@d19n/youfibre-odin-sdk 2.0.335 → 2.0.337

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 (79) hide show
  1. package/README.md +31 -2
  2. package/dist/EntityRegistry.d.ts +8 -0
  3. package/dist/EntityRegistry.js +8 -0
  4. package/dist/OdinApiClient.d.ts +16 -0
  5. package/dist/OdinApiClient.js +32 -0
  6. package/dist/OdinDbClient.d.ts +16 -0
  7. package/dist/OdinDbClient.js +32 -0
  8. package/dist/accessors-v2/QaAutoFailAccessor.d.ts +112 -0
  9. package/dist/accessors-v2/QaAutoFailAccessor.js +191 -0
  10. package/dist/accessors-v2/QaRubricAccessor.d.ts +112 -0
  11. package/dist/accessors-v2/QaRubricAccessor.js +191 -0
  12. package/dist/accessors-v2/QaRubricItemAccessor.d.ts +112 -0
  13. package/dist/accessors-v2/QaRubricItemAccessor.js +191 -0
  14. package/dist/accessors-v2/QaRubricSectionAccessor.d.ts +112 -0
  15. package/dist/accessors-v2/QaRubricSectionAccessor.js +191 -0
  16. package/dist/accessors-v2/index.d.ts +4 -0
  17. package/dist/accessors-v2/index.js +10 -2
  18. package/dist/actions-v2/CreateContactSalesAppDto.d.ts +2 -25
  19. package/dist/actions-v2/CreateInstallDayBeforeWifiEducationDto.d.ts +63 -0
  20. package/dist/actions-v2/CreateInstallDayBeforeWifiEducationDto.js +59 -0
  21. package/dist/actions-v2/CreateLeadSalesAppDto.d.ts +10 -2
  22. package/dist/actions-v2/CreateTransactionalEmailDto.d.ts +8 -1
  23. package/dist/actions-v2/UpdateQaAutoFailDto.d.ts +102 -0
  24. package/dist/actions-v2/UpdateQaAutoFailDto.js +56 -0
  25. package/dist/actions-v2/UpdateQaRubricDto.d.ts +103 -0
  26. package/dist/actions-v2/UpdateQaRubricDto.js +56 -0
  27. package/dist/actions-v2/UpdateQaRubricItemDto.d.ts +157 -0
  28. package/dist/actions-v2/UpdateQaRubricItemDto.js +56 -0
  29. package/dist/actions-v2/UpdateQaRubricSectionDto.d.ts +87 -0
  30. package/dist/actions-v2/UpdateQaRubricSectionDto.js +56 -0
  31. package/dist/api-sdk-v2/QaAutoFailApi.d.ts +48 -0
  32. package/dist/api-sdk-v2/QaAutoFailApi.js +155 -0
  33. package/dist/api-sdk-v2/QaRubricApi.d.ts +50 -0
  34. package/dist/api-sdk-v2/QaRubricApi.js +161 -0
  35. package/dist/api-sdk-v2/QaRubricItemApi.d.ts +48 -0
  36. package/dist/api-sdk-v2/QaRubricItemApi.js +155 -0
  37. package/dist/api-sdk-v2/QaRubricSectionApi.d.ts +50 -0
  38. package/dist/api-sdk-v2/QaRubricSectionApi.js +161 -0
  39. package/dist/db-accessors-v2/QaAutoFailDbAccessor.d.ts +180 -0
  40. package/dist/db-accessors-v2/QaAutoFailDbAccessor.js +265 -0
  41. package/dist/db-accessors-v2/QaRubricDbAccessor.d.ts +180 -0
  42. package/dist/db-accessors-v2/QaRubricDbAccessor.js +265 -0
  43. package/dist/db-accessors-v2/QaRubricItemDbAccessor.d.ts +180 -0
  44. package/dist/db-accessors-v2/QaRubricItemDbAccessor.js +265 -0
  45. package/dist/db-accessors-v2/QaRubricSectionDbAccessor.d.ts +180 -0
  46. package/dist/db-accessors-v2/QaRubricSectionDbAccessor.js +265 -0
  47. package/dist/db-accessors-v2/index.d.ts +4 -0
  48. package/dist/db-accessors-v2/index.js +10 -2
  49. package/dist/db-sdk-v2/QaAutoFailDb.d.ts +120 -0
  50. package/dist/db-sdk-v2/QaAutoFailDb.js +204 -0
  51. package/dist/db-sdk-v2/QaRubricDb.d.ts +122 -0
  52. package/dist/db-sdk-v2/QaRubricDb.js +210 -0
  53. package/dist/db-sdk-v2/QaRubricItemDb.d.ts +120 -0
  54. package/dist/db-sdk-v2/QaRubricItemDb.js +204 -0
  55. package/dist/db-sdk-v2/QaRubricSectionDb.d.ts +122 -0
  56. package/dist/db-sdk-v2/QaRubricSectionDb.js +210 -0
  57. package/dist/entities-v2/QaAutoFail.d.ts +117 -0
  58. package/dist/entities-v2/QaAutoFail.js +76 -0
  59. package/dist/entities-v2/QaReport.d.ts +41 -1
  60. package/dist/entities-v2/QaReport.js +10 -0
  61. package/dist/entities-v2/QaRubric.d.ts +152 -0
  62. package/dist/entities-v2/QaRubric.js +114 -0
  63. package/dist/entities-v2/QaRubricItem.d.ts +199 -0
  64. package/dist/entities-v2/QaRubricItem.js +110 -0
  65. package/dist/entities-v2/QaRubricSection.d.ts +108 -0
  66. package/dist/entities-v2/QaRubricSection.js +76 -0
  67. package/dist/records-v2/EmailRecord.d.ts +29 -0
  68. package/dist/records-v2/EmailRecord.js +36 -0
  69. package/dist/records-v2/QaAutoFailRecord.d.ts +205 -0
  70. package/dist/records-v2/QaAutoFailRecord.js +275 -0
  71. package/dist/records-v2/QaRubricItemRecord.d.ts +205 -0
  72. package/dist/records-v2/QaRubricItemRecord.js +275 -0
  73. package/dist/records-v2/QaRubricRecord.d.ts +225 -0
  74. package/dist/records-v2/QaRubricRecord.js +308 -0
  75. package/dist/records-v2/QaRubricSectionRecord.d.ts +225 -0
  76. package/dist/records-v2/QaRubricSectionRecord.js +308 -0
  77. package/dist/records-v2/index.d.ts +4 -0
  78. package/dist/records-v2/index.js +13 -1
  79. package/package.json +1 -1
