@ptkl/sdk 1.10.0 → 1.12.0
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.0.10.js +300 -66
- package/dist/index.0.9.js +57 -0
- package/dist/package.json +1 -1
- package/dist/v0.10/api/component.d.ts +7 -2
- package/dist/v0.10/api/forge.d.ts +9 -0
- package/dist/v0.10/api/index.d.ts +4 -0
- package/dist/v0.10/api/integrations/dms.d.ts +3 -1
- package/dist/v0.10/api/integrations/timber.d.ts +22 -0
- package/dist/v0.10/api/integrations.d.ts +2 -0
- package/dist/v0.10/api/kortex.d.ts +52 -0
- package/dist/v0.10/api/platform.d.ts +2 -0
- package/dist/v0.10/index.cjs.js +300 -66
- package/dist/v0.10/index.esm.js +299 -67
- package/dist/v0.10/types/component.d.ts +25 -1
- package/dist/v0.10/types/integrations.d.ts +6 -0
- package/dist/v0.10/types/kortex.d.ts +294 -0
- package/dist/v0.10/types/timber.d.ts +77 -0
- package/dist/v0.9/api/forge.d.ts +3 -0
- package/dist/v0.9/api/index.d.ts +2 -0
- package/dist/v0.9/api/integrations/timber.d.ts +22 -0
- package/dist/v0.9/api/integrations.d.ts +2 -0
- package/dist/v0.9/index.cjs.js +57 -0
- package/dist/v0.9/index.esm.js +57 -1
- package/dist/v0.9/types/integrations/timber.d.ts +77 -0
- package/package.json +1 -1
|
@@ -0,0 +1,294 @@
|
|
|
1
|
+
type PagedResponse<T> = {
|
|
2
|
+
data: T[];
|
|
3
|
+
total: number;
|
|
4
|
+
page: number;
|
|
5
|
+
limit: number;
|
|
6
|
+
};
|
|
7
|
+
type PaginationParams = {
|
|
8
|
+
limit?: number;
|
|
9
|
+
page?: number;
|
|
10
|
+
};
|
|
11
|
+
type RAGConfig = {
|
|
12
|
+
enabled: boolean;
|
|
13
|
+
top_k: number;
|
|
14
|
+
score_threshold: number;
|
|
15
|
+
};
|
|
16
|
+
type LLMSettings = {
|
|
17
|
+
temperature?: number;
|
|
18
|
+
top_p?: number;
|
|
19
|
+
top_k?: number;
|
|
20
|
+
max_tokens?: number;
|
|
21
|
+
};
|
|
22
|
+
type Agent = {
|
|
23
|
+
uuid: string;
|
|
24
|
+
project_uuid: string;
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
system_prompt: string;
|
|
28
|
+
knowledge_bases: string[];
|
|
29
|
+
rag_config: RAGConfig;
|
|
30
|
+
llm_settings: LLMSettings;
|
|
31
|
+
model_tier: string;
|
|
32
|
+
status: string;
|
|
33
|
+
created_at: string;
|
|
34
|
+
updated_at: string;
|
|
35
|
+
};
|
|
36
|
+
type AgentCreatePayload = {
|
|
37
|
+
name: string;
|
|
38
|
+
description?: string;
|
|
39
|
+
system_prompt?: string;
|
|
40
|
+
knowledge_bases?: string[];
|
|
41
|
+
rag_config?: RAGConfig;
|
|
42
|
+
llm_settings?: LLMSettings;
|
|
43
|
+
model_tier?: string;
|
|
44
|
+
};
|
|
45
|
+
type AgentUpdatePayload = {
|
|
46
|
+
name?: string;
|
|
47
|
+
description?: string;
|
|
48
|
+
system_prompt?: string;
|
|
49
|
+
knowledge_bases?: string[];
|
|
50
|
+
rag_config?: RAGConfig;
|
|
51
|
+
llm_settings?: LLMSettings;
|
|
52
|
+
model_tier?: string;
|
|
53
|
+
};
|
|
54
|
+
type ChunkingStrategy = {
|
|
55
|
+
chunk_size: number;
|
|
56
|
+
chunk_overlap: number;
|
|
57
|
+
};
|
|
58
|
+
type KnowledgeBase = {
|
|
59
|
+
uuid: string;
|
|
60
|
+
project_uuid: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string;
|
|
63
|
+
chunking_strategy: ChunkingStrategy;
|
|
64
|
+
document_count: number;
|
|
65
|
+
chunk_count: number;
|
|
66
|
+
total_size: number;
|
|
67
|
+
status: string;
|
|
68
|
+
created_at: string;
|
|
69
|
+
updated_at: string;
|
|
70
|
+
};
|
|
71
|
+
type KnowledgeBaseCreatePayload = {
|
|
72
|
+
name: string;
|
|
73
|
+
description?: string;
|
|
74
|
+
chunking_strategy?: ChunkingStrategy;
|
|
75
|
+
};
|
|
76
|
+
type KnowledgeBaseUpdatePayload = {
|
|
77
|
+
name?: string;
|
|
78
|
+
description?: string;
|
|
79
|
+
chunking_strategy?: ChunkingStrategy;
|
|
80
|
+
};
|
|
81
|
+
type Document = {
|
|
82
|
+
uuid: string;
|
|
83
|
+
project_uuid: string;
|
|
84
|
+
knowledge_base_uuid: string;
|
|
85
|
+
name: string;
|
|
86
|
+
content_type: string;
|
|
87
|
+
size: number;
|
|
88
|
+
processing_status: string;
|
|
89
|
+
processing_error?: string;
|
|
90
|
+
retry_count: number;
|
|
91
|
+
created_at: string;
|
|
92
|
+
updated_at: string;
|
|
93
|
+
};
|
|
94
|
+
type Participant = {
|
|
95
|
+
agent_uuid: string;
|
|
96
|
+
name: string;
|
|
97
|
+
mode: string;
|
|
98
|
+
instructions_override?: string;
|
|
99
|
+
};
|
|
100
|
+
type TokenUsage = {
|
|
101
|
+
prompt_tokens: number;
|
|
102
|
+
completion_tokens: number;
|
|
103
|
+
total_tokens: number;
|
|
104
|
+
};
|
|
105
|
+
type ToolCall = {
|
|
106
|
+
id: string;
|
|
107
|
+
type: string;
|
|
108
|
+
function: {
|
|
109
|
+
name: string;
|
|
110
|
+
arguments: string;
|
|
111
|
+
};
|
|
112
|
+
};
|
|
113
|
+
type RAGSource = {
|
|
114
|
+
document_uuid: string;
|
|
115
|
+
document_name: string;
|
|
116
|
+
chunk_index: number;
|
|
117
|
+
score: number;
|
|
118
|
+
content: string;
|
|
119
|
+
};
|
|
120
|
+
type Message = {
|
|
121
|
+
uuid: string;
|
|
122
|
+
conversation_uuid: string;
|
|
123
|
+
project_uuid: string;
|
|
124
|
+
role: string;
|
|
125
|
+
content: string;
|
|
126
|
+
agent_uuid?: string;
|
|
127
|
+
tool_calls?: ToolCall[];
|
|
128
|
+
tool_call_id?: string;
|
|
129
|
+
rag_sources?: RAGSource[];
|
|
130
|
+
token_usage: TokenUsage;
|
|
131
|
+
created_at: string;
|
|
132
|
+
};
|
|
133
|
+
type Conversation = {
|
|
134
|
+
uuid: string;
|
|
135
|
+
project_uuid: string;
|
|
136
|
+
user_uuid: string;
|
|
137
|
+
title: string;
|
|
138
|
+
agent_uuid?: string;
|
|
139
|
+
tier: string;
|
|
140
|
+
participants?: Participant[];
|
|
141
|
+
message_count: number;
|
|
142
|
+
tokens_used: number;
|
|
143
|
+
archived_at?: string;
|
|
144
|
+
created_at: string;
|
|
145
|
+
updated_at: string;
|
|
146
|
+
};
|
|
147
|
+
type ConversationCreatePayload = {
|
|
148
|
+
title?: string;
|
|
149
|
+
agent_uuid?: string;
|
|
150
|
+
};
|
|
151
|
+
type ConversationUpdatePayload = {
|
|
152
|
+
title?: string;
|
|
153
|
+
agent_uuid?: string;
|
|
154
|
+
};
|
|
155
|
+
type ParticipantAddPayload = {
|
|
156
|
+
agent_uuid: string;
|
|
157
|
+
name?: string;
|
|
158
|
+
mode?: string;
|
|
159
|
+
instructions_override?: string;
|
|
160
|
+
};
|
|
161
|
+
type ToolResultApproval = {
|
|
162
|
+
approved: boolean;
|
|
163
|
+
mode?: string;
|
|
164
|
+
};
|
|
165
|
+
type ToolResultPayload = {
|
|
166
|
+
tool_call_id: string;
|
|
167
|
+
name?: string;
|
|
168
|
+
content: string;
|
|
169
|
+
approval?: ToolResultApproval;
|
|
170
|
+
};
|
|
171
|
+
type PageContext = {
|
|
172
|
+
label: string;
|
|
173
|
+
description?: string;
|
|
174
|
+
icon?: string;
|
|
175
|
+
};
|
|
176
|
+
type SendMessagePayload = {
|
|
177
|
+
content: string;
|
|
178
|
+
agent_uuid?: string;
|
|
179
|
+
images?: string[];
|
|
180
|
+
stream?: boolean;
|
|
181
|
+
tools?: Record<string, any>[];
|
|
182
|
+
tool_results?: ToolResultPayload[];
|
|
183
|
+
page_context?: PageContext;
|
|
184
|
+
};
|
|
185
|
+
type InjectMessagePayload = {
|
|
186
|
+
role: string;
|
|
187
|
+
content: string;
|
|
188
|
+
};
|
|
189
|
+
type OCRPayload = {
|
|
190
|
+
file_name: string;
|
|
191
|
+
file_data: string;
|
|
192
|
+
content_type: string;
|
|
193
|
+
};
|
|
194
|
+
type OCRResult = {
|
|
195
|
+
text: string;
|
|
196
|
+
char_count: number;
|
|
197
|
+
};
|
|
198
|
+
type UserAccess = {
|
|
199
|
+
uuid: string;
|
|
200
|
+
project_uuid: string;
|
|
201
|
+
user_uuid: string;
|
|
202
|
+
credit_limit: number;
|
|
203
|
+
allowed_agent_uuids: string[];
|
|
204
|
+
status: string;
|
|
205
|
+
created_at: string;
|
|
206
|
+
updated_at: string;
|
|
207
|
+
};
|
|
208
|
+
type UserAccessCreatePayload = {
|
|
209
|
+
user_uuid: string;
|
|
210
|
+
credit_limit: number;
|
|
211
|
+
allowed_agent_uuids?: string[];
|
|
212
|
+
};
|
|
213
|
+
type UserAccessUpdatePayload = {
|
|
214
|
+
credit_limit?: number;
|
|
215
|
+
allowed_agent_uuids?: string[];
|
|
216
|
+
status?: string;
|
|
217
|
+
};
|
|
218
|
+
type TopUpPayload = {
|
|
219
|
+
amount: number;
|
|
220
|
+
reason?: string;
|
|
221
|
+
};
|
|
222
|
+
type UserMonthlyUsage = {
|
|
223
|
+
user_uuid: string;
|
|
224
|
+
year: number;
|
|
225
|
+
month: number;
|
|
226
|
+
credits_used: number;
|
|
227
|
+
credit_limit: number;
|
|
228
|
+
};
|
|
229
|
+
type UserUsageBreakdown = {
|
|
230
|
+
user_uuid: string;
|
|
231
|
+
credit_limit: number;
|
|
232
|
+
breakdown: {
|
|
233
|
+
year: number;
|
|
234
|
+
month: number;
|
|
235
|
+
credits: number;
|
|
236
|
+
}[];
|
|
237
|
+
};
|
|
238
|
+
type MyAccess = {
|
|
239
|
+
uuid: string;
|
|
240
|
+
project_uuid: string;
|
|
241
|
+
user_uuid: string;
|
|
242
|
+
credit_limit: number;
|
|
243
|
+
allowed_agent_uuids: string[];
|
|
244
|
+
status: string;
|
|
245
|
+
created_at: string;
|
|
246
|
+
updated_at: string;
|
|
247
|
+
credits_used: number;
|
|
248
|
+
is_admin?: boolean;
|
|
249
|
+
};
|
|
250
|
+
type AggregatedUsage = {
|
|
251
|
+
user_uuid: string;
|
|
252
|
+
model_tier: string;
|
|
253
|
+
prompt_tokens: number;
|
|
254
|
+
completion_tokens: number;
|
|
255
|
+
ocr_seconds: number;
|
|
256
|
+
credits: number;
|
|
257
|
+
billing_type: string;
|
|
258
|
+
created_at: string;
|
|
259
|
+
};
|
|
260
|
+
type Tier = {
|
|
261
|
+
tier: string;
|
|
262
|
+
can_create_agents: boolean;
|
|
263
|
+
can_create_kbs: boolean;
|
|
264
|
+
can_use_workflows: boolean;
|
|
265
|
+
can_assign_agents: boolean;
|
|
266
|
+
can_assign_users: boolean;
|
|
267
|
+
can_choose_model: boolean;
|
|
268
|
+
kb_ocr_seconds: number;
|
|
269
|
+
max_agents: number;
|
|
270
|
+
max_kbs: number;
|
|
271
|
+
max_msg_per_day: number;
|
|
272
|
+
max_msg_per_min: number;
|
|
273
|
+
max_storage_bytes: number;
|
|
274
|
+
max_users: number;
|
|
275
|
+
};
|
|
276
|
+
type KortexWorkflowMessage = {
|
|
277
|
+
role: string;
|
|
278
|
+
content: string;
|
|
279
|
+
};
|
|
280
|
+
type KortexWorkflowPayload = {
|
|
281
|
+
agent_uuid?: string;
|
|
282
|
+
system_prompt?: string;
|
|
283
|
+
response_format?: string;
|
|
284
|
+
messages: KortexWorkflowMessage[];
|
|
285
|
+
stream?: boolean;
|
|
286
|
+
temperature?: number;
|
|
287
|
+
max_tokens?: number;
|
|
288
|
+
tools?: Record<string, any>[];
|
|
289
|
+
};
|
|
290
|
+
type KortexWorkflowResult = {
|
|
291
|
+
content: string;
|
|
292
|
+
usage: TokenUsage;
|
|
293
|
+
};
|
|
294
|
+
export { PagedResponse, PaginationParams, RAGConfig, LLMSettings, Agent, AgentCreatePayload, AgentUpdatePayload, ChunkingStrategy, KnowledgeBase, KnowledgeBaseCreatePayload, KnowledgeBaseUpdatePayload, Document, Participant, TokenUsage, ToolCall, RAGSource, Message, Conversation, ConversationCreatePayload, ConversationUpdatePayload, ParticipantAddPayload, ToolResultApproval, ToolResultPayload, PageContext, SendMessagePayload, InjectMessagePayload, OCRPayload, OCRResult, UserAccess, UserAccessCreatePayload, UserAccessUpdatePayload, TopUpPayload, UserMonthlyUsage, UserUsageBreakdown, MyAccess, AggregatedUsage, Tier, KortexWorkflowMessage, KortexWorkflowPayload, KortexWorkflowResult, };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type TimberSource = 'system' | 'user';
|
|
2
|
+
export type TimberLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
3
|
+
export type TimberActorType = 'user' | 'api_key' | 'service' | 'system';
|
|
4
|
+
export interface TimberActor {
|
|
5
|
+
type: TimberActorType;
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
ip?: string;
|
|
9
|
+
user_agent?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TimberChanges {
|
|
12
|
+
before?: Record<string, any>;
|
|
13
|
+
after?: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
export interface TimberEntry {
|
|
16
|
+
id: string;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
source: TimberSource;
|
|
19
|
+
level: TimberLevel;
|
|
20
|
+
service: string;
|
|
21
|
+
project_uuid: string;
|
|
22
|
+
actor: TimberActor;
|
|
23
|
+
action?: string;
|
|
24
|
+
resource_type?: string;
|
|
25
|
+
resource_id?: string;
|
|
26
|
+
resource_name?: string;
|
|
27
|
+
message?: string;
|
|
28
|
+
changes?: TimberChanges;
|
|
29
|
+
attributes?: Record<string, any>;
|
|
30
|
+
trace_id?: string;
|
|
31
|
+
span_id?: string;
|
|
32
|
+
request_id?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TimberQueryParams {
|
|
35
|
+
limit?: number;
|
|
36
|
+
cursor?: string;
|
|
37
|
+
source?: TimberSource;
|
|
38
|
+
level?: TimberLevel;
|
|
39
|
+
from?: string | Date;
|
|
40
|
+
to?: string | Date;
|
|
41
|
+
actor_id?: string;
|
|
42
|
+
actor_name?: string;
|
|
43
|
+
actor_type?: TimberActorType;
|
|
44
|
+
action?: string;
|
|
45
|
+
resource_type?: string;
|
|
46
|
+
resource_id?: string;
|
|
47
|
+
request_uuid?: string;
|
|
48
|
+
search?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface TimberQueryResponse {
|
|
51
|
+
data: TimberEntry[];
|
|
52
|
+
meta: {
|
|
53
|
+
limit: number;
|
|
54
|
+
has_more: boolean;
|
|
55
|
+
next_cursor?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface TimberWritePayload {
|
|
59
|
+
level?: TimberLevel;
|
|
60
|
+
message: string;
|
|
61
|
+
service?: string;
|
|
62
|
+
resource_type?: string;
|
|
63
|
+
resource_id?: string;
|
|
64
|
+
resource_name?: string;
|
|
65
|
+
attributes?: Record<string, any>;
|
|
66
|
+
trace_id?: string;
|
|
67
|
+
span_id?: string;
|
|
68
|
+
request_id?: string;
|
|
69
|
+
}
|
|
70
|
+
export type TimberLogPayload = Omit<TimberWritePayload, 'level'>;
|
|
71
|
+
export interface TimberUsage {
|
|
72
|
+
tier: 'free' | 'pro' | string;
|
|
73
|
+
period?: string;
|
|
74
|
+
bytes_ingested?: number;
|
|
75
|
+
gb_ingested?: number;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}
|
package/dist/v0.9/api/forge.d.ts
CHANGED
|
@@ -4,4 +4,7 @@ export default class Forge extends PlatformBaseClient {
|
|
|
4
4
|
getWorkspaceApps(): Promise<any>;
|
|
5
5
|
removeVersion(ref: string, version: string): Promise<any>;
|
|
6
6
|
list(): Promise<any>;
|
|
7
|
+
getVariables(ref: string): Promise<any>;
|
|
8
|
+
updateVariables(ref: string, variables: Record<string, any>): Promise<any>;
|
|
9
|
+
addVariable(ref: string, key: string, value: any): Promise<any>;
|
|
7
10
|
}
|
package/dist/v0.9/api/index.d.ts
CHANGED
|
@@ -26,5 +26,7 @@ export { default as SerbiaUtil } from './integrations/serbiaUtil';
|
|
|
26
26
|
export { default as VPFR } from './integrations/vpfr';
|
|
27
27
|
export { default as Mail } from './integrations/mail';
|
|
28
28
|
export { default as Ecommerce } from './integrations/ecommerce';
|
|
29
|
+
export { default as Timber } from './integrations/timber';
|
|
30
|
+
export type { TimberQueryParams, TimberQueryResponse, TimberWritePayload, TimberLogPayload, TimberUsage, TimberEntry, } from '../types/integrations/timber';
|
|
29
31
|
import Platfrom from './platform';
|
|
30
32
|
export default Platfrom;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import IntegrationsBaseClient from "../integrationsBaseClient";
|
|
2
|
+
import { TimberLogPayload, TimberQueryParams, TimberQueryResponse, TimberUsage, TimberWritePayload } from "../../types/integrations/timber";
|
|
3
|
+
export default class Timber extends IntegrationsBaseClient {
|
|
4
|
+
query(params?: TimberQueryParams): Promise<TimberQueryResponse>;
|
|
5
|
+
write(payload: TimberWritePayload): Promise<{
|
|
6
|
+
accepted: boolean;
|
|
7
|
+
}>;
|
|
8
|
+
usage(): Promise<TimberUsage>;
|
|
9
|
+
debug(message: string, payload?: TimberLogPayload): Promise<{
|
|
10
|
+
accepted: boolean;
|
|
11
|
+
}>;
|
|
12
|
+
info(message: string, payload?: TimberLogPayload): Promise<{
|
|
13
|
+
accepted: boolean;
|
|
14
|
+
}>;
|
|
15
|
+
warn(message: string, payload?: TimberLogPayload): Promise<{
|
|
16
|
+
accepted: boolean;
|
|
17
|
+
}>;
|
|
18
|
+
error(message: string, payload?: TimberLogPayload): Promise<{
|
|
19
|
+
accepted: boolean;
|
|
20
|
+
}>;
|
|
21
|
+
private normalizeParams;
|
|
22
|
+
}
|
|
@@ -6,6 +6,7 @@ import IntegrationsBaseClient from "./integrationsBaseClient";
|
|
|
6
6
|
import Payments from "./integrations/payments";
|
|
7
7
|
import Minimax from "./integrations/minimax";
|
|
8
8
|
import Ecommerce from "./integrations/ecommerce";
|
|
9
|
+
import Timber from "./integrations/timber";
|
|
9
10
|
export default class Integrations extends IntegrationsBaseClient {
|
|
10
11
|
private integrations;
|
|
11
12
|
constructor(options?: {
|
|
@@ -21,6 +22,7 @@ export default class Integrations extends IntegrationsBaseClient {
|
|
|
21
22
|
getPayments(): Payments;
|
|
22
23
|
getMinimax(): Minimax;
|
|
23
24
|
getEcommerce(): Ecommerce;
|
|
25
|
+
getTimber(): Timber;
|
|
24
26
|
list(): Promise<any>;
|
|
25
27
|
isInstalled(id: string): Promise<boolean>;
|
|
26
28
|
isActive(id: string): Promise<boolean>;
|
package/dist/v0.9/index.cjs.js
CHANGED
|
@@ -19952,6 +19952,19 @@ class Forge extends PlatformBaseClient {
|
|
|
19952
19952
|
async list() {
|
|
19953
19953
|
return await this.client.get(`/luma/appservice/v1/forge`);
|
|
19954
19954
|
}
|
|
19955
|
+
async getVariables(ref) {
|
|
19956
|
+
return await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
19957
|
+
}
|
|
19958
|
+
async updateVariables(ref, variables) {
|
|
19959
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, variables);
|
|
19960
|
+
}
|
|
19961
|
+
async addVariable(ref, key, value) {
|
|
19962
|
+
var _a;
|
|
19963
|
+
const resp = await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
19964
|
+
const current = (_a = resp.data) !== null && _a !== void 0 ? _a : {};
|
|
19965
|
+
current[key] = value;
|
|
19966
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
|
|
19967
|
+
}
|
|
19955
19968
|
}
|
|
19956
19969
|
|
|
19957
19970
|
class Project extends PlatformBaseClient {
|
|
@@ -21938,6 +21951,45 @@ class Ecommerce extends IntegrationsBaseClient {
|
|
|
21938
21951
|
}
|
|
21939
21952
|
}
|
|
21940
21953
|
|
|
21954
|
+
class Timber extends IntegrationsBaseClient {
|
|
21955
|
+
async query(params = {}) {
|
|
21956
|
+
const { data } = await this.client.get("/v1/timber/logs", {
|
|
21957
|
+
params: this.normalizeParams(params),
|
|
21958
|
+
});
|
|
21959
|
+
return data;
|
|
21960
|
+
}
|
|
21961
|
+
async write(payload) {
|
|
21962
|
+
const { data } = await this.client.post("/v1/timber/logs", payload);
|
|
21963
|
+
return data;
|
|
21964
|
+
}
|
|
21965
|
+
async usage() {
|
|
21966
|
+
const { data } = await this.client.get("/v1/timber/usage");
|
|
21967
|
+
return data;
|
|
21968
|
+
}
|
|
21969
|
+
async debug(message, payload) {
|
|
21970
|
+
return this.write({ ...payload, message, level: 'debug' });
|
|
21971
|
+
}
|
|
21972
|
+
async info(message, payload) {
|
|
21973
|
+
return this.write({ ...payload, message, level: 'info' });
|
|
21974
|
+
}
|
|
21975
|
+
async warn(message, payload) {
|
|
21976
|
+
return this.write({ ...payload, message, level: 'warn' });
|
|
21977
|
+
}
|
|
21978
|
+
async error(message, payload) {
|
|
21979
|
+
return this.write({ ...payload, message, level: 'error' });
|
|
21980
|
+
}
|
|
21981
|
+
normalizeParams(params) {
|
|
21982
|
+
const normalized = { ...params };
|
|
21983
|
+
if (params.from instanceof Date) {
|
|
21984
|
+
normalized.from = params.from.toISOString();
|
|
21985
|
+
}
|
|
21986
|
+
if (params.to instanceof Date) {
|
|
21987
|
+
normalized.to = params.to.toISOString();
|
|
21988
|
+
}
|
|
21989
|
+
return normalized;
|
|
21990
|
+
}
|
|
21991
|
+
}
|
|
21992
|
+
|
|
21941
21993
|
// import integrations
|
|
21942
21994
|
class Integrations extends IntegrationsBaseClient {
|
|
21943
21995
|
constructor(options) {
|
|
@@ -21951,6 +22003,7 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21951
22003
|
'protokol-payments': new Payments().setClient(this.client),
|
|
21952
22004
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
21953
22005
|
'protokol-ecommerce': new Ecommerce().setClient(this.client),
|
|
22006
|
+
'protokol-timber': new Timber().setClient(this.client),
|
|
21954
22007
|
};
|
|
21955
22008
|
}
|
|
21956
22009
|
getSerbiaUtilities() {
|
|
@@ -21977,6 +22030,9 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
21977
22030
|
getEcommerce() {
|
|
21978
22031
|
return this.getInterfaceOf('protokol-ecommerce');
|
|
21979
22032
|
}
|
|
22033
|
+
getTimber() {
|
|
22034
|
+
return this.getInterfaceOf('protokol-timber');
|
|
22035
|
+
}
|
|
21980
22036
|
async list() {
|
|
21981
22037
|
const { data } = await this.client.get("/v1/integrations");
|
|
21982
22038
|
return data;
|
|
@@ -22152,6 +22208,7 @@ exports.Sandbox = Sandbox;
|
|
|
22152
22208
|
exports.SerbiaUtil = SerbiaUtil;
|
|
22153
22209
|
exports.System = System;
|
|
22154
22210
|
exports.Thunder = Thunder;
|
|
22211
|
+
exports.Timber = Timber;
|
|
22155
22212
|
exports.Users = Users;
|
|
22156
22213
|
exports.VPFR = VPFR;
|
|
22157
22214
|
exports.Workflow = Workflow;
|
package/dist/v0.9/index.esm.js
CHANGED
|
@@ -983,6 +983,19 @@ class Forge extends PlatformBaseClient {
|
|
|
983
983
|
async list() {
|
|
984
984
|
return await this.client.get(`/luma/appservice/v1/forge`);
|
|
985
985
|
}
|
|
986
|
+
async getVariables(ref) {
|
|
987
|
+
return await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
988
|
+
}
|
|
989
|
+
async updateVariables(ref, variables) {
|
|
990
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, variables);
|
|
991
|
+
}
|
|
992
|
+
async addVariable(ref, key, value) {
|
|
993
|
+
var _a;
|
|
994
|
+
const resp = await this.client.get(`/luma/appservice/v1/forge/${ref}/variables`);
|
|
995
|
+
const current = (_a = resp.data) !== null && _a !== void 0 ? _a : {};
|
|
996
|
+
current[key] = value;
|
|
997
|
+
return await this.client.patch(`/luma/appservice/v1/forge/${ref}/variables`, current);
|
|
998
|
+
}
|
|
986
999
|
}
|
|
987
1000
|
|
|
988
1001
|
class Project extends PlatformBaseClient {
|
|
@@ -2969,6 +2982,45 @@ class Ecommerce extends IntegrationsBaseClient {
|
|
|
2969
2982
|
}
|
|
2970
2983
|
}
|
|
2971
2984
|
|
|
2985
|
+
class Timber extends IntegrationsBaseClient {
|
|
2986
|
+
async query(params = {}) {
|
|
2987
|
+
const { data } = await this.client.get("/v1/timber/logs", {
|
|
2988
|
+
params: this.normalizeParams(params),
|
|
2989
|
+
});
|
|
2990
|
+
return data;
|
|
2991
|
+
}
|
|
2992
|
+
async write(payload) {
|
|
2993
|
+
const { data } = await this.client.post("/v1/timber/logs", payload);
|
|
2994
|
+
return data;
|
|
2995
|
+
}
|
|
2996
|
+
async usage() {
|
|
2997
|
+
const { data } = await this.client.get("/v1/timber/usage");
|
|
2998
|
+
return data;
|
|
2999
|
+
}
|
|
3000
|
+
async debug(message, payload) {
|
|
3001
|
+
return this.write({ ...payload, message, level: 'debug' });
|
|
3002
|
+
}
|
|
3003
|
+
async info(message, payload) {
|
|
3004
|
+
return this.write({ ...payload, message, level: 'info' });
|
|
3005
|
+
}
|
|
3006
|
+
async warn(message, payload) {
|
|
3007
|
+
return this.write({ ...payload, message, level: 'warn' });
|
|
3008
|
+
}
|
|
3009
|
+
async error(message, payload) {
|
|
3010
|
+
return this.write({ ...payload, message, level: 'error' });
|
|
3011
|
+
}
|
|
3012
|
+
normalizeParams(params) {
|
|
3013
|
+
const normalized = { ...params };
|
|
3014
|
+
if (params.from instanceof Date) {
|
|
3015
|
+
normalized.from = params.from.toISOString();
|
|
3016
|
+
}
|
|
3017
|
+
if (params.to instanceof Date) {
|
|
3018
|
+
normalized.to = params.to.toISOString();
|
|
3019
|
+
}
|
|
3020
|
+
return normalized;
|
|
3021
|
+
}
|
|
3022
|
+
}
|
|
3023
|
+
|
|
2972
3024
|
// import integrations
|
|
2973
3025
|
class Integrations extends IntegrationsBaseClient {
|
|
2974
3026
|
constructor(options) {
|
|
@@ -2982,6 +3034,7 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
2982
3034
|
'protokol-payments': new Payments().setClient(this.client),
|
|
2983
3035
|
'protokol-minimax': new Minimax().setClient(this.client),
|
|
2984
3036
|
'protokol-ecommerce': new Ecommerce().setClient(this.client),
|
|
3037
|
+
'protokol-timber': new Timber().setClient(this.client),
|
|
2985
3038
|
};
|
|
2986
3039
|
}
|
|
2987
3040
|
getSerbiaUtilities() {
|
|
@@ -3008,6 +3061,9 @@ class Integrations extends IntegrationsBaseClient {
|
|
|
3008
3061
|
getEcommerce() {
|
|
3009
3062
|
return this.getInterfaceOf('protokol-ecommerce');
|
|
3010
3063
|
}
|
|
3064
|
+
getTimber() {
|
|
3065
|
+
return this.getInterfaceOf('protokol-timber');
|
|
3066
|
+
}
|
|
3011
3067
|
async list() {
|
|
3012
3068
|
const { data } = await this.client.get("/v1/integrations");
|
|
3013
3069
|
return data;
|
|
@@ -3161,4 +3217,4 @@ function parsePRN(s) {
|
|
|
3161
3217
|
// Export all API modules for version 0.9
|
|
3162
3218
|
// This version has specific method signatures and behaviors for v0.9
|
|
3163
3219
|
|
|
3164
|
-
export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Ecommerce, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Mail, PRN, Payments, Platform, Project, Ratchet, Sandbox, SerbiaUtil, System, Thunder, Users, VPFR, Workflow, Platform as default, parsePRN };
|
|
3220
|
+
export { APIUser, Apps, Component, ComponentUtils, Config, DMS, Ecommerce, Forge, Functions, Integrations as Integration, Integrations, Invoicing, Mail, PRN, Payments, Platform, Project, Ratchet, Sandbox, SerbiaUtil, System, Thunder, Timber, Users, VPFR, Workflow, Platform as default, parsePRN };
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
export type TimberSource = 'system' | 'user';
|
|
2
|
+
export type TimberLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
3
|
+
export type TimberActorType = 'user' | 'api_key' | 'service' | 'system';
|
|
4
|
+
export interface TimberActor {
|
|
5
|
+
type: TimberActorType;
|
|
6
|
+
id: string;
|
|
7
|
+
name?: string;
|
|
8
|
+
ip?: string;
|
|
9
|
+
user_agent?: string;
|
|
10
|
+
}
|
|
11
|
+
export interface TimberChanges {
|
|
12
|
+
before?: Record<string, any>;
|
|
13
|
+
after?: Record<string, any>;
|
|
14
|
+
}
|
|
15
|
+
export interface TimberEntry {
|
|
16
|
+
id: string;
|
|
17
|
+
timestamp: string;
|
|
18
|
+
source: TimberSource;
|
|
19
|
+
level: TimberLevel;
|
|
20
|
+
service: string;
|
|
21
|
+
project_uuid: string;
|
|
22
|
+
actor: TimberActor;
|
|
23
|
+
action?: string;
|
|
24
|
+
resource_type?: string;
|
|
25
|
+
resource_id?: string;
|
|
26
|
+
resource_name?: string;
|
|
27
|
+
message?: string;
|
|
28
|
+
changes?: TimberChanges;
|
|
29
|
+
attributes?: Record<string, any>;
|
|
30
|
+
trace_id?: string;
|
|
31
|
+
span_id?: string;
|
|
32
|
+
request_id?: string;
|
|
33
|
+
}
|
|
34
|
+
export interface TimberQueryParams {
|
|
35
|
+
limit?: number;
|
|
36
|
+
cursor?: string;
|
|
37
|
+
source?: TimberSource;
|
|
38
|
+
level?: TimberLevel;
|
|
39
|
+
from?: string | Date;
|
|
40
|
+
to?: string | Date;
|
|
41
|
+
actor_id?: string;
|
|
42
|
+
actor_name?: string;
|
|
43
|
+
actor_type?: TimberActorType;
|
|
44
|
+
action?: string;
|
|
45
|
+
resource_type?: string;
|
|
46
|
+
resource_id?: string;
|
|
47
|
+
request_uuid?: string;
|
|
48
|
+
search?: string;
|
|
49
|
+
}
|
|
50
|
+
export interface TimberQueryResponse {
|
|
51
|
+
data: TimberEntry[];
|
|
52
|
+
meta: {
|
|
53
|
+
limit: number;
|
|
54
|
+
has_more: boolean;
|
|
55
|
+
next_cursor?: string;
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
export interface TimberWritePayload {
|
|
59
|
+
level?: TimberLevel;
|
|
60
|
+
message: string;
|
|
61
|
+
service?: string;
|
|
62
|
+
resource_type?: string;
|
|
63
|
+
resource_id?: string;
|
|
64
|
+
resource_name?: string;
|
|
65
|
+
attributes?: Record<string, any>;
|
|
66
|
+
trace_id?: string;
|
|
67
|
+
span_id?: string;
|
|
68
|
+
request_id?: string;
|
|
69
|
+
}
|
|
70
|
+
export type TimberLogPayload = Omit<TimberWritePayload, 'level'>;
|
|
71
|
+
export interface TimberUsage {
|
|
72
|
+
tier: 'free' | 'pro' | string;
|
|
73
|
+
period?: string;
|
|
74
|
+
bytes_ingested?: number;
|
|
75
|
+
gb_ingested?: number;
|
|
76
|
+
[key: string]: any;
|
|
77
|
+
}
|