@d19n/youfibre-odin-sdk 2.0.13-beta.1 → 2.0.13

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 (239) hide show
  1. package/README.md +11 -10
  2. package/dist/actions-v2/CreateOrderFromBrskDto.d.ts +75 -0
  3. package/dist/actions-v2/CreateOrderItemFromBrskDto.d.ts +191 -0
  4. package/dist/actions-v2/CreateOrderItemFromBrskDto.js +52 -0
  5. package/dist/entities-v2/Order.d.ts +7 -0
  6. package/dist/entities-v2/Order.js +2 -0
  7. package/dist/entities-v2/OrderItem.d.ts +7 -0
  8. package/dist/entities-v2/OrderItem.js +2 -0
  9. package/dist/entities-v2/Product.d.ts +0 -42
  10. package/dist/entities-v2/Product.js +0 -2
  11. package/dist/records-v2/AccountCreditRecord.d.ts +62 -1
  12. package/dist/records-v2/AccountCreditRecord.js +91 -0
  13. package/dist/records-v2/AccountRecord.d.ts +306 -2
  14. package/dist/records-v2/AccountRecord.js +451 -0
  15. package/dist/records-v2/ActivityLogRecord.d.ts +122 -1
  16. package/dist/records-v2/ActivityLogRecord.js +190 -0
  17. package/dist/records-v2/ActivityRecord.d.ts +255 -2
  18. package/dist/records-v2/ActivityRecord.js +387 -0
  19. package/dist/records-v2/AddressRecord.d.ts +321 -0
  20. package/dist/records-v2/AddressRecord.js +532 -0
  21. package/dist/records-v2/AffiliateCodeRecord.d.ts +102 -1
  22. package/dist/records-v2/AffiliateCodeRecord.js +157 -0
  23. package/dist/records-v2/AppointmentRecord.d.ts +141 -0
  24. package/dist/records-v2/AppointmentRecord.js +235 -0
  25. package/dist/records-v2/BillingAdjustmentRecord.d.ts +81 -0
  26. package/dist/records-v2/BillingAdjustmentRecord.js +136 -0
  27. package/dist/records-v2/BillingRequestRecord.d.ts +178 -2
  28. package/dist/records-v2/BillingRequestRecord.js +271 -0
  29. package/dist/records-v2/BlockageA55Record.d.ts +103 -2
  30. package/dist/records-v2/BlockageA55Record.js +157 -0
  31. package/dist/records-v2/BrskEntityMigrationErrorRecord.d.ts +21 -1
  32. package/dist/records-v2/BrskEntityMigrationErrorRecord.js +21 -0
  33. package/dist/records-v2/CallEventRecord.d.ts +82 -1
  34. package/dist/records-v2/CallEventRecord.js +124 -0
  35. package/dist/records-v2/CallLegRecord.d.ts +82 -1
  36. package/dist/records-v2/CallLegRecord.js +124 -0
  37. package/dist/records-v2/CallRecord.d.ts +202 -1
  38. package/dist/records-v2/CallRecord.js +322 -0
  39. package/dist/records-v2/CallTransferRecord.d.ts +102 -1
  40. package/dist/records-v2/CallTransferRecord.js +157 -0
  41. package/dist/records-v2/CampaignRecord.d.ts +83 -2
  42. package/dist/records-v2/CampaignRecord.js +124 -0
  43. package/dist/records-v2/CaseRecord.d.ts +418 -2
  44. package/dist/records-v2/CaseRecord.js +667 -0
  45. package/dist/records-v2/ChangeReasonRecord.d.ts +171 -2
  46. package/dist/records-v2/ChangeReasonRecord.js +238 -0
  47. package/dist/records-v2/ChurnRequestRecord.d.ts +62 -1
  48. package/dist/records-v2/ChurnRequestRecord.js +91 -0
  49. package/dist/records-v2/ContactRecord.d.ts +560 -0
  50. package/dist/records-v2/ContactRecord.js +927 -0
  51. package/dist/records-v2/ContractBuyOutRecord.d.ts +162 -1
  52. package/dist/records-v2/ContractBuyOutRecord.js +256 -0
  53. package/dist/records-v2/ConversationFeedbackRecord.d.ts +102 -1
  54. package/dist/records-v2/ConversationFeedbackRecord.js +157 -0
  55. package/dist/records-v2/ConversationRecord.d.ts +102 -1
  56. package/dist/records-v2/ConversationRecord.js +157 -0
  57. package/dist/records-v2/CreditNoteRecord.d.ts +81 -0
  58. package/dist/records-v2/CreditNoteRecord.js +136 -0
  59. package/dist/records-v2/CrmDatasetRecord.d.ts +191 -2
  60. package/dist/records-v2/CrmDatasetRecord.js +271 -0
  61. package/dist/records-v2/CustomerDeviceAtaRecord.d.ts +21 -0
  62. package/dist/records-v2/CustomerDeviceAtaRecord.js +37 -0
  63. package/dist/records-v2/CustomerDeviceConfigurationRecord.d.ts +62 -1
  64. package/dist/records-v2/CustomerDeviceConfigurationRecord.js +91 -0
  65. package/dist/records-v2/CustomerDeviceOntRecord.d.ts +181 -0
  66. package/dist/records-v2/CustomerDeviceOntRecord.js +301 -0
  67. package/dist/records-v2/CustomerDeviceRouterRecord.d.ts +141 -0
  68. package/dist/records-v2/CustomerDeviceRouterRecord.js +235 -0
  69. package/dist/records-v2/CustomerPhonePortingRecord.d.ts +21 -0
  70. package/dist/records-v2/CustomerPhonePortingRecord.js +37 -0
  71. package/dist/records-v2/DiscountRecord.d.ts +121 -0
  72. package/dist/records-v2/DiscountRecord.js +202 -0
  73. package/dist/records-v2/EmailRecord.d.ts +230 -2
  74. package/dist/records-v2/EmailRecord.js +336 -0
  75. package/dist/records-v2/EmailSenderRecord.d.ts +42 -1
  76. package/dist/records-v2/EmailSenderRecord.js +58 -0
  77. package/dist/records-v2/EmailTemplateRecord.d.ts +21 -1
  78. package/dist/records-v2/EmailTemplateRecord.js +21 -0
  79. package/dist/records-v2/FieldServiceDispatchedProductRecord.d.ts +135 -2
  80. package/dist/records-v2/FieldServiceDispatchedProductRecord.js +189 -0
  81. package/dist/records-v2/FieldServiceProductRecord.d.ts +115 -2
  82. package/dist/records-v2/FieldServiceProductRecord.js +156 -0
  83. package/dist/records-v2/FileRecord.d.ts +1211 -2
  84. package/dist/records-v2/FileRecord.js +1902 -0
  85. package/dist/records-v2/ImpersonationTrackerRecord.d.ts +62 -1
  86. package/dist/records-v2/ImpersonationTrackerRecord.js +91 -0
  87. package/dist/records-v2/InternalInstallAuditRecord.d.ts +83 -2
  88. package/dist/records-v2/InternalInstallAuditRecord.js +124 -0
  89. package/dist/records-v2/InvoiceItemRecord.d.ts +40 -0
  90. package/dist/records-v2/InvoiceItemRecord.js +69 -0
  91. package/dist/records-v2/InvoiceRecord.d.ts +399 -2
  92. package/dist/records-v2/InvoiceRecord.js +635 -0
  93. package/dist/records-v2/KnowledgeArticleRecord.d.ts +98 -2
  94. package/dist/records-v2/KnowledgeArticleRecord.js +139 -0
  95. package/dist/records-v2/LeadRecord.d.ts +261 -0
  96. package/dist/records-v2/LeadRecord.js +433 -0
  97. package/dist/records-v2/MessageRecord.d.ts +99 -2
  98. package/dist/records-v2/MessageRecord.js +140 -0
  99. package/dist/records-v2/NetworkDeviceRecord.d.ts +43 -2
  100. package/dist/records-v2/NetworkDeviceRecord.js +58 -0
  101. package/dist/records-v2/NoteRecord.d.ts +1121 -1
  102. package/dist/records-v2/NoteRecord.js +1839 -0
  103. package/dist/records-v2/OfferRecord.d.ts +154 -2
  104. package/dist/records-v2/OfferRecord.js +221 -0
  105. package/dist/records-v2/OhAuditOfInstallationRecord.d.ts +83 -2
  106. package/dist/records-v2/OhAuditOfInstallationRecord.js +124 -0
  107. package/dist/records-v2/OhExternalAuditRecord.d.ts +83 -2
  108. package/dist/records-v2/OhExternalAuditRecord.js +124 -0
  109. package/dist/records-v2/OhInProgressAuditRecord.d.ts +83 -2
  110. package/dist/records-v2/OhInProgressAuditRecord.js +124 -0
  111. package/dist/records-v2/OhInstallationAuditRecord.d.ts +83 -2
  112. package/dist/records-v2/OhInstallationAuditRecord.js +124 -0
  113. package/dist/records-v2/OhRetroAuditRecord.d.ts +83 -2
  114. package/dist/records-v2/OhRetroAuditRecord.js +124 -0
  115. package/dist/records-v2/OneTouchSwitchRecord.d.ts +255 -2
  116. package/dist/records-v2/OneTouchSwitchRecord.js +387 -0
  117. package/dist/records-v2/OntReplacementApprovalRecord.d.ts +62 -1
  118. package/dist/records-v2/OntReplacementApprovalRecord.js +91 -0
  119. package/dist/records-v2/OrderCheckRecord.d.ts +21 -0
  120. package/dist/records-v2/OrderCheckRecord.js +37 -0
  121. package/dist/records-v2/OrderItemRecord.d.ts +309 -0
  122. package/dist/records-v2/OrderItemRecord.js +501 -0
  123. package/dist/records-v2/OrderKciRecord.d.ts +42 -1
  124. package/dist/records-v2/OrderKciRecord.js +58 -0
  125. package/dist/records-v2/OrderRecord.d.ts +620 -0
  126. package/dist/records-v2/OrderRecord.js +1026 -0
  127. package/dist/records-v2/OutageRecord.d.ts +42 -1
  128. package/dist/records-v2/OutageRecord.js +58 -0
  129. package/dist/records-v2/OverlayRealA55Record.d.ts +83 -2
  130. package/dist/records-v2/OverlayRealA55Record.js +124 -0
  131. package/dist/records-v2/PICRequestRecord.d.ts +62 -1
  132. package/dist/records-v2/PICRequestRecord.js +91 -0
  133. package/dist/records-v2/PaymentMethodRecord.d.ts +121 -0
  134. package/dist/records-v2/PaymentMethodRecord.js +202 -0
  135. package/dist/records-v2/PaymentMethodRefundRecord.d.ts +181 -0
  136. package/dist/records-v2/PaymentMethodRefundRecord.js +301 -0
  137. package/dist/records-v2/PaymentRecord.d.ts +82 -1
  138. package/dist/records-v2/PaymentRecord.js +124 -0
  139. package/dist/records-v2/PermissionToFailRecord.d.ts +61 -0
  140. package/dist/records-v2/PermissionToFailRecord.js +103 -0
  141. package/dist/records-v2/PgAccountValidationRecord.d.ts +21 -1
  142. package/dist/records-v2/PgAccountValidationRecord.js +21 -0
  143. package/dist/records-v2/PgContactRecord.d.ts +62 -1
  144. package/dist/records-v2/PgContactRecord.js +91 -0
  145. package/dist/records-v2/PgDirectDebitFileRecord.d.ts +95 -2
  146. package/dist/records-v2/PgDirectDebitFileRecord.js +123 -0
  147. package/dist/records-v2/PgDisputeRecord.d.ts +62 -1
  148. package/dist/records-v2/PgDisputeRecord.js +91 -0
  149. package/dist/records-v2/PgFileAllocationRecord.d.ts +115 -2
  150. package/dist/records-v2/PgFileAllocationRecord.js +156 -0
  151. package/dist/records-v2/PgLogRecord.d.ts +21 -1
  152. package/dist/records-v2/PgLogRecord.js +21 -0
  153. package/dist/records-v2/PgPaymentMethodRecord.d.ts +102 -1
  154. package/dist/records-v2/PgPaymentMethodRecord.js +157 -0
  155. package/dist/records-v2/PgSortCodeSubstitutionRecord.d.ts +21 -1
  156. package/dist/records-v2/PgSortCodeSubstitutionRecord.js +21 -0
  157. package/dist/records-v2/PgTransactionRecord.d.ts +135 -2
  158. package/dist/records-v2/PgTransactionRecord.js +189 -0
  159. package/dist/records-v2/PgVocalinkRecord.d.ts +21 -1
  160. package/dist/records-v2/PgVocalinkRecord.js +21 -0
  161. package/dist/records-v2/PgWebhookAttemptRecord.d.ts +42 -1
  162. package/dist/records-v2/PgWebhookAttemptRecord.js +58 -0
  163. package/dist/records-v2/PgWebhookRecord.d.ts +122 -1
  164. package/dist/records-v2/PgWebhookRecord.js +190 -0
  165. package/dist/records-v2/PhoneNumberRecord.d.ts +41 -0
  166. package/dist/records-v2/PhoneNumberRecord.js +70 -0
  167. package/dist/records-v2/PriceBookRecord.d.ts +21 -0
  168. package/dist/records-v2/PriceBookRecord.js +37 -0
  169. package/dist/records-v2/ProductRecord.d.ts +258 -2
  170. package/dist/records-v2/ProductRecord.js +351 -0
  171. package/dist/records-v2/PushNotificationRecord.d.ts +162 -1
  172. package/dist/records-v2/PushNotificationRecord.js +256 -0
  173. package/dist/records-v2/ReferralRecord.d.ts +143 -2
  174. package/dist/records-v2/ReferralRecord.js +223 -0
  175. package/dist/records-v2/RemediationOutcomeFormRecord.d.ts +83 -2
  176. package/dist/records-v2/RemediationOutcomeFormRecord.js +124 -0
  177. package/dist/records-v2/RemediationRequiredReasonRecord.d.ts +103 -2
  178. package/dist/records-v2/RemediationRequiredReasonRecord.js +157 -0
  179. package/dist/records-v2/ReturnsRecord.d.ts +62 -1
  180. package/dist/records-v2/ReturnsRecord.js +91 -0
  181. package/dist/records-v2/RewardRecord.d.ts +123 -2
  182. package/dist/records-v2/RewardRecord.js +190 -0
  183. package/dist/records-v2/SalesTerritoryRecord.d.ts +79 -2
  184. package/dist/records-v2/SalesTerritoryRecord.js +107 -0
  185. package/dist/records-v2/ScheduleSlotRecord.d.ts +42 -1
  186. package/dist/records-v2/ScheduleSlotRecord.js +58 -0
  187. package/dist/records-v2/ServiceAppointmentConfigRecord.d.ts +287 -2
  188. package/dist/records-v2/ServiceAppointmentConfigRecord.js +367 -0
  189. package/dist/records-v2/ServiceAppointmentRecord.d.ts +81 -0
  190. package/dist/records-v2/ServiceAppointmentRecord.js +136 -0
  191. package/dist/records-v2/ServiceRecord.d.ts +40 -0
  192. package/dist/records-v2/ServiceRecord.js +69 -0
  193. package/dist/records-v2/ServiceVisitAuditRecord.d.ts +83 -2
  194. package/dist/records-v2/ServiceVisitAuditRecord.js +124 -0
  195. package/dist/records-v2/SiteSpecificRiskAssessmentOutcomeFormRecord.d.ts +83 -2
  196. package/dist/records-v2/SiteSpecificRiskAssessmentOutcomeFormRecord.js +124 -0
  197. package/dist/records-v2/SmsMessageRecord.d.ts +175 -2
  198. package/dist/records-v2/SmsMessageRecord.js +255 -0
  199. package/dist/records-v2/SweeperMaintenanceAuditRecord.d.ts +83 -2
  200. package/dist/records-v2/SweeperMaintenanceAuditRecord.js +124 -0
  201. package/dist/records-v2/TeamRecord.d.ts +101 -0
  202. package/dist/records-v2/TeamRecord.js +169 -0
  203. package/dist/records-v2/TestEntityForVisualBuilderRecord.d.ts +115 -2
  204. package/dist/records-v2/TestEntityForVisualBuilderRecord.js +156 -0
  205. package/dist/records-v2/TimeSlotRecord.d.ts +21 -0
  206. package/dist/records-v2/TimeSlotRecord.js +37 -0
  207. package/dist/records-v2/TransactionRecord.d.ts +181 -1
  208. package/dist/records-v2/TransactionRecord.js +288 -0
  209. package/dist/records-v2/TwilioUserUpdateRecord.d.ts +42 -1
  210. package/dist/records-v2/TwilioUserUpdateRecord.js +58 -0
  211. package/dist/records-v2/UgAuditOfInstallationRecord.d.ts +83 -2
  212. package/dist/records-v2/UgAuditOfInstallationRecord.js +124 -0
  213. package/dist/records-v2/UgExternalAuditRecord.d.ts +83 -2
  214. package/dist/records-v2/UgExternalAuditRecord.js +124 -0
  215. package/dist/records-v2/UgInProgressAuditRecord.d.ts +83 -2
  216. package/dist/records-v2/UgInProgressAuditRecord.js +124 -0
  217. package/dist/records-v2/UgInstallationAuditRecord.d.ts +83 -2
  218. package/dist/records-v2/UgInstallationAuditRecord.js +124 -0
  219. package/dist/records-v2/UgRetroAuditRecord.d.ts +83 -2
  220. package/dist/records-v2/UgRetroAuditRecord.js +124 -0
  221. package/dist/records-v2/UserRecord.d.ts +400 -0
  222. package/dist/records-v2/UserRecord.js +663 -0
  223. package/dist/records-v2/VisitRecord.d.ts +121 -0
  224. package/dist/records-v2/VisitRecord.js +202 -0
  225. package/dist/records-v2/VoiceConfigurationRecord.d.ts +21 -0
  226. package/dist/records-v2/VoiceConfigurationRecord.js +37 -0
  227. package/dist/records-v2/WayleaveAuditRecord.d.ts +83 -2
  228. package/dist/records-v2/WayleaveAuditRecord.js +124 -0
  229. package/dist/records-v2/WorkOrderRecord.d.ts +1226 -2
  230. package/dist/records-v2/WorkOrderRecord.js +1865 -0
  231. package/dist/records-v2/WorkOrderStatusUpdateRecord.d.ts +75 -2
  232. package/dist/records-v2/WorkOrderStatusUpdateRecord.js +90 -0
  233. package/dist/records-v2/YfFieldServiceVisitRecord.d.ts +83 -2
  234. package/dist/records-v2/YfFieldServiceVisitRecord.js +124 -0
  235. package/dist/records-v2/YfStockAuditRecord.d.ts +103 -2
  236. package/dist/records-v2/YfStockAuditRecord.js +157 -0
  237. package/dist/records-v2/index.d.ts +1 -1
  238. package/dist/records-v2/index.js +5 -5
  239. package/package.json +1 -1