@@ -0,0 +1,76 @@
1
+ "use strict";
2
+ /**
3
+ * QaRubricSection Entity Definition
4
+ *
5
+ * A weighted section within a QaRubric (e.g. Behavioural 55%). Groups the items that make it up.
6
+ *
7
+ * @module SupportModule
8
+ * @entity QaRubricSection
9
+ * @schemaId 880a4a28-6b84-4827-8367-1b368692387a
10
+ *
11
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
12
+ * Generated from Odin schema definition
13
+ */
14
+ Object.defineProperty(exports, "__esModule", { value: true });
15
+ exports.ROUTING_KEY_LINK_SECTION_ITEM_DELETED = exports.ROUTING_KEY_LINK_SECTION_ITEM_CREATED = exports.ROUTING_KEY_QA_RUBRIC_SECTION_DEFAULT_DELETED = exports.ROUTING_KEY_QA_RUBRIC_SECTION_DEFAULT_UPDATED = exports.ROUTING_KEY_QA_RUBRIC_SECTION_DEFAULT_CREATED = exports.ROUTING_KEY_QA_RUBRIC_SECTION_DELETED = exports.ROUTING_KEY_QA_RUBRIC_SECTION_UPDATED = exports.ROUTING_KEY_QA_RUBRIC_SECTION_CREATED = exports.QaRubricSection = exports.QaRubricSectionPropertyKeys = exports.QaRubricSectionEntityTypes = void 0;
16
+ const core_1 = require("@d19n/odin-types/dist/core");
17
+ /**
18
+ * Available types for QaRubricSection records
19
+ */
20
+ var QaRubricSectionEntityTypes;
21
+ (function (QaRubricSectionEntityTypes) {
22
+ /** This is the default record type */
23
+ QaRubricSectionEntityTypes["DEFAULT"] = "DEFAULT";
24
+ })(QaRubricSectionEntityTypes = exports.QaRubricSectionEntityTypes || (exports.QaRubricSectionEntityTypes = {}));
25
+ /**
26
+ * Property keys for QaRubricSection
27
+ * Use these constants instead of string literals for type safety
28
+ */
29
+ var QaRubricSectionPropertyKeys;
30
+ (function (QaRubricSectionPropertyKeys) {
31
+ /** The rubric this section belongs to. */
32
+ QaRubricSectionPropertyKeys["RubricId"] = "RubricId";
33
+ /** Section name, e.g. Ticket Identity, Behavioural, Call Handling. */
34
+ QaRubricSectionPropertyKeys["Name"] = "Name";
35
+ /** The section total as a percentage of the 100-point score (e.g. Behavioural 55). */
36
+ QaRubricSectionPropertyKeys["Weight"] = "Weight";
37
+ /** Display order of the section within the rubric. */
38
+ QaRubricSectionPropertyKeys["Position"] = "Position";
39
+ })(QaRubricSectionPropertyKeys = exports.QaRubricSectionPropertyKeys || (exports.QaRubricSectionPropertyKeys = {}));
40
+ /**
41
+ * QaRubricSection entity from SupportModule
42
+ *
43
+ * A weighted section within a QaRubric (e.g. Behavioural 55%). Groups the items that make it up.
44
+ *
45
+ * @module SupportModule
46
+ * @entity QaRubricSection
47
+ * @schemaId 880a4a28-6b84-4827-8367-1b368692387a
48
+ * @recordPrefix QRS
49
+ * @capabilities searchable, updateable, undeletable, triggerable
50
+ */
51
+ class QaRubricSection extends core_1.OdinRecord {
52
+ }
53
+ exports.QaRubricSection = QaRubricSection;
54
+ // ============================================
55
+ // RABBITMQ EVENT ROUTING KEYS
56
+ // ============================================
57
+ /**
58
+ * RabbitMQ routing keys for QaRubricSection events
59
+ */
60
+ exports.ROUTING_KEY_QA_RUBRIC_SECTION_CREATED = 'SupportModule.QaRubricSection.SubDbRecordCreated';
61
+ exports.ROUTING_KEY_QA_RUBRIC_SECTION_UPDATED = 'SupportModule.QaRubricSection.SubDbRecordUpdated';
62
+ exports.ROUTING_KEY_QA_RUBRIC_SECTION_DELETED = 'SupportModule.QaRubricSection.SubDbRecordDeleted';
63
+ /**
64
+ * Type-specific routing keys for QaRubricSection events
65
+ * Subscribe to these for events on specific entity types only
66
+ */
67
+ /** This is the default record type created */
68
+ exports.ROUTING_KEY_QA_RUBRIC_SECTION_DEFAULT_CREATED = 'SupportModule.QaRubricSection.DEFAULT.SubDbRecordCreated';
69
+ /** This is the default record type updated */
70
+ exports.ROUTING_KEY_QA_RUBRIC_SECTION_DEFAULT_UPDATED = 'SupportModule.QaRubricSection.DEFAULT.SubDbRecordUpdated';
71
+ /** This is the default record type deleted */
72
+ exports.ROUTING_KEY_QA_RUBRIC_SECTION_DEFAULT_DELETED = 'SupportModule.QaRubricSection.DEFAULT.SubDbRecordDeleted';
73
+ /** Event: Section__Item link created */
74
+ exports.ROUTING_KEY_LINK_SECTION_ITEM_CREATED = 'SupportModule.QaRubricSection.QaRubricItem.SubDbRecordAssociationCreated';
75
+ /** Event: Section__Item link deleted */
76
+ exports.ROUTING_KEY_LINK_SECTION_ITEM_DELETED = 'SupportModule.QaRubricSection.QaRubricItem.SubDbRecordAssociationDeleted';
@@ -47,6 +47,7 @@ import { CreateCboEmailProperties } from '../actions-v2/CreateCboEmailDto';
47
47
  import { CreateFailedInvoicePaymentProperties } from '../actions-v2/CreateFailedInvoicePaymentDto';
