@d19n/youfibre-odin-sdk 2.0.102-beta.1 → 2.0.102-beta.2

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.
@@ -10,7 +10,7 @@
10
10
  *
11
11
  * AUTO-GENERATED - DO NOT EDIT DIRECTLY
12
12
  */
13
- import { OdinRecordCreateDto, OdinRecordCreatedEvent } from '@d19n/odin-types/dist/core';
13
+ import { OdinRecord, OdinRecordCreateDto, OdinRecordCreatedEvent, OdinRecordLinkDto } from '@d19n/odin-types/dist/core';
14
14
  /**
15
15
  * RabbitMQ message payload for CreateCustomerCallLeg created events
16
16
  *
@@ -90,6 +90,100 @@ export interface CreateCustomerCallLegProperties {
90
90
  */
91
91
  InitiatedAt: string;
92
92
  }
93
+ /**
94
+ * Builder for CreateCustomerCallLeg action
95
+ *
96
+ * Provides fluent API for adding associations before executing the action.
97
+ * Use .link*() methods to add associations, then call .execute() to run.
98
+ *
99
+ * @example
100
+ * ```typescript
101
+ * await record.createCustomerCallLeg({ ...properties })
102
+ * .linkAssociation_1778250753812({ id: '...', entity: '...' })
103
+ * .execute();
104
+ * ```
105
+ */
106
+ export declare class CreateCustomerCallLegBuilder {
107
+ private _associations;
108
+ private _properties;
109
+ private _pendingLinks;
110
+ private _options?;
111
+ private _provider?;
112
+ private _moduleName?;
113
+ private _entityName?;
114
+ private _clearPendingLinks?;
115
+ private _externalId?;
116
+ private _externalAppId?;
117
+ private _groups?;
118
+ constructor(properties: CreateCustomerCallLegProperties, pendingLinks: OdinRecordLinkDto[], options?: {
119
+ journeyId?: string;
120
+ stageKey?: string;
121
+ });
122
+ /**
123
+ * Link CallLeg_Call
124
+ * @schemaAssociationId 40babadf-1cd8-4c6a-adb8-f78f976245ac
125
+ * @required
126
+ * @param target - The record to link
127
+ * @returns this (for method chaining)
128
+ */
129
+ linkAssociation_1778250753812(target: OdinRecord<any> | {
130
+ id: string;
131
+ entity: string;
132
+ }): this;
133
+ /**
134
+ * Set an external system identifier for this record.
135
+ * Links the record to a corresponding entry in an external application.
136
+ * @param externalId - The ID in the external system
137
+ * @param externalAppId - The external application identifier
138
+ * @returns this (for chaining)
139
+ */
140
+ withExternalId(externalId: string, externalAppId: string): this;
141
+ /**
142
+ * Set security/access groups for this record.
143
+ * @param groups - Array of group names
144
+ * @returns this (for chaining)
145
+ */
146
+ withGroups(groups: string[]): this;
147
+ /**
148
+ * Get the action payload without executing
149
+ * @returns The action data that would be sent
150
+ */
151
+ getData(): {
152
+ entity: string;
153
+ type: string | undefined;
154
+ actionName: string;
155
+ properties: CreateCustomerCallLegProperties;
156
+ associations?: OdinRecordLinkDto[];
157
+ journeyId?: string;
158
+ stageKey?: string;
159
+ externalId?: string;
160
+ externalAppId?: string;
161
+ groups?: string[];
162
+ };
163
+ /**
164
+ * Inject execution context (called by record wrapper)
165
+ * @internal
166
+ */
167
+ withProvider(provider: {
168
+ _applyAction(moduleName: string, entityName: string, payload: any): Promise<any>;
169
+ }, moduleName: string, entityName: string, clearPendingLinks: () => void): this;
170
+ /**
171
+ * Execute the action
172
+ * @returns The result from the API
173
+ * @throws Error if withProvider() has not been called
174
+ */
175
+ execute(): Promise<any>;
176
+ /**
177
+ * Returns the request payload without executing (for debugging)
178
+ * @returns The request payload that would be sent to the API
179
+ */
180
+ dryRun(): Record<string, any>;
181
+ /**
182
+ * Prevents accidental `await builder` without .execute()
183
+ * @throws Error always - use .execute() or .dryRun() instead
184
+ */
185
+ then(): never;
186
+ }
93
187
  /**
94
188
  * CreateCustomerCallLeg
95
189
  *
@@ -115,6 +209,15 @@ export declare class CreateCustomerCallLegDto extends OdinRecordCreateDto<Create
115
209
  static readonly STEP_SCHEMA_ID = "75c59745-35fb-44b9-b3f2-7563101fdcec";
116
210
  static readonly STEP_SCHEMA_ACTION_ID = "440c10de-fda8-4697-8b44-277cc7e00d3e";
117
211
  static readonly AUTO_LINK_PARENT = true;
212
+ static readonly HAS_ASSOCIATIONS = true;
213
+ static readonly HAS_REQUIRED_ASSOCIATIONS = true;
214
+ static readonly BUILDER_CLASS = "CreateCustomerCallLegBuilder";
215
+ static readonly ASSOCIATION_FIELDS: readonly [{
216
+ readonly name: "Association_1778250753812";
217
+ readonly methodName: "linkAssociation_1778250753812";
218
+ readonly required: true;
219
+ readonly schemaAssociationId: "40babadf-1cd8-4c6a-adb8-f78f976245ac";
220
+ }];
118
221
  readonly actionName: string;
119
222
  readonly schemaActionId: string;
120
223
  readonly entity: string;
@@ -11,9 +11,125 @@
11
11
  *
12
12
  * AUTO-GENERATED - DO NOT EDIT DIRECTLY
13
13
  */
