@d19n/youfibre-odin-sdk 2.0.76 → 2.0.78

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 (141) hide show
  1. package/README.md +10 -1
  2. package/dist/EntityRegistry.d.ts +2 -0
  3. package/dist/EntityRegistry.js +2 -0
  4. package/dist/OdinApiClient.d.ts +4 -0
  5. package/dist/OdinApiClient.js +8 -0
  6. package/dist/OdinDbClient.d.ts +4 -0
  7. package/dist/OdinDbClient.js +8 -0
  8. package/dist/accessors-v2/RegionAccessor.d.ts +111 -0
  9. package/dist/accessors-v2/RegionAccessor.js +190 -0
  10. package/dist/accessors-v2/index.d.ts +1 -0
  11. package/dist/accessors-v2/index.js +4 -2
  12. package/dist/actions-v2/CaseCreateNoteDto.d.ts +7 -0
  13. package/dist/actions-v2/CreateActivityLogEntryDto.d.ts +8 -0
  14. package/dist/actions-v2/CreateAppointmentDto.d.ts +8 -0
  15. package/dist/actions-v2/CreateBillingRequestTransactionDto.d.ts +9 -0
  16. package/dist/actions-v2/CreateBundleProductActionDto.d.ts +8 -0
  17. package/dist/actions-v2/CreateInstallDto.d.ts +9 -10
  18. package/dist/actions-v2/CreateInternetProductActionDto.d.ts +8 -0
  19. package/dist/actions-v2/CreateLaborProductActionDto.d.ts +8 -0
  20. package/dist/actions-v2/CreateLandlineProductActionDto.d.ts +8 -0
  21. package/dist/actions-v2/CreateLeadDto.d.ts +8 -0
  22. package/dist/actions-v2/CreateLeadFromAddressDto.d.ts +8 -0
  23. package/dist/actions-v2/CreateMeshProductActionDto.d.ts +8 -0
  24. package/dist/actions-v2/CreateMessageDto.d.ts +8 -0
  25. package/dist/actions-v2/CreateMobileProductActionDto.d.ts +8 -0
  26. package/dist/actions-v2/CreateOtpTransactionDto.d.ts +9 -0
  27. package/dist/actions-v2/CreatePgContactDto.d.ts +1 -1
  28. package/dist/actions-v2/CreateRegionDto.d.ts +65 -0
  29. package/dist/actions-v2/CreateRegionDto.js +52 -0
  30. package/dist/actions-v2/CreateTelevisionProductActionDto.d.ts +8 -0
  31. package/dist/actions-v2/CreateTransactionalEmailDto.d.ts +14 -0
  32. package/dist/actions-v2/NewAppointmentDto.d.ts +8 -0
  33. package/dist/actions-v2/SendDirectDebitCreatedEmailDto.d.ts +114 -0
  34. package/dist/actions-v2/SendDirectDebitCreatedEmailDto.js +59 -0
  35. package/dist/actions-v2/SendDirectDebitSetupConfirmationEmailDto.d.ts +114 -0
  36. package/dist/actions-v2/SendDirectDebitSetupConfirmationEmailDto.js +59 -0
  37. package/dist/actions-v2/SendRefundTransactionEmailDto.d.ts +109 -0
  38. package/dist/actions-v2/SendRefundTransactionEmailDto.js +54 -0
  39. package/dist/actions-v2/SendTlosNinjaCaseEmailDto.d.ts +7 -0
  40. package/dist/actions-v2/TransactionCreateDto.d.ts +8 -0
  41. package/dist/actions-v2/UpdateBundleProductActionDto.d.ts +8 -0
  42. package/dist/actions-v2/UpdateEmailDto.d.ts +14 -0
  43. package/dist/actions-v2/UpdateInternetProductActionDto.d.ts +8 -0
  44. package/dist/actions-v2/UpdateLaborProductActionDto.d.ts +8 -0
  45. package/dist/actions-v2/UpdateLandlineProductActionDto.d.ts +8 -0
  46. package/dist/actions-v2/UpdateLeadDto.d.ts +8 -0
  47. package/dist/actions-v2/UpdateMeshProductActionDto.d.ts +8 -0
  48. package/dist/actions-v2/UpdateMobileProductActionDto.d.ts +8 -0
  49. package/dist/actions-v2/UpdatePgContactDto.d.ts +1 -1
  50. package/dist/actions-v2/UpdateServiceDto.d.ts +8 -0
  51. package/dist/actions-v2/UpdateSupportEmailDto.d.ts +7 -0
  52. package/dist/actions-v2/UpdateTelevisionProductActionDto.d.ts +8 -0
  53. package/dist/api-sdk-v2/TeamApi.d.ts +2 -2
  54. package/dist/api-sdk-v2/TeamApi.js +6 -6
  55. package/dist/api-sdk-v2/UserApi.d.ts +4 -4
  56. package/dist/api-sdk-v2/UserApi.js +12 -12
  57. package/dist/db-accessors-v2/RegionDbAccessor.d.ts +149 -0
  58. package/dist/db-accessors-v2/RegionDbAccessor.js +227 -0
  59. package/dist/db-accessors-v2/index.d.ts +1 -0
  60. package/dist/db-accessors-v2/index.js +4 -2
  61. package/dist/db-sdk-v2/TeamDb.d.ts +2 -2
  62. package/dist/db-sdk-v2/TeamDb.js +6 -6
  63. package/dist/db-sdk-v2/UserDb.d.ts +4 -4
  64. package/dist/db-sdk-v2/UserDb.js +12 -12
  65. package/dist/entities-v2/Account.d.ts +60 -1
  66. package/dist/entities-v2/Account.js +20 -2
  67. package/dist/entities-v2/ActivityLog.d.ts +26 -1
  68. package/dist/entities-v2/ActivityLog.js +21 -1
  69. package/dist/entities-v2/Address.d.ts +23 -1
  70. package/dist/entities-v2/Address.js +17 -1
  71. package/dist/entities-v2/Appointment.d.ts +22 -1
  72. package/dist/entities-v2/Appointment.js +17 -1
  73. package/dist/entities-v2/Call.d.ts +15 -1
  74. package/dist/entities-v2/Call.js +4 -0
  75. package/dist/entities-v2/ConsumptionSchedule.d.ts +23 -1
  76. package/dist/entities-v2/ConsumptionSchedule.js +17 -1
  77. package/dist/entities-v2/Email.d.ts +45 -1
  78. package/dist/entities-v2/Email.js +4 -0
  79. package/dist/entities-v2/InvoiceItem.d.ts +26 -1
  80. package/dist/entities-v2/InvoiceItem.js +19 -1
  81. package/dist/entities-v2/KnowledgeArticle.d.ts +3 -1
  82. package/dist/entities-v2/KnowledgeArticle.js +2 -0
  83. package/dist/entities-v2/Lead.d.ts +31 -1
  84. package/dist/entities-v2/Lead.js +21 -1
  85. package/dist/entities-v2/Message.d.ts +23 -1
  86. package/dist/entities-v2/Message.js +2 -0
  87. package/dist/entities-v2/Milestone.d.ts +15 -1
  88. package/dist/entities-v2/Milestone.js +11 -1
  89. package/dist/entities-v2/Note.d.ts +8 -1
  90. package/dist/entities-v2/Note.js +2 -0
  91. package/dist/entities-v2/PaymentMethod.d.ts +43 -1
  92. package/dist/entities-v2/PaymentMethod.js +31 -1
  93. package/dist/entities-v2/PgContact.d.ts +8 -8
  94. package/dist/entities-v2/PgContact.js +2 -2
  95. package/dist/entities-v2/Product.d.ts +118 -1
  96. package/dist/entities-v2/Product.js +24 -2
  97. package/dist/entities-v2/ProductComponent.d.ts +27 -1
  98. package/dist/entities-v2/ProductComponent.js +21 -1
  99. package/dist/entities-v2/Program.d.ts +15 -1
  100. package/dist/entities-v2/Program.js +11 -1
  101. package/dist/entities-v2/Project.d.ts +15 -1
  102. package/dist/entities-v2/Project.js +11 -1
  103. package/dist/entities-v2/Restriction.d.ts +23 -1
  104. package/dist/entities-v2/Restriction.js +17 -1
  105. package/dist/entities-v2/Service.d.ts +22 -1
  106. package/dist/entities-v2/Service.js +17 -1
  107. package/dist/entities-v2/ServiceAppointment.d.ts +8 -1
  108. package/dist/entities-v2/ServiceAppointment.js +2 -0
  109. package/dist/entities-v2/ServiceVisitAudit.d.ts +13 -13
  110. package/dist/entities-v2/ServiceVisitAudit.js +2 -2
  111. package/dist/entities-v2/SmsMessage.d.ts +18 -1
  112. package/dist/entities-v2/SmsMessage.js +2 -0
  113. package/dist/entities-v2/Subtask.d.ts +15 -1
  114. package/dist/entities-v2/Subtask.js +11 -1
  115. package/dist/entities-v2/Task.d.ts +15 -1
  116. package/dist/entities-v2/Task.js +11 -1
  117. package/dist/entities-v2/Team.d.ts +3 -3
  118. package/dist/entities-v2/Transaction.d.ts +27 -1
  119. package/dist/entities-v2/Transaction.js +21 -1
  120. package/dist/entities-v2/User.d.ts +6 -6
  121. package/dist/entities-v2/Vendor.d.ts +22 -1
  122. package/dist/entities-v2/Vendor.js +17 -1
  123. package/dist/entities-v2/WorkOrder.d.ts +99 -1
  124. package/dist/entities-v2/WorkOrder.js +2 -0
  125. package/dist/entities-v2/YfStockCount.d.ts +9 -1
  126. package/dist/entities-v2/YfStockCount.js +8 -0
  127. package/dist/records-v2/EmailRecord.d.ts +87 -0
  128. package/dist/records-v2/EmailRecord.js +108 -0
  129. package/dist/records-v2/ExchangeRecord.d.ts +20 -0
  130. package/dist/records-v2/ExchangeRecord.js +33 -0
  131. package/dist/records-v2/RegionRecord.d.ts +205 -0
  132. package/dist/records-v2/RegionRecord.js +292 -0
  133. package/dist/records-v2/ServiceAppointmentConfigRecord.d.ts +20 -0
  134. package/dist/records-v2/ServiceAppointmentConfigRecord.js +33 -0
  135. package/dist/records-v2/TeamRecord.d.ts +20 -20
  136. package/dist/records-v2/TeamRecord.js +33 -33
  137. package/dist/records-v2/UserRecord.d.ts +40 -40
  138. package/dist/records-v2/UserRecord.js +66 -66
  139. package/dist/records-v2/index.d.ts +1 -0
  140. package/dist/records-v2/index.js +5 -2
  141. package/package.json +2 -2