48
48
  import { CreateGenericRemediationRequiredProperties } from '../actions-v2/CreateGenericRemediationRequiredDto';
49
49
  import { CreateInboundSupportEmailProperties } from '../actions-v2/CreateInboundSupportEmailDto';
50
+ import { CreateInstallDayBeforeWifiEducationProperties } from '../actions-v2/CreateInstallDayBeforeWifiEducationDto';
50
51
  import { CreateNewCreditNoteProperties } from '../actions-v2/CreateNewCreditNoteDto';
51
52
  import { CreateNewInvoiceProperties } from '../actions-v2/CreateNewInvoiceDto';
52
53
  import { CreateOrderConfirmationProperties } from '../actions-v2/CreateOrderConfirmationDto';
@@ -1095,6 +1096,34 @@ export declare class EmailRecord<TProps = EmailProperties> {
1095
1096
  journeyId?: string;
1096
1097
  stageKey?: string;
1097
1098
  }): ActionBuilder;
1099
+ /**
1100
+ * CreateInstallDayBeforeWifiEducation
1101
+ *
1102
+ * Creates a new Email record with the specified properties.
1103
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
1104
+ *
1105
+ * @remarks Record type: TRANSACTIONAL
1106
+ *
1107
+ * @param properties - The properties for the new record
1108
+ * @param options - Optional settings
1109
+ * @param options.journeyId - Associate with a journey
1110
+ * @param options.stageKey - Set initial pipeline stage
1111
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
1112
+ *
1113
+ * @example
1114
+ * ```typescript
1115
+ * // Create with properties
1116
+ * const record = odinClient.emails.new();
1117
+ * await record.createInstallDayBeforeWifiEducation({ ... }).execute();
1118
+ *
1119
+ * // Dry run (for debugging)
1120
+ * const payload = record.createInstallDayBeforeWifiEducation({ ... }).dryRun();
1121
+ * ```
1122
+ */
1123
+ createInstallDayBeforeWifiEducation(properties?: CreateInstallDayBeforeWifiEducationProperties, options?: {
1124
+ journeyId?: string;
1125
+ stageKey?: string;
1126
+ }): ActionBuilder;
1098
1127
  /**
1099
1128
  * CreateNewCreditNote
1100
1129
  *
@@ -1355,6 +1355,42 @@ class EmailRecord {
1355
1355
  };
1356
1356
  return new ActionBuilder(this._provider, 'NotificationModule', 'Email', payload, () => { this._pendingLinks = []; });
1357
1357
  }
1358
+ /**
1359
+ * CreateInstallDayBeforeWifiEducation
1360
+ *
1361
+ * Creates a new Email record with the specified properties.
1362
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
1363
+ *
1364
+ * @remarks Record type: TRANSACTIONAL
1365
+ *
1366
+ * @param properties - The properties for the new record
1367
+ * @param options - Optional settings
1368
+ * @param options.journeyId - Associate with a journey
1369
+ * @param options.stageKey - Set initial pipeline stage
1370
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
1371
+ *
1372
+ * @example
1373
+ * ```typescript
1374
+ * // Create with properties
1375
+ * const record = odinClient.emails.new();
1376
+ * await record.createInstallDayBeforeWifiEducation({ ... }).execute();
1377
+ *
1378
+ * // Dry run (for debugging)
1379
+ * const payload = record.createInstallDayBeforeWifiEducation({ ... }).dryRun();
1380
+ * ```
1381
+ */
1382
+ createInstallDayBeforeWifiEducation(properties, options) {
1383
+ const payload = {
1384
+ entity: 'NotificationModule:Email',
1385
+ type: 'TRANSACTIONAL',
1386
+ actionName: 'CreateInstallDayBeforeWifiEducation',
1387
+ properties: properties || {},
1388
+ associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined,
1389
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
1390
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
1391
+ };
1392
+ return new ActionBuilder(this._provider, 'NotificationModule', 'Email', payload, () => { this._pendingLinks = []; });
1393
+ }
1358
1394
  /**
1359
1395
  * CreateNewCreditNote
1360
1396
  *
@@ -0,0 +1,205 @@
1
+ /**
2
+ * QaAutoFail Record Wrapper
3
+ *
4
+ * Provides typed action methods and link management.
5
+ * Works with both ApiProvider and DbProvider.
6
+ *
7
+ * All action methods return an ActionBuilder or FlowBuilder.
8
+ * Call .execute() to run or .dryRun() to get the payload for debugging.
9
+ *
10
+ * Can be instantiated with null record for create operations:
11
+ * ```typescript
12
+ * const record = odinClient.qaAutoFails.new();
13
+ * await record.createQaAutoFail({ ... }).execute();
14
+ * ```
15
+ *
16
+ * Entity Types: DEFAULT
17
+ *
18
+ * AUTO-GENERATED - DO NOT EDIT DIRECTLY
19
+ */
20
+ import { OdinRecord, OdinRecordLinkDto } from '@d19n/odin-types/dist/core';
21
+ import { PipelineStageEntity } from '@d19n/odin-types/dist/core';
22
+ import { IDbRecordCreateUpdateRes } from '@d19n/odin-types/dist/core/interfaces/v1.db.interfaces';
23
+ import { IOdinProvider } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
24
+ import { RecordLinkManager } from '@d19n/odin-sdk-generator/dist/record-link-manager';
25
+ import { QaAutoFailProperties } from '../entities-v2/QaAutoFail';
26
+ import { UpdateQaAutoFailProperties } from '../actions-v2/UpdateQaAutoFailDto';
27
+ import { QaRubricRecord } from './QaRubricRecord';
28
+ /** Valid entity types for QaAutoFail */
29
+ export declare type QaAutoFailType = 'DEFAULT';
30
+ /**
31
+ * Builder for action execution with dryRun support
32
+ *
33
+ * Provides a consistent API across all action types:
34
+ * - `.execute()` - Execute the action and return results
35
+ * - `.dryRun()` - Return the payload without executing (for debugging)
36
+ */
37
+ declare class ActionBuilder<T = IDbRecordCreateUpdateRes[]> {
38
+ private _provider;
39
+ private _moduleName;
40
+ private _entityName;
41
+ private _payload;
42
+ private _clearPendingLinks;
43
+ constructor(provider: IOdinProvider, moduleName: string, entityName: string, payload: Record<string, any>, clearPendingLinks: () => void);
44
+ /**
45
+ * Set an external system identifier for this record.
46
+ * Links the record to a corresponding entry in an external application.
47
+ *
48
+ * @param externalId - The ID in the external system
49
+ * @param externalAppId - The external application identifier
50
+ * @returns this (for chaining)
51
+ *
52
+ * @example
53
+ * ```typescript
54
+ * await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
55
+ * ```
56
+ */
57
+ withExternalId(externalId: string, externalAppId: string): this;
58
+ /**
59
+ * Set security/access groups for this record.
60
+ * Controls which user groups can access the record.
61
+ *
62
+ * @param groups - Array of group names
63
+ * @returns this (for chaining)
64
+ *
65
+ * @example
66
+ * ```typescript
67
+ * await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
68
+ * ```
69
+ */
70
+ withGroups(groups: string[]): this;
71
+ /**
72
+ * Execute the action
73
+ * @returns The result from the API
74
+ */
75
+ execute(): Promise<T>;
76
+ /**
77
+ * Returns the request payload without executing (for debugging)
78
+ * @returns The request payload that would be sent to the API
79
+ */
80
+ dryRun(): Record<string, any>;
81
+ /**
82
+ * Prevents accidental `await actionBuilder` without .execute()
83
+ * Forces developers to explicitly call .execute()
84
+ * @throws Error always - use .execute() or .dryRun() instead
85
+ */
86
+ then(): never;
87
+ }
88
+ export declare class QaAutoFailRecord<TProps = QaAutoFailProperties> {
89
+ private _record;
90
+ private _provider;
91
+ private _pendingLinks;
92
+ private _preGeneratedId;
93
+ private _qaRubrics?;
94
+ /**
95
+ * Create a record wrapper.
96
+ * @param record - The underlying record, or null for create operations
97
+ * @param provider - The API or DB provider
98
+ * @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
99
+ */
100
+ constructor(record: OdinRecord<TProps> | null, provider: IOdinProvider, preGeneratedId?: string);
101
+ /** Returns true if this is a new (unsaved) record */
102
+ get isNew(): boolean;
103
+ /** Record ID - always available (pre-generated for new records) */
104
+ get id(): string;
105
+ get entity(): string;
106
+ get type(): QaAutoFailType | undefined;
107
+ /** Record properties - empty object for new (unsaved) records */
108
+ get properties(): TProps;
109
+ get title(): string | undefined;
110
+ get recordNumber(): string | undefined;
111
+ get stage(): PipelineStageEntity | undefined;
112
+ get createdAt(): string | undefined;
113
+ get updatedAt(): string | undefined;
114
+ get externalId(): string | undefined;
115
+ get externalAppId(): string | undefined;
116
+ get groups(): string[];
117
+ /** Link metadata - populated only when the read passed withLinks (empty otherwise) */
118
+ get links(): OdinRecord<TProps>['links'];
119
+ /** Access the underlying OdinRecord (null for new records) */
120
+ get record(): OdinRecord<TProps> | null;
121
+ /**
122
+ * Type guard: check if this record is of type DEFAULT
123
+ *
124
+ * When this returns true, TypeScript automatically narrows the type,
125
+ * giving you access to DEFAULT-specific properties.
126
+ *
127
+ * @example
128
+ * ```typescript
129
+ * if (record.isDefault()) {
130
+ * // TypeScript knows record.properties is QaAutoFailProperties
131
+ * console.log(record.properties.SomeTypeSpecificField);
132
+ * }
133
+ * ```
134
+ * @remarks This is the default record type
135
+ */
136
+ isDefault(): this is QaAutoFailRecord<QaAutoFailProperties>;
137
+ /** Valid labels for QaRubric associations */
138
+ static readonly qaRubricsLabels: readonly ["Rubric__AutoFail"];
139
+ /**
140
+ * Access linked QaRubric records
141
+ * @remarks Available labels: Rubric__AutoFail
142
+ * @throws Error if called on a new (unsaved) record
143
+ *
144
+ * @example
145
+ * ```typescript
146
+ * // Get all linked QaRubric records
147
+ * const items = await record.qaRubrics.list();
148
+ * const first = await record.qaRubrics.first();
149
+ *
150
+ * // Filter by label
151
+ * const specific = await record.qaRubrics.first({ label: 'Rubric__AutoFail' });
152
+ * ```
153
+ */
154
+ get qaRubrics(): RecordLinkManager<QaRubricRecord, typeof QaAutoFailRecord['qaRubricsLabels'][number]>;
155
+ /**
156
+ * Queue a link to be created with the next action.
157
+ * Works for both create and update actions.
158
+ * @returns this (for chaining)
159
+ */
160
+ link(target: OdinRecord<any> | {
161
+ id: string;
162
+ entity: string;
163
+ }): this;
164
+ /** Get the currently queued links */
165
+ get pendingLinks(): OdinRecordLinkDto[];
166
+ /** Clear pending links without executing an action */
167
+ clearPendingLinks(): this;
168
+ /**
169
+ * Immediately unlink a record (API call).
170
+ * Unlike link(), this executes immediately.
171
+ * @throws Error if called on a new (unsaved) record
172
+ */
173
+ unlink(target: OdinRecord<any> | {
174
+ id: string;
175
+ } | string): Promise<void>;
176
+ /**
177
+ * UpdateQaAutoFail
178
+ *
179
+ * Updates this QaAutoFail record with the specified properties.
180
+ * Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
181
+ *
182
+ * @param properties - Required properties for this action
183
+ * @param options - Optional settings
184
+ * @param options.journeyId - Associate with a journey
185
+ * @param options.stageKey - Transition to pipeline stage
186
+ * @returns ActionBuilder - call .execute() to update or .dryRun() for payload
187
+ * @throws Error if called on a new (unsaved) record
188
+ *
189
+ * @example
190
+ * ```typescript
191
+ * const record = await odinClient.qaAutoFails.get(id);
192
+ * await record.updateQaAutoFail({ ... }).execute();
193
+ *
194
+ * // Dry run (for debugging)
195
+ * const payload = record.updateQaAutoFail({ ... }).dryRun();
196
+ * ```
197
+ */
198
+ updateQaAutoFail(properties: UpdateQaAutoFailProperties, options?: {
199
+ journeyId?: string;
200
+ stageKey?: string;
201
+ }): ActionBuilder;
202
+ }
203
+ /** Type guard to check if an object is a QaAutoFailRecord */
204
+ export declare function isQaAutoFailRecord(obj: any): obj is QaAutoFailRecord;
205
+ export {};
@@ -0,0 +1,275 @@
1
+ "use strict";
2
+ /**
3
+ * QaAutoFail 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.qaAutoFails.new();
14
+ * await record.createQaAutoFail({ ... }).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.isQaAutoFailRecord = exports.QaAutoFailRecord = 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 QaRubricRecord_1 = require("./QaRubricRecord");
36
+ /**
37
+ * Builder for action execution with dryRun support
38
+ *
39
+ * Provides a consistent API across all action types:
40
+ * - `.execute()` - Execute the action and return results
41
+ * - `.dryRun()` - Return the payload without executing (for debugging)
42
+ */
43
+ class ActionBuilder {
44
+ constructor(provider, moduleName, entityName, payload, clearPendingLinks) {
45
+ this._provider = provider;
46
+ this._moduleName = moduleName;
47
+ this._entityName = entityName;
48
+ this._payload = payload;
49
+ this._clearPendingLinks = clearPendingLinks;
50
+ }
51
+ /**
52
+ * Set an external system identifier for this record.
53
+ * Links the record to a corresponding entry in an external application.
54
+ *
55
+ * @param externalId - The ID in the external system
56
+ * @param externalAppId - The external application identifier
57
+ * @returns this (for chaining)
58
+ *
59
+ * @example
60
+ * ```typescript
61
+ * await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
62
+ * ```
63
+ */
64
+ withExternalId(externalId, externalAppId) {
65
+ this._payload.externalId = externalId;
66
+ this._payload.externalAppId = externalAppId;
67
+ return this;
68
+ }
69
+ /**
70
+ * Set security/access groups for this record.
71
+ * Controls which user groups can access the record.
72
+ *
73
+ * @param groups - Array of group names
74
+ * @returns this (for chaining)
75
+ *
76
+ * @example
77
+ * ```typescript
78
+ * await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
79
+ * ```
80
+ */
81
+ withGroups(groups) {
82
+ this._payload.groups = groups;
83
+ return this;
84
+ }
85
+ /**
86
+ * Execute the action
87
+ * @returns The result from the API
88
+ */
89
+ execute() {
90
+ return __awaiter(this, void 0, void 0, function* () {
91
+ const result = yield this._provider._applyAction(this._moduleName, this._entityName, this._payload);
92
+ this._clearPendingLinks();
93
+ return result;
94
+ });
95
+ }
96
+ /**
97
+ * Returns the request payload without executing (for debugging)
98
+ * @returns The request payload that would be sent to the API
99
+ */
100
+ dryRun() {
101
+ return this._payload;
102
+ }
103
+ /**
104
+ * Prevents accidental `await actionBuilder` without .execute()
105
+ * Forces developers to explicitly call .execute()
106
+ * @throws Error always - use .execute() or .dryRun() instead
107
+ */
108
+ then() {
109
+ throw new Error('ActionBuilder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
110
+ }
111
+ }
112
+ class QaAutoFailRecord {
113
+ /**
114
+ * Create a record wrapper.
115
+ * @param record - The underlying record, or null for create operations
116
+ * @param provider - The API or DB provider
117
+ * @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
118
+ */
119
+ constructor(record, provider, preGeneratedId) {
120
+ this._pendingLinks = [];
121
+ this._record = record;
122
+ this._provider = provider;
123
+ this._preGeneratedId = preGeneratedId !== null && preGeneratedId !== void 0 ? preGeneratedId : (0, uuid_1.v4)();
124
+ }
125
+ // ============================================
126
+ // CORE PROPERTIES
127
+ // ============================================
128
+ /** Returns true if this is a new (unsaved) record */
129
+ get isNew() { var _a; return !((_a = this._record) === null || _a === void 0 ? void 0 : _a.id); }
130
+ /** Record ID - always available (pre-generated for new records) */
131
+ 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; }
132
+ get entity() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.entity) !== null && _b !== void 0 ? _b : 'SupportModule:QaAutoFail'; }
133
+ get type() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.type; }
134
+ /** Record properties - empty object for new (unsaved) records */
135
+ get properties() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.properties) || {}; }
136
+ get title() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.title; }
137
+ get recordNumber() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.recordNumber; }
138
+ get stage() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.stage; }
139
+ get createdAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.createdAt; }
140
+ get updatedAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.updatedAt; }
141
+ get externalId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalId; }
142
+ get externalAppId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalAppId; }
143
+ get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
144
+ /** Link metadata - populated only when the read passed withLinks (empty otherwise) */
145
+ get links() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.links) !== null && _b !== void 0 ? _b : []; }
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 QaAutoFailProperties
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 QaRubric records
169
+ * @remarks Available labels: Rubric__AutoFail
170
+ * @throws Error if called on a new (unsaved) record
171
+ *
172
+ * @example
173
+ * ```typescript
174
+ * // Get all linked QaRubric records
175
+ * const items = await record.qaRubrics.list();
176
+ * const first = await record.qaRubrics.first();
177
+ *
178
+ * // Filter by label
179
+ * const specific = await record.qaRubrics.first({ label: 'Rubric__AutoFail' });
180
+ * ```
181
+ */
182
+ get qaRubrics() {
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._qaRubrics) {
187
+ this._qaRubrics = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
188
+ sourceEntity: 'SupportModule:QaAutoFail',
189
+ targetEntity: 'SupportModule:QaRubric',
190
+ targetModuleName: 'SupportModule',
191
+ targetEntityName: 'QaRubric',
192
+ labels: ['Rubric__AutoFail'],
193
+ }, QaRubricRecord_1.QaRubricRecord);
194
+ }
195
+ return this._qaRubrics;
196
+ }
197
+ // ============================================
198
+ // LINK MANAGEMENT
199
+ // ============================================
200
+ /**
201
+ * Queue a link to be created with the next action.
202
+ * Works for both create and update actions.
203
+ * @returns this (for chaining)
204
+ */
205
+ link(target) {
206
+ this._pendingLinks.push(new core_1.OdinRecordLinkDto({ id: target.id, entity: target.entity }));
207
+ return this;
208
+ }
209
+ /** Get the currently queued links */
210
+ get pendingLinks() {
211
+ return [...this._pendingLinks];
212
+ }
213
+ /** Clear pending links without executing an action */
214
+ clearPendingLinks() {
215
+ this._pendingLinks = [];
216
+ return this;
217
+ }
218
+ /**
219
+ * Immediately unlink a record (API call).
220
+ * Unlike link(), this executes immediately.
221
+ * @throws Error if called on a new (unsaved) record
222
+ */
223
+ unlink(target) {
224
+ var _a;
225
+ return __awaiter(this, void 0, void 0, function* () {
226
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
227
+ throw new Error('Cannot unlink from a new (unsaved) record');
228
+ const targetId = typeof target === 'string' ? target : target.id;
229
+ yield this._provider._deleteLinks('SupportModule', 'QaAutoFail', this._record.id, targetId);
230
+ });
231
+ }
232
+ // ============================================
233
+ // UPDATE ACTIONS (require existing record)
234
+ // ============================================
235
+ /**
236
+ * UpdateQaAutoFail
237
+ *
238
+ * Updates this QaAutoFail record with the specified properties.
239
+ * Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
240
+ *
241
+ * @param properties - Required properties for this action
242
+ * @param options - Optional settings
243
+ * @param options.journeyId - Associate with a journey
244
+ * @param options.stageKey - Transition to pipeline stage
245
+ * @returns ActionBuilder - call .execute() to update or .dryRun() for payload
246
+ * @throws Error if called on a new (unsaved) record
247
+ *
248
+ * @example
249
+ * ```typescript
250
+ * const record = await odinClient.qaAutoFails.get(id);
251
+ * await record.updateQaAutoFail({ ... }).execute();
252
+ *
253
+ * // Dry run (for debugging)
254
+ * const payload = record.updateQaAutoFail({ ... }).dryRun();
255
+ * ```
256
+ */
257
+ updateQaAutoFail(properties, options) {
258
+ var _a;
259
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
260
+ throw new Error('updateQaAutoFail requires an existing record. Use accessor.get() first.');
261
+ const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'UpdateQaAutoFail', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, options);
262
+ return new ActionBuilder(this._provider, 'SupportModule', 'QaAutoFail', payload, () => { this._pendingLinks = []; });
263
+ }
264
+ }
265
+ exports.QaAutoFailRecord = QaAutoFailRecord;
266
+ // ============================================
267
+ // TYPED LINK ACCESSORS
268
+ // ============================================
269
+ /** Valid labels for QaRubric associations */
270
+ QaAutoFailRecord.qaRubricsLabels = ['Rubric__AutoFail'];
271
+ /** Type guard to check if an object is a QaAutoFailRecord */
272
+ function isQaAutoFailRecord(obj) {
273
+ return obj instanceof QaAutoFailRecord;
274
+ }
275
+ exports.isQaAutoFailRecord = isQaAutoFailRecord;