@@ -29,6 +29,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
29
29
  exports.isLeadRecord = exports.LeadRecord = void 0;
30
30
  const uuid_1 = require("uuid");
31
31
  const core_1 = require("@d19n/odin-types/dist/core");
32
+ const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
33
+ const NoteRecord_1 = require("./NoteRecord");
34
+ const CallRecord_1 = require("./CallRecord");
35
+ const OfferRecord_1 = require("./OfferRecord");
36
+ const DiscountRecord_1 = require("./DiscountRecord");
37
+ const ProductRecord_1 = require("./ProductRecord");
38
+ const ContactRecord_1 = require("./ContactRecord");
39
+ const OrderRecord_1 = require("./OrderRecord");
40
+ const FileRecord_1 = require("./FileRecord");
41
+ const WorkOrderRecord_1 = require("./WorkOrderRecord");
42
+ const CrmDatasetRecord_1 = require("./CrmDatasetRecord");
43
+ const VisitRecord_1 = require("./VisitRecord");
44
+ const AddressRecord_1 = require("./AddressRecord");
45
+ const AppointmentRecord_1 = require("./AppointmentRecord");
32
46
  /**
33
47
  * Builder for action execution with dryRun support
34
48
  *
@@ -139,6 +153,396 @@ class LeadRecord {
139
153
  get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
140
154
  /** Access the underlying OdinRecord (null for new records) */