@@ -0,0 +1,292 @@
1
+ "use strict";
2
+ /**
3
+ * Region Record Wrapper
4
+ *
5
+ * Provides typed action methods and link management.
6
+ * Works with both ApiProvider and DbProvider.
7
+ *
8
+ * All action methods return an ActionBuilder or FlowBuilder.
9
+ * Call .execute() to run or .dryRun() to get the payload for debugging.
10
+ *
11
+ * Can be instantiated with null record for create operations:
12
+ * ```typescript
13
+ * const record = odinClient.regions.new();
14
+ * await record.createRegion({ ... }).execute();
15
+ * ```
16
+ *
17
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
18
+ */
19
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
20
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
21
+ return new (P || (P = Promise))(function (resolve, reject) {
22
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
23
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
24
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
25
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
26
+ });
27
+ };
28
+ Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.isRegionRecord = exports.RegionRecord = void 0;
30
+ const uuid_1 = require("uuid");
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 ExchangeRecord_1 = require("./ExchangeRecord");
34
+ const ServiceAppointmentConfigRecord_1 = require("./ServiceAppointmentConfigRecord");
35
+ /**
36
+ * Builder for action execution with dryRun support
37
+ *
38
+ * Provides a consistent API across all action types:
39
+ * - `.execute()` - Execute the action and return results
40
+ * - `.dryRun()` - Return the payload without executing (for debugging)
41
+ */
42
+ class ActionBuilder {
43
+ constructor(provider, moduleName, entityName, payload, clearPendingLinks) {
44
+ this._provider = provider;
45
+ this._moduleName = moduleName;
46
+ this._entityName = entityName;
47
+ this._payload = payload;
48
+ this._clearPendingLinks = clearPendingLinks;
49
+ }
50
+ /**
51
+ * Set an external system identifier for this record.
52
+ * Links the record to a corresponding entry in an external application.
53
+ *
54
+ * @param externalId - The ID in the external system
55
+ * @param externalAppId - The external application identifier
56
+ * @returns this (for chaining)
57
+ *
58
+ * @example
59
+ * ```typescript
60
+ * await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
61
+ * ```
62
+ */
63
+ withExternalId(externalId, externalAppId) {
64
+ this._payload.externalId = externalId;
65
+ this._payload.externalAppId = externalAppId;
66
+ return this;
67
+ }
68
+ /**
69
+ * Set security/access groups for this record.
70
+ * Controls which user groups can access the record.
71
+ *
72
+ * @param groups - Array of group names
73
+ * @returns this (for chaining)
74
+ *
75
+ * @example
76
+ * ```typescript
77
+ * await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
78
+ * ```
79
+ */
80
+ withGroups(groups) {
81
+ this._payload.groups = groups;
82
+ return this;
83
+ }
84
+ /**
85
+ * Execute the action
86
+ * @returns The result from the API
87
+ */
88
+ execute() {
89
+ return __awaiter(this, void 0, void 0, function* () {
90
+ const result = yield this._provider._applyAction(this._moduleName, this._entityName, this._payload);
91
+ this._clearPendingLinks();
92
+ return result;
93
+ });
94
+ }
95
+ /**
96
+ * Returns the request payload without executing (for debugging)
97
+ * @returns The request payload that would be sent to the API
98
+ */
99
+ dryRun() {
100
+ return this._payload;
101
+ }
102
+ /**
103
+ * Prevents accidental `await actionBuilder` without .execute()
104
+ * Forces developers to explicitly call .execute()
105
+ * @throws Error always - use .execute() or .dryRun() instead
106
+ */
107
+ then() {
108
+ throw new Error('ActionBuilder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
109
+ }
110
+ }
111
+ class RegionRecord {
112
+ /**
113
+ * Create a record wrapper.
114
+ * @param record - The underlying record, or null for create operations
115
+ * @param provider - The API or DB provider
116
+ * @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
117
+ */
118
+ constructor(record, provider, preGeneratedId) {
119
+ this._pendingLinks = [];
120
+ this._record = record;
121
+ this._provider = provider;
122
+ this._preGeneratedId = preGeneratedId !== null && preGeneratedId !== void 0 ? preGeneratedId : (0, uuid_1.v4)();
123
+ }
124
+ // ============================================
125
+ // CORE PROPERTIES
126
+ // ============================================
127
+ /** Returns true if this is a new (unsaved) record */
128
+ get isNew() { var _a; return !((_a = this._record) === null || _a === void 0 ? void 0 : _a.id); }
129
+ /** Record ID - always available (pre-generated for new records) */
130
+ get id() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : this._preGeneratedId; }
131
+ get entity() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.entity) !== null && _b !== void 0 ? _b : 'ProjectModule:Region'; }
132
+ get type() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.type; }
133
+ /** Record properties - empty object for new (unsaved) records */
134
+ get properties() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.properties) || {}; }
135
+ get title() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.title; }
136
+ get recordNumber() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.recordNumber; }
137
+ get stage() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.stage; }
138
+ get createdAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.createdAt; }
139
+ get updatedAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.updatedAt; }
140
+ get externalId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalId; }
141
+ get externalAppId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalAppId; }
142
+ get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
143
+ /** Access the underlying OdinRecord (null for new records) */
144
+ get record() { return this._record; }
145
+ /**
146
+ * Access linked Exchange records
147
+ * @remarks Available labels: Region__Exchange
148
+ * @throws Error if called on a new (unsaved) record
149
+ *
150
+ * @example
151
+ * ```typescript
152
+ * // Get all linked Exchange records
153
+ * const items = await record.exchanges.list();
154
+ * const first = await record.exchanges.first();
155
+ *
156
+ * // Filter by label
157
+ * const specific = await record.exchanges.first({ label: 'Region__Exchange' });
158
+ * ```
159
+ */
160
+ get exchanges() {
161
+ var _a;
162
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
163
+ throw new Error('Cannot access links on a new (unsaved) record');
164
+ if (!this._exchanges) {
165
+ this._exchanges = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
166
+ sourceEntity: 'ProjectModule:Region',
167
+ targetEntity: 'ProjectModule:Exchange',
168
+ targetModuleName: 'ProjectModule',
169
+ targetEntityName: 'Exchange',
170
+ labels: ['Region__Exchange'],
171
+ }, ExchangeRecord_1.ExchangeRecord);
172
+ }
173
+ return this._exchanges;
174
+ }
175
+ /**
176
+ * Access linked ServiceAppointmentConfig records
177
+ * @remarks Available labels: ServiceAppointmentConfig_Region
178
+ * @throws Error if called on a new (unsaved) record
179
+ *
180
+ * @example
181
+ * ```typescript
182
+ * // Get all linked ServiceAppointmentConfig records
183
+ * const items = await record.serviceAppointmentConfigs.list();
184
+ * const first = await record.serviceAppointmentConfigs.first();
185
+ *
186
+ * // Filter by label
187
+ * const specific = await record.serviceAppointmentConfigs.first({ label: 'ServiceAppointmentConfig_Region' });
188
+ * ```
189
+ */
190
+ get serviceAppointmentConfigs() {
191
+ var _a;
192
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
193
+ throw new Error('Cannot access links on a new (unsaved) record');
194
+ if (!this._serviceAppointmentConfigs) {
195
+ this._serviceAppointmentConfigs = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
196
+ sourceEntity: 'ProjectModule:Region',
197
+ targetEntity: 'FieldServiceModule:ServiceAppointmentConfig',
198
+ targetModuleName: 'FieldServiceModule',
199
+ targetEntityName: 'ServiceAppointmentConfig',
200
+ labels: ['ServiceAppointmentConfig_Region'],
201
+ }, ServiceAppointmentConfigRecord_1.ServiceAppointmentConfigRecord);
202
+ }
203
+ return this._serviceAppointmentConfigs;
204
+ }
205
+ // ============================================
206
+ // LINK MANAGEMENT
207
+ // ============================================
208
+ /**
209
+ * Queue a link to be created with the next action.
210
+ * Works for both create and update actions.
211
+ * @returns this (for chaining)
212
+ */
213
+ link(target) {
214
+ this._pendingLinks.push(new core_1.OdinRecordLinkDto({ id: target.id, entity: target.entity }));
215
+ return this;
216
+ }
217
+ /** Get the currently queued links */
218
+ get pendingLinks() {
219
+ return [...this._pendingLinks];
220
+ }
221
+ /** Clear pending links without executing an action */
222
+ clearPendingLinks() {
223
+ this._pendingLinks = [];
224
+ return this;
225
+ }
226
+ /**
227
+ * Immediately unlink a record (API call).
228
+ * Unlike link(), this executes immediately.
229
+ * @throws Error if called on a new (unsaved) record
230
+ */
231
+ unlink(target) {
232
+ var _a;
233
+ return __awaiter(this, void 0, void 0, function* () {
234
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
235
+ throw new Error('Cannot unlink from a new (unsaved) record');
236
+ const targetId = typeof target === 'string' ? target : target.id;
237
+ yield this._provider._deleteLinks('ProjectModule', 'Region', this._record.id, targetId);
238
+ });
239
+ }
240
+ // ============================================
241
+ // CREATE ACTIONS (no existing record required)
242
+ // ============================================
243
+ /**
244
+ * CreateRegion
245
+ *
246
+ * Creates a new Region record with the specified properties.
247
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
248
+ *
249
+ * @param properties - The properties for the new record
250
+ * @param options - Optional settings
251
+ * @param options.type - Override the record type
252
+ * @param options.journeyId - Associate with a journey
253
+ * @param options.stageKey - Set initial pipeline stage
254
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
255
+ *
256
+ * @example
257
+ * ```typescript
258
+ * // Create with properties
259
+ * const record = odinClient.regions.new();
260
+ * await record.createRegion({ ... }).execute();
261
+ *
262
+ * // Dry run (for debugging)
263
+ * const payload = record.createRegion({ ... }).dryRun();
264
+ * ```
265
+ */
266
+ createRegion(properties, options) {
267
+ var _a, _b;
268
+ const payload = {
269
+ entity: 'ProjectModule:Region',
270
+ type: (_a = options === null || options === void 0 ? void 0 : options.type) !== null && _a !== void 0 ? _a : (_b = this._record) === null || _b === void 0 ? void 0 : _b.type,
271
+ actionName: 'CreateRegion',
272
+ properties: properties || {},
273
+ associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined,
274
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
275
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
276
+ };
277
+ return new ActionBuilder(this._provider, 'ProjectModule', 'Region', payload, () => { this._pendingLinks = []; });
278
+ }
279
+ }
280
+ exports.RegionRecord = RegionRecord;
281
+ // ============================================
282
+ // TYPED LINK ACCESSORS
283
+ // ============================================
284
+ /** Valid labels for Exchange associations */
285
+ RegionRecord.exchangesLabels = ['Region__Exchange'];
286
+ /** Valid labels for ServiceAppointmentConfig associations */
287
+ RegionRecord.serviceAppointmentConfigsLabels = ['ServiceAppointmentConfig_Region'];
288
+ /** Type guard to check if an object is a RegionRecord */
289
+ function isRegionRecord(obj) {
290
+ return obj instanceof RegionRecord;
291
+ }
292
+ exports.isRegionRecord = isRegionRecord;
@@ -37,6 +37,7 @@ import { UpdatePrePullScheduleProperties } from '../actions-v2/UpdatePrePullSche
37
37
  import { UpdateRemediationProperties } from '../actions-v2/UpdateRemediationDto';
