@d19n/youfibre-odin-sdk 2.0.313 → 2.0.314

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.
Files changed (26) hide show
  1. package/README.md +8 -1
  2. package/dist/actions-v2/CreateEnRouteToScheduledChangeReasonDto.d.ts +88 -0
  3. package/dist/actions-v2/CreateEnRouteToScheduledChangeReasonDto.js +59 -0
  4. package/dist/actions-v2/MoveBusinessInstallFromEnRouteToScheduledDto.d.ts +186 -0
  5. package/dist/actions-v2/MoveBusinessInstallFromEnRouteToScheduledDto.js +124 -0
  6. package/dist/actions-v2/MoveInspectionWorkOrderFromEnRouteToScheduledDto.d.ts +186 -0
  7. package/dist/actions-v2/MoveInspectionWorkOrderFromEnRouteToScheduledDto.js +124 -0
  8. package/dist/actions-v2/MoveInstallWorkOrderFromEnRouteToScheduledDto.d.ts +186 -0
  9. package/dist/actions-v2/MoveInstallWorkOrderFromEnRouteToScheduledDto.js +124 -0
  10. package/dist/actions-v2/MovePrePullWorkOrderFromEnRouteToScheduledDto.d.ts +186 -0
  11. package/dist/actions-v2/MovePrePullWorkOrderFromEnRouteToScheduledDto.js +124 -0
  12. package/dist/actions-v2/MoveRemediationWorkOrderFromEnRouteToScheduledDto.d.ts +186 -0
  13. package/dist/actions-v2/MoveRemediationWorkOrderFromEnRouteToScheduledDto.js +124 -0
  14. package/dist/actions-v2/MoveServiceWorkOrderFromEnRouteToScheduledDto.d.ts +186 -0
  15. package/dist/actions-v2/MoveServiceWorkOrderFromEnRouteToScheduledDto.js +124 -0
  16. package/dist/entities-v2/ChangeReason.d.ts +53 -1
  17. package/dist/entities-v2/ChangeReason.js +19 -1
  18. package/dist/entities-v2/Config.d.ts +8 -8
  19. package/dist/entities-v2/Config.js +2 -2
  20. package/dist/entities-v2/WorkOrder.d.ts +2 -0
  21. package/dist/entities-v2/WorkOrder.js +2 -0
  22. package/dist/records-v2/ChangeReasonRecord.d.ts +29 -0
  23. package/dist/records-v2/ChangeReasonRecord.js +36 -0
  24. package/dist/records-v2/WorkOrderRecord.d.ts +517 -0
  25. package/dist/records-v2/WorkOrderRecord.js +943 -151
  26. package/package.json +1 -1
@@ -28,7 +28,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
28
28
  });
29
29
  };
30
30
  Object.defineProperty(exports, "__esModule", { value: true });
31
- exports.isWorkOrderRecord = exports.WorkOrderRecord = exports.RescheduleServiceWorkOrderTenantFlowBuilder = exports.RescheduleServiceWorkOrderSupplierFlowBuilder = exports.RescheduleRemediationWorkOrderSupplierFlowBuilder = exports.ReschedulePrePullWorkOrderSupplierFlowBuilder = exports.RescheduleInstallWorkOrderTenantFlowBuilder = exports.RescheduleInspectionWorkOrderSupplierFlowBuilder = exports.RescheduleCollectionWorkOrderTenantFlowBuilder = exports.RescheduleBusinessInstallWorkOrderTenantFlowBuilder = exports.RescheduleBusinessInstallWorkOrderSupplierFlowBuilder = exports.MoveServiceWorkOrderToRemediationFlowBuilder = exports.MoveServiceWorkOrderToInProgressSupplierFlowBuilder = exports.MoveServiceWorkOrderToInProgressSubstantialFlowBuilder = exports.MoveServiceWorkOrderToInProgressFlowBuilder = exports.MoveRemediationWorkOrderToRemediationFlowBuilder = exports.MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder = exports.MovePrePullWorkOrderToRemediationFlowBuilder = exports.MovePrePullWorkOrderToInProgressSubstantialFlowBuilder = exports.MovePrePullWorkOrderToInProgressFlowBuilder = exports.MoveInstallWorkOrderToInProgressSubstantialFlowBuilder = exports.MoveInstallWorkOrderToInProgressFlowBuilder = exports.MoveInstallWorkOrderFromScheduledToPendingFlowBuilder = exports.MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder = exports.MoveInspectionWorkOrderToInProgressFlowBuilder = exports.MoveCollectionWorkOrderFromReceivedToCompleteFlowBuilder = exports.MoveCollectionWorkOrderFromAcceptedToEnRouteFlowBuilder = exports.MoveBusinessInstallToRemediationFlowBuilder = exports.CreateWayleaveWorkOrderFlowFlowBuilder = exports.CreateLinkedWorkOrderFlowFlowBuilder = exports.CreateCollectionAmcoReplacementWorkOrderFromWorkOrderFlowBuilder = exports.CompleteServiceWorkOrderFlowFlowBuilder = exports.CompleteRemediationWorkOrderFlowFlowBuilder = exports.CompletePrePullWorkOrderFlowFlowBuilder = exports.CancelServiceWorkOrderFlowTenantFlowBuilder = exports.CancelRemediationWorkOrderSupplierFlowBuilder = exports.CancelPrePullWorkOrderFlowSupplierFlowBuilder = exports.CancelInstallWorkOrderFlowTenantFlowBuilder = void 0;
31
+ exports.isWorkOrderRecord = exports.WorkOrderRecord = exports.RescheduleServiceWorkOrderTenantFlowBuilder = exports.RescheduleServiceWorkOrderSupplierFlowBuilder = exports.RescheduleRemediationWorkOrderSupplierFlowBuilder = exports.ReschedulePrePullWorkOrderSupplierFlowBuilder = exports.RescheduleInstallWorkOrderTenantFlowBuilder = exports.RescheduleInspectionWorkOrderSupplierFlowBuilder = exports.RescheduleCollectionWorkOrderTenantFlowBuilder = exports.RescheduleBusinessInstallWorkOrderTenantFlowBuilder = exports.RescheduleBusinessInstallWorkOrderSupplierFlowBuilder = exports.MoveServiceWorkOrderToRemediationFlowBuilder = exports.MoveServiceWorkOrderToInProgressSupplierFlowBuilder = exports.MoveServiceWorkOrderToInProgressSubstantialFlowBuilder = exports.MoveServiceWorkOrderToInProgressFlowBuilder = exports.MoveServiceWorkOrderFromEnRouteToScheduledFlowBuilder = exports.MoveRemediationWorkOrderToRemediationFlowBuilder = exports.MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder = exports.MoveRemediationWorkOrderFromEnRouteToScheduledFlowBuilder = exports.MovePrePullWorkOrderToRemediationFlowBuilder = exports.MovePrePullWorkOrderToInProgressSubstantialFlowBuilder = exports.MovePrePullWorkOrderToInProgressFlowBuilder = exports.MovePrePullWorkOrderFromEnRouteToScheduledFlowBuilder = exports.MoveInstallWorkOrderToInProgressSubstantialFlowBuilder = exports.MoveInstallWorkOrderToInProgressFlowBuilder = exports.MoveInstallWorkOrderFromScheduledToPendingFlowBuilder = exports.MoveInstallWorkOrderFromEnRouteToScheduledFlowBuilder = exports.MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder = exports.MoveInspectionWorkOrderToInProgressFlowBuilder = exports.MoveInspectionWorkOrderFromEnRouteToScheduledFlowBuilder = exports.MoveCollectionWorkOrderFromReceivedToCompleteFlowBuilder = exports.MoveCollectionWorkOrderFromAcceptedToEnRouteFlowBuilder = exports.MoveBusinessInstallToRemediationFlowBuilder = exports.MoveBusinessInstallFromEnRouteToScheduledFlowBuilder = exports.CreateWayleaveWorkOrderFlowFlowBuilder = exports.CreateLinkedWorkOrderFlowFlowBuilder = exports.CreateCollectionAmcoReplacementWorkOrderFromWorkOrderFlowBuilder = exports.CompleteServiceWorkOrderFlowFlowBuilder = exports.CompleteRemediationWorkOrderFlowFlowBuilder = exports.CompletePrePullWorkOrderFlowFlowBuilder = exports.CancelServiceWorkOrderFlowTenantFlowBuilder = exports.CancelRemediationWorkOrderSupplierFlowBuilder = exports.CancelPrePullWorkOrderFlowSupplierFlowBuilder = exports.CancelInstallWorkOrderFlowTenantFlowBuilder = void 0;
32
32
  const uuid_1 = require("uuid");
33
33
  const core_1 = require("@d19n/odin-types/dist/core");
34
34
  const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
@@ -1430,6 +1430,111 @@ class CreateWayleaveWorkOrderFlowFlowBuilder {
1430
1430
  }
1431
1431
  }
1432
1432
  exports.CreateWayleaveWorkOrderFlowFlowBuilder = CreateWayleaveWorkOrderFlowFlowBuilder;
