@d19n/youfibre-odin-sdk 2.0.229 → 2.0.231

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 (69) hide show
  1. package/README.md +19 -2
  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/PgReportEventAccessor.d.ts +111 -0
  9. package/dist/accessors-v2/PgReportEventAccessor.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/CompletePicRequestDto.d.ts +13 -3
  13. package/dist/actions-v2/CompletePicRequestDto.js +2 -0
  14. package/dist/actions-v2/CompletePicRequestFlowDto.d.ts +11 -3
  15. package/dist/actions-v2/CreatePgReportEventDto.d.ts +135 -0
  16. package/dist/actions-v2/CreatePgReportEventDto.js +59 -0
  17. package/dist/actions-v2/MovePgReportEventToFailedDto.d.ts +117 -0
  18. package/dist/actions-v2/MovePgReportEventToFailedDto.js +82 -0
  19. package/dist/actions-v2/MovePgReportEventToSkippedDto.d.ts +117 -0
  20. package/dist/actions-v2/MovePgReportEventToSkippedDto.js +82 -0
  21. package/dist/actions-v2/MovePgReportEventToSucceededDto.d.ts +117 -0
  22. package/dist/actions-v2/MovePgReportEventToSucceededDto.js +82 -0
  23. package/dist/actions-v2/UpdateAdditionalCareDto.d.ts +2 -2
  24. package/dist/actions-v2/UpdateContactDto.d.ts +2 -2
  25. package/dist/actions-v2/UpdatePgReportEventDto.d.ts +95 -0
  26. package/dist/actions-v2/UpdatePgReportEventDto.js +56 -0
  27. package/dist/api-sdk-v2/PgDirectDebitFileApi.d.ts +2 -0
  28. package/dist/api-sdk-v2/PgDirectDebitFileApi.js +6 -0
  29. package/dist/api-sdk-v2/PgPaymentMethodApi.d.ts +2 -0
  30. package/dist/api-sdk-v2/PgPaymentMethodApi.js +6 -0
  31. package/dist/api-sdk-v2/PgReportEventApi.d.ts +52 -0
  32. package/dist/api-sdk-v2/PgReportEventApi.js +167 -0
  33. package/dist/api-sdk-v2/PgTransactionApi.d.ts +2 -0
  34. package/dist/api-sdk-v2/PgTransactionApi.js +6 -0
  35. package/dist/db-accessors-v2/PgReportEventDbAccessor.d.ts +149 -0
  36. package/dist/db-accessors-v2/PgReportEventDbAccessor.js +227 -0
  37. package/dist/db-accessors-v2/index.d.ts +1 -0
  38. package/dist/db-accessors-v2/index.js +4 -2
  39. package/dist/db-sdk-v2/PgDirectDebitFileDb.d.ts +2 -0
  40. package/dist/db-sdk-v2/PgDirectDebitFileDb.js +6 -0
  41. package/dist/db-sdk-v2/PgPaymentMethodDb.d.ts +2 -0
  42. package/dist/db-sdk-v2/PgPaymentMethodDb.js +6 -0
  43. package/dist/db-sdk-v2/PgReportEventDb.d.ts +124 -0
  44. package/dist/db-sdk-v2/PgReportEventDb.js +216 -0
  45. package/dist/db-sdk-v2/PgTransactionDb.d.ts +2 -0
  46. package/dist/db-sdk-v2/PgTransactionDb.js +6 -0
  47. package/dist/entities-v2/ChurnRequest.d.ts +4 -0
  48. package/dist/entities-v2/ChurnRequest.js +4 -0
  49. package/dist/entities-v2/Contact.d.ts +58 -72
  50. package/dist/entities-v2/Contact.js +40 -54
  51. package/dist/entities-v2/PgDirectDebitFile.d.ts +7 -0
  52. package/dist/entities-v2/PgDirectDebitFile.js +5 -1
  53. package/dist/entities-v2/PgPaymentMethod.d.ts +7 -0
  54. package/dist/entities-v2/PgPaymentMethod.js +5 -1
  55. package/dist/entities-v2/PgReportEvent.d.ts +194 -0
  56. package/dist/entities-v2/PgReportEvent.js +134 -0
  57. package/dist/entities-v2/PgTransaction.d.ts +7 -0
  58. package/dist/entities-v2/PgTransaction.js +5 -1
  59. package/dist/records-v2/PgDirectDebitFileRecord.d.ts +20 -0
  60. package/dist/records-v2/PgDirectDebitFileRecord.js +33 -0
  61. package/dist/records-v2/PgPaymentMethodRecord.d.ts +20 -0
  62. package/dist/records-v2/PgPaymentMethodRecord.js +33 -0
  63. package/dist/records-v2/PgReportEventRecord.d.ts +347 -0
  64. package/dist/records-v2/PgReportEventRecord.js +465 -0
  65. package/dist/records-v2/PgTransactionRecord.d.ts +20 -0
  66. package/dist/records-v2/PgTransactionRecord.js +33 -0
  67. package/dist/records-v2/index.d.ts +1 -0
  68. package/dist/records-v2/index.js +6 -3
  69. package/package.json +1 -1
