@iblai/data-layer 1.12.5 → 1.12.7
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/dist/index.d.ts +3488 -58
- package/dist/index.esm.js +353 -17
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +382 -16
- package/dist/index.js.map +1 -1
- package/dist/package.json +1 -1
- package/dist/src/features/agent-skills/api-slice.d.ts +39 -39
- package/dist/src/features/billing/constants.d.ts +4 -0
- package/dist/src/features/billing/custom-api-slice.d.ts +135 -2
- package/dist/src/features/billing/types.d.ts +33 -0
- package/dist/src/features/notifications/__tests__/notifications-templates.test.d.ts +1 -0
- package/dist/src/features/notifications/constants.d.ts +9 -0
- package/dist/src/features/notifications/custom-api-slice.d.ts +391 -0
- package/dist/src/features/notifications/types.d.ts +96 -5
- package/dist/src/features/spend-caps/api-slice.d.ts +2554 -0
- package/dist/src/features/spend-caps/constants.d.ts +66 -0
- package/dist/src/features/spend-caps/index.d.ts +4 -0
- package/dist/src/features/spend-caps/types.d.ts +121 -0
- package/dist/src/features/spend-caps/utils.d.ts +12 -0
- package/dist/src/index.d.ts +4 -0
- package/dist/tests/features/spend-caps/api-slice.test.d.ts +1 -0
- package/dist/tests/features/spend-caps/constants.test.d.ts +1 -0
- package/dist/tests/features/spend-caps/index.test.d.ts +1 -0
- package/dist/tests/features/spend-caps/types.test.d.ts +1 -0
- package/dist/tests/features/spend-caps/utils.test.d.ts +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { SERVICES } from '@data-layer/constants';
|
|
2
|
+
export declare const SPEND_CAPS_REDUCER_PATH = "spendCapsApiSlice";
|
|
3
|
+
/**
|
|
4
|
+
* Error code returned (HTTP 429 body / WebSocket frame) when a hard-block
|
|
5
|
+
* spend cap is exceeded. Distinguishes a spend-cap block from a genuine
|
|
6
|
+
* provider rate limit, which also uses status 429.
|
|
7
|
+
*/
|
|
8
|
+
export declare const SPEND_CAP_EXCEEDED_ERROR_CODE = "spend_cap_exceeded";
|
|
9
|
+
export declare const SPEND_CAPS_ENDPOINTS: {
|
|
10
|
+
GET_TENANT_SPEND_CAP: {
|
|
11
|
+
service: SERVICES;
|
|
12
|
+
path: (org: string) => string;
|
|
13
|
+
};
|
|
14
|
+
UPSERT_TENANT_SPEND_CAP: {
|
|
15
|
+
service: SERVICES;
|
|
16
|
+
path: (org: string) => string;
|
|
17
|
+
};
|
|
18
|
+
DELETE_TENANT_SPEND_CAP: {
|
|
19
|
+
service: SERVICES;
|
|
20
|
+
path: (org: string) => string;
|
|
21
|
+
};
|
|
22
|
+
LIST_AGENT_SPEND_CAPS: {
|
|
23
|
+
service: SERVICES;
|
|
24
|
+
path: (org: string) => string;
|
|
25
|
+
};
|
|
26
|
+
GET_AGENT_SPEND_CAP: {
|
|
27
|
+
service: SERVICES;
|
|
28
|
+
path: (org: string, mentorId: string) => string;
|
|
29
|
+
};
|
|
30
|
+
UPSERT_AGENT_SPEND_CAP: {
|
|
31
|
+
service: SERVICES;
|
|
32
|
+
path: (org: string, mentorId: string) => string;
|
|
33
|
+
};
|
|
34
|
+
DELETE_AGENT_SPEND_CAP: {
|
|
35
|
+
service: SERVICES;
|
|
36
|
+
path: (org: string, mentorId: string) => string;
|
|
37
|
+
};
|
|
38
|
+
LIST_AGENT_USER_SPEND_CAPS: {
|
|
39
|
+
service: SERVICES;
|
|
40
|
+
path: (org: string, mentorId: string) => string;
|
|
41
|
+
};
|
|
42
|
+
GET_USER_SPEND_CAP: {
|
|
43
|
+
service: SERVICES;
|
|
44
|
+
path: (org: string, mentorId: string, username: string) => string;
|
|
45
|
+
};
|
|
46
|
+
UPSERT_USER_SPEND_CAP: {
|
|
47
|
+
service: SERVICES;
|
|
48
|
+
path: (org: string, mentorId: string, username: string) => string;
|
|
49
|
+
};
|
|
50
|
+
DELETE_USER_SPEND_CAP: {
|
|
51
|
+
service: SERVICES;
|
|
52
|
+
path: (org: string, mentorId: string, username: string) => string;
|
|
53
|
+
};
|
|
54
|
+
GET_SPEND_CAP_STATUS: {
|
|
55
|
+
service: SERVICES;
|
|
56
|
+
path: (org: string, userId: string) => string;
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export declare const SPEND_CAPS_QUERY_KEYS: {
|
|
60
|
+
readonly TENANT_SPEND_CAP: "TENANT_SPEND_CAP";
|
|
61
|
+
readonly AGENT_SPEND_CAP: "AGENT_SPEND_CAP";
|
|
62
|
+
readonly AGENT_SPEND_CAPS_LIST: "AGENT_SPEND_CAPS_LIST";
|
|
63
|
+
readonly AGENT_USER_SPEND_CAPS: "AGENT_USER_SPEND_CAPS";
|
|
64
|
+
readonly USER_SPEND_CAP: "USER_SPEND_CAP";
|
|
65
|
+
readonly SPEND_CAP_STATUS: "SPEND_CAP_STATUS";
|
|
66
|
+
};
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { SPEND_CAP_EXCEEDED_ERROR_CODE } from './constants';
|
|
2
|
+
export type SpendCapScope = 'tenant' | 'agent' | 'user_agent';
|
|
3
|
+
export type SpendCapIntervalType = 'day' | 'week' | 'month' | 'year';
|
|
4
|
+
export type SpendCapEnforcement = 'block' | 'alert_only';
|
|
5
|
+
export interface SpendCap {
|
|
6
|
+
id: number;
|
|
7
|
+
scope: SpendCapScope;
|
|
8
|
+
platform_key: string;
|
|
9
|
+
mentor_unique_id: string | null;
|
|
10
|
+
/** Agent display name — present on agent-scoped caps from the list endpoint. */
|
|
11
|
+
mentor_name?: string | null;
|
|
12
|
+
username: string | null;
|
|
13
|
+
/** User email — present on user-per-agent caps. */
|
|
14
|
+
email?: string | null;
|
|
15
|
+
interval_type: SpendCapIntervalType;
|
|
16
|
+
max_cost_usd: string;
|
|
17
|
+
enforcement: SpendCapEnforcement;
|
|
18
|
+
alert_thresholds: number[];
|
|
19
|
+
enabled: boolean;
|
|
20
|
+
period_started_at: string | null;
|
|
21
|
+
current_spend_usd: string;
|
|
22
|
+
remaining_usd: string;
|
|
23
|
+
is_exceeded: boolean;
|
|
24
|
+
last_reconciled_at: string | null;
|
|
25
|
+
created_at: string;
|
|
26
|
+
updated_at: string;
|
|
27
|
+
}
|
|
28
|
+
export interface SpendCapUpsertRequest {
|
|
29
|
+
interval_type: SpendCapIntervalType;
|
|
30
|
+
max_cost_usd: string;
|
|
31
|
+
enforcement?: SpendCapEnforcement;
|
|
32
|
+
alert_thresholds?: number[];
|
|
33
|
+
enabled?: boolean;
|
|
34
|
+
}
|
|
35
|
+
export type SpendCapStatusZone = 'ok' | 'warning' | 'exceeded';
|
|
36
|
+
export interface SpendCapStatusItem {
|
|
37
|
+
scope: SpendCapScope;
|
|
38
|
+
interval_type: SpendCapIntervalType;
|
|
39
|
+
enforcement: SpendCapEnforcement;
|
|
40
|
+
status: SpendCapStatusZone;
|
|
41
|
+
percent_used: number;
|
|
42
|
+
warning_threshold: number | null;
|
|
43
|
+
mentor_unique_id: string | null;
|
|
44
|
+
username: string | null;
|
|
45
|
+
}
|
|
46
|
+
export interface SpendCapStatusSummary {
|
|
47
|
+
status: SpendCapStatusZone;
|
|
48
|
+
blocked: boolean;
|
|
49
|
+
caps: SpendCapStatusItem[];
|
|
50
|
+
}
|
|
51
|
+
export interface SpendCapExceededDetails {
|
|
52
|
+
scope: SpendCapScope;
|
|
53
|
+
interval_type: SpendCapIntervalType;
|
|
54
|
+
mentor_unique_id: string | null;
|
|
55
|
+
}
|
|
56
|
+
export interface SpendCapExceededErrorBody {
|
|
57
|
+
error_code: typeof SPEND_CAP_EXCEEDED_ERROR_CODE;
|
|
58
|
+
error: string;
|
|
59
|
+
message: string;
|
|
60
|
+
details?: SpendCapExceededDetails;
|
|
61
|
+
status_code?: number;
|
|
62
|
+
}
|
|
63
|
+
export type GetTenantSpendCapArgs = {
|
|
64
|
+
org: string;
|
|
65
|
+
};
|
|
66
|
+
export type UpsertTenantSpendCapArgs = {
|
|
67
|
+
org: string;
|
|
68
|
+
formData: SpendCapUpsertRequest;
|
|
69
|
+
};
|
|
70
|
+
export type DeleteTenantSpendCapArgs = {
|
|
71
|
+
org: string;
|
|
72
|
+
};
|
|
73
|
+
export type GetAgentSpendCapArgs = {
|
|
74
|
+
org: string;
|
|
75
|
+
mentorId: string;
|
|
76
|
+
};
|
|
77
|
+
export type UpsertAgentSpendCapArgs = {
|
|
78
|
+
org: string;
|
|
79
|
+
mentorId: string;
|
|
80
|
+
formData: SpendCapUpsertRequest;
|
|
81
|
+
};
|
|
82
|
+
export type DeleteAgentSpendCapArgs = {
|
|
83
|
+
org: string;
|
|
84
|
+
mentorId: string;
|
|
85
|
+
};
|
|
86
|
+
export type ListAgentSpendCapsArgs = {
|
|
87
|
+
org: string;
|
|
88
|
+
/** Optional mentor unique_id — server-side filter supported by the endpoint. */
|
|
89
|
+
mentor?: string;
|
|
90
|
+
};
|
|
91
|
+
export type ListAgentUserSpendCapsArgs = {
|
|
92
|
+
org: string;
|
|
93
|
+
mentorId: string;
|
|
94
|
+
};
|
|
95
|
+
export type GetUserSpendCapArgs = {
|
|
96
|
+
org: string;
|
|
97
|
+
mentorId: string;
|
|
98
|
+
username: string;
|
|
99
|
+
};
|
|
100
|
+
export type UpsertUserSpendCapArgs = {
|
|
101
|
+
org: string;
|
|
102
|
+
mentorId: string;
|
|
103
|
+
username: string;
|
|
104
|
+
formData: SpendCapUpsertRequest;
|
|
105
|
+
};
|
|
106
|
+
export type DeleteUserSpendCapArgs = {
|
|
107
|
+
org: string;
|
|
108
|
+
mentorId: string;
|
|
109
|
+
username: string;
|
|
110
|
+
};
|
|
111
|
+
export type GetSpendCapStatusArgs = {
|
|
112
|
+
org: string;
|
|
113
|
+
userId: string;
|
|
114
|
+
mentor?: string;
|
|
115
|
+
};
|
|
116
|
+
export type PaginatedSpendCapsResponse = {
|
|
117
|
+
count: number;
|
|
118
|
+
next: string | null;
|
|
119
|
+
previous: string | null;
|
|
120
|
+
results: SpendCap[];
|
|
121
|
+
};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { SpendCapExceededErrorBody } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* True when `body` is a spend-cap-exceeded error body — an object whose
|
|
4
|
+
* `error_code` is `'spend_cap_exceeded'`. Works for HTTP 429 bodies and
|
|
5
|
+
* WebSocket error frames alike.
|
|
6
|
+
*/
|
|
7
|
+
export declare const isSpendCapExceededErrorBody: (body: unknown) => body is SpendCapExceededErrorBody;
|
|
8
|
+
/**
|
|
9
|
+
* Extract the spend-cap-exceeded body from either a raw error body or an RTK
|
|
10
|
+
* Query error shape (`{ status, data }`). Returns null for anything else.
|
|
11
|
+
*/
|
|
12
|
+
export declare const getSpendCapExceededError: (error: unknown) => SpendCapExceededErrorBody | null;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -112,6 +112,10 @@ export * from './features/disclaimers/types';
|
|
|
112
112
|
export * from './features/grading/api-slice';
|
|
113
113
|
export * from './features/grading/constants';
|
|
114
114
|
export * from './features/grading/types';
|
|
115
|
+
export * from './features/spend-caps/api-slice';
|
|
116
|
+
export * from './features/spend-caps/constants';
|
|
117
|
+
export * from './features/spend-caps/types';
|
|
118
|
+
export * from './features/spend-caps/utils';
|
|
115
119
|
export * from './features/search/ai-search-api-slice';
|
|
116
120
|
export * from './features/search/types';
|
|
117
121
|
export * from './features/search/constants';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|