38
38
  import { UpdateServiceScheduleProperties } from '../actions-v2/UpdateServiceScheduleDto';
39
39
  import { NoteRecord } from './NoteRecord';
40
+ import { RegionRecord } from './RegionRecord';
40
41
  import { WorkOrderRecord } from './WorkOrderRecord';
41
42
  import { ServiceAppointmentRecord } from './ServiceAppointmentRecord';
42
43
  import { ScheduleSlotRecord } from './ScheduleSlotRecord';
@@ -108,6 +109,7 @@ export declare class ServiceAppointmentConfigRecord<TProps = ServiceAppointmentC
108
109
  private _pendingLinks;
109
110
  private _preGeneratedId;
110
111
  private _notes?;
112
+ private _regions?;
111
113
  private _workOrders?;
112
114
  private _serviceAppointments?;
113
115
  private _scheduleSlots?;
@@ -316,6 +318,24 @@ export declare class ServiceAppointmentConfigRecord<TProps = ServiceAppointmentC
316
318
  * ```
317
319
  */
318
320
  get notes(): RecordLinkManager<NoteRecord, typeof ServiceAppointmentConfigRecord['notesLabels'][number]>;
321
+ /** Valid labels for Region associations */
322
+ static readonly regionsLabels: readonly ["ServiceAppointmentConfig_Region"];
323
+ /**
324
+ * Access linked Region records
325
+ * @remarks Available labels: ServiceAppointmentConfig_Region
326
+ * @throws Error if called on a new (unsaved) record
327
+ *
328
+ * @example
329
+ * ```typescript
330
+ * // Get all linked Region records
331
+ * const items = await record.regions.list();
332
+ * const first = await record.regions.first();
333
+ *
334
+ * // Filter by label
335
+ * const specific = await record.regions.first({ label: 'ServiceAppointmentConfig_Region' });
336
+ * ```
337
+ */
338
+ get regions(): RecordLinkManager<RegionRecord, typeof ServiceAppointmentConfigRecord['regionsLabels'][number]>;
319
339
  /** Valid labels for WorkOrder associations */
320
340
  static readonly workOrdersLabels: readonly ["WorkOrder__ServiceAppointmentConfig"];
321
341
  /**
@@ -33,6 +33,7 @@ const uuid_1 = require("uuid");
33
33
  const core_1 = require("@d19n/odin-types/dist/core");
34
34
  const record_link_manager_1 = require("@d19n/odin-sdk-generator/dist/record-link-manager");
35
35
  const NoteRecord_1 = require("./NoteRecord");
36
+ const RegionRecord_1 = require("./RegionRecord");
36
37
  const WorkOrderRecord_1 = require("./WorkOrderRecord");
37
38
  const ServiceAppointmentRecord_1 = require("./ServiceAppointmentRecord");
38
39
  const ScheduleSlotRecord_1 = require("./ScheduleSlotRecord");
@@ -341,6 +342,36 @@ class ServiceAppointmentConfigRecord {
341
342
  }
342
343
  return this._notes;
343
344
  }
345
+ /**
346
+ * Access linked Region records
347
+ * @remarks Available labels: ServiceAppointmentConfig_Region
348
+ * @throws Error if called on a new (unsaved) record
349
+ *
350
+ * @example
351
+ * ```typescript
352
+ * // Get all linked Region records
353
+ * const items = await record.regions.list();
354
+ * const first = await record.regions.first();
355
+ *
356
+ * // Filter by label
357
+ * const specific = await record.regions.first({ label: 'ServiceAppointmentConfig_Region' });
358
+ * ```
359
+ */
360
+ get regions() {
361
+ var _a;
362
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
363
+ throw new Error('Cannot access links on a new (unsaved) record');
364
+ if (!this._regions) {
365
+ this._regions = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
366
+ sourceEntity: 'FieldServiceModule:ServiceAppointmentConfig',
367
+ targetEntity: 'ProjectModule:Region',
368
+ targetModuleName: 'ProjectModule',
369
+ targetEntityName: 'Region',
370
+ labels: ['ServiceAppointmentConfig_Region'],
371
+ }, RegionRecord_1.RegionRecord);
372
+ }
373
+ return this._regions;
374
+ }
344
375
  /**
345
376
  * Access linked WorkOrder records
346
377
  * @remarks Available labels: WorkOrder__ServiceAppointmentConfig
@@ -973,6 +1004,8 @@ exports.ServiceAppointmentConfigRecord = ServiceAppointmentConfigRecord;
973
1004
  // ============================================
974
1005
  /** Valid labels for Note associations */
975
1006
  ServiceAppointmentConfigRecord.notesLabels = ['ServiceAppointmentConfig__Note'];
1007
+ /** Valid labels for Region associations */
1008
+ ServiceAppointmentConfigRecord.regionsLabels = ['ServiceAppointmentConfig_Region'];
976
1009
  /** Valid labels for WorkOrder associations */
977
1010
  ServiceAppointmentConfigRecord.workOrdersLabels = ['WorkOrder__ServiceAppointmentConfig'];
978
1011
  /** Valid labels for ServiceAppointment associations */
@@ -24,9 +24,9 @@ import { TeamProperties } from '../entities-v2/Team';
24
24
  import { CreateTeamProperties } from '../actions-v2/CreateTeamDto';
25
25
  import { UpdateTeamProperties } from '../actions-v2/UpdateTeamDto';
26
26
  import { CaseRecord } from './CaseRecord';
27
- import { UserRecord } from './UserRecord';
28
27
  import { WorkOrderRecord } from './WorkOrderRecord';
29
28
  import { CrmDatasetRecord } from './CrmDatasetRecord';
29
+ import { UserRecord } from './UserRecord';
30
30
  /**
31
31
  * Builder for action execution with dryRun support
32
32
  *
@@ -91,9 +91,9 @@ export declare class TeamRecord<TProps = TeamProperties> {
91
91
  private _pendingLinks;
92
92
  private _preGeneratedId;
93
93
  private _cases?;
94
- private _users?;
95
94
  private _workOrders?;
96
95
  private _crmDatasets?;
96
+ private _users?;
97
97
  /**
98
98
  * Create a record wrapper.
99
99
  * @param record - The underlying record, or null for create operations
@@ -137,24 +137,6 @@ export declare class TeamRecord<TProps = TeamProperties> {
137
137
  * ```