@@ -0,0 +1,465 @@
1
+ "use strict";
2
+ /**
3
+ * PgReportEvent 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.pgReportEvents.new();
14
+ * await record.createPgReportEvent({ ... }).execute();
15
+ * ```
16
+ *
17
+ * Entity Types: DEFAULT
18
+ *
19
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
20
+ */
21
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
22
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
23
+ return new (P || (P = Promise))(function (resolve, reject) {
24
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
25
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
26
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
27
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
28
+ });
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.isPgReportEventRecord = exports.PgReportEventRecord = void 0;
32
+ const uuid_1 = require("uuid");
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 PgDirectDebitFileRecord_1 = require("./PgDirectDebitFileRecord");
36
+ const PgPaymentMethodRecord_1 = require("./PgPaymentMethodRecord");
37
+ const PgTransactionRecord_1 = require("./PgTransactionRecord");
38
+ /**
39
+ * Builder for action execution with dryRun support
40
+ *
41
+ * Provides a consistent API across all action types:
42
+ * - `.execute()` - Execute the action and return results
43
+ * - `.dryRun()` - Return the payload without executing (for debugging)
44
+ */
45
+ class ActionBuilder {
46
+ constructor(provider, moduleName, entityName, payload, clearPendingLinks) {
47
+ this._provider = provider;
48
+ this._moduleName = moduleName;
49
+ this._entityName = entityName;
50
+ this._payload = payload;
51
+ this._clearPendingLinks = clearPendingLinks;
52
+ }
53
+ /**
54
+ * Set an external system identifier for this record.
55
+ * Links the record to a corresponding entry in an external application.
56
+ *
57
+ * @param externalId - The ID in the external system
58
+ * @param externalAppId - The external application identifier
59
+ * @returns this (for chaining)
60
+ *
61
+ * @example
62
+ * ```typescript
63
+ * await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
64
+ * ```
65
+ */
66
+ withExternalId(externalId, externalAppId) {
67
+ this._payload.externalId = externalId;
68
+ this._payload.externalAppId = externalAppId;
69
+ return this;
70
+ }
71
+ /**
72
+ * Set security/access groups for this record.
73
+ * Controls which user groups can access the record.
74
+ *
75
+ * @param groups - Array of group names
76
+ * @returns this (for chaining)
77
+ *
78
+ * @example
79
+ * ```typescript
80
+ * await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
81
+ * ```
82
+ */
83
+ withGroups(groups) {
84
+ this._payload.groups = groups;
85
+ return this;
86
+ }
87
+ /**
88
+ * Execute the action
89
+ * @returns The result from the API
90
+ */
91
+ execute() {
92
+ return __awaiter(this, void 0, void 0, function* () {
93
+ const result = yield this._provider._applyAction(this._moduleName, this._entityName, this._payload);
94
+ this._clearPendingLinks();
95
+ return result;
96
+ });
97
+ }
98
+ /**
99
+ * Returns the request payload without executing (for debugging)
100
+ * @returns The request payload that would be sent to the API
101
+ */
102
+ dryRun() {
103
+ return this._payload;
104
+ }
105
+ /**
106
+ * Prevents accidental `await actionBuilder` without .execute()
107
+ * Forces developers to explicitly call .execute()
108
+ * @throws Error always - use .execute() or .dryRun() instead
109
+ */
110
+ then() {
111
+ throw new Error('ActionBuilder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
112
+ }
113
+ }
114
+ class PgReportEventRecord {
115
+ /**
116
+ * Create a record wrapper.
117
+ * @param record - The underlying record, or null for create operations
118
+ * @param provider - The API or DB provider
119
+ * @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
120
+ */
121
+ constructor(record, provider, preGeneratedId) {
122
+ this._pendingLinks = [];
123
+ this._record = record;
124
+ this._provider = provider;
125
+ this._preGeneratedId = preGeneratedId !== null && preGeneratedId !== void 0 ? preGeneratedId : (0, uuid_1.v4)();
126
+ }
127
+ // ============================================
128
+ // CORE PROPERTIES
129
+ // ============================================
130
+ /** Returns true if this is a new (unsaved) record */
131
+ get isNew() { var _a; return !((_a = this._record) === null || _a === void 0 ? void 0 : _a.id); }
132
+ /** Record ID - always available (pre-generated for new records) */
133
+ 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; }
134
+ get entity() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.entity) !== null && _b !== void 0 ? _b : 'BillingModule:PgReportEvent'; }
135
+ get type() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.type; }
136
+ /** Record properties - empty object for new (unsaved) records */
137
+ get properties() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.properties) || {}; }
138
+ get title() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.title; }
139
+ get recordNumber() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.recordNumber; }
140
+ get stage() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.stage; }
141
+ get createdAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.createdAt; }
142
+ get updatedAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.updatedAt; }
143
+ get externalId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalId; }
144
+ get externalAppId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalAppId; }
145
+ get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
146
+ /** Access the underlying OdinRecord (null for new records) */
147
+ get record() { return this._record; }
148
+ // ============================================
149
+ // TYPE GUARDS (with TypeScript type predicates)
150
+ // ============================================
151
+ /**
152
+ * Type guard: check if this record is of type DEFAULT
153
+ *
154
+ * When this returns true, TypeScript automatically narrows the type,
155
+ * giving you access to DEFAULT-specific properties.
156
+ *
157
+ * @example
158
+ * ```typescript
159
+ * if (record.isDefault()) {
160
+ * // TypeScript knows record.properties is PgReportEventProperties
161
+ * console.log(record.properties.SomeTypeSpecificField);
162
+ * }
163
+ * ```
164
+ * @remarks This is the default record type
165
+ */
166
+ isDefault() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.type) === 'DEFAULT'; }
167
+ /**
168
+ * Access linked PgDirectDebitFile records
169
+ * @remarks Available labels: PgDirectDebitFile__PgReportEvent
170
+ * @throws Error if called on a new (unsaved) record
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * // Get all linked PgDirectDebitFile records
175
+ * const items = await record.pgDirectDebitFiles.list();
176
+ * const first = await record.pgDirectDebitFiles.first();
177
+ *
178
+ * // Filter by label
179
+ * const specific = await record.pgDirectDebitFiles.first({ label: 'PgDirectDebitFile__PgReportEvent' });
180
+ * ```
181
+ */
182
+ get pgDirectDebitFiles() {
183
+ var _a;
184
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
185
+ throw new Error('Cannot access links on a new (unsaved) record');
186
+ if (!this._pgDirectDebitFiles) {
187
+ this._pgDirectDebitFiles = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
188
+ sourceEntity: 'BillingModule:PgReportEvent',
189
+ targetEntity: 'BillingModule:PgDirectDebitFile',
190
+ targetModuleName: 'BillingModule',
191
+ targetEntityName: 'PgDirectDebitFile',
192
+ labels: ['PgDirectDebitFile__PgReportEvent'],
193
+ }, PgDirectDebitFileRecord_1.PgDirectDebitFileRecord);
194
+ }
195
+ return this._pgDirectDebitFiles;
196
+ }
197
+ /**
198
+ * Access linked PgPaymentMethod records
199
+ * @remarks Available labels: PgPaymentMethod__PgReportEvent
200
+ * @throws Error if called on a new (unsaved) record
201
+ *
202
+ * @example
203
+ * ```typescript
204
+ * // Get all linked PgPaymentMethod records
205
+ * const items = await record.pgPaymentMethods.list();
206
+ * const first = await record.pgPaymentMethods.first();
207
+ *
208
+ * // Filter by label
209
+ * const specific = await record.pgPaymentMethods.first({ label: 'PgPaymentMethod__PgReportEvent' });
210
+ * ```
211
+ */
212
+ get pgPaymentMethods() {
213
+ var _a;
214
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
215
+ throw new Error('Cannot access links on a new (unsaved) record');
216
+ if (!this._pgPaymentMethods) {
217
+ this._pgPaymentMethods = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
218
+ sourceEntity: 'BillingModule:PgReportEvent',
219
+ targetEntity: 'BillingModule:PgPaymentMethod',
220
+ targetModuleName: 'BillingModule',
221
+ targetEntityName: 'PgPaymentMethod',
222
+ labels: ['PgPaymentMethod__PgReportEvent'],
223
+ }, PgPaymentMethodRecord_1.PgPaymentMethodRecord);
224
+ }
225
+ return this._pgPaymentMethods;
226
+ }
227
+ /**
228
+ * Access linked PgTransaction records
229
+ * @remarks Available labels: PgTransaction__PgReportEvent
230
+ * @throws Error if called on a new (unsaved) record
231
+ *
232
+ * @example
233
+ * ```typescript
234
+ * // Get all linked PgTransaction records
235
+ * const items = await record.pgTransactions.list();
236
+ * const first = await record.pgTransactions.first();
237
+ *
238
+ * // Filter by label
239
+ * const specific = await record.pgTransactions.first({ label: 'PgTransaction__PgReportEvent' });
240
+ * ```
241
+ */
242
+ get pgTransactions() {
243
+ var _a;
244
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
245
+ throw new Error('Cannot access links on a new (unsaved) record');
246
+ if (!this._pgTransactions) {
247
+ this._pgTransactions = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
248
+ sourceEntity: 'BillingModule:PgReportEvent',
249
+ targetEntity: 'BillingModule:PgTransaction',
250
+ targetModuleName: 'BillingModule',
251
+ targetEntityName: 'PgTransaction',
252
+ labels: ['PgTransaction__PgReportEvent'],
253
+ }, PgTransactionRecord_1.PgTransactionRecord);
254
+ }
255
+ return this._pgTransactions;
256
+ }
257
+ // ============================================
258
+ // LINK MANAGEMENT
259
+ // ============================================
260
+ /**
261
+ * Queue a link to be created with the next action.
262
+ * Works for both create and update actions.
263
+ * @returns this (for chaining)
264
+ */
265
+ link(target) {
266
+ this._pendingLinks.push(new core_1.OdinRecordLinkDto({ id: target.id, entity: target.entity }));
267
+ return this;
268
+ }
269
+ /** Get the currently queued links */
270
+ get pendingLinks() {
271
+ return [...this._pendingLinks];
272
+ }
273
+ /** Clear pending links without executing an action */
274
+ clearPendingLinks() {
275
+ this._pendingLinks = [];
276
+ return this;
277
+ }
278
+ /**
279
+ * Immediately unlink a record (API call).
280
+ * Unlike link(), this executes immediately.
281
+ * @throws Error if called on a new (unsaved) record
282
+ */
283
+ unlink(target) {
284
+ var _a;
285
+ return __awaiter(this, void 0, void 0, function* () {
286
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
287
+ throw new Error('Cannot unlink from a new (unsaved) record');
288
+ const targetId = typeof target === 'string' ? target : target.id;
289
+ yield this._provider._deleteLinks('BillingModule', 'PgReportEvent', this._record.id, targetId);
290
+ });
291
+ }
292
+ // ============================================
293
+ // CREATE ACTIONS (no existing record required)
294
+ // ============================================
295
+ /**
296
+ * CreatePgReportEvent
297
+ *
298
+ * Creates a new PgReportEvent record with the specified properties.
299
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
300
+ *
301
+ * @remarks Record type: DEFAULT
302
+ *
303
+ * @param properties - The properties for the new record
304
+ * @param options - Optional settings
305
+ * @param options.journeyId - Associate with a journey
306
+ * @param options.stageKey - Set initial pipeline stage
307
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
308
+ *
309
+ * @example
310
+ * ```typescript
311
+ * // Create with properties
312
+ * const record = odinClient.pgReportEvents.new();
313
+ * await record.createPgReportEvent({ ... }).execute();
314
+ *
315
+ * // Dry run (for debugging)
316
+ * const payload = record.createPgReportEvent({ ... }).dryRun();
317
+ * ```
318
+ */
319
+ createPgReportEvent(properties, options) {
320
+ const payload = {
321
+ entity: 'BillingModule:PgReportEvent',
322
+ type: 'DEFAULT',
323
+ actionName: 'CreatePgReportEvent',
324
+ properties: properties || {},
325
+ associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined,
326
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
327
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
328
+ };
329
+ return new ActionBuilder(this._provider, 'BillingModule', 'PgReportEvent', payload, () => { this._pendingLinks = []; });
330
+ }
331
+ // ============================================
332
+ // UPDATE ACTIONS (require existing record)
333
+ // ============================================
334
+ /**
335
+ * MovePgReportEventToFailed
336
+ *
337
+ * Transitions this PgReportEvent record to a new pipeline stage.
338
+ * Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
339
+ *
340
+ * @remarks Transitions to stage: EventStatusStageFailed
341
+ *
342
+ * @param options - Optional settings
343
+ * @param options.journeyId - Associate with a journey
344
+ * @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
345
+ * @throws Error if called on a new (unsaved) record
346
+ *
347
+ * @example
348
+ * ```typescript
349
+ * const record = await odinClient.pgReportEvents.get(id);
350
+ * await record.movePgReportEventToFailed().execute();
351
+ *
352
+ * // Dry run (for debugging)
353
+ * const payload = record.movePgReportEventToFailed().dryRun();
354
+ * ```
355
+ */
356
+ movePgReportEventToFailed(options) {
357
+ var _a;
358
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
359
+ throw new Error('movePgReportEventToFailed requires an existing record. Use accessor.get() first.');
360
+ const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MovePgReportEventToFailed', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'EventStatusStageFailed' }, options);
361
+ return new ActionBuilder(this._provider, 'BillingModule', 'PgReportEvent', payload, () => { this._pendingLinks = []; });
362
+ }
363
+ /**
364
+ * MovePgReportEventToSkipped
365
+ *
366
+ * Transitions this PgReportEvent record to a new pipeline stage.
367
+ * Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
368
+ *
369
+ * @remarks Transitions to stage: EventStatusStageSkipped
370
+ *
371
+ * @param options - Optional settings
372
+ * @param options.journeyId - Associate with a journey
373
+ * @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
374
+ * @throws Error if called on a new (unsaved) record
375
+ *
376
+ * @example
377
+ * ```typescript
378
+ * const record = await odinClient.pgReportEvents.get(id);
379
+ * await record.movePgReportEventToSkipped().execute();
380
+ *
381
+ * // Dry run (for debugging)
382
+ * const payload = record.movePgReportEventToSkipped().dryRun();
383
+ * ```
384
+ */
385
+ movePgReportEventToSkipped(options) {
386
+ var _a;
387
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
388
+ throw new Error('movePgReportEventToSkipped requires an existing record. Use accessor.get() first.');
389
+ const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MovePgReportEventToSkipped', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'EventStatusStageSkipped' }, options);
390
+ return new ActionBuilder(this._provider, 'BillingModule', 'PgReportEvent', payload, () => { this._pendingLinks = []; });
391
+ }
392
+ /**
393
+ * MovePgReportEventToSucceeded
394
+ *
395
+ * Transitions this PgReportEvent record to a new pipeline stage.
396
+ * Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
397
+ *
398
+ * @remarks Transitions to stage: EventStatusStageSucceeded
399
+ *
400
+ * @param options - Optional settings
401
+ * @param options.journeyId - Associate with a journey
402
+ * @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
403
+ * @throws Error if called on a new (unsaved) record
404
+ *
405
+ * @example
406
+ * ```typescript
407
+ * const record = await odinClient.pgReportEvents.get(id);
408
+ * await record.movePgReportEventToSucceeded().execute();
409
+ *
410
+ * // Dry run (for debugging)
411
+ * const payload = record.movePgReportEventToSucceeded().dryRun();
412
+ * ```
413
+ */
414
+ movePgReportEventToSucceeded(options) {
415
+ var _a;
416
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
417
+ throw new Error('movePgReportEventToSucceeded requires an existing record. Use accessor.get() first.');
418
+ const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'MovePgReportEventToSucceeded', associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined, stageKey: 'EventStatusStageSucceeded' }, options);
419
+ return new ActionBuilder(this._provider, 'BillingModule', 'PgReportEvent', payload, () => { this._pendingLinks = []; });
420
+ }
421
+ /**
422
+ * UpdatePgReportEvent
423
+ *
424
+ * Updates this PgReportEvent record with the specified properties.
425
+ * Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
426
+ *
427
+ * @param properties - Required properties for this action
428
+ * @param options - Optional settings
429
+ * @param options.journeyId - Associate with a journey
430
+ * @param options.stageKey - Transition to pipeline stage
431
+ * @returns ActionBuilder - call .execute() to update or .dryRun() for payload
432
+ * @throws Error if called on a new (unsaved) record
433
+ *
434
+ * @example
435
+ * ```typescript
436
+ * const record = await odinClient.pgReportEvents.get(id);
437
+ * await record.updatePgReportEvent({ ... }).execute();
438
+ *
439
+ * // Dry run (for debugging)
440
+ * const payload = record.updatePgReportEvent({ ... }).dryRun();
441
+ * ```
442
+ */
443
+ updatePgReportEvent(properties, options) {
444
+ var _a;
445
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
446
+ throw new Error('updatePgReportEvent requires an existing record. Use accessor.get() first.');
447
+ const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'UpdatePgReportEvent', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, options);
448
+ return new ActionBuilder(this._provider, 'BillingModule', 'PgReportEvent', payload, () => { this._pendingLinks = []; });
449
+ }
450
+ }
451
+ exports.PgReportEventRecord = PgReportEventRecord;
452
+ // ============================================
453
+ // TYPED LINK ACCESSORS
454
+ // ============================================
455
+ /** Valid labels for PgDirectDebitFile associations */
456
+ PgReportEventRecord.pgDirectDebitFilesLabels = ['PgDirectDebitFile__PgReportEvent'];
457
+ /** Valid labels for PgPaymentMethod associations */
458
+ PgReportEventRecord.pgPaymentMethodsLabels = ['PgPaymentMethod__PgReportEvent'];
459
+ /** Valid labels for PgTransaction associations */
460
+ PgReportEventRecord.pgTransactionsLabels = ['PgTransaction__PgReportEvent'];
461
+ /** Type guard to check if an object is a PgReportEventRecord */
462
+ function isPgReportEventRecord(obj) {
463
+ return obj instanceof PgReportEventRecord;
464
+ }
465
+ exports.isPgReportEventRecord = isPgReportEventRecord;
@@ -34,6 +34,7 @@ import { PgWebhookRecord } from './PgWebhookRecord';
34
34
  import { PgPaymentMethodRecord } from './PgPaymentMethodRecord';