1433
+ /**
1434
+ * FlowBuilder for MoveBusinessInstallFromEnRouteToScheduled multi-step action
1435
+ *
1436
+ * Use method chaining to add steps, then call execute() to run the flow.
1437
+ * This is a CREATE flow - no existing record required.
1438
+ * Transitions to stage: BusinessInstallPipelineStageScheduled
1439
+ */
1440
+ class MoveBusinessInstallFromEnRouteToScheduledFlowBuilder {
1441
+ constructor(record, provider, pendingLinks, options) {
1442
+ this._groups = [];
1443
+ this._steps = [];
1444
+ this._record = record;
1445
+ this._provider = provider;
1446
+ this._pendingLinks = pendingLinks;
1447
+ this._options = options;
1448
+ }
1449
+ /**
1450
+ * Add a group to the main action
1451
+ * @param group - Group name to add
1452
+ * @returns this (for method chaining)
1453
+ */
1454
+ addGroup(group) {
1455
+ this._groups.push(group);
1456
+ return this;
1457
+ }
1458
+ /**
1459
+ * Add CreateEnRouteToScheduledChangeReason step to the flow
1460
+ * @param properties - Properties for this step
1461
+ * @param options - Optional step settings
1462
+ * @returns this (for method chaining)
1463
+ */
1464
+ createEnRouteToScheduledChangeReason(properties, options) {
1465
+ var _a;
1466
+ this._steps.push({
1467
+ actionName: 'CreateEnRouteToScheduledChangeReason',
1468
+ properties,
1469
+ entity: 'FieldServiceModule:ChangeReason',
1470
+ type: 'SA_DELAY',
1471
+ autoLinkParent: true,
1472
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
1473
+ groups: options === null || options === void 0 ? void 0 : options.groups,
1474
+ });
1475
+ return this;
1476
+ }
1477
+ /**
1478
+ * Execute the flow
1479
+ * @returns The result from the API
1480
+ */
1481
+ execute() {
1482
+ return __awaiter(this, void 0, void 0, function* () {
1483
+ const payload = this._buildRequestPayload();
1484
+ const result = yield this._provider._applyAction('FieldServiceModule', 'WorkOrder', payload);
1485
+ // Clear pending links on the record after execution
1486
+ this._record.clearPendingLinks();
1487
+ return result;
1488
+ });
1489
+ }
1490
+ /**
1491
+ * Returns the request payload without executing (for debugging)
1492
+ * @returns The request payload that would be sent to the API
1493
+ */
1494
+ dryRun() {
1495
+ return this._buildRequestPayload();
1496
+ }
1497
+ /**
1498
+ * Prevents accidental `await flowBuilder` without .execute()
1499
+ * Forces developers to explicitly call .execute()
1500
+ * @throws Error always - use .execute() or .dryRun() instead
1501
+ */
1502
+ then() {
1503
+ throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
1504
+ }
1505
+ /**
1506
+ * Build the request payload for the action
1507
+ * @private
1508
+ */
1509
+ _buildRequestPayload() {
1510
+ const record = this._record.record;
1511
+ // Build steps with parent associations
1512
+ const stepsWithAssociations = this._steps.map(step => {
1513
+ const stepAssociations = [...(step.associations || [])];
1514
+ // Auto-add parent association if step requires it and we have a parent record
1515
+ if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
1516
+ stepAssociations.push({
1517
+ entity: record.entity,
1518
+ recordId: record.id,
1519
+ linkType: null,
1520
+ relationType: 'PARENT',
1521
+ });
1522
+ }
1523
+ return {
1524
+ entity: step.entity,
1525
+ type: step.type,
1526
+ actionName: step.actionName,
1527
+ properties: step.properties,
1528
+ title: step.title,
1529
+ id: step.id,
1530
+ associations: stepAssociations.length > 0 ? stepAssociations : undefined,
1531
+ groups: step.groups,
1532
+ };
1533
+ });
1534
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveBusinessInstallFromEnRouteToScheduled', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'BusinessInstallPipelineStageScheduled' }), this._options);
1535
+ }
1536
+ }
1537
+ exports.MoveBusinessInstallFromEnRouteToScheduledFlowBuilder = MoveBusinessInstallFromEnRouteToScheduledFlowBuilder;
1433
1538
  /**
1434
1539
  * FlowBuilder for MoveBusinessInstallToRemediation multi-step action
1435
1540
  *
@@ -1770,12 +1875,13 @@ class MoveCollectionWorkOrderFromReceivedToCompleteFlowBuilder {
1770
1875
  }
1771
1876
  exports.MoveCollectionWorkOrderFromReceivedToCompleteFlowBuilder = MoveCollectionWorkOrderFromReceivedToCompleteFlowBuilder;
1772
1877
  /**
1773
- * FlowBuilder for MoveInspectionWorkOrderToInProgress multi-step action
1878
+ * FlowBuilder for MoveInspectionWorkOrderFromEnRouteToScheduled multi-step action
1774
1879
  *
1775
1880
  * Use method chaining to add steps, then call execute() to run the flow.
1776
- * Transitions to stage: WorkOrderStageInProgress
1881
+ * This is a CREATE flow - no existing record required.
1882
+ * Transitions to stage: WorkOrderStageScheduled
1777
1883
  */
