@keboola/api-client 1.0.0 → 1.0.1
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/chat/index.d.cts +1 -1
- package/dist/chat/index.d.ts +1 -1
- package/dist/chat/types.d.cts +1 -1
- package/dist/chat/types.d.ts +1 -1
- package/dist/index.cjs +165 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +196 -5
- package/dist/index.d.ts +196 -5
- package/dist/index.js +165 -2
- package/dist/index.js.map +1 -1
- package/dist/sdk/storage/index.cjs +20 -1
- package/dist/sdk/storage/index.cjs.map +1 -1
- package/dist/sdk/storage/index.d.cts +2 -2
- package/dist/sdk/storage/index.d.ts +2 -2
- package/dist/sdk/storage/index.js +20 -1
- package/dist/sdk/storage/index.js.map +1 -1
- package/dist/storage/index.cjs +88 -1
- package/dist/storage/index.cjs.map +1 -1
- package/dist/storage/index.d.cts +1 -1
- package/dist/storage/index.d.ts +1 -1
- package/dist/storage/index.js +88 -1
- package/dist/storage/index.js.map +1 -1
- package/dist/storage/types.d.cts +63 -4
- package/dist/storage/types.d.ts +63 -4
- package/dist/{storageClient-D05fdGHW.d.cts → storageClient-DSLTM3Cr.d.cts} +6 -1
- package/dist/{storageClient-C8LDO4gr.d.ts → storageClient-DrYOs4Xm.d.ts} +6 -1
- package/dist/storageSdk-BBqAo0Vx.d.cts +143 -0
- package/dist/storageSdk-ZVmKQQSl.d.ts +143 -0
- package/dist/{types-DJ6nbNq5.d.cts → types-CNkgmuhe.d.cts} +1 -1
- package/dist/{types-BjrNNn5I.d.ts → types-DzwzVgyG.d.ts} +1 -1
- package/package.json +1 -1
- package/dist/storageSdk-CX03lGn-.d.ts +0 -18
- package/dist/storageSdk-DZV4nB3o.d.cts +0 -18
package/dist/chat/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GetHistoryQuery, c as components, a as GetChatPath, C as ChatRequest, b as GetVotesQuery, V as VoteRequest, U as UsageResponse, A as AgentSettings, d as UpdateAgentSettingsRequest, e as UserAgentSettings, f as UpdateUserAgentSettingsRequest, T as ToolsListResponse } from '../types-
|
|
1
|
+
import { G as GetHistoryQuery, c as components, a as GetChatPath, C as ChatRequest, b as GetVotesQuery, V as VoteRequest, U as UsageResponse, A as AgentSettings, d as UpdateAgentSettingsRequest, e as UserAgentSettings, f as UpdateUserAgentSettingsRequest, T as ToolsListResponse } from '../types-CNkgmuhe.cjs';
|
|
2
2
|
import { C as ClientInitOptions } from '../types-DgaMV8FF.cjs';
|
|
3
3
|
import { SuggestionsRequestBody, SuggestionsApiResponse } from './suggestions.cjs';
|
|
4
4
|
import 'zod';
|
package/dist/chat/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { G as GetHistoryQuery, c as components, a as GetChatPath, C as ChatRequest, b as GetVotesQuery, V as VoteRequest, U as UsageResponse, A as AgentSettings, d as UpdateAgentSettingsRequest, e as UserAgentSettings, f as UpdateUserAgentSettingsRequest, T as ToolsListResponse } from '../types-
|
|
1
|
+
import { G as GetHistoryQuery, c as components, a as GetChatPath, C as ChatRequest, b as GetVotesQuery, V as VoteRequest, U as UsageResponse, A as AgentSettings, d as UpdateAgentSettingsRequest, e as UserAgentSettings, f as UpdateUserAgentSettingsRequest, T as ToolsListResponse } from '../types-DzwzVgyG.js';
|
|
2
2
|
import { C as ClientInitOptions } from '../types-DgaMV8FF.js';
|
|
3
3
|
import { SuggestionsRequestBody, SuggestionsApiResponse } from './suggestions.js';
|
|
4
4
|
import 'zod';
|
package/dist/chat/types.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'zod';
|
|
2
2
|
import '../types-C7mpAfq-.cjs';
|
|
3
|
-
export { A as AgentSettings, g as AskUserQuestionAnswers, h as Chat, i as ChatMessage, C as ChatRequest, j as ChatWithMessage, k as ChatWithMessages, a as GetChatPath, G as GetHistoryQuery, b as GetVotesQuery, H as HistoryResponse, M as MessageStatus, l as TextPart, m as ToolInfo, n as ToolPermissionValue, T as ToolsListResponse, d as UpdateAgentSettingsRequest, f as UpdateUserAgentSettingsRequest, U as UsageResponse, e as UserAgentSettings, o as UserMessage, p as Vote, V as VoteRequest, q as VotesResponse, r as askUserQuestionAnswersSchema } from '../types-
|
|
3
|
+
export { A as AgentSettings, g as AskUserQuestionAnswers, h as Chat, i as ChatMessage, C as ChatRequest, j as ChatWithMessage, k as ChatWithMessages, a as GetChatPath, G as GetHistoryQuery, b as GetVotesQuery, H as HistoryResponse, M as MessageStatus, l as TextPart, m as ToolInfo, n as ToolPermissionValue, T as ToolsListResponse, d as UpdateAgentSettingsRequest, f as UpdateUserAgentSettingsRequest, U as UsageResponse, e as UserAgentSettings, o as UserMessage, p as Vote, V as VoteRequest, q as VotesResponse, r as askUserQuestionAnswersSchema } from '../types-CNkgmuhe.cjs';
|
package/dist/chat/types.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import 'zod';
|
|
2
2
|
import '../types-C7mpAfq-.js';
|
|
3
|
-
export { A as AgentSettings, g as AskUserQuestionAnswers, h as Chat, i as ChatMessage, C as ChatRequest, j as ChatWithMessage, k as ChatWithMessages, a as GetChatPath, G as GetHistoryQuery, b as GetVotesQuery, H as HistoryResponse, M as MessageStatus, l as TextPart, m as ToolInfo, n as ToolPermissionValue, T as ToolsListResponse, d as UpdateAgentSettingsRequest, f as UpdateUserAgentSettingsRequest, U as UsageResponse, e as UserAgentSettings, o as UserMessage, p as Vote, V as VoteRequest, q as VotesResponse, r as askUserQuestionAnswersSchema } from '../types-
|
|
3
|
+
export { A as AgentSettings, g as AskUserQuestionAnswers, h as Chat, i as ChatMessage, C as ChatRequest, j as ChatWithMessage, k as ChatWithMessages, a as GetChatPath, G as GetHistoryQuery, b as GetVotesQuery, H as HistoryResponse, M as MessageStatus, l as TextPart, m as ToolInfo, n as ToolPermissionValue, T as ToolsListResponse, d as UpdateAgentSettingsRequest, f as UpdateUserAgentSettingsRequest, U as UsageResponse, e as UserAgentSettings, o as UserMessage, p as Vote, V as VoteRequest, q as VotesResponse, r as askUserQuestionAnswersSchema } from '../types-DzwzVgyG.js';
|
package/dist/index.cjs
CHANGED
|
@@ -987,6 +987,24 @@ var toolInfoSchema2 = z5.z.object({
|
|
|
987
987
|
var toolsListResponseSchema2 = z5.z.object({
|
|
988
988
|
tools: z5.z.array(toolInfoSchema2)
|
|
989
989
|
});
|
|
990
|
+
var sandboxFileEntrySchema = z5.z.object({
|
|
991
|
+
name: z5.z.string(),
|
|
992
|
+
path: z5.z.string(),
|
|
993
|
+
type: z5.z.enum(["file", "dir"]),
|
|
994
|
+
size: z5.z.number().int().nonnegative().optional()
|
|
995
|
+
});
|
|
996
|
+
var sandboxFileListingSchema = z5.z.object({
|
|
997
|
+
entries: z5.z.array(sandboxFileEntrySchema)
|
|
998
|
+
});
|
|
999
|
+
var sandboxFileContentSchema = z5.z.object({
|
|
1000
|
+
content: z5.z.string(),
|
|
1001
|
+
encoding: z5.z.enum(["utf-8", "binary"]),
|
|
1002
|
+
truncated: z5.z.boolean(),
|
|
1003
|
+
size: z5.z.number().int().nonnegative()
|
|
1004
|
+
});
|
|
1005
|
+
var sandboxGitBranchSchema = z5.z.object({
|
|
1006
|
+
branch: z5.z.string().nullable()
|
|
1007
|
+
});
|
|
990
1008
|
var createKaiAgentClient = ({ baseUrl, middlewares }) => {
|
|
991
1009
|
const clientOptions = { baseUrl, middlewares };
|
|
992
1010
|
const client = createOpenapiFetchClient(clientOptions);
|
|
@@ -1096,6 +1114,42 @@ var createKaiAgentClient = ({ baseUrl, middlewares }) => {
|
|
|
1096
1114
|
}
|
|
1097
1115
|
return result.data;
|
|
1098
1116
|
};
|
|
1117
|
+
const listSandboxFiles = async (chatId, path, signal) => {
|
|
1118
|
+
const { data } = await genericClient.get(
|
|
1119
|
+
`/api/chat/${encodeURIComponent(chatId)}/sandbox/files`,
|
|
1120
|
+
{ query: path ? { path } : void 0 },
|
|
1121
|
+
{ signal }
|
|
1122
|
+
);
|
|
1123
|
+
const result = sandboxFileListingSchema.safeParse(data);
|
|
1124
|
+
if (!result.success) {
|
|
1125
|
+
throw new Error("Invalid sandbox files response format");
|
|
1126
|
+
}
|
|
1127
|
+
return result.data;
|
|
1128
|
+
};
|
|
1129
|
+
const readSandboxFile = async (chatId, path, signal) => {
|
|
1130
|
+
const { data } = await genericClient.get(
|
|
1131
|
+
`/api/chat/${encodeURIComponent(chatId)}/sandbox/file`,
|
|
1132
|
+
{ query: { path } },
|
|
1133
|
+
{ signal }
|
|
1134
|
+
);
|
|
1135
|
+
const result = sandboxFileContentSchema.safeParse(data);
|
|
1136
|
+
if (!result.success) {
|
|
1137
|
+
throw new Error("Invalid sandbox file response format");
|
|
1138
|
+
}
|
|
1139
|
+
return result.data;
|
|
1140
|
+
};
|
|
1141
|
+
const getSandboxGitBranch = async (chatId, signal) => {
|
|
1142
|
+
const { data } = await genericClient.get(
|
|
1143
|
+
`/api/chat/${encodeURIComponent(chatId)}/sandbox/git-branch`,
|
|
1144
|
+
{},
|
|
1145
|
+
{ signal }
|
|
1146
|
+
);
|
|
1147
|
+
const result = sandboxGitBranchSchema.safeParse(data);
|
|
1148
|
+
if (!result.success) {
|
|
1149
|
+
throw new Error("Invalid sandbox git-branch response format");
|
|
1150
|
+
}
|
|
1151
|
+
return result.data;
|
|
1152
|
+
};
|
|
1099
1153
|
const chatStreamUrl = baseUrl + "/api/chat";
|
|
1100
1154
|
return {
|
|
1101
1155
|
getHistory,
|
|
@@ -1114,6 +1168,9 @@ var createKaiAgentClient = ({ baseUrl, middlewares }) => {
|
|
|
1114
1168
|
getUserAgentSettings,
|
|
1115
1169
|
updateUserAgentSettings,
|
|
1116
1170
|
getToolsList,
|
|
1171
|
+
listSandboxFiles,
|
|
1172
|
+
readSandboxFile,
|
|
1173
|
+
getSandboxGitBranch,
|
|
1117
1174
|
chatStreamUrl
|
|
1118
1175
|
};
|
|
1119
1176
|
};
|
|
@@ -2333,6 +2390,30 @@ var createBranches = (client) => {
|
|
|
2333
2390
|
};
|
|
2334
2391
|
};
|
|
2335
2392
|
|
|
2393
|
+
// src/clients/storage/buckets/listingConversion.ts
|
|
2394
|
+
var toBackendSubscribers = (subscribers) => subscribers.map((s) => `${s.type}:${s.email}`);
|
|
2395
|
+
var fromBackendSubscribers = (raw) => {
|
|
2396
|
+
const result = [];
|
|
2397
|
+
for (const entry of raw) {
|
|
2398
|
+
const colon = entry.indexOf(":");
|
|
2399
|
+
if (colon === -1) continue;
|
|
2400
|
+
const prefix = entry.slice(0, colon);
|
|
2401
|
+
const email2 = entry.slice(colon + 1);
|
|
2402
|
+
if (prefix !== "user" && prefix !== "group") continue;
|
|
2403
|
+
if (email2.length === 0) continue;
|
|
2404
|
+
result.push({ type: prefix, email: email2 });
|
|
2405
|
+
}
|
|
2406
|
+
return result;
|
|
2407
|
+
};
|
|
2408
|
+
var toBucketListing = (raw, bucketId) => ({
|
|
2409
|
+
bucketId,
|
|
2410
|
+
name: raw.name,
|
|
2411
|
+
description: raw.description ?? null,
|
|
2412
|
+
listingId: raw.bigquery.listingId,
|
|
2413
|
+
subscribers: fromBackendSubscribers(raw.bigquery.subscribers),
|
|
2414
|
+
createdAt: raw.createdAt
|
|
2415
|
+
});
|
|
2416
|
+
|
|
2336
2417
|
// src/clients/storage/buckets/buckets.ts
|
|
2337
2418
|
var createBuckets = (client) => {
|
|
2338
2419
|
const getBuckets = async (query = {}, signal) => {
|
|
@@ -2384,6 +2465,64 @@ var createBuckets = (client) => {
|
|
|
2384
2465
|
path: { taskId }
|
|
2385
2466
|
});
|
|
2386
2467
|
};
|
|
2468
|
+
const getListing = async (bucketId, signal) => {
|
|
2469
|
+
try {
|
|
2470
|
+
const { data } = await client.get(
|
|
2471
|
+
`/buckets/{bucketId}/listing`,
|
|
2472
|
+
{ path: { bucketId } },
|
|
2473
|
+
{ signal }
|
|
2474
|
+
);
|
|
2475
|
+
return toBucketListing(data, bucketId);
|
|
2476
|
+
} catch (error) {
|
|
2477
|
+
if (isApiError(error) && error.response.status === 404) return null;
|
|
2478
|
+
throw error;
|
|
2479
|
+
}
|
|
2480
|
+
};
|
|
2481
|
+
const createListing = async (bucketId, input, signal) => {
|
|
2482
|
+
const { data } = await client.post(
|
|
2483
|
+
`/buckets/{bucketId}/listing`,
|
|
2484
|
+
{
|
|
2485
|
+
path: { bucketId },
|
|
2486
|
+
body: {
|
|
2487
|
+
listingName: input.name,
|
|
2488
|
+
listingDescription: input.description?.trim() || null,
|
|
2489
|
+
bigquery: {
|
|
2490
|
+
listingId: input.listingId,
|
|
2491
|
+
subscribers: toBackendSubscribers(input.subscribers)
|
|
2492
|
+
}
|
|
2493
|
+
}
|
|
2494
|
+
},
|
|
2495
|
+
{ signal }
|
|
2496
|
+
);
|
|
2497
|
+
return data;
|
|
2498
|
+
};
|
|
2499
|
+
const updateListing = async (bucketId, input, signal) => {
|
|
2500
|
+
const body = {};
|
|
2501
|
+
if (input.name !== void 0) body.exposureName = input.name;
|
|
2502
|
+
if (input.description !== void 0) {
|
|
2503
|
+
body.exposureDescription = input.description?.trim() || null;
|
|
2504
|
+
}
|
|
2505
|
+
if (input.subscribers !== void 0) {
|
|
2506
|
+
body.bigquery = { subscribers: toBackendSubscribers(input.subscribers) };
|
|
2507
|
+
}
|
|
2508
|
+
if (Object.keys(body).length === 0) {
|
|
2509
|
+
throw new Error("updateListing requires at least one field");
|
|
2510
|
+
}
|
|
2511
|
+
const { data } = await client.patch(`/buckets/{bucketId}/listing`, { path: { bucketId }, body }, { signal });
|
|
2512
|
+
return data;
|
|
2513
|
+
};
|
|
2514
|
+
const deleteListing = async (bucketId, signal) => {
|
|
2515
|
+
const { data } = await client.delete(
|
|
2516
|
+
`/buckets/{bucketId}/listing`,
|
|
2517
|
+
{ path: { bucketId } },
|
|
2518
|
+
{ signal }
|
|
2519
|
+
);
|
|
2520
|
+
return data;
|
|
2521
|
+
};
|
|
2522
|
+
const listListings = async (signal) => {
|
|
2523
|
+
const { data } = await client.get(`/listings`, {}, { signal });
|
|
2524
|
+
return data.map((row) => toBucketListing(row, row.bucketId));
|
|
2525
|
+
};
|
|
2387
2526
|
return {
|
|
2388
2527
|
getBuckets,
|
|
2389
2528
|
getBucket,
|
|
@@ -2392,7 +2531,12 @@ var createBuckets = (client) => {
|
|
|
2392
2531
|
deleteBucket,
|
|
2393
2532
|
deleteBucketAsync,
|
|
2394
2533
|
createScheduledRefresh,
|
|
2395
|
-
deleteScheduledTask
|
|
2534
|
+
deleteScheduledTask,
|
|
2535
|
+
getListing,
|
|
2536
|
+
createListing,
|
|
2537
|
+
updateListing,
|
|
2538
|
+
deleteListing,
|
|
2539
|
+
listListings
|
|
2396
2540
|
};
|
|
2397
2541
|
};
|
|
2398
2542
|
|
|
@@ -3459,10 +3603,29 @@ var createStorageSdk = ({ storageClient }) => {
|
|
|
3459
3603
|
const job = await storageClient.tables.exportAsync(tableId, body, options?.abortSignal);
|
|
3460
3604
|
return waitForJob(job, options);
|
|
3461
3605
|
};
|
|
3606
|
+
const getBucketListing = async (bucketId, signal) => storageClient.buckets.getListing(bucketId, signal);
|
|
3607
|
+
const listBucketListings = async (signal) => storageClient.buckets.listListings(signal);
|
|
3608
|
+
const createBucketListing = async (bucketId, input, options) => {
|
|
3609
|
+
const job = await storageClient.buckets.createListing(bucketId, input, options?.abortSignal);
|
|
3610
|
+
return waitForJob(job, options);
|
|
3611
|
+
};
|
|
3612
|
+
const updateBucketListing = async (bucketId, input, options) => {
|
|
3613
|
+
const job = await storageClient.buckets.updateListing(bucketId, input, options?.abortSignal);
|
|
3614
|
+
return waitForJob(job, options);
|
|
3615
|
+
};
|
|
3616
|
+
const deleteBucketListing = async (bucketId, options) => {
|
|
3617
|
+
const job = await storageClient.buckets.deleteListing(bucketId, options?.abortSignal);
|
|
3618
|
+
return waitForJob(job, options);
|
|
3619
|
+
};
|
|
3462
3620
|
return {
|
|
3463
3621
|
createTable,
|
|
3464
3622
|
importFromFile,
|
|
3465
|
-
exportToFile
|
|
3623
|
+
exportToFile,
|
|
3624
|
+
getBucketListing,
|
|
3625
|
+
listBucketListings,
|
|
3626
|
+
createBucketListing,
|
|
3627
|
+
updateBucketListing,
|
|
3628
|
+
deleteBucketListing
|
|
3466
3629
|
};
|
|
3467
3630
|
};
|
|
3468
3631
|
|