138
138
  */
139
139
  get cases(): RecordLinkManager<CaseRecord, typeof TeamRecord['casesLabels'][number]>;
140
- /** Valid labels for User associations */
141
- static readonly usersLabels: readonly ["Team_User"];
142
- /**
143
- * Access linked User records
144
- * @remarks Available labels: Team_User
145
- * @throws Error if called on a new (unsaved) record
146
- *
147
- * @example
148
- * ```typescript
149
- * // Get all linked User records
150
- * const items = await record.users.list();
151
- * const first = await record.users.first();
152
- *
153
- * // Filter by label
154
- * const specific = await record.users.first({ label: 'Team_User' });
155
- * ```
156
- */
157
- get users(): RecordLinkManager<UserRecord, typeof TeamRecord['usersLabels'][number]>;
158
140
  /** Valid labels for WorkOrder associations */
159
141
  static readonly workOrdersLabels: readonly ["WorkOrder_Team"];
160
142
  /**
@@ -191,6 +173,24 @@ export declare class TeamRecord<TProps = TeamProperties> {
191
173
  * ```
192
174
  */
193
175
  get crmDatasets(): RecordLinkManager<CrmDatasetRecord, typeof TeamRecord['crmDatasetsLabels'][number]>;
176
+ /** Valid labels for User associations */
177
+ static readonly usersLabels: readonly ["Team_User"];
178
+ /**
179
+ * Access linked User records
180
+ * @remarks Available labels: Team_User
181
+ * @throws Error if called on a new (unsaved) record
182
+ *
183
+ * @example
184
+ * ```typescript
185
+ * // Get all linked User records
186
+ * const items = await record.users.list();
187
+ * const first = await record.users.first();
188
+ *
189
+ * // Filter by label
190
+ * const specific = await record.users.first({ label: 'Team_User' });
191
+ * ```
192
+ */
193
+ get users(): RecordLinkManager<UserRecord, typeof TeamRecord['usersLabels'][number]>;
194
194
  /**
195
195
  * Queue a link to be created with the next action.
196
196
  * Works for both create and update actions.
@@ -31,9 +31,9 @@ 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
33
  const CaseRecord_1 = require("./CaseRecord");
34
- const UserRecord_1 = require("./UserRecord");
35
34
  const WorkOrderRecord_1 = require("./WorkOrderRecord");
36
35
  const CrmDatasetRecord_1 = require("./CrmDatasetRecord");
36
+ const UserRecord_1 = require("./UserRecord");
37
37
  /**
38
38
  * Builder for action execution with dryRun support
39
39
  *
@@ -174,36 +174,6 @@ class TeamRecord {
174
174
  }
175
175
  return this._cases;
176
176
  }
177
- /**
178
- * Access linked User records
179
- * @remarks Available labels: Team_User
180
- * @throws Error if called on a new (unsaved) record
181
- *
182
- * @example
183
- * ```typescript
184
- * // Get all linked User records
185
- * const items = await record.users.list();
186
- * const first = await record.users.first();
187
- *
188
- * // Filter by label
189
- * const specific = await record.users.first({ label: 'Team_User' });
190
- * ```
191
- */
192
- get users() {
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._users) {
197
- this._users = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
198
- sourceEntity: 'IdentityModule:Team',
199
- targetEntity: 'IdentityModule:User',
200
- targetModuleName: 'IdentityModule',
201
- targetEntityName: 'User',
202
- labels: ['Team_User'],
203
- }, UserRecord_1.UserRecord);
204
- }
205
- return this._users;
206
- }
207
177
  /**
208
178
  * Access linked WorkOrder records
209
179
  * @remarks Available labels: WorkOrder_Team
@@ -264,6 +234,36 @@ class TeamRecord {
264
234
  }
265
235
  return this._crmDatasets;
266
236
  }
237
+ /**
238
+ * Access linked User records
239
+ * @remarks Available labels: Team_User
240
+ * @throws Error if called on a new (unsaved) record
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * // Get all linked User records
245
+ * const items = await record.users.list();
246
+ * const first = await record.users.first();
247
+ *
248
+ * // Filter by label
249
+ * const specific = await record.users.first({ label: 'Team_User' });
250
+ * ```
251
+ */
252
+ get users() {
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._users) {
257
+ this._users = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
258
+ sourceEntity: 'IdentityModule:Team',
259
+ targetEntity: 'IdentityModule:User',
260
+ targetModuleName: 'IdentityModule',
261
+ targetEntityName: 'User',
262
+ labels: ['Team_User'],
263
+ }, UserRecord_1.UserRecord);
264
+ }
265
+ return this._users;
266
+ }
267
267
  // ============================================
