@d19n/youfibre-odin-sdk 1.0.241 → 1.0.242

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (31) hide show
  1. package/dist/records-v2/AddressRecord.d.ts +46 -12
  2. package/dist/records-v2/AddressRecord.js +60 -23
  3. package/dist/records-v2/CaseRecord.d.ts +281 -72
  4. package/dist/records-v2/CaseRecord.js +386 -161
  5. package/dist/records-v2/ChurnRequestRecord.d.ts +38 -10
  6. package/dist/records-v2/ChurnRequestRecord.js +51 -23
  7. package/dist/records-v2/ContactRecord.d.ts +38 -12
  8. package/dist/records-v2/ContactRecord.js +50 -23
  9. package/dist/records-v2/ContractBuyOutRecord.d.ts +75 -20
  10. package/dist/records-v2/ContractBuyOutRecord.js +102 -46
  11. package/dist/records-v2/OntReplacementApprovalRecord.d.ts +37 -12
  12. package/dist/records-v2/OntReplacementApprovalRecord.js +50 -23
  13. package/dist/records-v2/OrderRecord.d.ts +299 -86
  14. package/dist/records-v2/OrderRecord.js +405 -184
  15. package/dist/records-v2/PICRequestRecord.d.ts +38 -10
  16. package/dist/records-v2/PICRequestRecord.js +51 -23
  17. package/dist/records-v2/PaymentMethodRefundRecord.d.ts +38 -10
  18. package/dist/records-v2/PaymentMethodRefundRecord.js +51 -23
  19. package/dist/records-v2/WorkOrderRecord.d.ts +1745 -440
  20. package/dist/records-v2/WorkOrderRecord.js +2394 -969
  21. package/package.json +2 -2
  22. package/src/records-v2/AddressRecord.ts +83 -35
  23. package/src/records-v2/CaseRecord.ts +536 -251
  24. package/src/records-v2/ChurnRequestRecord.ts +72 -36
  25. package/src/records-v2/ContactRecord.ts +71 -35
  26. package/src/records-v2/ContractBuyOutRecord.ts +144 -72
  27. package/src/records-v2/OntReplacementApprovalRecord.ts +70 -35
  28. package/src/records-v2/OrderRecord.ts +575 -285
  29. package/src/records-v2/PICRequestRecord.ts +72 -36
  30. package/src/records-v2/PaymentMethodRefundRecord.ts +72 -36
  31. package/src/records-v2/WorkOrderRecord.ts +6039 -4224
@@ -20,7 +20,8 @@ import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-man
20
20
  import { AddressProperties } from '../entities-v2/Address';
21
21
  import { AddressCreateProperties } from '../actions-v2/AddressCreateDto';
22
22
  import { AddressUpdateProperties } from '../actions-v2/AddressUpdateDto';
23
- import { CreateLeadFromAddressProperties } from '../actions-v2/CreateLeadFromAddressDto';
23
+ import { CreateLeadProperties } from '../actions-v2/CreateLeadFromAddressDto';
24
+ import { CreateContactProperties } from '../actions-v2/CreateLeadFromAddressDto';
24
25
  import { OrderRecord } from './OrderRecord';
25
26
  import { ContactRecord } from './ContactRecord';
26
27
  import { CustomerDeviceOntRecord } from './CustomerDeviceOntRecord';
@@ -35,6 +36,38 @@ import { CrmDatasetRecord } from './CrmDatasetRecord';
35
36
  import { CaseRecord } from './CaseRecord';
36
37
  import { LeadRecord } from './LeadRecord';
37
38
  import { AccountRecord } from './AccountRecord';
