@acontext/acontext 0.1.3 → 0.1.4

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.
@@ -9,11 +9,26 @@ export type MessageBlob = AcontextMessage | Record<string, unknown>;
9
9
  export declare class SessionsAPI {
10
10
  private requester;
11
11
  constructor(requester: RequesterProtocol);
12
+ /**
13
+ * List all sessions in the project.
14
+ *
15
+ * @param options - Options for listing sessions.
16
+ * @param options.user - Filter by user identifier.
17
+ * @param options.limit - Maximum number of sessions to return.
18
+ * @param options.cursor - Cursor for pagination.
19
+ * @param options.timeDesc - Order by created_at descending if true, ascending if false.
20
+ * @param options.filterByConfigs - Filter by session configs using JSONB containment.
21
+ * Only sessions where configs contains all key-value pairs in this object will be returned.
22
+ * Supports nested objects. Note: Matching is case-sensitive and type-sensitive.
23
+ * Sessions with NULL configs are excluded from filtered results.
24
+ * @returns ListSessionsOutput containing the list of sessions and pagination information.
25
+ */
12
26
  list(options?: {
13
27
  user?: string | null;
14
28
  limit?: number | null;
15
29
  cursor?: string | null;
16
30
  timeDesc?: boolean | null;
31
+ filterByConfigs?: Record<string, unknown> | null;
17
32
  }): Promise<ListSessionsOutput>;
18
33
  create(options?: {
19
34
  user?: string | null;
@@ -11,11 +11,29 @@ class SessionsAPI {
11
11
  constructor(requester) {
12
12
  this.requester = requester;
13
13
  }
14
+ /**
15
+ * List all sessions in the project.
16
+ *
17
+ * @param options - Options for listing sessions.
18
+ * @param options.user - Filter by user identifier.
19
+ * @param options.limit - Maximum number of sessions to return.
20
+ * @param options.cursor - Cursor for pagination.
21
+ * @param options.timeDesc - Order by created_at descending if true, ascending if false.
22
+ * @param options.filterByConfigs - Filter by session configs using JSONB containment.
23
+ * Only sessions where configs contains all key-value pairs in this object will be returned.
24
+ * Supports nested objects. Note: Matching is case-sensitive and type-sensitive.
25
+ * Sessions with NULL configs are excluded from filtered results.
26
+ * @returns ListSessionsOutput containing the list of sessions and pagination information.
27
+ */
14
28
  async list(options) {
15
29
  const params = {};
16
30
  if (options?.user) {
17
31
  params.user = options.user;
18
32
  }
33
+ // Handle filterByConfigs - JSON encode, skip empty object
34
+ if (options?.filterByConfigs && Object.keys(options.filterByConfigs).length > 0) {
35
+ params.filter_by_configs = JSON.stringify(options.filterByConfigs);
36
+ }
19
37
  Object.assign(params, (0, utils_1.buildParams)({
20
38
  limit: options?.limit ?? null,
21
39
  cursor: options?.cursor ?? null,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",