appwrite-cli 10.1.0 → 10.2.2

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.
@@ -119,6 +119,211 @@ const tablesDBCreate = async ({databaseId,name,enabled,parseOutput = true, overr
119
119
 
120
120
  return response;
121
121
 
122
+ }
123
+ /**
124
+ * @typedef {Object} TablesDBListTransactionsRequestParams
125
+ * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).
126
+ * @property {boolean} overrideForCli
127
+ * @property {boolean} parseOutput
128
+ * @property {libClient | undefined} sdk
129
+ */
130
+
131
+ /**
132
+ * @param {TablesDBListTransactionsRequestParams} params
133
+ */
134
+ const tablesDBListTransactions = async ({queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
135
+ let client = !sdk ? await sdkForProject() :
136
+ sdk;
137
+ let apiPath = '/tablesdb/transactions';
138
+ let payload = {};
139
+ if (typeof queries !== 'undefined') {
140
+ payload['queries'] = queries;
141
+ }
142
+
143
+ let response = undefined;
144
+
145
+ response = await client.call('get', apiPath, {
146
+ }, payload);
147
+
148
+ if (parseOutput) {
149
+ if(console) {
150
+ showConsoleLink('tablesDB', 'listTransactions');
151
+ } else {
152
+ parse(response)
153
+ }
154
+ }
155
+
156
+ return response;
157
+
158
+ }
159
+ /**
160
+ * @typedef {Object} TablesDBCreateTransactionRequestParams
161
+ * @property {number} ttl Seconds before the transaction expires.
162
+ * @property {boolean} overrideForCli
163
+ * @property {boolean} parseOutput
164
+ * @property {libClient | undefined} sdk
165
+ */
166
+
167
+ /**
168
+ * @param {TablesDBCreateTransactionRequestParams} params
169
+ */
170
+ const tablesDBCreateTransaction = async ({ttl,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
171
+ let client = !sdk ? await sdkForProject() :
172
+ sdk;
173
+ let apiPath = '/tablesdb/transactions';
174
+ let payload = {};
175
+ if (typeof ttl !== 'undefined') {
176
+ payload['ttl'] = ttl;
177
+ }
178
+
179
+ let response = undefined;
180
+
181
+ response = await client.call('post', apiPath, {
182
+ 'content-type': 'application/json',
183
+ }, payload);
184
+
185
+ if (parseOutput) {
186
+ parse(response)
187
+ }
188
+
189
+ return response;
190
+
191
+ }
192
+ /**
193
+ * @typedef {Object} TablesDBGetTransactionRequestParams
194
+ * @property {string} transactionId Transaction ID.
195
+ * @property {boolean} overrideForCli
196
+ * @property {boolean} parseOutput
197
+ * @property {libClient | undefined} sdk
198
+ */
199
+
200
+ /**
201
+ * @param {TablesDBGetTransactionRequestParams} params
202
+ */
203
+ const tablesDBGetTransaction = async ({transactionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
204
+ let client = !sdk ? await sdkForProject() :
205
+ sdk;
206
+ let apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
207
+ let payload = {};
208
+
209
+ let response = undefined;
210
+
211
+ response = await client.call('get', apiPath, {
212
+ }, payload);
213
+
214
+ if (parseOutput) {
215
+ if(console) {
216
+ showConsoleLink('tablesDB', 'getTransaction', transactionId);
217
+ } else {
218
+ parse(response)
219
+ }
220
+ }
221
+
222
+ return response;
223
+
224
+ }
225
+ /**
226
+ * @typedef {Object} TablesDBUpdateTransactionRequestParams
227
+ * @property {string} transactionId Transaction ID.
228
+ * @property {boolean} commit Commit transaction?
229
+ * @property {boolean} rollback Rollback transaction?
230
+ * @property {boolean} overrideForCli
231
+ * @property {boolean} parseOutput
232
+ * @property {libClient | undefined} sdk
233
+ */
234
+
235
+ /**
236
+ * @param {TablesDBUpdateTransactionRequestParams} params
237
+ */
238
+ const tablesDBUpdateTransaction = async ({transactionId,commit,rollback,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
239
+ let client = !sdk ? await sdkForProject() :
240
+ sdk;
241
+ let apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
242
+ let payload = {};
243
+ if (typeof commit !== 'undefined') {
244
+ payload['commit'] = commit;
245
+ }
246
+ if (typeof rollback !== 'undefined') {
247
+ payload['rollback'] = rollback;
248
+ }
249
+
250
+ let response = undefined;
251
+
252
+ response = await client.call('patch', apiPath, {
253
+ 'content-type': 'application/json',
254
+ }, payload);
255
+
256
+ if (parseOutput) {
257
+ parse(response)
258
+ }
259
+
260
+ return response;
261
+
262
+ }
263
+ /**
264
+ * @typedef {Object} TablesDBDeleteTransactionRequestParams
265
+ * @property {string} transactionId Transaction ID.
266
+ * @property {boolean} overrideForCli
267
+ * @property {boolean} parseOutput
268
+ * @property {libClient | undefined} sdk
269
+ */
270
+
271
+ /**
272
+ * @param {TablesDBDeleteTransactionRequestParams} params
273
+ */
274
+ const tablesDBDeleteTransaction = async ({transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
275
+ let client = !sdk ? await sdkForProject() :
276
+ sdk;
277
+ let apiPath = '/tablesdb/transactions/{transactionId}'.replace('{transactionId}', transactionId);
278
+ let payload = {};
279
+
280
+ let response = undefined;
281
+
282
+ response = await client.call('delete', apiPath, {
283
+ 'content-type': 'application/json',
284
+ }, payload);
285
+
286
+ if (parseOutput) {
287
+ parse(response)
288
+ }
289
+
290
+ return response;
291
+
292
+ }
293
+ /**
294
+ * @typedef {Object} TablesDBCreateOperationsRequestParams
295
+ * @property {string} transactionId Transaction ID.
296
+ * @property {object[]} operations Array of staged operations.
297
+ * @property {boolean} overrideForCli
298
+ * @property {boolean} parseOutput
299
+ * @property {libClient | undefined} sdk
300
+ */
301
+
302
+ /**
303
+ * @param {TablesDBCreateOperationsRequestParams} params
304
+ */
305
+ const tablesDBCreateOperations = async ({transactionId,operations,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
306
+ let client = !sdk ? await sdkForProject() :
307
+ sdk;
308
+ let apiPath = '/tablesdb/transactions/{transactionId}/operations'.replace('{transactionId}', transactionId);
309
+ let payload = {};
310
+ operations = operations === true ? [] : operations;
311
+ if (typeof operations !== 'undefined') {
312
+ payload['operations'] = operations;
313
+ }
314
+
315
+ let response = undefined;
316
+
317
+ response = await client.call('post', apiPath, {
318
+ 'content-type': 'application/json',
319
+ }, payload);
320
+
321
+ if (parseOutput) {
322
+ parse(response)
323
+ }
324
+
325
+ return response;
326
+
122
327
  }
123
328
  /**
124
329
  * @typedef {Object} TablesDBListUsageRequestParams
@@ -2000,6 +2205,7 @@ const tablesDBListTableLogs = async ({databaseId,tableId,queries,parseOutput = t
2000
2205
  * @property {string} databaseId Database ID.
2001
2206
  * @property {string} tableId Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).
2002
2207
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2208
+ * @property {string} transactionId Transaction ID to read uncommitted changes within the transaction.
2003
2209
  * @property {boolean} overrideForCli
2004
2210
  * @property {boolean} parseOutput
2005
2211
  * @property {libClient | undefined} sdk
@@ -2008,7 +2214,7 @@ const tablesDBListTableLogs = async ({databaseId,tableId,queries,parseOutput = t
2008
2214
  /**
2009
2215
  * @param {TablesDBListRowsRequestParams} params
2010
2216
  */
2011
- const tablesDBListRows = async ({databaseId,tableId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2217
+ const tablesDBListRows = async ({databaseId,tableId,queries,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2012
2218
  let client = !sdk ? await sdkForProject() :
2013
2219
  sdk;
2014
2220
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
@@ -2016,6 +2222,9 @@ const tablesDBListRows = async ({databaseId,tableId,queries,parseOutput = true,
2016
2222
  if (typeof queries !== 'undefined') {
2017
2223
  payload['queries'] = queries;
2018
2224
  }
2225
+ if (typeof transactionId !== 'undefined') {
2226
+ payload['transactionId'] = transactionId;
2227
+ }
2019
2228
 
2020
2229
  let response = undefined;
2021
2230
 
@@ -2040,6 +2249,7 @@ const tablesDBListRows = async ({databaseId,tableId,queries,parseOutput = true,
2040
2249
  * @property {string} rowId Row 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.
2041
2250
  * @property {object} data Row data as JSON object.
2042
2251
  * @property {string[]} permissions An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).
2252
+ * @property {string} transactionId Transaction ID for staging the operation.
2043
2253
  * @property {boolean} overrideForCli
2044
2254
  * @property {boolean} parseOutput
2045
2255
  * @property {libClient | undefined} sdk
@@ -2048,7 +2258,7 @@ const tablesDBListRows = async ({databaseId,tableId,queries,parseOutput = true,
2048
2258
  /**
2049
2259
  * @param {TablesDBCreateRowRequestParams} params
2050
2260
  */
2051
- const tablesDBCreateRow = async ({databaseId,tableId,rowId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2261
+ const tablesDBCreateRow = async ({databaseId,tableId,rowId,data,permissions,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2052
2262
  let client = !sdk ? await sdkForProject() :
2053
2263
  sdk;
2054
2264
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
@@ -2063,6 +2273,9 @@ const tablesDBCreateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2063
2273
  if (typeof permissions !== 'undefined') {
2064
2274
  payload['permissions'] = permissions;
2065
2275
  }
2276
+ if (typeof transactionId !== 'undefined') {
2277
+ payload['transactionId'] = transactionId;
2278
+ }
2066
2279
 
2067
2280
  let response = undefined;
2068
2281
 
@@ -2082,6 +2295,7 @@ const tablesDBCreateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2082
2295
  * @property {string} databaseId Database ID.
2083
2296
  * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.
2084
2297
  * @property {object[]} rows Array of rows data as JSON objects.
2298
+ * @property {string} transactionId Transaction ID for staging the operation.
2085
2299
  * @property {boolean} overrideForCli
2086
2300
  * @property {boolean} parseOutput
2087
2301
  * @property {libClient | undefined} sdk
@@ -2090,7 +2304,7 @@ const tablesDBCreateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2090
2304
  /**
2091
2305
  * @param {TablesDBCreateRowsRequestParams} params
2092
2306
  */
2093
- const tablesDBCreateRows = async ({databaseId,tableId,rows,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2307
+ const tablesDBCreateRows = async ({databaseId,tableId,rows,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2094
2308
  let client = !sdk ? await sdkForProject() :
2095
2309
  sdk;
2096
2310
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
@@ -2099,6 +2313,9 @@ const tablesDBCreateRows = async ({databaseId,tableId,rows,parseOutput = true, o
2099
2313
  if (typeof rows !== 'undefined') {
2100
2314
  payload['rows'] = rows;
2101
2315
  }
2316
+ if (typeof transactionId !== 'undefined') {
2317
+ payload['transactionId'] = transactionId;
2318
+ }
2102
2319
 
2103
2320
  let response = undefined;
2104
2321
 
@@ -2118,6 +2335,7 @@ const tablesDBCreateRows = async ({databaseId,tableId,rows,parseOutput = true, o
2118
2335
  * @property {string} databaseId Database ID.
2119
2336
  * @property {string} tableId Table ID.
2120
2337
  * @property {object[]} rows Array of row data as JSON objects. May contain partial rows.
2338
+ * @property {string} transactionId Transaction ID for staging the operation.
2121
2339
  * @property {boolean} overrideForCli
2122
2340
  * @property {boolean} parseOutput
2123
2341
  * @property {libClient | undefined} sdk
@@ -2126,7 +2344,7 @@ const tablesDBCreateRows = async ({databaseId,tableId,rows,parseOutput = true, o
2126
2344
  /**
2127
2345
  * @param {TablesDBUpsertRowsRequestParams} params
2128
2346
  */
2129
- const tablesDBUpsertRows = async ({databaseId,tableId,rows,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2347
+ const tablesDBUpsertRows = async ({databaseId,tableId,rows,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2130
2348
  let client = !sdk ? await sdkForProject() :
2131
2349
  sdk;
2132
2350
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
@@ -2135,6 +2353,9 @@ const tablesDBUpsertRows = async ({databaseId,tableId,rows,parseOutput = true, o
2135
2353
  if (typeof rows !== 'undefined') {
2136
2354
  payload['rows'] = rows;
2137
2355
  }
2356
+ if (typeof transactionId !== 'undefined') {
2357
+ payload['transactionId'] = transactionId;
2358
+ }
2138
2359
 
2139
2360
  let response = undefined;
2140
2361
 
@@ -2155,6 +2376,7 @@ const tablesDBUpsertRows = async ({databaseId,tableId,rows,parseOutput = true, o
2155
2376
  * @property {string} tableId Table ID.
2156
2377
  * @property {object} data Row data as JSON object. Include only column and value pairs to be updated.
2157
2378
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2379
+ * @property {string} transactionId Transaction ID for staging the operation.
2158
2380
  * @property {boolean} overrideForCli
2159
2381
  * @property {boolean} parseOutput
2160
2382
  * @property {libClient | undefined} sdk
@@ -2163,7 +2385,7 @@ const tablesDBUpsertRows = async ({databaseId,tableId,rows,parseOutput = true, o
2163
2385
  /**
2164
2386
  * @param {TablesDBUpdateRowsRequestParams} params
2165
2387
  */
2166
- const tablesDBUpdateRows = async ({databaseId,tableId,data,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2388
+ const tablesDBUpdateRows = async ({databaseId,tableId,data,queries,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2167
2389
  let client = !sdk ? await sdkForProject() :
2168
2390
  sdk;
2169
2391
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
@@ -2175,6 +2397,9 @@ const tablesDBUpdateRows = async ({databaseId,tableId,data,queries,parseOutput =
2175
2397
  if (typeof queries !== 'undefined') {
2176
2398
  payload['queries'] = queries;
2177
2399
  }
2400
+ if (typeof transactionId !== 'undefined') {
2401
+ payload['transactionId'] = transactionId;
2402
+ }
2178
2403
 
2179
2404
  let response = undefined;
2180
2405
 
@@ -2194,6 +2419,7 @@ const tablesDBUpdateRows = async ({databaseId,tableId,data,queries,parseOutput =
2194
2419
  * @property {string} databaseId Database ID.
2195
2420
  * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2196
2421
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2422
+ * @property {string} transactionId Transaction ID for staging the operation.
2197
2423
  * @property {boolean} overrideForCli
2198
2424
  * @property {boolean} parseOutput
2199
2425
  * @property {libClient | undefined} sdk
@@ -2202,7 +2428,7 @@ const tablesDBUpdateRows = async ({databaseId,tableId,data,queries,parseOutput =
2202
2428
  /**
2203
2429
  * @param {TablesDBDeleteRowsRequestParams} params
2204
2430
  */
2205
- const tablesDBDeleteRows = async ({databaseId,tableId,queries,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2431
+ const tablesDBDeleteRows = async ({databaseId,tableId,queries,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2206
2432
  let client = !sdk ? await sdkForProject() :
2207
2433
  sdk;
2208
2434
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows'.replace('{databaseId}', databaseId).replace('{tableId}', tableId);
@@ -2211,6 +2437,9 @@ const tablesDBDeleteRows = async ({databaseId,tableId,queries,parseOutput = true
2211
2437
  if (typeof queries !== 'undefined') {
2212
2438
  payload['queries'] = queries;
2213
2439
  }
2440
+ if (typeof transactionId !== 'undefined') {
2441
+ payload['transactionId'] = transactionId;
2442
+ }
2214
2443
 
2215
2444
  let response = undefined;
2216
2445
 
@@ -2231,6 +2460,7 @@ const tablesDBDeleteRows = async ({databaseId,tableId,queries,parseOutput = true
2231
2460
  * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2232
2461
  * @property {string} rowId Row ID.
2233
2462
  * @property {string[]} queries Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.
2463
+ * @property {string} transactionId Transaction ID to read uncommitted changes within the transaction.
2234
2464
  * @property {boolean} overrideForCli
2235
2465
  * @property {boolean} parseOutput
2236
2466
  * @property {libClient | undefined} sdk
@@ -2239,7 +2469,7 @@ const tablesDBDeleteRows = async ({databaseId,tableId,queries,parseOutput = true
2239
2469
  /**
2240
2470
  * @param {TablesDBGetRowRequestParams} params
2241
2471
  */
2242
- const tablesDBGetRow = async ({databaseId,tableId,rowId,queries,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2472
+ const tablesDBGetRow = async ({databaseId,tableId,rowId,queries,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined, console}) => {
2243
2473
  let client = !sdk ? await sdkForProject() :
2244
2474
  sdk;
2245
2475
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
@@ -2247,6 +2477,9 @@ const tablesDBGetRow = async ({databaseId,tableId,rowId,queries,parseOutput = tr
2247
2477
  if (typeof queries !== 'undefined') {
2248
2478
  payload['queries'] = queries;
2249
2479
  }
2480
+ if (typeof transactionId !== 'undefined') {
2481
+ payload['transactionId'] = transactionId;
2482
+ }
2250
2483
 
2251
2484
  let response = undefined;
2252
2485
 
@@ -2271,6 +2504,7 @@ const tablesDBGetRow = async ({databaseId,tableId,rowId,queries,parseOutput = tr
2271
2504
  * @property {string} rowId Row ID.
2272
2505
  * @property {object} data Row data as JSON object. Include all required columns of the row to be created or updated.
2273
2506
  * @property {string[]} permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
2507
+ * @property {string} transactionId Transaction ID for staging the operation.
2274
2508
  * @property {boolean} overrideForCli
2275
2509
  * @property {boolean} parseOutput
2276
2510
  * @property {libClient | undefined} sdk
@@ -2279,7 +2513,7 @@ const tablesDBGetRow = async ({databaseId,tableId,rowId,queries,parseOutput = tr
2279
2513
  /**
2280
2514
  * @param {TablesDBUpsertRowRequestParams} params
2281
2515
  */
2282
- const tablesDBUpsertRow = async ({databaseId,tableId,rowId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2516
+ const tablesDBUpsertRow = async ({databaseId,tableId,rowId,data,permissions,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2283
2517
  let client = !sdk ? await sdkForProject() :
2284
2518
  sdk;
2285
2519
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
@@ -2291,6 +2525,9 @@ const tablesDBUpsertRow = async ({databaseId,tableId,rowId,data,permissions,pars
2291
2525
  if (typeof permissions !== 'undefined') {
2292
2526
  payload['permissions'] = permissions;
2293
2527
  }
2528
+ if (typeof transactionId !== 'undefined') {
2529
+ payload['transactionId'] = transactionId;
2530
+ }
2294
2531
 
2295
2532
  let response = undefined;
2296
2533
 
@@ -2312,6 +2549,7 @@ const tablesDBUpsertRow = async ({databaseId,tableId,rowId,data,permissions,pars
2312
2549
  * @property {string} rowId Row ID.
2313
2550
  * @property {object} data Row data as JSON object. Include only columns and value pairs to be updated.
2314
2551
  * @property {string[]} permissions An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).
2552
+ * @property {string} transactionId Transaction ID for staging the operation.
2315
2553
  * @property {boolean} overrideForCli
2316
2554
  * @property {boolean} parseOutput
2317
2555
  * @property {libClient | undefined} sdk
@@ -2320,7 +2558,7 @@ const tablesDBUpsertRow = async ({databaseId,tableId,rowId,data,permissions,pars
2320
2558
  /**
2321
2559
  * @param {TablesDBUpdateRowRequestParams} params
2322
2560
  */
2323
- const tablesDBUpdateRow = async ({databaseId,tableId,rowId,data,permissions,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2561
+ const tablesDBUpdateRow = async ({databaseId,tableId,rowId,data,permissions,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2324
2562
  let client = !sdk ? await sdkForProject() :
2325
2563
  sdk;
2326
2564
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
@@ -2332,6 +2570,9 @@ const tablesDBUpdateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2332
2570
  if (typeof permissions !== 'undefined') {
2333
2571
  payload['permissions'] = permissions;
2334
2572
  }
2573
+ if (typeof transactionId !== 'undefined') {
2574
+ payload['transactionId'] = transactionId;
2575
+ }
2335
2576
 
2336
2577
  let response = undefined;
2337
2578
 
@@ -2351,6 +2592,7 @@ const tablesDBUpdateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2351
2592
  * @property {string} databaseId Database ID.
2352
2593
  * @property {string} tableId Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).
2353
2594
  * @property {string} rowId Row ID.
2595
+ * @property {string} transactionId Transaction ID for staging the operation.
2354
2596
  * @property {boolean} overrideForCli
2355
2597
  * @property {boolean} parseOutput
2356
2598
  * @property {libClient | undefined} sdk
@@ -2359,11 +2601,14 @@ const tablesDBUpdateRow = async ({databaseId,tableId,rowId,data,permissions,pars
2359
2601
  /**
2360
2602
  * @param {TablesDBDeleteRowRequestParams} params
2361
2603
  */
2362
- const tablesDBDeleteRow = async ({databaseId,tableId,rowId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2604
+ const tablesDBDeleteRow = async ({databaseId,tableId,rowId,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2363
2605
  let client = !sdk ? await sdkForProject() :
2364
2606
  sdk;
2365
2607
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId);
2366
2608
  let payload = {};
2609
+ if (typeof transactionId !== 'undefined') {
2610
+ payload['transactionId'] = transactionId;
2611
+ }
2367
2612
 
2368
2613
  let response = undefined;
2369
2614
 
@@ -2425,6 +2670,7 @@ const tablesDBListRowLogs = async ({databaseId,tableId,rowId,queries,parseOutput
2425
2670
  * @property {string} column Column key.
2426
2671
  * @property {number} value Value to increment the column by. The value must be a number.
2427
2672
  * @property {number} min Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.
2673
+ * @property {string} transactionId Transaction ID for staging the operation.
2428
2674
  * @property {boolean} overrideForCli
2429
2675
  * @property {boolean} parseOutput
2430
2676
  * @property {libClient | undefined} sdk
@@ -2433,7 +2679,7 @@ const tablesDBListRowLogs = async ({databaseId,tableId,rowId,queries,parseOutput
2433
2679
  /**
2434
2680
  * @param {TablesDBDecrementRowColumnRequestParams} params
2435
2681
  */
2436
- const tablesDBDecrementRowColumn = async ({databaseId,tableId,rowId,column,value,min,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2682
+ const tablesDBDecrementRowColumn = async ({databaseId,tableId,rowId,column,value,min,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2437
2683
  let client = !sdk ? await sdkForProject() :
2438
2684
  sdk;
2439
2685
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/decrement'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
@@ -2444,6 +2690,9 @@ const tablesDBDecrementRowColumn = async ({databaseId,tableId,rowId,column,value
2444
2690
  if (typeof min !== 'undefined') {
2445
2691
  payload['min'] = min;
2446
2692
  }
2693
+ if (typeof transactionId !== 'undefined') {
2694
+ payload['transactionId'] = transactionId;
2695
+ }
2447
2696
 
2448
2697
  let response = undefined;
2449
2698
 
@@ -2466,6 +2715,7 @@ const tablesDBDecrementRowColumn = async ({databaseId,tableId,rowId,column,value
2466
2715
  * @property {string} column Column key.
2467
2716
  * @property {number} value Value to increment the column by. The value must be a number.
2468
2717
  * @property {number} max Maximum value for the column. If the current value is greater than this value, an error will be thrown.
2718
+ * @property {string} transactionId Transaction ID for staging the operation.
2469
2719
  * @property {boolean} overrideForCli
2470
2720
  * @property {boolean} parseOutput
2471
2721
  * @property {libClient | undefined} sdk
@@ -2474,7 +2724,7 @@ const tablesDBDecrementRowColumn = async ({databaseId,tableId,rowId,column,value
2474
2724
  /**
2475
2725
  * @param {TablesDBIncrementRowColumnRequestParams} params
2476
2726
  */
2477
- const tablesDBIncrementRowColumn = async ({databaseId,tableId,rowId,column,value,max,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2727
+ const tablesDBIncrementRowColumn = async ({databaseId,tableId,rowId,column,value,max,transactionId,parseOutput = true, overrideForCli = false, sdk = undefined}) => {
2478
2728
  let client = !sdk ? await sdkForProject() :
2479
2729
  sdk;
2480
2730
  let apiPath = '/tablesdb/{databaseId}/tables/{tableId}/rows/{rowId}/{column}/increment'.replace('{databaseId}', databaseId).replace('{tableId}', tableId).replace('{rowId}', rowId).replace('{column}', column);
@@ -2485,6 +2735,9 @@ const tablesDBIncrementRowColumn = async ({databaseId,tableId,rowId,column,value
2485
2735
  if (typeof max !== 'undefined') {
2486
2736
  payload['max'] = max;
2487
2737
  }
2738
+ if (typeof transactionId !== 'undefined') {
2739
+ payload['transactionId'] = transactionId;
2740
+ }
2488
2741
 
2489
2742
  let response = undefined;
2490
2743
 
@@ -2586,6 +2839,47 @@ tablesDB
2586
2839
  .option(`--enabled [value]`, `Is the database enabled? When set to 'disabled', users cannot access the database but Server SDKs with an API key can still read and write to the database. No data is lost when this is toggled.`, (value) => value === undefined ? true : parseBool(value))
2587
2840
  .action(actionRunner(tablesDBCreate))
2588
2841
 
2842
+ tablesDB
2843
+ .command(`list-transactions`)
2844
+ .description(`List transactions across all databases.`)
2845
+ .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries).`)
2846
+ .option(`--console`, `Get the resource console url`)
2847
+ .action(actionRunner(tablesDBListTransactions))
2848
+
2849
+ tablesDB
2850
+ .command(`create-transaction`)
2851
+ .description(`Create a new transaction.`)
2852
+ .option(`--ttl <ttl>`, `Seconds before the transaction expires.`, parseInteger)
2853
+ .action(actionRunner(tablesDBCreateTransaction))
2854
+
2855
+ tablesDB
2856
+ .command(`get-transaction`)
2857
+ .description(`Get a transaction by its unique ID.`)
2858
+ .requiredOption(`--transaction-id <transaction-id>`, `Transaction ID.`)
2859
+ .option(`--console`, `Get the resource console url`)
2860
+ .action(actionRunner(tablesDBGetTransaction))
2861
+
2862
+ tablesDB
2863
+ .command(`update-transaction`)
2864
+ .description(`Update a transaction, to either commit or roll back its operations.`)
2865
+ .requiredOption(`--transaction-id <transaction-id>`, `Transaction ID.`)
2866
+ .option(`--commit [value]`, `Commit transaction?`, (value) => value === undefined ? true : parseBool(value))
2867
+ .option(`--rollback [value]`, `Rollback transaction?`, (value) => value === undefined ? true : parseBool(value))
2868
+ .action(actionRunner(tablesDBUpdateTransaction))
2869
+
2870
+ tablesDB
2871
+ .command(`delete-transaction`)
2872
+ .description(`Delete a transaction by its unique ID.`)
2873
+ .requiredOption(`--transaction-id <transaction-id>`, `Transaction ID.`)
2874
+ .action(actionRunner(tablesDBDeleteTransaction))
2875
+
2876
+ tablesDB
2877
+ .command(`create-operations`)
2878
+ .description(`Create multiple operations in a single transaction.`)
2879
+ .requiredOption(`--transaction-id <transaction-id>`, `Transaction ID.`)
2880
+ .option(`--operations [operations...]`, `Array of staged operations.`)
2881
+ .action(actionRunner(tablesDBCreateOperations))
2882
+
2589
2883
  tablesDB
2590
2884
  .command(`list-usage`)
2591
2885
  .description(`List usage metrics and statistics for all databases in the project. You can view the total number of databases, tables, rows, and storage usage. The response includes both current totals and historical data over time. Use the optional range parameter to specify the time window for historical data: 24h (last 24 hours), 30d (last 30 days), or 90d (last 90 days). If not specified, range defaults to 30 days.`)
@@ -3035,6 +3329,7 @@ tablesDB
3035
3329
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3036
3330
  .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the TablesDB service [server integration](https://appwrite.io/docs/products/databases/tables#create-table).`)
3037
3331
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
3332
+ .option(`--transaction-id <transaction-id>`, `Transaction ID to read uncommitted changes within the transaction.`)
3038
3333
  .option(`--console`, `Get the resource console url`)
3039
3334
  .action(actionRunner(tablesDBListRows))
3040
3335
 
@@ -3046,6 +3341,7 @@ tablesDB
3046
3341
  .requiredOption(`--row-id <row-id>`, `Row 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.`)
3047
3342
  .requiredOption(`--data <data>`, `Row data as JSON object.`)
3048
3343
  .option(`--permissions [permissions...]`, `An array of permissions strings. By default, only the current user is granted all permissions. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
3344
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3049
3345
  .action(actionRunner(tablesDBCreateRow))
3050
3346
 
3051
3347
  tablesDB
@@ -3054,6 +3350,7 @@ tablesDB
3054
3350
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3055
3351
  .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable). Make sure to define columns before creating rows.`)
3056
3352
  .requiredOption(`--rows [rows...]`, `Array of rows data as JSON objects.`)
3353
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3057
3354
  .action(actionRunner(tablesDBCreateRows))
3058
3355
 
3059
3356
  tablesDB
@@ -3062,6 +3359,7 @@ tablesDB
3062
3359
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3063
3360
  .requiredOption(`--table-id <table-id>`, `Table ID.`)
3064
3361
  .requiredOption(`--rows [rows...]`, `Array of row data as JSON objects. May contain partial rows.`)
3362
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3065
3363
  .action(actionRunner(tablesDBUpsertRows))
3066
3364
 
3067
3365
  tablesDB
@@ -3071,6 +3369,7 @@ tablesDB
3071
3369
  .requiredOption(`--table-id <table-id>`, `Table ID.`)
3072
3370
  .option(`--data <data>`, `Row data as JSON object. Include only column and value pairs to be updated.`)
3073
3371
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
3372
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3074
3373
  .action(actionRunner(tablesDBUpdateRows))
3075
3374
 
3076
3375
  tablesDB
@@ -3079,6 +3378,7 @@ tablesDB
3079
3378
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3080
3379
  .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3081
3380
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
3381
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3082
3382
  .action(actionRunner(tablesDBDeleteRows))
3083
3383
 
3084
3384
  tablesDB
@@ -3088,6 +3388,7 @@ tablesDB
3088
3388
  .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3089
3389
  .requiredOption(`--row-id <row-id>`, `Row ID.`)
3090
3390
  .option(`--queries [queries...]`, `Array of query strings generated using the Query class provided by the SDK. [Learn more about queries](https://appwrite.io/docs/queries). Maximum of 100 queries are allowed, each 4096 characters long.`)
3391
+ .option(`--transaction-id <transaction-id>`, `Transaction ID to read uncommitted changes within the transaction.`)
3091
3392
  .option(`--console`, `Get the resource console url`)
3092
3393
  .action(actionRunner(tablesDBGetRow))
3093
3394
 
@@ -3099,6 +3400,7 @@ tablesDB
3099
3400
  .requiredOption(`--row-id <row-id>`, `Row ID.`)
3100
3401
  .option(`--data <data>`, `Row data as JSON object. Include all required columns of the row to be created or updated.`)
3101
3402
  .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
3403
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3102
3404
  .action(actionRunner(tablesDBUpsertRow))
3103
3405
 
3104
3406
  tablesDB
@@ -3109,6 +3411,7 @@ tablesDB
3109
3411
  .requiredOption(`--row-id <row-id>`, `Row ID.`)
3110
3412
  .option(`--data <data>`, `Row data as JSON object. Include only columns and value pairs to be updated.`)
3111
3413
  .option(`--permissions [permissions...]`, `An array of permissions strings. By default, the current permissions are inherited. [Learn more about permissions](https://appwrite.io/docs/permissions).`)
3414
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3112
3415
  .action(actionRunner(tablesDBUpdateRow))
3113
3416
 
3114
3417
  tablesDB
@@ -3117,6 +3420,7 @@ tablesDB
3117
3420
  .requiredOption(`--database-id <database-id>`, `Database ID.`)
3118
3421
  .requiredOption(`--table-id <table-id>`, `Table ID. You can create a new table using the Database service [server integration](https://appwrite.io/docs/references/cloud/server-dart/tablesDB#createTable).`)
3119
3422
  .requiredOption(`--row-id <row-id>`, `Row ID.`)
3423
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3120
3424
  .action(actionRunner(tablesDBDeleteRow))
3121
3425
 
3122
3426
  tablesDB
@@ -3138,6 +3442,7 @@ tablesDB
3138
3442
  .requiredOption(`--column <column>`, `Column key.`)
3139
3443
  .option(`--value <value>`, `Value to increment the column by. The value must be a number.`, parseInteger)
3140
3444
  .option(`--min <min>`, `Minimum value for the column. If the current value is lesser than this value, an exception will be thrown.`, parseInteger)
3445
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3141
3446
  .action(actionRunner(tablesDBDecrementRowColumn))
3142
3447
 
3143
3448
  tablesDB
@@ -3149,6 +3454,7 @@ tablesDB
3149
3454
  .requiredOption(`--column <column>`, `Column key.`)
3150
3455
  .option(`--value <value>`, `Value to increment the column by. The value must be a number.`, parseInteger)
3151
3456
  .option(`--max <max>`, `Maximum value for the column. If the current value is greater than this value, an error will be thrown.`, parseInteger)
3457
+ .option(`--transaction-id <transaction-id>`, `Transaction ID for staging the operation.`)
3152
3458
  .action(actionRunner(tablesDBIncrementRowColumn))
3153
3459
 
3154
3460
  tablesDB
@@ -3171,6 +3477,12 @@ module.exports = {
3171
3477
  tablesDB,
3172
3478
  tablesDBList,
3173
3479
  tablesDBCreate,
3480
+ tablesDBListTransactions,
3481
+ tablesDBCreateTransaction,
3482
+ tablesDBGetTransaction,
3483
+ tablesDBUpdateTransaction,
3484
+ tablesDBDeleteTransaction,
3485
+ tablesDBCreateOperations,
3174
3486
  tablesDBListUsage,
3175
3487
  tablesDBGet,
3176
3488
  tablesDBUpdate,