@xata.io/client 0.21.6 → 0.22.0

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.
package/dist/index.d.ts CHANGED
@@ -215,6 +215,18 @@ type ListDatabasesResponse = {
215
215
  */
216
216
  databases: DatabaseMetadata[];
217
217
  };
218
+ /**
219
+ * @maxLength 255
220
+ * @minLength 1
221
+ * @pattern [a-zA-Z0-9_\-~]+
222
+ */
223
+ type DBName$1 = string;
224
+ /**
225
+ * @maxLength 255
226
+ * @minLength 1
227
+ * @pattern [a-zA-Z0-9_\-~]+
228
+ */
229
+ type BranchName$1 = string;
218
230
  /**
219
231
  * @example {"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}
220
232
  * @x-go-type xata.BranchMetadata
@@ -231,38 +243,22 @@ type BranchMetadata$1 = {
231
243
  stage?: string;
232
244
  labels?: string[];
233
245
  };
234
- /**
235
- * @maxLength 255
236
- * @minLength 1
237
- * @pattern [a-zA-Z0-9_\-~]+
238
- */
239
- type BranchName$1 = string;
240
- /**
241
- * @maxLength 255
242
- * @minLength 1
243
- * @pattern [a-zA-Z0-9_\-~]+
244
- */
245
- type DBName$1 = string;
246
246
  type MigrationStatus$1 = 'completed' | 'pending' | 'failed';
247
+ type Region = {
248
+ id: string;
249
+ };
247
250
  type ListRegionsResponse = {
248
251
  /**
249
252
  * A list of regions where databases can be created
250
253
  */
251
254
  regions: Region[];
252
255
  };
253
- type Region = {
254
- id: string;
255
- };
256
256
 
257
257
  /**
258
258
  * Generated by @openapi-codegen
259
259
  *
260
260
  * @version 1.0
261
261
  */