141
155
  get record() { return this._record; }
156
+ /**
157
+ * Access linked Note records
158
+ * @remarks Available labels: Lead__Note
159
+ * @throws Error if called on a new (unsaved) record
160
+ *
161
+ * @example
162
+ * ```typescript
163
+ * // Get all linked Note records
164
+ * const items = await record.notes.list();
165
+ * const first = await record.notes.first();
166
+ *
167
+ * // Filter by label
168
+ * const specific = await record.notes.first({ label: 'Lead__Note' });
169
+ * ```
170
+ */
171
+ get notes() {
172
+ var _a;
173
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
174
+ throw new Error('Cannot access links on a new (unsaved) record');
175
+ if (!this._notes) {
176
+ this._notes = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
177
+ sourceEntity: 'CrmModule:Lead',
178
+ targetEntity: 'SupportModule:Note',
179
+ targetModuleName: 'SupportModule',
180
+ targetEntityName: 'Note',
181
+ labels: ['Lead__Note'],
182
+ }, NoteRecord_1.NoteRecord);
183
+ }
184
+ return this._notes;
185
+ }
186
+ /**
187
+ * Access linked Call records
188
+ * @remarks Available labels: Call__Lead
189
+ * @throws Error if called on a new (unsaved) record
190
+ *
191
+ * @example
192
+ * ```typescript
193
+ * // Get all linked Call records
194
+ * const items = await record.calls.list();
195
+ * const first = await record.calls.first();
196
+ *
197
+ * // Filter by label
198
+ * const specific = await record.calls.first({ label: 'Call__Lead' });
199
+ * ```
200
+ */
201
+ get calls() {
202
+ var _a;
203
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
204
+ throw new Error('Cannot access links on a new (unsaved) record');
205
+ if (!this._calls) {
206
+ this._calls = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
207
+ sourceEntity: 'CrmModule:Lead',
208
+ targetEntity: 'NotificationModule:Call',
209
+ targetModuleName: 'NotificationModule',
210
+ targetEntityName: 'Call',
211
+ labels: ['Call__Lead'],
212
+ }, CallRecord_1.CallRecord);
213
+ }
214
+ return this._calls;
215
+ }
216
+ /**
217
+ * Access linked Offer records
218
+ * @remarks Available labels: Lead__Offer
219
+ * @throws Error if called on a new (unsaved) record
220
+ *
221
+ * @example
222
+ * ```typescript
223
+ * // Get all linked Offer records
224
+ * const items = await record.offers.list();
225
+ * const first = await record.offers.first();
226
+ *
227
+ * // Filter by label
228
+ * const specific = await record.offers.first({ label: 'Lead__Offer' });
229
+ * ```
230
+ */
231
+ get offers() {
232
+ var _a;
233
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
234
+ throw new Error('Cannot access links on a new (unsaved) record');
235
+ if (!this._offers) {
236
+ this._offers = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
237
+ sourceEntity: 'CrmModule:Lead',
238
+ targetEntity: 'ProductModule:Offer',
239
+ targetModuleName: 'ProductModule',
240
+ targetEntityName: 'Offer',
241
+ labels: ['Lead__Offer'],
242
+ }, OfferRecord_1.OfferRecord);
243
+ }
244
+ return this._offers;
245
+ }
246
+ /**
247
+ * Access linked Discount records
248
+ * @remarks Available labels: Lead__Discount
249
+ * @throws Error if called on a new (unsaved) record
250
+ *
251
+ * @example
252
+ * ```typescript
253
+ * // Get all linked Discount records
254
+ * const items = await record.discounts.list();
255
+ * const first = await record.discounts.first();
256
+ *
257
+ * // Filter by label
258
+ * const specific = await record.discounts.first({ label: 'Lead__Discount' });
259
+ * ```
260
+ */
261
+ get discounts() {
262
+ var _a;
263
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
264
+ throw new Error('Cannot access links on a new (unsaved) record');
265
+ if (!this._discounts) {
266
+ this._discounts = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
267
+ sourceEntity: 'CrmModule:Lead',
268
+ targetEntity: 'ProductModule:Discount',
269
+ targetModuleName: 'ProductModule',
270
+ targetEntityName: 'Discount',
271
+ labels: ['Lead__Discount'],
272
+ }, DiscountRecord_1.DiscountRecord);
273
+ }
274
+ return this._discounts;
275
+ }
276
+ /**
277
+ * Access linked Product records
278
+ * @remarks Available labels: Lead__Product
279
+ * @throws Error if called on a new (unsaved) record
280
+ *
281
+ * @example
282
+ * ```typescript
283
+ * // Get all linked Product records
284
+ * const items = await record.products.list();
285
+ * const first = await record.products.first();
286
+ *
287
+ * // Filter by label
288
+ * const specific = await record.products.first({ label: 'Lead__Product' });
289
+ * ```
290
+ */
291
+ get products() {
292
+ var _a;
293
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
294
+ throw new Error('Cannot access links on a new (unsaved) record');
295
+ if (!this._products) {
296
+ this._products = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
297
+ sourceEntity: 'CrmModule:Lead',
298
+ targetEntity: 'ProductModule:Product',
299
+ targetModuleName: 'ProductModule',
300
+ targetEntityName: 'Product',
301
+ labels: ['Lead__Product'],
302
+ }, ProductRecord_1.ProductRecord);
303
+ }
304
+ return this._products;
305
+ }
306
+ /**
307
+ * Access linked Contact records
308
+ * @remarks Available labels: Lead__Contact
309
+ * @throws Error if called on a new (unsaved) record
310
+ *
311
+ * @example
312
+ * ```typescript
313
+ * // Get all linked Contact records
314
+ * const items = await record.contacts.list();
315
+ * const first = await record.contacts.first();
316
+ *
317
+ * // Filter by label
318
+ * const specific = await record.contacts.first({ label: 'Lead__Contact' });
319
+ * ```
320
+ */
321
+ get contacts() {
322
+ var _a;
323
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
324
+ throw new Error('Cannot access links on a new (unsaved) record');
325
+ if (!this._contacts) {
326
+ this._contacts = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
327
+ sourceEntity: 'CrmModule:Lead',
328
+ targetEntity: 'CrmModule:Contact',
329
+ targetModuleName: 'CrmModule',
330
+ targetEntityName: 'Contact',
331
+ labels: ['Lead__Contact'],
332
+ }, ContactRecord_1.ContactRecord);
333
+ }
334
+ return this._contacts;
335
+ }
336
+ /**
337
+ * Access linked Order records
338
+ * @remarks Available labels: Lead_Order
339
+ * @throws Error if called on a new (unsaved) record
340
+ *
341
+ * @example
342
+ * ```typescript
343
+ * // Get all linked Order records
344
+ * const items = await record.orders.list();
345
+ * const first = await record.orders.first();
346
+ *
347
+ * // Filter by label
348
+ * const specific = await record.orders.first({ label: 'Lead_Order' });
349
+ * ```
350
+ */
351
+ get orders() {
352
+ var _a;
353
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
354
+ throw new Error('Cannot access links on a new (unsaved) record');
355
+ if (!this._orders) {
356
+ this._orders = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
357
+ sourceEntity: 'CrmModule:Lead',
358
+ targetEntity: 'OrderModule:Order',
359
+ targetModuleName: 'OrderModule',
360
+ targetEntityName: 'Order',
361
+ labels: ['Lead_Order'],
362
+ }, OrderRecord_1.OrderRecord);
363
+ }
364
+ return this._orders;
365
+ }
366
+ /**
367
+ * Access linked File records
368
+ * @remarks Available labels: Lead__File
369
+ * @throws Error if called on a new (unsaved) record
370
+ *
371
+ * @example
372
+ * ```typescript
373
+ * // Get all linked File records
374
+ * const items = await record.files.list();
375
+ * const first = await record.files.first();
376
+ *
377
+ * // Filter by label
378
+ * const specific = await record.files.first({ label: 'Lead__File' });
379
+ * ```
380
+ */
381
+ get files() {
382
+ var _a;
383
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
384
+ throw new Error('Cannot access links on a new (unsaved) record');
385
+ if (!this._files) {
386
+ this._files = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
387
+ sourceEntity: 'CrmModule:Lead',
388
+ targetEntity: 'SchemaModule:File',
389
+ targetModuleName: 'SchemaModule',
390
+ targetEntityName: 'File',
391
+ labels: ['Lead__File'],
392
+ }, FileRecord_1.FileRecord);
393
+ }
394
+ return this._files;
395
+ }
396
+ /**
397
+ * Access linked WorkOrder records
398
+ * @remarks Available labels: WorkOrder__Lead
399
+ * @throws Error if called on a new (unsaved) record
400
+ *
401
+ * @example
402
+ * ```typescript
403
+ * // Get all linked WorkOrder records
404
+ * const items = await record.workOrders.list();
405
+ * const first = await record.workOrders.first();
406
+ *
407
+ * // Filter by label
408
+ * const specific = await record.workOrders.first({ label: 'WorkOrder__Lead' });
409
+ * ```
410
+ */
411
+ get workOrders() {
412
+ var _a;
413
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
414
+ throw new Error('Cannot access links on a new (unsaved) record');
415
+ if (!this._workOrders) {
416
+ this._workOrders = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
417
+ sourceEntity: 'CrmModule:Lead',
418
+ targetEntity: 'FieldServiceModule:WorkOrder',
419
+ targetModuleName: 'FieldServiceModule',
420
+ targetEntityName: 'WorkOrder',
421
+ labels: ['WorkOrder__Lead'],
422
+ }, WorkOrderRecord_1.WorkOrderRecord);
423
+ }
424
+ return this._workOrders;
425
+ }
426
+ /**
427
+ * Access linked CrmDataset records
428
+ * @remarks Available labels: CrmDataset__Lead
429
+ * @throws Error if called on a new (unsaved) record
430
+ *
431
+ * @example
432
+ * ```typescript
433
+ * // Get all linked CrmDataset records
434
+ * const items = await record.crmDatasets.list();
435
+ * const first = await record.crmDatasets.first();
436
+ *
437
+ * // Filter by label
438
+ * const specific = await record.crmDatasets.first({ label: 'CrmDataset__Lead' });
439
+ * ```
440
+ */
441
+ get crmDatasets() {
442
+ var _a;
443
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
444
+ throw new Error('Cannot access links on a new (unsaved) record');
445
+ if (!this._crmDatasets) {
446
+ this._crmDatasets = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
447
+ sourceEntity: 'CrmModule:Lead',
448
+ targetEntity: 'CrmModule:CrmDataset',
449
+ targetModuleName: 'CrmModule',
450
+ targetEntityName: 'CrmDataset',
451
+ labels: ['CrmDataset__Lead'],
452
+ }, CrmDatasetRecord_1.CrmDatasetRecord);
453
+ }
454
+ return this._crmDatasets;
455
+ }
456
+ /**
457
+ * Access linked Visit records
458
+ * @remarks Available labels: Lead__Visit
459
+ * @throws Error if called on a new (unsaved) record
460
+ *
461
+ * @example
462
+ * ```typescript
463
+ * // Get all linked Visit records
464
+ * const items = await record.visits.list();
465
+ * const first = await record.visits.first();
466
+ *
467
+ * // Filter by label
468
+ * const specific = await record.visits.first({ label: 'Lead__Visit' });
469
+ * ```
470
+ */
471
+ get visits() {
472
+ var _a;
473
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
474
+ throw new Error('Cannot access links on a new (unsaved) record');
475
+ if (!this._visits) {
476
+ this._visits = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
477
+ sourceEntity: 'CrmModule:Lead',
478
+ targetEntity: 'CrmModule:Visit',
479
+ targetModuleName: 'CrmModule',
480
+ targetEntityName: 'Visit',
481
+ labels: ['Lead__Visit'],
482
+ }, VisitRecord_1.VisitRecord);
483
+ }
484
+ return this._visits;
485
+ }
486
+ /**
487
+ * Access linked Address records
488
+ * @remarks Available labels: Lead_Address
489
+ * @throws Error if called on a new (unsaved) record
490
+ *
491
+ * @example
492
+ * ```typescript
493
+ * // Get all linked Address records
494
+ * const items = await record.addresses.list();
495
+ * const first = await record.addresses.first();
496
+ *
497
+ * // Filter by label
498
+ * const specific = await record.addresses.first({ label: 'Lead_Address' });
499
+ * ```
500
+ */
501
+ get addresses() {
502
+ var _a;
503
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
504
+ throw new Error('Cannot access links on a new (unsaved) record');
505
+ if (!this._addresses) {
506
+ this._addresses = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
507
+ sourceEntity: 'CrmModule:Lead',
508
+ targetEntity: 'CrmModule:Address',
509
+ targetModuleName: 'CrmModule',
510
+ targetEntityName: 'Address',
511
+ labels: ['Lead_Address'],
512
+ }, AddressRecord_1.AddressRecord);
513
+ }
514
+ return this._addresses;
515
+ }
516
+ /**
517
+ * Access linked Appointment records
518
+ * @remarks Available labels: Lead_Appointment
519
+ * @throws Error if called on a new (unsaved) record
520
+ *
521
+ * @example
522
+ * ```typescript
523
+ * // Get all linked Appointment records
524
+ * const items = await record.appointments.list();
525
+ * const first = await record.appointments.first();
526
+ *
527
+ * // Filter by label
528
+ * const specific = await record.appointments.first({ label: 'Lead_Appointment' });
529
+ * ```
530
+ */
531
+ get appointments() {
532
+ var _a;
533
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
534
+ throw new Error('Cannot access links on a new (unsaved) record');
535
+ if (!this._appointments) {
536
+ this._appointments = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
537
+ sourceEntity: 'CrmModule:Lead',
538
+ targetEntity: 'CrmModule:Appointment',
539
+ targetModuleName: 'CrmModule',
540
+ targetEntityName: 'Appointment',
541
+ labels: ['Lead_Appointment'],
542
+ }, AppointmentRecord_1.AppointmentRecord);
543
+ }
544
+ return this._appointments;
545
+ }
142
546
  // ============================================
