@d19n/youfibre-odin-sdk 2.0.357 → 2.0.359
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 +2 -1
- package/dist/api-sdk-v2/AiRouteRequestApi.d.ts +45 -0
- package/dist/api-sdk-v2/AiRouteRequestApi.js +151 -0
- package/dist/db-sdk-v2/AiRouteRequestDb.d.ts +117 -0
- package/dist/db-sdk-v2/AiRouteRequestDb.js +200 -0
- package/dist/entities-v2/AiRouteRequest.d.ts +260 -0
- package/dist/entities-v2/AiRouteRequest.js +174 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -124,7 +124,7 @@ await workOrder.completeWorkOrder({ ... });
|
|
|
124
124
|
|
|
125
125
|
## Entities
|
|
126
126
|
|
|
127
|
-
This SDK includes **
|
|
127
|
+
This SDK includes **202** entities across **13** modules.
|
|
128
128
|
|
|
129
129
|
### CrmModule
|
|
130
130
|
|
|
@@ -205,6 +205,7 @@ This SDK includes **201** entities across **13** modules.
|
|
|
205
205
|
|--------|-------------|-------|
|
|
206
206
|
| **AgentStatus** | AgentStatus Entity Definition | DEFAULT |
|
|
207
207
|
| **AgentStatusHistory** | AgentStatusHistory Entity Definition | DEFAULT |
|
|
208
|
+
| **AiRouteRequest** | AiRouteRequest Entity Definition | DEFAULT |
|
|
208
209
|
| **AiTagItem** | AiTagItem Entity Definition | DEFAULT |
|
|
209
210
|
| **AiTagSet** | AiTagSet Entity Definition | DEFAULT |
|
|
210
211
|
| **Case** | Case Entity Definition | OUTAGE |
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { OauthParams } from '@d19n/odin-sdk-generator/dist/odin-sdk-types';
|
|
2
|
+
import { ApiProvider } from '@d19n/odin-sdk-generator/dist/api.provider';
|
|
3
|
+
import { OdinSearchV2, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/core';
|
|
4
|
+
import { AiRouteRequestProperties } from '../entities-v2/AiRouteRequest';
|
|
5
|
+
/**
|
|
6
|
+
* @deprecated Use OdinApiClient.
|
|
7
|
+
*
|
|
8
|
+
* Migration:
|
|
9
|
+
* - Old: new AiRouteRequestApi(authParams).get(id)
|
|
10
|
+
* - New: new odin.airouterequest.get(id)
|
|
11
|
+
*
|
|
12
|
+
* The new OdinApiClient returns typed record wrappers with action methods.
|
|
13
|
+
*/
|
|
14
|
+
export declare class AiRouteRequestApi extends ApiProvider {
|
|
15
|
+
protected readonly authToken?: string;
|
|
16
|
+
private readonly moduleName;
|
|
17
|
+
private readonly entityName;
|
|
18
|
+
private sourceRecord;
|
|
19
|
+
constructor(authParams?: OauthParams, authToken?: string);
|
|
20
|
+
setRecord(sourceRecord: any): void;
|
|
21
|
+
schema(): Promise<import("@d19n/odin-types/dist/core").OdinSchema>;
|
|
22
|
+
search(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>>>;
|
|
23
|
+
searchAndPaginate(params: Partial<OdinSearchV2>): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>>>;
|
|
24
|
+
reIndex(body: {
|
|
25
|
+
id: string;
|
|
26
|
+
schemaId: string;
|
|
27
|
+
}[]): Promise<any>;
|
|
28
|
+
get(aiRouteRequestId: string): Promise<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>>;
|
|
29
|
+
getMany(aiRouteRequestIds: string[]): Promise<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>[]>;
|
|
30
|
+
upsert(upsertDto: OdinRecordCreateDto): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes>;
|
|
31
|
+
upsertMany(upsertDtos: OdinRecordCreateDto[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes[]>;
|
|
32
|
+
update(updateDto: OdinRecordUpdateDto): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes>;
|
|
33
|
+
updateMany(updateDtos: OdinRecordUpdateDto[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").IDbRecordCreateUpdateRes[]>;
|
|
34
|
+
delete(aiRouteRequestId: string): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinDeleteResponse[]>;
|
|
35
|
+
deleteMany(aiRouteRequestIds: string[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinDeleteResponse[]>;
|
|
36
|
+
restore(aiRouteRequestIds: string[]): Promise<import("@d19n/odin-sdk-generator/dist/odin-sdk-types").OdinRestoreResponse[]>;
|
|
37
|
+
applyAction(dto: any): Promise<any[]>;
|
|
38
|
+
bulkApplyActions(dtos: any[]): Promise<any[]>;
|
|
39
|
+
getVersions(): Promise<{
|
|
40
|
+
[key: string]: Record<string, any>;
|
|
41
|
+
}>;
|
|
42
|
+
getRevisionTimeline(): Promise<{
|
|
43
|
+
[key: string]: Record<string, any>[];
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AiRouteRequestApi = void 0;
|
|
13
|
+
const api_provider_1 = require("@d19n/odin-sdk-generator/dist/api.provider");
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use OdinApiClient.
|
|
16
|
+
*
|
|
17
|
+
* Migration:
|
|
18
|
+
* - Old: new AiRouteRequestApi(authParams).get(id)
|
|
19
|
+
* - New: new odin.airouterequest.get(id)
|
|
20
|
+
*
|
|
21
|
+
* The new OdinApiClient returns typed record wrappers with action methods.
|
|
22
|
+
*/
|
|
23
|
+
class AiRouteRequestApi extends api_provider_1.ApiProvider {
|
|
24
|
+
// ============================================
|
|
25
|
+
// PRIVATE BACKING FIELDS (Lazy Loading)
|
|
26
|
+
// ============================================
|
|
27
|
+
constructor(authParams, authToken) {
|
|
28
|
+
super(authParams, authToken);
|
|
29
|
+
this.authToken = authToken;
|
|
30
|
+
this.moduleName = 'SupportModule';
|
|
31
|
+
this.entityName = 'AiRouteRequest';
|
|
32
|
+
// Link managers are lazy-loaded on first access
|
|
33
|
+
}
|
|
34
|
+
// ============================================
|
|
35
|
+
// LAZY-LOADED LINK MANAGERS (Public Getters)
|
|
36
|
+
// ============================================
|
|
37
|
+
// Usage remains identical: api.address.list(recordId)
|
|
38
|
+
// ============================================
|
|
39
|
+
// STANDARD METHODS (Unchanged API)
|
|
40
|
+
// ============================================
|
|
41
|
+
setRecord(sourceRecord) {
|
|
42
|
+
this.sourceRecord = sourceRecord;
|
|
43
|
+
}
|
|
44
|
+
schema() {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
return yield this.getSchema(this.moduleName, this.entityName);
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
// Use this function when you want to search and handle all pagination on your own
|
|
50
|
+
search(params) {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
return yield this._searchRecords(this.moduleName, this.entityName, params);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// Use this function when you want paginating through the results to be handled
|
|
56
|
+
searchAndPaginate(params) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params);
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
// Use this function to re-index records in elastic search
|
|
62
|
+
reIndex(body) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
return yield this._reIndexRecords(body);
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
// Use this function when you want to return a single record
|
|
68
|
+
get(aiRouteRequestId) {
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, aiRouteRequestId);
|
|
71
|
+
if (res)
|
|
72
|
+
this.setRecord(res);
|
|
73
|
+
return res;
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
// Use this function when you want to return many records by primaryKeys
|
|
77
|
+
getMany(aiRouteRequestIds) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, aiRouteRequestIds);
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// Use this function when you want to upsert one record
|
|
83
|
+
upsert(upsertDto) {
|
|
84
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
85
|
+
const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto]);
|
|
86
|
+
return res[0];
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
// Use this function when you want to upsert many records
|
|
90
|
+
upsertMany(upsertDtos) {
|
|
91
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
92
|
+
return yield this._upsert(this.moduleName, this.entityName, upsertDtos);
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
// Use this function when you want to update one record
|
|
96
|
+
update(updateDto) {
|
|
97
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
98
|
+
const res = yield this._update(this.moduleName, this.entityName, [updateDto]);
|
|
99
|
+
return res[0];
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
// Use this function when you want to update many records
|
|
103
|
+
updateMany(updateDtos) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
return yield this._update(this.moduleName, this.entityName, updateDtos);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
// Use this function when you want to delete one record
|
|
109
|
+
delete(aiRouteRequestId) {
|
|
110
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
111
|
+
return yield this._delete(this.moduleName, this.entityName, [aiRouteRequestId]);
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
// Use this function when you want to delete many records
|
|
115
|
+
deleteMany(aiRouteRequestIds) {
|
|
116
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
+
return yield this._delete(this.moduleName, this.entityName, aiRouteRequestIds);
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
// Use this function when you want to restore one or many records
|
|
121
|
+
restore(aiRouteRequestIds) {
|
|
122
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
return yield this._restore(this.moduleName, this.entityName, aiRouteRequestIds);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
// Use this function when you want to apply a single action
|
|
127
|
+
applyAction(dto) {
|
|
128
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
129
|
+
return yield this._applyAction(this.moduleName, this.entityName, dto);
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
// Use this function when you want to bulk apply actions
|
|
133
|
+
bulkApplyActions(dtos) {
|
|
134
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
135
|
+
return yield this._bulkApplyActions(this.moduleName, this.entityName, dtos);
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
// Use this function when you want to return the versions for a single record
|
|
139
|
+
getVersions() {
|
|
140
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
141
|
+
return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
142
|
+
});
|
|
143
|
+
}
|
|
144
|
+
// Use this function when you want to return the change history for a single record
|
|
145
|
+
getRevisionTimeline() {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
exports.AiRouteRequestApi = AiRouteRequestApi;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { DbProvider, DbProviderOptions, DbGetQueryOptions } from '@d19n/odin-sdk-generator/dist/db.provider';
|
|
2
|
+
import { OdinSearchV2, OdinRecordCreateDto, OdinRecordUpdateDto } from '@d19n/odin-types/dist/core';
|
|
3
|
+
import { AiRouteRequestProperties } from '../entities-v2/AiRouteRequest';
|
|
4
|
+
/**
|
|
5
|
+
* @deprecated Use OdinDbClient.
|
|
6
|
+
*
|
|
7
|
+
* Migration:
|
|
8
|
+
* - Old: new AiRouteRequestApi(authParams).get(id)
|
|
9
|
+
* - New: new odin.airouterequest.get(id)
|
|
10
|
+
*
|
|
11
|
+
* The new OdinDbClient returns typed record wrappers with action methods.
|
|
12
|
+
*
|
|
13
|
+
* Supports separate query options and provider options:
|
|
14
|
+
* - Constructor level: new AiRouteRequestDb(principal, dbService, { omitPermissionsCheck: true })
|
|
15
|
+
* - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
|
|
16
|
+
*/
|
|
17
|
+
export declare class AiRouteRequestDb extends DbProvider {
|
|
18
|
+
protected readonly principal: any;
|
|
19
|
+
protected readonly dbService: any;
|
|
20
|
+
private readonly moduleName;
|
|
21
|
+
private readonly entityName;
|
|
22
|
+
private sourceRecord;
|
|
23
|
+
constructor(principal: any, dbService: any, defaultOptions?: DbProviderOptions);
|
|
24
|
+
setRecord(sourceRecord: any): void;
|
|
25
|
+
/**
|
|
26
|
+
* Search records with manual pagination control
|
|
27
|
+
* @param params - Search parameters
|
|
28
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
29
|
+
*/
|
|
30
|
+
searchRecords(params: Partial<OdinSearchV2>, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>>>;
|
|
31
|
+
/**
|
|
32
|
+
* Search all records with automatic pagination
|
|
33
|
+
* @param params - Search parameters
|
|
34
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
35
|
+
*/
|
|
36
|
+
searchAllRecordsAndPaginate(params: Partial<OdinSearchV2>, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core/interfaces/v2.db.interfaces").OdinSearchResponse<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>>>;
|
|
37
|
+
/**
|
|
38
|
+
* Get a single record by primary key
|
|
39
|
+
* @param aiRouteRequestId - Record ID
|
|
40
|
+
* @param queryOptions - Query options (WHAT: entities to include)
|
|
41
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* // Simple get
|
|
45
|
+
* const record = await db.getByPrimaryKey(id);
|
|
46
|
+
*
|
|
47
|
+
* // With related entities
|
|
48
|
+
* const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
|
|
49
|
+
*
|
|
50
|
+
* // With permissions bypass
|
|
51
|
+
* const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
|
|
52
|
+
*
|
|
53
|
+
* // Both options
|
|
54
|
+
* const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
|
|
55
|
+
*/
|
|
56
|
+
getByPrimaryKey(aiRouteRequestId: string, queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>>;
|
|
57
|
+
/**
|
|
58
|
+
* Get multiple records by primary keys
|
|
59
|
+
* @param aiRouteRequestIds - Array of record IDs
|
|
60
|
+
* @param queryOptions - Query options (WHAT: entities to include)
|
|
61
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
62
|
+
*/
|
|
63
|
+
getManyByPrimaryKey(aiRouteRequestIds: string[], queryOptions?: DbGetQueryOptions, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").OdinRecord<AiRouteRequestProperties>[]>;
|
|
64
|
+
/**
|
|
65
|
+
* Upsert a single record
|
|
66
|
+
* @param upsertDto - Record to upsert
|
|
67
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
68
|
+
*/
|
|
69
|
+
upsert(upsertDto: OdinRecordCreateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
|
|
70
|
+
/**
|
|
71
|
+
* Upsert multiple records
|
|
72
|
+
* @param upsertDtos - Records to upsert
|
|
73
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
74
|
+
*/
|
|
75
|
+
upsertMany(upsertDtos: OdinRecordCreateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
|
|
76
|
+
/**
|
|
77
|
+
* Update a single record
|
|
78
|
+
* @param updateDto - Record to update
|
|
79
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
80
|
+
*/
|
|
81
|
+
update(updateDto: OdinRecordUpdateDto, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes>;
|
|
82
|
+
/**
|
|
83
|
+
* Update multiple records
|
|
84
|
+
* @param updateDtos - Records to update
|
|
85
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
86
|
+
*/
|
|
87
|
+
updateMany(updateDtos: OdinRecordUpdateDto[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
|
|
88
|
+
/**
|
|
89
|
+
* Delete one or many records
|
|
90
|
+
* @param aiRouteRequestIds - Record IDs to delete
|
|
91
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
92
|
+
*/
|
|
93
|
+
delete(aiRouteRequestIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordDeleted[]>;
|
|
94
|
+
/**
|
|
95
|
+
* Restore one or many deleted records
|
|
96
|
+
* @param aiRouteRequestIds - Record IDs to restore
|
|
97
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
98
|
+
*/
|
|
99
|
+
restore(aiRouteRequestIds: string[], providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-sdk-generator").DbRecordRestored[]>;
|
|
100
|
+
/**
|
|
101
|
+
* Apply an action to a record
|
|
102
|
+
* @param actionName - The action key
|
|
103
|
+
* @param dto - The action DTO
|
|
104
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
105
|
+
*/
|
|
106
|
+
applyAction(actionName: string, dto: any, providerOptions?: DbProviderOptions): Promise<import("@d19n/odin-types/dist/core").IDbRecordCreateUpdateRes[]>;
|
|
107
|
+
/**
|
|
108
|
+
* Get version history for the current source record
|
|
109
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
110
|
+
*/
|
|
111
|
+
getVersions(providerOptions?: DbProviderOptions): Promise<any>;
|
|
112
|
+
/**
|
|
113
|
+
* Get revision timeline for the current source record
|
|
114
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
115
|
+
*/
|
|
116
|
+
getRevisionTimeline(providerOptions?: DbProviderOptions): Promise<any>;
|
|
117
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.AiRouteRequestDb = void 0;
|
|
13
|
+
const db_provider_1 = require("@d19n/odin-sdk-generator/dist/db.provider");
|
|
14
|
+
/**
|
|
15
|
+
* @deprecated Use OdinDbClient.
|
|
16
|
+
*
|
|
17
|
+
* Migration:
|
|
18
|
+
* - Old: new AiRouteRequestApi(authParams).get(id)
|
|
19
|
+
* - New: new odin.airouterequest.get(id)
|
|
20
|
+
*
|
|
21
|
+
* The new OdinDbClient returns typed record wrappers with action methods.
|
|
22
|
+
*
|
|
23
|
+
* Supports separate query options and provider options:
|
|
24
|
+
* - Constructor level: new AiRouteRequestDb(principal, dbService, { omitPermissionsCheck: true })
|
|
25
|
+
* - Method level: await db.getByPrimaryKey(id, { entities: [] }, { omitPermissionsCheck: true })
|
|
26
|
+
*/
|
|
27
|
+
class AiRouteRequestDb extends db_provider_1.DbProvider {
|
|
28
|
+
// ============================================
|
|
29
|
+
// PRIVATE BACKING FIELDS (Lazy Loading)
|
|
30
|
+
// ============================================
|
|
31
|
+
constructor(principal, dbService, defaultOptions) {
|
|
32
|
+
super(principal, dbService, defaultOptions);
|
|
33
|
+
this.moduleName = 'SupportModule';
|
|
34
|
+
this.entityName = 'AiRouteRequest';
|
|
35
|
+
this.principal = principal;
|
|
36
|
+
this.dbService = dbService;
|
|
37
|
+
// Link managers are lazy-loaded on first access
|
|
38
|
+
}
|
|
39
|
+
// ============================================
|
|
40
|
+
// LAZY-LOADED LINK MANAGERS (Public Getters)
|
|
41
|
+
// ============================================
|
|
42
|
+
// Usage remains identical: db.address.list(recordId)
|
|
43
|
+
// ============================================
|
|
44
|
+
// STANDARD METHODS
|
|
45
|
+
// ============================================
|
|
46
|
+
// Methods support separate query options and provider options for clean API
|
|
47
|
+
setRecord(sourceRecord) {
|
|
48
|
+
this.sourceRecord = sourceRecord;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Search records with manual pagination control
|
|
52
|
+
* @param params - Search parameters
|
|
53
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
54
|
+
*/
|
|
55
|
+
searchRecords(params, providerOptions) {
|
|
56
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
return yield this._searchRecords(this.moduleName, this.entityName, params, providerOptions);
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Search all records with automatic pagination
|
|
62
|
+
* @param params - Search parameters
|
|
63
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
64
|
+
*/
|
|
65
|
+
searchAllRecordsAndPaginate(params, providerOptions) {
|
|
66
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
67
|
+
return yield this._searchAllRecordsAndPaginate(this.moduleName, this.entityName, params, 0, providerOptions);
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Get a single record by primary key
|
|
72
|
+
* @param aiRouteRequestId - Record ID
|
|
73
|
+
* @param queryOptions - Query options (WHAT: entities to include)
|
|
74
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
75
|
+
*
|
|
76
|
+
* @example
|
|
77
|
+
* // Simple get
|
|
78
|
+
* const record = await db.getByPrimaryKey(id);
|
|
79
|
+
*
|
|
80
|
+
* // With related entities
|
|
81
|
+
* const record = await db.getByPrimaryKey(id, { entities: ['InvoiceItem', 'Transaction'] });
|
|
82
|
+
*
|
|
83
|
+
* // With permissions bypass
|
|
84
|
+
* const record = await db.getByPrimaryKey(id, {}, { omitPermissionsCheck: true });
|
|
85
|
+
*
|
|
86
|
+
* // Both options
|
|
87
|
+
* const record = await db.getByPrimaryKey(id, { entities: ['Invoice'] }, { omitPermissionsCheck: true });
|
|
88
|
+
*/
|
|
89
|
+
getByPrimaryKey(aiRouteRequestId, queryOptions, providerOptions) {
|
|
90
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
91
|
+
const res = yield this._getByPrimaryKey(this.moduleName, this.entityName, aiRouteRequestId, queryOptions, providerOptions);
|
|
92
|
+
if (res)
|
|
93
|
+
this.setRecord(res);
|
|
94
|
+
return res;
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get multiple records by primary keys
|
|
99
|
+
* @param aiRouteRequestIds - Array of record IDs
|
|
100
|
+
* @param queryOptions - Query options (WHAT: entities to include)
|
|
101
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
102
|
+
*/
|
|
103
|
+
getManyByPrimaryKey(aiRouteRequestIds, queryOptions, providerOptions) {
|
|
104
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
105
|
+
return yield this._getManyByPrimaryKey(this.moduleName, this.entityName, aiRouteRequestIds, queryOptions, providerOptions);
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Upsert a single record
|
|
110
|
+
* @param upsertDto - Record to upsert
|
|
111
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
112
|
+
*/
|
|
113
|
+
upsert(upsertDto, providerOptions) {
|
|
114
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
115
|
+
const res = yield this._upsert(this.moduleName, this.entityName, [upsertDto], providerOptions);
|
|
116
|
+
return res[0];
|
|
117
|
+
});
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Upsert multiple records
|
|
121
|
+
* @param upsertDtos - Records to upsert
|
|
122
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
123
|
+
*/
|
|
124
|
+
upsertMany(upsertDtos, providerOptions) {
|
|
125
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
126
|
+
return yield this._upsert(this.moduleName, this.entityName, upsertDtos, providerOptions);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* Update a single record
|
|
131
|
+
* @param updateDto - Record to update
|
|
132
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
133
|
+
*/
|
|
134
|
+
update(updateDto, providerOptions) {
|
|
135
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
136
|
+
const res = yield this._update(this.moduleName, this.entityName, [updateDto], providerOptions);
|
|
137
|
+
return res[0];
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
/**
|
|
141
|
+
* Update multiple records
|
|
142
|
+
* @param updateDtos - Records to update
|
|
143
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
144
|
+
*/
|
|
145
|
+
updateMany(updateDtos, providerOptions) {
|
|
146
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
147
|
+
return yield this._update(this.moduleName, this.entityName, updateDtos, providerOptions);
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
/**
|
|
151
|
+
* Delete one or many records
|
|
152
|
+
* @param aiRouteRequestIds - Record IDs to delete
|
|
153
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
154
|
+
*/
|
|
155
|
+
delete(aiRouteRequestIds, providerOptions) {
|
|
156
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
157
|
+
return yield this._delete(this.moduleName, this.entityName, aiRouteRequestIds, providerOptions);
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* Restore one or many deleted records
|
|
162
|
+
* @param aiRouteRequestIds - Record IDs to restore
|
|
163
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
164
|
+
*/
|
|
165
|
+
restore(aiRouteRequestIds, providerOptions) {
|
|
166
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
167
|
+
return yield this._restore(this.moduleName, this.entityName, aiRouteRequestIds, providerOptions);
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/**
|
|
171
|
+
* Apply an action to a record
|
|
172
|
+
* @param actionName - The action key
|
|
173
|
+
* @param dto - The action DTO
|
|
174
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
175
|
+
*/
|
|
176
|
+
applyAction(actionName, dto, providerOptions) {
|
|
177
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
+
return yield this._applyAction(this.moduleName, this.entityName, dto, providerOptions);
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Get version history for the current source record
|
|
183
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
184
|
+
*/
|
|
185
|
+
getVersions(providerOptions) {
|
|
186
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
187
|
+
return yield this._getVersions(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
|
|
188
|
+
});
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* Get revision timeline for the current source record
|
|
192
|
+
* @param providerOptions - Provider options (HOW: omitPermissionsCheck)
|
|
193
|
+
*/
|
|
194
|
+
getRevisionTimeline(providerOptions) {
|
|
195
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
196
|
+
return yield this._getRevisionTimeline(this.moduleName, this.entityName, this.sourceRecord.id, providerOptions);
|
|
197
|
+
});
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
exports.AiRouteRequestDb = AiRouteRequestDb;
|
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AiRouteRequest Entity Definition
|
|
3
|
+
*
|
|
4
|
+
* One AI request handled by the AI provider router: the feature, the model that answered (Qwen or Databricks), tries, latency and outcome. Written by youfibre-api-support after every routed request; read by the AI traffic dashboard. Not edited by people.
|
|
5
|
+
*
|
|
6
|
+
* @module SupportModule
|
|
7
|
+
* @entity AiRouteRequest
|
|
8
|
+
* @schemaId 6e672d1d-d7c4-401d-8bcc-042b208664d6
|
|
9
|
+
*
|
|
10
|
+
* AUTO-GENERATED - DO NOT EDIT DIRECTLY
|
|
11
|
+
* Generated from Odin schema definition
|
|
12
|
+
*/
|
|
13
|
+
import { OdinRecord } from '@d19n/odin-types/dist/core';
|
|
14
|
+
/**
|
|
15
|
+
* Available types for AiRouteRequest records
|
|
16
|
+
*/
|
|
17
|
+
export declare enum AiRouteRequestEntityTypes {
|
|
18
|
+
/** This is the default record type */
|
|
19
|
+
DEFAULT = "DEFAULT"
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Valid values for AiRouteRequest.Feature
|
|
23
|
+
*
|
|
24
|
+
* Which AI feature made the request.
|
|
25
|
+
*
|
|
26
|
+
* @remarks Available options:
|
|
27
|
+
* - `CASE_SENTIMENT`
|
|
28
|
+
* - `CASE_TAGGING`
|
|
29
|
+
* - `CBO_FINAL_BILL_CHECK`
|
|
30
|
+
* - `CHAT_SUMMARY`
|
|
31
|
+
* - `CUSTOMER_CONTEXT_SUMMARY`
|
|
32
|
+
* - `DOCUMENT_DESCRIBE`
|
|
33
|
+
* - `EDGAR_CHAT`
|
|
34
|
+
* - `INSTALL_FORM_REVIEW`
|
|
35
|
+
* - `MAGRATHEA_PORTING`
|
|
36
|
+
* - `QA_REPORT`
|
|
37
|
+
*/
|
|
38
|
+
export declare enum AiRouteRequestFeature {
|
|
39
|
+
CASE_SENTIMENT = "CASE_SENTIMENT",
|
|
40
|
+
CASE_TAGGING = "CASE_TAGGING",
|
|
41
|
+
CBO_FINAL_BILL_CHECK = "CBO_FINAL_BILL_CHECK",
|
|
42
|
+
CHAT_SUMMARY = "CHAT_SUMMARY",
|
|
43
|
+
CUSTOMER_CONTEXT_SUMMARY = "CUSTOMER_CONTEXT_SUMMARY",
|
|
44
|
+
DOCUMENT_DESCRIBE = "DOCUMENT_DESCRIBE",
|
|
45
|
+
EDGAR_CHAT = "EDGAR_CHAT",
|
|
46
|
+
INSTALL_FORM_REVIEW = "INSTALL_FORM_REVIEW",
|
|
47
|
+
MAGRATHEA_PORTING = "MAGRATHEA_PORTING",
|
|
48
|
+
QA_REPORT = "QA_REPORT"
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Valid values for AiRouteRequest.Provider
|
|
52
|
+
*
|
|
53
|
+
* The model that answered: qwen (Kattuz) or databricks.
|
|
54
|
+
*
|
|
55
|
+
* @remarks Available options:
|
|
56
|
+
* - `databricks`
|
|
57
|
+
* - `qwen`
|
|
58
|
+
*/
|
|
59
|
+
export declare enum AiRouteRequestProvider {
|
|
60
|
+
DATABRICKS = "databricks",
|
|
61
|
+
QWEN = "qwen"
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Valid values for AiRouteRequest.Outcome
|
|
65
|
+
*
|
|
66
|
+
* ok when the provider answered and the reply passed its check; failed after the last try.
|
|
67
|
+
*
|
|
68
|
+
* @remarks Available options:
|
|
69
|
+
* - `failed`
|
|
70
|
+
* - `ok`
|
|
71
|
+
*/
|
|
72
|
+
export declare enum AiRouteRequestOutcome {
|
|
73
|
+
FAILED = "failed",
|
|
74
|
+
OK = "ok"
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Valid values for AiRouteRequest.Reason
|
|
78
|
+
*
|
|
79
|
+
* split: the 50/50 counter chose. Otherwise why the split was skipped and Databricks answered: config-off, config-unreadable, redis-unavailable, too-large (prompt over the Qwen size guard). single-provider: the feature has one provider, no split. edgar-reply: a message Edgar AI posted, no call of ours to time.
|
|
80
|
+
*
|
|
81
|
+
* @remarks Available options:
|
|
82
|
+
* - `config-off`
|
|
83
|
+
* - `config-unreadable`
|
|
84
|
+
* - `edgar-reply`
|
|
85
|
+
* - `redis-unavailable`
|
|
86
|
+
* - `single-provider`
|
|
87
|
+
* - `split`
|
|
88
|
+
* - `too-large`
|
|
89
|
+
*/
|
|
90
|
+
export declare enum AiRouteRequestReason {
|
|
91
|
+
CONFIG_OFF = "config-off",
|
|
92
|
+
CONFIG_UNREADABLE = "config-unreadable",
|
|
93
|
+
EDGAR_REPLY = "edgar-reply",
|
|
94
|
+
REDIS_UNAVAILABLE = "redis-unavailable",
|
|
95
|
+
SINGLE_PROVIDER = "single-provider",
|
|
96
|
+
SPLIT = "split",
|
|
97
|
+
TOO_LARGE = "too-large"
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Property keys for AiRouteRequest
|
|
101
|
+
* Use these constants instead of string literals for type safety
|
|
102
|
+
*/
|
|
103
|
+
export declare enum AiRouteRequestPropertyKeys {
|
|
104
|
+
/** Which AI feature made the request. */
|
|
105
|
+
Feature = "Feature",
|
|
106
|
+
/** The model that answered: qwen (Kattuz) or databricks. */
|
|
107
|
+
Provider = "Provider",
|
|
108
|
+
/** ok when the provider answered and the reply passed its check; failed after the last try. */
|
|
109
|
+
Outcome = "Outcome",
|
|
110
|
+
/** The per-feature counter value this request drew (odd = qwen, even = databricks). Empty when the split was skipped. */
|
|
111
|
+
Count = "Count",
|
|
112
|
+
/** 1 for Databricks; 1 to 6 for Qwen (one try plus up to five retries). */
|
|
113
|
+
Attempts = "Attempts",
|
|
114
|
+
/** Wall time of the whole request including retries, in milliseconds. */
|
|
115
|
+
LatencyMs = "LatencyMs",
|
|
116
|
+
/** true for a request a person is waiting for (one Qwen try); false for background work (retried). */
|
|
117
|
+
OnScreen = "OnScreen",
|
|
118
|
+
/** Characters sent to the model. Filled for Qwen turns; empty for Databricks turns until the proxy reports it. */
|
|
119
|
+
PromptChars = "PromptChars",
|
|
120
|
+
/** llm_endpoint_used from the result, e.g. Qwen3.8-27B-FP8 or system.ai.gpt-5-4-nano. Empty on failure. */
|
|
121
|
+
ModelUsed = "ModelUsed",
|
|
122
|
+
/** First 500 characters of the failure message. Empty on success. */
|
|
123
|
+
ErrorMessage = "ErrorMessage",
|
|
124
|
+
/** Case or Conversation. */
|
|
125
|
+
JourneyEntity = "JourneyEntity",
|
|
126
|
+
/** Id of the case or conversation the request was for. Links the row back to the record. */
|
|
127
|
+
JourneyId = "JourneyId",
|
|
128
|
+
/** When the router started the request. The record is written a few hundred milliseconds later. */
|
|
129
|
+
StartedAt = "StartedAt",
|
|
130
|
+
/** split: the 50/50 counter chose. Otherwise why the split was skipped and Databricks answered: config-off, config-unreadable, redis-unavailable, too-large (prompt over the Qwen size guard). single-provider: the feature has one provider, no split. edgar-reply: a message Edgar AI posted, no call of ours to time. */
|
|
131
|
+
Reason = "Reason"
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Properties for AiRouteRequest records
|
|
135
|
+
*
|
|
136
|
+
* @see SupportModule:AiRouteRequest
|
|
137
|
+
*/
|
|
138
|
+
export interface AiRouteRequestProperties {
|
|
139
|
+
/** Which AI feature made the request.
|
|
140
|
+
*
|
|
141
|
+
* @type {ENUM}
|
|
142
|
+
* @default
|
|
143
|
+
* @enum {AiRouteRequestFeature}
|
|
144
|
+
*/
|
|
145
|
+
Feature: AiRouteRequestFeature;
|
|
146
|
+
/** The model that answered: qwen (Kattuz) or databricks.
|
|
147
|
+
*
|
|
148
|
+
* @type {ENUM}
|
|
149
|
+
* @default
|
|
150
|
+
* @enum {AiRouteRequestProvider}
|
|
151
|
+
*/
|
|
152
|
+
Provider: AiRouteRequestProvider;
|
|
153
|
+
/** ok when the provider answered and the reply passed its check; failed after the last try.
|
|
154
|
+
*
|
|
155
|
+
* @type {ENUM}
|
|
156
|
+
* @default
|
|
157
|
+
* @enum {AiRouteRequestOutcome}
|
|
158
|
+
*/
|
|
159
|
+
Outcome: AiRouteRequestOutcome;
|
|
160
|
+
/** The per-feature counter value this request drew (odd = qwen, even = databricks). Empty when the split was skipped.
|
|
161
|
+
*
|
|
162
|
+
* @type {NUMBER}
|
|
163
|
+
* @default
|
|
164
|
+
*/
|
|
165
|
+
Count: number;
|
|
166
|
+
/** 1 for Databricks; 1 to 6 for Qwen (one try plus up to five retries).
|
|
167
|
+
*
|
|
168
|
+
* @type {NUMBER}
|
|
169
|
+
* @default
|
|
170
|
+
*/
|
|
171
|
+
Attempts: number;
|
|
172
|
+
/** Wall time of the whole request including retries, in milliseconds.
|
|
173
|
+
*
|
|
174
|
+
* @type {NUMBER}
|
|
175
|
+
* @default
|
|
176
|
+
*/
|
|
177
|
+
LatencyMs: number;
|
|
178
|
+
/** true for a request a person is waiting for (one Qwen try); false for background work (retried).
|
|
179
|
+
*
|
|
180
|
+
* @type {BOOLEAN}
|
|
181
|
+
* @default
|
|
182
|
+
*/
|
|
183
|
+
OnScreen: boolean;
|
|
184
|
+
/** Characters sent to the model. Filled for Qwen turns; empty for Databricks turns until the proxy reports it.
|
|
185
|
+
*
|
|
186
|
+
* @type {NUMBER}
|
|
187
|
+
* @default
|
|
188
|
+
*/
|
|
189
|
+
PromptChars: number;
|
|
190
|
+
/** llm_endpoint_used from the result, e.g. Qwen3.8-27B-FP8 or system.ai.gpt-5-4-nano. Empty on failure.
|
|
191
|
+
*
|
|
192
|
+
* @type {TEXT}
|
|
193
|
+
* @default
|
|
194
|
+
*/
|
|
195
|
+
ModelUsed: string;
|
|
196
|
+
/** First 500 characters of the failure message. Empty on success.
|
|
197
|
+
*
|
|
198
|
+
* @type {TEXT}
|
|
199
|
+
* @default
|
|
200
|
+
*/
|
|
201
|
+
ErrorMessage: string;
|
|
202
|
+
/** Case or Conversation.
|
|
203
|
+
*
|
|
204
|
+
* @type {TEXT}
|
|
205
|
+
* @default
|
|
206
|
+
*/
|
|
207
|
+
JourneyEntity: string;
|
|
208
|
+
/** Id of the case or conversation the request was for. Links the row back to the record.
|
|
209
|
+
*
|
|
210
|
+
* @type {TEXT}
|
|
211
|
+
* @default
|
|
212
|
+
*/
|
|
213
|
+
JourneyId: string;
|
|
214
|
+
/** When the router started the request. The record is written a few hundred milliseconds later.
|
|
215
|
+
*
|
|
216
|
+
* @type {DATE_TIME}
|
|
217
|
+
* @default
|
|
218
|
+
*/
|
|
219
|
+
StartedAt: string;
|
|
220
|
+
/** split: the 50/50 counter chose. Otherwise why the split was skipped and Databricks answered: config-off, config-unreadable, redis-unavailable, too-large (prompt over the Qwen size guard). single-provider: the feature has one provider, no split. edgar-reply: a message Edgar AI posted, no call of ours to time.
|
|
221
|
+
*
|
|
222
|
+
* @type {ENUM}
|
|
223
|
+
* @default
|
|
224
|
+
* @enum {AiRouteRequestReason}
|
|
225
|
+
*/
|
|
226
|
+
Reason: AiRouteRequestReason;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* AiRouteRequest entity from SupportModule
|
|
230
|
+
*
|
|
231
|
+
* One AI request handled by the AI provider router: the feature, the model that answered (Qwen or Databricks), tries, latency and outcome. Written by youfibre-api-support after every routed request; read by the AI traffic dashboard. Not edited by people.
|
|
232
|
+
*
|
|
233
|
+
* @module SupportModule
|
|
234
|
+
* @entity AiRouteRequest
|
|
235
|
+
* @schemaId 6e672d1d-d7c4-401d-8bcc-042b208664d6
|
|
236
|
+
* @recordPrefix AIR
|
|
237
|
+
* @capabilities searchable, updateable, undeletable, triggerable
|
|
238
|
+
*/
|
|
239
|
+
export declare class AiRouteRequest extends OdinRecord<AiRouteRequestProperties> {
|
|
240
|
+
entity: 'SupportModule:AiRouteRequest';
|
|
241
|
+
type: AiRouteRequestEntityTypes;
|
|
242
|
+
schemaId: '6e672d1d-d7c4-401d-8bcc-042b208664d6';
|
|
243
|
+
properties: AiRouteRequestProperties;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* RabbitMQ routing keys for AiRouteRequest events
|
|
247
|
+
*/
|
|
248
|
+
export declare const ROUTING_KEY_AI_ROUTE_REQUEST_CREATED = "SupportModule.AiRouteRequest.SubDbRecordCreated";
|
|
249
|
+
export declare const ROUTING_KEY_AI_ROUTE_REQUEST_UPDATED = "SupportModule.AiRouteRequest.SubDbRecordUpdated";
|
|
250
|
+
export declare const ROUTING_KEY_AI_ROUTE_REQUEST_DELETED = "SupportModule.AiRouteRequest.SubDbRecordDeleted";
|
|
251
|
+
/**
|
|
252
|
+
* Type-specific routing keys for AiRouteRequest events
|
|
253
|
+
* Subscribe to these for events on specific entity types only
|
|
254
|
+
*/
|
|
255
|
+
/** This is the default record type created */
|
|
256
|
+
export declare const ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_CREATED = "SupportModule.AiRouteRequest.DEFAULT.SubDbRecordCreated";
|
|
257
|
+
/** This is the default record type updated */
|
|
258
|
+
export declare const ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_UPDATED = "SupportModule.AiRouteRequest.DEFAULT.SubDbRecordUpdated";
|
|
259
|
+
/** This is the default record type deleted */
|
|
260
|
+
export declare const ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_DELETED = "SupportModule.AiRouteRequest.DEFAULT.SubDbRecordDeleted";
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* AiRouteRequest Entity Definition
|
|
4
|
+
*
|
|
5
|
+
* One AI request handled by the AI provider router: the feature, the model that answered (Qwen or Databricks), tries, latency and outcome. Written by youfibre-api-support after every routed request; read by the AI traffic dashboard. Not edited by people.
|
|
6
|
+
*
|
|
7
|
+
* @module SupportModule
|
|
8
|
+
* @entity AiRouteRequest
|
|
9
|
+
* @schemaId 6e672d1d-d7c4-401d-8bcc-042b208664d6
|
|
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_AI_ROUTE_REQUEST_DEFAULT_DELETED = exports.ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_UPDATED = exports.ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_CREATED = exports.ROUTING_KEY_AI_ROUTE_REQUEST_DELETED = exports.ROUTING_KEY_AI_ROUTE_REQUEST_UPDATED = exports.ROUTING_KEY_AI_ROUTE_REQUEST_CREATED = exports.AiRouteRequest = exports.AiRouteRequestPropertyKeys = exports.AiRouteRequestReason = exports.AiRouteRequestOutcome = exports.AiRouteRequestProvider = exports.AiRouteRequestFeature = exports.AiRouteRequestEntityTypes = void 0;
|
|
16
|
+
const core_1 = require("@d19n/odin-types/dist/core");
|
|
17
|
+
/**
|
|
18
|
+
* Available types for AiRouteRequest records
|
|
19
|
+
*/
|
|
20
|
+
var AiRouteRequestEntityTypes;
|
|
21
|
+
(function (AiRouteRequestEntityTypes) {
|
|
22
|
+
/** This is the default record type */
|
|
23
|
+
AiRouteRequestEntityTypes["DEFAULT"] = "DEFAULT";
|
|
24
|
+
})(AiRouteRequestEntityTypes = exports.AiRouteRequestEntityTypes || (exports.AiRouteRequestEntityTypes = {}));
|
|
25
|
+
/**
|
|
26
|
+
* Valid values for AiRouteRequest.Feature
|
|
27
|
+
*
|
|
28
|
+
* Which AI feature made the request.
|
|
29
|
+
*
|
|
30
|
+
* @remarks Available options:
|
|
31
|
+
* - `CASE_SENTIMENT`
|
|
32
|
+
* - `CASE_TAGGING`
|
|
33
|
+
* - `CBO_FINAL_BILL_CHECK`
|
|
34
|
+
* - `CHAT_SUMMARY`
|
|
35
|
+
* - `CUSTOMER_CONTEXT_SUMMARY`
|
|
36
|
+
* - `DOCUMENT_DESCRIBE`
|
|
37
|
+
* - `EDGAR_CHAT`
|
|
38
|
+
* - `INSTALL_FORM_REVIEW`
|
|
39
|
+
* - `MAGRATHEA_PORTING`
|
|
40
|
+
* - `QA_REPORT`
|
|
41
|
+
*/
|
|
42
|
+
var AiRouteRequestFeature;
|
|
43
|
+
(function (AiRouteRequestFeature) {
|
|
44
|
+
AiRouteRequestFeature["CASE_SENTIMENT"] = "CASE_SENTIMENT";
|
|
45
|
+
AiRouteRequestFeature["CASE_TAGGING"] = "CASE_TAGGING";
|
|
46
|
+
AiRouteRequestFeature["CBO_FINAL_BILL_CHECK"] = "CBO_FINAL_BILL_CHECK";
|
|
47
|
+
AiRouteRequestFeature["CHAT_SUMMARY"] = "CHAT_SUMMARY";
|
|
48
|
+
AiRouteRequestFeature["CUSTOMER_CONTEXT_SUMMARY"] = "CUSTOMER_CONTEXT_SUMMARY";
|
|
49
|
+
AiRouteRequestFeature["DOCUMENT_DESCRIBE"] = "DOCUMENT_DESCRIBE";
|
|
50
|
+
AiRouteRequestFeature["EDGAR_CHAT"] = "EDGAR_CHAT";
|
|
51
|
+
AiRouteRequestFeature["INSTALL_FORM_REVIEW"] = "INSTALL_FORM_REVIEW";
|
|
52
|
+
AiRouteRequestFeature["MAGRATHEA_PORTING"] = "MAGRATHEA_PORTING";
|
|
53
|
+
AiRouteRequestFeature["QA_REPORT"] = "QA_REPORT";
|
|
54
|
+
})(AiRouteRequestFeature = exports.AiRouteRequestFeature || (exports.AiRouteRequestFeature = {}));
|
|
55
|
+
/**
|
|
56
|
+
* Valid values for AiRouteRequest.Provider
|
|
57
|
+
*
|
|
58
|
+
* The model that answered: qwen (Kattuz) or databricks.
|
|
59
|
+
*
|
|
60
|
+
* @remarks Available options:
|
|
61
|
+
* - `databricks`
|
|
62
|
+
* - `qwen`
|
|
63
|
+
*/
|
|
64
|
+
var AiRouteRequestProvider;
|
|
65
|
+
(function (AiRouteRequestProvider) {
|
|
66
|
+
AiRouteRequestProvider["DATABRICKS"] = "databricks";
|
|
67
|
+
AiRouteRequestProvider["QWEN"] = "qwen";
|
|
68
|
+
})(AiRouteRequestProvider = exports.AiRouteRequestProvider || (exports.AiRouteRequestProvider = {}));
|
|
69
|
+
/**
|
|
70
|
+
* Valid values for AiRouteRequest.Outcome
|
|
71
|
+
*
|
|
72
|
+
* ok when the provider answered and the reply passed its check; failed after the last try.
|
|
73
|
+
*
|
|
74
|
+
* @remarks Available options:
|
|
75
|
+
* - `failed`
|
|
76
|
+
* - `ok`
|
|
77
|
+
*/
|
|
78
|
+
var AiRouteRequestOutcome;
|
|
79
|
+
(function (AiRouteRequestOutcome) {
|
|
80
|
+
AiRouteRequestOutcome["FAILED"] = "failed";
|
|
81
|
+
AiRouteRequestOutcome["OK"] = "ok";
|
|
82
|
+
})(AiRouteRequestOutcome = exports.AiRouteRequestOutcome || (exports.AiRouteRequestOutcome = {}));
|
|
83
|
+
/**
|
|
84
|
+
* Valid values for AiRouteRequest.Reason
|
|
85
|
+
*
|
|
86
|
+
* split: the 50/50 counter chose. Otherwise why the split was skipped and Databricks answered: config-off, config-unreadable, redis-unavailable, too-large (prompt over the Qwen size guard). single-provider: the feature has one provider, no split. edgar-reply: a message Edgar AI posted, no call of ours to time.
|
|
87
|
+
*
|
|
88
|
+
* @remarks Available options:
|
|
89
|
+
* - `config-off`
|
|
90
|
+
* - `config-unreadable`
|
|
91
|
+
* - `edgar-reply`
|
|
92
|
+
* - `redis-unavailable`
|
|
93
|
+
* - `single-provider`
|
|
94
|
+
* - `split`
|
|
95
|
+
* - `too-large`
|
|
96
|
+
*/
|
|
97
|
+
var AiRouteRequestReason;
|
|
98
|
+
(function (AiRouteRequestReason) {
|
|
99
|
+
AiRouteRequestReason["CONFIG_OFF"] = "config-off";
|
|
100
|
+
AiRouteRequestReason["CONFIG_UNREADABLE"] = "config-unreadable";
|
|
101
|
+
AiRouteRequestReason["EDGAR_REPLY"] = "edgar-reply";
|
|
102
|
+
AiRouteRequestReason["REDIS_UNAVAILABLE"] = "redis-unavailable";
|
|
103
|
+
AiRouteRequestReason["SINGLE_PROVIDER"] = "single-provider";
|
|
104
|
+
AiRouteRequestReason["SPLIT"] = "split";
|
|
105
|
+
AiRouteRequestReason["TOO_LARGE"] = "too-large";
|
|
106
|
+
})(AiRouteRequestReason = exports.AiRouteRequestReason || (exports.AiRouteRequestReason = {}));
|
|
107
|
+
/**
|
|
108
|
+
* Property keys for AiRouteRequest
|
|
109
|
+
* Use these constants instead of string literals for type safety
|
|
110
|
+
*/
|
|
111
|
+
var AiRouteRequestPropertyKeys;
|
|
112
|
+
(function (AiRouteRequestPropertyKeys) {
|
|
113
|
+
/** Which AI feature made the request. */
|
|
114
|
+
AiRouteRequestPropertyKeys["Feature"] = "Feature";
|
|
115
|
+
/** The model that answered: qwen (Kattuz) or databricks. */
|
|
116
|
+
AiRouteRequestPropertyKeys["Provider"] = "Provider";
|
|
117
|
+
/** ok when the provider answered and the reply passed its check; failed after the last try. */
|
|
118
|
+
AiRouteRequestPropertyKeys["Outcome"] = "Outcome";
|
|
119
|
+
/** The per-feature counter value this request drew (odd = qwen, even = databricks). Empty when the split was skipped. */
|
|
120
|
+
AiRouteRequestPropertyKeys["Count"] = "Count";
|
|
121
|
+
/** 1 for Databricks; 1 to 6 for Qwen (one try plus up to five retries). */
|
|
122
|
+
AiRouteRequestPropertyKeys["Attempts"] = "Attempts";
|
|
123
|
+
/** Wall time of the whole request including retries, in milliseconds. */
|
|
124
|
+
AiRouteRequestPropertyKeys["LatencyMs"] = "LatencyMs";
|
|
125
|
+
/** true for a request a person is waiting for (one Qwen try); false for background work (retried). */
|
|
126
|
+
AiRouteRequestPropertyKeys["OnScreen"] = "OnScreen";
|
|
127
|
+
/** Characters sent to the model. Filled for Qwen turns; empty for Databricks turns until the proxy reports it. */
|
|
128
|
+
AiRouteRequestPropertyKeys["PromptChars"] = "PromptChars";
|
|
129
|
+
/** llm_endpoint_used from the result, e.g. Qwen3.8-27B-FP8 or system.ai.gpt-5-4-nano. Empty on failure. */
|
|
130
|
+
AiRouteRequestPropertyKeys["ModelUsed"] = "ModelUsed";
|
|
131
|
+
/** First 500 characters of the failure message. Empty on success. */
|
|
132
|
+
AiRouteRequestPropertyKeys["ErrorMessage"] = "ErrorMessage";
|
|
133
|
+
/** Case or Conversation. */
|
|
134
|
+
AiRouteRequestPropertyKeys["JourneyEntity"] = "JourneyEntity";
|
|
135
|
+
/** Id of the case or conversation the request was for. Links the row back to the record. */
|
|
136
|
+
AiRouteRequestPropertyKeys["JourneyId"] = "JourneyId";
|
|
137
|
+
/** When the router started the request. The record is written a few hundred milliseconds later. */
|
|
138
|
+
AiRouteRequestPropertyKeys["StartedAt"] = "StartedAt";
|
|
139
|
+
/** split: the 50/50 counter chose. Otherwise why the split was skipped and Databricks answered: config-off, config-unreadable, redis-unavailable, too-large (prompt over the Qwen size guard). single-provider: the feature has one provider, no split. edgar-reply: a message Edgar AI posted, no call of ours to time. */
|
|
140
|
+
AiRouteRequestPropertyKeys["Reason"] = "Reason";
|
|
141
|
+
})(AiRouteRequestPropertyKeys = exports.AiRouteRequestPropertyKeys || (exports.AiRouteRequestPropertyKeys = {}));
|
|
142
|
+
/**
|
|
143
|
+
* AiRouteRequest entity from SupportModule
|
|
144
|
+
*
|
|
145
|
+
* One AI request handled by the AI provider router: the feature, the model that answered (Qwen or Databricks), tries, latency and outcome. Written by youfibre-api-support after every routed request; read by the AI traffic dashboard. Not edited by people.
|
|
146
|
+
*
|
|
147
|
+
* @module SupportModule
|
|
148
|
+
* @entity AiRouteRequest
|
|
149
|
+
* @schemaId 6e672d1d-d7c4-401d-8bcc-042b208664d6
|
|
150
|
+
* @recordPrefix AIR
|
|
151
|
+
* @capabilities searchable, updateable, undeletable, triggerable
|
|
152
|
+
*/
|
|
153
|
+
class AiRouteRequest extends core_1.OdinRecord {
|
|
154
|
+
}
|
|
155
|
+
exports.AiRouteRequest = AiRouteRequest;
|
|
156
|
+
// ============================================
|
|
157
|
+
// RABBITMQ EVENT ROUTING KEYS
|
|
158
|
+
// ============================================
|
|
159
|
+
/**
|
|
160
|
+
* RabbitMQ routing keys for AiRouteRequest events
|
|
161
|
+
*/
|
|
162
|
+
exports.ROUTING_KEY_AI_ROUTE_REQUEST_CREATED = 'SupportModule.AiRouteRequest.SubDbRecordCreated';
|
|
163
|
+
exports.ROUTING_KEY_AI_ROUTE_REQUEST_UPDATED = 'SupportModule.AiRouteRequest.SubDbRecordUpdated';
|
|
164
|
+
exports.ROUTING_KEY_AI_ROUTE_REQUEST_DELETED = 'SupportModule.AiRouteRequest.SubDbRecordDeleted';
|
|
165
|
+
/**
|
|
166
|
+
* Type-specific routing keys for AiRouteRequest events
|
|
167
|
+
* Subscribe to these for events on specific entity types only
|
|
168
|
+
*/
|
|
169
|
+
/** This is the default record type created */
|
|
170
|
+
exports.ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_CREATED = 'SupportModule.AiRouteRequest.DEFAULT.SubDbRecordCreated';
|
|
171
|
+
/** This is the default record type updated */
|
|
172
|
+
exports.ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_UPDATED = 'SupportModule.AiRouteRequest.DEFAULT.SubDbRecordUpdated';
|
|
173
|
+
/** This is the default record type deleted */
|
|
174
|
+
exports.ROUTING_KEY_AI_ROUTE_REQUEST_DEFAULT_DELETED = 'SupportModule.AiRouteRequest.DEFAULT.SubDbRecordDeleted';
|