@d19n/youfibre-odin-sdk 2.0.246 → 2.0.248

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.
package/README.md CHANGED
@@ -356,7 +356,7 @@ This SDK includes **168** entities across **12** modules.
356
356
 
357
357
  ## Actions
358
358
 
359
- This SDK includes **736** actions.
359
+ This SDK includes **737** actions.
360
360
 
361
361
  ### Action Types
362
362
 
@@ -1500,12 +1500,15 @@ This SDK includes **736** actions.
1500
1500
  | Action | Type | Event |
1501
1501
  |--------|------|-------|
1502
1502
  | `CreateModifyServiceRequest` | CREATE | k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Create.CreateModifyServiceRequest |
1503
+ | `MoveMsrToCancelled` | STAGE_TRANSITION | k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest |
1503
1504
  | `MoveMsrToComplete` | STAGE_TRANSITION | k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest |
1504
1505
  | `MoveMsrToFailed` | STAGE_TRANSITION | k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest |
1505
1506
  | `MoveMsrToHeld` | STAGE_TRANSITION | k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest |
1506
1507
  | `MoveMsrToInProgress` | STAGE_TRANSITION | k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest |
1507
1508
  | `UpdateModifyServiceRequest` | UPDATE | k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest |
1508
1509
 
1510
+ **MoveMsrToCancelled Target Stages:** `ModifyServiceRequestStateStageCancelled`
1511
+
1509
1512
  **MoveMsrToComplete Target Stages:** `ModifyServiceRequestStateStageCompleted`
1510
1513
 
1511
1514
  **MoveMsrToFailed Target Stages:** `ModifyServiceRequestStateStageFailed`
