@d19n/youfibre-odin-sdk 2.0.339 → 2.0.341

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.
@@ -0,0 +1,121 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ /**
4
+ * ORDER projection — scope of `supply-must-have-active-progressing-install`.
5
+ *
6
+ * A START order takes over a line that is already provisioned, so no engineer
7
+ * attends: the supplier cancels its INSTALL and says so with
8
+ * `NETOMNIA_INSTALL_WORK_ORDER_CANCELLED_ENGINEER_NOT_REQUIRED`. A Cancelled
9
+ * INSTALL is therefore the normal, correct state for these orders — they
10
+ * activate on the COMPLETED-OrderKci gate instead.
11
+ *
12
+ * The BP has excluded START from this rule since 2026-08-13
13
+ * (agent-os/knowledge/business-processes/order.ts:740). The projection is a
14
+ * hand-maintained copy and never received it, so the engine kept scoring healthy
15
+ * START orders BLOCKER and prescribing `cancel-parent` — which would deny a
16
+ * customer a service that is physically ready. Production 2026-09-16: 98 of the
17
+ * 122 orders off-track on this dep were START, 58 with a COMPLETED confirmation.
18
+ *
19
+ * These tests pin the scope so the drift cannot return silently.
20
+ *
21
+ * Run: npm run test:process-model
22
+ */
23
+ const order_process_projection_1 = require("./order-process.projection");
24
+ const process_validator_1 = require("./process-validator");
25
+ const DEP_ID = 'supply-must-have-active-progressing-install';
26
+ const WO_ENTITY = 'FieldServiceModule:WorkOrder';
27
+ let passed = 0;
28
+ let failed = 0;
29
+ const failures = [];
30
+ function assert(label, cond, hint) {
31
+ if (cond) {
32
+ passed += 1;
33
+ console.log(` PASS ${label}`);
34
+ }
35
+ else {
36
+ failed += 1;
37
+ const msg = ` FAIL ${label}${hint ? ' — ' + hint : ''}`;
38
+ failures.push(msg);
39
+ console.log(msg);
40
+ }
41
+ }
42
+ /** A Supply order, optionally carrying a SupplierOrderType discriminator. */
43
+ function supplyOrder(supplierOrderType) {
44
+ return {
45
+ id: 'ord-1',
46
+ recordNumber: 'OR0000001',
47
+ stage: { key: 'OrderStageSupply', name: 'Supply' },
48
+ createdAt: new Date(Date.now() - 3 * 86400000).toISOString(),
49
+ properties: supplierOrderType === undefined
50
+ ? { Provider: 'NETOMNIA' }
51
+ : { Provider: 'NETOMNIA', SupplierOrderType: supplierOrderType },
52
+ };
53
+ }
54
+ const CANCELLED_INSTALL = {
55
+ id: 'wo-1',
56
+ recordNumber: 'WO-1',
57
+ type: 'INSTALL',
58
+ stage: { key: 'WorkOrderStageCancelled', name: 'Cancelled' },
59
+ };
60
+ const SCHEDULED_INSTALL = {
61
+ id: 'wo-2',
62
+ recordNumber: 'WO-2',
63
+ type: 'INSTALL',
64
+ stage: { key: 'WorkOrderStageScheduled', name: 'Scheduled' },
65
+ };
66
+ function score(order, workOrders) {
67
+ return (0, process_validator_1.validateAgainstProcess)({
68
+ record: order,
69
+ process: order_process_projection_1.ORDER_PROCESS_PROJECTION,
70
+ relations: { [WO_ENTITY]: workOrders },
71
+ });
72
+ }
73
+ function verdictFor(report, depId) {
74
+ return report.verdicts.find((v) => v.depId === depId);
75
+ }
76
+ function run() {
77
+ var _a, _b, _c, _d, _e;
78
+ console.log(`\n${DEP_ID} — START orders are out of scope\n`);
79
+ {
80
+ const v = verdictFor(score(supplyOrder('START'), [CANCELLED_INSTALL]), DEP_ID);
81
+ assert('START + Cancelled INSTALL scores correct (parentFilter excludes it)', (v === null || v === void 0 ? void 0 : v.status) === 'correct', `got ${v === null || v === void 0 ? void 0 : v.status} / ${(_b = (_a = v === null || v === void 0 ? void 0 : v.prescribedAction) === null || _a === void 0 ? void 0 : _a.kind) !== null && _b !== void 0 ? _b : 'no action'}`);
82
+ }
83
+ {
84
+ const v = verdictFor(score(supplyOrder('NEW'), [CANCELLED_INSTALL]), DEP_ID);
85
+ assert('NEW + Cancelled INSTALL still scores variance', (v === null || v === void 0 ? void 0 : v.status) === 'variance', `got ${v === null || v === void 0 ? void 0 : v.status}`);
86
+ assert('NEW + Cancelled INSTALL still prescribes cancel-parent', ((_c = v === null || v === void 0 ? void 0 : v.prescribedAction) === null || _c === void 0 ? void 0 : _c.kind) === 'cancel-parent', `got ${(_d = v === null || v === void 0 ? void 0 : v.prescribedAction) === null || _d === void 0 ? void 0 : _d.kind}`);
87
+ }
88
+ {
89
+ // `notEq` is plain `!==`, so the ordinary NEW-provide case (no discriminator
90
+ // written) must stay fully in scope. This is the rule's blast radius.
91
+ const v = verdictFor(score(supplyOrder(undefined), [CANCELLED_INSTALL]), DEP_ID);
92
+ assert('absent SupplierOrderType stays in scope (variance)', (v === null || v === void 0 ? void 0 : v.status) === 'variance', `got ${v === null || v === void 0 ? void 0 : v.status}`);
93
+ }
94
+ {
95
+ const v = verdictFor(score(supplyOrder('START'), [SCHEDULED_INSTALL]), DEP_ID);
96
+ assert('START + Scheduled INSTALL scores correct', (v === null || v === void 0 ? void 0 : v.status) === 'correct', `got ${v === null || v === void 0 ? void 0 : v.status}`);
97
+ }
98
+ {
99
+ const v = verdictFor(score(supplyOrder('NEW'), [SCHEDULED_INSTALL]), DEP_ID);
100
+ assert('NEW + Scheduled INSTALL scores correct', (v === null || v === void 0 ? void 0 : v.status) === 'correct', `got ${v === null || v === void 0 ? void 0 : v.status}`);
101
+ }
102
+ {
103
+ // The projection must carry the BP's filter verbatim, not merely behave
104
+ // correctly for the cases above.
105
+ const supply = order_process_projection_1.ORDER_PROCESS_PROJECTION.stages.find((s) => s.key === 'OrderStageSupply');
106
+ const dep = (_e = supply === null || supply === void 0 ? void 0 : supply.dependencies) === null || _e === void 0 ? void 0 : _e.find((d) => d.id === DEP_ID);
107
+ const pf = dep && 'parentFilter' in dep ? dep.parentFilter : undefined;
108
+ assert('dep declares parentFilter SupplierOrderType notEq START', (pf === null || pf === void 0 ? void 0 : pf.length) === 1 &&
109
+ pf[0].column === 'SupplierOrderType' &&
110
+ pf[0].op === 'notEq' &&
111
+ pf[0].value === 'START', `got ${JSON.stringify(pf)}`);
112
+ }
113
+ console.log('\n────────────────────────────────────────');
114
+ console.log(`Tests: ${passed} passed, ${failed} failed`);
115
+ if (failed > 0) {
116
+ console.log('');
117
+ failures.forEach((f) => console.log(f));
118
+ process.exit(1);
119
+ }
120
+ }
121
+ run();
@@ -0,0 +1,186 @@
1
+ /**
2
+ * AiRouteRequest 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.aiRouteRequests.new();
13
+ * await record.createAiRouteRequest({ ... }).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 { AiRouteRequestProperties } from '../entities-v2/AiRouteRequest';
25
+ import { CreateAiRouteRequestProperties } from '../actions-v2/CreateAiRouteRequestDto';
26
+ /** Valid entity types for AiRouteRequest */
27
+ export declare type AiRouteRequestType = 'DEFAULT';
28
+ /**
29
+ * Builder for action execution with dryRun support
30
+ *
31
+ * Provides a consistent API across all action types:
32
+ * - `.execute()` - Execute the action and return results
33
+ * - `.dryRun()` - Return the payload without executing (for debugging)
34
+ */
35
+ declare class ActionBuilder<T = IDbRecordCreateUpdateRes[]> {
36
+ private _provider;
37
+ private _moduleName;
38
+ private _entityName;
39
+ private _payload;
40
+ private _clearPendingLinks;
41
+ constructor(provider: IOdinProvider, moduleName: string, entityName: string, payload: Record<string, any>, clearPendingLinks: () => void);
42
+ /**
43
+ * Set an external system identifier for this record.
44
+ * Links the record to a corresponding entry in an external application.
45
+ *
46
+ * @param externalId - The ID in the external system
47
+ * @param externalAppId - The external application identifier
48
+ * @returns this (for chaining)
49
+ *
50
+ * @example
51
+ * ```typescript
52
+ * await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
53
+ * ```
54
+ */
55
+ withExternalId(externalId: string, externalAppId: string): this;
56
+ /**
57
+ * Set security/access groups for this record.
58
+ * Controls which user groups can access the record.
59
+ *
60
+ * @param groups - Array of group names
61
+ * @returns this (for chaining)
62
+ *
63
+ * @example
64
+ * ```typescript
65
+ * await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
66
+ * ```
67
+ */
68
+ withGroups(groups: string[]): this;
69
+ /**
70
+ * Execute the action
71
+ * @returns The result from the API
72
+ */
73
+ execute(): Promise<T>;
74
+ /**
75
+ * Returns the request payload without executing (for debugging)
76
+ * @returns The request payload that would be sent to the API
77
+ */
78
+ dryRun(): Record<string, any>;
79
+ /**
80
+ * Prevents accidental `await actionBuilder` without .execute()
81
+ * Forces developers to explicitly call .execute()
82
+ * @throws Error always - use .execute() or .dryRun() instead
83
+ */
84
+ then(): never;
85
+ }
86
+ export declare class AiRouteRequestRecord<TProps = AiRouteRequestProperties> {
87
+ private _record;
88
+ private _provider;
89
+ private _pendingLinks;
90
+ private _preGeneratedId;
91
+ /**
92
+ * Create a record wrapper.
93
+ * @param record - The underlying record, or null for create operations
94
+ * @param provider - The API or DB provider
95
+ * @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
96
+ */
97
+ constructor(record: OdinRecord<TProps> | null, provider: IOdinProvider, preGeneratedId?: string);
98
+ /** Returns true if this is a new (unsaved) record */
99
+ get isNew(): boolean;
100
+ /** Record ID - always available (pre-generated for new records) */
101
+ get id(): string;
102
+ get entity(): string;
103
+ get type(): AiRouteRequestType | undefined;
104
+ /** Record properties - empty object for new (unsaved) records */
105
+ get properties(): TProps;
106
+ get title(): string | undefined;
107
+ get recordNumber(): string | undefined;
108
+ get stage(): PipelineStageEntity | undefined;
109
+ get createdAt(): string | undefined;
110
+ get updatedAt(): string | undefined;
111
+ get externalId(): string | undefined;
112
+ get externalAppId(): string | undefined;
113
+ get groups(): string[];
114
+ /** Link metadata - populated only when the read passed withLinks (empty otherwise) */
115
+ get links(): OdinRecord<TProps>['links'];
116
+ /** Access the underlying OdinRecord (null for new records) */
117
+ get record(): OdinRecord<TProps> | null;
118
+ /**
119
+ * Type guard: check if this record is of type DEFAULT
120
+ *
121
+ * When this returns true, TypeScript automatically narrows the type,
122
+ * giving you access to DEFAULT-specific properties.
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * if (record.isDefault()) {
127
+ * // TypeScript knows record.properties is AiRouteRequestProperties
128
+ * console.log(record.properties.SomeTypeSpecificField);
129
+ * }
130
+ * ```
131
+ * @remarks This is the default record type
132
+ */
133
+ isDefault(): this is AiRouteRequestRecord<AiRouteRequestProperties>;
134
+ /**
135
+ * Queue a link to be created with the next action.
136
+ * Works for both create and update actions.
137
+ * @returns this (for chaining)
138
+ */
139
+ link(target: OdinRecord<any> | {
140
+ id: string;
141
+ entity: string;
142
+ }): this;
143
+ /** Get the currently queued links */
144
+ get pendingLinks(): OdinRecordLinkDto[];
145
+ /** Clear pending links without executing an action */
146
+ clearPendingLinks(): this;
147
+ /**
148
+ * Immediately unlink a record (API call).
149
+ * Unlike link(), this executes immediately.
150
+ * @throws Error if called on a new (unsaved) record
151
+ */
152
+ unlink(target: OdinRecord<any> | {
153
+ id: string;
154
+ } | string): Promise<void>;
155
+ /**
156
+ * CreateAiRouteRequest
157
+ *
158
+ * Creates a new AiRouteRequest record with the specified properties.
159
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
160
+ *
161
+ * @remarks Record type: DEFAULT
162
+ *
163
+ * @param properties - The properties for the new record
164
+ * @param options - Optional settings
165
+ * @param options.journeyId - Associate with a journey
166
+ * @param options.stageKey - Set initial pipeline stage
167
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
168
+ *
169
+ * @example
170
+ * ```typescript
171
+ * // Create with properties
172
+ * const record = odinClient.aiRouteRequests.new();
173
+ * await record.createAiRouteRequest({ ... }).execute();
174
+ *
175
+ * // Dry run (for debugging)
176
+ * const payload = record.createAiRouteRequest({ ... }).dryRun();
177
+ * ```
178
+ */
179
+ createAiRouteRequest(properties: CreateAiRouteRequestProperties, options?: {
180
+ journeyId?: string;
181
+ stageKey?: string;
182
+ }): ActionBuilder;
183
+ }
184
+ /** Type guard to check if an object is a AiRouteRequestRecord */
185
+ export declare function isAiRouteRequestRecord(obj: any): obj is AiRouteRequestRecord;
186
+ export {};
@@ -0,0 +1,245 @@
1
+ "use strict";
2
+ /**
3
+ * AiRouteRequest 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.aiRouteRequests.new();
14
+ * await record.createAiRouteRequest({ ... }).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.isAiRouteRequestRecord = exports.AiRouteRequestRecord = void 0;
32
+ const uuid_1 = require("uuid");
33
+ const core_1 = require("@d19n/odin-types/dist/core");
34
+ /**
35
+ * Builder for action execution with dryRun support
36
+ *
37
+ * Provides a consistent API across all action types:
38
+ * - `.execute()` - Execute the action and return results
39
+ * - `.dryRun()` - Return the payload without executing (for debugging)
40
+ */
41
+ class ActionBuilder {
42
+ constructor(provider, moduleName, entityName, payload, clearPendingLinks) {
43
+ this._provider = provider;
44
+ this._moduleName = moduleName;
45
+ this._entityName = entityName;
46
+ this._payload = payload;
47
+ this._clearPendingLinks = clearPendingLinks;
48
+ }
49
+ /**
50
+ * Set an external system identifier for this record.
51
+ * Links the record to a corresponding entry in an external application.
52
+ *
53
+ * @param externalId - The ID in the external system
54
+ * @param externalAppId - The external application identifier
55
+ * @returns this (for chaining)
56
+ *
57
+ * @example
58
+ * ```typescript
59
+ * await record.createOrder({ ... }).withExternalId('SF-123', 'salesforce').execute();
60
+ * ```
61
+ */
62
+ withExternalId(externalId, externalAppId) {
63
+ this._payload.externalId = externalId;
64
+ this._payload.externalAppId = externalAppId;
65
+ return this;
66
+ }
67
+ /**
68
+ * Set security/access groups for this record.
69
+ * Controls which user groups can access the record.
70
+ *
71
+ * @param groups - Array of group names
72
+ * @returns this (for chaining)
73
+ *
74
+ * @example
75
+ * ```typescript
76
+ * await record.createOrder({ ... }).withGroups(['TenantA', 'BillingTeam']).execute();
77
+ * ```
78
+ */
79
+ withGroups(groups) {
80
+ this._payload.groups = groups;
81
+ return this;
82
+ }
83
+ /**
84
+ * Execute the action
85
+ * @returns The result from the API
86
+ */
87
+ execute() {
88
+ return __awaiter(this, void 0, void 0, function* () {
89
+ const result = yield this._provider._applyAction(this._moduleName, this._entityName, this._payload);
90
+ this._clearPendingLinks();
91
+ return result;
92
+ });
93
+ }
94
+ /**
95
+ * Returns the request payload without executing (for debugging)
96
+ * @returns The request payload that would be sent to the API
97
+ */
98
+ dryRun() {
99
+ return this._payload;
100
+ }
101
+ /**
102
+ * Prevents accidental `await actionBuilder` without .execute()
103
+ * Forces developers to explicitly call .execute()
104
+ * @throws Error always - use .execute() or .dryRun() instead
105
+ */
106
+ then() {
107
+ throw new Error('ActionBuilder cannot be awaited directly. Call .execute() to run the action or .dryRun() to get the payload.');
108
+ }
109
+ }
110
+ class AiRouteRequestRecord {
111
+ /**
112
+ * Create a record wrapper.
113
+ * @param record - The underlying record, or null for create operations
114
+ * @param provider - The API or DB provider
115
+ * @param preGeneratedId - Optional pre-generated ID for new records (auto-generated if not provided)
116
+ */
117
+ constructor(record, provider, preGeneratedId) {
118
+ this._pendingLinks = [];
119
+ this._record = record;
120
+ this._provider = provider;
121
+ this._preGeneratedId = preGeneratedId !== null && preGeneratedId !== void 0 ? preGeneratedId : (0, uuid_1.v4)();
122
+ }
123
+ // ============================================
124
+ // CORE PROPERTIES
125
+ // ============================================
126
+ /** Returns true if this is a new (unsaved) record */
127
+ get isNew() { var _a; return !((_a = this._record) === null || _a === void 0 ? void 0 : _a.id); }
128
+ /** Record ID - always available (pre-generated for new records) */
129
+ 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; }
130
+ get entity() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.entity) !== null && _b !== void 0 ? _b : 'SupportModule:AiRouteRequest'; }
131
+ get type() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.type; }
132
+ /** Record properties - empty object for new (unsaved) records */
133
+ get properties() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.properties) || {}; }
134
+ get title() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.title; }
135
+ get recordNumber() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.recordNumber; }
136
+ get stage() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.stage; }
137
+ get createdAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.createdAt; }
138
+ get updatedAt() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.updatedAt; }
139
+ get externalId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalId; }
140
+ get externalAppId() { var _a; return (_a = this._record) === null || _a === void 0 ? void 0 : _a.externalAppId; }
141
+ get groups() { var _a; return ((_a = this._record) === null || _a === void 0 ? void 0 : _a.groups) || []; }
142
+ /** Link metadata - populated only when the read passed withLinks (empty otherwise) */
143
+ get links() { var _a, _b; return (_b = (_a = this._record) === null || _a === void 0 ? void 0 : _a.links) !== null && _b !== void 0 ? _b : []; }
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 AiRouteRequestProperties
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
+ // LINK MANAGEMENT
167
+ // ============================================
168
+ /**
169
+ * Queue a link to be created with the next action.
170
+ * Works for both create and update actions.
171
+ * @returns this (for chaining)
172
+ */
173
+ link(target) {
174
+ this._pendingLinks.push(new core_1.OdinRecordLinkDto({ id: target.id, entity: target.entity }));
175
+ return this;
176
+ }
177
+ /** Get the currently queued links */
178
+ get pendingLinks() {
179
+ return [...this._pendingLinks];
180
+ }
181
+ /** Clear pending links without executing an action */
182
+ clearPendingLinks() {
183
+ this._pendingLinks = [];
184
+ return this;
185
+ }
186
+ /**
187
+ * Immediately unlink a record (API call).
188
+ * Unlike link(), this executes immediately.
189
+ * @throws Error if called on a new (unsaved) record
190
+ */
191
+ unlink(target) {
192
+ var _a;
193
+ return __awaiter(this, void 0, void 0, function* () {
194
+ if (!((_a = this._record) === null || _a === void 0 ? void 0 : _a.id))
195
+ throw new Error('Cannot unlink from a new (unsaved) record');
196
+ const targetId = typeof target === 'string' ? target : target.id;
197
+ yield this._provider._deleteLinks('SupportModule', 'AiRouteRequest', this._record.id, targetId);
198
+ });
199
+ }
200
+ // ============================================
201
+ // CREATE ACTIONS (no existing record required)
202
+ // ============================================
203
+ /**
204
+ * CreateAiRouteRequest
205
+ *
206
+ * Creates a new AiRouteRequest record with the specified properties.
207
+ * Returns an ActionBuilder - call .execute() to create or .dryRun() for debugging.
208
+ *
209
+ * @remarks Record type: DEFAULT
210
+ *
211
+ * @param properties - The properties for the new record
212
+ * @param options - Optional settings
213
+ * @param options.journeyId - Associate with a journey
214
+ * @param options.stageKey - Set initial pipeline stage
215
+ * @returns ActionBuilder - call .execute() to create or .dryRun() for payload
216
+ *
217
+ * @example
218
+ * ```typescript
219
+ * // Create with properties
220
+ * const record = odinClient.aiRouteRequests.new();
221
+ * await record.createAiRouteRequest({ ... }).execute();
222
+ *
223
+ * // Dry run (for debugging)
224
+ * const payload = record.createAiRouteRequest({ ... }).dryRun();
225
+ * ```
226
+ */
227
+ createAiRouteRequest(properties, options) {
228
+ const payload = {
229
+ entity: 'SupportModule:AiRouteRequest',
230
+ type: 'DEFAULT',
231
+ actionName: 'CreateAiRouteRequest',
232
+ properties: properties || {},
233
+ associations: this._pendingLinks.length > 0 ? this._pendingLinks : undefined,
234
+ journeyId: options === null || options === void 0 ? void 0 : options.journeyId,
235
+ stageKey: options === null || options === void 0 ? void 0 : options.stageKey,
236
+ };
237
+ return new ActionBuilder(this._provider, 'SupportModule', 'AiRouteRequest', payload, () => { this._pendingLinks = []; });
238
+ }
239
+ }
240
+ exports.AiRouteRequestRecord = AiRouteRequestRecord;
241
+ /** Type guard to check if an object is a AiRouteRequestRecord */
242
+ function isAiRouteRequestRecord(obj) {
243
+ return obj instanceof AiRouteRequestRecord;
244
+ }
245
+ exports.isAiRouteRequestRecord = isAiRouteRequestRecord;
@@ -41,6 +41,7 @@ export { AccountCreditRecord, isAccountCreditRecord } from './AccountCreditRecor
41
41
  export { ActivityLogRecord, isActivityLogRecord } from './ActivityLogRecord';
