@acontext/acontext 0.0.7 → 0.0.8

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.
@@ -2,7 +2,7 @@
2
2
  * Spaces endpoints.
3
3
  */
4
4
  import { RequesterProtocol } from '../client-types';
5
- import { ListSpacesOutput, SearchResultBlockItem, Space, SpaceSearchResult } from '../types';
5
+ import { ExperienceConfirmation, ListExperienceConfirmationsOutput, ListSpacesOutput, SearchResultBlockItem, Space, SpaceSearchResult } from '../types';
6
6
  export declare class SpacesAPI {
7
7
  private requester;
8
8
  constructor(requester: RequesterProtocol);
@@ -67,4 +67,30 @@ export declare class SpacesAPI {
67
67
  limit?: number | null;
68
68
  threshold?: number | null;
69
69
  }): Promise<SearchResultBlockItem[]>;
70
+ /**
71
+ * Get all unconfirmed experiences in a space with cursor-based pagination.
72
+ *
73
+ * @param spaceId - The UUID of the space
74
+ * @param options - Pagination options
75
+ * @returns ListExperienceConfirmationsOutput containing the list of experience confirmations and pagination information
76
+ */
77
+ getUnconfirmedExperiences(spaceId: string, options?: {
78
+ limit?: number | null;
79
+ cursor?: string | null;
80
+ timeDesc?: boolean | null;
81
+ }): Promise<ListExperienceConfirmationsOutput>;
82
+ /**
83
+ * Confirm an experience confirmation.
84
+ *
85
+ * If save is false, delete the row. If save is true, get the data first,
86
+ * then delete the row.
87
+ *
88
+ * @param spaceId - The UUID of the space
89
+ * @param experienceId - The UUID of the experience confirmation
90
+ * @param options - Confirmation options
91
+ * @returns ExperienceConfirmation object if save is true, null otherwise
92
+ */
93
+ confirmExperience(spaceId: string, experienceId: string, options: {
94
+ save: boolean;
95
+ }): Promise<ExperienceConfirmation | null>;
70
96
  }
@@ -104,5 +104,40 @@ class SpacesAPI {
104
104
  const data = await this.requester.request('GET', `/space/${spaceId}/semantic_grep`, { params: Object.keys(params).length > 0 ? params : undefined });
105
105
  return data.map((item) => types_1.SearchResultBlockItemSchema.parse(item));
106
106
  }
107
+ /**
108
+ * Get all unconfirmed experiences in a space with cursor-based pagination.
109
+ *
110
+ * @param spaceId - The UUID of the space
111
+ * @param options - Pagination options
112
+ * @returns ListExperienceConfirmationsOutput containing the list of experience confirmations and pagination information
113
+ */
114
+ async getUnconfirmedExperiences(spaceId, options) {
115
+ const params = (0, utils_1.buildParams)({
116
+ limit: options?.limit ?? null,
117
+ cursor: options?.cursor ?? null,
118
+ time_desc: options?.timeDesc ?? null,
119
+ });
120
+ const data = await this.requester.request('GET', `/space/${spaceId}/experience_confirmations`, { params: Object.keys(params).length > 0 ? params : undefined });
121
+ return types_1.ListExperienceConfirmationsOutputSchema.parse(data);
122
+ }
123
+ /**
124
+ * Confirm an experience confirmation.
125
+ *
126
+ * If save is false, delete the row. If save is true, get the data first,
127
+ * then delete the row.
128
+ *
129
+ * @param spaceId - The UUID of the space
130
+ * @param experienceId - The UUID of the experience confirmation
131
+ * @param options - Confirmation options
132
+ * @returns ExperienceConfirmation object if save is true, null otherwise
133
+ */
134
+ async confirmExperience(spaceId, experienceId, options) {
135
+ const payload = { save: options.save };
136
+ const data = await this.requester.request('PATCH', `/space/${spaceId}/experience_confirmations/${experienceId}`, { jsonData: payload });
137
+ if (data === null || data === undefined) {
138
+ return null;
139
+ }
140
+ return types_1.ExperienceConfirmationSchema.parse(data);
141
+ }
107
142
  }
108
143
  exports.SpacesAPI = SpacesAPI;
@@ -41,3 +41,25 @@ export declare const SpaceSearchResultSchema: z.ZodObject<{
41
41
  final_answer: z.ZodOptional<z.ZodNullable<z.ZodString>>;
42
42
  }, z.core.$strip>;
43
43
  export type SpaceSearchResult = z.infer<typeof SpaceSearchResultSchema>;
44
+ export declare const ExperienceConfirmationSchema: z.ZodObject<{
45
+ id: z.ZodString;
46
+ space_id: z.ZodString;
47
+ task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
48
+ experience_data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
49
+ created_at: z.ZodString;
50
+ updated_at: z.ZodString;
51
+ }, z.core.$strip>;
52
+ export type ExperienceConfirmation = z.infer<typeof ExperienceConfirmationSchema>;
53
+ export declare const ListExperienceConfirmationsOutputSchema: z.ZodObject<{
54
+ items: z.ZodArray<z.ZodObject<{
55
+ id: z.ZodString;
56
+ space_id: z.ZodString;
57
+ task_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
58
+ experience_data: z.ZodRecord<z.ZodString, z.ZodUnknown>;
59
+ created_at: z.ZodString;
60
+ updated_at: z.ZodString;
61
+ }, z.core.$strip>>;
62
+ next_cursor: z.ZodOptional<z.ZodNullable<z.ZodString>>;
63
+ has_more: z.ZodBoolean;
64
+ }, z.core.$strip>;
65
+ export type ListExperienceConfirmationsOutput = z.infer<typeof ListExperienceConfirmationsOutputSchema>;
@@ -3,7 +3,7 @@
3
3
  * Type definitions for space resources.
4
4
  */
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.SpaceSearchResultSchema = exports.SearchResultBlockItemSchema = exports.ListSpacesOutputSchema = exports.SpaceSchema = void 0;
6
+ exports.ListExperienceConfirmationsOutputSchema = exports.ExperienceConfirmationSchema = exports.SpaceSearchResultSchema = exports.SearchResultBlockItemSchema = exports.ListSpacesOutputSchema = exports.SpaceSchema = void 0;
7
7
  const zod_1 = require("zod");
8
8
  exports.SpaceSchema = zod_1.z.object({
9
9
  id: zod_1.z.string(),
@@ -28,3 +28,16 @@ exports.SpaceSearchResultSchema = zod_1.z.object({
28
28
  cited_blocks: zod_1.z.array(exports.SearchResultBlockItemSchema),
29
29
  final_answer: zod_1.z.string().nullable().optional(),
30
30
  });
31
+ exports.ExperienceConfirmationSchema = zod_1.z.object({
32
+ id: zod_1.z.string(),
33
+ space_id: zod_1.z.string(),
34
+ task_id: zod_1.z.string().nullable().optional(),
35
+ experience_data: zod_1.z.record(zod_1.z.string(), zod_1.z.unknown()),
36
+ created_at: zod_1.z.string(),
37
+ updated_at: zod_1.z.string(),
38
+ });
39
+ exports.ListExperienceConfirmationsOutputSchema = zod_1.z.object({
40
+ items: zod_1.z.array(exports.ExperienceConfirmationSchema),
41
+ next_cursor: zod_1.z.string().nullable().optional(),
42
+ has_more: zod_1.z.boolean(),
43
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acontext/acontext",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "description": "TypeScript SDK for the Acontext API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",