@d19n/youfibre-odin-sdk 2.0.21 → 2.0.23-beta.0

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 (39) hide show
  1. package/README.md +4 -1
  2. package/dist/actions-v2/CreateAccountCreditDto.d.ts +22 -1
  3. package/dist/actions-v2/CreateInstallDto.d.ts +16 -15
  4. package/dist/actions-v2/CreateInstallDto.js +6 -4
  5. package/dist/actions-v2/CreateServiceDto.d.ts +14 -13
  6. package/dist/actions-v2/CreateServiceDto.js +3 -1
  7. package/dist/actions-v2/MoveOrderFromSupplyToActiveDto.d.ts +112 -0
  8. package/dist/actions-v2/MoveOrderFromSupplyToActiveDto.js +77 -0
  9. package/dist/actions-v2/PriceMatchDto.d.ts +12 -4
  10. package/dist/actions-v2/PriceMatchDto.js +1 -1
  11. package/dist/actions-v2/UpdateAccountCreditBalanceDto.d.ts +10 -0
  12. package/dist/api-sdk-v2/AccountCreditApi.d.ts +2 -0
  13. package/dist/api-sdk-v2/AccountCreditApi.js +6 -0
  14. package/dist/api-sdk-v2/CreditNoteApi.d.ts +2 -0
  15. package/dist/api-sdk-v2/CreditNoteApi.js +6 -0
  16. package/dist/db-sdk-v2/AccountCreditDb.d.ts +2 -0
  17. package/dist/db-sdk-v2/AccountCreditDb.js +6 -0
  18. package/dist/db-sdk-v2/CreditNoteDb.d.ts +2 -0
  19. package/dist/db-sdk-v2/CreditNoteDb.js +6 -0
  20. package/dist/entities-v2/AccountCredit.d.ts +7 -0
  21. package/dist/entities-v2/AccountCredit.js +5 -1
  22. package/dist/entities-v2/Config.d.ts +8 -8
  23. package/dist/entities-v2/Config.js +4 -4
  24. package/dist/entities-v2/CreditNote.d.ts +3 -0
  25. package/dist/entities-v2/Email.d.ts +0 -22
  26. package/dist/entities-v2/Email.js +0 -2
  27. package/dist/entities-v2/OrderItem.d.ts +44 -1
  28. package/dist/entities-v2/OrderItem.js +39 -1
  29. package/dist/entities-v2/PaymentMethodRefund.d.ts +29 -29
  30. package/dist/entities-v2/PaymentMethodRefund.js +8 -8
  31. package/dist/records-v2/AccountCreditRecord.d.ts +26 -7
  32. package/dist/records-v2/AccountCreditRecord.js +40 -15
  33. package/dist/records-v2/CreditNoteRecord.d.ts +20 -0
  34. package/dist/records-v2/CreditNoteRecord.js +33 -0
  35. package/dist/records-v2/OrderRecord.d.ts +25 -0
  36. package/dist/records-v2/OrderRecord.js +29 -0
  37. package/dist/records-v2/ServiceAppointmentConfigRecord.d.ts +1 -1
  38. package/dist/records-v2/ServiceAppointmentConfigRecord.js +2 -2
  39. package/package.json +1 -1
@@ -30,6 +30,7 @@ exports.isCreditNoteRecord = exports.CreditNoteRecord = 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 AccountCreditRecord_1 = require("./AccountCreditRecord");
33
34
  const TransactionRecord_1 = require("./TransactionRecord");
34
35
  const NoteRecord_1 = require("./NoteRecord");
35
36
  const InvoiceRecord_1 = require("./InvoiceRecord");
@@ -144,6 +145,36 @@ class CreditNoteRecord {
144
145
  get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
145
146
  /** Access the underlying OdinRecord (null for new records) */
146
147
  get record() { return this._record; }
148
+ /**
149
+ * Access linked AccountCredit records
150
+ * @remarks Available labels: AccountCredit__CreditNote
151
+ * @throws Error if called on a new (unsaved) record
152
+ *
153
+ * @example
154
+ * ```typescript
155
+ * // Get all linked AccountCredit records
156
+ * const items = await record.accountCredits.list();
157
+ * const first = await record.accountCredits.first();
158
+ *
159
+ * // Filter by label
160
+ * const specific = await record.accountCredits.first({ label: 'AccountCredit__CreditNote' });
161
+ * ```
162
+ */
163
+ get accountCredits() {
164
+ var _a;
165
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
166
+ throw new Error('Cannot access links on a new (unsaved) record');
167
+ if (!this._accountCredits) {
168
+ this._accountCredits = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
169
+ sourceEntity: 'BillingModule:CreditNote',
170
+ targetEntity: 'BillingModule:AccountCredit',
171
+ targetModuleName: 'BillingModule',
172
+ targetEntityName: 'AccountCredit',
173
+ labels: ['AccountCredit__CreditNote'],
174
+ }, AccountCreditRecord_1.AccountCreditRecord);
175
+ }
176
+ return this._accountCredits;
177
+ }
147
178
  /**
148
179
  * Access linked Transaction records
149
180
  * @remarks Available labels: CreditNote__Transaction
@@ -375,6 +406,8 @@ exports.CreditNoteRecord = CreditNoteRecord;
375
406
  // ============================================
376
407
  // TYPED LINK ACCESSORS
377
408
  // ============================================
409
+ /** Valid labels for AccountCredit associations */
410
+ CreditNoteRecord.accountCreditsLabels = ['AccountCredit__CreditNote'];
378
411
  /** Valid labels for Transaction associations */