@@ -0,0 +1,209 @@
1
+ /**
2
+ * MoveMsrToCancelled Action DTO
3
+ *
4
+ * MoveMsrToCancelled
5
+ *
6
+ * @module ServiceModule
7
+ * @entity ModifyServiceRequest
8
+ * @entityType DEFAULT
9
+ * @actionKey MoveMsrToCancelled
10
+ * @event k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Transition.MoveMsrToCancelled
11
+ *
12
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
+ */
14
+ import { OdinRecord, OdinRecordUpdateDto, OdinRecordUpdatedEvent } from '@d19n/odin-types/dist/core';
15
+ /**
16
+ * Properties for UpdateModifyServiceRequest action
17
+ *
18
+ * @property Required fields: 0
19
+ * @property Optional fields: 7
20
+ */
21
+ export interface UpdateModifyServiceRequestProperties {
22
+ /**
23
+ * Service ID
24
+ *
25
+ * The ID of the service being modified
26
+ * @type {TEXT}
27
+ */
28
+ ServiceId?: string | null;
29
+ /**
30
+ * SKU Previous
31
+ *
32
+ * The previous SKU being modified from (Used for Line Profile mapping)
33
+ * @type {TEXT}
34
+ */
35
+ SkuPrevious?: string | null;
36
+ /**
37
+ * SKU Next
38
+ *
39
+ * The next SKU being modified to (Used for Line Profile mapping)
40
+ * @type {TEXT}
41
+ */
42
+ SkuNext?: string | null;
43
+ /**
44
+ * FNO Modify Status
45
+ *
46
+ * FNO Modify Status
47
+ * @type {ENUM}
48
+ */
49
+ FnoModifyStatus?: string | null;
50
+ /**
51
+ * FNO Comment
52
+ *
53
+ * FNO Comment
54
+ * @type {TEXT_LONG}
55
+ */
56
+ FnoComment?: string | null;
57
+ /**
58
+ * ISP Modify Status
59
+ *
60
+ * ISP Modify Status
61
+ * @type {ENUM}
62
+ */
63
+ IspModifyStatus?: string | null;
64
+ /**
65
+ * ISP Comment
66
+ *
67
+ * ISP Comment
68
+ * @type {TEXT_LONG}
69
+ */
70
+ IspComment?: string | null;
71
+ }
72
+ /**
73
+ * UpdateModifyServiceRequest
74
+ *
75
+ * @actionType UPDATE - Updates an existing ModifyServiceRequest record
76
+ * @module ServiceModule
77
+ * @entity ModifyServiceRequest
78
+ * @event k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest
79
+ * @permission schema.action.updatemodifyservicerequest.trigger
80
+ * @benchmark This action is tracked for performance benchmarks
81
+ */
82
+ export declare class UpdateModifyServiceRequestDto extends OdinRecordUpdateDto<UpdateModifyServiceRequestProperties> {
83
+ /** Used by SDK generators to identify action type */
84
+ static readonly ACTION_TYPE = "UPDATE";
85
+ static readonly ACTION_KEY = "UpdateModifyServiceRequest";
86
+ static readonly MODULE_NAME = "ServiceModule";
87
+ static readonly ENTITIES: string[];
88
+ static readonly EVENT_NAME = "k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest";
89
+ static readonly PERMISSION = "schema.action.updatemodifyservicerequest.trigger";
90
+ /** Step metadata - entity this action targets */
91
+ static readonly STEP_ENTITY = "ServiceModule:ModifyServiceRequest";
92
+ static readonly STEP_SCHEMA_ID = "e3ee21c4-f2bf-4931-867d-e02e70699221";
93
+ static readonly STEP_SCHEMA_ACTION_ID = "1065703e-e4d3-4010-bab0-4b0c08534c1d";
94
+ static readonly AUTO_LINK_PARENT = false;
95
+ readonly actionName: string;
96
+ readonly schemaActionId: string;
97
+ readonly entity: string;
98
+ constructor(record: OdinRecord<any> | {
99
+ id: string;
100
+ entity: string;
101
+ type?: string;
102
+ }, properties: UpdateModifyServiceRequestProperties, options?: {
103
+ journeyId?: string;
104
+ stageKey?: string;
105
+ });
106
+ }
107
+ declare type StepClassMap = {
108
+ UpdateModifyServiceRequestDto: UpdateModifyServiceRequestDto;
109
+ };
110
+ /**
111
+ * Link definition for connecting steps in MoveMsrToCancelled
112
+ */
113
+ export interface MoveMsrToCancelledStepLink {
114
+ /**
115
+ * The stepKey of the target step to link TO
116
+ * Must reference another step's stepKey in the same flow
117
+ */
118
+ stepKey: string;
119
+ /**
120
+ * The schema association ID (UUID) defining the relationship
121
+ * Use the association.id from the schema association definition
122
+ * @example "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
123
+ */
124
+ schemaAssociationId: string;
125
+ }
126
+ /**
127
+ * Step definition with linking metadata for MoveMsrToCancelled
128
+ */
129
+ export interface MoveMsrToCancelledStepDefinition {
130
+ /** Unique identifier for this step */
131
+ stepKey: string;
132
+ /** The DTO class name for this step */
133
+ dtoClass: string;
134
+ /** The entity this step creates (Module:Entity format) */
135
+ entity: string;
136
+ /** Links to create after this step executes */
137
+ linksTo: MoveMsrToCancelledStepLink[] | null;
138
+ }
139
+ /**
140
+ * Type-safe step keys for MoveMsrToCancelled
141
+ */
142
+ export declare const MoveMsrToCancelledSteps: {
143
+ readonly step_1: "step_1";
144
+ };
145
+ export declare type MoveMsrToCancelledStepKey = typeof MoveMsrToCancelledSteps[keyof typeof MoveMsrToCancelledSteps];
146
+ /**
147
+ * RabbitMQ message payload for MoveMsrToCancelled step flow events
148
+ *
149
+ * @event k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Transition.MoveMsrToCancelled
150
+ */
151
+ export interface MoveMsrToCancelledMessage extends OdinRecordUpdatedEvent<MoveMsrToCancelledDto, {}> {
152
+ }
153
+ /**
154
+ * Properties for MoveMsrToCancelled action
155
+ *
156
+ */
157
+ export interface MoveMsrToCancelledProperties {
158
+ }
159
+ /**
160
+ * MoveMsrToCancelled
161
+ *
162
+ * @actionType STAGE_TRANSITION - Transitions record to new pipeline stage
163
+ * @module ServiceModule
164
+ * @entity ModifyServiceRequest
165
+ * @entityType DEFAULT (Default)
166
+ * @targetStages ModifyServiceRequestStateStageCancelled
167
+ * @event k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Transition.MoveMsrToCancelled
168
+ * @permission schema.action.movemsrtocancelled.trigger
169
+ * @benchmark This action is tracked for performance benchmarks
170
+ */
171
+ export declare class MoveMsrToCancelledDto extends OdinRecordUpdateDto<Record<string, any>> {
172
+ /** Used by SDK generators to identify action type */
173
+ static readonly ACTION_TYPE = "UPDATE";
174
+ static readonly ACTION_KEY = "MoveMsrToCancelled";
175
+ static readonly MODULE_NAME = "ServiceModule";
176
+ static readonly ENTITIES: string[];
177
+ static readonly ENTITY_TYPE = "DEFAULT";
178
+ static readonly EVENT_NAME = "k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Transition.MoveMsrToCancelled";
179
+ static readonly SCHEMA_ACTION_ID = "7d70b973-7823-4625-bb7d-9c65aa9e0cfb";
180
+ static readonly PERMISSION = "schema.action.movemsrtocancelled.trigger";
181
+ static readonly TARGET_STAGES: readonly ["ModifyServiceRequestStateStageCancelled"];
182
+ static readonly IS_STAGE_TRANSITION = true;
183
+ static readonly IS_MULTI_STEP_FLOW = false;
184
+ static readonly HAS_STEP_LINKS = false;
185
+ /**
186
+ * Step definitions with linking metadata
187
+ * Used by SDK and backend for auto-linking after step execution
188
+ */
189
+ static readonly stepDefinitions: MoveMsrToCancelledStepDefinition[];
190
+ /** Type-safe step key accessor */
191
+ static readonly Steps: {
192
+ readonly step_1: "step_1";
193
+ };
194
+ readonly actionName: string;
195
+ readonly schemaActionId: string;
196
+ readonly entity: string;
197
+ readonly stageKey: string;
198
+ constructor(record: OdinRecord<any> | {
199
+ id: string;
200
+ entity: string;
201
+ type?: string;
202
+ }, options?: {
203
+ journeyId?: string;
204
+ });
205
+ /** Step classes that can be used with this action */
206
+ static readonly stepClasses: readonly ["UpdateModifyServiceRequestDto"];
207
+ steps: StepClassMap[(typeof MoveMsrToCancelledDto.stepClasses)[number]][];
208
+ }
209
+ export {};
@@ -0,0 +1,118 @@
1
+ "use strict";
2
+ /**
3
+ * MoveMsrToCancelled Action DTO
4
+ *
5
+ * MoveMsrToCancelled
6
+ *
7
+ * @module ServiceModule
8
+ * @entity ModifyServiceRequest
9
+ * @entityType DEFAULT
10
+ * @actionKey MoveMsrToCancelled
11
+ * @event k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Transition.MoveMsrToCancelled
12
+ *
13
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
14
+ */
15
+ Object.defineProperty(exports, "__esModule", { value: true });
16
+ exports.MoveMsrToCancelledDto = exports.MoveMsrToCancelledSteps = exports.UpdateModifyServiceRequestDto = void 0;
17
+ const core_1 = require("@d19n/odin-types/dist/core");
18
+ /**
19
+ * UpdateModifyServiceRequest
20
+ *
21
+ * @actionType UPDATE - Updates an existing ModifyServiceRequest record
22
+ * @module ServiceModule
23
+ * @entity ModifyServiceRequest
24
+ * @event k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest
25
+ * @permission schema.action.updatemodifyservicerequest.trigger
26
+ * @benchmark This action is tracked for performance benchmarks
27
+ */
28
+ class UpdateModifyServiceRequestDto extends core_1.OdinRecordUpdateDto {
29
+ constructor(record, properties, options) {
30
+ super({
31
+ id: record.id,
32
+ entity: record.entity,
33
+ type: record.type,
34
+ properties,
35
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
36
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
37
+ });
38
+ this.actionName = 'UpdateModifyServiceRequest';
39
+ this.schemaActionId = '1065703e-e4d3-4010-bab0-4b0c08534c1d';
40
+ this.entity = 'ServiceModule:ModifyServiceRequest';
41
+ }
42
+ }
43
+ exports.UpdateModifyServiceRequestDto = UpdateModifyServiceRequestDto;
44
+ /** Used by SDK generators to identify action type */
45
+ UpdateModifyServiceRequestDto.ACTION_TYPE = 'UPDATE';
46
+ UpdateModifyServiceRequestDto.ACTION_KEY = 'UpdateModifyServiceRequest';
47
+ UpdateModifyServiceRequestDto.MODULE_NAME = 'ServiceModule';
48
+ UpdateModifyServiceRequestDto.ENTITIES = ['ModifyServiceRequest'];
49
+ UpdateModifyServiceRequestDto.EVENT_NAME = 'k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Update.UpdateModifyServiceRequest';
50
+ UpdateModifyServiceRequestDto.PERMISSION = 'schema.action.updatemodifyservicerequest.trigger';
51
+ /** Step metadata - entity this action targets */
52
+ UpdateModifyServiceRequestDto.STEP_ENTITY = 'ServiceModule:ModifyServiceRequest';
53
+ UpdateModifyServiceRequestDto.STEP_SCHEMA_ID = 'e3ee21c4-f2bf-4931-867d-e02e70699221';
54
+ UpdateModifyServiceRequestDto.STEP_SCHEMA_ACTION_ID = '1065703e-e4d3-4010-bab0-4b0c08534c1d';
55
+ UpdateModifyServiceRequestDto.AUTO_LINK_PARENT = false;
56
+ /**
57
+ * Type-safe step keys for MoveMsrToCancelled
58
+ */
59
+ exports.MoveMsrToCancelledSteps = {
60
+ step_1: 'step_1',
61
+ };
62
+ /**
63
+ * MoveMsrToCancelled
64
+ *
65
+ * @actionType STAGE_TRANSITION - Transitions record to new pipeline stage
66
+ * @module ServiceModule
67
+ * @entity ModifyServiceRequest
68
+ * @entityType DEFAULT (Default)
69
+ * @targetStages ModifyServiceRequestStateStageCancelled
70
+ * @event k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Transition.MoveMsrToCancelled
71
+ * @permission schema.action.movemsrtocancelled.trigger
72
+ * @benchmark This action is tracked for performance benchmarks
73
+ */
74
+ class MoveMsrToCancelledDto extends core_1.OdinRecordUpdateDto {
75
+ constructor(record, options) {
76
+ super({
77
+ id: record.id,
78
+ entity: record.entity,
79
+ type: record.type,
80
+ properties: {},
81
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
82
+ });
83
+ this.actionName = 'MoveMsrToCancelled';
84
+ this.schemaActionId = '7d70b973-7823-4625-bb7d-9c65aa9e0cfb';
85
+ this.entity = 'ServiceModule:ModifyServiceRequest';
86
+ this.stageKey = 'ModifyServiceRequestStateStageCancelled';
87
+ }
88
+ }
89
+ exports.MoveMsrToCancelledDto = MoveMsrToCancelledDto;
90
+ /** Used by SDK generators to identify action type */
91
+ MoveMsrToCancelledDto.ACTION_TYPE = 'UPDATE';
92
+ MoveMsrToCancelledDto.ACTION_KEY = 'MoveMsrToCancelled';
93
+ MoveMsrToCancelledDto.MODULE_NAME = 'ServiceModule';
94
+ MoveMsrToCancelledDto.ENTITIES = ['ModifyServiceRequest'];
95
+ MoveMsrToCancelledDto.ENTITY_TYPE = 'DEFAULT';
96
+ MoveMsrToCancelledDto.EVENT_NAME = 'k1.t-hEOJjsDb.ServiceModule.ModifyServiceRequest.Transition.MoveMsrToCancelled';
97
+ MoveMsrToCancelledDto.SCHEMA_ACTION_ID = '7d70b973-7823-4625-bb7d-9c65aa9e0cfb';
98
+ MoveMsrToCancelledDto.PERMISSION = 'schema.action.movemsrtocancelled.trigger';
99
+ MoveMsrToCancelledDto.TARGET_STAGES = ['ModifyServiceRequestStateStageCancelled'];
100
+ MoveMsrToCancelledDto.IS_STAGE_TRANSITION = true;
101
+ MoveMsrToCancelledDto.IS_MULTI_STEP_FLOW = false;
102
+ MoveMsrToCancelledDto.HAS_STEP_LINKS = false;
103
+ /**
104
+ * Step definitions with linking metadata
105
+ * Used by SDK and backend for auto-linking after step execution
106
+ */
107
+ MoveMsrToCancelledDto.stepDefinitions = [
108
+ {
109
+ stepKey: 'step_1',
110
+ dtoClass: 'UpdateModifyServiceRequestDto',
111
+ entity: 'ServiceModule:ModifyServiceRequest',
112
+ linksTo: null
113
+ }
114
+ ];
115
+ /** Type-safe step key accessor */
116
+ MoveMsrToCancelledDto.Steps = exports.MoveMsrToCancelledSteps;
117
+ /** Step classes that can be used with this action */
118
+ MoveMsrToCancelledDto.stepClasses = ['UpdateModifyServiceRequestDto'];
@@ -24,7 +24,7 @@ import { IOdinProvider } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
24
24
  import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-manager';