1778
- class MoveInspectionWorkOrderToInProgressFlowBuilder {
1884
+ class MoveInspectionWorkOrderFromEnRouteToScheduledFlowBuilder {
1779
1885
  constructor(record, provider, pendingLinks, options) {
1780
1886
  this._groups = [];
1781
1887
  this._steps = [];
@@ -1794,20 +1900,19 @@ class MoveInspectionWorkOrderToInProgressFlowBuilder {
1794
1900
  return this;
1795
1901
  }
1796
1902
  /**
1797
- * Add InProgressWorkOrderConfirmation step to the flow
1798
- * @param id - ID of the record to update
1903
+ * Add CreateEnRouteToScheduledChangeReason step to the flow
1799
1904
  * @param properties - Properties for this step
1800
1905
  * @param options - Optional step settings
1801
1906
  * @returns this (for method chaining)
1802
1907
  */
1803
- inProgressWorkOrderConfirmation(id, properties, options) {
1908
+ createEnRouteToScheduledChangeReason(properties, options) {
1804
1909
  var _a;
1805
1910
  this._steps.push({
1806
- actionName: 'InProgressWorkOrderConfirmation',
1911
+ actionName: 'CreateEnRouteToScheduledChangeReason',
1807
1912
  properties,
1808
- id,
1809
- entity: 'FieldServiceModule:WorkOrder',
1810
- autoLinkParent: false,
1913
+ entity: 'FieldServiceModule:ChangeReason',
1914
+ type: 'SA_DELAY',
1915
+ autoLinkParent: true,
1811
1916
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
1812
1917
  groups: options === null || options === void 0 ? void 0 : options.groups,
1813
1918
  });
@@ -1847,13 +1952,11 @@ class MoveInspectionWorkOrderToInProgressFlowBuilder {
1847
1952
  */
1848
1953
  _buildRequestPayload() {
1849
1954
  const record = this._record.record;
1850
- if (!(record === null || record === void 0 ? void 0 : record.id))
1851
- throw new Error('Cannot execute flow on unsaved record');
1852
1955
  // Build steps with parent associations
1853
1956
  const stepsWithAssociations = this._steps.map(step => {
1854
1957
  const stepAssociations = [...(step.associations || [])];
1855
- // Auto-add parent association if step requires it
1856
- if (step.autoLinkParent) {
1958
+ // Auto-add parent association if step requires it and we have a parent record
1959
+ if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
1857
1960
  stepAssociations.push({
1858
1961
  entity: record.entity,
1859
1962
  recordId: record.id,
@@ -1872,18 +1975,17 @@ class MoveInspectionWorkOrderToInProgressFlowBuilder {
1872
1975
  groups: step.groups,
1873
1976
  };
1874
1977
  });
1875
- return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'MoveInspectionWorkOrderToInProgress', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }, this._options);
1978
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInspectionWorkOrderFromEnRouteToScheduled', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageScheduled' }), this._options);
1876
1979
  }
1877
1980
  }
1878
- exports.MoveInspectionWorkOrderToInProgressFlowBuilder = MoveInspectionWorkOrderToInProgressFlowBuilder;
1981
+ exports.MoveInspectionWorkOrderFromEnRouteToScheduledFlowBuilder = MoveInspectionWorkOrderFromEnRouteToScheduledFlowBuilder;
1879
1982
  /**
1880
- * FlowBuilder for MoveInspectionWorkOrderToInProgressSubstantial multi-step action
1983
+ * FlowBuilder for MoveInspectionWorkOrderToInProgress multi-step action
1881
1984
  *
1882
1985
  * Use method chaining to add steps, then call execute() to run the flow.
1883
- * This is a CREATE flow - no existing record required.
1884
1986
  * Transitions to stage: WorkOrderStageInProgress
1885
1987
  */
1886
- class MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder {
1988
+ class MoveInspectionWorkOrderToInProgressFlowBuilder {
1887
1989
  constructor(record, provider, pendingLinks, options) {
1888
1990
  this._groups = [];
1889
1991
  this._steps = [];
@@ -1902,19 +2004,20 @@ class MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder {
1902
2004
  return this;
1903
2005
  }
1904
2006
  /**
1905
- * Add CreateSsra step to the flow
2007
+ * Add InProgressWorkOrderConfirmation step to the flow
2008
+ * @param id - ID of the record to update
1906
2009
  * @param properties - Properties for this step
1907
2010
  * @param options - Optional step settings
1908
2011
  * @returns this (for method chaining)
1909
2012
  */
1910
- createSsra(properties, options) {
2013
+ inProgressWorkOrderConfirmation(id, properties, options) {
1911
2014
  var _a;
1912
2015
  this._steps.push({
1913
- actionName: 'CreateSsra',
2016
+ actionName: 'InProgressWorkOrderConfirmation',
1914
2017
  properties,
1915
- entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
1916
- type: 'OUTCOME_FORM',
1917
- autoLinkParent: true,
2018
+ id,
2019
+ entity: 'FieldServiceModule:WorkOrder',
2020
+ autoLinkParent: false,
1918
2021
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
1919
2022
  groups: options === null || options === void 0 ? void 0 : options.groups,
1920
2023
  });
@@ -1954,11 +2057,13 @@ class MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder {
1954
2057
  */
1955
2058
  _buildRequestPayload() {
1956
2059
  const record = this._record.record;
2060
+ if (!(record === null || record === void 0 ? void 0 : record.id))
2061
+ throw new Error('Cannot execute flow on unsaved record');
1957
2062
  // Build steps with parent associations
1958
2063
  const stepsWithAssociations = this._steps.map(step => {
1959
2064
  const stepAssociations = [...(step.associations || [])];
1960
- // Auto-add parent association if step requires it and we have a parent record
1961
- if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
2065
+ // Auto-add parent association if step requires it
2066
+ if (step.autoLinkParent) {
1962
2067
  stepAssociations.push({
1963
2068
  entity: record.entity,
1964
2069
  recordId: record.id,
@@ -1977,18 +2082,18 @@ class MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder {
1977
2082
  groups: step.groups,
1978
2083
  };
1979
2084
  });
1980
- return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInspectionWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
2085
+ return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'MoveInspectionWorkOrderToInProgress', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }, this._options);
1981
2086
  }
1982
2087
  }
1983
- exports.MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder = MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder;
2088
+ exports.MoveInspectionWorkOrderToInProgressFlowBuilder = MoveInspectionWorkOrderToInProgressFlowBuilder;
1984
2089
  /**
1985
- * FlowBuilder for MoveInstallWorkOrderFromScheduledToPending multi-step action
2090
+ * FlowBuilder for MoveInspectionWorkOrderToInProgressSubstantial multi-step action
1986
2091
  *
1987
2092
  * Use method chaining to add steps, then call execute() to run the flow.
1988
2093
  * This is a CREATE flow - no existing record required.
1989
- * Transitions to stage: CustomerWorkOrdersStagePending
2094
+ * Transitions to stage: WorkOrderStageInProgress
1990
2095
  */
1991
- class MoveInstallWorkOrderFromScheduledToPendingFlowBuilder {
2096
+ class MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder {
1992
2097
  constructor(record, provider, pendingLinks, options) {
1993
2098
  this._groups = [];
1994
2099
  this._steps = [];
@@ -2007,18 +2112,18 @@ class MoveInstallWorkOrderFromScheduledToPendingFlowBuilder {
2007
2112
  return this;
2008
2113
  }
2009
2114
  /**
2010
- * Add CreateInstallDelayedChangeReasonTenant step to the flow
2115
+ * Add CreateSsra step to the flow
2011
2116
  * @param properties - Properties for this step
2012
2117
  * @param options - Optional step settings
2013
2118
  * @returns this (for method chaining)
2014
2119
  */
2015
- createInstallDelayedChangeReasonTenant(properties, options) {
2120
+ createSsra(properties, options) {
2016
2121
  var _a;
2017
2122
  this._steps.push({
2018
- actionName: 'CreateInstallDelayedChangeReasonTenant',
2123
+ actionName: 'CreateSsra',
2019
2124
  properties,
2020
- entity: 'FieldServiceModule:ChangeReason',
2021
- type: 'SA_DELAY',
2125
+ entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
2126
+ type: 'OUTCOME_FORM',
2022
2127
  autoLinkParent: true,
2023
2128
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2024
2129
  groups: options === null || options === void 0 ? void 0 : options.groups,
@@ -2082,17 +2187,18 @@ class MoveInstallWorkOrderFromScheduledToPendingFlowBuilder {
2082
2187
  groups: step.groups,
2083
2188
  };
2084
2189
  });
2085
- return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInstallWorkOrderFromScheduledToPending', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'CustomerWorkOrdersStagePending' }), this._options);
2190
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInspectionWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
2086
2191
  }
2087
2192
  }
2088
- exports.MoveInstallWorkOrderFromScheduledToPendingFlowBuilder = MoveInstallWorkOrderFromScheduledToPendingFlowBuilder;
2193
+ exports.MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder = MoveInspectionWorkOrderToInProgressSubstantialFlowBuilder;
2089
2194
  /**
2090
- * FlowBuilder for MoveInstallWorkOrderToInProgress multi-step action
2195
+ * FlowBuilder for MoveInstallWorkOrderFromEnRouteToScheduled multi-step action
2091
2196
  *
2092
2197
  * Use method chaining to add steps, then call execute() to run the flow.
2093
- * Transitions to stage: WorkOrderStageInProgress
2198
+ * This is a CREATE flow - no existing record required.
2199
+ * Transitions to stage: WorkOrderStageScheduled
2094
2200
  */
2095
- class MoveInstallWorkOrderToInProgressFlowBuilder {
2201
+ class MoveInstallWorkOrderFromEnRouteToScheduledFlowBuilder {
2096
2202
  constructor(record, provider, pendingLinks, options) {
2097
2203
  this._groups = [];
2098
2204
  this._steps = [];
@@ -2111,20 +2217,19 @@ class MoveInstallWorkOrderToInProgressFlowBuilder {
2111
2217
  return this;
2112
2218
  }
2113
2219
  /**
2114
- * Add InProgressWorkOrderConfirmation step to the flow
2115
- * @param id - ID of the record to update
2220
+ * Add CreateEnRouteToScheduledChangeReason step to the flow
2116
2221
  * @param properties - Properties for this step
2117
2222
  * @param options - Optional step settings
2118
2223
  * @returns this (for method chaining)
2119
2224
  */
2120
- inProgressWorkOrderConfirmation(id, properties, options) {
2225
+ createEnRouteToScheduledChangeReason(properties, options) {
2121
2226
  var _a;
2122
2227
  this._steps.push({
2123
- actionName: 'InProgressWorkOrderConfirmation',
2228
+ actionName: 'CreateEnRouteToScheduledChangeReason',
2124
2229
  properties,
2125
- id,
2126
- entity: 'FieldServiceModule:WorkOrder',
2127
- autoLinkParent: false,
2230
+ entity: 'FieldServiceModule:ChangeReason',
2231
+ type: 'SA_DELAY',
2232
+ autoLinkParent: true,
2128
2233
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2129
2234
  groups: options === null || options === void 0 ? void 0 : options.groups,
2130
2235
  });
@@ -2164,13 +2269,11 @@ class MoveInstallWorkOrderToInProgressFlowBuilder {
2164
2269
  */
2165
2270
  _buildRequestPayload() {
2166
2271
  const record = this._record.record;
2167
- if (!(record === null || record === void 0 ? void 0 : record.id))
2168
- throw new Error('Cannot execute flow on unsaved record');
2169
2272
  // Build steps with parent associations
2170
2273
  const stepsWithAssociations = this._steps.map(step => {
2171
2274
  const stepAssociations = [...(step.associations || [])];
2172
- // Auto-add parent association if step requires it
2173
- if (step.autoLinkParent) {
2275
+ // Auto-add parent association if step requires it and we have a parent record
2276
+ if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
2174
2277
  stepAssociations.push({
2175
2278
  entity: record.entity,
2176
2279
  recordId: record.id,
@@ -2189,18 +2292,18 @@ class MoveInstallWorkOrderToInProgressFlowBuilder {
2189
2292
  groups: step.groups,
2190
2293
  };
2191
2294
  });
2192
- return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'MoveInstallWorkOrderToInProgress', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }, this._options);
2295
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInstallWorkOrderFromEnRouteToScheduled', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageScheduled' }), this._options);
2193
2296
  }
2194
2297
  }
2195
- exports.MoveInstallWorkOrderToInProgressFlowBuilder = MoveInstallWorkOrderToInProgressFlowBuilder;
2298
+ exports.MoveInstallWorkOrderFromEnRouteToScheduledFlowBuilder = MoveInstallWorkOrderFromEnRouteToScheduledFlowBuilder;
2196
2299
  /**
2197
- * FlowBuilder for MoveInstallWorkOrderToInProgressSubstantial multi-step action
2300
+ * FlowBuilder for MoveInstallWorkOrderFromScheduledToPending multi-step action
2198
2301
  *
2199
2302
  * Use method chaining to add steps, then call execute() to run the flow.
2200
2303
  * This is a CREATE flow - no existing record required.
2201
- * Transitions to stage: WorkOrderStageInProgress
2304
+ * Transitions to stage: CustomerWorkOrdersStagePending
2202
2305
  */
2203
- class MoveInstallWorkOrderToInProgressSubstantialFlowBuilder {
2306
+ class MoveInstallWorkOrderFromScheduledToPendingFlowBuilder {
2204
2307
  constructor(record, provider, pendingLinks, options) {
2205
2308
  this._groups = [];
2206
2309
  this._steps = [];
@@ -2219,18 +2322,18 @@ class MoveInstallWorkOrderToInProgressSubstantialFlowBuilder {
2219
2322
  return this;
2220
2323
  }
2221
2324
  /**
2222
- * Add CreateSsra step to the flow
2325
+ * Add CreateInstallDelayedChangeReasonTenant step to the flow
2223
2326
  * @param properties - Properties for this step
2224
2327
  * @param options - Optional step settings
2225
2328
  * @returns this (for method chaining)
2226
2329
  */
2227
- createSsra(properties, options) {
2330
+ createInstallDelayedChangeReasonTenant(properties, options) {
2228
2331
  var _a;
2229
2332
  this._steps.push({
2230
- actionName: 'CreateSsra',
2333
+ actionName: 'CreateInstallDelayedChangeReasonTenant',
2231
2334
  properties,
2232
- entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
2233
- type: 'OUTCOME_FORM',
2335
+ entity: 'FieldServiceModule:ChangeReason',
2336
+ type: 'SA_DELAY',
2234
2337
  autoLinkParent: true,
2235
2338
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2236
2339
  groups: options === null || options === void 0 ? void 0 : options.groups,
@@ -2294,17 +2397,17 @@ class MoveInstallWorkOrderToInProgressSubstantialFlowBuilder {
2294
2397
  groups: step.groups,
2295
2398
  };
2296
2399
  });
2297
- return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInstallWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
2400
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInstallWorkOrderFromScheduledToPending', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'CustomerWorkOrdersStagePending' }), this._options);
2298
2401
  }
2299
2402
  }
2300
- exports.MoveInstallWorkOrderToInProgressSubstantialFlowBuilder = MoveInstallWorkOrderToInProgressSubstantialFlowBuilder;
2403
+ exports.MoveInstallWorkOrderFromScheduledToPendingFlowBuilder = MoveInstallWorkOrderFromScheduledToPendingFlowBuilder;
2301
2404
  /**
2302
- * FlowBuilder for MovePrePullWorkOrderToInProgress multi-step action
2405
+ * FlowBuilder for MoveInstallWorkOrderToInProgress multi-step action
2303
2406
  *
2304
2407
  * Use method chaining to add steps, then call execute() to run the flow.
2305
2408
  * Transitions to stage: WorkOrderStageInProgress
2306
2409
  */
2307
- class MovePrePullWorkOrderToInProgressFlowBuilder {
2410
+ class MoveInstallWorkOrderToInProgressFlowBuilder {
2308
2411
  constructor(record, provider, pendingLinks, options) {
2309
2412
  this._groups = [];
2310
2413
  this._steps = [];
@@ -2334,9 +2437,556 @@ class MovePrePullWorkOrderToInProgressFlowBuilder {
2334
2437
  this._steps.push({
2335
2438
  actionName: 'InProgressWorkOrderConfirmation',
2336
2439
  properties,
2337
- id,
2338
- entity: 'FieldServiceModule:WorkOrder',
2339
- autoLinkParent: false,
2440
+ id,
2441
+ entity: 'FieldServiceModule:WorkOrder',
2442
+ autoLinkParent: false,
2443
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2444
+ groups: options === null || options === void 0 ? void 0 : options.groups,
2445
+ });
2446
+ return this;
2447
+ }
2448
+ /**
2449
+ * Execute the flow
2450
+ * @returns The result from the API
2451
+ */
2452
+ execute() {
2453
+ return __awaiter(this, void 0, void 0, function* () {
2454
+ const payload = this._buildRequestPayload();
2455
+ const result = yield this._provider._applyAction('FieldServiceModule', 'WorkOrder', payload);
2456
+ // Clear pending links on the record after execution
2457
+ this._record.clearPendingLinks();
2458
+ return result;
2459
+ });
2460
+ }
2461
+ /**
2462
+ * Returns the request payload without executing (for debugging)
2463
+ * @returns The request payload that would be sent to the API
2464
+ */
2465
+ dryRun() {
2466
+ return this._buildRequestPayload();
2467
+ }
2468
+ /**
2469
+ * Prevents accidental `await flowBuilder` without .execute()
2470
+ * Forces developers to explicitly call .execute()
2471
+ * @throws Error always - use .execute() or .dryRun() instead
2472
+ */
2473
+ then() {
2474
+ throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
2475
+ }
2476
+ /**
2477
+ * Build the request payload for the action
2478
+ * @private
2479
+ */
2480
+ _buildRequestPayload() {
2481
+ const record = this._record.record;
2482
+ if (!(record === null || record === void 0 ? void 0 : record.id))
2483
+ throw new Error('Cannot execute flow on unsaved record');
2484
+ // Build steps with parent associations
2485
+ const stepsWithAssociations = this._steps.map(step => {
2486
+ const stepAssociations = [...(step.associations || [])];
2487
+ // Auto-add parent association if step requires it
2488
+ if (step.autoLinkParent) {
2489
+ stepAssociations.push({
2490
+ entity: record.entity,
2491
+ recordId: record.id,
2492
+ linkType: null,
2493
+ relationType: 'PARENT',
2494
+ });
2495
+ }
2496
+ return {
2497
+ entity: step.entity,
2498
+ type: step.type,
2499
+ actionName: step.actionName,
2500
+ properties: step.properties,
2501
+ title: step.title,
2502
+ id: step.id,
2503
+ associations: stepAssociations.length > 0 ? stepAssociations : undefined,
2504
+ groups: step.groups,
2505
+ };
2506
+ });
2507
+ return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'MoveInstallWorkOrderToInProgress', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }, this._options);
2508
+ }
2509
+ }
2510
+ exports.MoveInstallWorkOrderToInProgressFlowBuilder = MoveInstallWorkOrderToInProgressFlowBuilder;
2511
+ /**
2512
+ * FlowBuilder for MoveInstallWorkOrderToInProgressSubstantial multi-step action
2513
+ *
2514
+ * Use method chaining to add steps, then call execute() to run the flow.
2515
+ * This is a CREATE flow - no existing record required.
2516
+ * Transitions to stage: WorkOrderStageInProgress
2517
+ */
2518
+ class MoveInstallWorkOrderToInProgressSubstantialFlowBuilder {
2519
+ constructor(record, provider, pendingLinks, options) {
2520
+ this._groups = [];
2521
+ this._steps = [];
2522
+ this._record = record;
2523
+ this._provider = provider;
2524
+ this._pendingLinks = pendingLinks;
2525
+ this._options = options;
2526
+ }
2527
+ /**
2528
+ * Add a group to the main action
2529
+ * @param group - Group name to add
2530
+ * @returns this (for method chaining)
2531
+ */
2532
+ addGroup(group) {
2533
+ this._groups.push(group);
2534
+ return this;
2535
+ }
2536
+ /**
2537
+ * Add CreateSsra step to the flow
2538
+ * @param properties - Properties for this step
2539
+ * @param options - Optional step settings
2540
+ * @returns this (for method chaining)
2541
+ */
2542
+ createSsra(properties, options) {
2543
+ var _a;
2544
+ this._steps.push({
2545
+ actionName: 'CreateSsra',
2546
+ properties,
2547
+ entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
2548
+ type: 'OUTCOME_FORM',
2549
+ autoLinkParent: true,
2550
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2551
+ groups: options === null || options === void 0 ? void 0 : options.groups,
2552
+ });
2553
+ return this;
2554
+ }
2555
+ /**
2556
+ * Execute the flow
2557
+ * @returns The result from the API
2558
+ */
2559
+ execute() {
2560
+ return __awaiter(this, void 0, void 0, function* () {
2561
+ const payload = this._buildRequestPayload();
2562
+ const result = yield this._provider._applyAction('FieldServiceModule', 'WorkOrder', payload);
2563
+ // Clear pending links on the record after execution
2564
+ this._record.clearPendingLinks();
2565
+ return result;
2566
+ });
2567
+ }
2568
+ /**
2569
+ * Returns the request payload without executing (for debugging)
2570
+ * @returns The request payload that would be sent to the API
2571
+ */
2572
+ dryRun() {
2573
+ return this._buildRequestPayload();
2574
+ }
2575
+ /**
2576
+ * Prevents accidental `await flowBuilder` without .execute()
2577
+ * Forces developers to explicitly call .execute()
2578
+ * @throws Error always - use .execute() or .dryRun() instead
2579
+ */
2580
+ then() {
2581
+ throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
2582
+ }
2583
+ /**
2584
+ * Build the request payload for the action
2585
+ * @private
2586
+ */
2587
+ _buildRequestPayload() {
2588
+ const record = this._record.record;
2589
+ // Build steps with parent associations
2590
+ const stepsWithAssociations = this._steps.map(step => {
2591
+ const stepAssociations = [...(step.associations || [])];
2592
+ // Auto-add parent association if step requires it and we have a parent record
2593
+ if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
2594
+ stepAssociations.push({
2595
+ entity: record.entity,
2596
+ recordId: record.id,
2597
+ linkType: null,
2598
+ relationType: 'PARENT',
2599
+ });
2600
+ }
2601
+ return {
2602
+ entity: step.entity,
2603
+ type: step.type,
2604
+ actionName: step.actionName,
2605
+ properties: step.properties,
2606
+ title: step.title,
2607
+ id: step.id,
2608
+ associations: stepAssociations.length > 0 ? stepAssociations : undefined,
2609
+ groups: step.groups,
2610
+ };
2611
+ });
2612
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveInstallWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
2613
+ }
2614
+ }
2615
+ exports.MoveInstallWorkOrderToInProgressSubstantialFlowBuilder = MoveInstallWorkOrderToInProgressSubstantialFlowBuilder;
2616
+ /**
2617
+ * FlowBuilder for MovePrePullWorkOrderFromEnRouteToScheduled multi-step action
2618
+ *
2619
+ * Use method chaining to add steps, then call execute() to run the flow.
2620
+ * This is a CREATE flow - no existing record required.
2621
+ * Transitions to stage: WorkOrderStageScheduled
2622
+ */
2623
+ class MovePrePullWorkOrderFromEnRouteToScheduledFlowBuilder {
2624
+ constructor(record, provider, pendingLinks, options) {
2625
+ this._groups = [];
2626
+ this._steps = [];
2627
+ this._record = record;
2628
+ this._provider = provider;
2629
+ this._pendingLinks = pendingLinks;
2630
+ this._options = options;
2631
+ }
2632
+ /**
2633
+ * Add a group to the main action
2634
+ * @param group - Group name to add
2635
+ * @returns this (for method chaining)
2636
+ */
2637
+ addGroup(group) {
2638
+ this._groups.push(group);
2639
+ return this;
2640
+ }
2641
+ /**
2642
+ * Add CreateEnRouteToScheduledChangeReason step to the flow
2643
+ * @param properties - Properties for this step
2644
+ * @param options - Optional step settings
2645
+ * @returns this (for method chaining)
2646
+ */
2647
+ createEnRouteToScheduledChangeReason(properties, options) {
2648
+ var _a;
2649
+ this._steps.push({
2650
+ actionName: 'CreateEnRouteToScheduledChangeReason',
2651
+ properties,
2652
+ entity: 'FieldServiceModule:ChangeReason',
2653
+ type: 'SA_DELAY',
2654
+ autoLinkParent: true,
2655
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2656
+ groups: options === null || options === void 0 ? void 0 : options.groups,
2657
+ });
2658
+ return this;
2659
+ }
2660
+ /**
2661
+ * Execute the flow
2662
+ * @returns The result from the API
2663
+ */
2664
+ execute() {
2665
+ return __awaiter(this, void 0, void 0, function* () {
2666
+ const payload = this._buildRequestPayload();
2667
+ const result = yield this._provider._applyAction('FieldServiceModule', 'WorkOrder', payload);
2668
+ // Clear pending links on the record after execution
2669
+ this._record.clearPendingLinks();
2670
+ return result;
2671
+ });
2672
+ }
2673
+ /**
2674
+ * Returns the request payload without executing (for debugging)
2675
+ * @returns The request payload that would be sent to the API
2676
+ */
2677
+ dryRun() {
2678
+ return this._buildRequestPayload();
2679
+ }
2680
+ /**
2681
+ * Prevents accidental `await flowBuilder` without .execute()
2682
+ * Forces developers to explicitly call .execute()
2683
+ * @throws Error always - use .execute() or .dryRun() instead
2684
+ */
2685
+ then() {
2686
+ throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
2687
+ }
2688
+ /**
2689
+ * Build the request payload for the action
2690
+ * @private
2691
+ */
2692
+ _buildRequestPayload() {
2693
+ const record = this._record.record;
2694
+ // Build steps with parent associations
2695
+ const stepsWithAssociations = this._steps.map(step => {
2696
+ const stepAssociations = [...(step.associations || [])];
2697
+ // Auto-add parent association if step requires it and we have a parent record
2698
+ if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
2699
+ stepAssociations.push({
2700
+ entity: record.entity,
2701
+ recordId: record.id,
2702
+ linkType: null,
2703
+ relationType: 'PARENT',
2704
+ });
2705
+ }
2706
+ return {
2707
+ entity: step.entity,
2708
+ type: step.type,
2709
+ actionName: step.actionName,
2710
+ properties: step.properties,
2711
+ title: step.title,
2712
+ id: step.id,
2713
+ associations: stepAssociations.length > 0 ? stepAssociations : undefined,
2714
+ groups: step.groups,
2715
+ };
2716
+ });
2717
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MovePrePullWorkOrderFromEnRouteToScheduled', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageScheduled' }), this._options);
2718
+ }
2719
+ }
2720
+ exports.MovePrePullWorkOrderFromEnRouteToScheduledFlowBuilder = MovePrePullWorkOrderFromEnRouteToScheduledFlowBuilder;
2721
+ /**
2722
+ * FlowBuilder for MovePrePullWorkOrderToInProgress multi-step action
2723
+ *
2724
+ * Use method chaining to add steps, then call execute() to run the flow.
2725
+ * Transitions to stage: WorkOrderStageInProgress
2726
+ */
2727
+ class MovePrePullWorkOrderToInProgressFlowBuilder {
2728
+ constructor(record, provider, pendingLinks, options) {
2729
+ this._groups = [];
2730
+ this._steps = [];
2731
+ this._record = record;
2732
+ this._provider = provider;
2733
+ this._pendingLinks = pendingLinks;
2734
+ this._options = options;
2735
+ }
2736
+ /**
2737
+ * Add a group to the main action
2738
+ * @param group - Group name to add
2739
+ * @returns this (for method chaining)
2740
+ */
2741
+ addGroup(group) {
2742
+ this._groups.push(group);
2743
+ return this;
2744
+ }
2745
+ /**
2746
+ * Add InProgressWorkOrderConfirmation step to the flow
2747
+ * @param id - ID of the record to update
2748
+ * @param properties - Properties for this step
2749
+ * @param options - Optional step settings
2750
+ * @returns this (for method chaining)
2751
+ */
2752
+ inProgressWorkOrderConfirmation(id, properties, options) {
2753
+ var _a;
2754
+ this._steps.push({
2755
+ actionName: 'InProgressWorkOrderConfirmation',
2756
+ properties,
2757
+ id,
2758
+ entity: 'FieldServiceModule:WorkOrder',
2759
+ autoLinkParent: false,
2760
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2761
+ groups: options === null || options === void 0 ? void 0 : options.groups,
2762
+ });
2763
+ return this;
2764
+ }
2765
+ /**
2766
+ * Execute the flow
2767
+ * @returns The result from the API
2768
+ */
2769
+ execute() {
2770
+ return __awaiter(this, void 0, void 0, function* () {
2771
+ const payload = this._buildRequestPayload();
2772
+ const result = yield this._provider._applyAction('FieldServiceModule', 'WorkOrder', payload);
2773
+ // Clear pending links on the record after execution
2774
+ this._record.clearPendingLinks();
2775
+ return result;
2776
+ });
2777
+ }
2778
+ /**
2779
+ * Returns the request payload without executing (for debugging)
2780
+ * @returns The request payload that would be sent to the API
2781
+ */
2782
+ dryRun() {
2783
+ return this._buildRequestPayload();
2784
+ }
2785
+ /**
2786
+ * Prevents accidental `await flowBuilder` without .execute()
2787
+ * Forces developers to explicitly call .execute()
2788
+ * @throws Error always - use .execute() or .dryRun() instead
2789
+ */
2790
+ then() {
2791
+ throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
2792
+ }
2793
+ /**
2794
+ * Build the request payload for the action
2795
+ * @private
2796
+ */
2797
+ _buildRequestPayload() {
2798
+ const record = this._record.record;
2799
+ if (!(record === null || record === void 0 ? void 0 : record.id))
2800
+ throw new Error('Cannot execute flow on unsaved record');
2801
+ // Build steps with parent associations
2802
+ const stepsWithAssociations = this._steps.map(step => {
2803
+ const stepAssociations = [...(step.associations || [])];
2804
+ // Auto-add parent association if step requires it
2805
+ if (step.autoLinkParent) {
2806
+ stepAssociations.push({
2807
+ entity: record.entity,
2808
+ recordId: record.id,
2809
+ linkType: null,
2810
+ relationType: 'PARENT',
2811
+ });
2812
+ }
2813
+ return {
2814
+ entity: step.entity,
2815
+ type: step.type,
2816
+ actionName: step.actionName,
2817
+ properties: step.properties,
2818
+ title: step.title,
2819
+ id: step.id,
2820
+ associations: stepAssociations.length > 0 ? stepAssociations : undefined,
2821
+ groups: step.groups,
2822
+ };
2823
+ });
2824
+ return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'MovePrePullWorkOrderToInProgress', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }, this._options);
2825
+ }
2826
+ }
2827
+ exports.MovePrePullWorkOrderToInProgressFlowBuilder = MovePrePullWorkOrderToInProgressFlowBuilder;
2828
+ /**
2829
+ * FlowBuilder for MovePrePullWorkOrderToInProgressSubstantial multi-step action
2830
+ *
2831
+ * Use method chaining to add steps, then call execute() to run the flow.
2832
+ * This is a CREATE flow - no existing record required.
2833
+ * Transitions to stage: WorkOrderStageInProgress
2834
+ */
2835
+ class MovePrePullWorkOrderToInProgressSubstantialFlowBuilder {
2836
+ constructor(record, provider, pendingLinks, options) {
2837
+ this._groups = [];
2838
+ this._steps = [];
2839
+ this._record = record;
2840
+ this._provider = provider;
2841
+ this._pendingLinks = pendingLinks;
2842
+ this._options = options;
2843
+ }
2844
+ /**
2845
+ * Add a group to the main action
2846
+ * @param group - Group name to add
2847
+ * @returns this (for method chaining)
2848
+ */
2849
+ addGroup(group) {
2850
+ this._groups.push(group);
2851
+ return this;
2852
+ }
2853
+ /**
2854
+ * Add CreateSsra step to the flow
2855
+ * @param properties - Properties for this step
2856
+ * @param options - Optional step settings
2857
+ * @returns this (for method chaining)
2858
+ */
2859
+ createSsra(properties, options) {
2860
+ var _a;
2861
+ this._steps.push({
2862
+ actionName: 'CreateSsra',
2863
+ properties,
2864
+ entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
2865
+ type: 'OUTCOME_FORM',
2866
+ autoLinkParent: true,
2867
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2868
+ groups: options === null || options === void 0 ? void 0 : options.groups,
2869
+ });
2870
+ return this;
2871
+ }
2872
+ /**
2873
+ * Execute the flow
2874
+ * @returns The result from the API
2875
+ */
2876
+ execute() {
2877
+ return __awaiter(this, void 0, void 0, function* () {
2878
+ const payload = this._buildRequestPayload();
2879
+ const result = yield this._provider._applyAction('FieldServiceModule', 'WorkOrder', payload);
2880
+ // Clear pending links on the record after execution
2881
+ this._record.clearPendingLinks();
2882
+ return result;
2883
+ });
2884
+ }
2885
+ /**
2886
+ * Returns the request payload without executing (for debugging)
2887
+ * @returns The request payload that would be sent to the API
2888
+ */
2889
+ dryRun() {
2890
+ return this._buildRequestPayload();
2891
+ }
2892
+ /**
2893
+ * Prevents accidental `await flowBuilder` without .execute()
2894
+ * Forces developers to explicitly call .execute()
2895
+ * @throws Error always - use .execute() or .dryRun() instead
2896
+ */
2897
+ then() {
2898
+ throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
2899
+ }
2900
+ /**
2901
+ * Build the request payload for the action
2902
+ * @private
2903
+ */
2904
+ _buildRequestPayload() {
2905
+ const record = this._record.record;
2906
+ // Build steps with parent associations
2907
+ const stepsWithAssociations = this._steps.map(step => {
2908
+ const stepAssociations = [...(step.associations || [])];
2909
+ // Auto-add parent association if step requires it and we have a parent record
2910
+ if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
2911
+ stepAssociations.push({
2912
+ entity: record.entity,
2913
+ recordId: record.id,
2914
+ linkType: null,
2915
+ relationType: 'PARENT',
2916
+ });
2917
+ }
2918
+ return {
2919
+ entity: step.entity,
2920
+ type: step.type,
2921
+ actionName: step.actionName,
2922
+ properties: step.properties,
2923
+ title: step.title,
2924
+ id: step.id,
2925
+ associations: stepAssociations.length > 0 ? stepAssociations : undefined,
2926
+ groups: step.groups,
2927
+ };
2928
+ });
2929
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MovePrePullWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
2930
+ }
2931
+ }
2932
+ exports.MovePrePullWorkOrderToInProgressSubstantialFlowBuilder = MovePrePullWorkOrderToInProgressSubstantialFlowBuilder;
2933
+ /**
2934
+ * FlowBuilder for MovePrePullWorkOrderToRemediation multi-step action
2935
+ *
2936
+ * Use method chaining to add steps, then call execute() to run the flow.
2937
+ * This is a CREATE flow - no existing record required.
2938
+ * Transitions to stage: WorkOrderRemediationRequired
2939
+ */
2940
+ class MovePrePullWorkOrderToRemediationFlowBuilder {
2941
+ constructor(record, provider, pendingLinks, options) {
2942
+ this._groups = [];
2943
+ this._steps = [];
2944
+ this._record = record;
2945
+ this._provider = provider;
2946
+ this._pendingLinks = pendingLinks;
2947
+ this._options = options;
2948
+ }
2949
+ /**
2950
+ * Add a group to the main action
2951
+ * @param group - Group name to add
2952
+ * @returns this (for method chaining)
2953
+ */
2954
+ addGroup(group) {
2955
+ this._groups.push(group);
2956
+ return this;
2957
+ }
2958
+ /**
2959
+ * Add CreatePermissionToFail step to the flow
2960
+ * @param properties - Properties for this step
2961
+ * @param options - Optional step settings
2962
+ * @returns this (for method chaining)
2963
+ */
2964
+ createPermissionToFail(properties, options) {
2965
+ var _a;
2966
+ this._steps.push({
2967
+ actionName: 'CreatePermissionToFail',
2968
+ properties,
2969
+ entity: 'FieldServiceModule:PermissionToFail',
2970
+ autoLinkParent: true,
2971
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2972
+ groups: options === null || options === void 0 ? void 0 : options.groups,
2973
+ });
2974
+ return this;
2975
+ }
2976
+ /**
2977
+ * Add RemediationRequiredReasonCreate step to the flow
2978
+ * @param properties - Properties for this step
2979
+ * @param options - Optional step settings
2980
+ * @returns this (for method chaining)
2981
+ */
2982
+ remediationRequiredReasonCreate(properties, options) {
2983
+ var _a;
2984
+ this._steps.push({
2985
+ actionName: 'RemediationRequiredReasonCreate',
2986
+ properties,
2987
+ entity: 'FieldServiceModule:RemediationRequiredReason',
2988
+ type: 'OUTCOME_FORM',
2989
+ autoLinkParent: true,
2340
2990
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2341
2991
  groups: options === null || options === void 0 ? void 0 : options.groups,
2342
2992
  });
@@ -2376,13 +3026,11 @@ class MovePrePullWorkOrderToInProgressFlowBuilder {
2376
3026
  */
2377
3027
  _buildRequestPayload() {
2378
3028
  const record = this._record.record;
2379
- if (!(record === null || record === void 0 ? void 0 : record.id))
2380
- throw new Error('Cannot execute flow on unsaved record');
2381
3029
  // Build steps with parent associations
2382
3030
  const stepsWithAssociations = this._steps.map(step => {
2383
3031
  const stepAssociations = [...(step.associations || [])];
2384
- // Auto-add parent association if step requires it
2385
- if (step.autoLinkParent) {
3032
+ // Auto-add parent association if step requires it and we have a parent record
3033
+ if (step.autoLinkParent && (record === null || record === void 0 ? void 0 : record.id)) {
2386
3034
  stepAssociations.push({
2387
3035
  entity: record.entity,
2388
3036
  recordId: record.id,
@@ -2401,18 +3049,18 @@ class MovePrePullWorkOrderToInProgressFlowBuilder {
2401
3049
  groups: step.groups,
2402
3050
  };
2403
3051
  });
2404
- return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'MovePrePullWorkOrderToInProgress', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }, this._options);
3052
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MovePrePullWorkOrderToRemediation', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderRemediationRequired' }), this._options);
2405
3053
  }
2406
3054
  }
2407
- exports.MovePrePullWorkOrderToInProgressFlowBuilder = MovePrePullWorkOrderToInProgressFlowBuilder;
3055
+ exports.MovePrePullWorkOrderToRemediationFlowBuilder = MovePrePullWorkOrderToRemediationFlowBuilder;
2408
3056
  /**
2409
- * FlowBuilder for MovePrePullWorkOrderToInProgressSubstantial multi-step action
3057
+ * FlowBuilder for MoveRemediationWorkOrderFromEnRouteToScheduled multi-step action
2410
3058
  *
2411
3059
  * Use method chaining to add steps, then call execute() to run the flow.
2412
3060
  * This is a CREATE flow - no existing record required.
2413
- * Transitions to stage: WorkOrderStageInProgress
3061
+ * Transitions to stage: WorkOrderStageScheduled
2414
3062
  */
2415
- class MovePrePullWorkOrderToInProgressSubstantialFlowBuilder {
3063
+ class MoveRemediationWorkOrderFromEnRouteToScheduledFlowBuilder {
2416
3064
  constructor(record, provider, pendingLinks, options) {
2417
3065
  this._groups = [];
2418
3066
  this._steps = [];
@@ -2431,18 +3079,18 @@ class MovePrePullWorkOrderToInProgressSubstantialFlowBuilder {
2431
3079
  return this;
2432
3080
  }
2433
3081
  /**
2434
- * Add CreateSsra step to the flow
3082
+ * Add CreateEnRouteToScheduledChangeReason step to the flow
2435
3083
  * @param properties - Properties for this step
2436
3084
  * @param options - Optional step settings
2437
3085
  * @returns this (for method chaining)
2438
3086
  */
2439
- createSsra(properties, options) {
3087
+ createEnRouteToScheduledChangeReason(properties, options) {
2440
3088
  var _a;
2441
3089
  this._steps.push({
2442
- actionName: 'CreateSsra',
3090
+ actionName: 'CreateEnRouteToScheduledChangeReason',
2443
3091
  properties,
2444
- entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
2445
- type: 'OUTCOME_FORM',
3092
+ entity: 'FieldServiceModule:ChangeReason',
3093
+ type: 'SA_DELAY',
2446
3094
  autoLinkParent: true,
2447
3095
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2448
3096
  groups: options === null || options === void 0 ? void 0 : options.groups,
@@ -2506,18 +3154,18 @@ class MovePrePullWorkOrderToInProgressSubstantialFlowBuilder {
2506
3154
  groups: step.groups,
2507
3155
  };
2508
3156
  });
2509
- return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MovePrePullWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
3157
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveRemediationWorkOrderFromEnRouteToScheduled', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageScheduled' }), this._options);
2510
3158
  }
2511
3159
  }
2512
- exports.MovePrePullWorkOrderToInProgressSubstantialFlowBuilder = MovePrePullWorkOrderToInProgressSubstantialFlowBuilder;
3160
+ exports.MoveRemediationWorkOrderFromEnRouteToScheduledFlowBuilder = MoveRemediationWorkOrderFromEnRouteToScheduledFlowBuilder;
2513
3161
  /**
2514
- * FlowBuilder for MovePrePullWorkOrderToRemediation multi-step action
3162
+ * FlowBuilder for MoveRemediationWorkOrderToInProgressSubstantial multi-step action
2515
3163
  *
2516
3164
  * Use method chaining to add steps, then call execute() to run the flow.
2517
3165
  * This is a CREATE flow - no existing record required.
2518
- * Transitions to stage: WorkOrderRemediationRequired
3166
+ * Transitions to stage: WorkOrderStageInProgress
2519
3167
  */
2520
- class MovePrePullWorkOrderToRemediationFlowBuilder {
3168
+ class MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder {
2521
3169
  constructor(record, provider, pendingLinks, options) {
2522
3170
  this._groups = [];
2523
3171
  this._steps = [];
@@ -2536,35 +3184,17 @@ class MovePrePullWorkOrderToRemediationFlowBuilder {
2536
3184
  return this;
2537
3185
  }
2538
3186
  /**
2539
- * Add CreatePermissionToFail step to the flow
2540
- * @param properties - Properties for this step
2541
- * @param options - Optional step settings
2542
- * @returns this (for method chaining)
2543
- */
2544
- createPermissionToFail(properties, options) {
2545
- var _a;
2546
- this._steps.push({
2547
- actionName: 'CreatePermissionToFail',
2548
- properties,
2549
- entity: 'FieldServiceModule:PermissionToFail',
2550
- autoLinkParent: true,
2551
- associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2552
- groups: options === null || options === void 0 ? void 0 : options.groups,
2553
- });
2554
- return this;
2555
- }
2556
- /**
2557
- * Add RemediationRequiredReasonCreate step to the flow
3187
+ * Add CreateSsra step to the flow
2558
3188
  * @param properties - Properties for this step
2559
3189
  * @param options - Optional step settings
2560
3190
  * @returns this (for method chaining)
2561
3191
  */
2562
- remediationRequiredReasonCreate(properties, options) {
3192
+ createSsra(properties, options) {
2563
3193
  var _a;
2564
3194
  this._steps.push({
2565
- actionName: 'RemediationRequiredReasonCreate',
3195
+ actionName: 'CreateSsra',
2566
3196
  properties,
2567
- entity: 'FieldServiceModule:RemediationRequiredReason',
3197
+ entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
2568
3198
  type: 'OUTCOME_FORM',
2569
3199
  autoLinkParent: true,
2570
3200
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
@@ -2629,18 +3259,18 @@ class MovePrePullWorkOrderToRemediationFlowBuilder {
2629
3259
  groups: step.groups,
2630
3260
  };
2631
3261
  });
2632
- return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MovePrePullWorkOrderToRemediation', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderRemediationRequired' }), this._options);
3262
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveRemediationWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
2633
3263
  }
2634
3264
  }
2635
- exports.MovePrePullWorkOrderToRemediationFlowBuilder = MovePrePullWorkOrderToRemediationFlowBuilder;
3265
+ exports.MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder = MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder;
2636
3266
  /**
2637
- * FlowBuilder for MoveRemediationWorkOrderToInProgressSubstantial multi-step action
3267
+ * FlowBuilder for MoveRemediationWorkOrderToRemediation multi-step action
2638
3268
  *
2639
3269
  * Use method chaining to add steps, then call execute() to run the flow.
2640
3270
  * This is a CREATE flow - no existing record required.
2641
- * Transitions to stage: WorkOrderStageInProgress
3271
+ * Transitions to stage: WorkOrderRemediationRequired
2642
3272
  */
2643
- class MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder {
3273
+ class MoveRemediationWorkOrderToRemediationFlowBuilder {
2644
3274
  constructor(record, provider, pendingLinks, options) {
2645
3275
  this._groups = [];
2646
3276
  this._steps = [];
@@ -2659,17 +3289,35 @@ class MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder {
2659
3289
  return this;
2660
3290
  }
2661
3291
  /**
2662
- * Add CreateSsra step to the flow
3292
+ * Add CreatePermissionToFail step to the flow
2663
3293
  * @param properties - Properties for this step
2664
3294
  * @param options - Optional step settings
2665
3295
  * @returns this (for method chaining)
2666
3296
  */
2667
- createSsra(properties, options) {
3297
+ createPermissionToFail(properties, options) {
2668
3298
  var _a;
2669
3299
  this._steps.push({
2670
- actionName: 'CreateSsra',
3300
+ actionName: 'CreatePermissionToFail',
2671
3301
  properties,
2672
- entity: 'FieldServiceModule:SiteSpecificRiskAssessmentOutcomeForm',
3302
+ entity: 'FieldServiceModule:PermissionToFail',
3303
+ autoLinkParent: true,
3304
+ associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
3305
+ groups: options === null || options === void 0 ? void 0 : options.groups,
3306
+ });
3307
+ return this;
3308
+ }
3309
+ /**
3310
+ * Add RemediationRequiredReasonCreate step to the flow
3311
+ * @param properties - Properties for this step
3312
+ * @param options - Optional step settings
3313
+ * @returns this (for method chaining)
3314
+ */
3315
+ remediationRequiredReasonCreate(properties, options) {
3316
+ var _a;
3317
+ this._steps.push({
3318
+ actionName: 'RemediationRequiredReasonCreate',
3319
+ properties,
3320
+ entity: 'FieldServiceModule:RemediationRequiredReason',
2673
3321
  type: 'OUTCOME_FORM',
2674
3322
  autoLinkParent: true,
2675
3323
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
@@ -2734,18 +3382,18 @@ class MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder {
2734
3382
  groups: step.groups,
2735
3383
  };
2736
3384
  });
2737
- return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveRemediationWorkOrderToInProgressSubstantial', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageInProgress' }), this._options);
3385
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveRemediationWorkOrderToRemediation', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderRemediationRequired' }), this._options);
2738
3386
  }
2739
3387
  }
2740
- exports.MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder = MoveRemediationWorkOrderToInProgressSubstantialFlowBuilder;
3388
+ exports.MoveRemediationWorkOrderToRemediationFlowBuilder = MoveRemediationWorkOrderToRemediationFlowBuilder;
2741
3389
  /**
2742
- * FlowBuilder for MoveRemediationWorkOrderToRemediation multi-step action
3390
+ * FlowBuilder for MoveServiceWorkOrderFromEnRouteToScheduled multi-step action
2743
3391
  *
2744
3392
  * Use method chaining to add steps, then call execute() to run the flow.
2745
3393
  * This is a CREATE flow - no existing record required.
2746
- * Transitions to stage: WorkOrderRemediationRequired
3394
+ * Transitions to stage: WorkOrderStageScheduled
2747
3395
  */
2748
- class MoveRemediationWorkOrderToRemediationFlowBuilder {
3396
+ class MoveServiceWorkOrderFromEnRouteToScheduledFlowBuilder {
2749
3397
  constructor(record, provider, pendingLinks, options) {
2750
3398
  this._groups = [];
2751
3399
  this._steps = [];
@@ -2764,36 +3412,18 @@ class MoveRemediationWorkOrderToRemediationFlowBuilder {
2764
3412
  return this;
2765
3413
  }
2766
3414
  /**
2767
- * Add CreatePermissionToFail step to the flow
2768
- * @param properties - Properties for this step
2769
- * @param options - Optional step settings
2770
- * @returns this (for method chaining)
2771
- */
2772
- createPermissionToFail(properties, options) {
2773
- var _a;
2774
- this._steps.push({
2775
- actionName: 'CreatePermissionToFail',
2776
- properties,
2777
- entity: 'FieldServiceModule:PermissionToFail',
2778
- autoLinkParent: true,
2779
- associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2780
- groups: options === null || options === void 0 ? void 0 : options.groups,
2781
- });
2782
- return this;
2783
- }
2784
- /**
2785
- * Add RemediationRequiredReasonCreate step to the flow
3415
+ * Add CreateEnRouteToScheduledChangeReason step to the flow
2786
3416
  * @param properties - Properties for this step
2787
3417
  * @param options - Optional step settings
2788
3418
  * @returns this (for method chaining)
2789
3419
  */
2790
- remediationRequiredReasonCreate(properties, options) {
3420
+ createEnRouteToScheduledChangeReason(properties, options) {
2791
3421
  var _a;
2792
3422
  this._steps.push({
2793
- actionName: 'RemediationRequiredReasonCreate',
3423
+ actionName: 'CreateEnRouteToScheduledChangeReason',
2794
3424
  properties,
2795
- entity: 'FieldServiceModule:RemediationRequiredReason',
2796
- type: 'OUTCOME_FORM',
3425
+ entity: 'FieldServiceModule:ChangeReason',
3426
+ type: 'SA_DELAY',
2797
3427
  autoLinkParent: true,
2798
3428
  associations: (_a = options === null || options === void 0 ? void 0 : options.associations) === null || _a === void 0 ? void 0 : _a.map(a => (Object.assign(Object.assign({}, a), { linkType: null, relationType: undefined }))),
2799
3429
  groups: options === null || options === void 0 ? void 0 : options.groups,
@@ -2857,10 +3487,10 @@ class MoveRemediationWorkOrderToRemediationFlowBuilder {
2857
3487
  groups: step.groups,
2858
3488
  };
2859
3489
  });
2860
- return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveRemediationWorkOrderToRemediation', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderRemediationRequired' }), this._options);
3490
+ return Object.assign(Object.assign(Object.assign({}, ((record === null || record === void 0 ? void 0 : record.id) && { id: record.id })), { entity: 'FieldServiceModule:WorkOrder', actionName: 'MoveServiceWorkOrderFromEnRouteToScheduled', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'WorkOrderStageScheduled' }), this._options);
2861
3491
  }
2862
3492
  }
2863
- exports.MoveRemediationWorkOrderToRemediationFlowBuilder = MoveRemediationWorkOrderToRemediationFlowBuilder;
3493
+ exports.MoveServiceWorkOrderFromEnRouteToScheduledFlowBuilder = MoveServiceWorkOrderFromEnRouteToScheduledFlowBuilder;
2864
3494
  /**
2865
3495
  * FlowBuilder for MoveServiceWorkOrderToInProgress multi-step action
2866
3496
  *
@@ -7563,6 +8193,33 @@ class WorkOrderRecord {
7563
8193
  const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MoveBusinessInstallFromEnRouteToPending', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'BusinessInstallPipelineStagePending' }, options);
7564
8194
  return new ActionBuilder(this._provider, 'FieldServiceModule', 'WorkOrder', payload, () => { this._pendingLinks = []; });
7565
8195
  }
8196
+ /**
8197
+ * MoveBusinessInstallFromEnRouteToScheduled
8198
+ *
8199
+ * Starts a stage transition flow on this WorkOrder record.
8200
+ * Chain step methods and call .execute() to run the flow.
8201
+ *
8202
+ * @remarks Transitions to stage: BusinessInstallPipelineStageScheduled
8203
+ *
8204
+ * @param options - Optional settings
8205
+ * @param options.journeyId - Associate with a journey
8206
+ * @returns FlowBuilder for chaining step methods
8207
+ * @throws Error if called on a new (unsaved) record
8208
+ *
8209
+ * @example
8210
+ * ```typescript
8211
+ * const record = await odinClient.workOrders.get(id);
8212
+ * await record.moveBusinessInstallFromEnRouteToScheduled()
8213
+ * .createEnRouteToScheduledChangeReason({ ... })
8214
+ * .execute();
8215
+ * ```
8216
+ */
8217
+ moveBusinessInstallFromEnRouteToScheduled(options) {
8218
+ var _a;
8219
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
8220
+ throw new Error('moveBusinessInstallFromEnRouteToScheduled requires an existing record. Use accessor.get() first.');
8221
+ return new MoveBusinessInstallFromEnRouteToScheduledFlowBuilder(this, this._provider, this._pendingLinks, options);
8222
+ }
7566
8223
  /**
7567
8224
  * MoveBusinessInstallFromInProgressToPending
7568
8225
  *
@@ -8660,6 +9317,33 @@ class WorkOrderRecord {
8660
9317
  const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MoveFinanceWorkOrderToPurchaseOrder', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'FinancePipelineStagePurchaseOrder' }, options);
8661
9318
  return new ActionBuilder(this._provider, 'FieldServiceModule', 'WorkOrder', payload, () => { this._pendingLinks = []; });
8662
9319
  }
9320
+ /**
9321
+ * MoveInspectionWorkOrderFromEnRouteToScheduled
9322
+ *
9323
+ * Starts a stage transition flow on this WorkOrder record.
9324
+ * Chain step methods and call .execute() to run the flow.
9325
+ *
9326
+ * @remarks Transitions to stage: WorkOrderStageScheduled
9327
+ *
9328
+ * @param options - Optional settings
9329
+ * @param options.journeyId - Associate with a journey
9330
+ * @returns FlowBuilder for chaining step methods
9331
+ * @throws Error if called on a new (unsaved) record
9332
+ *
9333
+ * @example
9334
+ * ```typescript
9335
+ * const record = await odinClient.workOrders.get(id);
9336
+ * await record.moveInspectionWorkOrderFromEnRouteToScheduled()
9337
+ * .createEnRouteToScheduledChangeReason({ ... })
9338
+ * .execute();
9339
+ * ```
9340
+ */
9341
+ moveInspectionWorkOrderFromEnRouteToScheduled(options) {
9342
+ var _a;
9343
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
9344
+ throw new Error('moveInspectionWorkOrderFromEnRouteToScheduled requires an existing record. Use accessor.get() first.');
9345
+ return new MoveInspectionWorkOrderFromEnRouteToScheduledFlowBuilder(this, this._provider, this._pendingLinks, options);
9346
+ }
8663
9347
  /**
8664
9348
  * MoveInspectionWorkOrderToCancelled
8665
9349
  *
@@ -8859,6 +9543,33 @@ class WorkOrderRecord {
8859
9543
  const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MoveInstallWorkOrderFromEnRouteToPending', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'CustomerWorkOrdersStagePending' }, options);
8860
9544
  return new ActionBuilder(this._provider, 'FieldServiceModule', 'WorkOrder', payload, () => { this._pendingLinks = []; });
8861
9545
  }
9546
+ /**
9547
+ * MoveInstallWorkOrderFromEnRouteToScheduled
9548
+ *
9549
+ * Starts a stage transition flow on this WorkOrder record.
9550
+ * Chain step methods and call .execute() to run the flow.
9551
+ *
9552
+ * @remarks Transitions to stage: WorkOrderStageScheduled
9553
+ *
9554
+ * @param options - Optional settings
9555
+ * @param options.journeyId - Associate with a journey
9556
+ * @returns FlowBuilder for chaining step methods
9557
+ * @throws Error if called on a new (unsaved) record
9558
+ *
9559
+ * @example
9560
+ * ```typescript
9561
+ * const record = await odinClient.workOrders.get(id);
9562
+ * await record.moveInstallWorkOrderFromEnRouteToScheduled()
9563
+ * .createEnRouteToScheduledChangeReason({ ... })
9564
+ * .execute();
9565
+ * ```
9566
+ */
9567
+ moveInstallWorkOrderFromEnRouteToScheduled(options) {
9568
+ var _a;
9569
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
9570
+ throw new Error('moveInstallWorkOrderFromEnRouteToScheduled requires an existing record. Use accessor.get() first.');
9571
+ return new MoveInstallWorkOrderFromEnRouteToScheduledFlowBuilder(this, this._provider, this._pendingLinks, options);
9572
+ }
8862
9573
  /**
8863
9574
  * MoveInstallWorkOrderFromInProgressToComplete
8864
9575
  *
@@ -9491,6 +10202,33 @@ class WorkOrderRecord {
9491
10202
  const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MovePlanningWorkOrderToOnHold', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'PlanningPipelineStageOnHold' }, options);
9492
10203
  return new ActionBuilder(this._provider, 'FieldServiceModule', 'WorkOrder', payload, () => { this._pendingLinks = []; });
9493
10204
  }
10205
+ /**
10206
+ * MovePrePullWorkOrderFromEnRouteToScheduled
10207
+ *
10208
+ * Starts a stage transition flow on this WorkOrder record.
10209
+ * Chain step methods and call .execute() to run the flow.
10210
+ *
10211
+ * @remarks Transitions to stage: WorkOrderStageScheduled
10212
+ *
10213
+ * @param options - Optional settings
10214
+ * @param options.journeyId - Associate with a journey
10215
+ * @returns FlowBuilder for chaining step methods
10216
+ * @throws Error if called on a new (unsaved) record
10217
+ *
10218
+ * @example
10219
+ * ```typescript
10220
+ * const record = await odinClient.workOrders.get(id);
10221
+ * await record.movePrePullWorkOrderFromEnRouteToScheduled()
10222
+ * .createEnRouteToScheduledChangeReason({ ... })
10223
+ * .execute();
10224
+ * ```
10225
+ */
10226
+ movePrePullWorkOrderFromEnRouteToScheduled(options) {
10227
+ var _a;
10228
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
10229
+ throw new Error('movePrePullWorkOrderFromEnRouteToScheduled requires an existing record. Use accessor.get() first.');
10230
+ return new MovePrePullWorkOrderFromEnRouteToScheduledFlowBuilder(this, this._provider, this._pendingLinks, options);
10231
+ }
9494
10232
  /**
9495
10233
  * MovePrePullWorkOrderToEnRoute
9496
10234
  *
@@ -9602,6 +10340,33 @@ class WorkOrderRecord {
9602
10340
  throw new Error('movePrePullWorkOrderToRemediation requires an existing record. Use accessor.get() first.');
9603
10341
  return new MovePrePullWorkOrderToRemediationFlowBuilder(this, this._provider, this._pendingLinks, options);
9604
10342
  }
10343
+ /**
10344
+ * MoveRemediationWorkOrderFromEnRouteToScheduled
10345
+ *
10346
+ * Starts a stage transition flow on this WorkOrder record.
10347
+ * Chain step methods and call .execute() to run the flow.
10348
+ *
10349
+ * @remarks Transitions to stage: WorkOrderStageScheduled
10350
+ *
10351
+ * @param options - Optional settings
10352
+ * @param options.journeyId - Associate with a journey
10353
+ * @returns FlowBuilder for chaining step methods
10354
+ * @throws Error if called on a new (unsaved) record
10355
+ *
10356
+ * @example
10357
+ * ```typescript
10358
+ * const record = await odinClient.workOrders.get(id);
10359
+ * await record.moveRemediationWorkOrderFromEnRouteToScheduled()
10360
+ * .createEnRouteToScheduledChangeReason({ ... })
10361
+ * .execute();
10362
+ * ```
10363
+ */
10364
+ moveRemediationWorkOrderFromEnRouteToScheduled(options) {
10365
+ var _a;
10366
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
10367
+ throw new Error('moveRemediationWorkOrderFromEnRouteToScheduled requires an existing record. Use accessor.get() first.');
10368
+ return new MoveRemediationWorkOrderFromEnRouteToScheduledFlowBuilder(this, this._provider, this._pendingLinks, options);
10369
+ }
9605
10370
  /**
9606
10371
  * MoveRemediationWorkOrderToEnRoute
9607
10372
  *
@@ -10150,6 +10915,33 @@ class WorkOrderRecord {
10150
10915
  const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MoveServiceWorkOrderFromEnRouteToPendingSupplier', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'CustomerWorkOrdersStagePending' }, options);
10151
10916
  return new ActionBuilder(this._provider, 'FieldServiceModule', 'WorkOrder', payload, () => { this._pendingLinks = []; });
10152
10917
  }
10918
+ /**
10919
+ * MoveServiceWorkOrderFromEnRouteToScheduled
10920
+ *
10921
+ * Starts a stage transition flow on this WorkOrder record.
10922
+ * Chain step methods and call .execute() to run the flow.
10923
+ *
10924
+ * @remarks Transitions to stage: WorkOrderStageScheduled
10925
+ *
10926
+ * @param options - Optional settings
10927
+ * @param options.journeyId - Associate with a journey
10928
+ * @returns FlowBuilder for chaining step methods
10929
+ * @throws Error if called on a new (unsaved) record
10930
+ *
10931
+ * @example
10932
+ * ```typescript
10933
+ * const record = await odinClient.workOrders.get(id);
10934
+ * await record.moveServiceWorkOrderFromEnRouteToScheduled()
10935
+ * .createEnRouteToScheduledChangeReason({ ... })
10936
+ * .execute();
10937
+ * ```
10938
+ */
10939
+ moveServiceWorkOrderFromEnRouteToScheduled(options) {
10940
+ var _a;
10941
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
10942
+ throw new Error('moveServiceWorkOrderFromEnRouteToScheduled requires an existing record. Use accessor.get() first.');
10943
+ return new MoveServiceWorkOrderFromEnRouteToScheduledFlowBuilder(this, this._provider, this._pendingLinks, options);
10944
+ }
10153
10945
  /**
10154
10946
  * MoveServiceWorkOrderFromInProgressToPending
10155
10947
  *