35
35
  import { PgDisputeRecord } from './PgDisputeRecord';
36
36
  import { PgFileAllocationRecord } from './PgFileAllocationRecord';
37
+ import { PgReportEventRecord } from './PgReportEventRecord';
37
38
  /** Valid entity types for PgTransaction */
38
39
  export declare type PgTransactionType = 'CHARGE' | 'DEFAULT' | 'REFUND';
39
40
  /**
@@ -103,6 +104,7 @@ export declare class PgTransactionRecord<TProps = PgTransactionProperties> {
103
104
  private _pgPaymentMethods?;
104
105
  private _pgDisputes?;
105
106
  private _pgFileAllocations?;
107
+ private _pgReportEvents?;
106
108
  /**
107
109
  * Create a record wrapper.
108
110
  * @param record - The underlying record, or null for create operations
@@ -248,6 +250,24 @@ export declare class PgTransactionRecord<TProps = PgTransactionProperties> {
248
250
  * ```
249
251
  */
250
252
  get pgFileAllocations(): RecordLinkManager<PgFileAllocationRecord, typeof PgTransactionRecord['pgFileAllocationsLabels'][number]>;
253
+ /** Valid labels for PgReportEvent associations */
254
+ static readonly pgReportEventsLabels: readonly ["PgTransaction__PgReportEvent"];
255
+ /**
256
+ * Access linked PgReportEvent records
257
+ * @remarks Available labels: PgTransaction__PgReportEvent
258
+ * @throws Error if called on a new (unsaved) record
259
+ *
260
+ * @example
261
+ * ```typescript
262
+ * // Get all linked PgReportEvent records
263
+ * const items = await record.pgReportEvents.list();
264
+ * const first = await record.pgReportEvents.first();
265
+ *
266
+ * // Filter by label
267
+ * const specific = await record.pgReportEvents.first({ label: 'PgTransaction__PgReportEvent' });
268
+ * ```
269
+ */
270
+ get pgReportEvents(): RecordLinkManager<PgReportEventRecord, typeof PgTransactionRecord['pgReportEventsLabels'][number]>;
251
271
  /**
252
272
  * Queue a link to be created with the next action.
253
273
  * Works for both create and update actions.
@@ -36,6 +36,7 @@ const PgWebhookRecord_1 = require("./PgWebhookRecord");
36
36
  const PgPaymentMethodRecord_1 = require("./PgPaymentMethodRecord");
37
37
  const PgDisputeRecord_1 = require("./PgDisputeRecord");
38
38
  const PgFileAllocationRecord_1 = require("./PgFileAllocationRecord");
39
+ const PgReportEventRecord_1 = require("./PgReportEventRecord");
39
40
  /**
40
41
  * Builder for action execution with dryRun support
41
42
  *
@@ -317,6 +318,36 @@ class PgTransactionRecord {
317
318
  }
318
319
  return this._pgFileAllocations;
319
320
  }
321
+ /**
322
+ * Access linked PgReportEvent records
323
+ * @remarks Available labels: PgTransaction__PgReportEvent
324
+ * @throws Error if called on a new (unsaved) record
325
+ *
326
+ * @example
327
+ * ```typescript
328
+ * // Get all linked PgReportEvent records
329
+ * const items = await record.pgReportEvents.list();
330
+ * const first = await record.pgReportEvents.first();
331
+ *
332
+ * // Filter by label
333
+ * const specific = await record.pgReportEvents.first({ label: 'PgTransaction__PgReportEvent' });
334
+ * ```
335
+ */
336
+ get pgReportEvents() {
337
+ var _a;
338
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
339
+ throw new Error('Cannot access links on a new (unsaved) record');
340
+ if (!this._pgReportEvents) {
341
+ this._pgReportEvents = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
342
+ sourceEntity: 'BillingModule:PgTransaction',
343
+ targetEntity: 'BillingModule:PgReportEvent',
344
+ targetModuleName: 'BillingModule',
345
+ targetEntityName: 'PgReportEvent',
346
+ labels: ['PgTransaction__PgReportEvent'],
347
+ }, PgReportEventRecord_1.PgReportEventRecord);
348
+ }
349
+ return this._pgReportEvents;
350
+ }
320
351
  // ============================================