25
25
  import { ModifyServiceRequestProperties } from '../entities-v2/ModifyServiceRequest';
26
26
  import { CreateModifyServiceRequestProperties } from '../actions-v2/CreateModifyServiceRequestDto';
27
- import { UpdateModifyServiceRequestProperties } from '../actions-v2/MoveMsrToCompleteDto';
27
+ import { UpdateModifyServiceRequestProperties } from '../actions-v2/MoveMsrToCancelledDto';
28
28
  import { OrderRecord } from './OrderRecord';
29
29
  import { OrderKciRecord } from './OrderKciRecord';
30
30
  /** Valid entity types for ModifyServiceRequest */
@@ -88,6 +88,68 @@ declare class ActionBuilder<T = IDbRecordCreateUpdateRes[]> {
88
88
  then(): never;
89
89
  }
90
90
  /** Options for a flow step */
91
+ export interface MoveMsrToCancelledFlowBuilderStepOptions {
92
+ /** Associations to create with this step */
93
+ associations?: Array<{
94
+ recordId?: string;
95
+ entity?: string;
96
+ }>;
97
+ /** Groups for this step */
98
+ groups?: string[];
99
+ }
100
+ /**
101
+ * FlowBuilder for MoveMsrToCancelled multi-step action
102
+ *
103
+ * Use method chaining to add steps, then call execute() to run the flow.
104
+ * Transitions to stage: ModifyServiceRequestStateStageCancelled
105
+ */
106
+ export declare class MoveMsrToCancelledFlowBuilder {
107
+ private _record;
108
+ private _provider;
109
+ private _pendingLinks;
110
+ private _options?;
111
+ private _groups;
112
+ private _steps;
113
+ constructor(record: ModifyServiceRequestRecord<any>, provider: IOdinProvider, pendingLinks: OdinRecordLinkDto[], options?: {
114
+ journeyId?: string;
115
+ });
116
+ /**
117
+ * Add a group to the main action
118
+ * @param group - Group name to add
119
+ * @returns this (for method chaining)
120
+ */
121
+ addGroup(group: string): this;
122
+ /**
123
+ * Add UpdateModifyServiceRequest step to the flow
124
+ * @param id - ID of the record to update
125
+ * @param properties - Properties for this step
126
+ * @param options - Optional step settings
127
+ * @returns this (for method chaining)
128
+ */
129
+ updateModifyServiceRequest(id: string, properties: UpdateModifyServiceRequestProperties, options?: MoveMsrToCancelledFlowBuilderStepOptions): this;
130
+ /**
131
+ * Execute the flow
132
+ * @returns The result from the API
133
+ */
134
+ execute(): Promise<IDbRecordCreateUpdateRes[]>;
135
+ /**
136
+ * Returns the request payload without executing (for debugging)
137
+ * @returns The request payload that would be sent to the API
138
+ */
139
+ dryRun(): Record<string, any>;
140
+ /**
141
+ * Prevents accidental `await flowBuilder` without .execute()
142
+ * Forces developers to explicitly call .execute()
143
+ * @throws Error always - use .execute() or .dryRun() instead
144
+ */
145
+ then(): never;
146
+ /**
147
+ * Build the request payload for the action
148
+ * @private
149
+ */
150
+ private _buildRequestPayload;
151
+ }
152
+ /** Options for a flow step */
91
153
  export interface MoveMsrToCompleteFlowBuilderStepOptions {
92
154
  /** Associations to create with this step */
93
155
  associations?: Array<{
@@ -495,6 +557,30 @@ export declare class ModifyServiceRequestRecord<TProps = ModifyServiceRequestPro
495
557
  journeyId?: string;
496
558
  stageKey?: string;
497
559
  }): ActionBuilder;
