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

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 { OdinRecord, OdinRecordCreateDto, OdinRecordCreatedEvent, OdinRecordLinkDto } from '@d19n/odin-types/dist/core';
13
+ import { OdinRecordCreateDto, OdinRecordCreatedEvent } from '@d19n/odin-types/dist/core';
14
14
  /**
15
15
  * RabbitMQ message payload for CreateCustomerCallLeg created events
16
16
  *
@@ -21,10 +21,18 @@ export interface CreateCustomerCallLegMessage extends OdinRecordCreatedEvent<Cre
21
21
  /**
22
22
  * Properties for CreateCustomerCallLeg action
23
23
  *
24
- * @property Required fields: 8
24
+ * @property Required fields: 9
25
25
  * @property Optional fields: 0
26
26
  */
27
27
  export interface CreateCustomerCallLegProperties {
28
+ /**
29
+ * CallId
30
+ *
31
+ * Reference identifier for CallLeg relationships. Used for data integrity.
32
+ * @type {LOOKUP}
33
+ * @required
34
+ */
35
+ CallId: string;
28
36
  /**
29
37
  * CallSid
30
38
  *
@@ -90,100 +98,6 @@ export interface CreateCustomerCallLegProperties {
90
98
  */
91
99
  InitiatedAt: string;
92
100
  }
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
- }
187
101
  /**
188
102
  * CreateCustomerCallLeg
189
103
  *
@@ -209,15 +123,6 @@ export declare class CreateCustomerCallLegDto extends OdinRecordCreateDto<Create
209
123
  static readonly STEP_SCHEMA_ID = "75c59745-35fb-44b9-b3f2-7563101fdcec";
210
124
  static readonly STEP_SCHEMA_ACTION_ID = "440c10de-fda8-4697-8b44-277cc7e00d3e";
211
125
  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
- }];
221
126
  readonly actionName: string;
222
127
  readonly schemaActionId: string;
223
128
  readonly entity: string;
@@ -11,125 +11,9 @@
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
- };
23
14
  Object.defineProperty(exports, "__esModule", { value: true });
24
- exports.CreateCustomerCallLegDto = exports.CreateCustomerCallLegBuilder = void 0;
15
+ exports.CreateCustomerCallLegDto = void 0;
25
16
  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;
133
17
  /**
134
18
  * CreateCustomerCallLeg
135
19
  *
@@ -168,7 +52,3 @@ CreateCustomerCallLegDto.STEP_ENTITY = 'NotificationModule:CallLeg';
168
52
  CreateCustomerCallLegDto.STEP_SCHEMA_ID = '75c59745-35fb-44b9-b3f2-7563101fdcec';
169
53
  CreateCustomerCallLegDto.STEP_SCHEMA_ACTION_ID = '440c10de-fda8-4697-8b44-277cc7e00d3e';
170
54
  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,7 +25,6 @@ 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';
29
28
  import { UpdateCallProperties } from '../actions-v2/UpdateCallDto';
30
29
  import { CallRecord } from './CallRecord';
31
30
  import { CallEventRecord } from './CallEventRecord';
@@ -246,27 +245,30 @@ export declare class CallLegRecord<TProps = CallLegProperties> {
246
245
  * CreateCustomerCallLeg
247
246
  *
248
247
  * Creates a new CallLeg record with the specified properties.
249
- * Returns a builder with fluent .link*() methods for associations.
250
- * Call .execute() to create or .dryRun() for debugging.
248
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
251
249
  *
252
250
  * @param properties - The properties for the new record
253
251
  * @param options - Optional settings
252
+ * @param options.type - Override the record type
254
253
  * @param options.journeyId - Associate with a journey
255
254
  * @param options.stageKey - Set initial pipeline stage
256
- * @returns CreateCustomerCallLegBuilder - chain .link*() then .execute()
255
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
257
256
  *
258
257
  * @example
259
258
  * ```typescript
259
+ * // Create with properties
260
260
  * const record = odinClient.callLegs.new();
261
- * await record.createCustomerCallLeg({ ... })
262
- * .linkAssociation_xxx(target)
263
- * .execute();
261
+ * await record.createCustomerCallLeg({ ... }).execute();
262
+ *
263
+ * // Dry run (for debugging)
264
+ * const payload = record.createCustomerCallLeg({ ... }).dryRun();
264
265
  * ```
265
266
  */
266
267
  createCustomerCallLeg(properties: CreateCustomerCallLegProperties, options?: {
268
+ type?: string;
267
269
  journeyId?: string;
268
270
  stageKey?: string;
269
- }): CreateCustomerCallLegBuilder;
271
+ }): ActionBuilder;
270
272
  /**
271
273
  * UpdateCall
272
274
  *
@@ -32,7 +32,6 @@ 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");
36
35
  const CallRecord_1 = require("./CallRecord");
37
36
  const CallEventRecord_1 = require("./CallEventRecord");
38
37
  const CallTransferRecord_1 = require("./CallTransferRecord");
@@ -333,25 +332,37 @@ class CallLegRecord {
333
332
  * CreateCustomerCallLeg
334
333
  *
335
334
  * Creates a new CallLeg record with the specified properties.
336
- * Returns a builder with fluent .link*() methods for associations.
337
- * Call .execute() to create or .dryRun() for debugging.
335
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
338
336
  *
339
337
  * @param properties - The properties for the new record
340
338
  * @param options - Optional settings
339
+ * @param options.type - Override the record type
341
340
  * @param options.journeyId - Associate with a journey
342
341
  * @param options.stageKey - Set initial pipeline stage
343
- * @returns CreateCustomerCallLegBuilder - chain .link*() then .execute()
342
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
344
343
  *
345
344
  * @example
346
345
  * ```typescript
346
+ * // Create with properties
347
347
  * const record = odinClient.callLegs.new();
348
- * await record.createCustomerCallLeg({ ... })
349
- * .linkAssociation_xxx(target)
350
- * .execute();
348
+ * await record.createCustomerCallLeg({ ... }).execute();
349
+ *
350
+ * // Dry run (for debugging)
351
+ * const payload = record.createCustomerCallLeg({ ... }).dryRun();
351
352
  * ```
352
353
  */
353
354
  createCustomerCallLeg(properties, options) {
354
- return new CreateCustomerCallLegDto_1.CreateCustomerCallLegBuilder(properties || {}, [...this._pendingLinks], options).withProvider(this._provider, 'NotificationModule', 'CallLeg', () => { this._pendingLinks = []; });
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 = []; });
355
366
  }
356
367
  // ============================================
357
368
  // 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.2",
3
+ "version": "2.0.102-beta.3",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",