@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.
- package/README.md +11 -10
- package/dist/actions-v2/CreateOrderFromBrskDto.d.ts +75 -0
- package/dist/actions-v2/CreateOrderItemFromBrskDto.d.ts +191 -0
- package/dist/actions-v2/CreateOrderItemFromBrskDto.js +52 -0
- package/dist/entities-v2/Order.d.ts +7 -0
- package/dist/entities-v2/Order.js +2 -0
- package/dist/entities-v2/OrderItem.d.ts +7 -0
- package/dist/entities-v2/OrderItem.js +2 -0
- package/dist/entities-v2/Product.d.ts +0 -42
- package/dist/entities-v2/Product.js +0 -2
- package/dist/records-v2/AccountCreditRecord.d.ts +62 -1
- package/dist/records-v2/AccountCreditRecord.js +91 -0
- package/dist/records-v2/AccountRecord.d.ts +306 -2
- package/dist/records-v2/AccountRecord.js +451 -0
- package/dist/records-v2/ActivityLogRecord.d.ts +122 -1
- package/dist/records-v2/ActivityLogRecord.js +190 -0
- package/dist/records-v2/ActivityRecord.d.ts +255 -2
- package/dist/records-v2/ActivityRecord.js +387 -0
- package/dist/records-v2/AddressRecord.d.ts +321 -0
- package/dist/records-v2/AddressRecord.js +532 -0
- package/dist/records-v2/AffiliateCodeRecord.d.ts +102 -1
- package/dist/records-v2/AffiliateCodeRecord.js +157 -0
- package/dist/records-v2/AppointmentRecord.d.ts +141 -0
- package/dist/records-v2/AppointmentRecord.js +235 -0
- package/dist/records-v2/BillingAdjustmentRecord.d.ts +81 -0
- package/dist/records-v2/BillingAdjustmentRecord.js +136 -0
- package/dist/records-v2/BillingRequestRecord.d.ts +178 -2
- package/dist/records-v2/BillingRequestRecord.js +271 -0
- package/dist/records-v2/BlockageA55Record.d.ts +103 -2
- package/dist/records-v2/BlockageA55Record.js +157 -0
- package/dist/records-v2/BrskEntityMigrationErrorRecord.d.ts +21 -1
- package/dist/records-v2/BrskEntityMigrationErrorRecord.js +21 -0
- package/dist/records-v2/CallEventRecord.d.ts +82 -1
- package/dist/records-v2/CallEventRecord.js +124 -0
- package/dist/records-v2/CallLegRecord.d.ts +82 -1
- package/dist/records-v2/CallLegRecord.js +124 -0
- package/dist/records-v2/CallRecord.d.ts +202 -1
- package/dist/records-v2/CallRecord.js +322 -0
- package/dist/records-v2/CallTransferRecord.d.ts +102 -1
- package/dist/records-v2/CallTransferRecord.js +157 -0
- package/dist/records-v2/CampaignRecord.d.ts +83 -2
- package/dist/records-v2/CampaignRecord.js +124 -0
- package/dist/records-v2/CaseRecord.d.ts +418 -2
- package/dist/records-v2/CaseRecord.js +667 -0
- package/dist/records-v2/ChangeReasonRecord.d.ts +171 -2
- package/dist/records-v2/ChangeReasonRecord.js +238 -0
- package/dist/records-v2/ChurnRequestRecord.d.ts +62 -1
- package/dist/records-v2/ChurnRequestRecord.js +91 -0
- package/dist/records-v2/ContactRecord.d.ts +560 -0
- package/dist/records-v2/ContactRecord.js +927 -0
- package/dist/records-v2/ContractBuyOutRecord.d.ts +162 -1
- package/dist/records-v2/ContractBuyOutRecord.js +256 -0
- package/dist/records-v2/ConversationFeedbackRecord.d.ts +102 -1
- package/dist/records-v2/ConversationFeedbackRecord.js +157 -0
- package/dist/records-v2/ConversationRecord.d.ts +102 -1
- package/dist/records-v2/ConversationRecord.js +157 -0
- package/dist/records-v2/CreditNoteRecord.d.ts +81 -0
- package/dist/records-v2/CreditNoteRecord.js +136 -0
- package/dist/records-v2/CrmDatasetRecord.d.ts +191 -2
- package/dist/records-v2/CrmDatasetRecord.js +271 -0
- package/dist/records-v2/CustomerDeviceAtaRecord.d.ts +21 -0
- package/dist/records-v2/CustomerDeviceAtaRecord.js +37 -0
- package/dist/records-v2/CustomerDeviceConfigurationRecord.d.ts +62 -1
- package/dist/records-v2/CustomerDeviceConfigurationRecord.js +91 -0
- package/dist/records-v2/CustomerDeviceOntRecord.d.ts +181 -0
- package/dist/records-v2/CustomerDeviceOntRecord.js +301 -0
- package/dist/records-v2/CustomerDeviceRouterRecord.d.ts +141 -0
- package/dist/records-v2/CustomerDeviceRouterRecord.js +235 -0
- package/dist/records-v2/CustomerPhonePortingRecord.d.ts +21 -0
- package/dist/records-v2/CustomerPhonePortingRecord.js +37 -0
- package/dist/records-v2/DiscountRecord.d.ts +121 -0
- package/dist/records-v2/DiscountRecord.js +202 -0
- package/dist/records-v2/EmailRecord.d.ts +230 -2
- package/dist/records-v2/EmailRecord.js +336 -0
- package/dist/records-v2/EmailSenderRecord.d.ts +42 -1
- package/dist/records-v2/EmailSenderRecord.js +58 -0
- package/dist/records-v2/EmailTemplateRecord.d.ts +21 -1
- package/dist/records-v2/EmailTemplateRecord.js +21 -0
- package/dist/records-v2/FieldServiceDispatchedProductRecord.d.ts +135 -2
- package/dist/records-v2/FieldServiceDispatchedProductRecord.js +189 -0
- package/dist/records-v2/FieldServiceProductRecord.d.ts +115 -2
- package/dist/records-v2/FieldServiceProductRecord.js +156 -0
- package/dist/records-v2/FileRecord.d.ts +1211 -2
- package/dist/records-v2/FileRecord.js +1902 -0
- package/dist/records-v2/ImpersonationTrackerRecord.d.ts +62 -1
- package/dist/records-v2/ImpersonationTrackerRecord.js +91 -0
- package/dist/records-v2/InternalInstallAuditRecord.d.ts +83 -2
- package/dist/records-v2/InternalInstallAuditRecord.js +124 -0
- package/dist/records-v2/InvoiceItemRecord.d.ts +40 -0
- package/dist/records-v2/InvoiceItemRecord.js +69 -0
- package/dist/records-v2/InvoiceRecord.d.ts +399 -2
- package/dist/records-v2/InvoiceRecord.js +635 -0
- package/dist/records-v2/KnowledgeArticleRecord.d.ts +98 -2
- package/dist/records-v2/KnowledgeArticleRecord.js +139 -0
- package/dist/records-v2/LeadRecord.d.ts +261 -0
- package/dist/records-v2/LeadRecord.js +433 -0
- package/dist/records-v2/MessageRecord.d.ts +99 -2
- package/dist/records-v2/MessageRecord.js +140 -0
- package/dist/records-v2/NetworkDeviceRecord.d.ts +43 -2
- package/dist/records-v2/NetworkDeviceRecord.js +58 -0
- package/dist/records-v2/NoteRecord.d.ts +1121 -1
- package/dist/records-v2/NoteRecord.js +1839 -0
- package/dist/records-v2/OfferRecord.d.ts +154 -2
- package/dist/records-v2/OfferRecord.js +221 -0
- package/dist/records-v2/OhAuditOfInstallationRecord.d.ts +83 -2
- package/dist/records-v2/OhAuditOfInstallationRecord.js +124 -0
- package/dist/records-v2/OhExternalAuditRecord.d.ts +83 -2
- package/dist/records-v2/OhExternalAuditRecord.js +124 -0
- package/dist/records-v2/OhInProgressAuditRecord.d.ts +83 -2
- package/dist/records-v2/OhInProgressAuditRecord.js +124 -0
- package/dist/records-v2/OhInstallationAuditRecord.d.ts +83 -2
- package/dist/records-v2/OhInstallationAuditRecord.js +124 -0
- package/dist/records-v2/OhRetroAuditRecord.d.ts +83 -2
- package/dist/records-v2/OhRetroAuditRecord.js +124 -0
- package/dist/records-v2/OneTouchSwitchRecord.d.ts +255 -2
- package/dist/records-v2/OneTouchSwitchRecord.js +387 -0
- package/dist/records-v2/OntReplacementApprovalRecord.d.ts +62 -1
- package/dist/records-v2/OntReplacementApprovalRecord.js +91 -0
- package/dist/records-v2/OrderCheckRecord.d.ts +21 -0
- package/dist/records-v2/OrderCheckRecord.js +37 -0
- package/dist/records-v2/OrderItemRecord.d.ts +309 -0
- package/dist/records-v2/OrderItemRecord.js +501 -0
- package/dist/records-v2/OrderKciRecord.d.ts +42 -1
- package/dist/records-v2/OrderKciRecord.js +58 -0
- package/dist/records-v2/OrderRecord.d.ts +620 -0
- package/dist/records-v2/OrderRecord.js +1026 -0
- package/dist/records-v2/OutageRecord.d.ts +42 -1
- package/dist/records-v2/OutageRecord.js +58 -0
- package/dist/records-v2/OverlayRealA55Record.d.ts +83 -2
- package/dist/records-v2/OverlayRealA55Record.js +124 -0
- package/dist/records-v2/PICRequestRecord.d.ts +62 -1
- package/dist/records-v2/PICRequestRecord.js +91 -0
- package/dist/records-v2/PaymentMethodRecord.d.ts +121 -0
- package/dist/records-v2/PaymentMethodRecord.js +202 -0
- package/dist/records-v2/PaymentMethodRefundRecord.d.ts +181 -0
- package/dist/records-v2/PaymentMethodRefundRecord.js +301 -0
- package/dist/records-v2/PaymentRecord.d.ts +82 -1
- package/dist/records-v2/PaymentRecord.js +124 -0
- package/dist/records-v2/PermissionToFailRecord.d.ts +61 -0
- package/dist/records-v2/PermissionToFailRecord.js +103 -0
- package/dist/records-v2/PgAccountValidationRecord.d.ts +21 -1
- package/dist/records-v2/PgAccountValidationRecord.js +21 -0
- package/dist/records-v2/PgContactRecord.d.ts +62 -1
- package/dist/records-v2/PgContactRecord.js +91 -0
- package/dist/records-v2/PgDirectDebitFileRecord.d.ts +95 -2
- package/dist/records-v2/PgDirectDebitFileRecord.js +123 -0
- package/dist/records-v2/PgDisputeRecord.d.ts +62 -1
- package/dist/records-v2/PgDisputeRecord.js +91 -0
- package/dist/records-v2/PgFileAllocationRecord.d.ts +115 -2
- package/dist/records-v2/PgFileAllocationRecord.js +156 -0
- package/dist/records-v2/PgLogRecord.d.ts +21 -1
- package/dist/records-v2/PgLogRecord.js +21 -0
- package/dist/records-v2/PgPaymentMethodRecord.d.ts +102 -1
- package/dist/records-v2/PgPaymentMethodRecord.js +157 -0
- package/dist/records-v2/PgSortCodeSubstitutionRecord.d.ts +21 -1
- package/dist/records-v2/PgSortCodeSubstitutionRecord.js +21 -0
- package/dist/records-v2/PgTransactionRecord.d.ts +135 -2
- package/dist/records-v2/PgTransactionRecord.js +189 -0
- package/dist/records-v2/PgVocalinkRecord.d.ts +21 -1
- package/dist/records-v2/PgVocalinkRecord.js +21 -0
- package/dist/records-v2/PgWebhookAttemptRecord.d.ts +42 -1
- package/dist/records-v2/PgWebhookAttemptRecord.js +58 -0
- package/dist/records-v2/PgWebhookRecord.d.ts +122 -1
- package/dist/records-v2/PgWebhookRecord.js +190 -0
- package/dist/records-v2/PhoneNumberRecord.d.ts +41 -0
- package/dist/records-v2/PhoneNumberRecord.js +70 -0
- package/dist/records-v2/PriceBookRecord.d.ts +21 -0
- package/dist/records-v2/PriceBookRecord.js +37 -0
- package/dist/records-v2/ProductRecord.d.ts +258 -2
- package/dist/records-v2/ProductRecord.js +351 -0
- package/dist/records-v2/PushNotificationRecord.d.ts +162 -1
- package/dist/records-v2/PushNotificationRecord.js +256 -0
- package/dist/records-v2/ReferralRecord.d.ts +143 -2
- package/dist/records-v2/ReferralRecord.js +223 -0
- package/dist/records-v2/RemediationOutcomeFormRecord.d.ts +83 -2
- package/dist/records-v2/RemediationOutcomeFormRecord.js +124 -0
- package/dist/records-v2/RemediationRequiredReasonRecord.d.ts +103 -2
- package/dist/records-v2/RemediationRequiredReasonRecord.js +157 -0
- package/dist/records-v2/ReturnsRecord.d.ts +62 -1
- package/dist/records-v2/ReturnsRecord.js +91 -0
- package/dist/records-v2/RewardRecord.d.ts +123 -2
- package/dist/records-v2/RewardRecord.js +190 -0
- package/dist/records-v2/SalesTerritoryRecord.d.ts +79 -2
- package/dist/records-v2/SalesTerritoryRecord.js +107 -0
- package/dist/records-v2/ScheduleSlotRecord.d.ts +42 -1
- package/dist/records-v2/ScheduleSlotRecord.js +58 -0
- package/dist/records-v2/ServiceAppointmentConfigRecord.d.ts +287 -2
- package/dist/records-v2/ServiceAppointmentConfigRecord.js +367 -0
- package/dist/records-v2/ServiceAppointmentRecord.d.ts +81 -0
- package/dist/records-v2/ServiceAppointmentRecord.js +136 -0
- package/dist/records-v2/ServiceRecord.d.ts +40 -0
- package/dist/records-v2/ServiceRecord.js +69 -0
- package/dist/records-v2/ServiceVisitAuditRecord.d.ts +83 -2
- package/dist/records-v2/ServiceVisitAuditRecord.js +124 -0
- package/dist/records-v2/SiteSpecificRiskAssessmentOutcomeFormRecord.d.ts +83 -2
- package/dist/records-v2/SiteSpecificRiskAssessmentOutcomeFormRecord.js +124 -0
- package/dist/records-v2/SmsMessageRecord.d.ts +175 -2
- package/dist/records-v2/SmsMessageRecord.js +255 -0
- package/dist/records-v2/SweeperMaintenanceAuditRecord.d.ts +83 -2
- package/dist/records-v2/SweeperMaintenanceAuditRecord.js +124 -0
- package/dist/records-v2/TeamRecord.d.ts +101 -0
- package/dist/records-v2/TeamRecord.js +169 -0
- package/dist/records-v2/TestEntityForVisualBuilderRecord.d.ts +115 -2
- package/dist/records-v2/TestEntityForVisualBuilderRecord.js +156 -0
- package/dist/records-v2/TimeSlotRecord.d.ts +21 -0
- package/dist/records-v2/TimeSlotRecord.js +37 -0
- package/dist/records-v2/TransactionRecord.d.ts +181 -1
- package/dist/records-v2/TransactionRecord.js +288 -0
- package/dist/records-v2/TwilioUserUpdateRecord.d.ts +42 -1
- package/dist/records-v2/TwilioUserUpdateRecord.js +58 -0
- package/dist/records-v2/UgAuditOfInstallationRecord.d.ts +83 -2
- package/dist/records-v2/UgAuditOfInstallationRecord.js +124 -0
- package/dist/records-v2/UgExternalAuditRecord.d.ts +83 -2
- package/dist/records-v2/UgExternalAuditRecord.js +124 -0
- package/dist/records-v2/UgInProgressAuditRecord.d.ts +83 -2
- package/dist/records-v2/UgInProgressAuditRecord.js +124 -0
- package/dist/records-v2/UgInstallationAuditRecord.d.ts +83 -2
- package/dist/records-v2/UgInstallationAuditRecord.js +124 -0
- package/dist/records-v2/UgRetroAuditRecord.d.ts +83 -2
- package/dist/records-v2/UgRetroAuditRecord.js +124 -0
- package/dist/records-v2/UserRecord.d.ts +400 -0
- package/dist/records-v2/UserRecord.js +663 -0
- package/dist/records-v2/VisitRecord.d.ts +121 -0
- package/dist/records-v2/VisitRecord.js +202 -0
- package/dist/records-v2/VoiceConfigurationRecord.d.ts +21 -0
- package/dist/records-v2/VoiceConfigurationRecord.js +37 -0
- package/dist/records-v2/WayleaveAuditRecord.d.ts +83 -2
- package/dist/records-v2/WayleaveAuditRecord.js +124 -0
- package/dist/records-v2/WorkOrderRecord.d.ts +1226 -2
- package/dist/records-v2/WorkOrderRecord.js +1865 -0
- package/dist/records-v2/WorkOrderStatusUpdateRecord.d.ts +75 -2
- package/dist/records-v2/WorkOrderStatusUpdateRecord.js +90 -0
- package/dist/records-v2/YfFieldServiceVisitRecord.d.ts +83 -2
- package/dist/records-v2/YfFieldServiceVisitRecord.js +124 -0
- package/dist/records-v2/YfStockAuditRecord.d.ts +103 -2
- package/dist/records-v2/YfStockAuditRecord.js +157 -0
- package/dist/records-v2/index.d.ts +1 -1
- package/dist/records-v2/index.js +5 -5
- package/package.json +1 -1
|
@@ -29,6 +29,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
29
|
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
|
+
const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
|
|
33
|
+
const TransactionRecord_1 = require("./TransactionRecord");
|
|
34
|
+
const NoteRecord_1 = require("./NoteRecord");
|
|
35
|
+
const InvoiceRecord_1 = require("./InvoiceRecord");
|
|
36
|
+
const FileRecord_1 = require("./FileRecord");
|
|
32
37
|
/**
|
|
33
38
|
* Builder for action execution with dryRun support
|
|
34
39
|
*
|
|
@@ -139,6 +144,126 @@ class CreditNoteRecord {
|
|
|
139
144
|
get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
|
|
140
145
|
/** Access the underlying OdinRecord (null for new records) */
|
|
141
146
|
get record() { return this._record; }
|
|
147
|
+
/**
|
|
148
|
+
* Access linked Transaction records
|
|
149
|
+
* @remarks Available labels: CreditNote__Transaction
|
|
150
|
+
* @throws Error if called on a new (unsaved) record
|
|
151
|
+
*
|
|
152
|
+
* @example
|
|
153
|
+
* ```typescript
|
|
154
|
+
* // Get all linked Transaction records
|
|
155
|
+
* const items = await record.transactions.list();
|
|
156
|
+
* const first = await record.transactions.first();
|
|
157
|
+
*
|
|
158
|
+
* // Filter by label
|
|
159
|
+
* const specific = await record.transactions.first({ label: 'CreditNote__Transaction' });
|
|
160
|
+
* ```
|
|
161
|
+
*/
|
|
162
|
+
get transactions() {
|
|
163
|
+
var _a;
|
|
164
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
165
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
166
|
+
if (!this._transactions) {
|
|
167
|
+
this._transactions = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
168
|
+
sourceEntity: 'BillingModule:CreditNote',
|
|
169
|
+
targetEntity: 'BillingModule:Transaction',
|
|
170
|
+
targetModuleName: 'BillingModule',
|
|
171
|
+
targetEntityName: 'Transaction',
|
|
172
|
+
labels: ['CreditNote__Transaction'],
|
|
173
|
+
}, TransactionRecord_1.TransactionRecord);
|
|
174
|
+
}
|
|
175
|
+
return this._transactions;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Access linked Note records
|
|
179
|
+
* @remarks Available labels: CreditNote__Note
|
|
180
|
+
* @throws Error if called on a new (unsaved) record
|
|
181
|
+
*
|
|
182
|
+
* @example
|
|
183
|
+
* ```typescript
|
|
184
|
+
* // Get all linked Note records
|
|
185
|
+
* const items = await record.notes.list();
|
|
186
|
+
* const first = await record.notes.first();
|
|
187
|
+
*
|
|
188
|
+
* // Filter by label
|
|
189
|
+
* const specific = await record.notes.first({ label: 'CreditNote__Note' });
|
|
190
|
+
* ```
|
|
191
|
+
*/
|
|
192
|
+
get notes() {
|
|
193
|
+
var _a;
|
|
194
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
195
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
196
|
+
if (!this._notes) {
|
|
197
|
+
this._notes = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
198
|
+
sourceEntity: 'BillingModule:CreditNote',
|
|
199
|
+
targetEntity: 'SupportModule:Note',
|
|
200
|
+
targetModuleName: 'SupportModule',
|
|
201
|
+
targetEntityName: 'Note',
|
|
202
|
+
labels: ['CreditNote__Note'],
|
|
203
|
+
}, NoteRecord_1.NoteRecord);
|
|
204
|
+
}
|
|
205
|
+
return this._notes;
|
|
206
|
+
}
|
|
207
|
+
/**
|
|
208
|
+
* Access linked Invoice records
|
|
209
|
+
* @remarks Available labels: Invoice__CreditNote
|
|
210
|
+
* @throws Error if called on a new (unsaved) record
|
|
211
|
+
*
|
|
212
|
+
* @example
|
|
213
|
+
* ```typescript
|
|
214
|
+
* // Get all linked Invoice records
|
|
215
|
+
* const items = await record.invoices.list();
|
|
216
|
+
* const first = await record.invoices.first();
|
|
217
|
+
*
|
|
218
|
+
* // Filter by label
|
|
219
|
+
* const specific = await record.invoices.first({ label: 'Invoice__CreditNote' });
|
|
220
|
+
* ```
|
|
221
|
+
*/
|
|
222
|
+
get invoices() {
|
|
223
|
+
var _a;
|
|
224
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
225
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
226
|
+
if (!this._invoices) {
|
|
227
|
+
this._invoices = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
228
|
+
sourceEntity: 'BillingModule:CreditNote',
|
|
229
|
+
targetEntity: 'BillingModule:Invoice',
|
|
230
|
+
targetModuleName: 'BillingModule',
|
|
231
|
+
targetEntityName: 'Invoice',
|
|
232
|
+
labels: ['Invoice__CreditNote'],
|
|
233
|
+
}, InvoiceRecord_1.InvoiceRecord);
|
|
234
|
+
}
|
|
235
|
+
return this._invoices;
|
|
236
|
+
}
|
|
237
|
+
/**
|
|
238
|
+
* Access linked File records
|
|
239
|
+
* @remarks Available labels: CreditNote__File
|
|
240
|
+
* @throws Error if called on a new (unsaved) record
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* ```typescript
|
|
244
|
+
* // Get all linked File records
|
|
245
|
+
* const items = await record.files.list();
|
|
246
|
+
* const first = await record.files.first();
|
|
247
|
+
*
|
|
248
|
+
* // Filter by label
|
|
249
|
+
* const specific = await record.files.first({ label: 'CreditNote__File' });
|
|
250
|
+
* ```
|
|
251
|
+
*/
|
|
252
|
+
get files() {
|
|
253
|
+
var _a;
|
|
254
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
255
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
256
|
+
if (!this._files) {
|
|
257
|
+
this._files = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
258
|
+
sourceEntity: 'BillingModule:CreditNote',
|
|
259
|
+
targetEntity: 'SchemaModule:File',
|
|
260
|
+
targetModuleName: 'SchemaModule',
|
|
261
|
+
targetEntityName: 'File',
|
|
262
|
+
labels: ['CreditNote__File'],
|
|
263
|
+
}, FileRecord_1.FileRecord);
|
|
264
|
+
}
|
|
265
|
+
return this._files;
|
|
266
|
+
}
|
|
142
267
|
// ============================================
|
|
143
268
|
// LINK MANAGEMENT
|
|
144
269
|
// ============================================
|
|
@@ -247,6 +372,17 @@ class CreditNoteRecord {
|
|
|
247
372
|
}
|
|
248
373
|
}
|
|
249
374
|
exports.CreditNoteRecord = CreditNoteRecord;
|
|
375
|
+
// ============================================
|
|
376
|
+
// TYPED LINK ACCESSORS
|
|
377
|
+
// ============================================
|
|
378
|
+
/** Valid labels for Transaction associations */
|
|
379
|
+
CreditNoteRecord.transactionsLabels = ['CreditNote__Transaction'];
|
|
380
|
+
/** Valid labels for Note associations */
|
|
381
|
+
CreditNoteRecord.notesLabels = ['CreditNote__Note'];
|
|
382
|
+
/** Valid labels for Invoice associations */
|
|
383
|
+
CreditNoteRecord.invoicesLabels = ['Invoice__CreditNote'];
|
|
384
|
+
/** Valid labels for File associations */
|
|
385
|
+
CreditNoteRecord.filesLabels = ['CreditNote__File'];
|
|
250
386
|
/** Type guard to check if an object is a CreditNoteRecord */
|
|
251
387
|
function isCreditNoteRecord(obj) {
|
|
252
388
|
return obj instanceof CreditNoteRecord;
|
|
@@ -13,17 +13,28 @@
|
|
|
13
13
|
* await record.createCrmDataset({ ... }).execute();
|
|
14
14
|
* ```
|
|
15
15
|
*
|
|
16
|
+
* Entity Types: ADDRESS, CONTACT, DEFAULT, LEAD
|
|
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 {
|
|
24
|
+
import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-manager';
|
|
25
|
+
import { CrmDatasetProperties, AddressCrmDatasetProperties, ContactCrmDatasetProperties, LeadCrmDatasetProperties } from '../entities-v2/CrmDataset';
|
|
23
26
|
import { AssignOwnerProperties } from '../actions-v2/AssignOwnerDto';
|
|
24
27
|
import { CrmDatasetCreateProperties } from '../actions-v2/CrmDatasetCreateDto';
|
|
25
28
|
import { CrmDatasetDefaultUpdateProperties } from '../actions-v2/CrmDatasetDefaultUpdateDto';
|
|
26
29
|
import { UpdateAddressDataSetProperties } from '../actions-v2/UpdateAddressDataSetDto';
|
|
30
|
+
import { UserRecord } from './UserRecord';
|
|
31
|
+
import { NoteRecord } from './NoteRecord';
|
|
32
|
+
import { LeadRecord } from './LeadRecord';
|
|
33
|
+
import { SalesTerritoryRecord } from './SalesTerritoryRecord';
|
|
34
|
+
import { TeamRecord } from './TeamRecord';
|
|
35
|
+
import { AddressRecord } from './AddressRecord';
|
|
36
|
+
/** Valid entity types for CrmDataset */
|
|
37
|
+
export declare type CrmDatasetType = 'ADDRESS' | 'CONTACT' | 'DEFAULT' | 'LEAD';
|
|
27
38
|
/**
|
|
28
39
|
* Builder for action execution with dryRun support
|
|
29
40
|
*
|
|
@@ -87,6 +98,12 @@ export declare class CrmDatasetRecord<TProps = CrmDatasetProperties> {
|
|
|
87
98
|
private _provider;
|
|
88
99
|
private _pendingLinks;
|
|
89
100
|
private _preGeneratedId;
|
|
101
|
+
private _users?;
|
|
102
|
+
private _notes?;
|
|
103
|
+
private _leads?;
|
|
104
|
+
private _salesTerritories?;
|
|
105
|
+
private _teams?;
|
|
106
|
+
private _addresses?;
|
|
90
107
|
/**
|
|
91
108
|
* Create a record wrapper.
|
|
92
109
|
* @param record - The underlying record, or null for create operations
|
|
@@ -99,7 +116,7 @@ export declare class CrmDatasetRecord<TProps = CrmDatasetProperties> {
|
|
|
99
116
|
/** Record ID - always available (pre-generated for new records) */
|
|
100
117
|
get id(): string;
|
|
101
118
|
get entity(): string;
|
|
102
|
-
get type():
|
|
119
|
+
get type(): CrmDatasetType | undefined;
|
|
103
120
|
/** Record properties - empty object for new (unsaved) records */
|
|
104
121
|
get properties(): TProps;
|
|
105
122
|
get title(): string | undefined;
|
|
@@ -112,6 +129,178 @@ export declare class CrmDatasetRecord<TProps = CrmDatasetProperties> {
|
|
|
112
129
|
get groups(): string[];
|
|
113
130
|
/** Access the underlying OdinRecord (null for new records) */
|
|
114
131
|
get record(): OdinRecord<TProps> | null;
|
|
132
|
+
/**
|
|
133
|
+
* Type guard: check if this record is of type ADDRESS
|
|
134
|
+
*
|
|
135
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
136
|
+
* giving you access to ADDRESS-specific properties.
|
|
137
|
+
*
|
|
138
|
+
* @example
|
|
139
|
+
* ```typescript
|
|
140
|
+
* if (record.isAddress()) {
|
|
141
|
+
* // TypeScript knows record.properties is AddressCrmDatasetProperties
|
|
142
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
143
|
+
* }
|
|
144
|
+
* ```
|
|
145
|
+
* @remarks Address data sets
|
|
146
|
+
*/
|
|
147
|
+
isAddress(): this is CrmDatasetRecord<AddressCrmDatasetProperties>;
|
|
148
|
+
/**
|
|
149
|
+
* Type guard: check if this record is of type CONTACT
|
|
150
|
+
*
|
|
151
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
152
|
+
* giving you access to CONTACT-specific properties.
|
|
153
|
+
*
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* if (record.isContact()) {
|
|
157
|
+
* // TypeScript knows record.properties is ContactCrmDatasetProperties
|
|
158
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
159
|
+
* }
|
|
160
|
+
* ```
|
|
161
|
+
* @remarks Contact datasets
|
|
162
|
+
*/
|
|
163
|
+
isContact(): this is CrmDatasetRecord<ContactCrmDatasetProperties>;
|
|
164
|
+
/**
|
|
165
|
+
* Type guard: check if this record is of type DEFAULT
|
|
166
|
+
*
|
|
167
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
168
|
+
* giving you access to DEFAULT-specific properties.
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* if (record.isDefault()) {
|
|
173
|
+
* // TypeScript knows record.properties is CrmDatasetProperties
|
|
174
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
175
|
+
* }
|
|
176
|
+
* ```
|
|
177
|
+
* @remarks This is the default record type
|
|
178
|
+
*/
|
|
179
|
+
isDefault(): this is CrmDatasetRecord<CrmDatasetProperties>;
|
|
180
|
+
/**
|
|
181
|
+
* Type guard: check if this record is of type LEAD
|
|
182
|
+
*
|
|
183
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
184
|
+
* giving you access to LEAD-specific properties.
|
|
185
|
+
*
|
|
186
|
+
* @example
|
|
187
|
+
* ```typescript
|
|
188
|
+
* if (record.isLead()) {
|
|
189
|
+
* // TypeScript knows record.properties is LeadCrmDatasetProperties
|
|
190
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
191
|
+
* }
|
|
192
|
+
* ```
|
|
193
|
+
* @remarks Lead DataSets
|
|
194
|
+
*/
|
|
195
|
+
isLead(): this is CrmDatasetRecord<LeadCrmDatasetProperties>;
|
|
196
|
+
/** Valid labels for User associations */
|
|
197
|
+
static readonly usersLabels: readonly ["CrmDataset__User"];
|
|
198
|
+
/**
|
|
199
|
+
* Access linked User records
|
|
200
|
+
* @remarks Available labels: CrmDataset__User
|
|
201
|
+
* @throws Error if called on a new (unsaved) record
|
|
202
|
+
*
|
|
203
|
+
* @example
|
|
204
|
+
* ```typescript
|
|
205
|
+
* // Get all linked User records
|
|
206
|
+
* const items = await record.users.list();
|
|
207
|
+
* const first = await record.users.first();
|
|
208
|
+
*
|
|
209
|
+
* // Filter by label
|
|
210
|
+
* const specific = await record.users.first({ label: 'CrmDataset__User' });
|
|
211
|
+
* ```
|
|
212
|
+
*/
|
|
213
|
+
get users(): RecordLinkManager<UserRecord, typeof CrmDatasetRecord['usersLabels'][number]>;
|
|
214
|
+
/** Valid labels for Note associations */
|
|
215
|
+
static readonly notesLabels: readonly ["CrmDataset__Note"];
|
|
216
|
+
/**
|
|
217
|
+
* Access linked Note records
|
|
218
|
+
* @remarks Available labels: CrmDataset__Note
|
|
219
|
+
* @throws Error if called on a new (unsaved) record
|
|
220
|
+
*
|
|
221
|
+
* @example
|
|
222
|
+
* ```typescript
|
|
223
|
+
* // Get all linked Note records
|
|
224
|
+
* const items = await record.notes.list();
|
|
225
|
+
* const first = await record.notes.first();
|
|
226
|
+
*
|
|
227
|
+
* // Filter by label
|
|
228
|
+
* const specific = await record.notes.first({ label: 'CrmDataset__Note' });
|
|
229
|
+
* ```
|
|
230
|
+
*/
|
|
231
|
+
get notes(): RecordLinkManager<NoteRecord, typeof CrmDatasetRecord['notesLabels'][number]>;
|
|
232
|
+
/** Valid labels for Lead associations */
|
|
233
|
+
static readonly leadsLabels: readonly ["CrmDataset__Lead"];
|
|
234
|
+
/**
|
|
235
|
+
* Access linked Lead records
|
|
236
|
+
* @remarks Available labels: CrmDataset__Lead
|
|
237
|
+
* @throws Error if called on a new (unsaved) record
|
|
238
|
+
*
|
|
239
|
+
* @example
|
|
240
|
+
* ```typescript
|
|
241
|
+
* // Get all linked Lead records
|
|
242
|
+
* const items = await record.leads.list();
|
|
243
|
+
* const first = await record.leads.first();
|
|
244
|
+
*
|
|
245
|
+
* // Filter by label
|
|
246
|
+
* const specific = await record.leads.first({ label: 'CrmDataset__Lead' });
|
|
247
|
+
* ```
|
|
248
|
+
*/
|
|
249
|
+
get leads(): RecordLinkManager<LeadRecord, typeof CrmDatasetRecord['leadsLabels'][number]>;
|
|
250
|
+
/** Valid labels for SalesTerritory associations */
|
|
251
|
+
static readonly salesTerritoriesLabels: readonly ["CrmDataset__SalesTerritory"];
|
|
252
|
+
/**
|
|
253
|
+
* Access linked SalesTerritory records
|
|
254
|
+
* @remarks Available labels: CrmDataset__SalesTerritory
|
|
255
|
+
* @throws Error if called on a new (unsaved) record
|
|
256
|
+
*
|
|
257
|
+
* @example
|
|
258
|
+
* ```typescript
|
|
259
|
+
* // Get all linked SalesTerritory records
|
|
260
|
+
* const items = await record.salesTerritories.list();
|
|
261
|
+
* const first = await record.salesTerritories.first();
|
|
262
|
+
*
|
|
263
|
+
* // Filter by label
|
|
264
|
+
* const specific = await record.salesTerritories.first({ label: 'CrmDataset__SalesTerritory' });
|
|
265
|
+
* ```
|
|
266
|
+
*/
|
|
267
|
+
get salesTerritories(): RecordLinkManager<SalesTerritoryRecord, typeof CrmDatasetRecord['salesTerritoriesLabels'][number]>;
|
|
268
|
+
/** Valid labels for Team associations */
|
|
269
|
+
static readonly teamsLabels: readonly ["CrmDataset_Team"];
|
|
270
|
+
/**
|
|
271
|
+
* Access linked Team records
|
|
272
|
+
* @remarks Available labels: CrmDataset_Team
|
|
273
|
+
* @throws Error if called on a new (unsaved) record
|
|
274
|
+
*
|
|
275
|
+
* @example
|
|
276
|
+
* ```typescript
|
|
277
|
+
* // Get all linked Team records
|
|
278
|
+
* const items = await record.teams.list();
|
|
279
|
+
* const first = await record.teams.first();
|
|
280
|
+
*
|
|
281
|
+
* // Filter by label
|
|
282
|
+
* const specific = await record.teams.first({ label: 'CrmDataset_Team' });
|
|
283
|
+
* ```
|
|
284
|
+
*/
|
|
285
|
+
get teams(): RecordLinkManager<TeamRecord, typeof CrmDatasetRecord['teamsLabels'][number]>;
|
|
286
|
+
/** Valid labels for Address associations */
|
|
287
|
+
static readonly addressesLabels: readonly ["CrmDataset__Address"];
|
|
288
|
+
/**
|
|
289
|
+
* Access linked Address records
|
|
290
|
+
* @remarks Available labels: CrmDataset__Address
|
|
291
|
+
* @throws Error if called on a new (unsaved) record
|
|
292
|
+
*
|
|
293
|
+
* @example
|
|
294
|
+
* ```typescript
|
|
295
|
+
* // Get all linked Address records
|
|
296
|
+
* const items = await record.addresses.list();
|
|
297
|
+
* const first = await record.addresses.first();
|
|
298
|
+
*
|
|
299
|
+
* // Filter by label
|
|
300
|
+
* const specific = await record.addresses.first({ label: 'CrmDataset__Address' });
|
|
301
|
+
* ```
|
|
302
|
+
*/
|
|
303
|
+
get addresses(): RecordLinkManager<AddressRecord, typeof CrmDatasetRecord['addressesLabels'][number]>;
|
|
115
304
|
/**
|
|
116
305
|
* Queue a link to be created with the next action.
|
|
117
306
|
* Works for both create and update actions.
|
|
@@ -14,6 +14,8 @@
|
|
|
14
14
|
* await record.createCrmDataset({ ... }).execute();
|
|
15
15
|
* ```
|
|
16
16
|
*
|
|
17
|
+
* Entity Types: ADDRESS, CONTACT, DEFAULT, LEAD
|
|
18
|
+
*
|
|
17
19
|
* AUTO-GENERATED - DO NOT EDIT DIRECTLY
|
|
18
20
|
*/
|
|
19
21
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
@@ -29,6 +31,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
29
31
|
exports.isCrmDatasetRecord = exports.CrmDatasetRecord = void 0;
|
|
30
32
|
const uuid_1 = require("uuid");
|
|
31
33
|
const core_1 = require("@d19n/odin-types/dist/core");
|
|
34
|
+
const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
|
|
35
|
+
const UserRecord_1 = require("./UserRecord");
|
|
36
|
+
const NoteRecord_1 = require("./NoteRecord");
|
|
37
|
+
const LeadRecord_1 = require("./LeadRecord");
|
|
38
|
+
const SalesTerritoryRecord_1 = require("./SalesTerritoryRecord");
|
|
39
|
+
const TeamRecord_1 = require("./TeamRecord");
|
|
40
|
+
const AddressRecord_1 = require("./AddressRecord");
|
|
32
41
|
/**
|
|
33
42
|
* Builder for action execution with dryRun support
|
|
34
43
|
*
|
|
@@ -140,6 +149,253 @@ class CrmDatasetRecord {
|
|
|
140
149
|
/** Access the underlying OdinRecord (null for new records) */
|
|
141
150
|
get record() { return this._record; }
|
|
142
151
|
// ============================================
|
|
152
|
+
// TYPE GUARDS (with TypeScript type predicates)
|
|
153
|
+
// ============================================
|
|
154
|
+
/**
|
|
155
|
+
* Type guard: check if this record is of type ADDRESS
|
|
156
|
+
*
|
|
157
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
158
|
+
* giving you access to ADDRESS-specific properties.
|
|
159
|
+
*
|
|
160
|
+
* @example
|
|
161
|
+
* ```typescript
|
|
162
|
+
* if (record.isAddress()) {
|
|
163
|
+
* // TypeScript knows record.properties is AddressCrmDatasetProperties
|
|
164
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
165
|
+
* }
|
|
166
|
+
* ```
|
|
167
|
+
* @remarks Address data sets
|
|
168
|
+
*/
|
|
169
|
+
isAddress() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.type) === 'ADDRESS'; }
|
|
170
|
+
/**
|
|
171
|
+
* Type guard: check if this record is of type CONTACT
|
|
172
|
+
*
|
|
173
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
174
|
+
* giving you access to CONTACT-specific properties.
|
|
175
|
+
*
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* if (record.isContact()) {
|
|
179
|
+
* // TypeScript knows record.properties is ContactCrmDatasetProperties
|
|
180
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
181
|
+
* }
|
|
182
|
+
* ```
|
|
183
|
+
* @remarks Contact datasets
|
|
184
|
+
*/
|
|
185
|
+
isContact() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.type) === 'CONTACT'; }
|
|
186
|
+
/**
|
|
187
|
+
* Type guard: check if this record is of type DEFAULT
|
|
188
|
+
*
|
|
189
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
190
|
+
* giving you access to DEFAULT-specific properties.
|
|
191
|
+
*
|
|
192
|
+
* @example
|
|
193
|
+
* ```typescript
|
|
194
|
+
* if (record.isDefault()) {
|
|
195
|
+
* // TypeScript knows record.properties is CrmDatasetProperties
|
|
196
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
197
|
+
* }
|
|
198
|
+
* ```
|
|
199
|
+
* @remarks This is the default record type
|
|
200
|
+
*/
|
|
201
|
+
isDefault() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.type) === 'DEFAULT'; }
|
|
202
|
+
/**
|
|
203
|
+
* Type guard: check if this record is of type LEAD
|
|
204
|
+
*
|
|
205
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
206
|
+
* giving you access to LEAD-specific properties.
|
|
207
|
+
*
|
|
208
|
+
* @example
|
|
209
|
+
* ```typescript
|
|
210
|
+
* if (record.isLead()) {
|
|
211
|
+
* // TypeScript knows record.properties is LeadCrmDatasetProperties
|
|
212
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
213
|
+
* }
|
|
214
|
+
* ```
|
|
215
|
+
* @remarks Lead DataSets
|
|
216
|
+
*/
|
|
217
|
+
isLead() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.type) === 'LEAD'; }
|
|
218
|
+
/**
|
|
219
|
+
* Access linked User records
|
|
220
|
+
* @remarks Available labels: CrmDataset__User
|
|
221
|
+
* @throws Error if called on a new (unsaved) record
|
|
222
|
+
*
|
|
223
|
+
* @example
|
|
224
|
+
* ```typescript
|
|
225
|
+
* // Get all linked User records
|
|
226
|
+
* const items = await record.users.list();
|
|
227
|
+
* const first = await record.users.first();
|
|
228
|
+
*
|
|
229
|
+
* // Filter by label
|
|
230
|
+
* const specific = await record.users.first({ label: 'CrmDataset__User' });
|
|
231
|
+
* ```
|
|
232
|
+
*/
|
|
233
|
+
get users() {
|
|
234
|
+
var _a;
|
|
235
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
236
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
237
|
+
if (!this._users) {
|
|
238
|
+
this._users = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
239
|
+
sourceEntity: 'CrmModule:CrmDataset',
|
|
240
|
+
targetEntity: 'IdentityModule:User',
|
|
241
|
+
targetModuleName: 'IdentityModule',
|
|
242
|
+
targetEntityName: 'User',
|
|
243
|
+
labels: ['CrmDataset__User'],
|
|
244
|
+
}, UserRecord_1.UserRecord);
|
|
245
|
+
}
|
|
246
|
+
return this._users;
|
|
247
|
+
}
|
|
248
|
+
/**
|
|
249
|
+
* Access linked Note records
|
|
250
|
+
* @remarks Available labels: CrmDataset__Note
|
|
251
|
+
* @throws Error if called on a new (unsaved) record
|
|
252
|
+
*
|
|
253
|
+
* @example
|
|
254
|
+
* ```typescript
|
|
255
|
+
* // Get all linked Note records
|
|
256
|
+
* const items = await record.notes.list();
|
|
257
|
+
* const first = await record.notes.first();
|
|
258
|
+
*
|
|
259
|
+
* // Filter by label
|
|
260
|
+
* const specific = await record.notes.first({ label: 'CrmDataset__Note' });
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
get notes() {
|
|
264
|
+
var _a;
|
|
265
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
266
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
267
|
+
if (!this._notes) {
|
|
268
|
+
this._notes = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
269
|
+
sourceEntity: 'CrmModule:CrmDataset',
|
|
270
|
+
targetEntity: 'SupportModule:Note',
|
|
271
|
+
targetModuleName: 'SupportModule',
|
|
272
|
+
targetEntityName: 'Note',
|
|
273
|
+
labels: ['CrmDataset__Note'],
|
|
274
|
+
}, NoteRecord_1.NoteRecord);
|
|
275
|
+
}
|
|
276
|
+
return this._notes;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Access linked Lead records
|
|
280
|
+
* @remarks Available labels: CrmDataset__Lead
|
|
281
|
+
* @throws Error if called on a new (unsaved) record
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* // Get all linked Lead records
|
|
286
|
+
* const items = await record.leads.list();
|
|
287
|
+
* const first = await record.leads.first();
|
|
288
|
+
*
|
|
289
|
+
* // Filter by label
|
|
290
|
+
* const specific = await record.leads.first({ label: 'CrmDataset__Lead' });
|
|
291
|
+
* ```
|
|
292
|
+
*/
|
|
293
|
+
get leads() {
|
|
294
|
+
var _a;
|
|
295
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
296
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
297
|
+
if (!this._leads) {
|
|
298
|
+
this._leads = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
299
|
+
sourceEntity: 'CrmModule:CrmDataset',
|
|
300
|
+
targetEntity: 'CrmModule:Lead',
|
|
301
|
+
targetModuleName: 'CrmModule',
|
|
302
|
+
targetEntityName: 'Lead',
|
|
303
|
+
labels: ['CrmDataset__Lead'],
|
|
304
|
+
}, LeadRecord_1.LeadRecord);
|
|
305
|
+
}
|
|
306
|
+
return this._leads;
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Access linked SalesTerritory records
|
|
310
|
+
* @remarks Available labels: CrmDataset__SalesTerritory
|
|
311
|
+
* @throws Error if called on a new (unsaved) record
|
|
312
|
+
*
|
|
313
|
+
* @example
|
|
314
|
+
* ```typescript
|
|
315
|
+
* // Get all linked SalesTerritory records
|
|
316
|
+
* const items = await record.salesTerritories.list();
|
|
317
|
+
* const first = await record.salesTerritories.first();
|
|
318
|
+
*
|
|
319
|
+
* // Filter by label
|
|
320
|
+
* const specific = await record.salesTerritories.first({ label: 'CrmDataset__SalesTerritory' });
|
|
321
|
+
* ```
|
|
322
|
+
*/
|
|
323
|
+
get salesTerritories() {
|
|
324
|
+
var _a;
|
|
325
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
326
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
327
|
+
if (!this._salesTerritories) {
|
|
328
|
+
this._salesTerritories = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
329
|
+
sourceEntity: 'CrmModule:CrmDataset',
|
|
330
|
+
targetEntity: 'CrmModule:SalesTerritory',
|
|
331
|
+
targetModuleName: 'CrmModule',
|
|
332
|
+
targetEntityName: 'SalesTerritory',
|
|
333
|
+
labels: ['CrmDataset__SalesTerritory'],
|
|
334
|
+
}, SalesTerritoryRecord_1.SalesTerritoryRecord);
|
|
335
|
+
}
|
|
336
|
+
return this._salesTerritories;
|
|
337
|
+
}
|
|
338
|
+
/**
|
|
339
|
+
* Access linked Team records
|
|
340
|
+
* @remarks Available labels: CrmDataset_Team
|
|
341
|
+
* @throws Error if called on a new (unsaved) record
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* ```typescript
|
|
345
|
+
* // Get all linked Team records
|
|
346
|
+
* const items = await record.teams.list();
|
|
347
|
+
* const first = await record.teams.first();
|
|
348
|
+
*
|
|
349
|
+
* // Filter by label
|
|
350
|
+
* const specific = await record.teams.first({ label: 'CrmDataset_Team' });
|
|
351
|
+
* ```
|
|
352
|
+
*/
|
|
353
|
+
get teams() {
|
|
354
|
+
var _a;
|
|
355
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
356
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
357
|
+
if (!this._teams) {
|
|
358
|
+
this._teams = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
359
|
+
sourceEntity: 'CrmModule:CrmDataset',
|
|
360
|
+
targetEntity: 'IdentityModule:Team',
|
|
361
|
+
targetModuleName: 'IdentityModule',
|
|
362
|
+
targetEntityName: 'Team',
|
|
363
|
+
labels: ['CrmDataset_Team'],
|
|
364
|
+
}, TeamRecord_1.TeamRecord);
|
|
365
|
+
}
|
|
366
|
+
return this._teams;
|
|
367
|
+
}
|
|
368
|
+
/**
|
|
369
|
+
* Access linked Address records
|
|
370
|
+
* @remarks Available labels: CrmDataset__Address
|
|
371
|
+
* @throws Error if called on a new (unsaved) record
|
|
372
|
+
*
|
|
373
|
+
* @example
|
|
374
|
+
* ```typescript
|
|
375
|
+
* // Get all linked Address records
|
|
376
|
+
* const items = await record.addresses.list();
|
|
377
|
+
* const first = await record.addresses.first();
|
|
378
|
+
*
|
|
379
|
+
* // Filter by label
|
|
380
|
+
* const specific = await record.addresses.first({ label: 'CrmDataset__Address' });
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
get addresses() {
|
|
384
|
+
var _a;
|
|
385
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
386
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
387
|
+
if (!this._addresses) {
|
|
388
|
+
this._addresses = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
389
|
+
sourceEntity: 'CrmModule:CrmDataset',
|
|
390
|
+
targetEntity: 'CrmModule:Address',
|
|
391
|
+
targetModuleName: 'CrmModule',
|
|
392
|
+
targetEntityName: 'Address',
|
|
393
|
+
labels: ['CrmDataset__Address'],
|
|
394
|
+
}, AddressRecord_1.AddressRecord);
|
|
395
|
+
}
|
|
396
|
+
return this._addresses;
|
|
397
|
+
}
|
|
398
|
+
// ============================================
|
|
143
399
|
// LINK MANAGEMENT
|
|
144
400
|
// ============================================
|
|
145
401
|
/**
|
|
@@ -313,6 +569,21 @@ class CrmDatasetRecord {
|
|
|
313
569
|
}
|
|
314
570
|
}
|
|
315
571
|
exports.CrmDatasetRecord = CrmDatasetRecord;
|
|
572
|
+
// ============================================
|
|
573
|
+
// TYPED LINK ACCESSORS
|
|
574
|
+
// ============================================
|
|
575
|
+
/** Valid labels for User associations */
|
|
576
|
+
CrmDatasetRecord.usersLabels = ['CrmDataset__User'];
|
|
577
|
+
/** Valid labels for Note associations */
|
|
578
|
+
CrmDatasetRecord.notesLabels = ['CrmDataset__Note'];
|
|
579
|
+
/** Valid labels for Lead associations */
|
|
580
|
+
CrmDatasetRecord.leadsLabels = ['CrmDataset__Lead'];
|
|
581
|
+
/** Valid labels for SalesTerritory associations */
|
|
582
|
+
CrmDatasetRecord.salesTerritoriesLabels = ['CrmDataset__SalesTerritory'];
|
|
583
|
+
/** Valid labels for Team associations */
|
|
584
|
+
CrmDatasetRecord.teamsLabels = ['CrmDataset_Team'];
|
|
585
|
+
/** Valid labels for Address associations */
|
|
586
|
+
CrmDatasetRecord.addressesLabels = ['CrmDataset__Address'];
|
|
316
587
|
/** Type guard to check if an object is a CrmDatasetRecord */
|
|
317
588
|
function isCrmDatasetRecord(obj) {
|
|
318
589
|
return obj instanceof CrmDatasetRecord;
|