42
42
  export { AffiliateCodeRecord, isAffiliateCodeRecord } from './AffiliateCodeRecord';
43
43
  export { CallLegRecord, isCallLegRecord } from './CallLegRecord';
44
+ export { AiRouteRequestRecord, isAiRouteRequestRecord } from './AiRouteRequestRecord';
44
45
  export { EmailRecord, isEmailRecord } from './EmailRecord';
45
46
  export { AppointmentRecord, isAppointmentRecord } from './AppointmentRecord';
46
47
  export { PgFileAllocationRecord, isPgFileAllocationRecord } from './PgFileAllocationRecord';
@@ -12,10 +12,11 @@
12
12
  */
13
13
  Object.defineProperty(exports, "__esModule", { value: true });
14
14
  exports.isUgExternalAuditRecord = exports.UgExternalAuditRecord = exports.isPaymentMethodRefundRecord = exports.PaymentMethodRefundRecord = exports.isCustomerDeviceRouterRecord = exports.CustomerDeviceRouterRecord = exports.isConversationRecord = exports.ConversationRecord = exports.isOntReplacementApprovalRecord = exports.OntReplacementApprovalRecord = exports.isAccountRecord = exports.AccountRecord = exports.isPermissionToFailRecord = exports.PermissionToFailRecord = exports.isTransactionRecord = exports.TransactionRecord = exports.isPaymentMethodRecord = exports.PaymentMethodRecord = 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.isDataIssueRecord = exports.DataIssueRecord = exports.isContractBuyOutRecord = exports.ContractBuyOutRecord = exports.isAddressInteractionRecord = exports.AddressInteractionRecord = exports.isAddressRecord = exports.AddressRecord = exports.isCaseRecord = exports.CaseRecord = exports.isWorkOrderRecord = exports.WorkOrderRecord = exports.isOrderRecord = exports.OrderRecord = void 0;
