@chatu-ai/builder-sdk 0.7.9 → 0.8.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/client.d.ts +39 -0
- package/dist/client.js +7 -0
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -353,6 +353,40 @@ export interface BuilderClient {
|
|
|
353
353
|
removed?: boolean;
|
|
354
354
|
}>;
|
|
355
355
|
};
|
|
356
|
+
/** 资源面板:文档集合浏览(技术方案 19) */
|
|
357
|
+
db: {
|
|
358
|
+
collections(conversationId: string, env?: 'dev' | 'prod'): Promise<{
|
|
359
|
+
ok: boolean;
|
|
360
|
+
collections: Array<{
|
|
361
|
+
name: string;
|
|
362
|
+
count: number;
|
|
363
|
+
}>;
|
|
364
|
+
}>;
|
|
365
|
+
query(conversationId: string, collection: string, opts?: {
|
|
366
|
+
env?: 'dev' | 'prod';
|
|
367
|
+
filter?: Record<string, unknown>;
|
|
368
|
+
sort?: Record<string, 1 | -1>;
|
|
369
|
+
skip?: number;
|
|
370
|
+
limit?: number;
|
|
371
|
+
}): Promise<{
|
|
372
|
+
ok: boolean;
|
|
373
|
+
docs: Array<Record<string, unknown>>;
|
|
374
|
+
total: number;
|
|
375
|
+
nextSkip: number | null;
|
|
376
|
+
}>;
|
|
377
|
+
replace(conversationId: string, collection: string, id: string, doc: Record<string, unknown>, env?: 'dev' | 'prod'): Promise<{
|
|
378
|
+
ok: boolean;
|
|
379
|
+
doc?: Record<string, unknown>;
|
|
380
|
+
}>;
|
|
381
|
+
remove(conversationId: string, collection: string, id: string, env?: 'dev' | 'prod'): Promise<{
|
|
382
|
+
ok: boolean;
|
|
383
|
+
removed?: boolean;
|
|
384
|
+
}>;
|
|
385
|
+
drop(conversationId: string, collection: string, env?: 'dev' | 'prod'): Promise<{
|
|
386
|
+
ok: boolean;
|
|
387
|
+
dropped?: boolean;
|
|
388
|
+
}>;
|
|
389
|
+
};
|
|
356
390
|
/** 资源面板:对象存储浏览 */
|
|
357
391
|
storage: {
|
|
358
392
|
list(conversationId: string, opts?: {
|
|
@@ -400,6 +434,7 @@ export interface BuilderClient {
|
|
|
400
434
|
overwrite?: boolean;
|
|
401
435
|
kv?: boolean;
|
|
402
436
|
storage?: boolean;
|
|
437
|
+
db?: boolean;
|
|
403
438
|
}): Promise<{
|
|
404
439
|
ok: boolean;
|
|
405
440
|
error?: string;
|
|
@@ -412,6 +447,10 @@ export interface BuilderClient {
|
|
|
412
447
|
skipped: number;
|
|
413
448
|
bytes: number;
|
|
414
449
|
} | null;
|
|
450
|
+
db?: {
|
|
451
|
+
copied: number;
|
|
452
|
+
skipped: number;
|
|
453
|
+
} | null;
|
|
415
454
|
}>;
|
|
416
455
|
/** 导出数据:KV 键值 + 对象清单(1 小时下载地址) */
|
|
417
456
|
export(conversationId: string, env?: 'dev' | 'prod'): Promise<{
|
package/dist/client.js
CHANGED
|
@@ -110,6 +110,13 @@ export function createBuilderClient(options) {
|
|
|
110
110
|
set: (id, key, value, o) => req(`/${id}/data/kv/${encPath(key)}?${qs({ env: o?.env })}`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ value, ex: o?.ex }) }),
|
|
111
111
|
remove: (id, key, env) => req(`/${id}/data/kv/${encPath(key)}?${qs({ env })}`, { method: 'DELETE' }),
|
|
112
112
|
},
|
|
113
|
+
db: {
|
|
114
|
+
collections: (id, env) => req(`/${id}/data/db?${qs({ env })}`),
|
|
115
|
+
query: (id, coll, o) => req(`/${id}/data/db/${encPath(coll)}/query?${qs({ env: o?.env })}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ filter: o?.filter, sort: o?.sort, skip: o?.skip, limit: o?.limit }) }),
|
|
116
|
+
replace: (id, coll, docId, doc, env) => req(`/${id}/data/db/${encPath(coll)}/${encPath(docId)}?${qs({ env })}`, { method: 'PUT', headers: { 'content-type': 'application/json' }, body: JSON.stringify(doc) }),
|
|
117
|
+
remove: (id, coll, docId, env) => req(`/${id}/data/db/${encPath(coll)}/${encPath(docId)}?${qs({ env })}`, { method: 'DELETE' }),
|
|
118
|
+
drop: (id, coll, env) => req(`/${id}/data/db/${encPath(coll)}?${qs({ env })}`, { method: 'DELETE' }),
|
|
119
|
+
},
|
|
113
120
|
storage: {
|
|
114
121
|
list: (id, o) => req(`/${id}/data/storage?${qs({ env: o?.env, prefix: o?.prefix, cursor: o?.cursor ?? undefined, limit: o?.limit })}`),
|
|
115
122
|
sign: (id, key, o) => req(`/${id}/data/storage/sign?${qs({ env: o?.env })}`, { method: 'POST', headers: { 'content-type': 'application/json' }, body: JSON.stringify({ key, expiresIn: o?.expiresIn, downloadName: o?.downloadName }) }),
|