@xata.io/client 0.18.5 → 0.19.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/CHANGELOG.md +30 -0
- package/README.md +5 -5
- package/dist/index.cjs +1152 -559
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3326 -1848
- package/dist/index.mjs +1141 -560
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -38,6 +38,9 @@ function isString(value) {
|
|
38
38
|
function isStringArray(value) {
|
39
39
|
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
40
40
|
}
|
41
|
+
function isNumber(value) {
|
42
|
+
return isDefined(value) && typeof value === "number";
|
43
|
+
}
|
41
44
|
function toBase64(value) {
|
42
45
|
try {
|
43
46
|
return btoa(value);
|
@@ -46,6 +49,17 @@ function toBase64(value) {
|
|
46
49
|
return buf.from(value).toString("base64");
|
47
50
|
}
|
48
51
|
}
|
52
|
+
function deepMerge(a, b) {
|
53
|
+
const result = { ...a };
|
54
|
+
for (const [key, value] of Object.entries(b)) {
|
55
|
+
if (isObject(value) && isObject(result[key])) {
|
56
|
+
result[key] = deepMerge(result[key], value);
|
57
|
+
} else {
|
58
|
+
result[key] = value;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return result;
|
62
|
+
}
|
49
63
|
|
50
64
|
function getEnvironment() {
|
51
65
|
try {
|
@@ -150,7 +164,7 @@ function getFetchImplementation(userFetch) {
|
|
150
164
|
return fetchImpl;
|
151
165
|
}
|
152
166
|
|
153
|
-
const VERSION = "0.
|
167
|
+
const VERSION = "0.19.0";
|
154
168
|
|
155
169
|
class ErrorWithCause extends Error {
|
156
170
|
constructor(message, options) {
|
@@ -207,15 +221,18 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
207
221
|
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
208
222
|
};
|
209
223
|
function buildBaseUrl({
|
224
|
+
endpoint,
|
210
225
|
path,
|
211
226
|
workspacesApiUrl,
|
212
227
|
apiUrl,
|
213
|
-
pathParams
|
228
|
+
pathParams = {}
|
214
229
|
}) {
|
215
|
-
if (
|
216
|
-
|
217
|
-
|
218
|
-
|
230
|
+
if (endpoint === "dataPlane") {
|
231
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
232
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
233
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
234
|
+
}
|
235
|
+
return `${apiUrl}${path}`;
|
219
236
|
}
|
220
237
|
function hostHeader(url) {
|
221
238
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -231,15 +248,18 @@ async function fetch$1({
|
|
231
248
|
queryParams,
|
232
249
|
fetchImpl,
|
233
250
|
apiKey,
|
251
|
+
endpoint,
|
234
252
|
apiUrl,
|
235
253
|
workspacesApiUrl,
|
236
254
|
trace,
|
237
|
-
signal
|
255
|
+
signal,
|
256
|
+
clientID,
|
257
|
+
sessionID
|
238
258
|
}) {
|
239
259
|
return trace(
|
240
260
|
`${method.toUpperCase()} ${path}`,
|
241
261
|
async ({ setAttributes }) => {
|
242
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
262
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
243
263
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
244
264
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
245
265
|
setAttributes({
|
@@ -252,6 +272,8 @@ async function fetch$1({
|
|
252
272
|
headers: {
|
253
273
|
"Content-Type": "application/json",
|
254
274
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
275
|
+
"X-Xata-Client-ID": clientID ?? "",
|
276
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
255
277
|
...headers,
|
256
278
|
...hostHeader(fullUrl),
|
257
279
|
Authorization: `Bearer ${apiKey}`
|
@@ -292,384 +314,359 @@ function parseUrl(url) {
|
|
292
314
|
}
|
293
315
|
}
|
294
316
|
|
295
|
-
const
|
296
|
-
|
297
|
-
|
298
|
-
|
299
|
-
...variables,
|
300
|
-
signal
|
301
|
-
});
|
302
|
-
const deleteUser = (variables, signal) => fetch$1({ url: "/user", method: "delete", ...variables, signal });
|
303
|
-
const getUserAPIKeys = (variables, signal) => fetch$1({
|
304
|
-
url: "/user/keys",
|
317
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
318
|
+
|
319
|
+
const getDatabaseList = (variables, signal) => dataPlaneFetch({
|
320
|
+
url: "/dbs",
|
305
321
|
method: "get",
|
306
322
|
...variables,
|
307
323
|
signal
|
308
324
|
});
|
309
|
-
const
|
310
|
-
url: "/
|
311
|
-
method: "
|
325
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
326
|
+
url: "/dbs/{dbName}",
|
327
|
+
method: "get",
|
312
328
|
...variables,
|
313
329
|
signal
|
314
330
|
});
|
315
|
-
const
|
316
|
-
|
331
|
+
const createDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
332
|
+
const deleteDatabase = (variables, signal) => dataPlaneFetch({
|
333
|
+
url: "/dbs/{dbName}",
|
317
334
|
method: "delete",
|
318
335
|
...variables,
|
319
336
|
signal
|
320
337
|
});
|
321
|
-
const
|
322
|
-
url: "/
|
323
|
-
method: "post",
|
324
|
-
...variables,
|
325
|
-
signal
|
326
|
-
});
|
327
|
-
const getWorkspacesList = (variables, signal) => fetch$1({
|
328
|
-
url: "/workspaces",
|
329
|
-
method: "get",
|
330
|
-
...variables,
|
331
|
-
signal
|
332
|
-
});
|
333
|
-
const getWorkspace = (variables, signal) => fetch$1({
|
334
|
-
url: "/workspaces/{workspaceId}",
|
338
|
+
const getDatabaseMetadata = (variables, signal) => dataPlaneFetch({
|
339
|
+
url: "/dbs/{dbName}/metadata",
|
335
340
|
method: "get",
|
336
341
|
...variables,
|
337
342
|
signal
|
338
343
|
});
|
339
|
-
const
|
340
|
-
|
341
|
-
|
342
|
-
...variables,
|
343
|
-
signal
|
344
|
-
});
|
345
|
-
const deleteWorkspace = (variables, signal) => fetch$1({
|
346
|
-
url: "/workspaces/{workspaceId}",
|
347
|
-
method: "delete",
|
348
|
-
...variables,
|
349
|
-
signal
|
350
|
-
});
|
351
|
-
const getWorkspaceMembersList = (variables, signal) => fetch$1({
|
352
|
-
url: "/workspaces/{workspaceId}/members",
|
344
|
+
const updateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
345
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
346
|
+
url: "/db/{dbBranchName}",
|
353
347
|
method: "get",
|
354
348
|
...variables,
|
355
349
|
signal
|
356
350
|
});
|
357
|
-
const
|
358
|
-
const
|
359
|
-
url: "/
|
351
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
352
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
353
|
+
url: "/db/{dbBranchName}",
|
360
354
|
method: "delete",
|
361
355
|
...variables,
|
362
356
|
signal
|
363
357
|
});
|
364
|
-
const
|
365
|
-
|
366
|
-
|
367
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
368
|
-
method: "delete",
|
358
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
359
|
+
url: "/db/{dbBranchName}/metadata",
|
360
|
+
method: "put",
|
369
361
|
...variables,
|
370
362
|
signal
|
371
363
|
});
|
372
|
-
const
|
373
|
-
url: "/
|
374
|
-
method: "
|
364
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
365
|
+
url: "/db/{dbBranchName}/metadata",
|
366
|
+
method: "get",
|
375
367
|
...variables,
|
376
368
|
signal
|
377
369
|
});
|
378
|
-
const
|
379
|
-
url: "/
|
380
|
-
method: "
|
370
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
371
|
+
url: "/db/{dbBranchName}/stats",
|
372
|
+
method: "get",
|
381
373
|
...variables,
|
382
374
|
signal
|
383
375
|
});
|
384
|
-
const
|
385
|
-
|
376
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
377
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
378
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
379
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
380
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
381
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
382
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
383
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
384
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
385
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
386
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
386
387
|
method: "get",
|
387
388
|
...variables,
|
388
389
|
signal
|
389
390
|
});
|
390
|
-
const
|
391
|
-
|
392
|
-
|
391
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
392
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
393
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
394
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
395
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
396
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
397
|
+
method: "post",
|
393
398
|
...variables,
|
394
399
|
signal
|
395
400
|
});
|
396
|
-
const
|
397
|
-
|
401
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
402
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
403
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
404
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
405
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
406
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
407
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
408
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
398
409
|
method: "put",
|
399
410
|
...variables,
|
400
411
|
signal
|
401
412
|
});
|
402
|
-
const
|
403
|
-
url: "/
|
413
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
414
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
404
415
|
method: "delete",
|
405
416
|
...variables,
|
406
417
|
signal
|
407
418
|
});
|
408
|
-
const
|
409
|
-
|
419
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
420
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
421
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
410
422
|
method: "get",
|
411
423
|
...variables,
|
412
424
|
signal
|
413
425
|
});
|
414
|
-
const
|
415
|
-
const
|
416
|
-
|
417
|
-
const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
418
|
-
const resolveBranch = (variables, signal) => fetch$1({
|
419
|
-
url: "/dbs/{dbName}/resolveBranch",
|
426
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
427
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
428
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
420
429
|
method: "get",
|
421
430
|
...variables,
|
422
431
|
signal
|
423
432
|
});
|
424
|
-
const
|
425
|
-
|
426
|
-
|
427
|
-
|
433
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
434
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
435
|
+
);
|
436
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
437
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
428
438
|
method: "get",
|
429
439
|
...variables,
|
430
440
|
signal
|
431
441
|
});
|
432
|
-
const
|
433
|
-
const
|
434
|
-
|
435
|
-
|
436
|
-
const mergeMigrationRequest = (variables, signal) => fetch$1({
|
437
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
438
|
-
method: "post",
|
442
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
443
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
444
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
445
|
+
method: "delete",
|
439
446
|
...variables,
|
440
447
|
signal
|
441
448
|
});
|
442
|
-
const
|
443
|
-
|
449
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
450
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
451
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
444
452
|
method: "get",
|
445
453
|
...variables,
|
446
454
|
signal
|
447
455
|
});
|
448
|
-
const
|
449
|
-
const
|
450
|
-
|
451
|
-
|
452
|
-
|
453
|
-
|
454
|
-
}
|
455
|
-
|
456
|
-
url: "/db/{dbBranchName}/metadata",
|
457
|
-
method: "put",
|
456
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
457
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
458
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
459
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
460
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
461
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
462
|
+
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
463
|
+
method: "post",
|
458
464
|
...variables,
|
459
465
|
signal
|
460
466
|
});
|
461
|
-
const
|
462
|
-
url: "/db/{dbBranchName}/
|
463
|
-
method: "
|
467
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
468
|
+
url: "/db/{dbBranchName}/search",
|
469
|
+
method: "post",
|
464
470
|
...variables,
|
465
471
|
signal
|
466
472
|
});
|
467
|
-
const
|
468
|
-
|
469
|
-
const getBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
470
|
-
const compareBranchWithUserSchema = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
471
|
-
const compareBranchSchemas = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
472
|
-
const updateBranchSchema = (variables, signal) => fetch$1({
|
473
|
-
url: "/db/{dbBranchName}/schema/update",
|
473
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
474
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
474
475
|
method: "post",
|
475
476
|
...variables,
|
476
477
|
signal
|
477
478
|
});
|
478
|
-
const
|
479
|
-
const
|
480
|
-
const
|
481
|
-
|
482
|
-
|
479
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
480
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
481
|
+
const operationsByTag$2 = {
|
482
|
+
database: { getDatabaseList, createDatabase, deleteDatabase, getDatabaseMetadata, updateDatabaseMetadata },
|
483
|
+
branch: {
|
484
|
+
getBranchList,
|
485
|
+
getBranchDetails,
|
486
|
+
createBranch,
|
487
|
+
deleteBranch,
|
488
|
+
updateBranchMetadata,
|
489
|
+
getBranchMetadata,
|
490
|
+
getBranchStats,
|
491
|
+
getGitBranchesMapping,
|
492
|
+
addGitBranchesEntry,
|
493
|
+
removeGitBranchesEntry,
|
494
|
+
resolveBranch
|
495
|
+
},
|
496
|
+
migrations: {
|
497
|
+
getBranchMigrationHistory,
|
498
|
+
getBranchMigrationPlan,
|
499
|
+
executeBranchMigrationPlan,
|
500
|
+
getBranchSchemaHistory,
|
501
|
+
compareBranchWithUserSchema,
|
502
|
+
compareBranchSchemas,
|
503
|
+
updateBranchSchema,
|
504
|
+
previewBranchSchemaEdit,
|
505
|
+
applyBranchSchemaEdit
|
506
|
+
},
|
507
|
+
migrationRequests: {
|
508
|
+
queryMigrationRequests,
|
509
|
+
createMigrationRequest,
|
510
|
+
getMigrationRequest,
|
511
|
+
updateMigrationRequest,
|
512
|
+
listMigrationRequestsCommits,
|
513
|
+
compareMigrationRequest,
|
514
|
+
getMigrationRequestIsMerged,
|
515
|
+
mergeMigrationRequest
|
516
|
+
},
|
517
|
+
table: {
|
518
|
+
createTable,
|
519
|
+
deleteTable,
|
520
|
+
updateTable,
|
521
|
+
getTableSchema,
|
522
|
+
setTableSchema,
|
523
|
+
getTableColumns,
|
524
|
+
addTableColumn,
|
525
|
+
getColumn,
|
526
|
+
updateColumn,
|
527
|
+
deleteColumn
|
528
|
+
},
|
529
|
+
records: {
|
530
|
+
insertRecord,
|
531
|
+
getRecord,
|
532
|
+
insertRecordWithID,
|
533
|
+
updateRecordWithID,
|
534
|
+
upsertRecordWithID,
|
535
|
+
deleteRecord,
|
536
|
+
bulkInsertTableRecords
|
537
|
+
},
|
538
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
539
|
+
};
|
540
|
+
|
541
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
542
|
+
|
543
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
544
|
+
url: "/user",
|
483
545
|
method: "get",
|
484
546
|
...variables,
|
485
547
|
signal
|
486
548
|
});
|
487
|
-
const
|
488
|
-
url: "/
|
549
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
550
|
+
url: "/user",
|
489
551
|
method: "put",
|
490
552
|
...variables,
|
491
553
|
signal
|
492
554
|
});
|
493
|
-
const
|
494
|
-
url: "/
|
555
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
556
|
+
url: "/user",
|
495
557
|
method: "delete",
|
496
558
|
...variables,
|
497
559
|
signal
|
498
560
|
});
|
499
|
-
const
|
500
|
-
url: "/
|
501
|
-
method: "
|
561
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
562
|
+
url: "/user/keys",
|
563
|
+
method: "get",
|
502
564
|
...variables,
|
503
565
|
signal
|
504
566
|
});
|
505
|
-
const
|
506
|
-
url: "/
|
507
|
-
method: "
|
567
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
568
|
+
url: "/user/keys/{keyName}",
|
569
|
+
method: "post",
|
508
570
|
...variables,
|
509
571
|
signal
|
510
572
|
});
|
511
|
-
const
|
512
|
-
url: "/
|
513
|
-
method: "
|
573
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
574
|
+
url: "/user/keys/{keyName}",
|
575
|
+
method: "delete",
|
514
576
|
...variables,
|
515
577
|
signal
|
516
578
|
});
|
517
|
-
const
|
518
|
-
url: "/
|
579
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
580
|
+
url: "/workspaces",
|
519
581
|
method: "get",
|
520
582
|
...variables,
|
521
583
|
signal
|
522
584
|
});
|
523
|
-
const
|
524
|
-
url: "/
|
585
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
586
|
+
url: "/workspaces",
|
525
587
|
method: "post",
|
526
588
|
...variables,
|
527
589
|
signal
|
528
590
|
});
|
529
|
-
const
|
530
|
-
url: "/
|
591
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
592
|
+
url: "/workspaces/{workspaceId}",
|
531
593
|
method: "get",
|
532
594
|
...variables,
|
533
595
|
signal
|
534
596
|
});
|
535
|
-
const
|
536
|
-
url: "/
|
537
|
-
method: "
|
538
|
-
...variables,
|
539
|
-
signal
|
540
|
-
});
|
541
|
-
const updateColumn = (variables, signal) => fetch$1({
|
542
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
543
|
-
method: "patch",
|
597
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
598
|
+
url: "/workspaces/{workspaceId}",
|
599
|
+
method: "put",
|
544
600
|
...variables,
|
545
601
|
signal
|
546
602
|
});
|
547
|
-
const
|
548
|
-
|
549
|
-
const updateRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
550
|
-
const upsertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
551
|
-
const deleteRecord = (variables, signal) => fetch$1({
|
552
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
603
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
604
|
+
url: "/workspaces/{workspaceId}",
|
553
605
|
method: "delete",
|
554
606
|
...variables,
|
555
607
|
signal
|
556
608
|
});
|
557
|
-
const
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
});
|
563
|
-
const bulkInsertTableRecords = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
564
|
-
const queryTable = (variables, signal) => fetch$1({
|
565
|
-
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
566
|
-
method: "post",
|
567
|
-
...variables,
|
568
|
-
signal
|
569
|
-
});
|
570
|
-
const searchTable = (variables, signal) => fetch$1({
|
571
|
-
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
572
|
-
method: "post",
|
609
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
610
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
611
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
612
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
613
|
+
method: "delete",
|
573
614
|
...variables,
|
574
615
|
signal
|
575
616
|
});
|
576
|
-
const
|
577
|
-
|
578
|
-
|
617
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
618
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
619
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
620
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
621
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
622
|
+
const cPGetDatabaseList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs", method: "get", ...variables, signal });
|
623
|
+
const cPCreateDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
624
|
+
const cPDeleteDatabase = (variables, signal) => controlPlaneFetch({
|
625
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
626
|
+
method: "delete",
|
579
627
|
...variables,
|
580
628
|
signal
|
581
629
|
});
|
582
|
-
const
|
583
|
-
|
584
|
-
|
630
|
+
const cPGetCPDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
631
|
+
const cPUpdateCPDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
632
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
633
|
+
url: "/workspaces/{workspaceId}/regions",
|
634
|
+
method: "get",
|
585
635
|
...variables,
|
586
636
|
signal
|
587
637
|
});
|
588
|
-
const operationsByTag = {
|
589
|
-
users: { getUser, updateUser, deleteUser
|
638
|
+
const operationsByTag$1 = {
|
639
|
+
users: { getUser, updateUser, deleteUser },
|
640
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
590
641
|
workspaces: {
|
591
|
-
createWorkspace,
|
592
642
|
getWorkspacesList,
|
643
|
+
createWorkspace,
|
593
644
|
getWorkspace,
|
594
645
|
updateWorkspace,
|
595
646
|
deleteWorkspace,
|
596
647
|
getWorkspaceMembersList,
|
597
648
|
updateWorkspaceMemberRole,
|
598
|
-
removeWorkspaceMember
|
649
|
+
removeWorkspaceMember
|
650
|
+
},
|
651
|
+
invites: {
|
599
652
|
inviteWorkspaceMember,
|
600
653
|
updateWorkspaceMemberInvite,
|
601
654
|
cancelWorkspaceMemberInvite,
|
602
|
-
|
603
|
-
|
604
|
-
},
|
605
|
-
database: {
|
606
|
-
getDatabaseList,
|
607
|
-
createDatabase,
|
608
|
-
deleteDatabase,
|
609
|
-
getDatabaseMetadata,
|
610
|
-
updateDatabaseMetadata,
|
611
|
-
getGitBranchesMapping,
|
612
|
-
addGitBranchesEntry,
|
613
|
-
removeGitBranchesEntry,
|
614
|
-
resolveBranch
|
615
|
-
},
|
616
|
-
branch: {
|
617
|
-
getBranchList,
|
618
|
-
getBranchDetails,
|
619
|
-
createBranch,
|
620
|
-
deleteBranch,
|
621
|
-
updateBranchMetadata,
|
622
|
-
getBranchMetadata,
|
623
|
-
getBranchStats
|
624
|
-
},
|
625
|
-
migrationRequests: {
|
626
|
-
queryMigrationRequests,
|
627
|
-
createMigrationRequest,
|
628
|
-
getMigrationRequest,
|
629
|
-
updateMigrationRequest,
|
630
|
-
listMigrationRequestsCommits,
|
631
|
-
compareMigrationRequest,
|
632
|
-
getMigrationRequestIsMerged,
|
633
|
-
mergeMigrationRequest
|
634
|
-
},
|
635
|
-
branchSchema: {
|
636
|
-
getBranchMigrationHistory,
|
637
|
-
executeBranchMigrationPlan,
|
638
|
-
getBranchMigrationPlan,
|
639
|
-
compareBranchWithUserSchema,
|
640
|
-
compareBranchSchemas,
|
641
|
-
updateBranchSchema,
|
642
|
-
previewBranchSchemaEdit,
|
643
|
-
applyBranchSchemaEdit,
|
644
|
-
getBranchSchemaHistory
|
655
|
+
acceptWorkspaceMemberInvite,
|
656
|
+
resendWorkspaceMemberInvite
|
645
657
|
},
|
646
|
-
|
647
|
-
|
648
|
-
|
649
|
-
|
650
|
-
|
651
|
-
|
652
|
-
|
653
|
-
addTableColumn,
|
654
|
-
getColumn,
|
655
|
-
deleteColumn,
|
656
|
-
updateColumn
|
657
|
-
},
|
658
|
-
records: {
|
659
|
-
insertRecord,
|
660
|
-
insertRecordWithID,
|
661
|
-
updateRecordWithID,
|
662
|
-
upsertRecordWithID,
|
663
|
-
deleteRecord,
|
664
|
-
getRecord,
|
665
|
-
bulkInsertTableRecords,
|
666
|
-
queryTable,
|
667
|
-
searchTable,
|
668
|
-
searchBranch,
|
669
|
-
summarizeTable
|
658
|
+
databases: {
|
659
|
+
cPGetDatabaseList,
|
660
|
+
cPCreateDatabase,
|
661
|
+
cPDeleteDatabase,
|
662
|
+
cPGetCPDatabaseMetadata,
|
663
|
+
cPUpdateCPDatabaseMetadata,
|
664
|
+
listRegions
|
670
665
|
}
|
671
666
|
};
|
672
667
|
|
668
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
669
|
+
|
673
670
|
function getHostUrl(provider, type) {
|
674
671
|
if (isHostProviderAlias(provider)) {
|
675
672
|
return providers[provider][type];
|
@@ -681,11 +678,11 @@ function getHostUrl(provider, type) {
|
|
681
678
|
const providers = {
|
682
679
|
production: {
|
683
680
|
main: "https://api.xata.io",
|
684
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
681
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
685
682
|
},
|
686
683
|
staging: {
|
687
684
|
main: "https://staging.xatabase.co",
|
688
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
685
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
689
686
|
}
|
690
687
|
};
|
691
688
|
function isHostProviderAlias(alias) {
|
@@ -694,6 +691,25 @@ function isHostProviderAlias(alias) {
|
|
694
691
|
function isHostProviderBuilder(builder) {
|
695
692
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
696
693
|
}
|
694
|
+
function parseProviderString(provider = "production") {
|
695
|
+
if (isHostProviderAlias(provider)) {
|
696
|
+
return provider;
|
697
|
+
}
|
698
|
+
const [main, workspaces] = provider.split(",");
|
699
|
+
if (!main || !workspaces)
|
700
|
+
return null;
|
701
|
+
return { main, workspaces };
|
702
|
+
}
|
703
|
+
function parseWorkspacesUrlParts(url) {
|
704
|
+
if (!isString(url))
|
705
|
+
return null;
|
706
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
707
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
708
|
+
const match = url.match(regex) || url.match(regexStaging);
|
709
|
+
if (!match)
|
710
|
+
return null;
|
711
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
712
|
+
}
|
697
713
|
|
698
714
|
var __accessCheck$7 = (obj, member, msg) => {
|
699
715
|
if (!member.has(obj))
|
@@ -737,21 +753,41 @@ class XataApiClient {
|
|
737
753
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
738
754
|
return __privateGet$7(this, _namespaces).user;
|
739
755
|
}
|
756
|
+
get authentication() {
|
757
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
758
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
759
|
+
return __privateGet$7(this, _namespaces).authentication;
|
760
|
+
}
|
740
761
|
get workspaces() {
|
741
762
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
742
763
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
743
764
|
return __privateGet$7(this, _namespaces).workspaces;
|
744
765
|
}
|
745
|
-
get
|
746
|
-
if (!__privateGet$7(this, _namespaces).
|
747
|
-
__privateGet$7(this, _namespaces).
|
748
|
-
return __privateGet$7(this, _namespaces).
|
766
|
+
get invites() {
|
767
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
768
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
769
|
+
return __privateGet$7(this, _namespaces).invites;
|
770
|
+
}
|
771
|
+
get database() {
|
772
|
+
if (!__privateGet$7(this, _namespaces).database)
|
773
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
774
|
+
return __privateGet$7(this, _namespaces).database;
|
749
775
|
}
|
750
776
|
get branches() {
|
751
777
|
if (!__privateGet$7(this, _namespaces).branches)
|
752
778
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
753
779
|
return __privateGet$7(this, _namespaces).branches;
|
754
780
|
}
|
781
|
+
get migrations() {
|
782
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
783
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
784
|
+
return __privateGet$7(this, _namespaces).migrations;
|
785
|
+
}
|
786
|
+
get migrationRequests() {
|
787
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
788
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
789
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
790
|
+
}
|
755
791
|
get tables() {
|
756
792
|
if (!__privateGet$7(this, _namespaces).tables)
|
757
793
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -762,15 +798,10 @@ class XataApiClient {
|
|
762
798
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
763
799
|
return __privateGet$7(this, _namespaces).records;
|
764
800
|
}
|
765
|
-
get
|
766
|
-
if (!__privateGet$7(this, _namespaces).
|
767
|
-
__privateGet$7(this, _namespaces).
|
768
|
-
return __privateGet$7(this, _namespaces).
|
769
|
-
}
|
770
|
-
get branchSchema() {
|
771
|
-
if (!__privateGet$7(this, _namespaces).branchSchema)
|
772
|
-
__privateGet$7(this, _namespaces).branchSchema = new BranchSchemaApi(__privateGet$7(this, _extraProps));
|
773
|
-
return __privateGet$7(this, _namespaces).branchSchema;
|
801
|
+
get searchAndFilter() {
|
802
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
803
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
804
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
774
805
|
}
|
775
806
|
}
|
776
807
|
_extraProps = new WeakMap();
|
@@ -782,24 +813,29 @@ class UserApi {
|
|
782
813
|
getUser() {
|
783
814
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
784
815
|
}
|
785
|
-
updateUser(user) {
|
816
|
+
updateUser({ user }) {
|
786
817
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
787
818
|
}
|
788
819
|
deleteUser() {
|
789
820
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
790
821
|
}
|
822
|
+
}
|
823
|
+
class AuthenticationApi {
|
824
|
+
constructor(extraProps) {
|
825
|
+
this.extraProps = extraProps;
|
826
|
+
}
|
791
827
|
getUserAPIKeys() {
|
792
|
-
return operationsByTag.
|
828
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
793
829
|
}
|
794
|
-
createUserAPIKey(
|
795
|
-
return operationsByTag.
|
796
|
-
pathParams: { keyName },
|
830
|
+
createUserAPIKey({ name }) {
|
831
|
+
return operationsByTag.authentication.createUserAPIKey({
|
832
|
+
pathParams: { keyName: name },
|
797
833
|
...this.extraProps
|
798
834
|
});
|
799
835
|
}
|
800
|
-
deleteUserAPIKey(
|
801
|
-
return operationsByTag.
|
802
|
-
pathParams: { keyName },
|
836
|
+
deleteUserAPIKey({ name }) {
|
837
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
838
|
+
pathParams: { keyName: name },
|
803
839
|
...this.extraProps
|
804
840
|
});
|
805
841
|
}
|
@@ -808,196 +844,248 @@ class WorkspaceApi {
|
|
808
844
|
constructor(extraProps) {
|
809
845
|
this.extraProps = extraProps;
|
810
846
|
}
|
811
|
-
|
847
|
+
getWorkspacesList() {
|
848
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
849
|
+
}
|
850
|
+
createWorkspace({ data }) {
|
812
851
|
return operationsByTag.workspaces.createWorkspace({
|
813
|
-
body:
|
852
|
+
body: data,
|
814
853
|
...this.extraProps
|
815
854
|
});
|
816
855
|
}
|
817
|
-
|
818
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
819
|
-
}
|
820
|
-
getWorkspace(workspaceId) {
|
856
|
+
getWorkspace({ workspace }) {
|
821
857
|
return operationsByTag.workspaces.getWorkspace({
|
822
|
-
pathParams: { workspaceId },
|
858
|
+
pathParams: { workspaceId: workspace },
|
823
859
|
...this.extraProps
|
824
860
|
});
|
825
861
|
}
|
826
|
-
updateWorkspace(
|
862
|
+
updateWorkspace({
|
863
|
+
workspace,
|
864
|
+
update
|
865
|
+
}) {
|
827
866
|
return operationsByTag.workspaces.updateWorkspace({
|
828
|
-
pathParams: { workspaceId },
|
829
|
-
body:
|
867
|
+
pathParams: { workspaceId: workspace },
|
868
|
+
body: update,
|
830
869
|
...this.extraProps
|
831
870
|
});
|
832
871
|
}
|
833
|
-
deleteWorkspace(
|
872
|
+
deleteWorkspace({ workspace }) {
|
834
873
|
return operationsByTag.workspaces.deleteWorkspace({
|
835
|
-
pathParams: { workspaceId },
|
874
|
+
pathParams: { workspaceId: workspace },
|
836
875
|
...this.extraProps
|
837
876
|
});
|
838
877
|
}
|
839
|
-
getWorkspaceMembersList(
|
878
|
+
getWorkspaceMembersList({ workspace }) {
|
840
879
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
841
|
-
pathParams: { workspaceId },
|
880
|
+
pathParams: { workspaceId: workspace },
|
842
881
|
...this.extraProps
|
843
882
|
});
|
844
883
|
}
|
845
|
-
updateWorkspaceMemberRole(
|
884
|
+
updateWorkspaceMemberRole({
|
885
|
+
workspace,
|
886
|
+
user,
|
887
|
+
role
|
888
|
+
}) {
|
846
889
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
847
|
-
pathParams: { workspaceId, userId },
|
890
|
+
pathParams: { workspaceId: workspace, userId: user },
|
848
891
|
body: { role },
|
849
892
|
...this.extraProps
|
850
893
|
});
|
851
894
|
}
|
852
|
-
removeWorkspaceMember(
|
895
|
+
removeWorkspaceMember({
|
896
|
+
workspace,
|
897
|
+
user
|
898
|
+
}) {
|
853
899
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
854
|
-
pathParams: { workspaceId, userId },
|
900
|
+
pathParams: { workspaceId: workspace, userId: user },
|
855
901
|
...this.extraProps
|
856
902
|
});
|
857
903
|
}
|
858
|
-
|
859
|
-
|
860
|
-
|
904
|
+
}
|
905
|
+
class InvitesApi {
|
906
|
+
constructor(extraProps) {
|
907
|
+
this.extraProps = extraProps;
|
908
|
+
}
|
909
|
+
inviteWorkspaceMember({
|
910
|
+
workspace,
|
911
|
+
email,
|
912
|
+
role
|
913
|
+
}) {
|
914
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
915
|
+
pathParams: { workspaceId: workspace },
|
861
916
|
body: { email, role },
|
862
917
|
...this.extraProps
|
863
918
|
});
|
864
919
|
}
|
865
|
-
updateWorkspaceMemberInvite(
|
866
|
-
|
867
|
-
|
920
|
+
updateWorkspaceMemberInvite({
|
921
|
+
workspace,
|
922
|
+
invite,
|
923
|
+
role
|
924
|
+
}) {
|
925
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
926
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
868
927
|
body: { role },
|
869
928
|
...this.extraProps
|
870
929
|
});
|
871
930
|
}
|
872
|
-
cancelWorkspaceMemberInvite(
|
873
|
-
|
874
|
-
|
931
|
+
cancelWorkspaceMemberInvite({
|
932
|
+
workspace,
|
933
|
+
invite
|
934
|
+
}) {
|
935
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
936
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
875
937
|
...this.extraProps
|
876
938
|
});
|
877
939
|
}
|
878
|
-
|
879
|
-
|
880
|
-
|
940
|
+
acceptWorkspaceMemberInvite({
|
941
|
+
workspace,
|
942
|
+
key
|
943
|
+
}) {
|
944
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
945
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
881
946
|
...this.extraProps
|
882
947
|
});
|
883
948
|
}
|
884
|
-
|
885
|
-
|
886
|
-
|
949
|
+
resendWorkspaceMemberInvite({
|
950
|
+
workspace,
|
951
|
+
invite
|
952
|
+
}) {
|
953
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
954
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
887
955
|
...this.extraProps
|
888
956
|
});
|
889
957
|
}
|
890
958
|
}
|
891
|
-
class
|
959
|
+
class BranchApi {
|
892
960
|
constructor(extraProps) {
|
893
961
|
this.extraProps = extraProps;
|
894
962
|
}
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
return operationsByTag.database.createDatabase({
|
903
|
-
pathParams: { workspace, dbName },
|
904
|
-
body: options,
|
905
|
-
...this.extraProps
|
906
|
-
});
|
907
|
-
}
|
908
|
-
deleteDatabase(workspace, dbName) {
|
909
|
-
return operationsByTag.database.deleteDatabase({
|
910
|
-
pathParams: { workspace, dbName },
|
911
|
-
...this.extraProps
|
912
|
-
});
|
913
|
-
}
|
914
|
-
getDatabaseMetadata(workspace, dbName) {
|
915
|
-
return operationsByTag.database.getDatabaseMetadata({
|
916
|
-
pathParams: { workspace, dbName },
|
917
|
-
...this.extraProps
|
918
|
-
});
|
919
|
-
}
|
920
|
-
updateDatabaseMetadata(workspace, dbName, options = {}) {
|
921
|
-
return operationsByTag.database.updateDatabaseMetadata({
|
922
|
-
pathParams: { workspace, dbName },
|
923
|
-
body: options,
|
924
|
-
...this.extraProps
|
925
|
-
});
|
926
|
-
}
|
927
|
-
getGitBranchesMapping(workspace, dbName) {
|
928
|
-
return operationsByTag.database.getGitBranchesMapping({
|
929
|
-
pathParams: { workspace, dbName },
|
963
|
+
getBranchList({
|
964
|
+
workspace,
|
965
|
+
region,
|
966
|
+
database
|
967
|
+
}) {
|
968
|
+
return operationsByTag.branch.getBranchList({
|
969
|
+
pathParams: { workspace, region, dbName: database },
|
930
970
|
...this.extraProps
|
931
971
|
});
|
932
972
|
}
|
933
|
-
|
934
|
-
|
935
|
-
|
936
|
-
|
973
|
+
getBranchDetails({
|
974
|
+
workspace,
|
975
|
+
region,
|
976
|
+
database,
|
977
|
+
branch
|
978
|
+
}) {
|
979
|
+
return operationsByTag.branch.getBranchDetails({
|
980
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
937
981
|
...this.extraProps
|
938
982
|
});
|
939
983
|
}
|
940
|
-
|
941
|
-
|
942
|
-
|
943
|
-
|
984
|
+
createBranch({
|
985
|
+
workspace,
|
986
|
+
region,
|
987
|
+
database,
|
988
|
+
branch,
|
989
|
+
from,
|
990
|
+
metadata
|
991
|
+
}) {
|
992
|
+
return operationsByTag.branch.createBranch({
|
993
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
994
|
+
body: { from, metadata },
|
944
995
|
...this.extraProps
|
945
996
|
});
|
946
997
|
}
|
947
|
-
|
948
|
-
|
949
|
-
|
950
|
-
|
998
|
+
deleteBranch({
|
999
|
+
workspace,
|
1000
|
+
region,
|
1001
|
+
database,
|
1002
|
+
branch
|
1003
|
+
}) {
|
1004
|
+
return operationsByTag.branch.deleteBranch({
|
1005
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
951
1006
|
...this.extraProps
|
952
1007
|
});
|
953
1008
|
}
|
954
|
-
|
955
|
-
|
956
|
-
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
1009
|
+
updateBranchMetadata({
|
1010
|
+
workspace,
|
1011
|
+
region,
|
1012
|
+
database,
|
1013
|
+
branch,
|
1014
|
+
metadata
|
1015
|
+
}) {
|
1016
|
+
return operationsByTag.branch.updateBranchMetadata({
|
1017
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1018
|
+
body: metadata,
|
962
1019
|
...this.extraProps
|
963
1020
|
});
|
964
1021
|
}
|
965
|
-
|
966
|
-
|
967
|
-
|
1022
|
+
getBranchMetadata({
|
1023
|
+
workspace,
|
1024
|
+
region,
|
1025
|
+
database,
|
1026
|
+
branch
|
1027
|
+
}) {
|
1028
|
+
return operationsByTag.branch.getBranchMetadata({
|
1029
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
968
1030
|
...this.extraProps
|
969
1031
|
});
|
970
1032
|
}
|
971
|
-
|
972
|
-
|
973
|
-
|
974
|
-
|
975
|
-
|
1033
|
+
getBranchStats({
|
1034
|
+
workspace,
|
1035
|
+
region,
|
1036
|
+
database,
|
1037
|
+
branch
|
1038
|
+
}) {
|
1039
|
+
return operationsByTag.branch.getBranchStats({
|
1040
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
976
1041
|
...this.extraProps
|
977
1042
|
});
|
978
1043
|
}
|
979
|
-
|
980
|
-
|
981
|
-
|
1044
|
+
getGitBranchesMapping({
|
1045
|
+
workspace,
|
1046
|
+
region,
|
1047
|
+
database
|
1048
|
+
}) {
|
1049
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1050
|
+
pathParams: { workspace, region, dbName: database },
|
982
1051
|
...this.extraProps
|
983
1052
|
});
|
984
1053
|
}
|
985
|
-
|
986
|
-
|
987
|
-
|
988
|
-
|
1054
|
+
addGitBranchesEntry({
|
1055
|
+
workspace,
|
1056
|
+
region,
|
1057
|
+
database,
|
1058
|
+
gitBranch,
|
1059
|
+
xataBranch
|
1060
|
+
}) {
|
1061
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1062
|
+
pathParams: { workspace, region, dbName: database },
|
1063
|
+
body: { gitBranch, xataBranch },
|
989
1064
|
...this.extraProps
|
990
1065
|
});
|
991
1066
|
}
|
992
|
-
|
993
|
-
|
994
|
-
|
1067
|
+
removeGitBranchesEntry({
|
1068
|
+
workspace,
|
1069
|
+
region,
|
1070
|
+
database,
|
1071
|
+
gitBranch
|
1072
|
+
}) {
|
1073
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1074
|
+
pathParams: { workspace, region, dbName: database },
|
1075
|
+
queryParams: { gitBranch },
|
995
1076
|
...this.extraProps
|
996
1077
|
});
|
997
1078
|
}
|
998
|
-
|
999
|
-
|
1000
|
-
|
1079
|
+
resolveBranch({
|
1080
|
+
workspace,
|
1081
|
+
region,
|
1082
|
+
database,
|
1083
|
+
gitBranch,
|
1084
|
+
fallbackBranch
|
1085
|
+
}) {
|
1086
|
+
return operationsByTag.branch.resolveBranch({
|
1087
|
+
pathParams: { workspace, region, dbName: database },
|
1088
|
+
queryParams: { gitBranch, fallbackBranch },
|
1001
1089
|
...this.extraProps
|
1002
1090
|
});
|
1003
1091
|
}
|
@@ -1006,67 +1094,134 @@ class TableApi {
|
|
1006
1094
|
constructor(extraProps) {
|
1007
1095
|
this.extraProps = extraProps;
|
1008
1096
|
}
|
1009
|
-
createTable(
|
1097
|
+
createTable({
|
1098
|
+
workspace,
|
1099
|
+
region,
|
1100
|
+
database,
|
1101
|
+
branch,
|
1102
|
+
table
|
1103
|
+
}) {
|
1010
1104
|
return operationsByTag.table.createTable({
|
1011
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1105
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1012
1106
|
...this.extraProps
|
1013
1107
|
});
|
1014
1108
|
}
|
1015
|
-
deleteTable(
|
1109
|
+
deleteTable({
|
1110
|
+
workspace,
|
1111
|
+
region,
|
1112
|
+
database,
|
1113
|
+
branch,
|
1114
|
+
table
|
1115
|
+
}) {
|
1016
1116
|
return operationsByTag.table.deleteTable({
|
1017
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1117
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1018
1118
|
...this.extraProps
|
1019
1119
|
});
|
1020
1120
|
}
|
1021
|
-
updateTable(
|
1121
|
+
updateTable({
|
1122
|
+
workspace,
|
1123
|
+
region,
|
1124
|
+
database,
|
1125
|
+
branch,
|
1126
|
+
table,
|
1127
|
+
update
|
1128
|
+
}) {
|
1022
1129
|
return operationsByTag.table.updateTable({
|
1023
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1024
|
-
body:
|
1130
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1131
|
+
body: update,
|
1025
1132
|
...this.extraProps
|
1026
1133
|
});
|
1027
1134
|
}
|
1028
|
-
getTableSchema(
|
1135
|
+
getTableSchema({
|
1136
|
+
workspace,
|
1137
|
+
region,
|
1138
|
+
database,
|
1139
|
+
branch,
|
1140
|
+
table
|
1141
|
+
}) {
|
1029
1142
|
return operationsByTag.table.getTableSchema({
|
1030
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1143
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1031
1144
|
...this.extraProps
|
1032
1145
|
});
|
1033
1146
|
}
|
1034
|
-
setTableSchema(
|
1147
|
+
setTableSchema({
|
1148
|
+
workspace,
|
1149
|
+
region,
|
1150
|
+
database,
|
1151
|
+
branch,
|
1152
|
+
table,
|
1153
|
+
schema
|
1154
|
+
}) {
|
1035
1155
|
return operationsByTag.table.setTableSchema({
|
1036
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1037
|
-
body:
|
1156
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1157
|
+
body: schema,
|
1038
1158
|
...this.extraProps
|
1039
1159
|
});
|
1040
1160
|
}
|
1041
|
-
getTableColumns(
|
1161
|
+
getTableColumns({
|
1162
|
+
workspace,
|
1163
|
+
region,
|
1164
|
+
database,
|
1165
|
+
branch,
|
1166
|
+
table
|
1167
|
+
}) {
|
1042
1168
|
return operationsByTag.table.getTableColumns({
|
1043
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1169
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1044
1170
|
...this.extraProps
|
1045
1171
|
});
|
1046
1172
|
}
|
1047
|
-
addTableColumn(
|
1173
|
+
addTableColumn({
|
1174
|
+
workspace,
|
1175
|
+
region,
|
1176
|
+
database,
|
1177
|
+
branch,
|
1178
|
+
table,
|
1179
|
+
column
|
1180
|
+
}) {
|
1048
1181
|
return operationsByTag.table.addTableColumn({
|
1049
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1182
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1050
1183
|
body: column,
|
1051
1184
|
...this.extraProps
|
1052
1185
|
});
|
1053
1186
|
}
|
1054
|
-
getColumn(
|
1187
|
+
getColumn({
|
1188
|
+
workspace,
|
1189
|
+
region,
|
1190
|
+
database,
|
1191
|
+
branch,
|
1192
|
+
table,
|
1193
|
+
column
|
1194
|
+
}) {
|
1055
1195
|
return operationsByTag.table.getColumn({
|
1056
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1196
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1057
1197
|
...this.extraProps
|
1058
1198
|
});
|
1059
1199
|
}
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
1200
|
+
updateColumn({
|
1201
|
+
workspace,
|
1202
|
+
region,
|
1203
|
+
database,
|
1204
|
+
branch,
|
1205
|
+
table,
|
1206
|
+
column,
|
1207
|
+
update
|
1208
|
+
}) {
|
1209
|
+
return operationsByTag.table.updateColumn({
|
1210
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1211
|
+
body: update,
|
1063
1212
|
...this.extraProps
|
1064
1213
|
});
|
1065
1214
|
}
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1215
|
+
deleteColumn({
|
1216
|
+
workspace,
|
1217
|
+
region,
|
1218
|
+
database,
|
1219
|
+
branch,
|
1220
|
+
table,
|
1221
|
+
column
|
1222
|
+
}) {
|
1223
|
+
return operationsByTag.table.deleteColumn({
|
1224
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1070
1225
|
...this.extraProps
|
1071
1226
|
});
|
1072
1227
|
}
|
@@ -1075,85 +1230,213 @@ class RecordsApi {
|
|
1075
1230
|
constructor(extraProps) {
|
1076
1231
|
this.extraProps = extraProps;
|
1077
1232
|
}
|
1078
|
-
insertRecord(
|
1233
|
+
insertRecord({
|
1234
|
+
workspace,
|
1235
|
+
region,
|
1236
|
+
database,
|
1237
|
+
branch,
|
1238
|
+
table,
|
1239
|
+
record,
|
1240
|
+
columns
|
1241
|
+
}) {
|
1079
1242
|
return operationsByTag.records.insertRecord({
|
1080
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1081
|
-
queryParams:
|
1243
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1244
|
+
queryParams: { columns },
|
1082
1245
|
body: record,
|
1083
1246
|
...this.extraProps
|
1084
1247
|
});
|
1085
1248
|
}
|
1086
|
-
|
1249
|
+
getRecord({
|
1250
|
+
workspace,
|
1251
|
+
region,
|
1252
|
+
database,
|
1253
|
+
branch,
|
1254
|
+
table,
|
1255
|
+
id,
|
1256
|
+
columns
|
1257
|
+
}) {
|
1258
|
+
return operationsByTag.records.getRecord({
|
1259
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1260
|
+
queryParams: { columns },
|
1261
|
+
...this.extraProps
|
1262
|
+
});
|
1263
|
+
}
|
1264
|
+
insertRecordWithID({
|
1265
|
+
workspace,
|
1266
|
+
region,
|
1267
|
+
database,
|
1268
|
+
branch,
|
1269
|
+
table,
|
1270
|
+
id,
|
1271
|
+
record,
|
1272
|
+
columns,
|
1273
|
+
createOnly,
|
1274
|
+
ifVersion
|
1275
|
+
}) {
|
1087
1276
|
return operationsByTag.records.insertRecordWithID({
|
1088
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1089
|
-
queryParams:
|
1277
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1278
|
+
queryParams: { columns, createOnly, ifVersion },
|
1090
1279
|
body: record,
|
1091
1280
|
...this.extraProps
|
1092
1281
|
});
|
1093
1282
|
}
|
1094
|
-
updateRecordWithID(
|
1283
|
+
updateRecordWithID({
|
1284
|
+
workspace,
|
1285
|
+
region,
|
1286
|
+
database,
|
1287
|
+
branch,
|
1288
|
+
table,
|
1289
|
+
id,
|
1290
|
+
record,
|
1291
|
+
columns,
|
1292
|
+
ifVersion
|
1293
|
+
}) {
|
1095
1294
|
return operationsByTag.records.updateRecordWithID({
|
1096
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1097
|
-
queryParams:
|
1295
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1296
|
+
queryParams: { columns, ifVersion },
|
1098
1297
|
body: record,
|
1099
1298
|
...this.extraProps
|
1100
1299
|
});
|
1101
1300
|
}
|
1102
|
-
upsertRecordWithID(
|
1301
|
+
upsertRecordWithID({
|
1302
|
+
workspace,
|
1303
|
+
region,
|
1304
|
+
database,
|
1305
|
+
branch,
|
1306
|
+
table,
|
1307
|
+
id,
|
1308
|
+
record,
|
1309
|
+
columns,
|
1310
|
+
ifVersion
|
1311
|
+
}) {
|
1103
1312
|
return operationsByTag.records.upsertRecordWithID({
|
1104
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1105
|
-
queryParams:
|
1313
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1314
|
+
queryParams: { columns, ifVersion },
|
1106
1315
|
body: record,
|
1107
1316
|
...this.extraProps
|
1108
1317
|
});
|
1109
1318
|
}
|
1110
|
-
deleteRecord(
|
1319
|
+
deleteRecord({
|
1320
|
+
workspace,
|
1321
|
+
region,
|
1322
|
+
database,
|
1323
|
+
branch,
|
1324
|
+
table,
|
1325
|
+
id,
|
1326
|
+
columns
|
1327
|
+
}) {
|
1111
1328
|
return operationsByTag.records.deleteRecord({
|
1112
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1113
|
-
queryParams:
|
1114
|
-
...this.extraProps
|
1115
|
-
});
|
1116
|
-
}
|
1117
|
-
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
1118
|
-
return operationsByTag.records.getRecord({
|
1119
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1120
|
-
queryParams: options,
|
1329
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1330
|
+
queryParams: { columns },
|
1121
1331
|
...this.extraProps
|
1122
1332
|
});
|
1123
1333
|
}
|
1124
|
-
bulkInsertTableRecords(
|
1334
|
+
bulkInsertTableRecords({
|
1335
|
+
workspace,
|
1336
|
+
region,
|
1337
|
+
database,
|
1338
|
+
branch,
|
1339
|
+
table,
|
1340
|
+
records,
|
1341
|
+
columns
|
1342
|
+
}) {
|
1125
1343
|
return operationsByTag.records.bulkInsertTableRecords({
|
1126
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1127
|
-
queryParams:
|
1344
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1345
|
+
queryParams: { columns },
|
1128
1346
|
body: { records },
|
1129
1347
|
...this.extraProps
|
1130
1348
|
});
|
1131
1349
|
}
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
...this.extraProps
|
1137
|
-
});
|
1138
|
-
}
|
1139
|
-
searchTable(workspace, database, branch, tableName, query) {
|
1140
|
-
return operationsByTag.records.searchTable({
|
1141
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1142
|
-
body: query,
|
1143
|
-
...this.extraProps
|
1144
|
-
});
|
1145
|
-
}
|
1146
|
-
searchBranch(workspace, database, branch, query) {
|
1147
|
-
return operationsByTag.records.searchBranch({
|
1148
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1149
|
-
body: query,
|
1150
|
-
...this.extraProps
|
1151
|
-
});
|
1350
|
+
}
|
1351
|
+
class SearchAndFilterApi {
|
1352
|
+
constructor(extraProps) {
|
1353
|
+
this.extraProps = extraProps;
|
1152
1354
|
}
|
1153
|
-
|
1154
|
-
|
1155
|
-
|
1156
|
-
|
1355
|
+
queryTable({
|
1356
|
+
workspace,
|
1357
|
+
region,
|
1358
|
+
database,
|
1359
|
+
branch,
|
1360
|
+
table,
|
1361
|
+
filter,
|
1362
|
+
sort,
|
1363
|
+
page,
|
1364
|
+
columns
|
1365
|
+
}) {
|
1366
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1367
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1368
|
+
body: { filter, sort, page, columns },
|
1369
|
+
...this.extraProps
|
1370
|
+
});
|
1371
|
+
}
|
1372
|
+
searchTable({
|
1373
|
+
workspace,
|
1374
|
+
region,
|
1375
|
+
database,
|
1376
|
+
branch,
|
1377
|
+
table,
|
1378
|
+
query,
|
1379
|
+
fuzziness,
|
1380
|
+
target,
|
1381
|
+
prefix,
|
1382
|
+
filter,
|
1383
|
+
highlight,
|
1384
|
+
boosters
|
1385
|
+
}) {
|
1386
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1387
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1388
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1389
|
+
...this.extraProps
|
1390
|
+
});
|
1391
|
+
}
|
1392
|
+
searchBranch({
|
1393
|
+
workspace,
|
1394
|
+
region,
|
1395
|
+
database,
|
1396
|
+
branch,
|
1397
|
+
tables,
|
1398
|
+
query,
|
1399
|
+
fuzziness,
|
1400
|
+
prefix,
|
1401
|
+
highlight
|
1402
|
+
}) {
|
1403
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1404
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1405
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1406
|
+
...this.extraProps
|
1407
|
+
});
|
1408
|
+
}
|
1409
|
+
summarizeTable({
|
1410
|
+
workspace,
|
1411
|
+
region,
|
1412
|
+
database,
|
1413
|
+
branch,
|
1414
|
+
table,
|
1415
|
+
filter,
|
1416
|
+
columns,
|
1417
|
+
summaries,
|
1418
|
+
sort,
|
1419
|
+
summariesFilter,
|
1420
|
+
page
|
1421
|
+
}) {
|
1422
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1423
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1424
|
+
body: { filter, columns, summaries, sort, summariesFilter, page },
|
1425
|
+
...this.extraProps
|
1426
|
+
});
|
1427
|
+
}
|
1428
|
+
aggregateTable({
|
1429
|
+
workspace,
|
1430
|
+
region,
|
1431
|
+
database,
|
1432
|
+
branch,
|
1433
|
+
table,
|
1434
|
+
filter,
|
1435
|
+
aggs
|
1436
|
+
}) {
|
1437
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1438
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1439
|
+
body: { filter, aggs },
|
1157
1440
|
...this.extraProps
|
1158
1441
|
});
|
1159
1442
|
}
|
@@ -1162,123 +1445,281 @@ class MigrationRequestsApi {
|
|
1162
1445
|
constructor(extraProps) {
|
1163
1446
|
this.extraProps = extraProps;
|
1164
1447
|
}
|
1165
|
-
queryMigrationRequests(
|
1448
|
+
queryMigrationRequests({
|
1449
|
+
workspace,
|
1450
|
+
region,
|
1451
|
+
database,
|
1452
|
+
filter,
|
1453
|
+
sort,
|
1454
|
+
page,
|
1455
|
+
columns
|
1456
|
+
}) {
|
1166
1457
|
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1167
|
-
pathParams: { workspace, dbName: database },
|
1168
|
-
body:
|
1458
|
+
pathParams: { workspace, region, dbName: database },
|
1459
|
+
body: { filter, sort, page, columns },
|
1169
1460
|
...this.extraProps
|
1170
1461
|
});
|
1171
1462
|
}
|
1172
|
-
createMigrationRequest(
|
1463
|
+
createMigrationRequest({
|
1464
|
+
workspace,
|
1465
|
+
region,
|
1466
|
+
database,
|
1467
|
+
migration
|
1468
|
+
}) {
|
1173
1469
|
return operationsByTag.migrationRequests.createMigrationRequest({
|
1174
|
-
pathParams: { workspace, dbName: database },
|
1175
|
-
body:
|
1470
|
+
pathParams: { workspace, region, dbName: database },
|
1471
|
+
body: migration,
|
1176
1472
|
...this.extraProps
|
1177
1473
|
});
|
1178
1474
|
}
|
1179
|
-
getMigrationRequest(
|
1475
|
+
getMigrationRequest({
|
1476
|
+
workspace,
|
1477
|
+
region,
|
1478
|
+
database,
|
1479
|
+
migrationRequest
|
1480
|
+
}) {
|
1180
1481
|
return operationsByTag.migrationRequests.getMigrationRequest({
|
1181
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1482
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1182
1483
|
...this.extraProps
|
1183
1484
|
});
|
1184
1485
|
}
|
1185
|
-
updateMigrationRequest(
|
1486
|
+
updateMigrationRequest({
|
1487
|
+
workspace,
|
1488
|
+
region,
|
1489
|
+
database,
|
1490
|
+
migrationRequest,
|
1491
|
+
update
|
1492
|
+
}) {
|
1186
1493
|
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1187
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1188
|
-
body:
|
1494
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1495
|
+
body: update,
|
1189
1496
|
...this.extraProps
|
1190
1497
|
});
|
1191
1498
|
}
|
1192
|
-
listMigrationRequestsCommits(
|
1499
|
+
listMigrationRequestsCommits({
|
1500
|
+
workspace,
|
1501
|
+
region,
|
1502
|
+
database,
|
1503
|
+
migrationRequest,
|
1504
|
+
page
|
1505
|
+
}) {
|
1193
1506
|
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1194
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1195
|
-
body:
|
1507
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1508
|
+
body: { page },
|
1196
1509
|
...this.extraProps
|
1197
1510
|
});
|
1198
1511
|
}
|
1199
|
-
compareMigrationRequest(
|
1512
|
+
compareMigrationRequest({
|
1513
|
+
workspace,
|
1514
|
+
region,
|
1515
|
+
database,
|
1516
|
+
migrationRequest
|
1517
|
+
}) {
|
1200
1518
|
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1201
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1519
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1202
1520
|
...this.extraProps
|
1203
1521
|
});
|
1204
1522
|
}
|
1205
|
-
getMigrationRequestIsMerged(
|
1523
|
+
getMigrationRequestIsMerged({
|
1524
|
+
workspace,
|
1525
|
+
region,
|
1526
|
+
database,
|
1527
|
+
migrationRequest
|
1528
|
+
}) {
|
1206
1529
|
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1207
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1530
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1208
1531
|
...this.extraProps
|
1209
1532
|
});
|
1210
1533
|
}
|
1211
|
-
mergeMigrationRequest(
|
1534
|
+
mergeMigrationRequest({
|
1535
|
+
workspace,
|
1536
|
+
region,
|
1537
|
+
database,
|
1538
|
+
migrationRequest
|
1539
|
+
}) {
|
1212
1540
|
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1213
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1541
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1214
1542
|
...this.extraProps
|
1215
1543
|
});
|
1216
1544
|
}
|
1217
1545
|
}
|
1218
|
-
class
|
1546
|
+
class MigrationsApi {
|
1219
1547
|
constructor(extraProps) {
|
1220
1548
|
this.extraProps = extraProps;
|
1221
1549
|
}
|
1222
|
-
getBranchMigrationHistory(
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1550
|
+
getBranchMigrationHistory({
|
1551
|
+
workspace,
|
1552
|
+
region,
|
1553
|
+
database,
|
1554
|
+
branch,
|
1555
|
+
limit,
|
1556
|
+
startFrom
|
1557
|
+
}) {
|
1558
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1559
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1560
|
+
body: { limit, startFrom },
|
1561
|
+
...this.extraProps
|
1562
|
+
});
|
1563
|
+
}
|
1564
|
+
getBranchMigrationPlan({
|
1565
|
+
workspace,
|
1566
|
+
region,
|
1567
|
+
database,
|
1568
|
+
branch,
|
1569
|
+
schema
|
1570
|
+
}) {
|
1571
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1572
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1573
|
+
body: schema,
|
1226
1574
|
...this.extraProps
|
1227
1575
|
});
|
1228
1576
|
}
|
1229
|
-
executeBranchMigrationPlan(
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1577
|
+
executeBranchMigrationPlan({
|
1578
|
+
workspace,
|
1579
|
+
region,
|
1580
|
+
database,
|
1581
|
+
branch,
|
1582
|
+
plan
|
1583
|
+
}) {
|
1584
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1585
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1586
|
+
body: plan,
|
1233
1587
|
...this.extraProps
|
1234
1588
|
});
|
1235
1589
|
}
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
1590
|
+
getBranchSchemaHistory({
|
1591
|
+
workspace,
|
1592
|
+
region,
|
1593
|
+
database,
|
1594
|
+
branch,
|
1595
|
+
page
|
1596
|
+
}) {
|
1597
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1598
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1599
|
+
body: { page },
|
1240
1600
|
...this.extraProps
|
1241
1601
|
});
|
1242
1602
|
}
|
1243
|
-
compareBranchWithUserSchema(
|
1244
|
-
|
1245
|
-
|
1603
|
+
compareBranchWithUserSchema({
|
1604
|
+
workspace,
|
1605
|
+
region,
|
1606
|
+
database,
|
1607
|
+
branch,
|
1608
|
+
schema
|
1609
|
+
}) {
|
1610
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1611
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1246
1612
|
body: { schema },
|
1247
1613
|
...this.extraProps
|
1248
1614
|
});
|
1249
1615
|
}
|
1250
|
-
compareBranchSchemas(
|
1251
|
-
|
1252
|
-
|
1616
|
+
compareBranchSchemas({
|
1617
|
+
workspace,
|
1618
|
+
region,
|
1619
|
+
database,
|
1620
|
+
branch,
|
1621
|
+
compare,
|
1622
|
+
schema
|
1623
|
+
}) {
|
1624
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1625
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1253
1626
|
body: { schema },
|
1254
1627
|
...this.extraProps
|
1255
1628
|
});
|
1256
1629
|
}
|
1257
|
-
updateBranchSchema(
|
1258
|
-
|
1259
|
-
|
1630
|
+
updateBranchSchema({
|
1631
|
+
workspace,
|
1632
|
+
region,
|
1633
|
+
database,
|
1634
|
+
branch,
|
1635
|
+
migration
|
1636
|
+
}) {
|
1637
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1638
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1260
1639
|
body: migration,
|
1261
1640
|
...this.extraProps
|
1262
1641
|
});
|
1263
1642
|
}
|
1264
|
-
previewBranchSchemaEdit(
|
1265
|
-
|
1266
|
-
|
1267
|
-
|
1643
|
+
previewBranchSchemaEdit({
|
1644
|
+
workspace,
|
1645
|
+
region,
|
1646
|
+
database,
|
1647
|
+
branch,
|
1648
|
+
data
|
1649
|
+
}) {
|
1650
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1651
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1652
|
+
body: data,
|
1268
1653
|
...this.extraProps
|
1269
1654
|
});
|
1270
1655
|
}
|
1271
|
-
applyBranchSchemaEdit(
|
1272
|
-
|
1273
|
-
|
1656
|
+
applyBranchSchemaEdit({
|
1657
|
+
workspace,
|
1658
|
+
region,
|
1659
|
+
database,
|
1660
|
+
branch,
|
1661
|
+
edits
|
1662
|
+
}) {
|
1663
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1664
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1274
1665
|
body: { edits },
|
1275
1666
|
...this.extraProps
|
1276
1667
|
});
|
1277
1668
|
}
|
1278
|
-
|
1279
|
-
|
1280
|
-
|
1281
|
-
|
1669
|
+
}
|
1670
|
+
class DatabaseApi {
|
1671
|
+
constructor(extraProps) {
|
1672
|
+
this.extraProps = extraProps;
|
1673
|
+
}
|
1674
|
+
getDatabaseList({ workspace }) {
|
1675
|
+
return operationsByTag.databases.cPGetDatabaseList({
|
1676
|
+
pathParams: { workspaceId: workspace },
|
1677
|
+
...this.extraProps
|
1678
|
+
});
|
1679
|
+
}
|
1680
|
+
createDatabase({
|
1681
|
+
workspace,
|
1682
|
+
database,
|
1683
|
+
data
|
1684
|
+
}) {
|
1685
|
+
return operationsByTag.databases.cPCreateDatabase({
|
1686
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1687
|
+
body: data,
|
1688
|
+
...this.extraProps
|
1689
|
+
});
|
1690
|
+
}
|
1691
|
+
deleteDatabase({
|
1692
|
+
workspace,
|
1693
|
+
database
|
1694
|
+
}) {
|
1695
|
+
return operationsByTag.databases.cPDeleteDatabase({
|
1696
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1697
|
+
...this.extraProps
|
1698
|
+
});
|
1699
|
+
}
|
1700
|
+
getDatabaseMetadata({
|
1701
|
+
workspace,
|
1702
|
+
database
|
1703
|
+
}) {
|
1704
|
+
return operationsByTag.databases.cPGetCPDatabaseMetadata({
|
1705
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1706
|
+
...this.extraProps
|
1707
|
+
});
|
1708
|
+
}
|
1709
|
+
updateDatabaseMetadata({
|
1710
|
+
workspace,
|
1711
|
+
database,
|
1712
|
+
metadata
|
1713
|
+
}) {
|
1714
|
+
return operationsByTag.databases.cPUpdateCPDatabaseMetadata({
|
1715
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1716
|
+
body: metadata,
|
1717
|
+
...this.extraProps
|
1718
|
+
});
|
1719
|
+
}
|
1720
|
+
listRegions({ workspace }) {
|
1721
|
+
return operationsByTag.databases.listRegions({
|
1722
|
+
pathParams: { workspaceId: workspace },
|
1282
1723
|
...this.extraProps
|
1283
1724
|
});
|
1284
1725
|
}
|
@@ -1294,6 +1735,20 @@ class XataApiPlugin {
|
|
1294
1735
|
class XataPlugin {
|
1295
1736
|
}
|
1296
1737
|
|
1738
|
+
function generateUUID() {
|
1739
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1740
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1741
|
+
return v.toString(16);
|
1742
|
+
});
|
1743
|
+
}
|
1744
|
+
|
1745
|
+
function cleanFilter(filter) {
|
1746
|
+
if (!filter)
|
1747
|
+
return void 0;
|
1748
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1749
|
+
return values.length > 0 ? filter : void 0;
|
1750
|
+
}
|
1751
|
+
|
1297
1752
|
var __accessCheck$6 = (obj, member, msg) => {
|
1298
1753
|
if (!member.has(obj))
|
1299
1754
|
throw TypeError("Cannot " + msg);
|
@@ -1433,7 +1888,7 @@ const _Query = class {
|
|
1433
1888
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1434
1889
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1435
1890
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1436
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1891
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1437
1892
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1438
1893
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1439
1894
|
this.any = this.any.bind(this);
|
@@ -1549,6 +2004,16 @@ const _Query = class {
|
|
1549
2004
|
throw new Error("No results found.");
|
1550
2005
|
return records[0];
|
1551
2006
|
}
|
2007
|
+
async summarize(params = {}) {
|
2008
|
+
const { summaries, summariesFilter, ...options } = params;
|
2009
|
+
const query = new _Query(
|
2010
|
+
__privateGet$5(this, _repository),
|
2011
|
+
__privateGet$5(this, _table$1),
|
2012
|
+
options,
|
2013
|
+
__privateGet$5(this, _data)
|
2014
|
+
);
|
2015
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2016
|
+
}
|
1552
2017
|
cache(ttl) {
|
1553
2018
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1554
2019
|
}
|
@@ -1585,7 +2050,7 @@ cleanFilterConstraint_fn = function(column, value) {
|
|
1585
2050
|
};
|
1586
2051
|
function cleanParent(data, parent) {
|
1587
2052
|
if (isCursorPaginationOptions(data.pagination)) {
|
1588
|
-
return { ...parent,
|
2053
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1589
2054
|
}
|
1590
2055
|
return parent;
|
1591
2056
|
}
|
@@ -1670,10 +2135,13 @@ class RestRepository extends Query {
|
|
1670
2135
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1671
2136
|
__privateAdd$4(this, _trace, void 0);
|
1672
2137
|
__privateSet$4(this, _table, options.table);
|
1673
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1674
2138
|
__privateSet$4(this, _db, options.db);
|
1675
2139
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1676
2140
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2141
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2142
|
+
const props = await options.pluginOptions.getFetchProps();
|
2143
|
+
return { ...props, sessionID: generateUUID() };
|
2144
|
+
});
|
1677
2145
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1678
2146
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1679
2147
|
return trace(name, fn, {
|
@@ -1684,8 +2152,9 @@ class RestRepository extends Query {
|
|
1684
2152
|
});
|
1685
2153
|
});
|
1686
2154
|
}
|
1687
|
-
async create(a, b, c) {
|
2155
|
+
async create(a, b, c, d) {
|
1688
2156
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2157
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1689
2158
|
if (Array.isArray(a)) {
|
1690
2159
|
if (a.length === 0)
|
1691
2160
|
return [];
|
@@ -1696,13 +2165,13 @@ class RestRepository extends Query {
|
|
1696
2165
|
if (a === "")
|
1697
2166
|
throw new Error("The id can't be empty");
|
1698
2167
|
const columns = isStringArray(c) ? c : void 0;
|
1699
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
2168
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1700
2169
|
}
|
1701
2170
|
if (isObject(a) && isString(a.id)) {
|
1702
2171
|
if (a.id === "")
|
1703
2172
|
throw new Error("The id can't be empty");
|
1704
2173
|
const columns = isStringArray(b) ? b : void 0;
|
1705
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2174
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1706
2175
|
}
|
1707
2176
|
if (isObject(a)) {
|
1708
2177
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1733,6 +2202,7 @@ class RestRepository extends Query {
|
|
1733
2202
|
pathParams: {
|
1734
2203
|
workspace: "{workspaceId}",
|
1735
2204
|
dbBranchName: "{dbBranch}",
|
2205
|
+
region: "{region}",
|
1736
2206
|
tableName: __privateGet$4(this, _table),
|
1737
2207
|
recordId: id
|
1738
2208
|
},
|
@@ -1770,8 +2240,9 @@ class RestRepository extends Query {
|
|
1770
2240
|
return result;
|
1771
2241
|
});
|
1772
2242
|
}
|
1773
|
-
async update(a, b, c) {
|
2243
|
+
async update(a, b, c, d) {
|
1774
2244
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2245
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1775
2246
|
if (Array.isArray(a)) {
|
1776
2247
|
if (a.length === 0)
|
1777
2248
|
return [];
|
@@ -1783,18 +2254,18 @@ class RestRepository extends Query {
|
|
1783
2254
|
}
|
1784
2255
|
if (isString(a) && isObject(b)) {
|
1785
2256
|
const columns = isStringArray(c) ? c : void 0;
|
1786
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
2257
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1787
2258
|
}
|
1788
2259
|
if (isObject(a) && isString(a.id)) {
|
1789
2260
|
const columns = isStringArray(b) ? b : void 0;
|
1790
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2261
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1791
2262
|
}
|
1792
2263
|
throw new Error("Invalid arguments for update method");
|
1793
2264
|
});
|
1794
2265
|
}
|
1795
|
-
async updateOrThrow(a, b, c) {
|
2266
|
+
async updateOrThrow(a, b, c, d) {
|
1796
2267
|
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
1797
|
-
const result = await this.update(a, b, c);
|
2268
|
+
const result = await this.update(a, b, c, d);
|
1798
2269
|
if (Array.isArray(result)) {
|
1799
2270
|
const missingIds = compact(
|
1800
2271
|
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
@@ -1811,8 +2282,9 @@ class RestRepository extends Query {
|
|
1811
2282
|
return result;
|
1812
2283
|
});
|
1813
2284
|
}
|
1814
|
-
async createOrUpdate(a, b, c) {
|
2285
|
+
async createOrUpdate(a, b, c, d) {
|
1815
2286
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2287
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1816
2288
|
if (Array.isArray(a)) {
|
1817
2289
|
if (a.length === 0)
|
1818
2290
|
return [];
|
@@ -1824,15 +2296,35 @@ class RestRepository extends Query {
|
|
1824
2296
|
}
|
1825
2297
|
if (isString(a) && isObject(b)) {
|
1826
2298
|
const columns = isStringArray(c) ? c : void 0;
|
1827
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
2299
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1828
2300
|
}
|
1829
2301
|
if (isObject(a) && isString(a.id)) {
|
1830
2302
|
const columns = isStringArray(c) ? c : void 0;
|
1831
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2303
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1832
2304
|
}
|
1833
2305
|
throw new Error("Invalid arguments for createOrUpdate method");
|
1834
2306
|
});
|
1835
2307
|
}
|
2308
|
+
async createOrReplace(a, b, c, d) {
|
2309
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2310
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2311
|
+
if (Array.isArray(a)) {
|
2312
|
+
if (a.length === 0)
|
2313
|
+
return [];
|
2314
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2315
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
2316
|
+
}
|
2317
|
+
if (isString(a) && isObject(b)) {
|
2318
|
+
const columns = isStringArray(c) ? c : void 0;
|
2319
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2320
|
+
}
|
2321
|
+
if (isObject(a) && isString(a.id)) {
|
2322
|
+
const columns = isStringArray(c) ? c : void 0;
|
2323
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2324
|
+
}
|
2325
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2326
|
+
});
|
2327
|
+
}
|
1836
2328
|
async delete(a, b) {
|
1837
2329
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
1838
2330
|
if (Array.isArray(a)) {
|
@@ -1874,7 +2366,12 @@ class RestRepository extends Query {
|
|
1874
2366
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1875
2367
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1876
2368
|
const { records } = await searchTable({
|
1877
|
-
pathParams: {
|
2369
|
+
pathParams: {
|
2370
|
+
workspace: "{workspaceId}",
|
2371
|
+
dbBranchName: "{dbBranch}",
|
2372
|
+
region: "{region}",
|
2373
|
+
tableName: __privateGet$4(this, _table)
|
2374
|
+
},
|
1878
2375
|
body: {
|
1879
2376
|
query,
|
1880
2377
|
fuzziness: options.fuzziness,
|
@@ -1889,22 +2386,42 @@ class RestRepository extends Query {
|
|
1889
2386
|
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
1890
2387
|
});
|
1891
2388
|
}
|
2389
|
+
async aggregate(aggs, filter) {
|
2390
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2391
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2392
|
+
const result = await aggregateTable({
|
2393
|
+
pathParams: {
|
2394
|
+
workspace: "{workspaceId}",
|
2395
|
+
dbBranchName: "{dbBranch}",
|
2396
|
+
region: "{region}",
|
2397
|
+
tableName: __privateGet$4(this, _table)
|
2398
|
+
},
|
2399
|
+
body: { aggs, filter },
|
2400
|
+
...fetchProps
|
2401
|
+
});
|
2402
|
+
return result;
|
2403
|
+
});
|
2404
|
+
}
|
1892
2405
|
async query(query) {
|
1893
2406
|
return __privateGet$4(this, _trace).call(this, "query", async () => {
|
1894
2407
|
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
1895
2408
|
if (cacheQuery)
|
1896
2409
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1897
2410
|
const data = query.getQueryOptions();
|
1898
|
-
const body = {
|
1899
|
-
filter: cleanFilter(data.filter),
|
1900
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1901
|
-
page: data.pagination,
|
1902
|
-
columns: data.columns
|
1903
|
-
};
|
1904
2411
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1905
2412
|
const { meta, records: objects } = await queryTable({
|
1906
|
-
pathParams: {
|
1907
|
-
|
2413
|
+
pathParams: {
|
2414
|
+
workspace: "{workspaceId}",
|
2415
|
+
dbBranchName: "{dbBranch}",
|
2416
|
+
region: "{region}",
|
2417
|
+
tableName: __privateGet$4(this, _table)
|
2418
|
+
},
|
2419
|
+
body: {
|
2420
|
+
filter: cleanFilter(data.filter),
|
2421
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2422
|
+
page: data.pagination,
|
2423
|
+
columns: data.columns ?? ["*"]
|
2424
|
+
},
|
1908
2425
|
...fetchProps
|
1909
2426
|
});
|
1910
2427
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
@@ -1915,6 +2432,30 @@ class RestRepository extends Query {
|
|
1915
2432
|
return new Page(query, meta, records);
|
1916
2433
|
});
|
1917
2434
|
}
|
2435
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2436
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2437
|
+
const data = query.getQueryOptions();
|
2438
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2439
|
+
const result = await summarizeTable({
|
2440
|
+
pathParams: {
|
2441
|
+
workspace: "{workspaceId}",
|
2442
|
+
dbBranchName: "{dbBranch}",
|
2443
|
+
region: "{region}",
|
2444
|
+
tableName: __privateGet$4(this, _table)
|
2445
|
+
},
|
2446
|
+
body: {
|
2447
|
+
filter: cleanFilter(data.filter),
|
2448
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2449
|
+
columns: data.columns,
|
2450
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2451
|
+
summaries,
|
2452
|
+
summariesFilter
|
2453
|
+
},
|
2454
|
+
...fetchProps
|
2455
|
+
});
|
2456
|
+
return result;
|
2457
|
+
});
|
2458
|
+
}
|
1918
2459
|
}
|
1919
2460
|
_table = new WeakMap();
|
1920
2461
|
_getFetchProps = new WeakMap();
|
@@ -1930,6 +2471,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1930
2471
|
pathParams: {
|
1931
2472
|
workspace: "{workspaceId}",
|
1932
2473
|
dbBranchName: "{dbBranch}",
|
2474
|
+
region: "{region}",
|
1933
2475
|
tableName: __privateGet$4(this, _table)
|
1934
2476
|
},
|
1935
2477
|
queryParams: { columns },
|
@@ -1940,18 +2482,19 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1940
2482
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1941
2483
|
};
|
1942
2484
|
_insertRecordWithId = new WeakSet();
|
1943
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2485
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1944
2486
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1945
2487
|
const record = transformObjectLinks(object);
|
1946
2488
|
const response = await insertRecordWithID({
|
1947
2489
|
pathParams: {
|
1948
2490
|
workspace: "{workspaceId}",
|
1949
2491
|
dbBranchName: "{dbBranch}",
|
2492
|
+
region: "{region}",
|
1950
2493
|
tableName: __privateGet$4(this, _table),
|
1951
2494
|
recordId
|
1952
2495
|
},
|
1953
2496
|
body: record,
|
1954
|
-
queryParams: { createOnly
|
2497
|
+
queryParams: { createOnly, columns, ifVersion },
|
1955
2498
|
...fetchProps
|
1956
2499
|
});
|
1957
2500
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
@@ -1962,7 +2505,12 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
1962
2505
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1963
2506
|
const records = objects.map((object) => transformObjectLinks(object));
|
1964
2507
|
const response = await bulkInsertTableRecords({
|
1965
|
-
pathParams: {
|
2508
|
+
pathParams: {
|
2509
|
+
workspace: "{workspaceId}",
|
2510
|
+
dbBranchName: "{dbBranch}",
|
2511
|
+
region: "{region}",
|
2512
|
+
tableName: __privateGet$4(this, _table)
|
2513
|
+
},
|
1966
2514
|
queryParams: { columns },
|
1967
2515
|
body: { records },
|
1968
2516
|
...fetchProps
|
@@ -1974,13 +2522,19 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
1974
2522
|
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
1975
2523
|
};
|
1976
2524
|
_updateRecordWithID = new WeakSet();
|
1977
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2525
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1978
2526
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1979
2527
|
const record = transformObjectLinks(object);
|
1980
2528
|
try {
|
1981
2529
|
const response = await updateRecordWithID({
|
1982
|
-
pathParams: {
|
1983
|
-
|
2530
|
+
pathParams: {
|
2531
|
+
workspace: "{workspaceId}",
|
2532
|
+
dbBranchName: "{dbBranch}",
|
2533
|
+
region: "{region}",
|
2534
|
+
tableName: __privateGet$4(this, _table),
|
2535
|
+
recordId
|
2536
|
+
},
|
2537
|
+
queryParams: { columns, ifVersion },
|
1984
2538
|
body: record,
|
1985
2539
|
...fetchProps
|
1986
2540
|
});
|
@@ -1994,11 +2548,17 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1994
2548
|
}
|
1995
2549
|
};
|
1996
2550
|
_upsertRecordWithID = new WeakSet();
|
1997
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2551
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1998
2552
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1999
2553
|
const response = await upsertRecordWithID({
|
2000
|
-
pathParams: {
|
2001
|
-
|
2554
|
+
pathParams: {
|
2555
|
+
workspace: "{workspaceId}",
|
2556
|
+
dbBranchName: "{dbBranch}",
|
2557
|
+
region: "{region}",
|
2558
|
+
tableName: __privateGet$4(this, _table),
|
2559
|
+
recordId
|
2560
|
+
},
|
2561
|
+
queryParams: { columns, ifVersion },
|
2002
2562
|
body: object,
|
2003
2563
|
...fetchProps
|
2004
2564
|
});
|
@@ -2010,7 +2570,13 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
2010
2570
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2011
2571
|
try {
|
2012
2572
|
const response = await deleteRecord({
|
2013
|
-
pathParams: {
|
2573
|
+
pathParams: {
|
2574
|
+
workspace: "{workspaceId}",
|
2575
|
+
dbBranchName: "{dbBranch}",
|
2576
|
+
region: "{region}",
|
2577
|
+
tableName: __privateGet$4(this, _table),
|
2578
|
+
recordId
|
2579
|
+
},
|
2014
2580
|
queryParams: { columns },
|
2015
2581
|
...fetchProps
|
2016
2582
|
});
|
@@ -2045,7 +2611,7 @@ getSchemaTables_fn$1 = async function() {
|
|
2045
2611
|
return __privateGet$4(this, _schemaTables$2);
|
2046
2612
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2047
2613
|
const { schema } = await getBranchDetails({
|
2048
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2614
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2049
2615
|
...fetchProps
|
2050
2616
|
});
|
2051
2617
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -2111,8 +2677,15 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
2111
2677
|
result.read = function(columns2) {
|
2112
2678
|
return db[table].read(result["id"], columns2);
|
2113
2679
|
};
|
2114
|
-
result.update = function(data,
|
2115
|
-
|
2680
|
+
result.update = function(data, b, c) {
|
2681
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2682
|
+
const ifVersion = parseIfVersion(b, c);
|
2683
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2684
|
+
};
|
2685
|
+
result.replace = function(data, b, c) {
|
2686
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2687
|
+
const ifVersion = parseIfVersion(b, c);
|
2688
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
2116
2689
|
};
|
2117
2690
|
result.delete = function() {
|
2118
2691
|
return db[table].delete(result["id"]);
|
@@ -2136,12 +2709,6 @@ function extractId(value) {
|
|
2136
2709
|
return value.id;
|
2137
2710
|
return void 0;
|
2138
2711
|
}
|
2139
|
-
function cleanFilter(filter) {
|
2140
|
-
if (!filter)
|
2141
|
-
return void 0;
|
2142
|
-
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
2143
|
-
return values.length > 0 ? filter : void 0;
|
2144
|
-
}
|
2145
2712
|
function isValidColumn(columns, column) {
|
2146
2713
|
if (columns.includes("*"))
|
2147
2714
|
return true;
|
@@ -2151,6 +2718,14 @@ function isValidColumn(columns, column) {
|
|
2151
2718
|
}
|
2152
2719
|
return columns.includes(column.name);
|
2153
2720
|
}
|
2721
|
+
function parseIfVersion(...args) {
|
2722
|
+
for (const arg of args) {
|
2723
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2724
|
+
return arg.ifVersion;
|
2725
|
+
}
|
2726
|
+
}
|
2727
|
+
return void 0;
|
2728
|
+
}
|
2154
2729
|
|
2155
2730
|
var __accessCheck$3 = (obj, member, msg) => {
|
2156
2731
|
if (!member.has(obj))
|
@@ -2338,7 +2913,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
2338
2913
|
const fetchProps = await getFetchProps();
|
2339
2914
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
2340
2915
|
const { records } = await searchBranch({
|
2341
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2916
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2342
2917
|
body: { tables, query, fuzziness, prefix, highlight },
|
2343
2918
|
...fetchProps
|
2344
2919
|
});
|
@@ -2350,7 +2925,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
2350
2925
|
return __privateGet$1(this, _schemaTables);
|
2351
2926
|
const fetchProps = await getFetchProps();
|
2352
2927
|
const { schema } = await getBranchDetails({
|
2353
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2928
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2354
2929
|
...fetchProps
|
2355
2930
|
});
|
2356
2931
|
__privateSet$1(this, _schemaTables, schema.tables);
|
@@ -2388,14 +2963,17 @@ async function resolveXataBranch(gitBranch, options) {
|
|
2388
2963
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2389
2964
|
);
|
2390
2965
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2391
|
-
const
|
2966
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
2967
|
+
if (!urlParts)
|
2968
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
2969
|
+
const { workspace, region } = urlParts;
|
2392
2970
|
const { fallbackBranch } = getEnvironment();
|
2393
2971
|
const { branch } = await resolveBranch({
|
2394
2972
|
apiKey,
|
2395
2973
|
apiUrl: databaseURL,
|
2396
2974
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2397
2975
|
workspacesApiUrl: `${protocol}//${host}`,
|
2398
|
-
pathParams: { dbName, workspace },
|
2976
|
+
pathParams: { dbName, workspace, region },
|
2399
2977
|
queryParams: { gitBranch, fallbackBranch },
|
2400
2978
|
trace: defaultTrace
|
2401
2979
|
});
|
@@ -2413,15 +2991,17 @@ async function getDatabaseBranch(branch, options) {
|
|
2413
2991
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2414
2992
|
);
|
2415
2993
|
const [protocol, , host, , database] = databaseURL.split("/");
|
2416
|
-
const
|
2417
|
-
|
2994
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
2995
|
+
if (!urlParts)
|
2996
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
2997
|
+
const { workspace, region } = urlParts;
|
2418
2998
|
try {
|
2419
2999
|
return await getBranchDetails({
|
2420
3000
|
apiKey,
|
2421
3001
|
apiUrl: databaseURL,
|
2422
3002
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2423
3003
|
workspacesApiUrl: `${protocol}//${host}`,
|
2424
|
-
pathParams: { dbBranchName
|
3004
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
2425
3005
|
trace: defaultTrace
|
2426
3006
|
});
|
2427
3007
|
} catch (err) {
|
@@ -2512,8 +3092,8 @@ const buildClient = (plugins) => {
|
|
2512
3092
|
if (!databaseURL) {
|
2513
3093
|
throw new Error("Option databaseURL is required");
|
2514
3094
|
}
|
2515
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2516
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
|
3095
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
3096
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
2517
3097
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2518
3098
|
if (!branchValue)
|
2519
3099
|
throw new Error("Unable to resolve branch value");
|
@@ -2526,7 +3106,8 @@ const buildClient = (plugins) => {
|
|
2526
3106
|
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2527
3107
|
return databaseURL + newPath;
|
2528
3108
|
},
|
2529
|
-
trace
|
3109
|
+
trace,
|
3110
|
+
clientID
|
2530
3111
|
};
|
2531
3112
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2532
3113
|
if (__privateGet(this, _branch))
|
@@ -2638,5 +3219,5 @@ class XataError extends Error {
|
|
2638
3219
|
}
|
2639
3220
|
}
|
2640
3221
|
|
2641
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, lt, lte, mergeMigrationRequest, notExists, operationsByTag, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
3222
|
+
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cPCreateDatabase, cPDeleteDatabase, cPGetCPDatabaseMetadata, cPGetDatabaseList, cPUpdateCPDatabaseMetadata, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
2642
3223
|
//# sourceMappingURL=index.mjs.map
|