agentbase-web-sdk 2.6.0-fix1

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.
Files changed (89) hide show
  1. package/LICENSE +0 -0
  2. package/README.md +41 -0
  3. package/dist/cjs/sdk.js +13833 -0
  4. package/dist/cjs/sdk.js.map +1 -0
  5. package/dist/esm/sdk.js +13805 -0
  6. package/dist/esm/sdk.js.map +1 -0
  7. package/dist/iife/sdk.js +17632 -0
  8. package/package.json +50 -0
  9. package/types/channel.d.ts +79 -0
  10. package/types/client.d.ts +289 -0
  11. package/types/enums/authentication-factor.d.ts +6 -0
  12. package/types/enums/authenticator-type.d.ts +3 -0
  13. package/types/enums/browser-permission.d.ts +22 -0
  14. package/types/enums/browser.d.ts +16 -0
  15. package/types/enums/credit-card.d.ts +19 -0
  16. package/types/enums/distillation-message-role.d.ts +6 -0
  17. package/types/enums/distillation-mode.d.ts +4 -0
  18. package/types/enums/distillation-tool-status.d.ts +4 -0
  19. package/types/enums/execution-method.d.ts +9 -0
  20. package/types/enums/execution-status.d.ts +7 -0
  21. package/types/enums/execution-trigger.d.ts +5 -0
  22. package/types/enums/export-job-mode.d.ts +4 -0
  23. package/types/enums/export-mode.d.ts +3 -0
  24. package/types/enums/feedback-type.d.ts +5 -0
  25. package/types/enums/flag.d.ts +197 -0
  26. package/types/enums/format.d.ts +4 -0
  27. package/types/enums/image-format.d.ts +9 -0
  28. package/types/enums/image-gravity.d.ts +11 -0
  29. package/types/enums/kind.d.ts +6 -0
  30. package/types/enums/kinds.d.ts +6 -0
  31. package/types/enums/knowledge-base-data-source-document-import-result-status.d.ts +5 -0
  32. package/types/enums/memory-access-mode.d.ts +4 -0
  33. package/types/enums/memory-batch-operation.d.ts +5 -0
  34. package/types/enums/memory-bulk-delete-item-status.d.ts +4 -0
  35. package/types/enums/memory-bulk-delete-response-status.d.ts +4 -0
  36. package/types/enums/memory-handling-policy.d.ts +5 -0
  37. package/types/enums/memory-message-role.d.ts +5 -0
  38. package/types/enums/memory-record-kind.d.ts +5 -0
  39. package/types/enums/memory-record-sensitivity.d.ts +5 -0
  40. package/types/enums/memory-scope.d.ts +7 -0
  41. package/types/enums/memory-sensitivity.d.ts +6 -0
  42. package/types/enums/memory-share-subject-type.d.ts +4 -0
  43. package/types/enums/o-auth-provider.d.ts +45 -0
  44. package/types/enums/organization-project-deletion-deletion-status.d.ts +5 -0
  45. package/types/enums/organization-role.d.ts +8 -0
  46. package/types/enums/organization-usage-range.d.ts +5 -0
  47. package/types/enums/outcome.d.ts +6 -0
  48. package/types/enums/profile-extraction-mode.d.ts +4 -0
  49. package/types/enums/profile-type.d.ts +4 -0
  50. package/types/enums/project-deletion-restore-status.d.ts +3 -0
  51. package/types/enums/project-deletion-result-deletion-status.d.ts +5 -0
  52. package/types/enums/project-deletion-result-status.d.ts +5 -0
  53. package/types/enums/record-kind.d.ts +5 -0
  54. package/types/enums/retention-policy.d.ts +3 -0
  55. package/types/enums/scope.d.ts +5 -0
  56. package/types/enums/source-type.d.ts +6 -0
  57. package/types/enums/status.d.ts +17 -0
  58. package/types/enums/theme.d.ts +4 -0
  59. package/types/enums/timezone.d.ts +422 -0
  60. package/types/enums/transaction-action.d.ts +12 -0
  61. package/types/enums/validation-status.d.ts +6 -0
  62. package/types/enums/verification-source.d.ts +5 -0
  63. package/types/id.d.ts +20 -0
  64. package/types/index.d.ts +87 -0
  65. package/types/models.d.ts +2537 -0
  66. package/types/operator.d.ts +180 -0
  67. package/types/permission.d.ts +43 -0
  68. package/types/query.d.ts +442 -0
  69. package/types/role.d.ts +70 -0
  70. package/types/service.d.ts +11 -0
  71. package/types/services/account.d.ts +1267 -0
  72. package/types/services/ai-gateway.d.ts +738 -0
  73. package/types/services/avatars.d.ts +320 -0
  74. package/types/services/databases.d.ts +437 -0
  75. package/types/services/documents-db.d.ts +405 -0
  76. package/types/services/functions.d.ts +91 -0
  77. package/types/services/graphql.d.ts +43 -0
  78. package/types/services/knowledge-bases.d.ts +117 -0
  79. package/types/services/llm-gateway.d.ts +282 -0
  80. package/types/services/locale.d.ts +64 -0
  81. package/types/services/memory.d.ts +1765 -0
  82. package/types/services/messaging.d.ts +53 -0
  83. package/types/services/projects.d.ts +129 -0
  84. package/types/services/realtime.d.ts +197 -0
  85. package/types/services/self-hosted-organizations.d.ts +495 -0
  86. package/types/services/storage.d.ts +259 -0
  87. package/types/services/tables-db.d.ts +434 -0
  88. package/types/services/teams.d.ts +341 -0
  89. package/types/services/vectors-db.d.ts +297 -0