379
412
  CreditNoteRecord.transactionsLabels = ['CreditNote__Transaction'];
380
413
  /** Valid labels for Note associations */
@@ -1859,6 +1859,31 @@ export declare class OrderRecord<TProps = OrderProperties> {
1859
1859
  moveOrderFromPreOrderToCancelled(options?: {
1860
1860
  journeyId?: string;
1861
1861
  }): ActionBuilder;
1862
+ /**
1863
+ * MoveOrderFromSupplyToActive
1864
+ *
1865
+ * Transitions this Order record to a new pipeline stage.
1866
+ * Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
1867
+ *
1868
+ * @remarks Transitions to stage: OrderStageActive
1869
+ *
1870
+ * @param options - Optional settings
1871
+ * @param options.journeyId - Associate with a journey
1872
+ * @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
1873
+ * @throws Error if called on a new (unsaved) record
1874
+ *
1875
+ * @example
1876
+ * ```typescript
1877
+ * const record = await odinClient.orders.get(id);
1878
+ * await record.moveOrderFromSupplyToActive().execute();
1879
+ *
1880
+ * // Dry run (for debugging)
1881
+ * const payload = record.moveOrderFromSupplyToActive().dryRun();
1882
+ * ```
1883
+ */
1884
+ moveOrderFromSupplyToActive(options?: {
1885
+ journeyId?: string;
1886
+ }): ActionBuilder;
1862
1887
  /**
1863
1888
  * MoveOrderToActive
1864
1889
  *
@@ -2719,6 +2719,35 @@ class OrderRecord {
2719
2719
  const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MoveOrderFromPreOrderToCancelled', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'OrderStageCancelled' }, options);
2720
2720
  return new ActionBuilder(this._provider, 'OrderModule', 'Order', payload, () => { this._pendingLinks = []; });
2721
2721
  }
2722
+ /**
2723
+ * MoveOrderFromSupplyToActive
2724
+ *
2725
+ * Transitions this Order record to a new pipeline stage.
2726
+ * Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
2727
+ *
2728
+ * @remarks Transitions to stage: OrderStageActive
2729
+ *
2730
+ * @param options - Optional settings
2731
+ * @param options.journeyId - Associate with a journey
2732
+ * @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
2733
+ * @throws Error if called on a new (unsaved) record
2734
+ *
2735
+ * @example
2736
+ * ```typescript
2737
+ * const record = await odinClient.orders.get(id);
2738
+ * await record.moveOrderFromSupplyToActive().execute();
2739
+ *
2740
+ * // Dry run (for debugging)
2741
+ * const payload = record.moveOrderFromSupplyToActive().dryRun();
2742
+ * ```
2743
+ */
2744
+ moveOrderFromSupplyToActive(options) {
2745
+ var _a;
2746
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
2747
+ throw new Error('moveOrderFromSupplyToActive requires an existing record. Use accessor.get() first.');
2748
+ const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MoveOrderFromSupplyToActive', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'OrderStageActive' }, options);
2749
+ return new ActionBuilder(this._provider, 'OrderModule', 'Order', payload, () => { this._pendingLinks = []; });
2750
+ }
2722
2751
  /**
2723
2752
  * MoveOrderToActive
2724
2753
  *
@@ -456,7 +456,7 @@ export declare class ServiceAppointmentConfigRecord<TProps = ServiceAppointmentC
456
456
  stageKey?: string;
457
457
  }): ActionBuilder;
458
458
  /**
459
- * Create INSTALL
459
+ * CreateINSTALL
460
460
  *
461
461
  * Creates a new ServiceAppointmentConfig record with the specified properties.
462
462
  * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
@@ -566,7 +566,7 @@ class ServiceAppointmentConfigRecord {
566
566
  return new ActionBuilder(this._provider, 'FieldServiceModule', 'ServiceAppointmentConfig', payload, () => { this._pendingLinks = []; });
567
567
  }
568
568
  /**
569
- * Create INSTALL
569
+ * CreateINSTALL
570
570
  *
571
571
  * Creates a new ServiceAppointmentConfig record with the specified properties.
572
572
  * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
@@ -593,7 +593,7 @@ class ServiceAppointmentConfigRecord {
593
593
  const payload = {
594
594
  entity: 'FieldServiceModule:ServiceAppointmentConfig',
595
595
  type: 'INSTALL',
596
- actionName: 'Create INSTALL',
596
+ actionName: 'CreateINSTALL',
597
597
  properties: properties || {},
598
598
  associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined,
599
599
  journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "2.0.21",
3
+ "version": "2.0.23-beta.0",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",