@d19n/youfibre-odin-sdk 2.0.46 → 2.0.47
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 +14 -3
- package/dist/actions-v2/AssignCaseTransitionDto.d.ts +141 -2
- package/dist/actions-v2/AssignCaseTransitionDto.js +90 -4
- package/dist/actions-v2/CaseDefaultStageEscalatedDto.d.ts +152 -19
- package/dist/actions-v2/CaseDefaultStageEscalatedDto.js +101 -23
- package/dist/actions-v2/CrmDatasetCreateDto.d.ts +8 -1
- package/dist/actions-v2/EscalateCaseActionBrskDto.d.ts +91 -0
- package/dist/actions-v2/EscalateCaseActionBrskDto.js +56 -0
- package/dist/actions-v2/EscalateCaseActionYfDto.d.ts +82 -0
- package/dist/actions-v2/EscalateCaseActionYfDto.js +56 -0
- package/dist/actions-v2/EscalateCaseActionYfcsDto.d.ts +89 -0
- package/dist/actions-v2/EscalateCaseActionYfcsDto.js +56 -0
- package/dist/actions-v2/UpdateExternalServiceIdDto.d.ts +73 -0
- package/dist/actions-v2/UpdateExternalServiceIdDto.js +56 -0
- package/dist/actions-v2/UpdateTeamDto.d.ts +3 -3
- package/dist/api-sdk-v2/CrmDatasetApi.d.ts +2 -0
- package/dist/api-sdk-v2/CrmDatasetApi.js +6 -0
- package/dist/api-sdk-v2/ExchangeApi.d.ts +2 -0
- package/dist/api-sdk-v2/ExchangeApi.js +6 -0
- package/dist/db-sdk-v2/CrmDatasetDb.d.ts +2 -0
- package/dist/db-sdk-v2/CrmDatasetDb.js +6 -0
- package/dist/db-sdk-v2/ExchangeDb.d.ts +2 -0
- package/dist/db-sdk-v2/ExchangeDb.js +6 -0
- package/dist/entities-v2/Address.d.ts +8 -1
- package/dist/entities-v2/Address.js +2 -0
- package/dist/entities-v2/Config.d.ts +8 -8
- package/dist/entities-v2/Config.js +4 -4
- package/dist/entities-v2/CreditNote.d.ts +20 -20
- package/dist/entities-v2/CreditNote.js +6 -6
- package/dist/entities-v2/CrmDataset.d.ts +3 -4
- package/dist/entities-v2/Exchange.d.ts +7 -0
- package/dist/entities-v2/Exchange.js +5 -1
- package/dist/entities-v2/Team.d.ts +12 -10
- package/dist/entities-v2/Team.js +13 -11
- package/dist/records-v2/AddressRecord.d.ts +27 -0
- package/dist/records-v2/AddressRecord.js +29 -0
- package/dist/records-v2/CaseRecord.d.ts +207 -13
- package/dist/records-v2/CaseRecord.js +312 -16
- package/dist/records-v2/CrmDatasetRecord.d.ts +20 -0
- package/dist/records-v2/CrmDatasetRecord.js +33 -0
- package/dist/records-v2/ExchangeRecord.d.ts +20 -0
- package/dist/records-v2/ExchangeRecord.js +33 -0
- 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.isCaseRecord = exports.CaseRecord = exports.MoveDefaultCaseFromOpenToClosedFlowBuilder = exports.MoveCaseToPendingReviewTransitionFlowBuilder = exports.MoveCaseToBlockedTransitionFlowBuilder = exports.EscalateCaseTransitionFlowBuilder = exports.CasedefaultstageblockedFlowBuilder = exports.CaseDefaultStageSolvedFlowBuilder = exports.CaseDefaultStageEscalatedFlowBuilder = exports.AssignCaseWithNoteFlowFlowBuilder = void 0;
|
|
31
|
+
exports.isCaseRecord = exports.CaseRecord = exports.MoveDefaultCaseFromOpenToClosedFlowBuilder = exports.MoveCaseToPendingReviewTransitionFlowBuilder = exports.MoveCaseToBlockedTransitionFlowBuilder = exports.EscalateCaseTransitionFlowBuilder = exports.CasedefaultstageblockedFlowBuilder = exports.CaseDefaultStageSolvedFlowBuilder = exports.CaseDefaultStageEscalatedFlowBuilder = exports.AssignCaseWithNoteFlowFlowBuilder = exports.AssignCaseTransitionFlowBuilder = 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");
|
|
@@ -125,6 +125,133 @@ class ActionBuilder {
|
|
|
125
125
|
throw new Error('ActionBuilder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* FlowBuilder for AssignCaseTransition multi-step action
|
|
130
|
+
*
|
|
131
|
+
* Use method chaining to add steps, then call execute() to run the flow.
|
|
132
|
+
*/
|
|
133
|
+
class AssignCaseTransitionFlowBuilder {
|
|
134
|
+
constructor(record, provider, pendingLinks, options) {
|
|
135
|
+
this._groups = [];
|
|
136
|
+
this._steps = [];
|
|
137
|
+
this._record = record;
|
|
138
|
+
this._provider = provider;
|
|
139
|
+
this._pendingLinks = pendingLinks;
|
|
140
|
+
this._options = options;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Add a group to the main action
|
|
144
|
+
* @param group - Group name to add
|
|
145
|
+
* @returns this (for method chaining)
|
|
146
|
+
*/
|
|
147
|
+
addGroup(group) {
|
|
148
|
+
this._groups.push(group);
|
|
149
|
+
return this;
|
|
150
|
+
}
|
|
151
|
+
/**
|
|
152
|
+
* Add AssignCase step to the flow
|
|
153
|
+
* @param id - ID of the record to update
|
|
154
|
+
* @param properties - Properties for this step
|
|
155
|
+
* @param options - Optional step settings
|
|
156
|
+
* @returns this (for method chaining)
|
|
157
|
+
*/
|
|
158
|
+
assignCase(id, properties, options) {
|
|
159
|
+
var _a;
|
|
160
|
+
this._steps.push({
|
|
161
|
+
actionName: 'AssignCase',
|
|
162
|
+
properties,
|
|
163
|
+
id,
|
|
164
|
+
entity: 'SupportModule:Case',
|
|
165
|
+
type: 'DEFAULT',
|
|
166
|
+
autoLinkParent: false,
|
|
167
|
+
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 }))),
|
|
168
|
+
groups: options === null || options === void 0 ? void 0 : options.groups,
|
|
169
|
+
});
|
|
170
|
+
return this;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Add EscalateCaseActionBrsk step to the flow
|
|
174
|
+
* @param id - ID of the record to update
|
|
175
|
+
* @param properties - Properties for this step
|
|
176
|
+
* @param options - Optional step settings
|
|
177
|
+
* @returns this (for method chaining)
|
|
178
|
+
*/
|
|
179
|
+
escalateCaseActionBrsk(id, properties, options) {
|
|
180
|
+
var _a;
|
|
181
|
+
this._steps.push({
|
|
182
|
+
actionName: 'EscalateCaseActionBrsk',
|
|
183
|
+
properties,
|
|
184
|
+
id,
|
|
185
|
+
entity: 'SupportModule:Case',
|
|
186
|
+
autoLinkParent: false,
|
|
187
|
+
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 }))),
|
|
188
|
+
groups: options === null || options === void 0 ? void 0 : options.groups,
|
|
189
|
+
});
|
|
190
|
+
return this;
|
|
191
|
+
}
|
|
192
|
+
/**
|
|
193
|
+
* Execute the flow
|
|
194
|
+
* @returns The result from the API
|
|
195
|
+
*/
|
|
196
|
+
execute() {
|
|
197
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
198
|
+
const payload = this._buildRequestPayload();
|
|
199
|
+
const result = yield this._provider._applyAction('SupportModule', 'Case', payload);
|
|
200
|
+
// Clear pending links on the record after execution
|
|
201
|
+
this._record.clearPendingLinks();
|
|
202
|
+
return result;
|
|
203
|
+
});
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* Returns the request payload without executing (for debugging)
|
|
207
|
+
* @returns The request payload that would be sent to the API
|
|
208
|
+
*/
|
|
209
|
+
dryRun() {
|
|
210
|
+
return this._buildRequestPayload();
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Prevents accidental `await flowBuilder` without .execute()
|
|
214
|
+
* Forces developers to explicitly call .execute()
|
|
215
|
+
* @throws Error always - use .execute() or .dryRun() instead
|
|
216
|
+
*/
|
|
217
|
+
then() {
|
|
218
|
+
throw new Error('FlowBuilder cannot be awaited directly. Call .execute() to run the flow or .dryRun() to get the payload.');
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Build the request payload for the action
|
|
222
|
+
* @private
|
|
223
|
+
*/
|
|
224
|
+
_buildRequestPayload() {
|
|
225
|
+
const record = this._record.record;
|
|
226
|
+
if (!(record === null || record === void 0 ? void 0 : record.id))
|
|
227
|
+
throw new Error('Cannot execute flow on unsaved record');
|
|
228
|
+
// Build steps with parent associations
|
|
229
|
+
const stepsWithAssociations = this._steps.map(step => {
|
|
230
|
+
const stepAssociations = [...(step.associations || [])];
|
|
231
|
+
// Auto-add parent association if step requires it
|
|
232
|
+
if (step.autoLinkParent) {
|
|
233
|
+
stepAssociations.push({
|
|
234
|
+
entity: record.entity,
|
|
235
|
+
recordId: record.id,
|
|
236
|
+
linkType: null,
|
|
237
|
+
relationType: 'PARENT',
|
|
238
|
+
});
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
entity: step.entity,
|
|
242
|
+
type: step.type,
|
|
243
|
+
actionName: step.actionName,
|
|
244
|
+
properties: step.properties,
|
|
245
|
+
title: step.title,
|
|
246
|
+
id: step.id,
|
|
247
|
+
associations: stepAssociations.length > 0 ? stepAssociations : undefined,
|
|
248
|
+
groups: step.groups,
|
|
249
|
+
};
|
|
250
|
+
});
|
|
251
|
+
return Object.assign({ id: record.id, entity: record.entity, type: record.type, actionName: 'AssignCaseTransition', steps: stepsWithAssociations, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, groups: this._groups.length > 0 ? this._groups : undefined }, this._options);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
exports.AssignCaseTransitionFlowBuilder = AssignCaseTransitionFlowBuilder;
|
|
128
255
|
/**
|
|
129
256
|
* FlowBuilder for AssignCaseWithNoteFlow multi-step action
|
|
130
257
|
*
|
|
@@ -276,16 +403,56 @@ class CaseDefaultStageEscalatedFlowBuilder {
|
|
|
276
403
|
return this;
|
|
277
404
|
}
|
|
278
405
|
/**
|
|
279
|
-
* Add
|
|
406
|
+
* Add EscalateCaseActionYF step to the flow
|
|
280
407
|
* @param id - ID of the record to update
|
|
281
408
|
* @param properties - Properties for this step
|
|
282
409
|
* @param options - Optional step settings
|
|
283
410
|
* @returns this (for method chaining)
|
|
284
411
|
*/
|
|
285
|
-
|
|
412
|
+
escalateCaseActionYf(id, properties, options) {
|
|
286
413
|
var _a;
|
|
287
414
|
this._steps.push({
|
|
288
|
-
actionName: '
|
|
415
|
+
actionName: 'EscalateCaseActionYF',
|
|
416
|
+
properties,
|
|
417
|
+
id,
|
|
418
|
+
entity: 'SupportModule:Case',
|
|
419
|
+
autoLinkParent: false,
|
|
420
|
+
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 }))),
|
|
421
|
+
groups: options === null || options === void 0 ? void 0 : options.groups,
|
|
422
|
+
});
|
|
423
|
+
return this;
|
|
424
|
+
}
|
|
425
|
+
/**
|
|
426
|
+
* Add EscalateCaseActionBrsk step to the flow
|
|
427
|
+
* @param id - ID of the record to update
|
|
428
|
+
* @param properties - Properties for this step
|
|
429
|
+
* @param options - Optional step settings
|
|
430
|
+
* @returns this (for method chaining)
|
|
431
|
+
*/
|
|
432
|
+
escalateCaseActionBrsk(id, properties, options) {
|
|
433
|
+
var _a;
|
|
434
|
+
this._steps.push({
|
|
435
|
+
actionName: 'EscalateCaseActionBrsk',
|
|
436
|
+
properties,
|
|
437
|
+
id,
|
|
438
|
+
entity: 'SupportModule:Case',
|
|
439
|
+
autoLinkParent: false,
|
|
440
|
+
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 }))),
|
|
441
|
+
groups: options === null || options === void 0 ? void 0 : options.groups,
|
|
442
|
+
});
|
|
443
|
+
return this;
|
|
444
|
+
}
|
|
445
|
+
/**
|
|
446
|
+
* Add EscalateCaseActionYFCS step to the flow
|
|
447
|
+
* @param id - ID of the record to update
|
|
448
|
+
* @param properties - Properties for this step
|
|
449
|
+
* @param options - Optional step settings
|
|
450
|
+
* @returns this (for method chaining)
|
|
451
|
+
*/
|
|
452
|
+
escalateCaseActionYfcs(id, properties, options) {
|
|
453
|
+
var _a;
|
|
454
|
+
this._steps.push({
|
|
455
|
+
actionName: 'EscalateCaseActionYFCS',
|
|
289
456
|
properties,
|
|
290
457
|
id,
|
|
291
458
|
entity: 'SupportModule:Case',
|
|
@@ -1911,6 +2078,59 @@ class CaseRecord {
|
|
|
1911
2078
|
const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'AssignCase', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, opts);
|
|
1912
2079
|
return new ActionBuilder(this._provider, 'SupportModule', 'Case', payload, () => { this._pendingLinks = []; });
|
|
1913
2080
|
}
|
|
2081
|
+
/**
|
|
2082
|
+
* EscalateCaseActionBrsk
|
|
2083
|
+
*
|
|
2084
|
+
* Updates this Case record with the specified properties.
|
|
2085
|
+
* Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
|
|
2086
|
+
*
|
|
2087
|
+
* @param properties - Required properties for this action
|
|
2088
|
+
* @param options - Optional settings
|
|
2089
|
+
* @param options.journeyId - Associate with a journey
|
|
2090
|
+
* @param options.stageKey - Transition to pipeline stage
|
|
2091
|
+
* @returns ActionBuilder - call .execute() to update or .dryRun() for payload
|
|
2092
|
+
* @throws Error if called on a new (unsaved) record
|
|
2093
|
+
*
|
|
2094
|
+
* @example
|
|
2095
|
+
* ```typescript
|
|
2096
|
+
* const record = await odinClient.cases.get(id);
|
|
2097
|
+
* await record.escalateCaseActionBrsk({ ... }).execute();
|
|
2098
|
+
*
|
|
2099
|
+
* // Dry run (for debugging)
|
|
2100
|
+
* const payload = record.escalateCaseActionBrsk({ ... }).dryRun();
|
|
2101
|
+
* ```
|
|
2102
|
+
*/
|
|
2103
|
+
escalateCaseActionBrsk(properties, options) {
|
|
2104
|
+
var _a;
|
|
2105
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
2106
|
+
throw new Error('escalateCaseActionBrsk requires an existing record. Use accessor.get() first.');
|
|
2107
|
+
const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'EscalateCaseActionBrsk', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, options);
|
|
2108
|
+
return new ActionBuilder(this._provider, 'SupportModule', 'Case', payload, () => { this._pendingLinks = []; });
|
|
2109
|
+
}
|
|
2110
|
+
/**
|
|
2111
|
+
* AssignCaseTransition
|
|
2112
|
+
*
|
|
2113
|
+
* Starts a multi-step flow action on this Case record.
|
|
2114
|
+
* Chain step methods and call .execute() to run the flow.
|
|
2115
|
+
* Individual steps determine their own ID requirements (CREATE vs UPDATE).
|
|
2116
|
+
*
|
|
2117
|
+
* @param options - Optional settings
|
|
2118
|
+
* @param options.journeyId - Associate with a journey
|
|
2119
|
+
* @returns FlowBuilder for chaining step methods
|
|
2120
|
+
*
|
|
2121
|
+
* @example
|
|
2122
|
+
* ```typescript
|
|
2123
|
+
* // Can be called on new() or get() - steps determine ID requirements
|
|
2124
|
+
* const record = odinClient.cases.new();
|
|
2125
|
+
* await record.assignCaseTransition()
|
|
2126
|
+
* .assignCase(recordId, { ... })
|
|
2127
|
+
* .escalateCaseActionBrsk(recordId, { ... })
|
|
2128
|
+
* .execute();
|
|
2129
|
+
* ```
|
|
2130
|
+
*/
|
|
2131
|
+
assignCaseTransition(options) {
|
|
2132
|
+
return new AssignCaseTransitionFlowBuilder(this, this._provider, this._pendingLinks, options);
|
|
2133
|
+
}
|
|
1914
2134
|
/**
|
|
1915
2135
|
* AssignCaseWithNoteFlow
|
|
1916
2136
|
*
|
|
@@ -1936,32 +2156,77 @@ class CaseRecord {
|
|
|
1936
2156
|
return new AssignCaseWithNoteFlowFlowBuilder(this, this._provider, this._pendingLinks, options);
|
|
1937
2157
|
}
|
|
1938
2158
|
/**
|
|
1939
|
-
*
|
|
2159
|
+
* EscalateCaseActionYF
|
|
1940
2160
|
*
|
|
1941
|
-
* Updates this Case record
|
|
2161
|
+
* Updates this Case record.
|
|
1942
2162
|
* Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
|
|
1943
2163
|
*
|
|
1944
|
-
* @param
|
|
1945
|
-
* @param options - Optional settings
|
|
1946
|
-
* @param options.journeyId - Associate with a journey
|
|
1947
|
-
* @param options.stageKey - Transition to pipeline stage
|
|
2164
|
+
* @param propertiesOrOptions - Properties to update, or options object
|
|
2165
|
+
* @param options - Optional settings (journeyId, stageKey)
|
|
1948
2166
|
* @returns ActionBuilder - call .execute() to update or .dryRun() for payload
|
|
1949
2167
|
* @throws Error if called on a new (unsaved) record
|
|
1950
2168
|
*
|
|
1951
2169
|
* @example
|
|
1952
2170
|
* ```typescript
|
|
1953
2171
|
* const record = await odinClient.cases.get(id);
|
|
1954
|
-
* await record.
|
|
2172
|
+
* await record.escalateCaseActionYf({ ... }).execute();
|
|
1955
2173
|
*
|
|
1956
2174
|
* // Dry run (for debugging)
|
|
1957
|
-
* const payload = record.
|
|
2175
|
+
* const payload = record.escalateCaseActionYf({ ... }).dryRun();
|
|
1958
2176
|
* ```
|
|
1959
2177
|
*/
|
|
1960
|
-
|
|
2178
|
+
escalateCaseActionYf(propertiesOrOptions, options) {
|
|
1961
2179
|
var _a;
|
|
1962
2180
|
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
1963
|
-
throw new Error('
|
|
1964
|
-
|
|
2181
|
+
throw new Error('escalateCaseActionYf requires an existing record. Use accessor.get() first.');
|
|
2182
|
+
let properties = {};
|
|
2183
|
+
let opts = options;
|
|
2184
|
+
if (propertiesOrOptions) {
|
|
2185
|
+
if ('journeyId' in propertiesOrOptions || 'stageKey' in propertiesOrOptions) {
|
|
2186
|
+
opts = propertiesOrOptions;
|
|
2187
|
+
}
|
|
2188
|
+
else {
|
|
2189
|
+
properties = propertiesOrOptions;
|
|
2190
|
+
}
|
|
2191
|
+
}
|
|
2192
|
+
const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'EscalateCaseActionYF', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, opts);
|
|
2193
|
+
return new ActionBuilder(this._provider, 'SupportModule', 'Case', payload, () => { this._pendingLinks = []; });
|
|
2194
|
+
}
|
|
2195
|
+
/**
|
|
2196
|
+
* EscalateCaseActionYFCS
|
|
2197
|
+
*
|
|
2198
|
+
* Updates this Case record.
|
|
2199
|
+
* Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
|
|
2200
|
+
*
|
|
2201
|
+
* @param propertiesOrOptions - Properties to update, or options object
|
|
2202
|
+
* @param options - Optional settings (journeyId, stageKey)
|
|
2203
|
+
* @returns ActionBuilder - call .execute() to update or .dryRun() for payload
|
|
2204
|
+
* @throws Error if called on a new (unsaved) record
|
|
2205
|
+
*
|
|
2206
|
+
* @example
|
|
2207
|
+
* ```typescript
|
|
2208
|
+
* const record = await odinClient.cases.get(id);
|
|
2209
|
+
* await record.escalateCaseActionYfcs({ ... }).execute();
|
|
2210
|
+
*
|
|
2211
|
+
* // Dry run (for debugging)
|
|
2212
|
+
* const payload = record.escalateCaseActionYfcs({ ... }).dryRun();
|
|
2213
|
+
* ```
|
|
2214
|
+
*/
|
|
2215
|
+
escalateCaseActionYfcs(propertiesOrOptions, options) {
|
|
2216
|
+
var _a;
|
|
2217
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
2218
|
+
throw new Error('escalateCaseActionYfcs requires an existing record. Use accessor.get() first.');
|
|
2219
|
+
let properties = {};
|
|
2220
|
+
let opts = options;
|
|
2221
|
+
if (propertiesOrOptions) {
|
|
2222
|
+
if ('journeyId' in propertiesOrOptions || 'stageKey' in propertiesOrOptions) {
|
|
2223
|
+
opts = propertiesOrOptions;
|
|
2224
|
+
}
|
|
2225
|
+
else {
|
|
2226
|
+
properties = propertiesOrOptions;
|
|
2227
|
+
}
|
|
2228
|
+
}
|
|
2229
|
+
const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'EscalateCaseActionYFCS', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, opts);
|
|
1965
2230
|
return new ActionBuilder(this._provider, 'SupportModule', 'Case', payload, () => { this._pendingLinks = []; });
|
|
1966
2231
|
}
|
|
1967
2232
|
/**
|
|
@@ -1981,7 +2246,9 @@ class CaseRecord {
|
|
|
1981
2246
|
* ```typescript
|
|
1982
2247
|
* const record = await odinClient.cases.get(id);
|
|
1983
2248
|
* await record.caseDefaultStageEscalated()
|
|
1984
|
-
* .
|
|
2249
|
+
* .escalateCaseActionYf(recordId, { ... })
|
|
2250
|
+
* .escalateCaseActionBrsk(recordId, { ... })
|
|
2251
|
+
* .escalateCaseActionYfcs(recordId, { ... })
|
|
1985
2252
|
* .createNoteForCaseAssignment({ ... })
|
|
1986
2253
|
* .execute();
|
|
1987
2254
|
* ```
|
|
@@ -2186,6 +2453,35 @@ class CaseRecord {
|
|
|
2186
2453
|
const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'EditProviders', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, opts);
|
|
2187
2454
|
return new ActionBuilder(this._provider, 'SupportModule', 'Case', payload, () => { this._pendingLinks = []; });
|
|
2188
2455
|
}
|
|
2456
|
+
/**
|
|
2457
|
+
* EscalateCaseAction
|
|
2458
|
+
*
|
|
2459
|
+
* Updates this Case record with the specified properties.
|
|
2460
|
+
* Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
|
|
2461
|
+
*
|
|
2462
|
+
* @param properties - Required properties for this action
|
|
2463
|
+
* @param options - Optional settings
|
|
2464
|
+
* @param options.journeyId - Associate with a journey
|
|
2465
|
+
* @param options.stageKey - Transition to pipeline stage
|
|
2466
|
+
* @returns ActionBuilder - call .execute() to update or .dryRun() for payload
|
|
2467
|
+
* @throws Error if called on a new (unsaved) record
|
|
2468
|
+
*
|
|
2469
|
+
* @example
|
|
2470
|
+
* ```typescript
|
|
2471
|
+
* const record = await odinClient.cases.get(id);
|
|
2472
|
+
* await record.escalateCaseAction({ ... }).execute();
|
|
2473
|
+
*
|
|
2474
|
+
* // Dry run (for debugging)
|
|
2475
|
+
* const payload = record.escalateCaseAction({ ... }).dryRun();
|
|
2476
|
+
* ```
|
|
2477
|
+
*/
|
|
2478
|
+
escalateCaseAction(properties, options) {
|
|
2479
|
+
var _a;
|
|
2480
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
2481
|
+
throw new Error('escalateCaseAction requires an existing record. Use accessor.get() first.');
|
|
2482
|
+
const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'EscalateCaseAction', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, options);
|
|
2483
|
+
return new ActionBuilder(this._provider, 'SupportModule', 'Case', payload, () => { this._pendingLinks = []; });
|
|
2484
|
+
}
|
|
2189
2485
|
/**
|
|
2190
2486
|
* EscalateCaseTransition
|
|
2191
2487
|
*
|
|
@@ -34,6 +34,7 @@ import { LeadRecord } from './LeadRecord';
|
|
|
34
34
|
import { SalesTerritoryRecord } from './SalesTerritoryRecord';
|
|
35
35
|
import { TeamRecord } from './TeamRecord';
|
|
36
36
|
import { AddressRecord } from './AddressRecord';
|
|
37
|
+
import { ExchangeRecord } from './ExchangeRecord';
|
|
37
38
|
/** Valid entity types for CrmDataset */
|
|
38
39
|
export declare type CrmDatasetType = 'ADDRESS' | 'CONTACT' | 'DEFAULT' | 'LEAD';
|
|
39
40
|
/**
|
|
@@ -105,6 +106,7 @@ export declare class CrmDatasetRecord<TProps = CrmDatasetProperties> {
|
|
|
105
106
|
private _salesTerritories?;
|
|
106
107
|
private _teams?;
|
|
107
108
|
private _addresses?;
|
|
109
|
+
private _exchanges?;
|
|
108
110
|
/**
|
|
109
111
|
* Create a record wrapper.
|
|
110
112
|
* @param record - The underlying record, or null for create operations
|
|
@@ -302,6 +304,24 @@ export declare class CrmDatasetRecord<TProps = CrmDatasetProperties> {
|
|
|
302
304
|
* ```
|
|
303
305
|
*/
|
|
304
306
|
get addresses(): RecordLinkManager<AddressRecord, typeof CrmDatasetRecord['addressesLabels'][number]>;
|
|
307
|
+
/** Valid labels for Exchange associations */
|
|
308
|
+
static readonly exchangesLabels: readonly ["Exchange__CrmDataset"];
|
|
309
|
+
/**
|
|
310
|
+
* Access linked Exchange records
|
|
311
|
+
* @remarks Available labels: Exchange__CrmDataset
|
|
312
|
+
* @throws Error if called on a new (unsaved) record
|
|
313
|
+
*
|
|
314
|
+
* @example
|
|
315
|
+
* ```typescript
|
|
316
|
+
* // Get all linked Exchange records
|
|
317
|
+
* const items = await record.exchanges.list();
|
|
318
|
+
* const first = await record.exchanges.first();
|
|
319
|
+
*
|
|
320
|
+
* // Filter by label
|
|
321
|
+
* const specific = await record.exchanges.first({ label: 'Exchange__CrmDataset' });
|
|
322
|
+
* ```
|
|
323
|
+
*/
|
|
324
|
+
get exchanges(): RecordLinkManager<ExchangeRecord, typeof CrmDatasetRecord['exchangesLabels'][number]>;
|
|
305
325
|
/**
|
|
306
326
|
* Queue a link to be created with the next action.
|
|
307
327
|
* Works for both create and update actions.
|
|
@@ -38,6 +38,7 @@ const LeadRecord_1 = require("./LeadRecord");
|
|
|
38
38
|
const SalesTerritoryRecord_1 = require("./SalesTerritoryRecord");
|
|
39
39
|
const TeamRecord_1 = require("./TeamRecord");
|
|
40
40
|
const AddressRecord_1 = require("./AddressRecord");
|
|
41
|
+
const ExchangeRecord_1 = require("./ExchangeRecord");
|
|
41
42
|
/**
|
|
42
43
|
* Builder for action execution with dryRun support
|
|
43
44
|
*
|
|
@@ -395,6 +396,36 @@ class CrmDatasetRecord {
|
|
|
395
396
|
}
|
|
396
397
|
return this._addresses;
|
|
397
398
|
}
|
|
399
|
+
/**
|
|
400
|
+
* Access linked Exchange records
|
|
401
|
+
* @remarks Available labels: Exchange__CrmDataset
|
|
402
|
+
* @throws Error if called on a new (unsaved) record
|
|
403
|
+
*
|
|
404
|
+
* @example
|
|
405
|
+
* ```typescript
|
|
406
|
+
* // Get all linked Exchange records
|
|
407
|
+
* const items = await record.exchanges.list();
|
|
408
|
+
* const first = await record.exchanges.first();
|
|
409
|
+
*
|
|
410
|
+
* // Filter by label
|
|
411
|
+
* const specific = await record.exchanges.first({ label: 'Exchange__CrmDataset' });
|
|
412
|
+
* ```
|
|
413
|
+
*/
|
|
414
|
+
get exchanges() {
|
|
415
|
+
var _a;
|
|
416
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
417
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
418
|
+
if (!this._exchanges) {
|
|
419
|
+
this._exchanges = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
420
|
+
sourceEntity: 'CrmModule:CrmDataset',
|
|
421
|
+
targetEntity: 'ProjectModule:Exchange',
|
|
422
|
+
targetModuleName: 'ProjectModule',
|
|
423
|
+
targetEntityName: 'Exchange',
|
|
424
|
+
labels: ['Exchange__CrmDataset'],
|
|
425
|
+
}, ExchangeRecord_1.ExchangeRecord);
|
|
426
|
+
}
|
|
427
|
+
return this._exchanges;
|
|
428
|
+
}
|
|
398
429
|
// ============================================
|
|
399
430
|
// LINK MANAGEMENT
|
|
400
431
|
// ============================================
|
|
@@ -620,6 +651,8 @@ CrmDatasetRecord.salesTerritoriesLabels = ['CrmDataset__SalesTerritory'];
|
|
|
620
651
|
CrmDatasetRecord.teamsLabels = ['CrmDataset_Team'];
|
|
621
652
|
/** Valid labels for Address associations */
|
|
622
653
|
CrmDatasetRecord.addressesLabels = ['CrmDataset__Address'];
|
|
654
|
+
/** Valid labels for Exchange associations */
|
|
655
|
+
CrmDatasetRecord.exchangesLabels = ['Exchange__CrmDataset'];
|
|
623
656
|
/** Type guard to check if an object is a CrmDatasetRecord */
|
|
624
657
|
function isCrmDatasetRecord(obj) {
|
|
625
658
|
return obj instanceof CrmDatasetRecord;
|
|
@@ -23,6 +23,7 @@ import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-man
|
|
|
23
23
|
import { ExchangeProperties } from '../entities-v2/Exchange';
|
|
24
24
|
import { CreateExchangeProperties } from '../actions-v2/CreateExchangeDto';
|
|
25
25
|
import { UpdateExchangeProperties } from '../actions-v2/UpdateExchangeDto';
|
|
26
|
+
import { CrmDatasetRecord } from './CrmDatasetRecord';
|
|
26
27
|
import { SalesTerritoryRecord } from './SalesTerritoryRecord';
|
|
27
28
|
/**
|
|
28
29
|
* Builder for action execution with dryRun support
|
|
@@ -87,6 +88,7 @@ export declare class ExchangeRecord<TProps = ExchangeProperties> {
|
|
|
87
88
|
private _provider;
|
|
88
89
|
private _pendingLinks;
|
|
89
90
|
private _preGeneratedId;
|
|
91
|
+
private _crmDatasets?;
|
|
90
92
|
private _salesTerritories?;
|
|
91
93
|
/**
|
|
92
94
|
* Create a record wrapper.
|
|
@@ -113,6 +115,24 @@ export declare class ExchangeRecord<TProps = ExchangeProperties> {
|
|
|
113
115
|
get groups(): string[];
|
|
114
116
|
/** Access the underlying OdinRecord (null for new records) */
|
|
115
117
|
get record(): OdinRecord<TProps> | null;
|
|
118
|
+
/** Valid labels for CrmDataset associations */
|
|
119
|
+
static readonly crmDatasetsLabels: readonly ["Exchange__CrmDataset"];
|
|
120
|
+
/**
|
|
121
|
+
* Access linked CrmDataset records
|
|
122
|
+
* @remarks Available labels: Exchange__CrmDataset
|
|
123
|
+
* @throws Error if called on a new (unsaved) record
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* // Get all linked CrmDataset records
|
|
128
|
+
* const items = await record.crmDatasets.list();
|
|
129
|
+
* const first = await record.crmDatasets.first();
|
|
130
|
+
*
|
|
131
|
+
* // Filter by label
|
|
132
|
+
* const specific = await record.crmDatasets.first({ label: 'Exchange__CrmDataset' });
|
|
133
|
+
* ```
|
|
134
|
+
*/
|
|
135
|
+
get crmDatasets(): RecordLinkManager<CrmDatasetRecord, typeof ExchangeRecord['crmDatasetsLabels'][number]>;
|
|
116
136
|
/** Valid labels for SalesTerritory associations */
|
|
117
137
|
static readonly salesTerritoriesLabels: readonly ["Exchange__SalesTerritory"];
|
|
118
138
|
/**
|
|
@@ -30,6 +30,7 @@ exports.isExchangeRecord = exports.ExchangeRecord = void 0;
|
|
|
30
30
|
const uuid_1 = require("uuid");
|
|
31
31
|
const core_1 = require("@d19n/odin-types/dist/core");
|
|
32
32
|
const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
|
|
33
|
+
const CrmDatasetRecord_1 = require("./CrmDatasetRecord");
|
|
33
34
|
const SalesTerritoryRecord_1 = require("./SalesTerritoryRecord");
|
|
34
35
|
/**
|
|
35
36
|
* Builder for action execution with dryRun support
|
|
@@ -141,6 +142,36 @@ class ExchangeRecord {
|
|
|
141
142
|
get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
|
|
142
143
|
/** Access the underlying OdinRecord (null for new records) */
|
|
143
144
|
get record() { return this._record; }
|
|
145
|
+
/**
|
|
146
|
+
* Access linked CrmDataset records
|
|
147
|
+
* @remarks Available labels: Exchange__CrmDataset
|
|
148
|
+
* @throws Error if called on a new (unsaved) record
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* ```typescript
|
|
152
|
+
* // Get all linked CrmDataset records
|
|
153
|
+
* const items = await record.crmDatasets.list();
|
|
154
|
+
* const first = await record.crmDatasets.first();
|
|
155
|
+
*
|
|
156
|
+
* // Filter by label
|
|
157
|
+
* const specific = await record.crmDatasets.first({ label: 'Exchange__CrmDataset' });
|
|
158
|
+
* ```
|
|
159
|
+
*/
|
|
160
|
+
get crmDatasets() {
|
|
161
|
+
var _a;
|
|
162
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
163
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
164
|
+
if (!this._crmDatasets) {
|
|
165
|
+
this._crmDatasets = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
166
|
+
sourceEntity: 'ProjectModule:Exchange',
|
|
167
|
+
targetEntity: 'CrmModule:CrmDataset',
|
|
168
|
+
targetModuleName: 'CrmModule',
|
|
169
|
+
targetEntityName: 'CrmDataset',
|
|
170
|
+
labels: ['Exchange__CrmDataset'],
|
|
171
|
+
}, CrmDatasetRecord_1.CrmDatasetRecord);
|
|
172
|
+
}
|
|
173
|
+
return this._crmDatasets;
|
|
174
|
+
}
|
|
144
175
|
/**
|
|
145
176
|
* Access linked SalesTerritory records
|
|
146
177
|
* @remarks Available labels: Exchange__SalesTerritory
|
|
@@ -282,6 +313,8 @@ exports.ExchangeRecord = ExchangeRecord;
|
|
|
282
313
|
// ============================================
|
|
283
314
|
// TYPED LINK ACCESSORS
|
|
284
315
|
// ============================================
|
|
316
|
+
/** Valid labels for CrmDataset associations */
|
|
317
|
+
ExchangeRecord.crmDatasetsLabels = ['Exchange__CrmDataset'];
|
|
285
318
|
/** Valid labels for SalesTerritory associations */
|
|
286
319
|
ExchangeRecord.salesTerritoriesLabels = ['Exchange__SalesTerritory'];
|
|
287
320
|
/** Type guard to check if an object is a ExchangeRecord */
|