39
+ /**
40
+ * FlowBuilder for CreateLeadFromAddress multi-step action
41
+ *
42
+ * Use method chaining to add steps, then call execute() to run the flow.
43
+ */
44
+ declare class CreateLeadFromAddressFlowBuilder {
45
+ private _record;
46
+ private _provider;
47
+ private _pendingLinks;
48
+ private _options?;
49
+ private _steps;
50
+ constructor(record: AddressRecord, provider: IOdinProvider, pendingLinks: OdinRecordLinkDto[], options?: {
51
+ journeyId?: string;
52
+ });
53
+ /**
54
+ * Add CreateLead step to the flow
55
+ * @param properties - Properties for this step
56
+ * @returns this (for method chaining)
57
+ */
58
+ createLead(properties: CreateLeadProperties): this;
59
+ /**
60
+ * Add CreateContact step to the flow
61
+ * @param properties - Properties for this step
62
+ * @returns this (for method chaining)
63
+ */
64
+ createContact(properties: CreateContactProperties): this;
65
+ /**
66
+ * Execute the flow with all collected steps
67
+ * @returns The action result
68
+ */
69
+ execute(): Promise<IDbRecordCreateUpdateRes[]>;
70
+ }
38
71
  export declare class AddressRecord {
39
72
  private _record;
40
73
  private _provider;
@@ -330,26 +363,27 @@ export declare class AddressRecord {
330
363
  /**
331
364
  * CreateLeadFromAddress
332
365
  *
333
- * Updates this Address record.
366
+ * Starts a multi-step flow action on this Address record.
367
+ * Chain step methods and call .execute() to run the flow.
334
368
  *
335
- * @param propertiesOrOptions - Properties to update, or options object
336
- * @param options - Optional settings (journeyId, stageKey)
337
- * @returns The updated record(s)
369
+ * @param options - Optional settings
370
+ * @param options.journeyId - Associate with a journey
371
+ * @returns FlowBuilder for chaining step methods
338
372
  * @throws Error if called on a new (unsaved) record
339
373
  *
340
374
  * @example
341
375
  * ```typescript
342
376
  * const record = await odinClient.addresss.get(id);
343
- * await record.createLeadFromAddress({ ... });
377
+ * await record.createLeadFromAddress()
378
+ * .createLead({ ... })
379
+ * .createContact({ ... })
380
+ * .execute();
344
381
  * ```
345
382
  */
346
- createLeadFromAddress(propertiesOrOptions?: CreateLeadFromAddressProperties | {
347
- journeyId?: string;
348
- stageKey?: string;
349
- }, options?: {
383
+ createLeadFromAddress(options?: {
350
384
  journeyId?: string;
351
- stageKey?: string;
352
- }): Promise<IDbRecordCreateUpdateRes[]>;
385
+ }): CreateLeadFromAddressFlowBuilder;
353
386
  }
354
387
  /** Type guard to check if an object is a AddressRecord */
355
388
  export declare function isAddressRecord(obj: any): obj is AddressRecord;
389
+ export {};
@@ -40,6 +40,53 @@ const CrmDatasetRecord_1 = require("./CrmDatasetRecord");
40
40
  const CaseRecord_1 = require("./CaseRecord");
41
41
  const LeadRecord_1 = require("./LeadRecord");
42
42
  const AccountRecord_1 = require("./AccountRecord");
43
+ /**
44
+ * FlowBuilder for CreateLeadFromAddress multi-step action
45
+ *
46
+ * Use method chaining to add steps, then call execute() to run the flow.
47
+ */
48
+ class CreateLeadFromAddressFlowBuilder {
49
+ constructor(record, provider, pendingLinks, options) {
50
+ this._steps = [];
51
+ this._record = record;
52
+ this._provider = provider;
53
+ this._pendingLinks = pendingLinks;
54
+ this._options = options;
55
+ }
56
+ /**
57
+ * Add CreateLead step to the flow
58
+ * @param properties - Properties for this step
59
+ * @returns this (for method chaining)
60
+ */
61
+ createLead(properties) {
62
+ this._steps.push({ actionKey: 'CreateLead', properties });
63
+ return this;
64
+ }
65
+ /**
66
+ * Add CreateContact step to the flow
67
+ * @param properties - Properties for this step
68
+ * @returns this (for method chaining)
69
+ */
70
+ createContact(properties) {
71
+ this._steps.push({ actionKey: 'CreateContact', properties });
72
+ return this;
73
+ }
74
+ /**
75
+ * Execute the flow with all collected steps
76
+ * @returns The action result
77
+ */
78
+ execute() {
79
+ return __awaiter(this, void 0, void 0, function* () {
80
+ const rawRecord = this._record.raw;
81
+ if (!(rawRecord === null || rawRecord === void 0 ? void 0 : rawRecord.id))
82
+ throw new Error('Cannot execute flow on unsaved record');
83
+ const result = yield this._provider._applyAction('CrmModule', 'Address', Object.assign({ id: rawRecord.id, entity: rawRecord.entity, type: rawRecord.type, actionName: 'CreateLeadFromAddress', steps: this._steps, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, this._options));
84
+ // Clear pending links on the record after execution
85
+ this._record.clearPendingLinks();
86
+ return result;
87
+ });
88
+ }
89
+ }
43
90
  class AddressRecord {
44
91
  /**
45
92
  * Create a record wrapper.
@@ -581,38 +628,28 @@ class AddressRecord {
581
628
  /**
582
629
  * CreateLeadFromAddress
583
630
  *
584
- * Updates this Address record.
631
+ * Starts a multi-step flow action on this Address record.
632
+ * Chain step methods and call .execute() to run the flow.
585
633
  *
586
- * @param propertiesOrOptions - Properties to update, or options object
587
- * @param options - Optional settings (journeyId, stageKey)
588
- * @returns The updated record(s)
634
+ * @param options - Optional settings
635
+ * @param options.journeyId - Associate with a journey
636
+ * @returns FlowBuilder for chaining step methods
589
637
  * @throws Error if called on a new (unsaved) record
590
638
  *
591
639
  * @example
592
640
  * ```typescript
593
641
  * const record = await odinClient.addresss.get(id);
594
- * await record.createLeadFromAddress({ ... });
642
+ * await record.createLeadFromAddress()
643
+ * .createLead({ ... })
644
+ * .createContact({ ... })
645
+ * .execute();
595
646
  * ```
596
647
  */
597
- createLeadFromAddress(propertiesOrOptions, options) {
648
+ createLeadFromAddress(options) {
598
649
  var _a;
599
- return __awaiter(this, void 0, void 0, function* () {
600
- if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
601
- throw new Error('createLeadFromAddress requires an existing record. Use accessor.get() first.');
602
- let properties = {};
603
- let opts = options;
604
- if (propertiesOrOptions) {
605
- if ('journeyId' in propertiesOrOptions || 'stageKey' in propertiesOrOptions) {
606
- opts = propertiesOrOptions;
607
- }
608
- else {
609
- properties = propertiesOrOptions;
610
- }
611
- }
612
- const result = yield this._provider._applyAction('CrmModule', 'Address', Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'CreateLeadFromAddress', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, opts));
613
- this._pendingLinks = [];
614
- return result;
615
- });
650
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
651
+ throw new Error('createLeadFromAddress requires an existing record. Use accessor.get() first.');
652
+ return new CreateLeadFromAddressFlowBuilder(this, this._provider, this._pendingLinks, options);
616
653
  }
617
654
  }
618
655
  exports.AddressRecord = AddressRecord;