321
352
  // LINK MANAGEMENT
322
353
  // ============================================
@@ -1387,6 +1418,8 @@ PgTransactionRecord.pgPaymentMethodsLabels = ['PgPaymentMethod__PgTransaction'];
1387
1418
  PgTransactionRecord.pgDisputesLabels = ['PgTransaction__PgDispute'];
1388
1419
  /** Valid labels for PgFileAllocation associations */
1389
1420
  PgTransactionRecord.pgFileAllocationsLabels = ['PgTransaction__PgFileAllocation'];
1421
+ /** Valid labels for PgReportEvent associations */
1422
+ PgTransactionRecord.pgReportEventsLabels = ['PgTransaction__PgReportEvent'];
1390
1423
  /** Type guard to check if an object is a PgTransactionRecord */
1391
1424
  function isPgTransactionRecord(obj) {
1392
1425
  return obj instanceof PgTransactionRecord;
@@ -80,6 +80,7 @@ export { PgContactRecord, isPgContactRecord } from './PgContactRecord';
80
80
  export { PgDisputeRecord, isPgDisputeRecord } from './PgDisputeRecord';
81
81
  export { PgLogRecord, isPgLogRecord } from './PgLogRecord';
82
82
  export { PgPaymentMethodRecord, isPgPaymentMethodRecord } from './PgPaymentMethodRecord';
83
+ export { PgReportEventRecord, isPgReportEventRecord } from './PgReportEventRecord';
83
84
  export { PgDirectDebitFileRecord, isPgDirectDebitFileRecord } from './PgDirectDebitFileRecord';
84
85
  export { PgVocalinkRecord, isPgVocalinkRecord } from './PgVocalinkRecord';
85
86
  export { PgSortCodeSubstitutionRecord, isPgSortCodeSubstitutionRecord } from './PgSortCodeSubstitutionRecord';
@@ -13,9 +13,9 @@
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.isYfFieldServiceVisitRecord = exports.YfFieldServiceVisitRecord = exports.isRemediationOutcomeFormRecord = exports.RemediationOutcomeFormRecord = exports.isOhExternalAuditRecord = exports.OhExternalAuditRecord = exports.isUgExternalAuditRecord = exports.UgExternalAuditRecord = exports.isPaymentMethodRefundRecord = exports.PaymentMethodRefundRecord = exports.isConversationRecord = exports.ConversationRecord = exports.isOntReplacementApprovalRecord = exports.OntReplacementApprovalRecord = exports.isAccountRecord = exports.AccountRecord = exports.isPermissionToFailRecord = exports.PermissionToFailRecord = exports.isTransactionRecord = exports.TransactionRecord = exports.isPaymentRecord = exports.PaymentRecord = exports.isPICRequestRecord = exports.PICRequestRecord = exports.isChangeReasonRecord = exports.ChangeReasonRecord = exports.isChurnRequestRecord = exports.ChurnRequestRecord = exports.isBillingRequestRecord = exports.BillingRequestRecord = exports.isBillingAdjustmentRecord = exports.BillingAdjustmentRecord = exports.isServiceAppointmentConfigRecord = exports.ServiceAppointmentConfigRecord = exports.isCrmDatasetRecord = exports.CrmDatasetRecord = exports.isNoteRecord = exports.NoteRecord = exports.isContractBuyOutRecord = exports.ContractBuyOutRecord = exports.isCaseRecord = exports.CaseRecord = exports.isAddressInteractionRecord = exports.AddressInteractionRecord = exports.isAddressRecord = exports.AddressRecord = exports.isWorkOrderRecord = exports.WorkOrderRecord = exports.isOrderRecord = exports.OrderRecord = void 0;
15
15
  exports.isFieldServiceProductRecord = exports.FieldServiceProductRecord = exports.isFieldServiceDispatchedProductRecord = exports.FieldServiceDispatchedProductRecord = exports.isExchangeRecord = exports.ExchangeRecord = exports.isEmailTemplateRecord = exports.EmailTemplateRecord = exports.isEmailSenderRecord = exports.EmailSenderRecord = exports.isCustomerDeviceOntRecord = exports.CustomerDeviceOntRecord = exports.isCustomerDeviceConfigurationRecord = exports.CustomerDeviceConfigurationRecord = exports.isConversationSummaryFeedbackRecord = exports.ConversationSummaryFeedbackRecord = exports.isContactIdentityRecord = exports.ContactIdentityRecord = exports.isConfigRecord = exports.ConfigRecord = exports.isOrderKciRecord = exports.OrderKciRecord = exports.isEmailRecord = exports.EmailRecord = exports.isRewardRecord = exports.RewardRecord = exports.isContactRecord = exports.ContactRecord = exports.isCallRecord = exports.CallRecord = exports.isTwilioCallEventRecord = exports.TwilioCallEventRecord = exports.isProductRecord = exports.ProductRecord = exports.isBrskEntityMigrationErrorRecord = exports.BrskEntityMigrationErrorRecord = exports.isBngProvisionRecord = exports.BngProvisionRecord = exports.isPgFileAllocationRecord = exports.PgFileAllocationRecord = exports.isAppointmentRecord = exports.AppointmentRecord = exports.isCallLegRecord = exports.CallLegRecord = exports.isAffiliateCodeRecord = exports.AffiliateCodeRecord = exports.isActivityLogRecord = exports.ActivityLogRecord = exports.isAccountCreditRecord = exports.AccountCreditRecord = void 0;
16
- exports.isPgTransactionRecord = exports.PgTransactionRecord = exports.isPgSortCodeSubstitutionRecord = exports.PgSortCodeSubstitutionRecord = exports.isPgVocalinkRecord = exports.PgVocalinkRecord = exports.isPgDirectDebitFileRecord = exports.PgDirectDebitFileRecord = exports.isPgPaymentMethodRecord = exports.PgPaymentMethodRecord = exports.isPgLogRecord = exports.PgLogRecord = exports.isPgDisputeRecord = exports.PgDisputeRecord = exports.isPgContactRecord = exports.PgContactRecord = exports.isPaymentMethodRecord = exports.PaymentMethodRecord = exports.isSmsMessageRecord = exports.SmsMessageRecord = exports.isOutboundDialSessionRecord = exports.OutboundDialSessionRecord = exports.isOutboundDialCampaignRecord = exports.OutboundDialCampaignRecord = exports.isReferralRecord = exports.ReferralRecord = exports.isOrderCheckRecord = exports.OrderCheckRecord = exports.isCampaignRecord = exports.CampaignRecord = exports.isOneTouchSwitchRecord = exports.OneTouchSwitchRecord = exports.isOfferTemplateRecord = exports.OfferTemplateRecord = exports.isReturnsRecord = exports.ReturnsRecord = exports.isNetworkDeviceRecord = exports.NetworkDeviceRecord = exports.isMessageRecord = exports.MessageRecord = exports.isLeadRecord = exports.LeadRecord = exports.isInvoiceItemRecord = exports.InvoiceItemRecord = exports.isImpersonationTrackerRecord = exports.ImpersonationTrackerRecord = exports.isActivityRecord = exports.ActivityRecord = exports.isFileRecord = exports.FileRecord = void 0;
17
- exports.isRemediationRequiredReasonRecord = exports.RemediationRequiredReasonRecord = exports.isKnowledgeArticleRecord = exports.KnowledgeArticleRecord = exports.isInvoiceRecord = exports.InvoiceRecord = exports.isDiscountRecord = exports.DiscountRecord = exports.isCustomerDeviceRouterRecord = exports.CustomerDeviceRouterRecord = exports.isCustomerDeviceAtaRecord = exports.CustomerDeviceAtaRecord = exports.isCreditNoteRecord = exports.CreditNoteRecord = exports.isOutboundDialCampaignCaseRecord = exports.OutboundDialCampaignCaseRecord = exports.isWorkOrderStatusUpdateRecord = exports.WorkOrderStatusUpdateRecord = exports.isWayleaveAuditRecord = exports.WayleaveAuditRecord = exports.isUserRecord = exports.UserRecord = exports.isTwilioWorkerRecord = exports.TwilioWorkerRecord = exports.isTwilioUserUpdateRecord = exports.TwilioUserUpdateRecord = exports.isTwilioTaskQueueRecord = exports.TwilioTaskQueueRecord = exports.isTwilioActivityRecord = exports.TwilioActivityRecord = exports.isTimeSlotRecord = exports.TimeSlotRecord = exports.isTeamRecord = exports.TeamRecord = exports.isSalesTerritoryRecord = exports.SalesTerritoryRecord = exports.isRegionRecord = exports.RegionRecord = exports.isVoiceConfigurationRecord = exports.VoiceConfigurationRecord = exports.isOrderItemRecord = exports.OrderItemRecord = exports.isPushNotificationRecord = exports.PushNotificationRecord = exports.isPgWebhookRecord = exports.PgWebhookRecord = exports.isPgWebhookAttemptRecord = exports.PgWebhookAttemptRecord = exports.isPgAccountValidationRecord = exports.PgAccountValidationRecord = void 0;
18
- exports.isCustomerPhonePortingRecord = exports.CustomerPhonePortingRecord = exports.isVisitRecord = exports.VisitRecord = exports.isServiceRecord = exports.ServiceRecord = exports.isScheduleSlotRecord = exports.ScheduleSlotRecord = exports.isPriceBookRecord = exports.PriceBookRecord = exports.isOverlayRealA55Record = exports.OverlayRealA55Record = exports.isOfferRecord = exports.OfferRecord = exports.isServiceAppointmentRecord = exports.ServiceAppointmentRecord = exports.isOutageRecord = exports.OutageRecord = exports.isSiteSpecificRiskAssessmentOutcomeFormRecord = exports.SiteSpecificRiskAssessmentOutcomeFormRecord = void 0;
16
+ exports.isPgSortCodeSubstitutionRecord = exports.PgSortCodeSubstitutionRecord = exports.isPgVocalinkRecord = exports.PgVocalinkRecord = exports.isPgDirectDebitFileRecord = exports.PgDirectDebitFileRecord = exports.isPgReportEventRecord = exports.PgReportEventRecord = exports.isPgPaymentMethodRecord = exports.PgPaymentMethodRecord = exports.isPgLogRecord = exports.PgLogRecord = exports.isPgDisputeRecord = exports.PgDisputeRecord = exports.isPgContactRecord = exports.PgContactRecord = exports.isPaymentMethodRecord = exports.PaymentMethodRecord = exports.isSmsMessageRecord = exports.SmsMessageRecord = exports.isOutboundDialSessionRecord = exports.OutboundDialSessionRecord = exports.isOutboundDialCampaignRecord = exports.OutboundDialCampaignRecord = exports.isReferralRecord = exports.ReferralRecord = exports.isOrderCheckRecord = exports.OrderCheckRecord = exports.isCampaignRecord = exports.CampaignRecord = exports.isOneTouchSwitchRecord = exports.OneTouchSwitchRecord = exports.isOfferTemplateRecord = exports.OfferTemplateRecord = exports.isReturnsRecord = exports.ReturnsRecord = exports.isNetworkDeviceRecord = exports.NetworkDeviceRecord = exports.isMessageRecord = exports.MessageRecord = exports.isLeadRecord = exports.LeadRecord = exports.isInvoiceItemRecord = exports.InvoiceItemRecord = exports.isImpersonationTrackerRecord = exports.ImpersonationTrackerRecord = exports.isActivityRecord = exports.ActivityRecord = exports.isFileRecord = exports.FileRecord = void 0;
17
+ exports.isKnowledgeArticleRecord = exports.KnowledgeArticleRecord = exports.isInvoiceRecord = exports.InvoiceRecord = exports.isDiscountRecord = exports.DiscountRecord = exports.isCustomerDeviceRouterRecord = exports.CustomerDeviceRouterRecord = exports.isCustomerDeviceAtaRecord = exports.CustomerDeviceAtaRecord = exports.isCreditNoteRecord = exports.CreditNoteRecord = exports.isOutboundDialCampaignCaseRecord = exports.OutboundDialCampaignCaseRecord = exports.isWorkOrderStatusUpdateRecord = exports.WorkOrderStatusUpdateRecord = exports.isWayleaveAuditRecord = exports.WayleaveAuditRecord = exports.isUserRecord = exports.UserRecord = exports.isTwilioWorkerRecord = exports.TwilioWorkerRecord = exports.isTwilioUserUpdateRecord = exports.TwilioUserUpdateRecord = exports.isTwilioTaskQueueRecord = exports.TwilioTaskQueueRecord = exports.isTwilioActivityRecord = exports.TwilioActivityRecord = exports.isTimeSlotRecord = exports.TimeSlotRecord = exports.isTeamRecord = exports.TeamRecord = exports.isSalesTerritoryRecord = exports.SalesTerritoryRecord = exports.isRegionRecord = exports.RegionRecord = exports.isVoiceConfigurationRecord = exports.VoiceConfigurationRecord = exports.isOrderItemRecord = exports.OrderItemRecord = exports.isPushNotificationRecord = exports.PushNotificationRecord = exports.isPgWebhookRecord = exports.PgWebhookRecord = exports.isPgWebhookAttemptRecord = exports.PgWebhookAttemptRecord = exports.isPgAccountValidationRecord = exports.PgAccountValidationRecord = exports.isPgTransactionRecord = exports.PgTransactionRecord = void 0;
18
+ exports.isCustomerPhonePortingRecord = exports.CustomerPhonePortingRecord = exports.isVisitRecord = exports.VisitRecord = exports.isServiceRecord = exports.ServiceRecord = exports.isScheduleSlotRecord = exports.ScheduleSlotRecord = exports.isPriceBookRecord = exports.PriceBookRecord = exports.isOverlayRealA55Record = exports.OverlayRealA55Record = exports.isOfferRecord = exports.OfferRecord = exports.isServiceAppointmentRecord = exports.ServiceAppointmentRecord = exports.isOutageRecord = exports.OutageRecord = exports.isSiteSpecificRiskAssessmentOutcomeFormRecord = exports.SiteSpecificRiskAssessmentOutcomeFormRecord = exports.isRemediationRequiredReasonRecord = exports.RemediationRequiredReasonRecord = void 0;
19
19
  var OrderRecord_1 = require("./OrderRecord");
20
20
  Object.defineProperty(exports, "OrderRecord", { enumerable: true, get: function () { return OrderRecord_1.OrderRecord; } });
21
21
  Object.defineProperty(exports, "isOrderRecord", { enumerable: true, get: function () { return OrderRecord_1.isOrderRecord; } });
@@ -229,6 +229,9 @@ Object.defineProperty(exports, "isPgLogRecord", { enumerable: true, get: functio
229
229
  var PgPaymentMethodRecord_1 = require("./PgPaymentMethodRecord");
230
230
  Object.defineProperty(exports, "PgPaymentMethodRecord", { enumerable: true, get: function () { return PgPaymentMethodRecord_1.PgPaymentMethodRecord; } });
231
231
  Object.defineProperty(exports, "isPgPaymentMethodRecord", { enumerable: true, get: function () { return PgPaymentMethodRecord_1.isPgPaymentMethodRecord; } });
232
+ var PgReportEventRecord_1 = require("./PgReportEventRecord");
233
+ Object.defineProperty(exports, "PgReportEventRecord", { enumerable: true, get: function () { return PgReportEventRecord_1.PgReportEventRecord; } });
234
+ Object.defineProperty(exports, "isPgReportEventRecord", { enumerable: true, get: function () { return PgReportEventRecord_1.isPgReportEventRecord; } });
232
235
  var PgDirectDebitFileRecord_1 = require("./PgDirectDebitFileRecord");
233
236
  Object.defineProperty(exports, "PgDirectDebitFileRecord", { enumerable: true, get: function () { return PgDirectDebitFileRecord_1.PgDirectDebitFileRecord; } });
234
237
  Object.defineProperty(exports, "isPgDirectDebitFileRecord", { enumerable: true, get: function () { return PgDirectDebitFileRecord_1.isPgDirectDebitFileRecord; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "2.0.229",
3
+ "version": "2.0.231",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",