262
- type SimpleError$1 = {
263
- id?: string;
264
- message: string;
265
- };
266
262
  type BadRequestError$1 = {
267
263
  id?: string;
268
264
  message: string;
@@ -274,6 +270,10 @@ type AuthError$1 = {
274
270
  id?: string;
275
271
  message: string;
276
272
  };
273
+ type SimpleError$1 = {
274
+ id?: string;
275
+ message: string;
276
+ };
277
277
 
278
278
  /**
279
279
  * Generated by @openapi-codegen
@@ -809,6 +809,12 @@ type CreateDatabaseError = ErrorWrapper$1<{
809
809
  } | {
810
810
  status: 401;
811
811
  payload: AuthError$1;
812
+ } | {
813
+ status: 422;
814
+ payload: SimpleError$1;
815
+ } | {
816
+ status: 423;
817
+ payload: SimpleError$1;
812
818
  }>;
813
819
  type CreateDatabaseResponse = {
814
820
  /**
@@ -959,20 +965,39 @@ declare const listRegions: (variables: ListRegionsVariables, signal?: AbortSigna
959
965
  *
960
966
  * @version 1.0
961
967
  */
962
- type ListBranchesResponse = {
963
- databaseName: string;
964
- branches: Branch[];
965
- };
966
- type ListGitBranchesResponse = {
967
- mapping: {
968
- gitBranch: string;
969
- xataBranch: string;
970
- }[];
971
- };
968
+ /**
969
+ * @maxLength 255
970
+ * @minLength 1
971
+ * @pattern [a-zA-Z0-9_\-~]+
972
+ */
973
+ type DBName = string;
974
+ /**
975
+ * @format date-time
976
+ * @x-go-type string
977
+ */
978
+ type DateTime = string;
972
979
  type Branch = {
973
980
  name: string;
974
981
  createdAt: DateTime;
975
982
  };
983
+ type ListBranchesResponse = {
984
+ databaseName: string;
985
+ branches: Branch[];
986
+ };
987
+ /**
988
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
989
+ *
990
+ * @maxLength 511
991
+ * @minLength 1
992
+ * @pattern [a-zA-Z0-9_\-~]+:[a-zA-Z0-9_\-~]+
993
+ */
994
+ type DBBranchName = string;
995
+ /**
996
+ * @maxLength 255
997
+ * @minLength 1
998
+ * @pattern [a-zA-Z0-9_\-~]+
999
+ */
1000
+ type BranchName = string;
976
1001
  /**
977
1002
  * @example {"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}
978
1003
  * @x-go-type xata.BranchMetadata
@@ -989,39 +1014,19 @@ type BranchMetadata = {
989
1014
  stage?: string;
990
1015
  labels?: string[];
991
1016
  };
992
- type DBBranch = {
993
- databaseName: DBName;
994
- branchName: BranchName;
995
- createdAt: DateTime;
996
- id: string;
997
- version: number;
998
- lastMigrationID: string;
999
- metadata?: BranchMetadata;
1000
- startedFrom?: StartedFromMetadata;
1001
- schema: Schema;
1002
- };
1003
1017
  type StartedFromMetadata = {
1004
1018
  branchName: BranchName;
1005
1019
  dbBranchID: string;
1006
1020
  migrationID: string;
1007
1021
  };
1008
1022
  /**
1009
- * @x-go-type xata.Schema
1023
+ * @maxLength 255
1024
+ * @minLength 1
1025
+ * @pattern [a-zA-Z0-9_\-~]+
1010
1026
  */
1011
- type Schema = {
1012
- tables: Table[];
1013
- tablesOrder?: string[];
1014
- };
1015
- type SchemaEditScript = {
1016
- sourceMigrationID?: string;
1017
- targetMigrationID?: string;
1018
- operations: MigrationOp[];
1019
- };
1020
- type Table = {
1021
- id?: string;
1022
- name: TableName;
1023
- columns: Column[];
1024
- revLinks?: RevLink[];
1027
+ type TableName = string;
1028
+ type ColumnLink = {
1029
+ table: string;
1025
1030
  };
1026
1031
  type Column = {
1027
1032
  name: string;
@@ -1032,43 +1037,35 @@ type Column = {
1032
1037
  unique?: boolean;
1033
1038
  columns?: Column[];
1034
1039
  };
1035
- type ColumnLink = {
1036
- table: string;
1037
- };
1038
1040
  type RevLink = {
1039
1041
  linkID: string;
1040
1042
  table: string;
1041
1043
  };
1044
+ type Table = {
1045
+ id?: string;
1046
+ name: TableName;
1047
+ columns: Column[];
1048
+ revLinks?: RevLink[];
1049
+ };
1042
1050
  /**
1043
- * @maxLength 255
1044
- * @minLength 1
1045
- * @pattern [a-zA-Z0-9_\-~]+
1046
- */
1047
- type BranchName = string;
1048
- /**
1049
- * @maxLength 255
1050
- * @minLength 1
1051
- * @pattern [a-zA-Z0-9_\-~]+
1052
- */
1053
- type DBName = string;
1054
- /**
1055
- * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
1056
- *
1057
- * @maxLength 511
1058
- * @minLength 1
1059
- * @pattern [a-zA-Z0-9_\-~]+:[a-zA-Z0-9_\-~]+
1060
- */
1061
- type DBBranchName = string;
1062
- /**
1063
- * @maxLength 255
1064
- * @minLength 1
1065
- * @pattern [a-zA-Z0-9_\-~]+
1066
- */
1067
- type TableName = string;
1068
- /**
1069
- * @pattern [a-zA-Z0-9_\-~\.]+
1051
+ * @x-go-type xata.Schema
1070
1052
  */
1071
- type ColumnName = string;
1053
+ type Schema = {
1054
+ tables: Table[];
1055
+ tablesOrder?: string[];
1056
+ };
1057
+ type DBBranch = {
1058
+ databaseName: DBName;
1059
+ branchName: BranchName;
1060
+ createdAt: DateTime;
1061
+ id: string;
1062
+ version: number;
1063
+ lastMigrationID: string;
1064
+ metadata?: BranchMetadata;
1065
+ startedFrom?: StartedFromMetadata;
1066
+ schema: Schema;
1067
+ };
1068
+ type MigrationStatus = 'completed' | 'pending' | 'failed';
1072
1069
  type MetricsDatapoint = {
1073
1070
  timestamp: string;
1074
1071
  value: number;
@@ -1077,6 +1074,37 @@ type MetricsLatency = {
1077
1074
  p50?: MetricsDatapoint[];
1078
1075
  p90?: MetricsDatapoint[];
1079
1076
  };
1077
+ type ListGitBranchesResponse = {
1078
+ mapping: {
1079
+ gitBranch: string;
1080
+ xataBranch: string;
1081
+ }[];
1082
+ };
1083
+ type ColumnMigration = {
1084
+ old: Column;
1085
+ ['new']: Column;
1086
+ };
1087
+ type TableMigration = {
1088
+ newColumns?: {
1089
+ [key: string]: Column;
1090
+ };
1091
+ removedColumns?: string[];
1092
+ modifiedColumns?: ColumnMigration[];
1093
+ newColumnOrder: string[];
1094
+ };
1095
+ /**
1096
+ * @example {"newName":"newName","oldName":"oldName"}
1097
+ */
1098
+ type TableRename = {
1099
+ /**
1100
+ * @minLength 1
1101
+ */
1102
+ newName: string;
1103
+ /**
1104
+ * @minLength 1
1105
+ */
1106
+ oldName: string;
1107
+ };
1080
1108
  type BranchMigration = {
1081
1109
  id?: string;
1082
1110
  parentID?: string;
@@ -1095,78 +1123,109 @@ type BranchMigration = {
1095
1123
  newTableOrder: string[];
1096
1124
  renamedTables?: TableRename[];
1097
1125
  };
1098
- type TableMigration = {
1099
- newColumns?: {
1100
- [key: string]: Column;
1101
- };
1102
- removedColumns?: string[];
1103
- modifiedColumns?: ColumnMigration[];
1104
- newColumnOrder: string[];
1105
- };
1106
- type ColumnMigration = {
1107
- old: Column;
1108
- ['new']: Column;
1109
- };
1110
- type Commit = {
1111
- title?: string;
1112
- message?: string;
1113
- id: string;
1114
- parentID?: string;
1115
- mergeParentID?: string;
1116
- status: MigrationStatus;
1117
- createdAt: DateTime;
1118
- modifiedAt?: DateTime;
1119
- operations: MigrationOp[];
1120
- };
1121
- type MigrationStatus = 'completed' | 'pending' | 'failed';
1122
1126
  /**
1123
- * Branch schema migration.
1127
+ * @minProperties 1
1124
1128
  */
1125
- type Migration = {
1126
- parentID?: string;
1127
- operations: MigrationOp[];
1129
+ type FilterExpression = {
1130
+ $exists?: string;
1131
+ $existsNot?: string;
1132
+ $any?: FilterList;
1133
+ $all?: FilterList;
1134
+ $none?: FilterList;
1135
+ $not?: FilterList;
1136
+ } & {
1137
+ [key: string]: FilterColumn;
1128
1138
  };
1139
+ type FilterList = FilterExpression | FilterExpression[];
1140
+ type FilterValue = number | string | boolean;
1141
+ type FilterPredicate = FilterValue | FilterPredicate[] | FilterPredicateOp | FilterPredicateRangeOp;
1142
+ type FilterRangeValue = number | string;
1129
1143
  /**
1130
- * Branch schema migration operations.
1144
+ * @maxProperties 1
1145
+ * @minProperties 1
1131
1146
  */
1132
- type MigrationOp = MigrationTableOp | MigrationColumnOp;
1133
- type MigrationTableOp = {
1134
- addTable: TableOpAdd;
1135
- } | {
1136
- removeTable: TableOpRemove;
1137
- } | {
1138
- renameTable: TableOpRename;
1139
- };
1140
- type MigrationColumnOp = {
1141
- addColumn: ColumnOpAdd;
1142
- } | {
1143
- removeColumn: ColumnOpRemove;
1144
- } | {
1145
- renameColumn: ColumnOpRename;
1146
- };
1147
- type TableOpAdd = {
1148
- table: string;
1149
- };
1150
- type TableOpRemove = {
1151
- table: string;
1152
- };
1153
- type TableOpRename = {
1154
- oldName: string;
1155
- newName: string;
1147
+ type FilterPredicateOp = {
1148
+ $any?: FilterPredicate[];
1149
+ $all?: FilterPredicate[];
1150
+ $none?: FilterPredicate | FilterPredicate[];
1151
+ $not?: FilterPredicate | FilterPredicate[];
1152
+ $is?: FilterValue | FilterValue[];
1153
+ $isNot?: FilterValue | FilterValue[];
1154
+ $lt?: FilterRangeValue;
1155
+ $le?: FilterRangeValue;
1156
+ $gt?: FilterRangeValue;
1157
+ $ge?: FilterRangeValue;
1158
+ $contains?: string;
1159
+ $startsWith?: string;
1160
+ $endsWith?: string;
1161
+ $pattern?: string;
1156
1162
  };
1157
- type ColumnOpAdd = {
1158
- table: string;
1159
- column: Column;
1163
+ /**
1164
+ * @maxProperties 2
1165
+ * @minProperties 2
1166
+ */
1167
+ type FilterPredicateRangeOp = {
1168
+ $lt?: FilterRangeValue;
1169
+ $le?: FilterRangeValue;
1170
+ $gt?: FilterRangeValue;
1171
+ $ge?: FilterRangeValue;
1160
1172
  };
1161
- type ColumnOpRemove = {
1162
- table: string;
1163
- column: string;
1173
+ /**
1174
+ * @maxProperties 1
1175
+ * @minProperties 1
1176
+ */
1177
+ type FilterColumnIncludes = {
1178
+ $includes?: FilterPredicate;
1179
+ $includesAny?: FilterPredicate;
1180
+ $includesAll?: FilterPredicate;
1181
+ $includesNone?: FilterPredicate;
1164
1182
  };
1165
- type ColumnOpRename = {
1166
- table: string;
1167
- oldName: string;
1168
- newName: string;
1183
+ type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
1184
+ type SortOrder = 'asc' | 'desc';
1185
+ type SortExpression = string[] | {
1186
+ [key: string]: SortOrder;
1187
+ } | {
1188
+ [key: string]: SortOrder;
1189
+ }[];
1190
+ /**
1191
+ * Pagination settings.
1192
+ */
1193
+ type PageConfig = {
1194
+ /**
1195
+ * Query the next page that follow the cursor.
1196
+ */
1197
+ after?: string;
1198
+ /**
1199
+ * Query the previous page before the cursor.
1200
+ */
1201
+ before?: string;
1202
+ /**
1203
+ * Query the first page from the cursor.
1204
+ */
1205
+ start?: string;
1206
+ /**
1207
+ * Query the last page from the cursor.
1208
+ */
1209
+ end?: string;
1210
+ /**
1211
+ * Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size.
1212
+ *
1213
+ * @default 20
1214
+ */
1215
+ size?: number;
1216
+ /**
1217
+ * Use offset to skip entries. To skip pages set offset to a multiple of size.
1218
+ *
1219
+ * @default 0
1220
+ */
1221
+ offset?: number;
1169
1222
  };
1223
+ /**
1224
+ * @example name
1225
+ * @example email
1226
+ * @example created_at
1227
+ */
1228
+ type ColumnsProjection = string[];
1170
1229
  /**
1171
1230
  * The migration request number.
1172
1231
  *
@@ -1210,330 +1269,316 @@ type MigrationRequest = {
1210
1269
  */
1211
1270
  target?: string;
1212
1271
  };
1213
- type SortExpression = string[] | {
1214
- [key: string]: SortOrder;
1272
+ /**
1273
+ * Records metadata
1274
+ */
1275
+ type RecordsMetadata = {
1276
+ page: {
1277
+ /**
1278
+ * last record id
1279
+ */
1280
+ cursor: string;
1281
+ /**
1282
+ * true if more records can be fetch
1283
+ */
1284
+ more: boolean;
1285
+ };
1286
+ };
1287
+ type TableOpAdd = {
1288
+ table: string;
1289
+ };
1290
+ type TableOpRemove = {
1291
+ table: string;
1292
+ };
1293
+ type TableOpRename = {
1294
+ oldName: string;
1295
+ newName: string;
1296
+ };
1297
+ type MigrationTableOp = {
1298
+ addTable: TableOpAdd;
1215
1299
  } | {
1216
- [key: string]: SortOrder;
1217
- }[];
1218
- type SortOrder = 'asc' | 'desc';
1300
+ removeTable: TableOpRemove;
1301
+ } | {
1302
+ renameTable: TableOpRename;
1303
+ };
1304
+ type ColumnOpAdd = {
1305
+ table: string;
1306
+ column: Column;
1307
+ };
1308
+ type ColumnOpRemove = {
1309
+ table: string;
1310
+ column: string;
1311
+ };
1312
+ type ColumnOpRename = {
1313
+ table: string;
1314
+ oldName: string;
1315
+ newName: string;
1316
+ };
1317
+ type MigrationColumnOp = {
1318
+ addColumn: ColumnOpAdd;
1319
+ } | {
1320
+ removeColumn: ColumnOpRemove;
1321
+ } | {
1322
+ renameColumn: ColumnOpRename;
1323
+ };
1219
1324
  /**
1220
- * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
1221
- * distance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single
1222
- * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
1223
- * to allow two typos in a word.
1224
- *
1225
- * @default 1
1226
- * @maximum 2
1227
- * @minimum 0
1325
+ * Branch schema migration operations.
1228
1326
  */
1229
- type FuzzinessExpression = number;
1327
+ type MigrationOp = MigrationTableOp | MigrationColumnOp;
1328
+ type Commit = {
1329
+ title?: string;
1330
+ message?: string;
1331
+ id: string;
1332
+ parentID?: string;
1333
+ mergeParentID?: string;
1334
+ status: MigrationStatus;
1335
+ createdAt: DateTime;
1336
+ modifiedAt?: DateTime;
1337
+ operations: MigrationOp[];
1338
+ };
1339
+ type SchemaEditScript = {
1340
+ sourceMigrationID?: string;
1341
+ targetMigrationID?: string;
1342
+ operations: MigrationOp[];
1343
+ };
1230
1344
  /**
1231
- * If the prefix type is set to "disabled" (the default), the search only matches full words. If the prefix type is set to "phrase", the search will return results that match prefixes of the search phrase.
1345
+ * Branch schema migration.
1232
1346
  */
1233
- type PrefixExpression = 'phrase' | 'disabled';
1347
+ type Migration = {
1348
+ parentID?: string;
1349
+ operations: MigrationOp[];
1350
+ };
1234
1351
  /**
1235
- * The target expression is used to filter the search results by the target columns.
1352
+ * @pattern [a-zA-Z0-9_\-~\.]+
1236
1353
  */
1237
- type TargetExpression = (string | {
1354
+ type ColumnName = string;
1355
+ /**
1356
+ * Insert operation
1357
+ */
1358
+ type TransactionInsertOp = {
1238
1359
  /**
1239
- * The name of the column.
1360
+ * The table name
1240
1361
  */
1241
- column: string;
1362
+ table: string;
1242
1363
  /**
1243
- * The weight of the column.
1364
+ * The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record.
1365
+ */
1366
+ record: {
1367
+ [key: string]: any;
1368
+ };
1369
+ /**
1370
+ * The version of the record you expect to be overwriting. Only valid with an
1371
+ * explicit ID is also set in the `record` key.
1372
+ */
1373
+ ifVersion?: number;
1374
+ /**
1375
+ * createOnly is used to change how Xata acts when an explicit ID is set in the `record` key.
1244
1376
  *
1245
- * @default 1
1246
- * @maximum 10
1247
- * @minimum 1
1377
+ * If `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata
1378
+ * will cancel the transaction.
1379
+ *
1380
+ * If `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no
1381
+ * conflict, the record is inserted. If there is a conflict, Xata will replace the record.
1248
1382
  */
1249
- weight?: number;
1250
- })[];
1251
- /**
1252
- * @minProperties 1
1253
- */
1254
- type FilterExpression = {
1255
- $exists?: string;
1256
- $existsNot?: string;
1257
- $any?: FilterList;
1258
- $all?: FilterList;
1259
- $none?: FilterList;
1260
- $not?: FilterList;
1261
- } & {
1262
- [key: string]: FilterColumn;
1383
+ createOnly?: boolean;
1263
1384
  };
1264
1385
  /**
1265
- * The description of the summaries you wish to receive. Set each key to be the field name
1266
- * you'd like for the summary. These names must not collide with other columns you've
1267
- * requested from `columns`; including implicit requests like `settings.*`.
1268
- *
1269
- * The value for each key needs to be an object. This object should contain one key and one
1270
- * value only. In this object, the key should be set to the summary function you wish to use
1271
- * and the value set to the column name to be summarized.
1272
- *
1273
- * The column being summarized cannot be an internal column (id, xata.*), nor the base of
1274
- * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
1275
- * `settings.dark_mode` but not `settings` nor `settings.*`.
1276
- *
1277
- * @example {"all_users":{"count":"*"}}
1278
- * @example {"total_created":{"count":"created_at"}}
1279
- * @example {"min_cost":{"min":"cost"}}
1280
- * @example {"max_happiness":{"max":"happiness"}}
1281
- * @example {"total_revenue":{"sum":"revenue"}}
1282
- * @example {"average_speed":{"average":"speed"}}
1283
- * @x-go-type xbquery.SummaryList
1386
+ * @pattern [a-zA-Z0-9_-~:]+
1284
1387
  */
1285
- type SummaryExpressionList = {
1286
- [key: string]: SummaryExpression;
1287
- };
1388
+ type RecordID = string;
1288
1389
  /**
1289
- * A summary expression is the description of a single summary operation. It consists of a single
1290
- * key representing the operation, and a value representing the column to be operated on.
1291
- *
1292
- * The column being summarized cannot be an internal column (id, xata.*), nor the base of
1293
- * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
1294
- * `settings.dark_mode` but not `settings` nor `settings.*`.
1295
- *
1296
- * We currently support several aggregation functions. Not all functions can be run on all column
1297
- * types.
1298
- *
1299
- * - `count` is used to count the number of records in each group. Use `{"count": "*"}` to count
1300
- * all columns present, otherwise `{"count": "<column_path>"}` to count the number of non-null
1301
- * values are present at column path.
1302
- *
1303
- * Count can be used on any column type, and always returns an int.
1304
- *
1305
- * - `min` calculates the minimum value in each group. `min` is compatible with most types;
1306
- * string, multiple, text, email, int, float, and datetime. It returns a value of the same
1307
- * type as operated on. This means that `{"lowest_latency": {"min": "latency"}}` where
1308
- * `latency` is an int, will always return an int.
1309
- *
1310
- * - `max` calculates the maximum value in each group. `max` shares the same compatibility as
1311
- * `min`.
1312
- *
1313
- * - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will
1314
- * return a value of the same type as requested.
1315
- *
1316
- * - `average` averages all values in a group. `average` can be run on `int` and `float` types, and
1317
- * always returns a float.
1318
- *
1319
- * @example {"count":"deleted_at"}
1320
- * @x-go-type xbquery.Summary
1390
+ * Update operation
1321
1391
  */
1322
- type SummaryExpression = Record<string, any>;
1392
+ type TransactionUpdateOp = {
1393
+ /**
1394
+ * The table name
1395
+ */
1396
+ table: string;
1397
+ id: RecordID;
1398
+ /**
1399
+ * The fields of the record you'd like to update
1400
+ */
1401
+ fields: {
1402
+ [key: string]: any;
1403
+ };
1404
+ /**
1405
+ * The version of the record you expect to be updating
1406
+ */
1407
+ ifVersion?: number;
1408
+ /**
1409
+ * Xata will insert this record if it cannot be found.
1410
+ */
1411
+ upsert?: boolean;
1412
+ };
1323
1413
  /**
1324
- * The description of the aggregations you wish to receive.
1325
- *
1326
- * @example {"totalCount":{"count":"*"},"dailyActiveUsers":{"dateHistogram":{"column":"date","interval":"1d"},"aggs":{"uniqueUsers":{"uniqueCount":{"column":"userID"}}}}}
1414
+ * A delete operation. The transaction will continue if no record matches the ID.
1327
1415
  */
1328
- type AggExpressionMap = {
1329
- [key: string]: AggExpression;
1416
+ type TransactionDeleteOp = {
1417
+ /**
1418
+ * The table name
1419
+ */
1420
+ table: string;
1421
+ id: RecordID;
1330
1422
  };
1331
1423
  /**
1332
- * The description of a single aggregation operation. It is an object with only one key-value pair.
1333
- * The key represents the aggreagtion type, while the value is an object with the configuration of
1334
- * the aggreagtion.
1335
- *
1336
- * @x-go-type xata.AggExpression
1424
+ * A transaction operation
1337
1425
  */
1338
- type AggExpression = {
1339
- count?: CountAgg;
1340
- } | {
1341
- sum?: SumAgg;
1342
- } | {
1343
- max?: MaxAgg;
1344
- } | {
1345
- min?: MinAgg;
1346
- } | {
1347
- average?: AverageAgg;
1348
- } | {
1349
- uniqueCount?: UniqueCountAgg;
1350
- } | {
1351
- dateHistogram?: DateHistogramAgg;
1426
+ type TransactionOperation$1 = {
1427
+ insert: TransactionInsertOp;
1352
1428
  } | {
1353
- topValues?: TopValuesAgg;
1429
+ update: TransactionUpdateOp;
1354
1430
  } | {
1355
- numericHistogram?: NumericHistogramAgg;
1431
+ ['delete']: TransactionDeleteOp;
1356
1432
  };
1357
1433
  /**
1358
- * Count the number of records with an optional filter.
1359
- */
1360
- type CountAgg = {
1361
- filter?: FilterExpression;
1362
- } | '*';
1363
- /**
1364
- * The sum of the numeric values in a particular column.
1434
+ * A result from an insert operation.
1365
1435
  */
1366
- type SumAgg = {
1436
+ type TransactionResultInsert = {
1367
1437
  /**
1368
- * The column on which to compute the sum. Must be a numeric type.
1438
+ * The type of operation who's result is being returned.
1369
1439
  */
1370
- column: string;
1440
+ operation: 'insert';
1441
+ /**
1442
+ * The number of affected rows
1443
+ */
1444
+ rows: number;
1445
+ id: RecordID;
1371
1446
  };
1372
1447
  /**
1373
- * The max of the numeric values in a particular column.
1448
+ * A result from an update operation.
1374
1449
  */
1375
- type MaxAgg = {
1450
+ type TransactionResultUpdate = {
1376
1451
  /**
1377
- * The column on which to compute the max. Must be a numeric type.
1452
+ * The type of operation who's result is being returned.
1378
1453
  */
1379
- column: string;
1454
+ operation: 'update';
1455
+ /**
1456
+ * The number of updated rows
1457
+ */
1458
+ rows: number;
1459
+ id: RecordID;
1380
1460
  };
1381
1461
  /**
1382
- * The min of the numeric values in a particular column.
1462
+ * A result from a delete operation.
1383
1463
  */
1384
- type MinAgg = {
1464
+ type TransactionResultDelete = {
1385
1465
  /**
1386
- * The column on which to compute the min. Must be a numeric type.
1466
+ * The type of operation who's result is being returned.
1387
1467
  */
1388
- column: string;
1468
+ operation: 'delete';
1469
+ /**
1470
+ * The number of deleted rows
1471
+ */
1472
+ rows: number;
1389
1473
  };
1390
1474
  /**
1391
- * The average of the numeric values in a particular column.
1475
+ * An ordered array of results from the submitted operations.
1392
1476
  */
1393
- type AverageAgg = {
1394
- /**
1395
- * The column on which to compute the average. Must be a numeric type.
1396
- */
1397
- column: string;
1477
+ type TransactionSuccess = {
1478
+ results: (TransactionResultInsert | TransactionResultUpdate | TransactionResultDelete)[];
1398
1479
  };
1399
1480
  /**
1400
- * Count the number of distinct values in a particular column.
1481
+ * An error message from a failing transaction operation
1401
1482
  */
1402
- type UniqueCountAgg = {
1483
+ type TransactionError = {
1403
1484
  /**
1404
- * The column from where to count the unique values.
1485
+ * The index of the failing operation
1405
1486
  */
1406
- column: string;
1487
+ index: number;
1407
1488
  /**
1408
- * The threshold under which the unique count is exact. If the number of unique
1409
- * values in the column is higher than this threshold, the results are approximative.
1410
- * Maximum value is 40,000, default value is 3000.
1489
+ * The error message
1411
1490
  */
1412
- precisionThreshold?: number;
1491
+ message: string;
1413
1492
  };
1414
1493
  /**
1415
- * Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket.
1494
+ * An array of errors, with indicides, from the transaction.
1416
1495
  */
1417
- type DateHistogramAgg = {
1496
+ type TransactionFailure = {
1418
1497
  /**
1419
- * The column to use for bucketing. Must be of type datetime.
1498
+ * The request ID.
1420
1499
  */
1421
- column: string;
1500
+ id: string;
1422
1501
  /**
1423
- * The fixed interval to use when bucketing.
1424
- * It is fromatted as number + units, for example: `5d`, `20m`, `10s`.
1425
- *
1426
- * @pattern ^(\d+)(d|h|m|s|ms)$
1502
+ * An array of errors from the submitted operations.
1427
1503
  */
1428
- interval?: string;
1504
+ errors: TransactionError[];
1505
+ };
1506
+ /**
1507
+ * Xata Table Record Metadata
1508
+ */
1509
+ type RecordMeta = {
1510
+ id: RecordID;
1511
+ xata: {
1512
+ /**
1513
+ * The record's version. Can be used for optimistic concurrency control.
1514
+ */
1515
+ version: number;
1516
+ /**
1517
+ * The record's table name. APIs that return records from multiple tables will set this field accordingly.
1518
+ */
1519
+ table?: string;
1520
+ /**
1521
+ * Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
1522
+ */
1523
+ highlight?: {
1524
+ [key: string]: string[] | {
1525
+ [key: string]: any;
1526
+ };
1527
+ };
1528
+ /**
1529
+ * The record's relevancy score. This is returned by the search APIs.
1530
+ */
1531
+ score?: number;
1532
+ /**
1533
+ * Encoding/Decoding errors
1534
+ */
1535
+ warnings?: string[];
1536
+ };
1537
+ };
1538
+ /**
1539
+ * The target expression is used to filter the search results by the target columns.
1540
+ */
1541
+ type TargetExpression = (string | {
1429
1542
  /**
1430
- * The calendar-aware interval to use when bucketing. Possible values are: `minute`,
1431
- * `hour`, `day`, `week`, `month`, `quarter`, `year`.
1543
+ * The name of the column.
1432
1544
  */
1433
- calendarInterval?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
1545
+ column: string;
1434
1546
  /**
1435
- * The timezone to use for bucketing. By default, UTC is assumed.
1436
- * The accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or
1437
- * `-08:00`.
1547
+ * The weight of the column.
1438
1548
  *
1439
- * @pattern ^[+-][01]\d:[0-5]\d$
1549
+ * @default 1
1550
+ * @maximum 10
1551
+ * @minimum 1
1440
1552
  */
1441
- timezone?: string;
1442
- aggs?: AggExpressionMap;
1443
- };
1553
+ weight?: number;
1554
+ })[];
1444
1555
  /**
1445
- * Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket.
1446
- * The top values as ordered by the number of records (`$count`) are returned.
1556
+ * Boost records with a particular value for a column.
1447
1557
  */
1448
- type TopValuesAgg = {
1558
+ type ValueBooster$1 = {
1449
1559
  /**
1450
- * The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`.
1560
+ * The column in which to look for the value.
1451
1561
  */
1452
1562
  column: string;
1453
- aggs?: AggExpressionMap;
1454
1563
  /**
1455
- * The maximum number of unique values to return.
1456
- *
1457
- * @default 10
1458
- * @maximum 1000
1564
+ * The exact value to boost.
1459
1565
  */
1460
- size?: number;
1566
+ value: string | number | boolean;
1567
+ /**
1568
+ * The factor with which to multiply the score of the record.
1569
+ */
1570
+ factor: number;
1571
+ /**
1572
+ * Only apply this booster to the records for which the provided filter matches.
1573
+ */
1574
+ ifMatchesFilter?: FilterExpression;
1461
1575
  };
1462
1576
  /**
1463
- * Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket.
1577
+ * Boost records based on the value of a numeric column.
1464
1578
  */
1465
- type NumericHistogramAgg = {
1579
+ type NumericBooster$1 = {
1466
1580
  /**
1467
- * The column to use for bucketing. Must be of numeric type.
1468
- */
1469
- column: string;
1470
- /**
1471
- * The numeric interval to use for bucketing. The resulting buckets will be ranges
1472
- * with this value as size.
1473
- *
1474
- * @minimum 0
1475
- */
1476
- interval: number;
1477
- /**
1478
- * By default the bucket keys start with 0 and then continue in `interval` steps. The bucket
1479
- * boundaries can be shiftend by using the offset option. For example, if the `interval` is 100,
1480
- * but you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset`
1481
- * to 50.
1482
- *
1483
- * @default 0
1484
- */
1485
- offset?: number;
1486
- aggs?: AggExpressionMap;
1487
- };
1488
- type HighlightExpression = {
1489
- /**
1490
- * Set to `false` to disable highlighting. By default it is `true`.
1491
- */
1492
- enabled?: boolean;
1493
- /**
1494
- * Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.
1495
- */
1496
- encodeHTML?: boolean;
1497
- };
1498
- /**
1499
- * Booster Expression
1500
- *
1501
- * @x-go-type xata.BoosterExpression
1502
- */
1503
- type BoosterExpression = {
1504
- valueBooster?: ValueBooster$1;
1505
- } | {
1506
- numericBooster?: NumericBooster$1;
1507
- } | {
1508
- dateBooster?: DateBooster$1;
1509
- };
1510
- /**
1511
- * Boost records with a particular value for a column.
1512
- */
1513
- type ValueBooster$1 = {
1514
- /**
1515
- * The column in which to look for the value.
1516
- */
1517
- column: string;
1518
- /**
1519
- * The exact value to boost.
1520
- */
1521
- value: string | number | boolean;
1522
- /**
1523
- * The factor with which to multiply the score of the record.
1524
- */
1525
- factor: number;
1526
- /**
1527
- * Only apply this booster to the records for which the provided filter matches.
1528
- */
1529
- ifMatchesFilter?: FilterExpression;
1530
- };
1531
- /**
1532
- * Boost records based on the value of a numeric column.
1533
- */
1534
- type NumericBooster$1 = {
1535
- /**
1536
- * The column in which to look for the value.
1581
+ * The column in which to look for the value.
1537
1582
  */
1538
1583
  column: string;
1539
1584
  /**
@@ -1589,83 +1634,42 @@ type DateBooster$1 = {
1589
1634
  */
1590
1635
  ifMatchesFilter?: FilterExpression;
1591
1636
  };
1592
- type FilterList = FilterExpression | FilterExpression[];
1593
- type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
1594
- /**
1595
- * @maxProperties 1
1596
- * @minProperties 1
1597
- */
1598
- type FilterColumnIncludes = {
1599
- $includes?: FilterPredicate;
1600
- $includesAny?: FilterPredicate;
1601
- $includesAll?: FilterPredicate;
1602
- $includesNone?: FilterPredicate;
1603
- };
1604
- type FilterPredicate = FilterValue | FilterPredicate[] | FilterPredicateOp | FilterPredicateRangeOp;
1605
1637
  /**
1606
- * @maxProperties 1
1607
- * @minProperties 1
1638
+ * Booster Expression
1639
+ *
1640
+ * @x-go-type xata.BoosterExpression
1608
1641
  */
1609
- type FilterPredicateOp = {
1610
- $any?: FilterPredicate[];
1611
- $all?: FilterPredicate[];
1612
- $none?: FilterPredicate | FilterPredicate[];
1613
- $not?: FilterPredicate | FilterPredicate[];
1614
- $is?: FilterValue | FilterValue[];
1615
- $isNot?: FilterValue | FilterValue[];
1616
- $lt?: FilterRangeValue;
1617
- $le?: FilterRangeValue;
1618
- $gt?: FilterRangeValue;
1619
- $ge?: FilterRangeValue;
1620
- $contains?: string;
1621
- $startsWith?: string;
1622
- $endsWith?: string;
1623
- $pattern?: string;
1642
+ type BoosterExpression = {
1643
+ valueBooster?: ValueBooster$1;
1644
+ } | {
1645
+ numericBooster?: NumericBooster$1;
1646
+ } | {
1647
+ dateBooster?: DateBooster$1;
1624
1648
  };
1625
1649
  /**
1626
- * @maxProperties 2
1627
- * @minProperties 2
1650
+ * Maximum [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) for the search terms. The Levenshtein
1651
+ * distance is the number of one character changes needed to make two strings equal. The default is 1, meaning that single
1652
+ * character typos per word are tollerated by search. You can set it to 0 to remove the typo tollerance or set it to 2
1653
+ * to allow two typos in a word.
1654
+ *
1655
+ * @default 1
1656
+ * @maximum 2
1657
+ * @minimum 0
1628
1658
  */
1629
- type FilterPredicateRangeOp = {
1630
- $lt?: FilterRangeValue;
1631
- $le?: FilterRangeValue;
1632
- $gt?: FilterRangeValue;
1633
- $ge?: FilterRangeValue;
1634
- };
1635
- type FilterRangeValue = number | string;
1636
- type FilterValue = number | string | boolean;
1659
+ type FuzzinessExpression = number;
1637
1660
  /**
1638
- * Pagination settings.
1661
+ * If the prefix type is set to "disabled" (the default), the search only matches full words. If the prefix type is set to "phrase", the search will return results that match prefixes of the search phrase.
1639
1662
  */
1640
- type PageConfig = {
1641
- /**
1642
- * Query the next page that follow the cursor.
1643
- */
1644
- after?: string;
1645
- /**
1646
- * Query the previous page before the cursor.
1647
- */
1648
- before?: string;
1649
- /**
1650
- * Query the first page from the cursor.
1651
- */
1652
- start?: string;
1653
- /**
1654
- * Query the last page from the cursor.
1655
- */
1656
- end?: string;
1663
+ type PrefixExpression = 'phrase' | 'disabled';
1664
+ type HighlightExpression = {
1657
1665
  /**
1658
- * Set page size. If the size is missing it is read from the cursor. If no cursor is given Xata will choose the default page size.
1659
- *
1660
- * @default 20
1666
+ * Set to `false` to disable highlighting. By default it is `true`.
1661
1667
  */
1662
- size?: number;
1668
+ enabled?: boolean;
1663
1669
  /**
1664
- * Use offset to skip entries. To skip pages set offset to a multiple of size.
1665
- *
1666
- * @default 0
1670
+ * Set to `false` to disable HTML encoding in highlight snippets. By default it is `true`.
1667
1671
  */
1668
- offset?: number;
1672
+ encodeHTML?: boolean;
1669
1673
  };
1670
1674
  /**
1671
1675
  * Pagination settings for the search endpoints.
@@ -1687,218 +1691,232 @@ type SearchPageConfig = {
1687
1691
  offset?: number;
1688
1692
  };
1689
1693
  /**
1690
- * @example name
1691
- * @example email
1692
- * @example created_at
1694
+ * A summary expression is the description of a single summary operation. It consists of a single
1695
+ * key representing the operation, and a value representing the column to be operated on.
1696
+ *
1697
+ * The column being summarized cannot be an internal column (id, xata.*), nor the base of
1698
+ * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
1699
+ * `settings.dark_mode` but not `settings` nor `settings.*`.
1700
+ *
1701
+ * We currently support several aggregation functions. Not all functions can be run on all column
1702
+ * types.
1703
+ *
1704
+ * - `count` is used to count the number of records in each group. Use `{"count": "*"}` to count
1705
+ * all columns present, otherwise `{"count": "<column_path>"}` to count the number of non-null
1706
+ * values are present at column path.
1707
+ *
1708
+ * Count can be used on any column type, and always returns an int.
1709
+ *
1710
+ * - `min` calculates the minimum value in each group. `min` is compatible with most types;
1711
+ * string, multiple, text, email, int, float, and datetime. It returns a value of the same
1712
+ * type as operated on. This means that `{"lowest_latency": {"min": "latency"}}` where
1713
+ * `latency` is an int, will always return an int.
1714
+ *
1715
+ * - `max` calculates the maximum value in each group. `max` shares the same compatibility as
1716
+ * `min`.
1717
+ *
1718
+ * - `sum` adds up all values in a group. `sum` can be run on `int` and `float` types, and will
1719
+ * return a value of the same type as requested.
1720
+ *
1721
+ * - `average` averages all values in a group. `average` can be run on `int` and `float` types, and
1722
+ * always returns a float.
1723
+ *
1724
+ * @example {"count":"deleted_at"}
1725
+ * @x-go-type xbquery.Summary
1693
1726
  */
1694
- type ColumnsProjection = string[];
1727
+ type SummaryExpression = Record<string, any>;
1695
1728
  /**
1696
- * Xata Table Record Metadata
1729
+ * The description of the summaries you wish to receive. Set each key to be the field name
1730
+ * you'd like for the summary. These names must not collide with other columns you've
1731
+ * requested from `columns`; including implicit requests like `settings.*`.
1732
+ *
1733
+ * The value for each key needs to be an object. This object should contain one key and one
1734
+ * value only. In this object, the key should be set to the summary function you wish to use
1735
+ * and the value set to the column name to be summarized.
1736
+ *
1737
+ * The column being summarized cannot be an internal column (id, xata.*), nor the base of
1738
+ * an object, i.e. if `settings` is an object with `dark_mode` as a field, you may summarize
1739
+ * `settings.dark_mode` but not `settings` nor `settings.*`.
1740
+ *
1741
+ * @example {"all_users":{"count":"*"},"total_created":{"count":"created_at"},"min_cost":{"min":"cost"},"max_happiness":{"max":"happiness"},"total_revenue":{"sum":"revenue"},"average_speed":{"average":"speed"}}
1742
+ * @x-go-type xbquery.SummaryList
1697
1743
  */
1698
- type RecordMeta = {
1699
- id: RecordID;
1700
- xata: {
1701
- /**
1702
- * The record's version. Can be used for optimistic concurrency control.
1703
- */
1704
- version: number;
1705
- /**
1706
- * The record's table name. APIs that return records from multiple tables will set this field accordingly.
1707
- */
1708
- table?: string;
1709
- /**
1710
- * Highlights of the record. This is used by the search APIs to indicate which fields and parts of the fields have matched the search.
1711
- */
1712
- highlight?: {
1713
- [key: string]: string[] | {
1714
- [key: string]: any;
1715
- };
1716
- };
1717
- /**
1718
- * The record's relevancy score. This is returned by the search APIs.
1719
- */
1720
- score?: number;
1721
- /**
1722
- * Encoding/Decoding errors
1723
- */
1724
- warnings?: string[];
1725
- };
1744
+ type SummaryExpressionList = {
1745
+ [key: string]: SummaryExpression;
1726
1746
  };
1727
1747
  /**
1728
- * @pattern [a-zA-Z0-9_-~:]+
1748
+ * Count the number of records with an optional filter.
1729
1749
  */
1730
- type RecordID = string;
1750
+ type CountAgg = {
1751
+ filter?: FilterExpression;
1752
+ } | '*';
1731
1753
  /**
1732
- * @example {"newName":"newName","oldName":"oldName"}
1754
+ * The sum of the numeric values in a particular column.
1733
1755
  */
1734
- type TableRename = {
1735
- /**
1736
- * @minLength 1
1737
- */
1738
- newName: string;
1756
+ type SumAgg = {
1739
1757
  /**
1740
- * @minLength 1
1758
+ * The column on which to compute the sum. Must be a numeric type.
1741
1759
  */
1742
- oldName: string;
1760
+ column: string;
1743
1761
  };
1744
1762
  /**
1745
- * Records metadata
1763
+ * The max of the numeric values in a particular column.
1746
1764
  */
1747
- type RecordsMetadata = {
1748
- page: {
1749
- /**
1750
- * last record id
1751
- */
1752
- cursor: string;
1753
- /**
1754
- * true if more records can be fetch
1755
- */
1756
- more: boolean;
1757
- };
1758
- };
1759
- type AggResponse$1 = (number | null) | {
1760
- values: ({
1761
- $key: string | number;
1762
- $count: number;
1763
- } & {
1764
- [key: string]: AggResponse$1;
1765
- })[];
1765
+ type MaxAgg = {
1766
+ /**
1767
+ * The column on which to compute the max. Must be a numeric type.
1768
+ */
1769
+ column: string;
1766
1770
  };
1767
1771
  /**
1768
- * A transaction operation
1772
+ * The min of the numeric values in a particular column.
1769
1773
  */
1770
- type TransactionOperation$1 = {
1771
- insert: TransactionInsertOp;
1772
- } | {
1773
- update: TransactionUpdateOp;
1774
- } | {
1775
- ['delete']: TransactionDeleteOp;
1774
+ type MinAgg = {
1775
+ /**
1776
+ * The column on which to compute the min. Must be a numeric type.
1777
+ */
1778
+ column: string;
1776
1779
  };
1777
1780
  /**
1778
- * Insert operation
1781
+ * The average of the numeric values in a particular column.
1779
1782
  */
1780
- type TransactionInsertOp = {
1781
- /**
1782
- * The table name
1783
- */
1784
- table: string;
1785
- /**
1786
- * The record to insert. The `id` field is optional; when specified, it will be used as the ID for the record.
1787
- */
1788
- record: {
1789
- [key: string]: any;
1790
- };
1791
- /**
1792
- * The version of the record you expect to be overwriting. Only valid with an
1793
- * explicit ID is also set in the `record` key.
1794
- */
1795
- ifVersion?: number;
1783
+ type AverageAgg = {
1796
1784
  /**
1797
- * createOnly is used to change how Xata acts when an explicit ID is set in the `record` key.
1798
- *
1799
- * If `createOnly` is set to `true`, Xata will only attempt to insert the record. If there's a conflict, Xata
1800
- * will cancel the transaction.
1801
- *
1802
- * If `createOnly` is set to `false`, Xata will attempt to insert the record. If there's no
1803
- * conflict, the record is inserted. If there is a conflict, Xata will replace the record.
1785
+ * The column on which to compute the average. Must be a numeric type.
1804
1786
  */
1805
- createOnly?: boolean;
1787
+ column: string;
1806
1788
  };
1807
1789
  /**
1808
- * Update operation
1790
+ * Count the number of distinct values in a particular column.
1809
1791
  */
1810
- type TransactionUpdateOp = {
1811
- /**
1812
- * The table name
1813
- */
1814
- table: string;
1815
- id: RecordID;
1816
- /**
1817
- * The fields of the record you'd like to update
1818
- */
1819
- fields: {
1820
- [key: string]: any;
1821
- };
1792
+ type UniqueCountAgg = {
1822
1793
  /**
1823
- * The version of the record you expect to be updating
1794
+ * The column from where to count the unique values.
1824
1795
  */
1825
- ifVersion?: number;
1796
+ column: string;
1826
1797
  /**
1827
- * Xata will insert this record if it cannot be found.
1798
+ * The threshold under which the unique count is exact. If the number of unique
1799
+ * values in the column is higher than this threshold, the results are approximative.
1800
+ * Maximum value is 40,000, default value is 3000.
1828
1801
  */
1829
- upsert?: boolean;
1802
+ precisionThreshold?: number;
1830
1803
  };
1831
1804
  /**
1832
- * A delete operation. The transaction will continue if no record matches the ID.
1805
+ * The description of the aggregations you wish to receive.
1806
+ *
1807
+ * @example {"totalCount":{"count":"*"},"dailyActiveUsers":{"dateHistogram":{"column":"date","interval":"1d","aggs":{"uniqueUsers":{"uniqueCount":{"column":"userID"}}}}}}
1833
1808
  */
1834
- type TransactionDeleteOp = {
1835
- /**
1836
- * The table name
1837
- */
1838
- table: string;
1839
- id: RecordID;
1809
+ type AggExpressionMap = {
1810
+ [key: string]: AggExpression;
1840
1811
  };
1841
1812
  /**
1842
- * A result from an insert operation.
1813
+ * Split data into buckets by a datetime column. Accepts sub-aggregations for each bucket.
1843
1814
  */
1844
- type TransactionResultInsert = {
1815
+ type DateHistogramAgg = {
1845
1816
  /**
1846
- * The type of operation who's result is being returned.
1817
+ * The column to use for bucketing. Must be of type datetime.
1847
1818
  */
1848
- operation: 'insert';
1819
+ column: string;
1849
1820
  /**
1850
- * The number of affected rows
1821
+ * The fixed interval to use when bucketing.
1822
+ * It is fromatted as number + units, for example: `5d`, `20m`, `10s`.
1823
+ *
1824
+ * @pattern ^(\d+)(d|h|m|s|ms)$
1851
1825
  */
1852
- rows: number;
1853
- id: RecordID;
1854
- };
1855
- /**
1856
- * A result from an update operation.
1857
- */
1858
- type TransactionResultUpdate = {
1826
+ interval?: string;
1859
1827
  /**
1860
- * The type of operation who's result is being returned.
1828
+ * The calendar-aware interval to use when bucketing. Possible values are: `minute`,
1829
+ * `hour`, `day`, `week`, `month`, `quarter`, `year`.
1861
1830
  */
1862
- operation: 'update';
1831
+ calendarInterval?: 'minute' | 'hour' | 'day' | 'week' | 'month' | 'quarter' | 'year';
1863
1832
  /**
1864
- * The number of updated rows
1833
+ * The timezone to use for bucketing. By default, UTC is assumed.
1834
+ * The accepted format is as an ISO 8601 UTC offset. For example: `+01:00` or
1835
+ * `-08:00`.
1836
+ *
1837
+ * @pattern ^[+-][01]\d:[0-5]\d$
1865
1838
  */
1866
- rows: number;
1867
- id: RecordID;
1839
+ timezone?: string;
1840
+ aggs?: AggExpressionMap;
1868
1841
  };
1869
1842
  /**
1870
- * A result from a delete operation.
1843
+ * Split data into buckets by the unique values in a column. Accepts sub-aggregations for each bucket.
1844
+ * The top values as ordered by the number of records (`$count`) are returned.
1871
1845
  */
1872
- type TransactionResultDelete = {
1846
+ type TopValuesAgg = {
1873
1847
  /**
1874
- * The type of operation who's result is being returned.
1848
+ * The column to use for bucketing. Accepted types are `string`, `email`, `int`, `float`, or `bool`.
1875
1849
  */
1876
- operation: 'delete';
1850
+ column: string;
1851
+ aggs?: AggExpressionMap;
1877
1852
  /**
1878
- * The number of deleted rows
1853
+ * The maximum number of unique values to return.
1854
+ *
1855
+ * @default 10
1856
+ * @maximum 1000
1879
1857
  */
1880
- rows: number;
1858
+ size?: number;
1881
1859
  };
1882
1860
  /**
1883
- * An error message from a failing transaction operation
1884
- *
1885
- * @x-go-type xata.ErrTxOp
1861
+ * Split data into buckets by dynamic numeric ranges. Accepts sub-aggregations for each bucket.
1886
1862
  */
1887
- type TransactionError = {
1863
+ type NumericHistogramAgg = {
1888
1864
  /**
1889
- * The index of the failing operation
1865
+ * The column to use for bucketing. Must be of numeric type.
1890
1866
  */
1891
- index?: number;
1867
+ column: string;
1892
1868
  /**
1893
- * The error message
1869
+ * The numeric interval to use for bucketing. The resulting buckets will be ranges
1870
+ * with this value as size.
1871
+ *
1872
+ * @minimum 0
1894
1873
  */
1895
- message: string;
1874
+ interval: number;
1875
+ /**
1876
+ * By default the bucket keys start with 0 and then continue in `interval` steps. The bucket
1877
+ * boundaries can be shiftend by using the offset option. For example, if the `interval` is 100,
1878
+ * but you prefer the bucket boundaries to be `[50, 150), [150, 250), etc.`, you can set `offset`
1879
+ * to 50.
1880
+ *
1881
+ * @default 0
1882
+ */
1883
+ offset?: number;
1884
+ aggs?: AggExpressionMap;
1896
1885
  };
1897
1886
  /**
1898
- * @format date-time
1899
- * @x-go-type string
1887
+ * The description of a single aggregation operation. It is an object with only one key-value pair.
1888
+ * The key represents the aggregation type, while the value is an object with the configuration of
1889
+ * the aggregation.
1890
+ *
1891
+ * @x-go-type xata.AggExpression
1900
1892
  */
1901
- type DateTime = string;
1893
+ type AggExpression = {
1894
+ count?: CountAgg;
1895
+ } | {
1896
+ sum?: SumAgg;
1897
+ } | {
1898
+ max?: MaxAgg;
1899
+ } | {
1900
+ min?: MinAgg;
1901
+ } | {
1902
+ average?: AverageAgg;
1903
+ } | {
1904
+ uniqueCount?: UniqueCountAgg;
1905
+ } | {
1906
+ dateHistogram?: DateHistogramAgg;
1907
+ } | {
1908
+ topValues?: TopValuesAgg;
1909
+ } | {
1910
+ numericHistogram?: NumericHistogramAgg;
1911
+ };
1912
+ type AggResponse$1 = (number | null) | {
1913
+ values: ({
1914
+ $key: string | number;
1915
+ $count: number;
1916
+ } & {
1917
+ [key: string]: AggResponse$1;
1918
+ })[];
1919
+ };
1902
1920
  /**
1903
1921
  * Xata Table Record Metadata
1904
1922
  */
@@ -1912,26 +1930,33 @@ type XataRecord$1 = RecordMeta & {
1912
1930
  * @version 1.0
1913
1931
  */
1914
1932
 
1915
- type SimpleError = {
1933
+ type BadRequestError = {
1916
1934
  id?: string;
1917
1935
  message: string;
1918
1936
  };
1919
- type BulkError = {
1920
- errors: {
1921
- message?: string;
1922
- status?: number;
1923
- }[];
1937
+ /**
1938
+ * @example {"message":"invalid API key"}
1939
+ */
1940
+ type AuthError = {
1941
+ id?: string;
1942
+ message: string;
1924
1943
  };
1925
- type BulkInsertResponse = {
1926
- recordIDs: string[];
1927
- } | {
1928
- records: XataRecord$1[];
1944
+ type SimpleError = {
1945
+ id?: string;
1946
+ message: string;
1929
1947
  };
1930
1948
  type BranchMigrationPlan = {
1931
1949
  version: number;
1932
1950
  migration: BranchMigration;
1933
1951
  };
1934
- type RecordResponse = XataRecord$1;
1952
+ type SchemaUpdateResponse = {
1953
+ /**
1954
+ * @minLength 1
1955
+ */
1956
+ migrationID: string;
1957
+ parentMigrationID: string;
1958
+ status: MigrationStatus;
1959
+ };
1935
1960
  type SchemaCompareResponse = {
1936
1961
  source: Schema;
1937
1962
  target: Schema;
@@ -1943,62 +1968,37 @@ type RecordUpdateResponse = XataRecord$1 | {
1943
1968
  version: number;
1944
1969
  };
1945
1970
  };
1971
+ type RecordResponse = XataRecord$1;
1972
+ type BulkInsertResponse = {
1973
+ recordIDs: string[];
1974
+ } | {
1975
+ records: XataRecord$1[];
1976
+ };
1977
+ type BulkError = {
1978
+ errors: {
1979
+ message?: string;
1980
+ status?: number;
1981
+ }[];
1982
+ };
1946
1983
  type QueryResponse = {
1947
1984
  records: XataRecord$1[];
1948
1985
  meta: RecordsMetadata;
1949
1986
  };
1950
- type SchemaUpdateResponse = {
1951
- /**
1952
- * @minLength 1
1953
- */
1954
- migrationID: string;
1955
- parentMigrationID: string;
1956
- status: MigrationStatus;
1987
+ type SearchResponse = {
1988
+ records: XataRecord$1[];
1989
+ warning?: string;
1957
1990
  };
1958
1991
  type SummarizeResponse = {
1959
1992
  summaries: Record<string, any>[];
1960
1993
  };
1961
1994
  /**
1962
- * @example {"aggs":{"dailyUniqueUsers":{"values":[{"key":"2022-02-22T22:22:22Z","uniqueUsers":134},{"key":"2022-02-23T22:22:22Z","uniqueUsers":90}]}}}
1995
+ * @example {"aggs":{"dailyUniqueUsers":{"values":[{"$count":321,"$key":"2022-02-22T22:22:22Z","uniqueUsers":134},{"$count":202,"$key":"2022-02-23T22:22:22Z","uniqueUsers":90}]}}}
1963
1996
  */
1964
1997
  type AggResponse = {
1965
1998
  aggs?: {
1966
1999
  [key: string]: AggResponse$1;
1967
2000
  };
1968
2001
  };
1969
- type SearchResponse = {
1970
- records: XataRecord$1[];
1971
- warning?: string;
1972
- };
1973
- /**
1974
- * @x-go-type TxSuccess
1975
- */
1976
- type TransactionSuccess = {
1977
- /**
1978
- * An ordered array of results from the submitted operations that were executed
1979
- */
1980
- results: (TransactionResultInsert | TransactionResultUpdate | TransactionResultDelete)[];
1981
- };
1982
- /**
1983
- * @x-go-type TxFailure
1984
- */
1985
- type TransactionFailure = {
1986
- /**
1987
- * An array of errors from the submitted operations.
1988
- */
1989
- errors: TransactionError[];
1990
- };
1991
- type BadRequestError = {
1992
- id?: string;
1993
- message: string;
1994
- };
1995
- /**
1996
- * @example {"message":"invalid API key"}
1997
- */
1998
- type AuthError = {
1999
- id?: string;
2000
- message: string;
2001
- };
2002
2002
 
2003
2003
  type DataPlaneFetcherExtraProps = {
2004
2004
  apiUrl: string;
@@ -2092,6 +2092,9 @@ type CreateBranchError = ErrorWrapper<{
2092
2092
  } | {
2093
2093
  status: 404;
2094
2094
  payload: SimpleError;
2095
+ } | {
2096
+ status: 423;
2097
+ payload: SimpleError;
2095
2098
  }>;
2096
2099
  type CreateBranchResponse = {
2097
2100
  /**
@@ -2131,6 +2134,9 @@ type DeleteBranchError = ErrorWrapper<{
2131
2134
  } | {
2132
2135
  status: 404;
2133
2136
  payload: SimpleError;
2137
+ } | {
2138
+ status: 409;
2139
+ payload: SimpleError;
2134
2140
  }>;
2135
2141
  type DeleteBranchResponse = {
2136
2142
  status: MigrationStatus;
@@ -2504,32 +2510,6 @@ type ExecuteBranchMigrationPlanVariables = {
2504
2510
  * Apply a migration plan to the branch
2505
2511
  */
2506
2512
  declare const executeBranchMigrationPlan: (variables: ExecuteBranchMigrationPlanVariables, signal?: AbortSignal) => Promise<SchemaUpdateResponse>;
2507
- type BranchTransactionPathParams = {
2508
- /**
2509
- * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
2510
- */
2511
- dbBranchName: DBBranchName;
2512
- workspace: string;
2513
- region: string;
2514
- };
2515
- type BranchTransactionError = ErrorWrapper<{
2516
- status: 400;
2517
- payload: TransactionFailure;
2518
- } | {
2519
- status: 401;
2520
- payload: AuthError;
2521
- } | {
2522
- status: 404;
2523
- payload: SimpleError;
2524
- }>;
2525
- type BranchTransactionRequestBody = {
2526
- operations: TransactionOperation$1[];
2527
- };
2528
- type BranchTransactionVariables = {
2529
- body: BranchTransactionRequestBody;
2530
- pathParams: BranchTransactionPathParams;
2531
- } & DataPlaneFetcherExtraProps;
2532
- declare const branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal) => Promise<TransactionSuccess>;
2533
2513
  type QueryMigrationRequestsPathParams = {
2534
2514
  /**
2535
2515
  * The Database Name
@@ -3089,6 +3069,9 @@ type UpdateTableError = ErrorWrapper<{
3089
3069
  } | {
3090
3070
  status: 404;
3091
3071
  payload: SimpleError;
3072
+ } | {
3073
+ status: 422;
3074
+ payload: SimpleError;
3092
3075
  }>;
3093
3076
  type UpdateTableRequestBody = {
3094
3077
  /**
@@ -3347,6 +3330,32 @@ type DeleteColumnVariables = {
3347
3330
  * Deletes the specified column. To refer to sub-objects, the column name can contain dots. For example `address.country`.
3348
3331
  */
3349
3332
  declare const deleteColumn: (variables: DeleteColumnVariables, signal?: AbortSignal) => Promise<SchemaUpdateResponse>;
3333
+ type BranchTransactionPathParams = {
3334
+ /**
3335
+ * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
3336
+ */
3337
+ dbBranchName: DBBranchName;
3338
+ workspace: string;
3339
+ region: string;
3340
+ };
3341
+ type BranchTransactionError = ErrorWrapper<{
3342
+ status: 400;
3343
+ payload: TransactionFailure;
3344
+ } | {
3345
+ status: 401;
3346
+ payload: AuthError;
3347
+ } | {
3348
+ status: 404;
3349
+ payload: SimpleError;
3350
+ }>;
3351
+ type BranchTransactionRequestBody = {
3352
+ operations: TransactionOperation$1[];
3353
+ };
3354
+ type BranchTransactionVariables = {
3355
+ body: BranchTransactionRequestBody;
3356
+ pathParams: BranchTransactionPathParams;
3357
+ } & DataPlaneFetcherExtraProps;
3358
+ declare const branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal) => Promise<TransactionSuccess>;
3350
3359
  type InsertRecordPathParams = {
3351
3360
  /**
3352
3361
  * The DBBranchName matches the pattern `{db_name}:{branch_name}`.
@@ -4801,245 +4810,245 @@ declare function parseWorkspacesUrlParts(url: string): {
4801
4810
  region: string;
4802
4811
  } | null;
4803
4812
 
4813
+ type responses_AggResponse = AggResponse;
4804
4814
  type responses_AuthError = AuthError;
4805
4815
  type responses_BadRequestError = BadRequestError;
4806
- type responses_SimpleError = SimpleError;
4816
+ type responses_BranchMigrationPlan = BranchMigrationPlan;
4807
4817
  type responses_BulkError = BulkError;
4808
4818
  type responses_BulkInsertResponse = BulkInsertResponse;
4809
- type responses_BranchMigrationPlan = BranchMigrationPlan;
4819
+ type responses_QueryResponse = QueryResponse;
4810
4820
  type responses_RecordResponse = RecordResponse;
4811
- type responses_SchemaCompareResponse = SchemaCompareResponse;
4812
4821
  type responses_RecordUpdateResponse = RecordUpdateResponse;
4813
- type responses_QueryResponse = QueryResponse;
4822
+ type responses_SchemaCompareResponse = SchemaCompareResponse;
4814
4823
  type responses_SchemaUpdateResponse = SchemaUpdateResponse;
4815
- type responses_SummarizeResponse = SummarizeResponse;
4816
- type responses_AggResponse = AggResponse;
4817
4824
  type responses_SearchResponse = SearchResponse;
4818
- type responses_TransactionSuccess = TransactionSuccess;
4819
- type responses_TransactionFailure = TransactionFailure;
4825
+ type responses_SimpleError = SimpleError;
4826
+ type responses_SummarizeResponse = SummarizeResponse;
4820
4827
  declare namespace responses {
4821
4828
  export {
4829
+ responses_AggResponse as AggResponse,
4822
4830
  responses_AuthError as AuthError,
4823
4831
  responses_BadRequestError as BadRequestError,
4824
- responses_SimpleError as SimpleError,
4832
+ responses_BranchMigrationPlan as BranchMigrationPlan,
4825
4833
  responses_BulkError as BulkError,
4826
4834
  responses_BulkInsertResponse as BulkInsertResponse,
4827
- responses_BranchMigrationPlan as BranchMigrationPlan,
4835
+ responses_QueryResponse as QueryResponse,
4828
4836
  responses_RecordResponse as RecordResponse,
4829
- responses_SchemaCompareResponse as SchemaCompareResponse,
4830
4837
  responses_RecordUpdateResponse as RecordUpdateResponse,
4831
- responses_QueryResponse as QueryResponse,
4838
+ responses_SchemaCompareResponse as SchemaCompareResponse,
4832
4839
  responses_SchemaUpdateResponse as SchemaUpdateResponse,
4833
- responses_SummarizeResponse as SummarizeResponse,
4834
- responses_AggResponse as AggResponse,
4835
4840
  responses_SearchResponse as SearchResponse,
4836
- responses_TransactionSuccess as TransactionSuccess,
4837
- responses_TransactionFailure as TransactionFailure,
4841
+ responses_SimpleError as SimpleError,
4842
+ responses_SummarizeResponse as SummarizeResponse,
4838
4843
  };
4839
4844
  }
4840
4845
 
4846
+ type schemas_APIKeyName = APIKeyName;
4847
+ type schemas_AggExpression = AggExpression;
4848
+ type schemas_AggExpressionMap = AggExpressionMap;
4849
+ type schemas_AverageAgg = AverageAgg;
4850
+ type schemas_BoosterExpression = BoosterExpression;
4851
+ type schemas_Branch = Branch;
4841
4852
  type schemas_BranchMetadata = BranchMetadata;
4853
+ type schemas_BranchMigration = BranchMigration;
4842
4854
  type schemas_BranchName = BranchName;
4843
- type schemas_DBName = DBName;
4844
- type schemas_DateTime = DateTime;
4845
- type schemas_MigrationStatus = MigrationStatus;
4846
- type schemas_ListBranchesResponse = ListBranchesResponse;
4847
- type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
4848
- type schemas_Branch = Branch;
4849
- type schemas_DBBranch = DBBranch;
4850
- type schemas_StartedFromMetadata = StartedFromMetadata;
4851
- type schemas_Schema = Schema;
4852
- type schemas_SchemaEditScript = SchemaEditScript;
4853
- type schemas_Table = Table;
4854
4855
  type schemas_Column = Column;
4855
4856
  type schemas_ColumnLink = ColumnLink;
4856
- type schemas_RevLink = RevLink;
4857
- type schemas_DBBranchName = DBBranchName;
4858
- type schemas_TableName = TableName;
4859
- type schemas_ColumnName = ColumnName;
4860
- type schemas_MetricsDatapoint = MetricsDatapoint;
4861
- type schemas_MetricsLatency = MetricsLatency;
4862
- type schemas_BranchMigration = BranchMigration;
4863
- type schemas_TableMigration = TableMigration;
4864
4857
  type schemas_ColumnMigration = ColumnMigration;
4865
- type schemas_Commit = Commit;
4866
- type schemas_Migration = Migration;
4867
- type schemas_MigrationOp = MigrationOp;
4868
- type schemas_MigrationTableOp = MigrationTableOp;
4869
- type schemas_MigrationColumnOp = MigrationColumnOp;
4870
- type schemas_TableOpAdd = TableOpAdd;
4871
- type schemas_TableOpRemove = TableOpRemove;
4872
- type schemas_TableOpRename = TableOpRename;
4858
+ type schemas_ColumnName = ColumnName;
4873
4859
  type schemas_ColumnOpAdd = ColumnOpAdd;
4874
4860
  type schemas_ColumnOpRemove = ColumnOpRemove;
4875
4861
  type schemas_ColumnOpRename = ColumnOpRename;
4876
- type schemas_MigrationRequestNumber = MigrationRequestNumber;
4877
- type schemas_MigrationRequest = MigrationRequest;
4878
- type schemas_SortExpression = SortExpression;
4879
- type schemas_SortOrder = SortOrder;
4880
- type schemas_FuzzinessExpression = FuzzinessExpression;
4881
- type schemas_PrefixExpression = PrefixExpression;
4882
- type schemas_TargetExpression = TargetExpression;
4883
- type schemas_FilterExpression = FilterExpression;
4884
- type schemas_SummaryExpressionList = SummaryExpressionList;
4885
- type schemas_SummaryExpression = SummaryExpression;
4886
- type schemas_AggExpressionMap = AggExpressionMap;
4887
- type schemas_AggExpression = AggExpression;
4862
+ type schemas_ColumnsProjection = ColumnsProjection;
4863
+ type schemas_Commit = Commit;
4888
4864
  type schemas_CountAgg = CountAgg;
4889
- type schemas_SumAgg = SumAgg;
4890
- type schemas_MaxAgg = MaxAgg;
4891
- type schemas_MinAgg = MinAgg;
4892
- type schemas_AverageAgg = AverageAgg;
4893
- type schemas_UniqueCountAgg = UniqueCountAgg;
4865
+ type schemas_DBBranch = DBBranch;
4866
+ type schemas_DBBranchName = DBBranchName;
4867
+ type schemas_DBName = DBName;
4868
+ type schemas_DatabaseMetadata = DatabaseMetadata;
4894
4869
  type schemas_DateHistogramAgg = DateHistogramAgg;
4895
- type schemas_TopValuesAgg = TopValuesAgg;
4896
- type schemas_NumericHistogramAgg = NumericHistogramAgg;
4897
- type schemas_HighlightExpression = HighlightExpression;
4898
- type schemas_BoosterExpression = BoosterExpression;
4899
- type schemas_FilterList = FilterList;
4870
+ type schemas_DateTime = DateTime;
4900
4871
  type schemas_FilterColumn = FilterColumn;
4901
4872
  type schemas_FilterColumnIncludes = FilterColumnIncludes;
4873
+ type schemas_FilterExpression = FilterExpression;
4874
+ type schemas_FilterList = FilterList;
4902
4875
  type schemas_FilterPredicate = FilterPredicate;
4903
4876
  type schemas_FilterPredicateOp = FilterPredicateOp;
4904
4877
  type schemas_FilterPredicateRangeOp = FilterPredicateRangeOp;
4905
4878
  type schemas_FilterRangeValue = FilterRangeValue;
4906
4879
  type schemas_FilterValue = FilterValue;
4880
+ type schemas_FuzzinessExpression = FuzzinessExpression;
4881
+ type schemas_HighlightExpression = HighlightExpression;
4882
+ type schemas_InviteID = InviteID;
4883
+ type schemas_InviteKey = InviteKey;
4884
+ type schemas_ListBranchesResponse = ListBranchesResponse;
4885
+ type schemas_ListDatabasesResponse = ListDatabasesResponse;
4886
+ type schemas_ListGitBranchesResponse = ListGitBranchesResponse;
4887
+ type schemas_ListRegionsResponse = ListRegionsResponse;
4888
+ type schemas_MaxAgg = MaxAgg;
4889
+ type schemas_MetricsDatapoint = MetricsDatapoint;
4890
+ type schemas_MetricsLatency = MetricsLatency;
4891
+ type schemas_Migration = Migration;
4892
+ type schemas_MigrationColumnOp = MigrationColumnOp;
4893
+ type schemas_MigrationOp = MigrationOp;
4894
+ type schemas_MigrationRequest = MigrationRequest;
4895
+ type schemas_MigrationRequestNumber = MigrationRequestNumber;
4896
+ type schemas_MigrationStatus = MigrationStatus;
4897
+ type schemas_MigrationTableOp = MigrationTableOp;
4898
+ type schemas_MinAgg = MinAgg;
4899
+ type schemas_NumericHistogramAgg = NumericHistogramAgg;
4907
4900
  type schemas_PageConfig = PageConfig;
4908
- type schemas_SearchPageConfig = SearchPageConfig;
4909
- type schemas_ColumnsProjection = ColumnsProjection;
4910
- type schemas_RecordMeta = RecordMeta;
4901
+ type schemas_PrefixExpression = PrefixExpression;
4911
4902
  type schemas_RecordID = RecordID;
4912
- type schemas_TableRename = TableRename;
4903
+ type schemas_RecordMeta = RecordMeta;
4913
4904
  type schemas_RecordsMetadata = RecordsMetadata;
4914
- type schemas_TransactionInsertOp = TransactionInsertOp;
4915
- type schemas_TransactionUpdateOp = TransactionUpdateOp;
4905
+ type schemas_Region = Region;
4906
+ type schemas_RevLink = RevLink;
4907
+ type schemas_Role = Role;
4908
+ type schemas_Schema = Schema;
4909
+ type schemas_SchemaEditScript = SchemaEditScript;
4910
+ type schemas_SearchPageConfig = SearchPageConfig;
4911
+ type schemas_SortExpression = SortExpression;
4912
+ type schemas_SortOrder = SortOrder;
4913
+ type schemas_StartedFromMetadata = StartedFromMetadata;
4914
+ type schemas_SumAgg = SumAgg;
4915
+ type schemas_SummaryExpression = SummaryExpression;
4916
+ type schemas_SummaryExpressionList = SummaryExpressionList;
4917
+ type schemas_Table = Table;
4918
+ type schemas_TableMigration = TableMigration;
4919
+ type schemas_TableName = TableName;
4920
+ type schemas_TableOpAdd = TableOpAdd;
4921
+ type schemas_TableOpRemove = TableOpRemove;
4922
+ type schemas_TableOpRename = TableOpRename;
4923
+ type schemas_TableRename = TableRename;
4924
+ type schemas_TargetExpression = TargetExpression;
4925
+ type schemas_TopValuesAgg = TopValuesAgg;
4916
4926
  type schemas_TransactionDeleteOp = TransactionDeleteOp;
4927
+ type schemas_TransactionError = TransactionError;
4928
+ type schemas_TransactionFailure = TransactionFailure;
4929
+ type schemas_TransactionInsertOp = TransactionInsertOp;
4930
+ type schemas_TransactionResultDelete = TransactionResultDelete;
4917
4931
  type schemas_TransactionResultInsert = TransactionResultInsert;
4918
4932
  type schemas_TransactionResultUpdate = TransactionResultUpdate;
4919
- type schemas_TransactionResultDelete = TransactionResultDelete;
4920
- type schemas_TransactionError = TransactionError;
4933
+ type schemas_TransactionSuccess = TransactionSuccess;
4934
+ type schemas_TransactionUpdateOp = TransactionUpdateOp;
4935
+ type schemas_UniqueCountAgg = UniqueCountAgg;
4921
4936
  type schemas_User = User;
4922
4937
  type schemas_UserID = UserID;
4923
4938
  type schemas_UserWithID = UserWithID;
4924
- type schemas_APIKeyName = APIKeyName;
4925
- type schemas_WorkspaceID = WorkspaceID;
4926
- type schemas_Role = Role;
4927
- type schemas_WorkspaceMeta = WorkspaceMeta;
4928
4939
  type schemas_Workspace = Workspace;
4929
- type schemas_WorkspaceMember = WorkspaceMember;
4930
- type schemas_InviteID = InviteID;
4940
+ type schemas_WorkspaceID = WorkspaceID;
4931
4941
  type schemas_WorkspaceInvite = WorkspaceInvite;
4942
+ type schemas_WorkspaceMember = WorkspaceMember;
4932
4943
  type schemas_WorkspaceMembers = WorkspaceMembers;
4933
- type schemas_InviteKey = InviteKey;
4934
- type schemas_DatabaseMetadata = DatabaseMetadata;
4935
- type schemas_ListDatabasesResponse = ListDatabasesResponse;
4936
- type schemas_ListRegionsResponse = ListRegionsResponse;
4937
- type schemas_Region = Region;
4944
+ type schemas_WorkspaceMeta = WorkspaceMeta;
4938
4945
  declare namespace schemas {
4939
4946
  export {
4947
+ schemas_APIKeyName as APIKeyName,
4948
+ schemas_AggExpression as AggExpression,
4949
+ schemas_AggExpressionMap as AggExpressionMap,
4950
+ AggResponse$1 as AggResponse,
4951
+ schemas_AverageAgg as AverageAgg,
4952
+ schemas_BoosterExpression as BoosterExpression,
4953
+ schemas_Branch as Branch,
4940
4954
  schemas_BranchMetadata as BranchMetadata,
4955
+ schemas_BranchMigration as BranchMigration,
4941
4956
  schemas_BranchName as BranchName,
4942
- schemas_DBName as DBName,
4943
- schemas_DateTime as DateTime,
4944
- schemas_MigrationStatus as MigrationStatus,
4945
- schemas_ListBranchesResponse as ListBranchesResponse,
4946
- schemas_ListGitBranchesResponse as ListGitBranchesResponse,
4947
- schemas_Branch as Branch,
4948
- schemas_DBBranch as DBBranch,
4949
- schemas_StartedFromMetadata as StartedFromMetadata,
4950
- schemas_Schema as Schema,
4951
- schemas_SchemaEditScript as SchemaEditScript,
4952
- schemas_Table as Table,
4953
4957
  schemas_Column as Column,
4954
4958
  schemas_ColumnLink as ColumnLink,
4955
- schemas_RevLink as RevLink,
4956
- schemas_DBBranchName as DBBranchName,
4957
- schemas_TableName as TableName,
4958
- schemas_ColumnName as ColumnName,
4959
- schemas_MetricsDatapoint as MetricsDatapoint,
4960
- schemas_MetricsLatency as MetricsLatency,
4961
- schemas_BranchMigration as BranchMigration,
4962
- schemas_TableMigration as TableMigration,
4963
4959
  schemas_ColumnMigration as ColumnMigration,
4964
- schemas_Commit as Commit,
4965
- schemas_Migration as Migration,
4966
- schemas_MigrationOp as MigrationOp,
4967
- schemas_MigrationTableOp as MigrationTableOp,
4968
- schemas_MigrationColumnOp as MigrationColumnOp,
4969
- schemas_TableOpAdd as TableOpAdd,
4970
- schemas_TableOpRemove as TableOpRemove,
4971
- schemas_TableOpRename as TableOpRename,
4960
+ schemas_ColumnName as ColumnName,
4972
4961
  schemas_ColumnOpAdd as ColumnOpAdd,
4973
4962
  schemas_ColumnOpRemove as ColumnOpRemove,
4974
4963
  schemas_ColumnOpRename as ColumnOpRename,
4975
- schemas_MigrationRequestNumber as MigrationRequestNumber,
4976
- schemas_MigrationRequest as MigrationRequest,
4977
- schemas_SortExpression as SortExpression,
4978
- schemas_SortOrder as SortOrder,
4979
- schemas_FuzzinessExpression as FuzzinessExpression,
4980
- schemas_PrefixExpression as PrefixExpression,
4981
- schemas_TargetExpression as TargetExpression,
4982
- schemas_FilterExpression as FilterExpression,
4983
- schemas_SummaryExpressionList as SummaryExpressionList,
4984
- schemas_SummaryExpression as SummaryExpression,
4985
- schemas_AggExpressionMap as AggExpressionMap,
4986
- schemas_AggExpression as AggExpression,
4964
+ schemas_ColumnsProjection as ColumnsProjection,
4965
+ schemas_Commit as Commit,
4987
4966
  schemas_CountAgg as CountAgg,
4988
- schemas_SumAgg as SumAgg,
4989
- schemas_MaxAgg as MaxAgg,
4990
- schemas_MinAgg as MinAgg,
4991
- schemas_AverageAgg as AverageAgg,
4992
- schemas_UniqueCountAgg as UniqueCountAgg,
4993
- schemas_DateHistogramAgg as DateHistogramAgg,
4994
- schemas_TopValuesAgg as TopValuesAgg,
4995
- schemas_NumericHistogramAgg as NumericHistogramAgg,
4996
- schemas_HighlightExpression as HighlightExpression,
4997
- schemas_BoosterExpression as BoosterExpression,
4998
- ValueBooster$1 as ValueBooster,
4999
- NumericBooster$1 as NumericBooster,
4967
+ schemas_DBBranch as DBBranch,
4968
+ schemas_DBBranchName as DBBranchName,
4969
+ schemas_DBName as DBName,
4970
+ schemas_DatabaseMetadata as DatabaseMetadata,
5000
4971
  DateBooster$1 as DateBooster,
5001
- schemas_FilterList as FilterList,
4972
+ schemas_DateHistogramAgg as DateHistogramAgg,
4973
+ schemas_DateTime as DateTime,
5002
4974
  schemas_FilterColumn as FilterColumn,
5003
4975
  schemas_FilterColumnIncludes as FilterColumnIncludes,
4976
+ schemas_FilterExpression as FilterExpression,
4977
+ schemas_FilterList as FilterList,
5004
4978
  schemas_FilterPredicate as FilterPredicate,
5005
4979
  schemas_FilterPredicateOp as FilterPredicateOp,
5006
4980
  schemas_FilterPredicateRangeOp as FilterPredicateRangeOp,
5007
4981
  schemas_FilterRangeValue as FilterRangeValue,
5008
4982
  schemas_FilterValue as FilterValue,
4983
+ schemas_FuzzinessExpression as FuzzinessExpression,
4984
+ schemas_HighlightExpression as HighlightExpression,
4985
+ schemas_InviteID as InviteID,
4986
+ schemas_InviteKey as InviteKey,
4987
+ schemas_ListBranchesResponse as ListBranchesResponse,
4988
+ schemas_ListDatabasesResponse as ListDatabasesResponse,
4989
+ schemas_ListGitBranchesResponse as ListGitBranchesResponse,
4990
+ schemas_ListRegionsResponse as ListRegionsResponse,
4991
+ schemas_MaxAgg as MaxAgg,
4992
+ schemas_MetricsDatapoint as MetricsDatapoint,
4993
+ schemas_MetricsLatency as MetricsLatency,
4994
+ schemas_Migration as Migration,
4995
+ schemas_MigrationColumnOp as MigrationColumnOp,
4996
+ schemas_MigrationOp as MigrationOp,
4997
+ schemas_MigrationRequest as MigrationRequest,
4998
+ schemas_MigrationRequestNumber as MigrationRequestNumber,
4999
+ schemas_MigrationStatus as MigrationStatus,
5000
+ schemas_MigrationTableOp as MigrationTableOp,
5001
+ schemas_MinAgg as MinAgg,
5002
+ NumericBooster$1 as NumericBooster,
5003
+ schemas_NumericHistogramAgg as NumericHistogramAgg,
5009
5004
  schemas_PageConfig as PageConfig,
5010
- schemas_SearchPageConfig as SearchPageConfig,
5011
- schemas_ColumnsProjection as ColumnsProjection,
5012
- schemas_RecordMeta as RecordMeta,
5005
+ schemas_PrefixExpression as PrefixExpression,
5013
5006
  schemas_RecordID as RecordID,
5014
- schemas_TableRename as TableRename,
5007
+ schemas_RecordMeta as RecordMeta,
5015
5008
  schemas_RecordsMetadata as RecordsMetadata,
5016
- AggResponse$1 as AggResponse,
5017
- TransactionOperation$1 as TransactionOperation,
5018
- schemas_TransactionInsertOp as TransactionInsertOp,
5019
- schemas_TransactionUpdateOp as TransactionUpdateOp,
5009
+ schemas_Region as Region,
5010
+ schemas_RevLink as RevLink,
5011
+ schemas_Role as Role,
5012
+ schemas_Schema as Schema,
5013
+ schemas_SchemaEditScript as SchemaEditScript,
5014
+ schemas_SearchPageConfig as SearchPageConfig,
5015
+ schemas_SortExpression as SortExpression,
5016
+ schemas_SortOrder as SortOrder,
5017
+ schemas_StartedFromMetadata as StartedFromMetadata,
5018
+ schemas_SumAgg as SumAgg,
5019
+ schemas_SummaryExpression as SummaryExpression,
5020
+ schemas_SummaryExpressionList as SummaryExpressionList,
5021
+ schemas_Table as Table,
5022
+ schemas_TableMigration as TableMigration,
5023
+ schemas_TableName as TableName,
5024
+ schemas_TableOpAdd as TableOpAdd,
5025
+ schemas_TableOpRemove as TableOpRemove,
5026
+ schemas_TableOpRename as TableOpRename,
5027
+ schemas_TableRename as TableRename,
5028
+ schemas_TargetExpression as TargetExpression,
5029
+ schemas_TopValuesAgg as TopValuesAgg,
5020
5030
  schemas_TransactionDeleteOp as TransactionDeleteOp,
5031
+ schemas_TransactionError as TransactionError,
5032
+ schemas_TransactionFailure as TransactionFailure,
5033
+ schemas_TransactionInsertOp as TransactionInsertOp,
5034
+ TransactionOperation$1 as TransactionOperation,
5035
+ schemas_TransactionResultDelete as TransactionResultDelete,
5021
5036
  schemas_TransactionResultInsert as TransactionResultInsert,
5022
5037
  schemas_TransactionResultUpdate as TransactionResultUpdate,
5023
- schemas_TransactionResultDelete as TransactionResultDelete,
5024
- schemas_TransactionError as TransactionError,
5025
- XataRecord$1 as XataRecord,
5038
+ schemas_TransactionSuccess as TransactionSuccess,
5039
+ schemas_TransactionUpdateOp as TransactionUpdateOp,
5040
+ schemas_UniqueCountAgg as UniqueCountAgg,
5026
5041
  schemas_User as User,
5027
5042
  schemas_UserID as UserID,
5028
5043
  schemas_UserWithID as UserWithID,
5029
- schemas_APIKeyName as APIKeyName,
5030
- schemas_WorkspaceID as WorkspaceID,
5031
- schemas_Role as Role,
5032
- schemas_WorkspaceMeta as WorkspaceMeta,
5044
+ ValueBooster$1 as ValueBooster,
5033
5045
  schemas_Workspace as Workspace,
5034
- schemas_WorkspaceMember as WorkspaceMember,
5035
- schemas_InviteID as InviteID,
5046
+ schemas_WorkspaceID as WorkspaceID,
5036
5047
  schemas_WorkspaceInvite as WorkspaceInvite,
5048
+ schemas_WorkspaceMember as WorkspaceMember,
5037
5049
  schemas_WorkspaceMembers as WorkspaceMembers,
5038
- schemas_InviteKey as InviteKey,
5039
- schemas_DatabaseMetadata as DatabaseMetadata,
5040
- schemas_ListDatabasesResponse as ListDatabasesResponse,
5041
- schemas_ListRegionsResponse as ListRegionsResponse,
5042
- schemas_Region as Region,
5050
+ schemas_WorkspaceMeta as WorkspaceMeta,
5051
+ XataRecord$1 as XataRecord,
5043
5052
  };
5044
5053
  }
5045
5054
 
@@ -5663,7 +5672,7 @@ type SelectedPick<O extends XataRecord, Key extends SelectableColumn<O>[]> = Xat
5663
5672
  type ValueAtColumn<O, P extends SelectableColumn<O>> = P extends '*' ? Values<O> : P extends 'id' ? string : P extends keyof O ? O[P] : P extends `${infer K}.${infer V}` ? K extends keyof O ? Values<NonNullable<O[K]> extends infer Item ? Item extends Record<string, any> ? V extends SelectableColumn<Item> ? {
5664
5673
  V: ValueAtColumn<Item, V>;
5665
5674
  } : never : O[K] : never> : never : never;
5666
- type MAX_RECURSION = 5;
5675
+ type MAX_RECURSION = 2;
5667
5676
  type NestedColumns<O, RecursivePath extends any[]> = RecursivePath['length'] extends MAX_RECURSION ? never : If<IsObject<O>, Values<{
5668
5677
  [K in DataProps<O>]: NonNullable<O[K]> extends infer Item ? If<IsArray<Item>, K, // If the property is an array, we stop recursion. We don't support object arrays yet
5669
5678
  If<IsObject<Item>, Item extends XataRecord ? SelectableColumn<Item, [...RecursivePath, Item]> extends infer Column ? Column extends string ? K | `${K}.${Column}` : never : never : Item extends Date ? K : `${K}.${StringKeys<Item> | '*'}`, // This allows usage of objects that are not links
@@ -5699,6 +5708,14 @@ interface XataRecord<OriginalRecord extends XataRecord<any> = XataRecord<any>> e
5699
5708
  * Get metadata of this record.
5700
5709
  */
5701
5710
  getMetadata(): XataRecordMetadata;
5711
+ /**
5712
+ * Get an object representation of this record.
5713
+ */
5714
+ toSerializable(): JSONData<OriginalRecord>;
5715
+ /**
5716
+ * Get a string representation of this record.
5717
+ */
5718
+ toString(): string;
5702
5719
  /**
5703
5720
  * Retrieves a refreshed copy of the current record from the database.
5704
5721
  * @param columns The columns to retrieve. If not specified, all first level properties are retrieved.
@@ -5779,6 +5796,10 @@ type EditableDataFields<T> = T extends XataRecord ? {
5779
5796
  type EditableData<O extends XataRecord> = Identifiable & Partial<Omit<{
5780
5797
  [K in keyof O]: EditableDataFields<O[K]>;
5781
5798
  }, keyof XataRecord>>;
5799
+ type JSONDataFields<T> = T extends XataRecord ? string : NonNullable<T> extends XataRecord ? string | null | undefined : T extends Date ? string : NonNullable<T> extends Date ? string | null | undefined : T;
5800
+ type JSONData<O> = Identifiable & Partial<Omit<{
5801
+ [K in keyof O]: JSONDataFields<O[K]>;
5802
+ }, keyof XataRecord>>;
5782
5803
 
5783
5804
  /**
5784
5805
  * PropertyMatchFilter
@@ -6579,6 +6600,8 @@ declare class RecordArray<Result extends XataRecord> extends Array<Result> {
6579
6600
  constructor(page: Paginable<any, Result>, overrideRecords?: Result[]);
6580
6601
  static parseConstructorParams(...args: any[]): any[];
6581
6602
  toArray(): Result[];
6603
+ toSerializable(): JSONData<Result>[];
6604
+ toString(): string;
6582
6605
  map<U>(callbackfn: (value: Result, index: number, array: Result[]) => U, thisArg?: any): U[];
6583
6606
  /**
6584
6607
  * Retrieve next page of records