@@ -0,0 +1,405 @@
1
+ import { Client } from '../client';
2
+ import type { Models } from '../models';
3
+ export declare class DocumentsDB {
4
+ client: Client;
5
+ constructor(client: Client);
6
+ /**
7
+ *
8
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries).
9
+ * @throws {AgentbaseException}
10
+ * @returns {Promise<Models.TransactionList>}
11
+ */
12
+ listTransactions(params?: {
13
+ queries?: string[];
14
+ }): Promise<Models.TransactionList>;
15
+ /**
16
+ *
17
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries).
18
+ * @throws {AgentbaseException}
19
+ * @returns {Promise<Models.TransactionList>}
20
+ * @deprecated Use the object parameter style method for a better developer experience.
21
+ */
22
+ listTransactions(queries?: string[]): Promise<Models.TransactionList>;
23
+ /**
24
+ *
25
+ * @param {number} params.ttl - Seconds before the transaction expires.
26
+ * @throws {AgentbaseException}
27
+ * @returns {Promise<Models.Transaction>}
28
+ */
29
+ createTransaction(params?: {
30
+ ttl?: number;
31
+ }): Promise<Models.Transaction>;
32
+ /**
33
+ *
34
+ * @param {number} ttl - Seconds before the transaction expires.
35
+ * @throws {AgentbaseException}
36
+ * @returns {Promise<Models.Transaction>}
37
+ * @deprecated Use the object parameter style method for a better developer experience.
38
+ */
39
+ createTransaction(ttl?: number): Promise<Models.Transaction>;
40
+ /**
41
+ *
42
+ * @param {string} params.transactionId - Transaction ID.
43
+ * @throws {AgentbaseException}
44
+ * @returns {Promise<Models.Transaction>}
45
+ */
46
+ getTransaction(params: {
47
+ transactionId: string;
48
+ }): Promise<Models.Transaction>;
49
+ /**
50
+ *
51
+ * @param {string} transactionId - Transaction ID.
52
+ * @throws {AgentbaseException}
53
+ * @returns {Promise<Models.Transaction>}
54
+ * @deprecated Use the object parameter style method for a better developer experience.
55
+ */
56
+ getTransaction(transactionId: string): Promise<Models.Transaction>;
57
+ /**
58
+ *
59
+ * @param {string} params.transactionId - Transaction ID.
60
+ * @param {boolean} params.commit - Commit transaction?
61
+ * @param {boolean} params.rollback - Rollback transaction?
62
+ * @throws {AgentbaseException}
63
+ * @returns {Promise<Models.Transaction>}
64
+ */
65
+ updateTransaction(params: {
66
+ transactionId: string;
67
+ commit?: boolean;
68
+ rollback?: boolean;
69
+ }): Promise<Models.Transaction>;
70
+ /**
71
+ *
72
+ * @param {string} transactionId - Transaction ID.
73
+ * @param {boolean} commit - Commit transaction?
74
+ * @param {boolean} rollback - Rollback transaction?
75
+ * @throws {AgentbaseException}
76
+ * @returns {Promise<Models.Transaction>}
77
+ * @deprecated Use the object parameter style method for a better developer experience.
78
+ */
79
+ updateTransaction(transactionId: string, commit?: boolean, rollback?: boolean): Promise<Models.Transaction>;
80
+ /**
81
+ *
82
+ * @param {string} params.transactionId - Transaction ID.
83
+ * @throws {AgentbaseException}
84
+ * @returns {Promise<{}>}
85
+ */
86
+ deleteTransaction(params: {
87
+ transactionId: string;
88
+ }): Promise<{}>;
89
+ /**
90
+ *
91
+ * @param {string} transactionId - Transaction ID.
92
+ * @throws {AgentbaseException}
93
+ * @returns {Promise<{}>}
94
+ * @deprecated Use the object parameter style method for a better developer experience.
95
+ */
96
+ deleteTransaction(transactionId: string): Promise<{}>;
97
+ /**
98
+ *
99
+ * @param {string} params.transactionId - Transaction ID.
100
+ * @param {Models.DocumentsDBTransactionOperation[]} params.operations - Array of staged operations.
101
+ * @throws {AgentbaseException}
102
+ * @returns {Promise<Models.Transaction>}
103
+ */
104
+ createOperations(params: {
105
+ transactionId: string;
106
+ operations?: Models.DocumentsDBTransactionOperation[];
107
+ }): Promise<Models.Transaction>;
108
+ /**
109
+ *
110
+ * @param {string} transactionId - Transaction ID.
111
+ * @param {Models.DocumentsDBTransactionOperation[]} operations - Array of staged operations.
112
+ * @throws {AgentbaseException}
113
+ * @returns {Promise<Models.Transaction>}
114
+ * @deprecated Use the object parameter style method for a better developer experience.
115
+ */
116
+ createOperations(transactionId: string, operations?: Models.DocumentsDBTransactionOperation[]): Promise<Models.Transaction>;
117
+ /**
118
+ * Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
119
+ *
120
+ * @param {string} params.databaseId - Database ID.
121
+ * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
122
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
123
+ * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
124
+ * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
125
+ * @param {number} params.ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
126
+ * @throws {AgentbaseException}
127
+ * @returns {Promise<Models.DocumentList<Document>>}
128
+ */
129
+ listDocuments<Document extends Models.Document = Models.DefaultDocument>(params: {
130
+ databaseId: string;
131
+ collectionId: string;
132
+ queries?: string[];
133
+ transactionId?: string;
134
+ total?: boolean;
135
+ ttl?: number;
136
+ }): Promise<Models.DocumentList<Document>>;
137
+ /**
138
+ * Get a list of all the user's documents in a given collection. You can use the query params to filter your results.
139
+ *
140
+ * @param {string} databaseId - Database ID.
141
+ * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
142
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
143
+ * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
144
+ * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
145
+ * @param {number} ttl - TTL (seconds) for cached responses when caching is enabled for select queries. Must be between 0 and 86400 (24 hours).
146
+ * @throws {AgentbaseException}
147
+ * @returns {Promise<Models.DocumentList<Document>>}
148
+ * @deprecated Use the object parameter style method for a better developer experience.
149
+ */
150
+ listDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, queries?: string[], transactionId?: string, total?: boolean, ttl?: number): Promise<Models.DocumentList<Document>>;
151
+ /**
152
+ * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
153
+ *
154
+ * @param {string} params.databaseId - Database ID.
155
+ * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
156
+ * @param {string} params.documentId - Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
157
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} params.data - Document data as JSON object.
158
+ * @param {string[]} params.permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions]([HOSTNAME]/docs/permissions).
159
+ * @throws {AgentbaseException}
160
+ * @returns {Promise<Document>}
161
+ */
162
+ createDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
163
+ databaseId: string;
164
+ collectionId: string;
165
+ documentId: string;
166
+ data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>;
167
+ permissions?: string[];
168
+ }): Promise<Document>;
169
+ /**
170
+ * Create a new Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
171
+ *
172
+ * @param {string} databaseId - Database ID.
173
+ * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
174
+ * @param {string} documentId - Document ID. Choose a custom ID or generate a random ID with `ID.unique()`. Valid chars are a-z, A-Z, 0-9, period, hyphen, and underscore. Can't start with a special char. Max length is 36 chars.
175
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>} data - Document data as JSON object.
176
+ * @param {string[]} permissions - An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions]([HOSTNAME]/docs/permissions).
177
+ * @throws {AgentbaseException}
178
+ * @returns {Promise<Document>}
179
+ * @deprecated Use the object parameter style method for a better developer experience.
180
+ */
181
+ createDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Omit<Document, keyof Models.Document>, permissions?: string[]): Promise<Document>;
182
+ /**
183
+ * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
184
+ *
185
+ * @param {string} params.databaseId - Database ID.
186
+ * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
187
+ * @throws {AgentbaseException}
188
+ * @returns {Promise<Models.DocumentList<Document>>}
189
+ */
190
+ createDocuments<Document extends Models.Document = Models.DefaultDocument>(params: {
191
+ databaseId: string;
192
+ collectionId: string;
193
+ }): Promise<Models.DocumentList<Document>>;
194
+ /**
195
+ * Create new Documents. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
196
+ *
197
+ * @param {string} databaseId - Database ID.
198
+ * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection). Make sure to define attributes before creating documents.
199
+ * @throws {AgentbaseException}
200
+ * @returns {Promise<Models.DocumentList<Document>>}
201
+ * @deprecated Use the object parameter style method for a better developer experience.
202
+ */
203
+ createDocuments<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string): Promise<Models.DocumentList<Document>>;
204
+ /**
205
+ * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
206
+ *
207
+ * @param {string} params.databaseId - Database ID.
208
+ * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
209
+ * @param {string} params.documentId - Document ID.
210
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
211
+ * @param {string} params.transactionId - Transaction ID to read uncommitted changes within the transaction.
212
+ * @throws {AgentbaseException}
213
+ * @returns {Promise<Document>}
214
+ */
215
+ getDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
216
+ databaseId: string;
217
+ collectionId: string;
218
+ documentId: string;
219
+ queries?: string[];
220
+ transactionId?: string;
221
+ }): Promise<Document>;
222
+ /**
223
+ * Get a document by its unique ID. This endpoint response returns a JSON object with the document data.
224
+ *
225
+ * @param {string} databaseId - Database ID.
226
+ * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
227
+ * @param {string} documentId - Document ID.
228
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
229
+ * @param {string} transactionId - Transaction ID to read uncommitted changes within the transaction.
230
+ * @throws {AgentbaseException}
231
+ * @returns {Promise<Document>}
232
+ * @deprecated Use the object parameter style method for a better developer experience.
233
+ */
234
+ getDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, queries?: string[], transactionId?: string): Promise<Document>;
235
+ /**
236
+ * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
237
+ *
238
+ * @param {string} params.databaseId - Database ID.
239
+ * @param {string} params.collectionId - Collection ID.
240
+ * @param {string} params.documentId - Document ID.
241
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include all required fields of the document to be created or updated.
242
+ * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
243
+ * @param {string} params.transactionId - Transaction ID for staging the operation.
244
+ * @throws {AgentbaseException}
245
+ * @returns {Promise<Document>}
246
+ */
247
+ upsertDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
248
+ databaseId: string;
249
+ collectionId: string;
250
+ documentId: string;
251
+ data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>;
252
+ permissions?: string[];
253
+ transactionId?: string;
254
+ }): Promise<Document>;
255
+ /**
256
+ * Create or update a Document. Before using this route, you should create a new collection resource using either a [server integration]([HOSTNAME]/docs/server/databases#documentsDBCreateCollection) API or directly from your database console.
257
+ *
258
+ * @param {string} databaseId - Database ID.
259
+ * @param {string} collectionId - Collection ID.
260
+ * @param {string} documentId - Document ID.
261
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include all required fields of the document to be created or updated.
262
+ * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
263
+ * @param {string} transactionId - Transaction ID for staging the operation.
264
+ * @throws {AgentbaseException}
265
+ * @returns {Promise<Document>}
266
+ * @deprecated Use the object parameter style method for a better developer experience.
267
+ */
268
+ upsertDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
269
+ /**
270
+ * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
271
+ *
272
+ * @param {string} params.databaseId - Database ID.
273
+ * @param {string} params.collectionId - Collection ID.
274
+ * @param {string} params.documentId - Document ID.
275
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} params.data - Document data as JSON object. Include only fields and value pairs to be updated.
276
+ * @param {string[]} params.permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
277
+ * @param {string} params.transactionId - Transaction ID for staging the operation.
278
+ * @throws {AgentbaseException}
279
+ * @returns {Promise<Document>}
280
+ */
281
+ updateDocument<Document extends Models.Document = Models.DefaultDocument>(params: {
282
+ databaseId: string;
283
+ collectionId: string;
284
+ documentId: string;
285
+ data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>;
286
+ permissions?: string[];
287
+ transactionId?: string;
288
+ }): Promise<Document>;
289
+ /**
290
+ * Update a document by its unique ID. Using the patch method you can pass only specific fields that will get updated.
291
+ *
292
+ * @param {string} databaseId - Database ID.
293
+ * @param {string} collectionId - Collection ID.
294
+ * @param {string} documentId - Document ID.
295
+ * @param {Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>} data - Document data as JSON object. Include only fields and value pairs to be updated.
296
+ * @param {string[]} permissions - An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions]([HOSTNAME]/docs/permissions).
297
+ * @param {string} transactionId - Transaction ID for staging the operation.
298
+ * @throws {AgentbaseException}
299
+ * @returns {Promise<Document>}
300
+ * @deprecated Use the object parameter style method for a better developer experience.
301
+ */
302
+ updateDocument<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, data?: Document extends Models.DefaultDocument ? Partial<Models.Document> & Record<string, any> : Partial<Models.Document> & Partial<Omit<Document, keyof Models.Document>>, permissions?: string[], transactionId?: string): Promise<Document>;
303
+ /**
304
+ * Delete a document by its unique ID.
305
+ *
306
+ * @param {string} params.databaseId - Database ID.
307
+ * @param {string} params.collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
308
+ * @param {string} params.documentId - Document ID.
309
+ * @param {string} params.transactionId - Transaction ID for staging the operation.
310
+ * @throws {AgentbaseException}
311
+ * @returns {Promise<{}>}
312
+ */
313
+ deleteDocument(params: {
314
+ databaseId: string;
315
+ collectionId: string;
316
+ documentId: string;
317
+ transactionId?: string;
318
+ }): Promise<{}>;
319
+ /**
320
+ * Delete a document by its unique ID.
321
+ *
322
+ * @param {string} databaseId - Database ID.
323
+ * @param {string} collectionId - Collection ID. You can create a new collection using the Database service [server integration]([HOSTNAME]/docs/server/databases#databasesCreateCollection).
324
+ * @param {string} documentId - Document ID.
325
+ * @param {string} transactionId - Transaction ID for staging the operation.
326
+ * @throws {AgentbaseException}
327
+ * @returns {Promise<{}>}
328
+ * @deprecated Use the object parameter style method for a better developer experience.
329
+ */
330
+ deleteDocument(databaseId: string, collectionId: string, documentId: string, transactionId?: string): Promise<{}>;
331
+ /**
332
+ * Decrement a specific column of a row by a given value.
333
+ *
334
+ * @param {string} params.databaseId - Database ID.
335
+ * @param {string} params.collectionId - Collection ID.
336
+ * @param {string} params.documentId - Document ID.
337
+ * @param {string} params.attribute - Attribute key.
338
+ * @param {number} params.value - Value to decrement the attribute by. The value must be a number.
339
+ * @param {number} params.min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
340
+ * @param {string} params.transactionId - Transaction ID for staging the operation.
341
+ * @throws {AgentbaseException}
342
+ * @returns {Promise<Document>}
343
+ */
344
+ decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: {
345
+ databaseId: string;
346
+ collectionId: string;
347
+ documentId: string;
348
+ attribute: string;
349
+ value?: number;
350
+ min?: number;
351
+ transactionId?: string;
352
+ }): Promise<Document>;
353
+ /**
354
+ * Decrement a specific column of a row by a given value.
355
+ *
356
+ * @param {string} databaseId - Database ID.
357
+ * @param {string} collectionId - Collection ID.
358
+ * @param {string} documentId - Document ID.
359
+ * @param {string} attribute - Attribute key.
360
+ * @param {number} value - Value to decrement the attribute by. The value must be a number.
361
+ * @param {number} min - Minimum value for the attribute. If the current value is lesser than this value, an exception will be thrown.
362
+ * @param {string} transactionId - Transaction ID for staging the operation.
363
+ * @throws {AgentbaseException}
364
+ * @returns {Promise<Document>}
365
+ * @deprecated Use the object parameter style method for a better developer experience.
366
+ */
367
+ decrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, min?: number, transactionId?: string): Promise<Document>;
368
+ /**
369
+ * Increment a specific column of a row by a given value.
370
+ *
371
+ * @param {string} params.databaseId - Database ID.
372
+ * @param {string} params.collectionId - Collection ID.
373
+ * @param {string} params.documentId - Document ID.
374
+ * @param {string} params.attribute - Attribute key.
375
+ * @param {number} params.value - Value to increment the attribute by. The value must be a number.
376
+ * @param {number} params.max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
377
+ * @param {string} params.transactionId - Transaction ID for staging the operation.
378
+ * @throws {AgentbaseException}
379
+ * @returns {Promise<Document>}
380
+ */
381
+ incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(params: {
382
+ databaseId: string;
383
+ collectionId: string;
384
+ documentId: string;
385
+ attribute: string;
386
+ value?: number;
387
+ max?: number;
388
+ transactionId?: string;
389
+ }): Promise<Document>;
390
+ /**
391
+ * Increment a specific column of a row by a given value.
392
+ *
393
+ * @param {string} databaseId - Database ID.
394
+ * @param {string} collectionId - Collection ID.
395
+ * @param {string} documentId - Document ID.
396
+ * @param {string} attribute - Attribute key.
397
+ * @param {number} value - Value to increment the attribute by. The value must be a number.
398
+ * @param {number} max - Maximum value for the attribute. If the current value is greater than this value, an error will be thrown.
399
+ * @param {string} transactionId - Transaction ID for staging the operation.
400
+ * @throws {AgentbaseException}
401
+ * @returns {Promise<Document>}
402
+ * @deprecated Use the object parameter style method for a better developer experience.
403
+ */
404
+ incrementDocumentAttribute<Document extends Models.Document = Models.DefaultDocument>(databaseId: string, collectionId: string, documentId: string, attribute: string, value?: number, max?: number, transactionId?: string): Promise<Document>;
405
+ }
@@ -0,0 +1,91 @@
1
+ import { Client } from '../client';
2
+ import type { Models } from '../models';
3
+ import { ExecutionMethod } from '../enums/execution-method';
4
+ export declare class Functions {
5
+ client: Client;
6
+ constructor(client: Client);
7
+ /**
8
+ * Get a list of all the current user function execution logs. You can use the query params to filter your results.
9
+ *
10
+ * @param {string} params.functionId - Function ID.
11
+ * @param {string[]} params.queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
12
+ * @param {boolean} params.total - When set to false, the total count returned will be 0 and will not be calculated.
13
+ * @throws {AgentbaseException}
14
+ * @returns {Promise<Models.ExecutionList>}
15
+ */
16
+ listExecutions(params: {
17
+ functionId: string;
18
+ queries?: string[];
19
+ total?: boolean;
20
+ }): Promise<Models.ExecutionList>;
21
+ /**
22
+ * Get a list of all the current user function execution logs. You can use the query params to filter your results.
23
+ *
24
+ * @param {string} functionId - Function ID.
25
+ * @param {string[]} queries - Array of query strings generated using the Query class provided by the SDK. [Learn more about queries]([HOSTNAME]/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long. You may filter on the following attributes: trigger, status, responseStatusCode, duration, requestMethod, requestPath, deploymentId
26
+ * @param {boolean} total - When set to false, the total count returned will be 0 and will not be calculated.
27
+ * @throws {AgentbaseException}
28
+ * @returns {Promise<Models.ExecutionList>}
29
+ * @deprecated Use the object parameter style method for a better developer experience.
30
+ */
31
+ listExecutions(functionId: string, queries?: string[], total?: boolean): Promise<Models.ExecutionList>;
32
+ /**
33
+ * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
34
+ *
35
+ * @param {string} params.functionId - Function ID.
36
+ * @param {string} params.body - HTTP body of execution. Default value is empty string.
37
+ * @param {boolean} params.async - Execute code in the background. Default value is false.
38
+ * @param {string} params.xpath - HTTP path of execution. Path can include query params. Default value is /
39
+ * @param {ExecutionMethod} params.method - HTTP method of execution. Default value is POST.
40
+ * @param {object} params.headers - HTTP headers of execution. Defaults to empty.
41
+ * @param {string} params.scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
42
+ * @throws {AgentbaseException}
43
+ * @returns {Promise<Models.Execution>}
44
+ */
45
+ createExecution(params: {
46
+ functionId: string;
47
+ body?: string;
48
+ async?: boolean;
49
+ xpath?: string;
50
+ method?: ExecutionMethod;
51
+ headers?: object;
52
+ scheduledAt?: string;
53
+ }): Promise<Models.Execution>;
54
+ /**
55
+ * Trigger a function execution. The returned object will return you the current execution status. You can ping the `Get Execution` endpoint to get updates on the current execution status. Once this endpoint is called, your function execution process will start asynchronously.
56
+ *
57
+ * @param {string} functionId - Function ID.
58
+ * @param {string} body - HTTP body of execution. Default value is empty string.
59
+ * @param {boolean} async - Execute code in the background. Default value is false.
60
+ * @param {string} xpath - HTTP path of execution. Path can include query params. Default value is /
61
+ * @param {ExecutionMethod} method - HTTP method of execution. Default value is POST.
62
+ * @param {object} headers - HTTP headers of execution. Defaults to empty.
63
+ * @param {string} scheduledAt - Scheduled execution time in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html) format. DateTime value must be in future with precision in minutes.
64
+ * @throws {AgentbaseException}
65
+ * @returns {Promise<Models.Execution>}
66
+ * @deprecated Use the object parameter style method for a better developer experience.
67
+ */
68
+ createExecution(functionId: string, body?: string, async?: boolean, xpath?: string, method?: ExecutionMethod, headers?: object, scheduledAt?: string): Promise<Models.Execution>;
69
+ /**
70
+ * Get a function execution log by its unique ID.
71
+ *
72
+ * @param {string} params.functionId - Function ID.
73
+ * @param {string} params.executionId - Execution ID.
74
+ * @throws {AgentbaseException}
75
+ * @returns {Promise<Models.Execution>}
76
+ */
77
+ getExecution(params: {
78
+ functionId: string;
79
+ executionId: string;
80
+ }): Promise<Models.Execution>;
81
+ /**
82
+ * Get a function execution log by its unique ID.
83
+ *
84
+ * @param {string} functionId - Function ID.
85
+ * @param {string} executionId - Execution ID.
86
+ * @throws {AgentbaseException}
87
+ * @returns {Promise<Models.Execution>}
88
+ * @deprecated Use the object parameter style method for a better developer experience.
89
+ */
90
+ getExecution(functionId: string, executionId: string): Promise<Models.Execution>;
91
+ }
@@ -0,0 +1,43 @@
1
+ import { Client } from '../client';
2
+ export declare class Graphql {
3
+ client: Client;
4
+ constructor(client: Client);
5
+ /**
6
+ * Execute a GraphQL mutation.
7
+ *
8
+ * @param {object} params.query - The query or queries to execute.
9
+ * @throws {AgentbaseException}
10
+ * @returns {Promise<{}>}
11
+ */
12
+ query(params: {
13
+ query: object;
14
+ }): Promise<{}>;
15
+ /**
16
+ * Execute a GraphQL mutation.
17
+ *
18
+ * @param {object} query - The query or queries to execute.
19
+ * @throws {AgentbaseException}
20
+ * @returns {Promise<{}>}
21
+ * @deprecated Use the object parameter style method for a better developer experience.
22
+ */
23
+ query(query: object): Promise<{}>;
24
+ /**
25
+ * Execute a GraphQL mutation.
26
+ *
27
+ * @param {object} params.query - The query or queries to execute.
28
+ * @throws {AgentbaseException}
29
+ * @returns {Promise<{}>}
30
+ */
31
+ mutation(params: {
32
+ query: object;
33
+ }): Promise<{}>;
34
+ /**
35
+ * Execute a GraphQL mutation.
36
+ *
37
+ * @param {object} query - The query or queries to execute.
38
+ * @throws {AgentbaseException}
39
+ * @returns {Promise<{}>}
40
+ * @deprecated Use the object parameter style method for a better developer experience.
41
+ */
42
+ mutation(query: object): Promise<{}>;
43
+ }
@@ -0,0 +1,117 @@
1
+ import { Client } from '../client';
2
+ import type { Models } from '../models';
3
+ export declare class KnowledgeBases {
4
+ client: Client;
5
+ constructor(client: Client);
6
+ /**
7
+ * Import the current user's personal Yuque documents by URL using an authorized Yuque OAuth session. No team data source is required. Document ownership uses `source=yuque:personal`.
8
+ *
9
+ * The service resolves the session's current-user credential from encrypted private storage before requesting the Yuque Open API. If the credential is missing, was locally cancelled, was revoked at Yuque, or Yuque returns 401/403, the request fails with `knowledge_base_yuque_oauth_reauth_required` (HTTP 401); authorize again before retrying.
10
+ *
11
+ * URL rules match the team data-source import: only approved Yuque HTTPS hosts and an exact `{group}/{book}/{slug}` path are accepted. The service never fetches the pasted URL directly.
12
+ *
13
+ *
14
+ * @param {string} params.knowledgeBaseId - Knowledge base ID.
15
+ * @param {string} params.sessionId - Yuque OAuth session ID from createYuqueOAuthSession.
16
+ * @param {string[]} params.urls - Yuque document URLs to import. Maximum 20 URLs.
17
+ * @param {string} params.idempotencyKey - Optional batch idempotency key prefix.
18
+ * @throws {AgentbaseException}
19
+ * @returns {Promise<Models.KnowledgeBaseDataSourceDocumentImportBatch>}
20
+ */
21
+ createYuqueDocuments(params: {
22
+ knowledgeBaseId: string;
23
+ sessionId: string;
24
+ urls: string[];
25
+ idempotencyKey?: string;
26
+ }): Promise<Models.KnowledgeBaseDataSourceDocumentImportBatch>;
27
+ /**
28
+ * Import the current user's personal Yuque documents by URL using an authorized Yuque OAuth session. No team data source is required. Document ownership uses `source=yuque:personal`.
29
+ *
30
+ * The service resolves the session's current-user credential from encrypted private storage before requesting the Yuque Open API. If the credential is missing, was locally cancelled, was revoked at Yuque, or Yuque returns 401/403, the request fails with `knowledge_base_yuque_oauth_reauth_required` (HTTP 401); authorize again before retrying.
31
+ *
32
+ * URL rules match the team data-source import: only approved Yuque HTTPS hosts and an exact `{group}/{book}/{slug}` path are accepted. The service never fetches the pasted URL directly.
33
+ *
34
+ *
35
+ * @param {string} knowledgeBaseId - Knowledge base ID.
36
+ * @param {string} sessionId - Yuque OAuth session ID from createYuqueOAuthSession.
37
+ * @param {string[]} urls - Yuque document URLs to import. Maximum 20 URLs.
38
+ * @param {string} idempotencyKey - Optional batch idempotency key prefix.
39
+ * @throws {AgentbaseException}
40
+ * @returns {Promise<Models.KnowledgeBaseDataSourceDocumentImportBatch>}
41
+ * @deprecated Use the object parameter style method for a better developer experience.
42
+ */
43
+ createYuqueDocuments(knowledgeBaseId: string, sessionId: string, urls: string[], idempotencyKey?: string): Promise<Models.KnowledgeBaseDataSourceDocumentImportBatch>;
44
+ /**
45
+ * Delete the current signed-in user's locally stored Yuque OAuth credential for this project. This endpoint is idempotent and returns `204 No Content` when no credential exists. It removes only the encrypted Agentbase copy; it does not revoke the authorization at Yuque.
46
+ *
47
+ *
48
+ * @param {string} params.knowledgeBaseId - Knowledge base ID.
49
+ * @throws {AgentbaseException}
50
+ * @returns {Promise<{}>}
51
+ */
52
+ deleteYuqueOAuthCredential(params: {
53
+ knowledgeBaseId: string;
54
+ }): Promise<{}>;
55
+ /**
56
+ * Delete the current signed-in user's locally stored Yuque OAuth credential for this project. This endpoint is idempotent and returns `204 No Content` when no credential exists. It removes only the encrypted Agentbase copy; it does not revoke the authorization at Yuque.
57
+ *
58
+ *
59
+ * @param {string} knowledgeBaseId - Knowledge base ID.
60
+ * @throws {AgentbaseException}
61
+ * @returns {Promise<{}>}
62
+ * @deprecated Use the object parameter style method for a better developer experience.
63
+ */
64
+ deleteYuqueOAuthCredential(knowledgeBaseId: string): Promise<{}>;
65
+ /**
66
+ * Create a short-lived Yuque OAuth session for the signed-in user's personal document import into a knowledge base.
67
+ *
68
+ * The OAuth Client ID and Client Secret must be configured for a first authorization. If the current user already has an encrypted Yuque credential in this project, the default request returns `authorized=true` and `authorizeUrl=null` without opening OAuth again. Pass optional `force=true` to start a new authorization; the old credential remains usable until the new callback succeeds. The OAuth callback state is single-use: after a callback attempt, create a new session before retrying authorization. After consent, poll `getYuqueOAuthSession` until `authorized` is true, then call `createYuqueDocuments`.
69
+ *
70
+ *
71
+ * @param {string} params.knowledgeBaseId - Knowledge base ID.
72
+ * @param {boolean} params.force - Ignore a saved Yuque credential and start a new OAuth authorization.
73
+ * @throws {AgentbaseException}
74
+ * @returns {Promise<{}>}
75
+ */
76
+ createYuqueOAuthSession(params: {
77
+ knowledgeBaseId: string;
78
+ force?: boolean;
79
+ }): Promise<{}>;
80
+ /**
81
+ * Create a short-lived Yuque OAuth session for the signed-in user's personal document import into a knowledge base.
82
+ *
83
+ * The OAuth Client ID and Client Secret must be configured for a first authorization. If the current user already has an encrypted Yuque credential in this project, the default request returns `authorized=true` and `authorizeUrl=null` without opening OAuth again. Pass optional `force=true` to start a new authorization; the old credential remains usable until the new callback succeeds. The OAuth callback state is single-use: after a callback attempt, create a new session before retrying authorization. After consent, poll `getYuqueOAuthSession` until `authorized` is true, then call `createYuqueDocuments`.
84
+ *
85
+ *
86
+ * @param {string} knowledgeBaseId - Knowledge base ID.
87
+ * @param {boolean} force - Ignore a saved Yuque credential and start a new OAuth authorization.
88
+ * @throws {AgentbaseException}
89
+ * @returns {Promise<{}>}
90
+ * @deprecated Use the object parameter style method for a better developer experience.
91
+ */
92
+ createYuqueOAuthSession(knowledgeBaseId: string, force?: boolean): Promise<{}>;
93
+ /**
94
+ * Return the current user's public Yuque OAuth session status (`authorized`, `scope`) without an access token. The first protected poll after a successful OAuth callback persists the token in the private encrypted credential store and removes it from the Redis session.
95
+ *
96
+ *
97
+ * @param {string} params.knowledgeBaseId - Knowledge base ID.
98
+ * @param {string} params.sessionId - Yuque OAuth session ID.
99
+ * @throws {AgentbaseException}
100
+ * @returns {Promise<{}>}
101
+ */
102
+ getYuqueOAuthSession(params: {
103
+ knowledgeBaseId: string;
104
+ sessionId: string;
105
+ }): Promise<{}>;
106
+ /**
107
+ * Return the current user's public Yuque OAuth session status (`authorized`, `scope`) without an access token. The first protected poll after a successful OAuth callback persists the token in the private encrypted credential store and removes it from the Redis session.
108
+ *
109
+ *
110
+ * @param {string} knowledgeBaseId - Knowledge base ID.
111
+ * @param {string} sessionId - Yuque OAuth session ID.
112
+ * @throws {AgentbaseException}
113
+ * @returns {Promise<{}>}
114
+ * @deprecated Use the object parameter style method for a better developer experience.
115
+ */
116
+ getYuqueOAuthSession(knowledgeBaseId: string, sessionId: string): Promise<{}>;
117
+ }