15
- exports.isCustomerDeviceOntRecord = exports.CustomerDeviceOntRecord = exports.isCustomerDeviceConfigurationRecord = exports.CustomerDeviceConfigurationRecord = exports.isCustomerDeviceRecord = exports.CustomerDeviceRecord = exports.isConversationSummaryFeedbackRecord = exports.ConversationSummaryFeedbackRecord = exports.isContactIdentityRecord = exports.ContactIdentityRecord = exports.isConfigRecord = exports.ConfigRecord = exports.isMessageRecord = exports.MessageRecord = exports.isOrderKciRecord = exports.OrderKciRecord = 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.isEmailRecord = exports.EmailRecord = exports.isCallLegRecord = exports.CallLegRecord = exports.isAffiliateCodeRecord = exports.AffiliateCodeRecord = exports.isActivityLogRecord = exports.ActivityLogRecord = exports.isAccountCreditRecord = exports.AccountCreditRecord = exports.isYfFieldVisitOutcomeFormRecord = exports.YfFieldVisitOutcomeFormRecord = exports.isRemediationOutcomeFormRecord = exports.RemediationOutcomeFormRecord = exports.isOhExternalAuditRecord = exports.OhExternalAuditRecord = void 0;
16
- exports.isPgPaymentMethodRecord = exports.PgPaymentMethodRecord = exports.isPgLogRecord = exports.PgLogRecord = exports.isPgDisputeRecord = exports.PgDisputeRecord = exports.isPgContactRecord = exports.PgContactRecord = 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.isModifyServiceRequestRecord = exports.ModifyServiceRequestRecord = exports.isLeadRecord = exports.LeadRecord = exports.isInvoiceItemRecord = exports.InvoiceItemRecord = exports.isImpersonationTrackerRecord = exports.ImpersonationTrackerRecord = exports.isActivityRecord = exports.ActivityRecord = exports.isFileRecord = exports.FileRecord = exports.isFieldServiceProductRecord = exports.FieldServiceProductRecord = exports.isFieldServiceDispatchedProductRecord = exports.FieldServiceDispatchedProductRecord = exports.isExchangeRecord = exports.ExchangeRecord = exports.isEmailTemplateRecord = exports.EmailTemplateRecord = exports.isEmailSenderRecord = exports.EmailSenderRecord = void 0;
17
- exports.isYfAgentLocationRecord = exports.YfAgentLocationRecord = 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.isRecontractRecord = exports.RecontractRecord = exports.isQaReportRecord = exports.QaReportRecord = exports.isPushNotificationRecord = exports.PushNotificationRecord = exports.isPgWebhookRecord = exports.PgWebhookRecord = exports.isPgWebhookAttemptRecord = exports.PgWebhookAttemptRecord = exports.isPgAccountValidationRecord = exports.PgAccountValidationRecord = exports.isPgTransactionRecord = exports.PgTransactionRecord = exports.isPgSortCodeSubstitutionRecord = exports.PgSortCodeSubstitutionRecord = exports.isPgVocalinkRecord = exports.PgVocalinkRecord = exports.isPgDirectDebitFileRecord = exports.PgDirectDebitFileRecord = exports.isPgReportEventRecord = exports.PgReportEventRecord = void 0;
18
- exports.isCustomerPhonePortingRecord = exports.CustomerPhonePortingRecord = exports.isVisitRecord = exports.VisitRecord = exports.isSmsTemplateRecord = exports.SmsTemplateRecord = exports.isServiceRecord = exports.ServiceRecord = exports.isQaRubricSectionRecord = exports.QaRubricSectionRecord = exports.isQaRubricItemRecord = exports.QaRubricItemRecord = exports.isQaRubricRecord = exports.QaRubricRecord = exports.isQaAutoFailRecord = exports.QaAutoFailRecord = exports.isNotificationTemplateRecord = exports.NotificationTemplateRecord = exports.isAgentStatusRecord = exports.AgentStatusRecord = 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 = exports.isKnowledgeArticleRecord = exports.KnowledgeArticleRecord = exports.isInvoiceRecord = exports.InvoiceRecord = exports.isDiscountRecord = exports.DiscountRecord = exports.isCustomerDeviceAtaRecord = exports.CustomerDeviceAtaRecord = exports.isCreditNoteRecord = exports.CreditNoteRecord = exports.isOutboundDialCampaignCaseRecord = exports.OutboundDialCampaignCaseRecord = exports.isYfWifiSurveyRecord = exports.YfWifiSurveyRecord = void 0;
15
+ exports.isCustomerDeviceConfigurationRecord = exports.CustomerDeviceConfigurationRecord = exports.isCustomerDeviceRecord = exports.CustomerDeviceRecord = exports.isConversationSummaryFeedbackRecord = exports.ConversationSummaryFeedbackRecord = exports.isContactIdentityRecord = exports.ContactIdentityRecord = exports.isConfigRecord = exports.ConfigRecord = exports.isMessageRecord = exports.MessageRecord = exports.isOrderKciRecord = exports.OrderKciRecord = 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.isEmailRecord = exports.EmailRecord = exports.isAiRouteRequestRecord = exports.AiRouteRequestRecord = exports.isCallLegRecord = exports.CallLegRecord = exports.isAffiliateCodeRecord = exports.AffiliateCodeRecord = exports.isActivityLogRecord = exports.ActivityLogRecord = exports.isAccountCreditRecord = exports.AccountCreditRecord = exports.isYfFieldVisitOutcomeFormRecord = exports.YfFieldVisitOutcomeFormRecord = exports.isRemediationOutcomeFormRecord = exports.RemediationOutcomeFormRecord = exports.isOhExternalAuditRecord = exports.OhExternalAuditRecord = void 0;
16
+ exports.isPgLogRecord = exports.PgLogRecord = exports.isPgDisputeRecord = exports.PgDisputeRecord = exports.isPgContactRecord = exports.PgContactRecord = 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.isModifyServiceRequestRecord = exports.ModifyServiceRequestRecord = exports.isLeadRecord = exports.LeadRecord = exports.isInvoiceItemRecord = exports.InvoiceItemRecord = exports.isImpersonationTrackerRecord = exports.ImpersonationTrackerRecord = exports.isActivityRecord = exports.ActivityRecord = exports.isFileRecord = exports.FileRecord = exports.isFieldServiceProductRecord = exports.FieldServiceProductRecord = exports.isFieldServiceDispatchedProductRecord = exports.FieldServiceDispatchedProductRecord = exports.isExchangeRecord = exports.ExchangeRecord = exports.isEmailTemplateRecord = exports.EmailTemplateRecord = exports.isEmailSenderRecord = exports.EmailSenderRecord = exports.isCustomerDeviceOntRecord = exports.CustomerDeviceOntRecord = void 0;
17
+ 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.isRecontractRecord = exports.RecontractRecord = exports.isQaReportRecord = exports.QaReportRecord = exports.isPushNotificationRecord = exports.PushNotificationRecord = exports.isPgWebhookRecord = exports.PgWebhookRecord = exports.isPgWebhookAttemptRecord = exports.PgWebhookAttemptRecord = exports.isPgAccountValidationRecord = exports.PgAccountValidationRecord = exports.isPgTransactionRecord = exports.PgTransactionRecord = exports.isPgSortCodeSubstitutionRecord = exports.PgSortCodeSubstitutionRecord = exports.isPgVocalinkRecord = exports.PgVocalinkRecord = exports.isPgDirectDebitFileRecord = exports.PgDirectDebitFileRecord = exports.isPgReportEventRecord = exports.PgReportEventRecord = exports.isPgPaymentMethodRecord = exports.PgPaymentMethodRecord = void 0;
18
+ exports.isVisitRecord = exports.VisitRecord = exports.isSmsTemplateRecord = exports.SmsTemplateRecord = exports.isServiceRecord = exports.ServiceRecord = exports.isQaRubricSectionRecord = exports.QaRubricSectionRecord = exports.isQaRubricItemRecord = exports.QaRubricItemRecord = exports.isQaRubricRecord = exports.QaRubricRecord = exports.isQaAutoFailRecord = exports.QaAutoFailRecord = exports.isNotificationTemplateRecord = exports.NotificationTemplateRecord = exports.isAgentStatusRecord = exports.AgentStatusRecord = 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 = exports.isKnowledgeArticleRecord = exports.KnowledgeArticleRecord = exports.isInvoiceRecord = exports.InvoiceRecord = exports.isDiscountRecord = exports.DiscountRecord = exports.isCustomerDeviceAtaRecord = exports.CustomerDeviceAtaRecord = exports.isCreditNoteRecord = exports.CreditNoteRecord = exports.isOutboundDialCampaignCaseRecord = exports.OutboundDialCampaignCaseRecord = exports.isYfWifiSurveyRecord = exports.YfWifiSurveyRecord = exports.isYfAgentLocationRecord = exports.YfAgentLocationRecord = void 0;
19
+ exports.isCustomerPhonePortingRecord = exports.CustomerPhonePortingRecord = void 0;
19
20
  var OrderRecord_1 = require("./OrderRecord");
