@kaiban/sdk 0.4.20 → 0.4.21

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.
@@ -44,23 +44,22 @@ class SessionsClient {
44
44
  return this.http.get(`/session/${encodeURIComponent(id)}`, options);
45
45
  }
46
46
  /**
47
- * Create session data (artifact) for a session
47
+ * Create session data (artifacts) for a session (batch).
48
48
  *
49
49
  * @param sessionId - Parent session ID
50
- * @param data - Label (optional) and data payload
50
+ * @param items - Array of items (label optional, data required). At least one item.
51
51
  * @param options - Optional request configuration
52
- * @returns The created session data
52
+ * @returns Array of created session data
53
53
  *
54
54
  * @example
55
55
  * ```typescript
56
- * const sessionData = await client.sessions.createData('session_abc', {
57
- * label: 'analysis',
58
- * data: { result: 'ok', confidence: 0.95 },
59
- * });
56
+ * const created = await client.sessions.createData('session_abc', [
57
+ * { label: 'analysis', data: { result: 'ok', confidence: 0.95 } },
58
+ * ]);
60
59
  * ```
61
60
  */
62
- createData(sessionId, data, options) {
63
- return this.http.post(`/session/${encodeURIComponent(sessionId)}/data`, data, options);
61
+ createData(sessionId, items, options) {
62
+ return this.http.post(`/session/${encodeURIComponent(sessionId)}/data`, items, options);
64
63
  }
65
64
  /**
66
65
  * List all session data for a session (ordered by created_at)
@@ -41,23 +41,22 @@ export class SessionsClient {
41
41
  return this.http.get(`/session/${encodeURIComponent(id)}`, options);
42
42
  }
43
43
  /**
44
- * Create session data (artifact) for a session
44
+ * Create session data (artifacts) for a session (batch).
45
45
  *
46
46
  * @param sessionId - Parent session ID
47
- * @param data - Label (optional) and data payload
47
+ * @param items - Array of items (label optional, data required). At least one item.
48
48
  * @param options - Optional request configuration
49
- * @returns The created session data
49
+ * @returns Array of created session data
50
50
  *
51
51
  * @example
52
52
  * ```typescript
53
- * const sessionData = await client.sessions.createData('session_abc', {
54
- * label: 'analysis',
55
- * data: { result: 'ok', confidence: 0.95 },
56
- * });
53
+ * const created = await client.sessions.createData('session_abc', [
54
+ * { label: 'analysis', data: { result: 'ok', confidence: 0.95 } },
55
+ * ]);
57
56
  * ```
58
57
  */
59
- createData(sessionId, data, options) {
60
- return this.http.post(`/session/${encodeURIComponent(sessionId)}/data`, data, options);
58
+ createData(sessionId, items, options) {
59
+ return this.http.post(`/session/${encodeURIComponent(sessionId)}/data`, items, options);
61
60
  }
62
61
  /**
63
62
  * List all session data for a session (ordered by created_at)
@@ -1,4 +1,4 @@
1
- import { CreateSessionDataInput, CreateSessionInput, Session, SessionData, UpdateSessionDataInput } from '../../types/entities';
1
+ import { CreateSessionDataBatchInput, CreateSessionInput, Session, SessionData, UpdateSessionDataInput } from '../../types/entities';
2
2
  import { HttpClient } from '../http/HttpClient';
3
3
  import { RequestOptions } from '../http/types';
4
4
  /**
@@ -39,22 +39,21 @@ export declare class SessionsClient {
39
39
  */
40
40
  get(id: string, options?: RequestOptions): Promise<Session>;
41
41
  /**
42
- * Create session data (artifact) for a session
42
+ * Create session data (artifacts) for a session (batch).
43
43
  *
44
44
  * @param sessionId - Parent session ID
45
- * @param data - Label (optional) and data payload
45
+ * @param items - Array of items (label optional, data required). At least one item.
46
46
  * @param options - Optional request configuration
47
- * @returns The created session data
47
+ * @returns Array of created session data
48
48
  *
49
49
  * @example
50
50
  * ```typescript
51
- * const sessionData = await client.sessions.createData('session_abc', {
52
- * label: 'analysis',
53
- * data: { result: 'ok', confidence: 0.95 },
54
- * });
51
+ * const created = await client.sessions.createData('session_abc', [
52
+ * { label: 'analysis', data: { result: 'ok', confidence: 0.95 } },
53
+ * ]);
55
54
  * ```
56
55
  */
57
- createData(sessionId: string, data: CreateSessionDataInput, options?: RequestOptions): Promise<SessionData>;
56
+ createData(sessionId: string, items: CreateSessionDataBatchInput, options?: RequestOptions): Promise<SessionData[]>;
58
57
  /**
59
58
  * List all session data for a session (ordered by created_at)
60
59
  *
@@ -29,11 +29,13 @@ export interface SessionData {
29
29
  created_at: ISODate;
30
30
  updated_at: ISODate;
31
31
  }
32
- /** Input for creating session data (POST /v1/session/:sessionId/data) */
32
+ /** Input for a single session data item (one element of the batch) */
33
33
  export type CreateSessionDataInput = {
34
34
  label?: string;
35
35
  data: Record<string, unknown>;
36
36
  };
37
+ /** Batch input for creating session data (POST /v1/session/:sessionId/data). Must send at least one item. */
38
+ export type CreateSessionDataBatchInput = CreateSessionDataInput[];
37
39
  /** Input for updating session data (PUT /v1/session/:sessionId/data/:id) */
38
40
  export type UpdateSessionDataInput = {
39
41
  label?: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaiban/sdk",
3
- "version": "0.4.20",
3
+ "version": "0.4.21",
4
4
  "description": "Official TypeScript SDK for the Kaiban API",
5
5
  "keywords": [
6
6
  "kaiban",