143
547
  // LINK MANAGEMENT
144
548
  // ============================================
@@ -399,6 +803,35 @@ class LeadRecord {
399
803
  }
400
804
  }
401
805
  exports.LeadRecord = LeadRecord;
806
+ // ============================================
807
+ // TYPED LINK ACCESSORS
808
+ // ============================================
809
+ /** Valid labels for Note associations */
810
+ LeadRecord.notesLabels = ['Lead__Note'];
811
+ /** Valid labels for Call associations */
812
+ LeadRecord.callsLabels = ['Call__Lead'];
813
+ /** Valid labels for Offer associations */
814
+ LeadRecord.offersLabels = ['Lead__Offer'];
815
+ /** Valid labels for Discount associations */
816
+ LeadRecord.discountsLabels = ['Lead__Discount'];
817
+ /** Valid labels for Product associations */
818
+ LeadRecord.productsLabels = ['Lead__Product'];
819
+ /** Valid labels for Contact associations */
820
+ LeadRecord.contactsLabels = ['Lead__Contact'];
821
+ /** Valid labels for Order associations */
822
+ LeadRecord.ordersLabels = ['Lead_Order'];
823
+ /** Valid labels for File associations */
824
+ LeadRecord.filesLabels = ['Lead__File'];
825
+ /** Valid labels for WorkOrder associations */
826
+ LeadRecord.workOrdersLabels = ['WorkOrder__Lead'];
827
+ /** Valid labels for CrmDataset associations */
828
+ LeadRecord.crmDatasetsLabels = ['CrmDataset__Lead'];
829
+ /** Valid labels for Visit associations */
830
+ LeadRecord.visitsLabels = ['Lead__Visit'];
831
+ /** Valid labels for Address associations */
832
+ LeadRecord.addressesLabels = ['Lead_Address'];
833
+ /** Valid labels for Appointment associations */
834
+ LeadRecord.appointmentsLabels = ['Lead_Appointment'];
402
835
  /** Type guard to check if an object is a LeadRecord */