20
21
  Object.defineProperty(exports, "OrderRecord", { enumerable: true, get: function () { return OrderRecord_1.OrderRecord; } });
21
22
  Object.defineProperty(exports, "isOrderRecord", { enumerable: true, get: function () { return OrderRecord_1.isOrderRecord; } });
@@ -112,6 +113,9 @@ Object.defineProperty(exports, "isAffiliateCodeRecord", { enumerable: true, get:
112
113
  var CallLegRecord_1 = require("./CallLegRecord");
113
114
  Object.defineProperty(exports, "CallLegRecord", { enumerable: true, get: function () { return CallLegRecord_1.CallLegRecord; } });
114
115
  Object.defineProperty(exports, "isCallLegRecord", { enumerable: true, get: function () { return CallLegRecord_1.isCallLegRecord; } });
116
+ var AiRouteRequestRecord_1 = require("./AiRouteRequestRecord");
117
+ Object.defineProperty(exports, "AiRouteRequestRecord", { enumerable: true, get: function () { return AiRouteRequestRecord_1.AiRouteRequestRecord; } });
118
+ Object.defineProperty(exports, "isAiRouteRequestRecord", { enumerable: true, get: function () { return AiRouteRequestRecord_1.isAiRouteRequestRecord; } });
115
119
  var EmailRecord_1 = require("./EmailRecord");
116
120
  Object.defineProperty(exports, "EmailRecord", { enumerable: true, get: function () { return EmailRecord_1.EmailRecord; } });
117
121
  Object.defineProperty(exports, "isEmailRecord", { enumerable: true, get: function () { return EmailRecord_1.isEmailRecord; } });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@d19n/youfibre-odin-sdk",
3
- "version": "2.0.339",
3
+ "version": "2.0.341",
4
4
  "description": "",
5
5
  "author": "@d19n",
6
6
  "license": "UNLICENSED",
@@ -42,12 +42,17 @@
42
42
  "ts-node": "^10.9.2",
43
43
  "typescript": "4.8.4"
44
44
  },
45
+ "overrides": {
46
+ "uuid": "^11.1.1",
47
+ "diff": "^4.0.4"
48
+ },
45
49
  "dependencies": {
46
50
  "@d19n/odin-sdk-generator": "^3.0.244",
47
51
  "@d19n/odin-types": "^3.6.8"
48
52
  },
49
53
  "scripts": {
50
54
  "test:wholesale-provider": "npx --yes tsx src/wholesale-provider/test/netomnia-provider.spec.ts && npx --yes tsx src/wholesale-provider/test/kci-effect-bridge.spec.ts",
55
+ "test:process-model": "npx --yes tsx src/process-model/order-process.projection.spec.ts",
51
56
  "release:beta": "echo Local publish disabled. Use GitHub Actions workflow_dispatch on .github/workflows/release.yml with target=beta && exit 1",
52
57
  "release:prod": "echo Local publish disabled. Use GitHub Actions workflow_dispatch on .github/workflows/release.yml with target=prod && exit 1"
53
58
  },