560
+ /**
561
+ * MoveMsrToCancelled
562
+ *
563
+ * Starts a stage transition flow on this ModifyServiceRequest record.
564
+ * Chain step methods and call .execute() to run the flow.
565
+ *
566
+ * @remarks Transitions to stage: ModifyServiceRequestStateStageCancelled
567
+ *
568
+ * @param options - Optional settings
569
+ * @param options.journeyId - Associate with a journey
570
+ * @returns FlowBuilder for chaining step methods
571
+ * @throws Error if called on a new (unsaved) record
572
+ *
573
+ * @example
574
+ * ```typescript
575
+ * const record = await odinClient.modifyServiceRequests.get(id);
576
+ * await record.moveMsrToCancelled()
577
+ * .updateModifyServiceRequest(recordId, { ... })
578
+ * .execute();
579
+ * ```
580
+ */
581
+ moveMsrToCancelled(options?: {
582
+ journeyId?: string;
583
+ }): MoveMsrToCancelledFlowBuilder;
498
584
  /**
499
585
  * MoveMsrToComplete
500
586
  *
@@ -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.isModifyServiceRequestRecord = exports.ModifyServiceRequestRecord = exports.MoveMsrToInProgressFlowBuilder = exports.MoveMsrToHeldFlowBuilder = exports.MoveMsrToFailedFlowBuilder = exports.MoveMsrToCompleteFlowBuilder = void 0;
31
+ exports.isModifyServiceRequestRecord = exports.ModifyServiceRequestRecord = exports.MoveMsrToInProgressFlowBuilder = exports.MoveMsrToHeldFlowBuilder = exports.MoveMsrToFailedFlowBuilder = exports.MoveMsrToCompleteFlowBuilder = exports.MoveMsrToCancelledFlowBuilder = 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");
@@ -110,6 +110,113 @@ class ActionBuilder {
110
110
  throw new Error('ActionBuilder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
111
111
  }
112
112
  }
113
+ /**
114
+ * FlowBuilder for MoveMsrToCancelled multi-step action
115
+ *
116
+ * Use method chaining to add steps, then call execute() to run the flow.
117
+ * Transitions to stage: ModifyServiceRequestStateStageCancelled
118
+ */
119
+ class MoveMsrToCancelledFlowBuilder {
120
+ constructor(record, provider, pendingLinks, options) {
121
+ this._groups = [];
122
+ this._steps = [];
123
+ this._record = record;
124
+ this._provider = provider;
125
+ this._pendingLinks = pendingLinks;
126
+ this._options = options;
127
+ }
128
+ /**
129
+ * Add a group to the main action
130
+ * @param group - Group name to add
131
+ * @returns this (for method chaining)
132
+ */
133
+ addGroup(group) {
134
+ this._groups.push(group);
135
+ return this;
136
+ }
137
+ /**
138
+ * Add UpdateModifyServiceRequest step to the flow
139
+ * @param id - ID of the record to update
140
+ * @param properties - Properties for this step
141
+ * @param options - Optional step settings
142
+ * @returns this (for method chaining)
143
+ */
144
+ updateModifyServiceRequest(id, properties, options) {
145
+ var _a;
146
+ this._steps.push({
147
+ actionName: 'UpdateModifyServiceRequest',
148
+ properties,
149
+ id,
150
+ entity: 'ServiceModule:ModifyServiceRequest',
151
+ autoLinkParent: false,
152
+ 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 }))),
153
+ groups: options === null || options === void 0 ? void 0 : options.groups,
154
+ });
155
+ return this;
156
+ }
157
+ /**
158
+ * Execute the flow
159
+ * @returns The result from the API
160
+ */
161
+ execute() {
162
+ return __awaiter(this, void 0, void 0, function* () {
163
+ const payload = this._buildRequestPayload();
164
+ const result = yield this._provider._applyAction('ServiceModule', 'ModifyServiceRequest', payload);
165
+ // Clear pending links on the record after execution
166
+ this._record.clearPendingLinks();
167
+ return result;
168
+ });
169
+ }
170
+ /**
171
+ * Returns the request payload without executing (for debugging)
172
+ * @returns The request payload that would be sent to the API
173
+ */
174
+ dryRun() {
175
+ return this._buildRequestPayload();
176
+ }
177
+ /**
178
+ * Prevents accidental `await flowBuilder` without .execute()
179
+ * Forces developers to explicitly call .execute()
180
+ * @throws Error always - use .execute() or .dryRun() instead
181
+ */
182
+ then() {
183
+ throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
184
+ }
185
+ /**
186
+ * Build the request payload for the action
187
+ * @private
188
+ */
189
+ _buildRequestPayload() {
190
+ const record = this._record.record;
191
+ if (!(record === null || record === void 0 ? void 0 : record.id))
192
+ throw new Error('Cannot execute flow on unsaved record');
193
+ // Build steps with parent associations
194
+ const stepsWithAssociations = this._steps.map(step => {
195
+ const stepAssociations = [...(step.associations || [])];
196
+ // Auto-add parent association if step requires it
197
+ if (step.autoLinkParent) {
198
+ stepAssociations.push({
199
+ entity: record.entity,
200
+ recordId: record.id,
201
+ linkType: null,
202
+ relationType: 'PARENT',
203
+ });
204
+ }
205
+ return {
206
+ entity: step.entity,
207
+ type: step.type,
208
+ actionName: step.actionName,
209
+ properties: step.properties,
210
+ title: step.title,
211
+ id: step.id,
212
+ associations: stepAssociations.length > 0 ? stepAssociations : undefined,
213
+ groups: step.groups,
214
+ };
215
+ });
216
+ return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'MoveMsrToCancelled', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined, stageKey: 'ModifyServiceRequestStateStageCancelled' }, this._options);
217
+ }
218
+ }
219
+ exports.MoveMsrToCancelledFlowBuilder = MoveMsrToCancelledFlowBuilder;
113
220
  /**
114
221
  * FlowBuilder for MoveMsrToComplete multi-step action
115
222
  *
@@ -765,6 +872,33 @@ class ModifyServiceRequestRecord {
765
872
  const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'UpdateModifyServiceRequest', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, opts);
766
873
  return new ActionBuilder(this._provider, 'ServiceModule', 'ModifyServiceRequest', payload, () => { this._pendingLinks = []; });
767
874
  }
875
+ /**
876
+ * MoveMsrToCancelled
877
+ *
878
+ * Starts a stage transition flow on this ModifyServiceRequest record.
879
+ * Chain step methods and call .execute() to run the flow.
880
+ *
881
+ * @remarks Transitions to stage: ModifyServiceRequestStateStageCancelled
882
+ *
883
+ * @param options - Optional settings
884
+ * @param options.journeyId - Associate with a journey
885
+ * @returns FlowBuilder for chaining step methods
886
+ * @throws Error if called on a new (unsaved) record
887
+ *
888
+ * @example
889
+ * ```typescript
890
+ * const record = await odinClient.modifyServiceRequests.get(id);
891
+ * await record.moveMsrToCancelled()
892
+ * .updateModifyServiceRequest(recordId, { ... })
893
+ * .execute();
894
+ * ```
895
+ */
896
+ moveMsrToCancelled(options) {
897
+ var _a;
898
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
899
+ throw new Error('moveMsrToCancelled requires an existing record. Use accessor.get() first.');
900
+ return new MoveMsrToCancelledFlowBuilder(this, this._provider, this._pendingLinks, options);
901
+ }
768
902
  /**
769
903
  * MoveMsrToComplete
770
904
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "2.0.246",
3
+ "version": "2.0.248",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",