403
836
  function isLeadRecord(obj) {
404
837
  return obj instanceof LeadRecord;
@@ -13,14 +13,22 @@
13
13
  * await record.createMessage({ ... }).execute();
14
14
  * ```
15
15
  *
16
+ * Entity Types: DEFAULT, EVENT
17
+ *
16
18
  * AUTO-GENERATED - DO NOT EDIT DIRECTLY
17
19
  */
18
20
  import { OdinRecord, OdinRecordLinkDto } from '@d19n/odin-types/dist/core';
19
21
  import { PipelineStageEntity } from '@d19n/odin-types/dist/core';
20
22
  import { IDbRecordCreateUpdateRes } from '@d19n/odin-types/dist/core/interfaces/v1.db.interfaces';
21
23
  import { IOdinProvider } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
22
- import { MessageProperties } from '../entities-v2/Message';
24
+ import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-manager';
25
+ import { MessageProperties, EventMessageProperties } from '../entities-v2/Message';
23
26
  import { CreateMessageProperties } from '../actions-v2/CreateMessageDto';
27
+ import { ConversationRecord } from './ConversationRecord';
28
+ import { FileRecord } from './FileRecord';
29
+ import { PushNotificationRecord } from './PushNotificationRecord';
30
+ /** Valid entity types for Message */
31
+ export declare type MessageType = 'DEFAULT' | 'EVENT';
24
32
  /**
25
33
  * Builder for action execution with dryRun support
26
34
  *
@@ -84,6 +92,9 @@ export declare class MessageRecord<TProps = MessageProperties> {
84
92
  private _provider;
85
93
  private _pendingLinks;
86
94
  private _preGeneratedId;
95
+ private _conversations?;
96
+ private _files?;
97
+ private _pushNotifications?;
87
98
  /**
88
99
  * Create a record wrapper.
89
100
  * @param record - The underlying record, or null for create operations
@@ -96,7 +107,7 @@ export declare class MessageRecord<TProps = MessageProperties> {
96
107
  /** Record ID - always available (pre-generated for new records) */
97
108
  get id(): string;
98
109
  get entity(): string;
99
- get type(): string | undefined;
110
+ get type(): MessageType | undefined;
100
111
  /** Record properties - empty object for new (unsaved) records */
101
112
  get properties(): TProps;
102
113
  get title(): string | undefined;
@@ -109,6 +120,92 @@ export declare class MessageRecord<TProps = MessageProperties> {
109
120
  get groups(): string[];
110
121
  /** Access the underlying OdinRecord (null for new records) */
111
122
  get record(): OdinRecord<TProps> | null;
123
+ /**
124
+ * Type guard: check if this record is of type DEFAULT
125
+ *
126
+ * When this returns true, TypeScript automatically narrows the type,
127
+ * giving you access to DEFAULT-specific properties.
128
+ *
129
+ * @example
130
+ * ```typescript
131
+ * if (record.isDefault()) {
132
+ * // TypeScript knows record.properties is MessageProperties
133
+ * console.log(record.properties.SomeTypeSpecificField);
134
+ * }
135
+ * ```
136
+ * @remarks This is the default record type
137
+ */
138
+ isDefault(): this is MessageRecord<MessageProperties>;
139
+ /**
140
+ * Type guard: check if this record is of type EVENT
141
+ *
142
+ * When this returns true, TypeScript automatically narrows the type,
143
+ * giving you access to EVENT-specific properties.
144
+ *
145
+ * @example
146
+ * ```typescript
147
+ * if (record.isEvent()) {
148
+ * // TypeScript knows record.properties is EventMessageProperties
149
+ * console.log(record.properties.SomeTypeSpecificField);
150
+ * }
151
+ * ```
152
+ * @remarks event
153
+ */
154
+ isEvent(): this is MessageRecord<EventMessageProperties>;
155
+ /** Valid labels for Conversation associations */
156
+ static readonly conversationsLabels: readonly ["Conversation_Message"];
157
+ /**
158
+ * Access linked Conversation records
159
+ * @remarks Available labels: Conversation_Message
160
+ * @throws Error if called on a new (unsaved) record
161
+ *
162
+ * @example
163
+ * ```typescript
164
+ * // Get all linked Conversation records
165
+ * const items = await record.conversations.list();
166
+ * const first = await record.conversations.first();
167
+ *
168
+ * // Filter by label
169
+ * const specific = await record.conversations.first({ label: 'Conversation_Message' });
170
+ * ```
171
+ */
172
+ get conversations(): RecordLinkManager<ConversationRecord, typeof MessageRecord['conversationsLabels'][number]>;
173
+ /** Valid labels for File associations */
174
+ static readonly filesLabels: readonly ["Message_File"];
175
+ /**
176
+ * Access linked File records
177
+ * @remarks Available labels: Message_File
178
+ * @throws Error if called on a new (unsaved) record
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * // Get all linked File records
183
+ * const items = await record.files.list();
184
+ * const first = await record.files.first();
185
+ *
186
+ * // Filter by label
187
+ * const specific = await record.files.first({ label: 'Message_File' });
188
+ * ```
189
+ */
190
+ get files(): RecordLinkManager<FileRecord, typeof MessageRecord['filesLabels'][number]>;
191
+ /** Valid labels for PushNotification associations */
192
+ static readonly pushNotificationsLabels: readonly ["Message__PushNotification"];
193
+ /**
194
+ * Access linked PushNotification records
195
+ * @remarks Available labels: Message__PushNotification
196
+ * @throws Error if called on a new (unsaved) record
197
+ *
198
+ * @example
199
+ * ```typescript
200
+ * // Get all linked PushNotification records
201
+ * const items = await record.pushNotifications.list();
202
+ * const first = await record.pushNotifications.first();
203
+ *
204
+ * // Filter by label
205
+ * const specific = await record.pushNotifications.first({ label: 'Message__PushNotification' });
206
+ * ```
207
+ */
208
+ get pushNotifications(): RecordLinkManager<PushNotificationRecord, typeof MessageRecord['pushNotificationsLabels'][number]>;
112
209
  /**
113
210
  * Queue a link to be created with the next action.
114
211
  * Works for both create and update actions.