268
268
  // LINK MANAGEMENT
269
269
  // ============================================
@@ -385,12 +385,12 @@ exports.TeamRecord = TeamRecord;
385
385
  // ============================================
386
386
  /** Valid labels for Case associations */
387
387
  TeamRecord.casesLabels = ['Case_Team'];
388
- /** Valid labels for User associations */
389
- TeamRecord.usersLabels = ['Team_User'];
390
388
  /** Valid labels for WorkOrder associations */
391
389
  TeamRecord.workOrdersLabels = ['WorkOrder_Team'];
392
390
  /** Valid labels for CrmDataset associations */
393
391
  TeamRecord.crmDatasetsLabels = ['CrmDataset_Team'];
392
+ /** Valid labels for User associations */
393
+ TeamRecord.usersLabels = ['Team_User'];
394
394
  /** Type guard to check if an object is a TeamRecord */
395
395
  function isTeamRecord(obj) {
396
396
  return obj instanceof TeamRecord;
@@ -25,7 +25,6 @@ import { CreateUserProperties } from '../actions-v2/CreateUserDto';
25
25
  import { UpdateUserProperties } from '../actions-v2/UpdateUserDto';
26
26
  import { BlockageA55Record } from './BlockageA55Record';
27
27
  import { TimeSlotRecord } from './TimeSlotRecord';
28
- import { TeamRecord } from './TeamRecord';
29
28
  import { ReturnsRecord } from './ReturnsRecord';
30
29
  import { PushNotificationRecord } from './PushNotificationRecord';
31
30
  import { EmailRecord } from './EmailRecord';
@@ -38,8 +37,9 @@ import { CaseRecord } from './CaseRecord';
38
37
  import { ChangeReasonRecord } from './ChangeReasonRecord';
39
38
  import { CrmDatasetRecord } from './CrmDatasetRecord';
40
39
  import { CustomerDeviceConfigurationRecord } from './CustomerDeviceConfigurationRecord';
41
- import { SalesTerritoryRecord } from './SalesTerritoryRecord';
42
40
  import { CallTransferRecord } from './CallTransferRecord';
41
+ import { TeamRecord } from './TeamRecord';
42
+ import { SalesTerritoryRecord } from './SalesTerritoryRecord';
43
43
  /**
44
44
  * Builder for action execution with dryRun support
45
45
  *
@@ -105,7 +105,6 @@ export declare class UserRecord<TProps = UserProperties> {
105
105
  private _preGeneratedId;
106
106
  private _blockageA55s?;
107
107
  private _timeSlots?;
108
- private _teams?;
109
108
  private _returnses?;
110
109
  private _pushNotifications?;
111
110
  private _emails?;
@@ -118,8 +117,9 @@ export declare class UserRecord<TProps = UserProperties> {
118
117
  private _changeReasons?;
119
118
  private _crmDatasets?;
120
119
  private _customerDeviceConfigurations?;
121
- private _salesTerritories?;
122
120
  private _callTransfers?;
121
+ private _teams?;
122
+ private _salesTerritories?;
123
123
  /**
124
124
  * Create a record wrapper.
125
125
  * @param record - The underlying record, or null for create operations
@@ -181,24 +181,6 @@ export declare class UserRecord<TProps = UserProperties> {
181
181
  * ```
182
182
  */
183
183
  get timeSlots(): RecordLinkManager<TimeSlotRecord, typeof UserRecord['timeSlotsLabels'][number]>;
184
- /** Valid labels for Team associations */
185
- static readonly teamsLabels: readonly ["Team_User"];
186
- /**
187
- * Access linked Team records
188
- * @remarks Available labels: Team_User
189
- * @throws Error if called on a new (unsaved) record
190
- *
191
- * @example
192
- * ```typescript
193
- * // Get all linked Team records
194
- * const items = await record.teams.list();
195
- * const first = await record.teams.first();
196
- *
197
- * // Filter by label
198
- * const specific = await record.teams.first({ label: 'Team_User' });
199
- * ```
200
- */
201
- get teams(): RecordLinkManager<TeamRecord, typeof UserRecord['teamsLabels'][number]>;
202
184
  /** Valid labels for Returns associations */
203
185
  static readonly returnsesLabels: readonly ["Returns__Inspected_By"];
204
186
  /**
@@ -415,24 +397,6 @@ export declare class UserRecord<TProps = UserProperties> {
415
397
  * ```
416
398
  */
417
399
  get customerDeviceConfigurations(): RecordLinkManager<CustomerDeviceConfigurationRecord, typeof UserRecord['customerDeviceConfigurationsLabels'][number]>;
418
- /** Valid labels for SalesTerritory associations */
419
- static readonly salesTerritoriesLabels: readonly ["SalesTerritory__User"];
420
- /**
421
- * Access linked SalesTerritory records
422
- * @remarks Available labels: SalesTerritory__User
423
- * @throws Error if called on a new (unsaved) record
424
- *
425
- * @example
426
- * ```typescript
427
- * // Get all linked SalesTerritory records
428
- * const items = await record.salesTerritories.list();
429
- * const first = await record.salesTerritories.first();
430
- *
431
- * // Filter by label
432
- * const specific = await record.salesTerritories.first({ label: 'SalesTerritory__User' });
433
- * ```
434
- */
435
- get salesTerritories(): RecordLinkManager<SalesTerritoryRecord, typeof UserRecord['salesTerritoriesLabels'][number]>;
436
400
  /** Valid labels for CallTransfer associations */
437
401
  static readonly callTransfersLabels: readonly ["CallTransfer_ToAgent", "CallTransfer_FromAgent"];
438
402
  /**
@@ -451,6 +415,42 @@ export declare class UserRecord<TProps = UserProperties> {
451
415
  * ```
452
416
  */
453
417
  get callTransfers(): RecordLinkManager<CallTransferRecord, typeof UserRecord['callTransfersLabels'][number]>;
418
+ /** Valid labels for Team associations */
419
+ static readonly teamsLabels: readonly ["Team_User"];
420
+ /**
421
+ * Access linked Team records
422
+ * @remarks Available labels: Team_User
423
+ * @throws Error if called on a new (unsaved) record
424
+ *
425
+ * @example
426
+ * ```typescript
427
+ * // Get all linked Team records
428
+ * const items = await record.teams.list();
429
+ * const first = await record.teams.first();
430
+ *
431
+ * // Filter by label
432
+ * const specific = await record.teams.first({ label: 'Team_User' });
433
+ * ```
434
+ */
435
+ get teams(): RecordLinkManager<TeamRecord, typeof UserRecord['teamsLabels'][number]>;
436
+ /** Valid labels for SalesTerritory associations */
437
+ static readonly salesTerritoriesLabels: readonly ["SalesTerritory__User"];
438
+ /**
439
+ * Access linked SalesTerritory records
440
+ * @remarks Available labels: SalesTerritory__User
441
+ * @throws Error if called on a new (unsaved) record
442
+ *
443
+ * @example
444
+ * ```typescript
445
+ * // Get all linked SalesTerritory records
446
+ * const items = await record.salesTerritories.list();
447
+ * const first = await record.salesTerritories.first();
448
+ *
449
+ * // Filter by label
450
+ * const specific = await record.salesTerritories.first({ label: 'SalesTerritory__User' });
451
+ * ```
452
+ */
453
+ get salesTerritories(): RecordLinkManager<SalesTerritoryRecord, typeof UserRecord['salesTerritoriesLabels'][number]>;
454
454
  /**
455
455
  * Queue a link to be created with the next action.
456
456
  * Works for both create and update actions.