@d19n/youfibre-odin-sdk 2.0.291 → 2.0.293
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +17 -1
- package/dist/EntityRegistry.d.ts +2 -0
- package/dist/EntityRegistry.js +2 -0
- package/dist/OdinApiClient.d.ts +4 -0
- package/dist/OdinApiClient.js +8 -0
- package/dist/OdinDbClient.d.ts +4 -0
- package/dist/OdinDbClient.js +8 -0
- package/dist/accessors-v2/AgentStatusAccessor.d.ts +111 -0
- package/dist/accessors-v2/AgentStatusAccessor.js +190 -0
- package/dist/accessors-v2/index.d.ts +1 -0
- package/dist/accessors-v2/index.js +5 -3
- package/dist/actions-v2/MovePaymentMethodRefundToFailedDto.d.ts +114 -0
- package/dist/actions-v2/MovePaymentMethodRefundToFailedDto.js +79 -0
- package/dist/actions-v2/MovePaymentMethodRefundToInProgressDto.d.ts +114 -0
- package/dist/actions-v2/MovePaymentMethodRefundToInProgressDto.js +79 -0
- package/dist/actions-v2/MovePaymentMethodRefundToRetryingDto.d.ts +114 -0
- package/dist/actions-v2/MovePaymentMethodRefundToRetryingDto.js +79 -0
- package/dist/actions-v2/UpdateAgentStatusDto.d.ts +80 -0
- package/dist/actions-v2/UpdateAgentStatusDto.js +56 -0
- package/dist/actions-v2/UpdatePaymentMethodRefundDto.d.ts +93 -0
- package/dist/actions-v2/UpdatePaymentMethodRefundDto.js +56 -0
- package/dist/db-accessors-v2/AgentStatusDbAccessor.d.ts +149 -0
- package/dist/db-accessors-v2/AgentStatusDbAccessor.js +227 -0
- package/dist/db-accessors-v2/index.d.ts +1 -0
- package/dist/db-accessors-v2/index.js +5 -3
- package/dist/entities-v2/Case.d.ts +2 -0
- package/dist/entities-v2/Case.js +2 -0
- package/dist/entities-v2/PaymentMethodRefund.d.ts +4 -4
- package/dist/entities-v2/PaymentMethodRefund.js +2 -2
- package/dist/entities-v2/Recontract.d.ts +22 -1
- package/dist/entities-v2/Recontract.js +6 -0
- package/dist/records-v2/AgentStatusRecord.d.ts +203 -0
- package/dist/records-v2/AgentStatusRecord.js +273 -0
- package/dist/records-v2/PaymentMethodRefundRecord.d.ts +103 -0
- package/dist/records-v2/PaymentMethodRefundRecord.js +124 -0
- package/dist/records-v2/UserRecord.d.ts +20 -0
- package/dist/records-v2/UserRecord.js +33 -0
- package/dist/records-v2/index.d.ts +1 -0
- package/dist/records-v2/index.js +4 -1
- package/package.json +2 -2
|
@@ -70,7 +70,13 @@ export declare enum RecontractPropertyKeys {
|
|
|
70
70
|
/** Who initiated the recontract. */
|
|
71
71
|
Source = "Source",
|
|
72
72
|
/** Date the order was recontracted (in place). Discriminator + event date. */
|
|
73
|
-
RecontractDate = "RecontractDate"
|
|
73
|
+
RecontractDate = "RecontractDate",
|
|
74
|
+
/** Whether the recontract required an ONT upgrade or not */
|
|
75
|
+
RequiredOntUpgrade = "RequiredOntUpgrade",
|
|
76
|
+
/** Whether the recontract required a router upgrade or not */
|
|
77
|
+
RequiredRouterUpgrade = "RequiredRouterUpgrade",
|
|
78
|
+
/** Whether the recontract required a mesh upgrade or not */
|
|
79
|
+
RequiredMeshUpgrade = "RequiredMeshUpgrade"
|
|
74
80
|
}
|
|
75
81
|
/**
|
|
76
82
|
* Properties for Recontract records
|
|
@@ -166,6 +172,21 @@ export interface RecontractProperties {
|
|
|
166
172
|
* @type {DATE}
|
|
167
173
|
*/
|
|
168
174
|
RecontractDate: string;
|
|
175
|
+
/** Whether the recontract required an ONT upgrade or not
|
|
176
|
+
*
|
|
177
|
+
* @type {BOOLEAN}
|
|
178
|
+
*/
|
|
179
|
+
RequiredOntUpgrade: boolean;
|
|
180
|
+
/** Whether the recontract required a router upgrade or not
|
|
181
|
+
*
|
|
182
|
+
* @type {BOOLEAN}
|
|
183
|
+
*/
|
|
184
|
+
RequiredRouterUpgrade: boolean;
|
|
185
|
+
/** Whether the recontract required a mesh upgrade or not
|
|
186
|
+
*
|
|
187
|
+
* @type {BOOLEAN}
|
|
188
|
+
*/
|
|
189
|
+
RequiredMeshUpgrade: boolean;
|
|
169
190
|
}
|
|
170
191
|
/**
|
|
171
192
|
* Recontract entity from OrderModule
|
|
@@ -76,6 +76,12 @@ var RecontractPropertyKeys;
|
|
|
76
76
|
RecontractPropertyKeys["Source"] = "Source";
|
|
77
77
|
/** Date the order was recontracted (in place). Discriminator + event date. */
|
|
78
78
|
RecontractPropertyKeys["RecontractDate"] = "RecontractDate";
|
|
79
|
+
/** Whether the recontract required an ONT upgrade or not */
|
|
80
|
+
RecontractPropertyKeys["RequiredOntUpgrade"] = "RequiredOntUpgrade";
|
|
81
|
+
/** Whether the recontract required a router upgrade or not */
|
|
82
|
+
RecontractPropertyKeys["RequiredRouterUpgrade"] = "RequiredRouterUpgrade";
|
|
83
|
+
/** Whether the recontract required a mesh upgrade or not */
|
|
84
|
+
RecontractPropertyKeys["RequiredMeshUpgrade"] = "RequiredMeshUpgrade";
|
|
79
85
|
})(RecontractPropertyKeys = exports.RecontractPropertyKeys || (exports.RecontractPropertyKeys = {}));
|
|
80
86
|
/**
|
|
81
87
|
* Recontract entity from OrderModule
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AgentStatus 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.agentStatuss.new();
|
|
13
|
+
* await record.createAgentStatus({ ... }).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 { AgentStatusProperties } from '../entities-v2/AgentStatus';
|
|
26
|
+
import { UpdateAgentStatusProperties } from '../actions-v2/UpdateAgentStatusDto';
|
|
27
|
+
import { UserRecord } from './UserRecord';
|
|
28
|
+
/** Valid entity types for AgentStatus */
|
|
29
|
+
export declare type AgentStatusType = '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 AgentStatusRecord<TProps = AgentStatusProperties> {
|
|
89
|
+
private _record;
|
|
90
|
+
private _provider;
|
|
91
|
+
private _pendingLinks;
|
|
92
|
+
private _preGeneratedId;
|
|
93
|
+
private _users?;
|
|
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(): AgentStatusType | 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
|
+
/** Access the underlying OdinRecord (null for new records) */
|
|
118
|
+
get record(): OdinRecord<TProps> | null;
|
|
119
|
+
/**
|
|
120
|
+
* Type guard: check if this record is of type DEFAULT
|
|
121
|
+
*
|
|
122
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
123
|
+
* giving you access to DEFAULT-specific properties.
|
|
124
|
+
*
|
|
125
|
+
* @example
|
|
126
|
+
* ```typescript
|
|
127
|
+
* if (record.isDefault()) {
|
|
128
|
+
* // TypeScript knows record.properties is AgentStatusProperties
|
|
129
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
130
|
+
* }
|
|
131
|
+
* ```
|
|
132
|
+
* @remarks This is the default record type
|
|
133
|
+
*/
|
|
134
|
+
isDefault(): this is AgentStatusRecord<AgentStatusProperties>;
|
|
135
|
+
/** Valid labels for User associations */
|
|
136
|
+
static readonly usersLabels: readonly ["AgentStatus__User"];
|
|
137
|
+
/**
|
|
138
|
+
* Access linked User records
|
|
139
|
+
* @remarks Available labels: AgentStatus__User
|
|
140
|
+
* @throws Error if called on a new (unsaved) record
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```typescript
|
|
144
|
+
* // Get all linked User records
|
|
145
|
+
* const items = await record.users.list();
|
|
146
|
+
* const first = await record.users.first();
|
|
147
|
+
*
|
|
148
|
+
* // Filter by label
|
|
149
|
+
* const specific = await record.users.first({ label: 'AgentStatus__User' });
|
|
150
|
+
* ```
|
|
151
|
+
*/
|
|
152
|
+
get users(): RecordLinkManager<UserRecord, typeof AgentStatusRecord['usersLabels'][number]>;
|
|
153
|
+
/**
|
|
154
|
+
* Queue a link to be created with the next action.
|
|
155
|
+
* Works for both create and update actions.
|
|
156
|
+
* @returns this (for chaining)
|
|
157
|
+
*/
|
|
158
|
+
link(target: OdinRecord<any> | {
|
|
159
|
+
id: string;
|
|
160
|
+
entity: string;
|
|
161
|
+
}): this;
|
|
162
|
+
/** Get the currently queued links */
|
|
163
|
+
get pendingLinks(): OdinRecordLinkDto[];
|
|
164
|
+
/** Clear pending links without executing an action */
|
|
165
|
+
clearPendingLinks(): this;
|
|
166
|
+
/**
|
|
167
|
+
* Immediately unlink a record (API call).
|
|
168
|
+
* Unlike link(), this executes immediately.
|
|
169
|
+
* @throws Error if called on a new (unsaved) record
|
|
170
|
+
*/
|
|
171
|
+
unlink(target: OdinRecord<any> | {
|
|
172
|
+
id: string;
|
|
173
|
+
} | string): Promise<void>;
|
|
174
|
+
/**
|
|
175
|
+
* UpdateAgentStatus
|
|
176
|
+
*
|
|
177
|
+
* Updates this AgentStatus record with the specified properties.
|
|
178
|
+
* Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
|
|
179
|
+
*
|
|
180
|
+
* @param properties - Required properties for this action
|
|
181
|
+
* @param options - Optional settings
|
|
182
|
+
* @param options.journeyId - Associate with a journey
|
|
183
|
+
* @param options.stageKey - Transition to pipeline stage
|
|
184
|
+
* @returns ActionBuilder - call .execute() to update or .dryRun() for payload
|
|
185
|
+
* @throws Error if called on a new (unsaved) record
|
|
186
|
+
*
|
|
187
|
+
* @example
|
|
188
|
+
* ```typescript
|
|
189
|
+
* const record = await odinClient.agentStatuss.get(id);
|
|
190
|
+
* await record.updateAgentStatus({ ... }).execute();
|
|
191
|
+
*
|
|
192
|
+
* // Dry run (for debugging)
|
|
193
|
+
* const payload = record.updateAgentStatus({ ... }).dryRun();
|
|
194
|
+
* ```
|
|
195
|
+
*/
|
|
196
|
+
updateAgentStatus(properties: UpdateAgentStatusProperties, options?: {
|
|
197
|
+
journeyId?: string;
|
|
198
|
+
stageKey?: string;
|
|
199
|
+
}): ActionBuilder;
|
|
200
|
+
}
|
|
201
|
+
/** Type guard to check if an object is a AgentStatusRecord */
|
|
202
|
+
export declare function isAgentStatusRecord(obj: any): obj is AgentStatusRecord;
|
|
203
|
+
export {};
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AgentStatus 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.agentStatuss.new();
|
|
14
|
+
* await record.createAgentStatus({ ... }).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.isAgentStatusRecord = exports.AgentStatusRecord = 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 UserRecord_1 = require("./UserRecord");
|
|
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 AgentStatusRecord {
|
|
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:AgentStatus'; }
|
|
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
|
+
/** Access the underlying OdinRecord (null for new records) */
|
|
145
|
+
get record() { return this._record; }
|
|
146
|
+
// ============================================
|
|
147
|
+
// TYPE GUARDS (with TypeScript type predicates)
|
|
148
|
+
// ============================================
|
|
149
|
+
/**
|
|
150
|
+
* Type guard: check if this record is of type DEFAULT
|
|
151
|
+
*
|
|
152
|
+
* When this returns true, TypeScript automatically narrows the type,
|
|
153
|
+
* giving you access to DEFAULT-specific properties.
|
|
154
|
+
*
|
|
155
|
+
* @example
|
|
156
|
+
* ```typescript
|
|
157
|
+
* if (record.isDefault()) {
|
|
158
|
+
* // TypeScript knows record.properties is AgentStatusProperties
|
|
159
|
+
* console.log(record.properties.SomeTypeSpecificField);
|
|
160
|
+
* }
|
|
161
|
+
* ```
|
|
162
|
+
* @remarks This is the default record type
|
|
163
|
+
*/
|
|
164
|
+
isDefault() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.type) === 'DEFAULT'; }
|
|
165
|
+
/**
|
|
166
|
+
* Access linked User records
|
|
167
|
+
* @remarks Available labels: AgentStatus__User
|
|
168
|
+
* @throws Error if called on a new (unsaved) record
|
|
169
|
+
*
|
|
170
|
+
* @example
|
|
171
|
+
* ```typescript
|
|
172
|
+
* // Get all linked User records
|
|
173
|
+
* const items = await record.users.list();
|
|
174
|
+
* const first = await record.users.first();
|
|
175
|
+
*
|
|
176
|
+
* // Filter by label
|
|
177
|
+
* const specific = await record.users.first({ label: 'AgentStatus__User' });
|
|
178
|
+
* ```
|
|
179
|
+
*/
|
|
180
|
+
get users() {
|
|
181
|
+
var _a;
|
|
182
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
183
|
+
throw new Error('Cannot access links on a new (unsaved) record');
|
|
184
|
+
if (!this._users) {
|
|
185
|
+
this._users = new record_link_manager_1.RecordLinkManager(this._provider, this._record, {
|
|
186
|
+
sourceEntity: 'SupportModule:AgentStatus',
|
|
187
|
+
targetEntity: 'IdentityModule:User',
|
|
188
|
+
targetModuleName: 'IdentityModule',
|
|
189
|
+
targetEntityName: 'User',
|
|
190
|
+
labels: ['AgentStatus__User'],
|
|
191
|
+
}, UserRecord_1.UserRecord);
|
|
192
|
+
}
|
|
193
|
+
return this._users;
|
|
194
|
+
}
|
|
195
|
+
// ============================================
|
|
196
|
+
// LINK MANAGEMENT
|
|
197
|
+
// ============================================
|
|
198
|
+
/**
|
|
199
|
+
* Queue a link to be created with the next action.
|
|
200
|
+
* Works for both create and update actions.
|
|
201
|
+
* @returns this (for chaining)
|
|
202
|
+
*/
|
|
203
|
+
link(target) {
|
|
204
|
+
this._pendingLinks.push(new core_1.OdinRecordLinkDto({ id: target.id, entity: target.entity }));
|
|
205
|
+
return this;
|
|
206
|
+
}
|
|
207
|
+
/** Get the currently queued links */
|
|
208
|
+
get pendingLinks() {
|
|
209
|
+
return [...this._pendingLinks];
|
|
210
|
+
}
|
|
211
|
+
/** Clear pending links without executing an action */
|
|
212
|
+
clearPendingLinks() {
|
|
213
|
+
this._pendingLinks = [];
|
|
214
|
+
return this;
|
|
215
|
+
}
|
|
216
|
+
/**
|
|
217
|
+
* Immediately unlink a record (API call).
|
|
218
|
+
* Unlike link(), this executes immediately.
|
|
219
|
+
* @throws Error if called on a new (unsaved) record
|
|
220
|
+
*/
|
|
221
|
+
unlink(target) {
|
|
222
|
+
var _a;
|
|
223
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
224
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
225
|
+
throw new Error('Cannot unlink from a new (unsaved) record');
|
|
226
|
+
const targetId = typeof target === 'string' ? target : target.id;
|
|
227
|
+
yield this._provider._deleteLinks('SupportModule', 'AgentStatus', this._record.id, targetId);
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
// ============================================
|
|
231
|
+
// UPDATE ACTIONS (require existing record)
|
|
232
|
+
// ============================================
|
|
233
|
+
/**
|
|
234
|
+
* UpdateAgentStatus
|
|
235
|
+
*
|
|
236
|
+
* Updates this AgentStatus record with the specified properties.
|
|
237
|
+
* Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
|
|
238
|
+
*
|
|
239
|
+
* @param properties - Required properties for this action
|
|
240
|
+
* @param options - Optional settings
|
|
241
|
+
* @param options.journeyId - Associate with a journey
|
|
242
|
+
* @param options.stageKey - Transition to pipeline stage
|
|
243
|
+
* @returns ActionBuilder - call .execute() to update or .dryRun() for payload
|
|
244
|
+
* @throws Error if called on a new (unsaved) record
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* ```typescript
|
|
248
|
+
* const record = await odinClient.agentStatuss.get(id);
|
|
249
|
+
* await record.updateAgentStatus({ ... }).execute();
|
|
250
|
+
*
|
|
251
|
+
* // Dry run (for debugging)
|
|
252
|
+
* const payload = record.updateAgentStatus({ ... }).dryRun();
|
|
253
|
+
* ```
|
|
254
|
+
*/
|
|
255
|
+
updateAgentStatus(properties, options) {
|
|
256
|
+
var _a;
|
|
257
|
+
if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
|
|
258
|
+
throw new Error('updateAgentStatus requires an existing record. Use accessor.get() first.');
|
|
259
|
+
const payload = Object.assign({ id: this._record.id, entity: this._record.entity, type: this._record.type, actionName: 'UpdateAgentStatus', properties, associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined }, options);
|
|
260
|
+
return new ActionBuilder(this._provider, 'SupportModule', 'AgentStatus', payload, () => { this._pendingLinks = []; });
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
exports.AgentStatusRecord = AgentStatusRecord;
|
|
264
|
+
// ============================================
|
|
265
|
+
// TYPED LINK ACCESSORS
|
|
266
|
+
// ============================================
|
|
267
|
+
/** Valid labels for User associations */
|
|
268
|
+
AgentStatusRecord.usersLabels = ['AgentStatus__User'];
|
|
269
|
+
/** Type guard to check if an object is a AgentStatusRecord */
|
|
270
|
+
function isAgentStatusRecord(obj) {
|
|
271
|
+
return obj instanceof AgentStatusRecord;
|
|
272
|
+
}
|
|
273
|
+
exports.isAgentStatusRecord = isAgentStatusRecord;
|
|
@@ -25,6 +25,7 @@ import { CompletePaymentMethodRefundProperties } from '../actions-v2/CompletePay
|
|
|
25
25
|
import { CreatePaymentMethodRefundProperties } from '../actions-v2/CreatePaymentMethodRefundDto';
|
|
26
26
|
import { CreatePaymentMethodRefundForContactProperties } from '../actions-v2/CreatePaymentMethodRefundForContactDto';
|
|
27
27
|
import { CreatePaymentMethodRefundForContactBuilder } from '../actions-v2/CreatePaymentMethodRefundForContactDto';
|
|
28
|
+
import { UpdatePaymentMethodRefundProperties } from '../actions-v2/UpdatePaymentMethodRefundDto';
|
|
28
29
|
import { RewardRecord } from './RewardRecord';
|
|
29
30
|
import { FileRecord } from './FileRecord';
|
|
30
31
|
import { NoteRecord } from './NoteRecord';
|
|
@@ -519,6 +520,108 @@ export declare class PaymentMethodRefundRecord<TProps = PaymentMethodRefundPrope
|
|
|
519
520
|
completePaymentMethodRefundFlow(options?: {
|
|
520
521
|
journeyId?: string;
|
|
521
522
|
}): CompletePaymentMethodRefundFlowFlowBuilder;
|
|
523
|
+
/**
|
|
524
|
+
* MovePaymentMethodRefundToFailed
|
|
525
|
+
*
|
|
526
|
+
* Transitions this PaymentMethodRefund record to a new pipeline stage.
|
|
527
|
+
* Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
|
|
528
|
+
*
|
|
529
|
+
* @remarks Transitions to stage: PaymentMethodRefundPipelineStageFailed
|
|
530
|
+
*
|
|
531
|
+
* @param options - Optional settings
|
|
532
|
+
* @param options.journeyId - Associate with a journey
|
|
533
|
+
* @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
|
|
534
|
+
* @throws Error if called on a new (unsaved) record
|
|
535
|
+
*
|
|
536
|
+
* @example
|
|
537
|
+
* ```typescript
|
|
538
|
+
* const record = await odinClient.paymentMethodRefunds.get(id);
|
|
539
|
+
* await record.movePaymentMethodRefundToFailed().execute();
|
|
540
|
+
*
|
|
541
|
+
* // Dry run (for debugging)
|
|
542
|
+
* const payload = record.movePaymentMethodRefundToFailed().dryRun();
|
|
543
|
+
* ```
|
|
544
|
+
*/
|
|
545
|
+
movePaymentMethodRefundToFailed(options?: {
|
|
546
|
+
journeyId?: string;
|
|
547
|
+
}): ActionBuilder;
|
|
548
|
+
/**
|
|
549
|
+
* MovePaymentMethodRefundToInProgress
|
|
550
|
+
*
|
|
551
|
+
* Transitions this PaymentMethodRefund record to a new pipeline stage.
|
|
552
|
+
* Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
|
|
553
|
+
*
|
|
554
|
+
* @remarks Transitions to stage: PaymentMethodRefundStageInProgress
|
|
555
|
+
*
|
|
556
|
+
* @param options - Optional settings
|
|
557
|
+
* @param options.journeyId - Associate with a journey
|
|
558
|
+
* @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
|
|
559
|
+
* @throws Error if called on a new (unsaved) record
|
|
560
|
+
*
|
|
561
|
+
* @example
|
|
562
|
+
* ```typescript
|
|
563
|
+
* const record = await odinClient.paymentMethodRefunds.get(id);
|
|
564
|
+
* await record.movePaymentMethodRefundToInProgress().execute();
|
|
565
|
+
*
|
|
566
|
+
* // Dry run (for debugging)
|
|
567
|
+
* const payload = record.movePaymentMethodRefundToInProgress().dryRun();
|
|
568
|
+
* ```
|
|
569
|
+
*/
|
|
570
|
+
movePaymentMethodRefundToInProgress(options?: {
|
|
571
|
+
journeyId?: string;
|
|
572
|
+
}): ActionBuilder;
|
|
573
|
+
/**
|
|
574
|
+
* MovePaymentMethodRefundToRetrying
|
|
575
|
+
*
|
|
576
|
+
* Transitions this PaymentMethodRefund record to a new pipeline stage.
|
|
577
|
+
* Returns an ActionBuilder - call .execute() to transition or .dryRun() for debugging.
|
|
578
|
+
*
|
|
579
|
+
* @remarks Transitions to stage: PaymentMethodRefundPipelineStageRetrying
|
|
580
|
+
*
|
|
581
|
+
* @param options - Optional settings
|
|
582
|
+
* @param options.journeyId - Associate with a journey
|
|
583
|
+
* @returns ActionBuilder - call .execute() to transition or .dryRun() for payload
|
|
584
|
+
* @throws Error if called on a new (unsaved) record
|
|
585
|
+
*
|
|
586
|
+
* @example
|
|
587
|
+
* ```typescript
|
|
588
|
+
* const record = await odinClient.paymentMethodRefunds.get(id);
|
|
589
|
+
* await record.movePaymentMethodRefundToRetrying().execute();
|
|
590
|
+
*
|
|
591
|
+
* // Dry run (for debugging)
|
|
592
|
+
* const payload = record.movePaymentMethodRefundToRetrying().dryRun();
|
|
593
|
+
* ```
|
|
594
|
+
*/
|
|
595
|
+
movePaymentMethodRefundToRetrying(options?: {
|
|
596
|
+
journeyId?: string;
|
|
597
|
+
}): ActionBuilder;
|
|
598
|
+
/**
|
|
599
|
+
* UpdatePaymentMethodRefund
|
|
600
|
+
*
|
|
601
|
+
* Updates this PaymentMethodRefund record.
|
|
602
|
+
* Returns an ActionBuilder - call .execute() to update or .dryRun() for debugging.
|
|
603
|
+
*
|
|
604
|
+
* @param propertiesOrOptions - Properties to update, or options object
|
|
605
|
+
* @param options - Optional settings (journeyId, stageKey)
|
|
606
|
+
* @returns ActionBuilder - call .execute() to update or .dryRun() for payload
|
|
607
|
+
* @throws Error if called on a new (unsaved) record
|
|
608
|
+
*
|
|
609
|
+
* @example
|
|
610
|
+
* ```typescript
|
|
611
|
+
* const record = await odinClient.paymentMethodRefunds.get(id);
|
|
612
|
+
* await record.updatePaymentMethodRefund({ ... }).execute();
|
|
613
|
+
*
|
|
614
|
+
* // Dry run (for debugging)
|
|
615
|
+
* const payload = record.updatePaymentMethodRefund({ ... }).dryRun();
|
|
616
|
+
* ```
|
|
617
|
+
*/
|
|
618
|
+
updatePaymentMethodRefund(propertiesOrOptions?: UpdatePaymentMethodRefundProperties | {
|
|
619
|
+
journeyId?: string;
|
|
620
|
+
stageKey?: string;
|
|
621
|
+
}, options?: {
|
|
622
|
+
journeyId?: string;
|
|
623
|
+
stageKey?: string;
|
|
624
|
+
}): ActionBuilder;
|
|
522
625
|
}
|
|
523
626
|
/** Type guard to check if an object is a PaymentMethodRefundRecord */
|
|
524
627
|
export declare function isPaymentMethodRefundRecord(obj: any): obj is PaymentMethodRefundRecord;
|