14
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
15
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
16
+ return new (P || (P = Promise))(function (resolve, reject) {
17
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
18
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
19
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
20
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
21
+ });
22
+ };
14
23
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CreateCustomerCallLegDto = void 0;
24
+ exports.CreateCustomerCallLegDto = exports.CreateCustomerCallLegBuilder = void 0;
16
25
  const core_1 = require("@d19n/odin-types/dist/core");
26
+ /**
27
+ * Builder for CreateCustomerCallLeg action
28
+ *
29
+ * Provides fluent API for adding associations before executing the action.
30
+ * Use .link*() methods to add associations, then call .execute() to run.
31
+ *
32
+ * @example
33
+ * ```typescript
34
+ * await record.createCustomerCallLeg({ ...properties })
35
+ * .linkAssociation_1778250753812({ id: '...', entity: '...' })
36
+ * .execute();
37
+ * ```
38
+ */
39
+ class CreateCustomerCallLegBuilder {
40
+ constructor(properties, pendingLinks, options) {
41
+ this._associations = [];
42
+ this._properties = properties;
43
+ this._pendingLinks = pendingLinks;
44
+ this._options = options;
45
+ }
46
+ /**
47
+ * Link CallLeg_Call
48
+ * @schemaAssociationId 40babadf-1cd8-4c6a-adb8-f78f976245ac
49
+ * @required
50
+ * @param target - The record to link
51
+ * @returns this (for method chaining)
52
+ */
53
+ linkAssociation_1778250753812(target) {
54
+ this._associations.push(new core_1.OdinRecordLinkDto({
55
+ id: target.id,
56
+ entity: 'entity' in target ? target.entity : target.entity,
57
+ }));
58
+ return this;
59
+ }
60
+ /**
61
+ * Set an external system identifier for this record.
62
+ * Links the record to a corresponding entry in an external application.
63
+ * @param externalId - The ID in the external system
64
+ * @param externalAppId - The external application identifier
65
+ * @returns this (for chaining)
66
+ */
67
+ withExternalId(externalId, externalAppId) {
68
+ this._externalId = externalId;
69
+ this._externalAppId = externalAppId;
70
+ return this;
71
+ }
72
+ /**
73
+ * Set security/access groups for this record.
74
+ * @param groups - Array of group names
75
+ * @returns this (for chaining)
76
+ */
77
+ withGroups(groups) {
78
+ this._groups = groups;
79
+ return this;
80
+ }
81
+ /**
82
+ * Get the action payload without executing
83
+ * @returns The action data that would be sent
84
+ */
85
+ getData() {
86
+ var _a, _b;
87
+ const allAssociations = [...this._associations, ...this._pendingLinks];
88
+ return Object.assign(Object.assign({ entity: 'NotificationModule:CallLeg', type: undefined, actionName: 'CreateCustomerCallLeg', properties: this._properties, associations: allAssociations.length > 0 ? allAssociations : undefined, journeyId: (_a = this._options) === null || _a === void 0 ? void 0 : _a.journeyId, stageKey: (_b = this._options) === null || _b === void 0 ? void 0 : _b.stageKey }, (this._externalId && { externalId: this._externalId, externalAppId: this._externalAppId })), (this._groups && { groups: this._groups }));
89
+ }
90
+ /**
91
+ * Inject execution context (called by record wrapper)
92
+ * @internal
93
+ */
94
+ withProvider(provider, moduleName, entityName, clearPendingLinks) {
95
+ this._provider = provider;
96
+ this._moduleName = moduleName;
97
+ this._entityName = entityName;
98
+ this._clearPendingLinks = clearPendingLinks;
99
+ return this;
100
+ }
101
+ /**
102
+ * Execute the action
103
+ * @returns The result from the API
104
+ * @throws Error if withProvider() has not been called
105
+ */
106
+ execute() {
107
+ var _a;
108
+ return __awaiter(this, void 0, void 0, function* () {
109
+ if (!this._provider || !this._moduleName || !this._entityName) {
110
+ throw new Error('Builder not connected to provider. Use the record wrapper API to get an executable builder.');
111
+ }
112
+ const result = yield this._provider._applyAction(this._moduleName, this._entityName, this.getData());
113
+ (_a = this._clearPendingLinks) === null || _a === void 0 ? void 0 : _a.call(this);
114
+ return result;
115
+ });
116
+ }
117
+ /**
118
+ * Returns the request payload without executing (for debugging)
119
+ * @returns The request payload that would be sent to the API
120
+ */
121
+ dryRun() {
122
+ return this.getData();
123
+ }
124
+ /**
125
+ * Prevents accidental `await builder` without .execute()
126
+ * @throws Error always - use .execute() or .dryRun() instead
127
+ */
128
+ then() {
129
+ throw new Error('Builder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
130
+ }
131
+ }
132
+ exports.CreateCustomerCallLegBuilder = CreateCustomerCallLegBuilder;
17
133
  /**
18
134
  * CreateCustomerCallLeg
19
135
  *
@@ -52,3 +168,7 @@ CreateCustomerCallLegDto.STEP_ENTITY = 'NotificationModule:CallLeg';
52
168
  CreateCustomerCallLegDto.STEP_SCHEMA_ID = '75c59745-35fb-44b9-b3f2-7563101fdcec';
53
169
  CreateCustomerCallLegDto.STEP_SCHEMA_ACTION_ID = '440c10de-fda8-4697-8b44-277cc7e00d3e';
54
170
  CreateCustomerCallLegDto.AUTO_LINK_PARENT = true;
171
+ CreateCustomerCallLegDto.HAS_ASSOCIATIONS = true;
172
+ CreateCustomerCallLegDto.HAS_REQUIRED_ASSOCIATIONS = true;
173
+ CreateCustomerCallLegDto.BUILDER_CLASS = 'CreateCustomerCallLegBuilder';
174
+ CreateCustomerCallLegDto.ASSOCIATION_FIELDS = [{ "name": "Association_1778250753812", "methodName": "linkAssociation_1778250753812", "required": true, "schemaAssociationId": "40babadf-1cd8-4c6a-adb8-f78f976245ac" }];
@@ -25,6 +25,7 @@ import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-man
25
25
  import { CallLegProperties } from '../entities-v2/CallLeg';
26
26
  import { CreateAgentCallLegProperties } from '../actions-v2/CreateAgentCallLegDto';
27
27
  import { CreateCustomerCallLegProperties } from '../actions-v2/CreateCustomerCallLegDto';
28
+ import { CreateCustomerCallLegBuilder } from '../actions-v2/CreateCustomerCallLegDto';
28
29
  import { UpdateCallProperties } from '../actions-v2/UpdateCallDto';
29
30
  import { CallRecord } from './CallRecord';
30
31
  import { CallEventRecord } from './CallEventRecord';
@@ -245,30 +246,27 @@ export declare class CallLegRecord<TProps = CallLegProperties> {
245
246
  * CreateCustomerCallLeg
246
247
  *
247
248
  * Creates a new CallLeg record with the specified properties.
248
- * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
249
+ * Returns a builder with fluent .link*() methods for associations.
250
+ * Call .execute() to create or .dryRun() for debugging.
249
251
  *
250
252
  * @param properties - The properties for the new record
251
253
  * @param options - Optional settings
252
- * @param options.type - Override the record type
253
254
  * @param options.journeyId - Associate with a journey
254
255
  * @param options.stageKey - Set initial pipeline stage
255
- * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
256
+ * @returns CreateCustomerCallLegBuilder - chain .link*() then .execute()
256
257
  *
257
258
  * @example
258
259
  * ```typescript
259
- * // Create with properties
260
260
  * const record = odinClient.callLegs.new();
261
- * await record.createCustomerCallLeg({ ... }).execute();
262
- *
263
- * // Dry run (for debugging)
264
- * const payload = record.createCustomerCallLeg({ ... }).dryRun();
261
+ * await record.createCustomerCallLeg({ ... })
262
+ * .linkAssociation_xxx(target)
263
+ * .execute();
265
264
  * ```
266
265
  */
267
266
  createCustomerCallLeg(properties: CreateCustomerCallLegProperties, options?: {
268
- type?: string;
269
267
  journeyId?: string;
270
268
  stageKey?: string;
271
- }): ActionBuilder;
269
+ }): CreateCustomerCallLegBuilder;
272
270
  /**
273
271
  * UpdateCall
274
272
  *
@@ -32,6 +32,7 @@ exports.isCallLegRecord = exports.CallLegRecord = 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");
35
+ const CreateCustomerCallLegDto_1 = require("../actions-v2/CreateCustomerCallLegDto");
35
36
  const CallRecord_1 = require("./CallRecord");
36
37
  const CallEventRecord_1 = require("./CallEventRecord");
37
38
  const CallTransferRecord_1 = require("./CallTransferRecord");
@@ -332,37 +333,25 @@ class CallLegRecord {
332
333
  * CreateCustomerCallLeg
333
334
  *
334
335
  * Creates a new CallLeg record with the specified properties.
335
- * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
336
+ * Returns a builder with fluent .link*() methods for associations.
337
+ * Call .execute() to create or .dryRun() for debugging.
336
338
  *
337
339
  * @param properties - The properties for the new record
338
340
  * @param options - Optional settings
339
- * @param options.type - Override the record type
340
341
  * @param options.journeyId - Associate with a journey
341
342
  * @param options.stageKey - Set initial pipeline stage
342
- * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
343
+ * @returns CreateCustomerCallLegBuilder - chain .link*() then .execute()
343
344
  *
344
345
  * @example
345
346
  * ```typescript
346
- * // Create with properties
347
347
  * const record = odinClient.callLegs.new();
348
- * await record.createCustomerCallLeg({ ... }).execute();
349
- *
350
- * // Dry run (for debugging)
351
- * const payload = record.createCustomerCallLeg({ ... }).dryRun();
348
+ * await record.createCustomerCallLeg({ ... })
349
+ * .linkAssociation_xxx(target)
350
+ * .execute();
352
351
  * ```
353
352
  */
354
353
  createCustomerCallLeg(properties, options) {
355
- var _a, _b;
356
- const payload = {
357
- entity: 'NotificationModule:CallLeg',
358
- type: (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : (_b = this._record) === null || _b === void 0 ? void 0 : _b.type,
359
- actionName: 'CreateCustomerCallLeg',
360
- properties: properties || {},
361
- associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined,
362
- journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
363
- stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
364
- };
365
- return new ActionBuilder(this._provider, 'NotificationModule', 'CallLeg', payload, () => { this._pendingLinks = []; });
354
+ return new CreateCustomerCallLegDto_1.CreateCustomerCallLegBuilder(properties || {}, [...this._pendingLinks], options).withProvider(this._provider, 'NotificationModule', 'CallLeg', () => { this._pendingLinks = []; });
366
355
  }
367
356
  // ============================================
368
357
  // UPDATE ACTIONS (require existing record)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "2.0.102-beta.1",
3
+ "version": "2.0.102-beta.2",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",