@xata.io/client 0.18.6 → 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 +18 -0
- package/README.md +5 -5
- package/dist/index.cjs +1047 -572
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2664 -1862
- package/dist/index.mjs +1046 -573
- 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,6 +248,7 @@ async function fetch$1({
|
|
|
231
248
|
queryParams,
|
|
232
249
|
fetchImpl,
|
|
233
250
|
apiKey,
|
|
251
|
+
endpoint,
|
|
234
252
|
apiUrl,
|
|
235
253
|
workspacesApiUrl,
|
|
236
254
|
trace,
|
|
@@ -241,7 +259,7 @@ async function fetch$1({
|
|
|
241
259
|
return trace(
|
|
242
260
|
`${method.toUpperCase()} ${path}`,
|
|
243
261
|
async ({ setAttributes }) => {
|
|
244
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
|
262
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
|
245
263
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
|
246
264
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
|
247
265
|
setAttributes({
|
|
@@ -296,415 +314,359 @@ function parseUrl(url) {
|
|
|
296
314
|
}
|
|
297
315
|
}
|
|
298
316
|
|
|
299
|
-
const
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
...variables,
|
|
304
|
-
signal
|
|
305
|
-
});
|
|
306
|
-
const deleteUser = (variables, signal) => fetch$1({ url: "/user", method: "delete", ...variables, signal });
|
|
307
|
-
const getUserAPIKeys = (variables, signal) => fetch$1({
|
|
308
|
-
url: "/user/keys",
|
|
317
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
|
318
|
+
|
|
319
|
+
const getDatabaseList = (variables, signal) => dataPlaneFetch({
|
|
320
|
+
url: "/dbs",
|
|
309
321
|
method: "get",
|
|
310
322
|
...variables,
|
|
311
323
|
signal
|
|
312
324
|
});
|
|
313
|
-
const
|
|
314
|
-
url: "/
|
|
315
|
-
method: "
|
|
325
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
|
326
|
+
url: "/dbs/{dbName}",
|
|
327
|
+
method: "get",
|
|
316
328
|
...variables,
|
|
317
329
|
signal
|
|
318
330
|
});
|
|
319
|
-
const
|
|
320
|
-
|
|
331
|
+
const createDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
|
332
|
+
const deleteDatabase = (variables, signal) => dataPlaneFetch({
|
|
333
|
+
url: "/dbs/{dbName}",
|
|
321
334
|
method: "delete",
|
|
322
335
|
...variables,
|
|
323
336
|
signal
|
|
324
337
|
});
|
|
325
|
-
const
|
|
326
|
-
url: "/
|
|
327
|
-
method: "post",
|
|
328
|
-
...variables,
|
|
329
|
-
signal
|
|
330
|
-
});
|
|
331
|
-
const getWorkspacesList = (variables, signal) => fetch$1({
|
|
332
|
-
url: "/workspaces",
|
|
333
|
-
method: "get",
|
|
334
|
-
...variables,
|
|
335
|
-
signal
|
|
336
|
-
});
|
|
337
|
-
const getWorkspace = (variables, signal) => fetch$1({
|
|
338
|
-
url: "/workspaces/{workspaceId}",
|
|
338
|
+
const getDatabaseMetadata = (variables, signal) => dataPlaneFetch({
|
|
339
|
+
url: "/dbs/{dbName}/metadata",
|
|
339
340
|
method: "get",
|
|
340
341
|
...variables,
|
|
341
342
|
signal
|
|
342
343
|
});
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
...variables,
|
|
347
|
-
signal
|
|
348
|
-
});
|
|
349
|
-
const deleteWorkspace = (variables, signal) => fetch$1({
|
|
350
|
-
url: "/workspaces/{workspaceId}",
|
|
351
|
-
method: "delete",
|
|
352
|
-
...variables,
|
|
353
|
-
signal
|
|
354
|
-
});
|
|
355
|
-
const getWorkspaceMembersList = (variables, signal) => fetch$1({
|
|
356
|
-
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}",
|
|
357
347
|
method: "get",
|
|
358
348
|
...variables,
|
|
359
349
|
signal
|
|
360
350
|
});
|
|
361
|
-
const
|
|
362
|
-
const
|
|
363
|
-
url: "/
|
|
351
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
|
352
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
|
353
|
+
url: "/db/{dbBranchName}",
|
|
364
354
|
method: "delete",
|
|
365
355
|
...variables,
|
|
366
356
|
signal
|
|
367
357
|
});
|
|
368
|
-
const
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
|
372
|
-
method: "delete",
|
|
358
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
|
359
|
+
url: "/db/{dbBranchName}/metadata",
|
|
360
|
+
method: "put",
|
|
373
361
|
...variables,
|
|
374
362
|
signal
|
|
375
363
|
});
|
|
376
|
-
const
|
|
377
|
-
url: "/
|
|
378
|
-
method: "
|
|
364
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
|
365
|
+
url: "/db/{dbBranchName}/metadata",
|
|
366
|
+
method: "get",
|
|
379
367
|
...variables,
|
|
380
368
|
signal
|
|
381
369
|
});
|
|
382
|
-
const
|
|
383
|
-
url: "/
|
|
384
|
-
method: "
|
|
370
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
371
|
+
url: "/db/{dbBranchName}/stats",
|
|
372
|
+
method: "get",
|
|
385
373
|
...variables,
|
|
386
374
|
signal
|
|
387
375
|
});
|
|
388
|
-
const
|
|
389
|
-
|
|
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}",
|
|
390
387
|
method: "get",
|
|
391
388
|
...variables,
|
|
392
389
|
signal
|
|
393
390
|
});
|
|
394
|
-
const
|
|
395
|
-
|
|
396
|
-
|
|
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",
|
|
397
398
|
...variables,
|
|
398
399
|
signal
|
|
399
400
|
});
|
|
400
|
-
const
|
|
401
|
-
|
|
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}",
|
|
402
409
|
method: "put",
|
|
403
410
|
...variables,
|
|
404
411
|
signal
|
|
405
412
|
});
|
|
406
|
-
const
|
|
407
|
-
url: "/
|
|
413
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
414
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
|
408
415
|
method: "delete",
|
|
409
416
|
...variables,
|
|
410
417
|
signal
|
|
411
418
|
});
|
|
412
|
-
const
|
|
413
|
-
|
|
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",
|
|
414
422
|
method: "get",
|
|
415
423
|
...variables,
|
|
416
424
|
signal
|
|
417
425
|
});
|
|
418
|
-
const
|
|
419
|
-
const
|
|
420
|
-
|
|
421
|
-
const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
|
422
|
-
const resolveBranch = (variables, signal) => fetch$1({
|
|
423
|
-
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",
|
|
424
429
|
method: "get",
|
|
425
430
|
...variables,
|
|
426
431
|
signal
|
|
427
432
|
});
|
|
428
|
-
const
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
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}",
|
|
432
438
|
method: "get",
|
|
433
439
|
...variables,
|
|
434
440
|
signal
|
|
435
441
|
});
|
|
436
|
-
const
|
|
437
|
-
const
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
const mergeMigrationRequest = (variables, signal) => fetch$1({
|
|
441
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
|
442
|
-
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",
|
|
443
446
|
...variables,
|
|
444
447
|
signal
|
|
445
448
|
});
|
|
446
|
-
const
|
|
447
|
-
|
|
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}",
|
|
448
452
|
method: "get",
|
|
449
453
|
...variables,
|
|
450
454
|
signal
|
|
451
455
|
});
|
|
452
|
-
const
|
|
453
|
-
const
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
url: "/db/{dbBranchName}/metadata",
|
|
461
|
-
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",
|
|
462
464
|
...variables,
|
|
463
465
|
signal
|
|
464
466
|
});
|
|
465
|
-
const
|
|
466
|
-
url: "/db/{dbBranchName}/
|
|
467
|
-
method: "
|
|
467
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
|
468
|
+
url: "/db/{dbBranchName}/search",
|
|
469
|
+
method: "post",
|
|
468
470
|
...variables,
|
|
469
471
|
signal
|
|
470
472
|
});
|
|
471
|
-
const
|
|
472
|
-
|
|
473
|
-
const getBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
|
474
|
-
const compareBranchWithUserSchema = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
|
475
|
-
const compareBranchSchemas = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
|
476
|
-
const updateBranchSchema = (variables, signal) => fetch$1({
|
|
477
|
-
url: "/db/{dbBranchName}/schema/update",
|
|
473
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
|
474
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
|
478
475
|
method: "post",
|
|
479
476
|
...variables,
|
|
480
477
|
signal
|
|
481
478
|
});
|
|
482
|
-
const
|
|
483
|
-
const
|
|
484
|
-
const
|
|
485
|
-
|
|
486
|
-
|
|
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",
|
|
487
545
|
method: "get",
|
|
488
546
|
...variables,
|
|
489
547
|
signal
|
|
490
548
|
});
|
|
491
|
-
const
|
|
492
|
-
url: "/
|
|
549
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
|
550
|
+
url: "/user",
|
|
493
551
|
method: "put",
|
|
494
552
|
...variables,
|
|
495
553
|
signal
|
|
496
554
|
});
|
|
497
|
-
const
|
|
498
|
-
url: "/
|
|
555
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
|
556
|
+
url: "/user",
|
|
499
557
|
method: "delete",
|
|
500
558
|
...variables,
|
|
501
559
|
signal
|
|
502
560
|
});
|
|
503
|
-
const
|
|
504
|
-
url: "/
|
|
505
|
-
method: "patch",
|
|
506
|
-
...variables,
|
|
507
|
-
signal
|
|
508
|
-
});
|
|
509
|
-
const getTableSchema = (variables, signal) => fetch$1({
|
|
510
|
-
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
|
511
|
-
method: "get",
|
|
512
|
-
...variables,
|
|
513
|
-
signal
|
|
514
|
-
});
|
|
515
|
-
const setTableSchema = (variables, signal) => fetch$1({
|
|
516
|
-
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
|
517
|
-
method: "put",
|
|
518
|
-
...variables,
|
|
519
|
-
signal
|
|
520
|
-
});
|
|
521
|
-
const getTableColumns = (variables, signal) => fetch$1({
|
|
522
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
|
561
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
|
562
|
+
url: "/user/keys",
|
|
523
563
|
method: "get",
|
|
524
564
|
...variables,
|
|
525
565
|
signal
|
|
526
566
|
});
|
|
527
|
-
const
|
|
528
|
-
url: "/
|
|
567
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
|
568
|
+
url: "/user/keys/{keyName}",
|
|
529
569
|
method: "post",
|
|
530
570
|
...variables,
|
|
531
571
|
signal
|
|
532
572
|
});
|
|
533
|
-
const
|
|
534
|
-
url: "/
|
|
535
|
-
method: "get",
|
|
536
|
-
...variables,
|
|
537
|
-
signal
|
|
538
|
-
});
|
|
539
|
-
const deleteColumn = (variables, signal) => fetch$1({
|
|
540
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
|
541
|
-
method: "delete",
|
|
542
|
-
...variables,
|
|
543
|
-
signal
|
|
544
|
-
});
|
|
545
|
-
const updateColumn = (variables, signal) => fetch$1({
|
|
546
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
|
547
|
-
method: "patch",
|
|
548
|
-
...variables,
|
|
549
|
-
signal
|
|
550
|
-
});
|
|
551
|
-
const insertRecord = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
|
552
|
-
const insertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
|
553
|
-
const updateRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
|
554
|
-
const upsertRecordWithID = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
|
555
|
-
const deleteRecord = (variables, signal) => fetch$1({
|
|
556
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
|
573
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
|
574
|
+
url: "/user/keys/{keyName}",
|
|
557
575
|
method: "delete",
|
|
558
576
|
...variables,
|
|
559
577
|
signal
|
|
560
578
|
});
|
|
561
|
-
const
|
|
562
|
-
url: "/
|
|
579
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
|
580
|
+
url: "/workspaces",
|
|
563
581
|
method: "get",
|
|
564
582
|
...variables,
|
|
565
583
|
signal
|
|
566
584
|
});
|
|
567
|
-
const
|
|
568
|
-
|
|
569
|
-
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
|
585
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
|
586
|
+
url: "/workspaces",
|
|
570
587
|
method: "post",
|
|
571
588
|
...variables,
|
|
572
589
|
signal
|
|
573
590
|
});
|
|
574
|
-
const
|
|
575
|
-
url: "/
|
|
576
|
-
method: "
|
|
591
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
|
592
|
+
url: "/workspaces/{workspaceId}",
|
|
593
|
+
method: "get",
|
|
577
594
|
...variables,
|
|
578
595
|
signal
|
|
579
596
|
});
|
|
580
|
-
const
|
|
581
|
-
url: "/
|
|
582
|
-
method: "
|
|
597
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
|
598
|
+
url: "/workspaces/{workspaceId}",
|
|
599
|
+
method: "put",
|
|
583
600
|
...variables,
|
|
584
601
|
signal
|
|
585
602
|
});
|
|
586
|
-
const
|
|
587
|
-
url: "/
|
|
588
|
-
method: "
|
|
603
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
604
|
+
url: "/workspaces/{workspaceId}",
|
|
605
|
+
method: "delete",
|
|
589
606
|
...variables,
|
|
590
607
|
signal
|
|
591
608
|
});
|
|
592
|
-
const
|
|
593
|
-
|
|
594
|
-
|
|
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",
|
|
595
614
|
...variables,
|
|
596
615
|
signal
|
|
597
616
|
});
|
|
598
|
-
const
|
|
599
|
-
|
|
600
|
-
|
|
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",
|
|
601
627
|
...variables,
|
|
602
628
|
signal
|
|
603
629
|
});
|
|
604
|
-
const
|
|
605
|
-
const
|
|
606
|
-
|
|
607
|
-
|
|
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",
|
|
608
635
|
...variables,
|
|
609
636
|
signal
|
|
610
637
|
});
|
|
611
|
-
const
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
const cPUpdateCPDatabaseMetadata = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
|
615
|
-
const operationsByTag = {
|
|
616
|
-
users: { getUser, updateUser, deleteUser, getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
|
638
|
+
const operationsByTag$1 = {
|
|
639
|
+
users: { getUser, updateUser, deleteUser },
|
|
640
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
|
617
641
|
workspaces: {
|
|
618
|
-
createWorkspace,
|
|
619
642
|
getWorkspacesList,
|
|
643
|
+
createWorkspace,
|
|
620
644
|
getWorkspace,
|
|
621
645
|
updateWorkspace,
|
|
622
646
|
deleteWorkspace,
|
|
623
647
|
getWorkspaceMembersList,
|
|
624
648
|
updateWorkspaceMemberRole,
|
|
625
|
-
removeWorkspaceMember
|
|
649
|
+
removeWorkspaceMember
|
|
650
|
+
},
|
|
651
|
+
invites: {
|
|
626
652
|
inviteWorkspaceMember,
|
|
627
653
|
updateWorkspaceMemberInvite,
|
|
628
654
|
cancelWorkspaceMemberInvite,
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
},
|
|
632
|
-
database: {
|
|
633
|
-
getDatabaseList,
|
|
634
|
-
createDatabase,
|
|
635
|
-
deleteDatabase,
|
|
636
|
-
getDatabaseMetadata,
|
|
637
|
-
updateDatabaseMetadata,
|
|
638
|
-
getGitBranchesMapping,
|
|
639
|
-
addGitBranchesEntry,
|
|
640
|
-
removeGitBranchesEntry,
|
|
641
|
-
resolveBranch
|
|
642
|
-
},
|
|
643
|
-
branch: {
|
|
644
|
-
getBranchList,
|
|
645
|
-
getBranchDetails,
|
|
646
|
-
createBranch,
|
|
647
|
-
deleteBranch,
|
|
648
|
-
updateBranchMetadata,
|
|
649
|
-
getBranchMetadata,
|
|
650
|
-
getBranchStats
|
|
651
|
-
},
|
|
652
|
-
migrationRequests: {
|
|
653
|
-
queryMigrationRequests,
|
|
654
|
-
createMigrationRequest,
|
|
655
|
-
getMigrationRequest,
|
|
656
|
-
updateMigrationRequest,
|
|
657
|
-
listMigrationRequestsCommits,
|
|
658
|
-
compareMigrationRequest,
|
|
659
|
-
getMigrationRequestIsMerged,
|
|
660
|
-
mergeMigrationRequest
|
|
661
|
-
},
|
|
662
|
-
branchSchema: {
|
|
663
|
-
getBranchMigrationHistory,
|
|
664
|
-
executeBranchMigrationPlan,
|
|
665
|
-
getBranchMigrationPlan,
|
|
666
|
-
compareBranchWithUserSchema,
|
|
667
|
-
compareBranchSchemas,
|
|
668
|
-
updateBranchSchema,
|
|
669
|
-
previewBranchSchemaEdit,
|
|
670
|
-
applyBranchSchemaEdit,
|
|
671
|
-
getBranchSchemaHistory
|
|
672
|
-
},
|
|
673
|
-
table: {
|
|
674
|
-
createTable,
|
|
675
|
-
deleteTable,
|
|
676
|
-
updateTable,
|
|
677
|
-
getTableSchema,
|
|
678
|
-
setTableSchema,
|
|
679
|
-
getTableColumns,
|
|
680
|
-
addTableColumn,
|
|
681
|
-
getColumn,
|
|
682
|
-
deleteColumn,
|
|
683
|
-
updateColumn
|
|
684
|
-
},
|
|
685
|
-
records: {
|
|
686
|
-
insertRecord,
|
|
687
|
-
insertRecordWithID,
|
|
688
|
-
updateRecordWithID,
|
|
689
|
-
upsertRecordWithID,
|
|
690
|
-
deleteRecord,
|
|
691
|
-
getRecord,
|
|
692
|
-
bulkInsertTableRecords,
|
|
693
|
-
queryTable,
|
|
694
|
-
searchTable,
|
|
695
|
-
searchBranch,
|
|
696
|
-
summarizeTable,
|
|
697
|
-
aggregateTable
|
|
655
|
+
acceptWorkspaceMemberInvite,
|
|
656
|
+
resendWorkspaceMemberInvite
|
|
698
657
|
},
|
|
699
658
|
databases: {
|
|
700
659
|
cPGetDatabaseList,
|
|
701
660
|
cPCreateDatabase,
|
|
702
661
|
cPDeleteDatabase,
|
|
703
662
|
cPGetCPDatabaseMetadata,
|
|
704
|
-
cPUpdateCPDatabaseMetadata
|
|
663
|
+
cPUpdateCPDatabaseMetadata,
|
|
664
|
+
listRegions
|
|
705
665
|
}
|
|
706
666
|
};
|
|
707
667
|
|
|
668
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
|
669
|
+
|
|
708
670
|
function getHostUrl(provider, type) {
|
|
709
671
|
if (isHostProviderAlias(provider)) {
|
|
710
672
|
return providers[provider][type];
|
|
@@ -716,11 +678,11 @@ function getHostUrl(provider, type) {
|
|
|
716
678
|
const providers = {
|
|
717
679
|
production: {
|
|
718
680
|
main: "https://api.xata.io",
|
|
719
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
|
681
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
|
720
682
|
},
|
|
721
683
|
staging: {
|
|
722
684
|
main: "https://staging.xatabase.co",
|
|
723
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
|
685
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
|
724
686
|
}
|
|
725
687
|
};
|
|
726
688
|
function isHostProviderAlias(alias) {
|
|
@@ -736,7 +698,17 @@ function parseProviderString(provider = "production") {
|
|
|
736
698
|
const [main, workspaces] = provider.split(",");
|
|
737
699
|
if (!main || !workspaces)
|
|
738
700
|
return null;
|
|
739
|
-
return { main, workspaces };
|
|
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" };
|
|
740
712
|
}
|
|
741
713
|
|
|
742
714
|
var __accessCheck$7 = (obj, member, msg) => {
|
|
@@ -781,21 +753,41 @@ class XataApiClient {
|
|
|
781
753
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
|
782
754
|
return __privateGet$7(this, _namespaces).user;
|
|
783
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
|
+
}
|
|
784
761
|
get workspaces() {
|
|
785
762
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
|
786
763
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
|
787
764
|
return __privateGet$7(this, _namespaces).workspaces;
|
|
788
765
|
}
|
|
789
|
-
get
|
|
790
|
-
if (!__privateGet$7(this, _namespaces).
|
|
791
|
-
__privateGet$7(this, _namespaces).
|
|
792
|
-
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;
|
|
793
775
|
}
|
|
794
776
|
get branches() {
|
|
795
777
|
if (!__privateGet$7(this, _namespaces).branches)
|
|
796
778
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
|
797
779
|
return __privateGet$7(this, _namespaces).branches;
|
|
798
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
|
+
}
|
|
799
791
|
get tables() {
|
|
800
792
|
if (!__privateGet$7(this, _namespaces).tables)
|
|
801
793
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
|
@@ -806,15 +798,10 @@ class XataApiClient {
|
|
|
806
798
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
|
807
799
|
return __privateGet$7(this, _namespaces).records;
|
|
808
800
|
}
|
|
809
|
-
get
|
|
810
|
-
if (!__privateGet$7(this, _namespaces).
|
|
811
|
-
__privateGet$7(this, _namespaces).
|
|
812
|
-
return __privateGet$7(this, _namespaces).
|
|
813
|
-
}
|
|
814
|
-
get branchSchema() {
|
|
815
|
-
if (!__privateGet$7(this, _namespaces).branchSchema)
|
|
816
|
-
__privateGet$7(this, _namespaces).branchSchema = new BranchSchemaApi(__privateGet$7(this, _extraProps));
|
|
817
|
-
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;
|
|
818
805
|
}
|
|
819
806
|
}
|
|
820
807
|
_extraProps = new WeakMap();
|
|
@@ -826,24 +813,29 @@ class UserApi {
|
|
|
826
813
|
getUser() {
|
|
827
814
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
|
828
815
|
}
|
|
829
|
-
updateUser(user) {
|
|
816
|
+
updateUser({ user }) {
|
|
830
817
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
|
831
818
|
}
|
|
832
819
|
deleteUser() {
|
|
833
820
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
|
834
821
|
}
|
|
822
|
+
}
|
|
823
|
+
class AuthenticationApi {
|
|
824
|
+
constructor(extraProps) {
|
|
825
|
+
this.extraProps = extraProps;
|
|
826
|
+
}
|
|
835
827
|
getUserAPIKeys() {
|
|
836
|
-
return operationsByTag.
|
|
828
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
|
837
829
|
}
|
|
838
|
-
createUserAPIKey(
|
|
839
|
-
return operationsByTag.
|
|
840
|
-
pathParams: { keyName },
|
|
830
|
+
createUserAPIKey({ name }) {
|
|
831
|
+
return operationsByTag.authentication.createUserAPIKey({
|
|
832
|
+
pathParams: { keyName: name },
|
|
841
833
|
...this.extraProps
|
|
842
834
|
});
|
|
843
835
|
}
|
|
844
|
-
deleteUserAPIKey(
|
|
845
|
-
return operationsByTag.
|
|
846
|
-
pathParams: { keyName },
|
|
836
|
+
deleteUserAPIKey({ name }) {
|
|
837
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
|
838
|
+
pathParams: { keyName: name },
|
|
847
839
|
...this.extraProps
|
|
848
840
|
});
|
|
849
841
|
}
|
|
@@ -852,196 +844,248 @@ class WorkspaceApi {
|
|
|
852
844
|
constructor(extraProps) {
|
|
853
845
|
this.extraProps = extraProps;
|
|
854
846
|
}
|
|
855
|
-
|
|
847
|
+
getWorkspacesList() {
|
|
848
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
|
849
|
+
}
|
|
850
|
+
createWorkspace({ data }) {
|
|
856
851
|
return operationsByTag.workspaces.createWorkspace({
|
|
857
|
-
body:
|
|
852
|
+
body: data,
|
|
858
853
|
...this.extraProps
|
|
859
854
|
});
|
|
860
855
|
}
|
|
861
|
-
|
|
862
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
|
863
|
-
}
|
|
864
|
-
getWorkspace(workspaceId) {
|
|
856
|
+
getWorkspace({ workspace }) {
|
|
865
857
|
return operationsByTag.workspaces.getWorkspace({
|
|
866
|
-
pathParams: { workspaceId },
|
|
858
|
+
pathParams: { workspaceId: workspace },
|
|
867
859
|
...this.extraProps
|
|
868
860
|
});
|
|
869
861
|
}
|
|
870
|
-
updateWorkspace(
|
|
862
|
+
updateWorkspace({
|
|
863
|
+
workspace,
|
|
864
|
+
update
|
|
865
|
+
}) {
|
|
871
866
|
return operationsByTag.workspaces.updateWorkspace({
|
|
872
|
-
pathParams: { workspaceId },
|
|
873
|
-
body:
|
|
867
|
+
pathParams: { workspaceId: workspace },
|
|
868
|
+
body: update,
|
|
874
869
|
...this.extraProps
|
|
875
870
|
});
|
|
876
871
|
}
|
|
877
|
-
deleteWorkspace(
|
|
872
|
+
deleteWorkspace({ workspace }) {
|
|
878
873
|
return operationsByTag.workspaces.deleteWorkspace({
|
|
879
|
-
pathParams: { workspaceId },
|
|
874
|
+
pathParams: { workspaceId: workspace },
|
|
880
875
|
...this.extraProps
|
|
881
876
|
});
|
|
882
877
|
}
|
|
883
|
-
getWorkspaceMembersList(
|
|
878
|
+
getWorkspaceMembersList({ workspace }) {
|
|
884
879
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
|
885
|
-
pathParams: { workspaceId },
|
|
880
|
+
pathParams: { workspaceId: workspace },
|
|
886
881
|
...this.extraProps
|
|
887
882
|
});
|
|
888
883
|
}
|
|
889
|
-
updateWorkspaceMemberRole(
|
|
884
|
+
updateWorkspaceMemberRole({
|
|
885
|
+
workspace,
|
|
886
|
+
user,
|
|
887
|
+
role
|
|
888
|
+
}) {
|
|
890
889
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
|
891
|
-
pathParams: { workspaceId, userId },
|
|
890
|
+
pathParams: { workspaceId: workspace, userId: user },
|
|
892
891
|
body: { role },
|
|
893
892
|
...this.extraProps
|
|
894
893
|
});
|
|
895
894
|
}
|
|
896
|
-
removeWorkspaceMember(
|
|
895
|
+
removeWorkspaceMember({
|
|
896
|
+
workspace,
|
|
897
|
+
user
|
|
898
|
+
}) {
|
|
897
899
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
|
898
|
-
pathParams: { workspaceId, userId },
|
|
900
|
+
pathParams: { workspaceId: workspace, userId: user },
|
|
899
901
|
...this.extraProps
|
|
900
902
|
});
|
|
901
903
|
}
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
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 },
|
|
905
916
|
body: { email, role },
|
|
906
917
|
...this.extraProps
|
|
907
918
|
});
|
|
908
919
|
}
|
|
909
|
-
updateWorkspaceMemberInvite(
|
|
910
|
-
|
|
911
|
-
|
|
920
|
+
updateWorkspaceMemberInvite({
|
|
921
|
+
workspace,
|
|
922
|
+
invite,
|
|
923
|
+
role
|
|
924
|
+
}) {
|
|
925
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
|
926
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
|
912
927
|
body: { role },
|
|
913
928
|
...this.extraProps
|
|
914
929
|
});
|
|
915
930
|
}
|
|
916
|
-
cancelWorkspaceMemberInvite(
|
|
917
|
-
|
|
918
|
-
|
|
931
|
+
cancelWorkspaceMemberInvite({
|
|
932
|
+
workspace,
|
|
933
|
+
invite
|
|
934
|
+
}) {
|
|
935
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
|
936
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
|
919
937
|
...this.extraProps
|
|
920
938
|
});
|
|
921
939
|
}
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
940
|
+
acceptWorkspaceMemberInvite({
|
|
941
|
+
workspace,
|
|
942
|
+
key
|
|
943
|
+
}) {
|
|
944
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
|
945
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
|
925
946
|
...this.extraProps
|
|
926
947
|
});
|
|
927
948
|
}
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
949
|
+
resendWorkspaceMemberInvite({
|
|
950
|
+
workspace,
|
|
951
|
+
invite
|
|
952
|
+
}) {
|
|
953
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
|
954
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
|
931
955
|
...this.extraProps
|
|
932
956
|
});
|
|
933
957
|
}
|
|
934
958
|
}
|
|
935
|
-
class
|
|
959
|
+
class BranchApi {
|
|
936
960
|
constructor(extraProps) {
|
|
937
961
|
this.extraProps = extraProps;
|
|
938
962
|
}
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
return operationsByTag.database.createDatabase({
|
|
947
|
-
pathParams: { workspace, dbName },
|
|
948
|
-
body: options,
|
|
949
|
-
...this.extraProps
|
|
950
|
-
});
|
|
951
|
-
}
|
|
952
|
-
deleteDatabase(workspace, dbName) {
|
|
953
|
-
return operationsByTag.database.deleteDatabase({
|
|
954
|
-
pathParams: { workspace, dbName },
|
|
955
|
-
...this.extraProps
|
|
956
|
-
});
|
|
957
|
-
}
|
|
958
|
-
getDatabaseMetadata(workspace, dbName) {
|
|
959
|
-
return operationsByTag.database.getDatabaseMetadata({
|
|
960
|
-
pathParams: { workspace, dbName },
|
|
961
|
-
...this.extraProps
|
|
962
|
-
});
|
|
963
|
-
}
|
|
964
|
-
updateDatabaseMetadata(workspace, dbName, options = {}) {
|
|
965
|
-
return operationsByTag.database.updateDatabaseMetadata({
|
|
966
|
-
pathParams: { workspace, dbName },
|
|
967
|
-
body: options,
|
|
968
|
-
...this.extraProps
|
|
969
|
-
});
|
|
970
|
-
}
|
|
971
|
-
getGitBranchesMapping(workspace, dbName) {
|
|
972
|
-
return operationsByTag.database.getGitBranchesMapping({
|
|
973
|
-
pathParams: { workspace, dbName },
|
|
963
|
+
getBranchList({
|
|
964
|
+
workspace,
|
|
965
|
+
region,
|
|
966
|
+
database
|
|
967
|
+
}) {
|
|
968
|
+
return operationsByTag.branch.getBranchList({
|
|
969
|
+
pathParams: { workspace, region, dbName: database },
|
|
974
970
|
...this.extraProps
|
|
975
971
|
});
|
|
976
972
|
}
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
973
|
+
getBranchDetails({
|
|
974
|
+
workspace,
|
|
975
|
+
region,
|
|
976
|
+
database,
|
|
977
|
+
branch
|
|
978
|
+
}) {
|
|
979
|
+
return operationsByTag.branch.getBranchDetails({
|
|
980
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
981
981
|
...this.extraProps
|
|
982
982
|
});
|
|
983
983
|
}
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
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 },
|
|
988
995
|
...this.extraProps
|
|
989
996
|
});
|
|
990
997
|
}
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
998
|
+
deleteBranch({
|
|
999
|
+
workspace,
|
|
1000
|
+
region,
|
|
1001
|
+
database,
|
|
1002
|
+
branch
|
|
1003
|
+
}) {
|
|
1004
|
+
return operationsByTag.branch.deleteBranch({
|
|
1005
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
995
1006
|
...this.extraProps
|
|
996
1007
|
});
|
|
997
1008
|
}
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
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,
|
|
1006
1019
|
...this.extraProps
|
|
1007
1020
|
});
|
|
1008
1021
|
}
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1022
|
+
getBranchMetadata({
|
|
1023
|
+
workspace,
|
|
1024
|
+
region,
|
|
1025
|
+
database,
|
|
1026
|
+
branch
|
|
1027
|
+
}) {
|
|
1028
|
+
return operationsByTag.branch.getBranchMetadata({
|
|
1029
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1012
1030
|
...this.extraProps
|
|
1013
1031
|
});
|
|
1014
1032
|
}
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1033
|
+
getBranchStats({
|
|
1034
|
+
workspace,
|
|
1035
|
+
region,
|
|
1036
|
+
database,
|
|
1037
|
+
branch
|
|
1038
|
+
}) {
|
|
1039
|
+
return operationsByTag.branch.getBranchStats({
|
|
1040
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1020
1041
|
...this.extraProps
|
|
1021
1042
|
});
|
|
1022
1043
|
}
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1044
|
+
getGitBranchesMapping({
|
|
1045
|
+
workspace,
|
|
1046
|
+
region,
|
|
1047
|
+
database
|
|
1048
|
+
}) {
|
|
1049
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
|
1050
|
+
pathParams: { workspace, region, dbName: database },
|
|
1026
1051
|
...this.extraProps
|
|
1027
1052
|
});
|
|
1028
1053
|
}
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
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 },
|
|
1033
1064
|
...this.extraProps
|
|
1034
1065
|
});
|
|
1035
1066
|
}
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
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 },
|
|
1039
1076
|
...this.extraProps
|
|
1040
1077
|
});
|
|
1041
1078
|
}
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
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 },
|
|
1045
1089
|
...this.extraProps
|
|
1046
1090
|
});
|
|
1047
1091
|
}
|
|
@@ -1050,67 +1094,134 @@ class TableApi {
|
|
|
1050
1094
|
constructor(extraProps) {
|
|
1051
1095
|
this.extraProps = extraProps;
|
|
1052
1096
|
}
|
|
1053
|
-
createTable(
|
|
1097
|
+
createTable({
|
|
1098
|
+
workspace,
|
|
1099
|
+
region,
|
|
1100
|
+
database,
|
|
1101
|
+
branch,
|
|
1102
|
+
table
|
|
1103
|
+
}) {
|
|
1054
1104
|
return operationsByTag.table.createTable({
|
|
1055
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1105
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1056
1106
|
...this.extraProps
|
|
1057
1107
|
});
|
|
1058
1108
|
}
|
|
1059
|
-
deleteTable(
|
|
1109
|
+
deleteTable({
|
|
1110
|
+
workspace,
|
|
1111
|
+
region,
|
|
1112
|
+
database,
|
|
1113
|
+
branch,
|
|
1114
|
+
table
|
|
1115
|
+
}) {
|
|
1060
1116
|
return operationsByTag.table.deleteTable({
|
|
1061
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1117
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1062
1118
|
...this.extraProps
|
|
1063
1119
|
});
|
|
1064
1120
|
}
|
|
1065
|
-
updateTable(
|
|
1121
|
+
updateTable({
|
|
1122
|
+
workspace,
|
|
1123
|
+
region,
|
|
1124
|
+
database,
|
|
1125
|
+
branch,
|
|
1126
|
+
table,
|
|
1127
|
+
update
|
|
1128
|
+
}) {
|
|
1066
1129
|
return operationsByTag.table.updateTable({
|
|
1067
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1068
|
-
body:
|
|
1130
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1131
|
+
body: update,
|
|
1069
1132
|
...this.extraProps
|
|
1070
1133
|
});
|
|
1071
1134
|
}
|
|
1072
|
-
getTableSchema(
|
|
1135
|
+
getTableSchema({
|
|
1136
|
+
workspace,
|
|
1137
|
+
region,
|
|
1138
|
+
database,
|
|
1139
|
+
branch,
|
|
1140
|
+
table
|
|
1141
|
+
}) {
|
|
1073
1142
|
return operationsByTag.table.getTableSchema({
|
|
1074
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1143
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1075
1144
|
...this.extraProps
|
|
1076
1145
|
});
|
|
1077
1146
|
}
|
|
1078
|
-
setTableSchema(
|
|
1147
|
+
setTableSchema({
|
|
1148
|
+
workspace,
|
|
1149
|
+
region,
|
|
1150
|
+
database,
|
|
1151
|
+
branch,
|
|
1152
|
+
table,
|
|
1153
|
+
schema
|
|
1154
|
+
}) {
|
|
1079
1155
|
return operationsByTag.table.setTableSchema({
|
|
1080
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1081
|
-
body:
|
|
1156
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1157
|
+
body: schema,
|
|
1082
1158
|
...this.extraProps
|
|
1083
1159
|
});
|
|
1084
1160
|
}
|
|
1085
|
-
getTableColumns(
|
|
1161
|
+
getTableColumns({
|
|
1162
|
+
workspace,
|
|
1163
|
+
region,
|
|
1164
|
+
database,
|
|
1165
|
+
branch,
|
|
1166
|
+
table
|
|
1167
|
+
}) {
|
|
1086
1168
|
return operationsByTag.table.getTableColumns({
|
|
1087
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1169
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1088
1170
|
...this.extraProps
|
|
1089
1171
|
});
|
|
1090
1172
|
}
|
|
1091
|
-
addTableColumn(
|
|
1173
|
+
addTableColumn({
|
|
1174
|
+
workspace,
|
|
1175
|
+
region,
|
|
1176
|
+
database,
|
|
1177
|
+
branch,
|
|
1178
|
+
table,
|
|
1179
|
+
column
|
|
1180
|
+
}) {
|
|
1092
1181
|
return operationsByTag.table.addTableColumn({
|
|
1093
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1182
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1094
1183
|
body: column,
|
|
1095
1184
|
...this.extraProps
|
|
1096
1185
|
});
|
|
1097
1186
|
}
|
|
1098
|
-
getColumn(
|
|
1187
|
+
getColumn({
|
|
1188
|
+
workspace,
|
|
1189
|
+
region,
|
|
1190
|
+
database,
|
|
1191
|
+
branch,
|
|
1192
|
+
table,
|
|
1193
|
+
column
|
|
1194
|
+
}) {
|
|
1099
1195
|
return operationsByTag.table.getColumn({
|
|
1100
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
|
1196
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
|
1101
1197
|
...this.extraProps
|
|
1102
1198
|
});
|
|
1103
1199
|
}
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
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,
|
|
1107
1212
|
...this.extraProps
|
|
1108
1213
|
});
|
|
1109
1214
|
}
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
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 },
|
|
1114
1225
|
...this.extraProps
|
|
1115
1226
|
});
|
|
1116
1227
|
}
|
|
@@ -1119,92 +1230,213 @@ class RecordsApi {
|
|
|
1119
1230
|
constructor(extraProps) {
|
|
1120
1231
|
this.extraProps = extraProps;
|
|
1121
1232
|
}
|
|
1122
|
-
insertRecord(
|
|
1233
|
+
insertRecord({
|
|
1234
|
+
workspace,
|
|
1235
|
+
region,
|
|
1236
|
+
database,
|
|
1237
|
+
branch,
|
|
1238
|
+
table,
|
|
1239
|
+
record,
|
|
1240
|
+
columns
|
|
1241
|
+
}) {
|
|
1123
1242
|
return operationsByTag.records.insertRecord({
|
|
1124
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1125
|
-
queryParams:
|
|
1243
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1244
|
+
queryParams: { columns },
|
|
1126
1245
|
body: record,
|
|
1127
1246
|
...this.extraProps
|
|
1128
1247
|
});
|
|
1129
1248
|
}
|
|
1130
|
-
|
|
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
|
+
}) {
|
|
1131
1276
|
return operationsByTag.records.insertRecordWithID({
|
|
1132
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1133
|
-
queryParams:
|
|
1277
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1278
|
+
queryParams: { columns, createOnly, ifVersion },
|
|
1134
1279
|
body: record,
|
|
1135
1280
|
...this.extraProps
|
|
1136
1281
|
});
|
|
1137
1282
|
}
|
|
1138
|
-
updateRecordWithID(
|
|
1283
|
+
updateRecordWithID({
|
|
1284
|
+
workspace,
|
|
1285
|
+
region,
|
|
1286
|
+
database,
|
|
1287
|
+
branch,
|
|
1288
|
+
table,
|
|
1289
|
+
id,
|
|
1290
|
+
record,
|
|
1291
|
+
columns,
|
|
1292
|
+
ifVersion
|
|
1293
|
+
}) {
|
|
1139
1294
|
return operationsByTag.records.updateRecordWithID({
|
|
1140
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1141
|
-
queryParams:
|
|
1295
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1296
|
+
queryParams: { columns, ifVersion },
|
|
1142
1297
|
body: record,
|
|
1143
1298
|
...this.extraProps
|
|
1144
1299
|
});
|
|
1145
1300
|
}
|
|
1146
|
-
upsertRecordWithID(
|
|
1301
|
+
upsertRecordWithID({
|
|
1302
|
+
workspace,
|
|
1303
|
+
region,
|
|
1304
|
+
database,
|
|
1305
|
+
branch,
|
|
1306
|
+
table,
|
|
1307
|
+
id,
|
|
1308
|
+
record,
|
|
1309
|
+
columns,
|
|
1310
|
+
ifVersion
|
|
1311
|
+
}) {
|
|
1147
1312
|
return operationsByTag.records.upsertRecordWithID({
|
|
1148
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1149
|
-
queryParams:
|
|
1313
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1314
|
+
queryParams: { columns, ifVersion },
|
|
1150
1315
|
body: record,
|
|
1151
1316
|
...this.extraProps
|
|
1152
1317
|
});
|
|
1153
1318
|
}
|
|
1154
|
-
deleteRecord(
|
|
1319
|
+
deleteRecord({
|
|
1320
|
+
workspace,
|
|
1321
|
+
region,
|
|
1322
|
+
database,
|
|
1323
|
+
branch,
|
|
1324
|
+
table,
|
|
1325
|
+
id,
|
|
1326
|
+
columns
|
|
1327
|
+
}) {
|
|
1155
1328
|
return operationsByTag.records.deleteRecord({
|
|
1156
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1157
|
-
queryParams:
|
|
1158
|
-
...this.extraProps
|
|
1159
|
-
});
|
|
1160
|
-
}
|
|
1161
|
-
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
|
1162
|
-
return operationsByTag.records.getRecord({
|
|
1163
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1164
|
-
queryParams: options,
|
|
1329
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1330
|
+
queryParams: { columns },
|
|
1165
1331
|
...this.extraProps
|
|
1166
1332
|
});
|
|
1167
1333
|
}
|
|
1168
|
-
bulkInsertTableRecords(
|
|
1334
|
+
bulkInsertTableRecords({
|
|
1335
|
+
workspace,
|
|
1336
|
+
region,
|
|
1337
|
+
database,
|
|
1338
|
+
branch,
|
|
1339
|
+
table,
|
|
1340
|
+
records,
|
|
1341
|
+
columns
|
|
1342
|
+
}) {
|
|
1169
1343
|
return operationsByTag.records.bulkInsertTableRecords({
|
|
1170
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1171
|
-
queryParams:
|
|
1344
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1345
|
+
queryParams: { columns },
|
|
1172
1346
|
body: { records },
|
|
1173
1347
|
...this.extraProps
|
|
1174
1348
|
});
|
|
1175
1349
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1350
|
+
}
|
|
1351
|
+
class SearchAndFilterApi {
|
|
1352
|
+
constructor(extraProps) {
|
|
1353
|
+
this.extraProps = extraProps;
|
|
1354
|
+
}
|
|
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 },
|
|
1180
1369
|
...this.extraProps
|
|
1181
1370
|
});
|
|
1182
1371
|
}
|
|
1183
|
-
searchTable(
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
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 },
|
|
1187
1389
|
...this.extraProps
|
|
1188
1390
|
});
|
|
1189
1391
|
}
|
|
1190
|
-
searchBranch(
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
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 },
|
|
1194
1406
|
...this.extraProps
|
|
1195
1407
|
});
|
|
1196
1408
|
}
|
|
1197
|
-
summarizeTable(
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
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 },
|
|
1201
1425
|
...this.extraProps
|
|
1202
1426
|
});
|
|
1203
1427
|
}
|
|
1204
|
-
aggregateTable(
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
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 },
|
|
1208
1440
|
...this.extraProps
|
|
1209
1441
|
});
|
|
1210
1442
|
}
|
|
@@ -1213,123 +1445,281 @@ class MigrationRequestsApi {
|
|
|
1213
1445
|
constructor(extraProps) {
|
|
1214
1446
|
this.extraProps = extraProps;
|
|
1215
1447
|
}
|
|
1216
|
-
queryMigrationRequests(
|
|
1448
|
+
queryMigrationRequests({
|
|
1449
|
+
workspace,
|
|
1450
|
+
region,
|
|
1451
|
+
database,
|
|
1452
|
+
filter,
|
|
1453
|
+
sort,
|
|
1454
|
+
page,
|
|
1455
|
+
columns
|
|
1456
|
+
}) {
|
|
1217
1457
|
return operationsByTag.migrationRequests.queryMigrationRequests({
|
|
1218
|
-
pathParams: { workspace, dbName: database },
|
|
1219
|
-
body:
|
|
1458
|
+
pathParams: { workspace, region, dbName: database },
|
|
1459
|
+
body: { filter, sort, page, columns },
|
|
1220
1460
|
...this.extraProps
|
|
1221
1461
|
});
|
|
1222
1462
|
}
|
|
1223
|
-
createMigrationRequest(
|
|
1463
|
+
createMigrationRequest({
|
|
1464
|
+
workspace,
|
|
1465
|
+
region,
|
|
1466
|
+
database,
|
|
1467
|
+
migration
|
|
1468
|
+
}) {
|
|
1224
1469
|
return operationsByTag.migrationRequests.createMigrationRequest({
|
|
1225
|
-
pathParams: { workspace, dbName: database },
|
|
1226
|
-
body:
|
|
1470
|
+
pathParams: { workspace, region, dbName: database },
|
|
1471
|
+
body: migration,
|
|
1227
1472
|
...this.extraProps
|
|
1228
1473
|
});
|
|
1229
1474
|
}
|
|
1230
|
-
getMigrationRequest(
|
|
1475
|
+
getMigrationRequest({
|
|
1476
|
+
workspace,
|
|
1477
|
+
region,
|
|
1478
|
+
database,
|
|
1479
|
+
migrationRequest
|
|
1480
|
+
}) {
|
|
1231
1481
|
return operationsByTag.migrationRequests.getMigrationRequest({
|
|
1232
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1482
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1233
1483
|
...this.extraProps
|
|
1234
1484
|
});
|
|
1235
1485
|
}
|
|
1236
|
-
updateMigrationRequest(
|
|
1486
|
+
updateMigrationRequest({
|
|
1487
|
+
workspace,
|
|
1488
|
+
region,
|
|
1489
|
+
database,
|
|
1490
|
+
migrationRequest,
|
|
1491
|
+
update
|
|
1492
|
+
}) {
|
|
1237
1493
|
return operationsByTag.migrationRequests.updateMigrationRequest({
|
|
1238
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1239
|
-
body:
|
|
1494
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1495
|
+
body: update,
|
|
1240
1496
|
...this.extraProps
|
|
1241
1497
|
});
|
|
1242
1498
|
}
|
|
1243
|
-
listMigrationRequestsCommits(
|
|
1499
|
+
listMigrationRequestsCommits({
|
|
1500
|
+
workspace,
|
|
1501
|
+
region,
|
|
1502
|
+
database,
|
|
1503
|
+
migrationRequest,
|
|
1504
|
+
page
|
|
1505
|
+
}) {
|
|
1244
1506
|
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
|
1245
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1246
|
-
body:
|
|
1507
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1508
|
+
body: { page },
|
|
1247
1509
|
...this.extraProps
|
|
1248
1510
|
});
|
|
1249
1511
|
}
|
|
1250
|
-
compareMigrationRequest(
|
|
1512
|
+
compareMigrationRequest({
|
|
1513
|
+
workspace,
|
|
1514
|
+
region,
|
|
1515
|
+
database,
|
|
1516
|
+
migrationRequest
|
|
1517
|
+
}) {
|
|
1251
1518
|
return operationsByTag.migrationRequests.compareMigrationRequest({
|
|
1252
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1519
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1253
1520
|
...this.extraProps
|
|
1254
1521
|
});
|
|
1255
1522
|
}
|
|
1256
|
-
getMigrationRequestIsMerged(
|
|
1523
|
+
getMigrationRequestIsMerged({
|
|
1524
|
+
workspace,
|
|
1525
|
+
region,
|
|
1526
|
+
database,
|
|
1527
|
+
migrationRequest
|
|
1528
|
+
}) {
|
|
1257
1529
|
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
|
1258
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1530
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1259
1531
|
...this.extraProps
|
|
1260
1532
|
});
|
|
1261
1533
|
}
|
|
1262
|
-
mergeMigrationRequest(
|
|
1534
|
+
mergeMigrationRequest({
|
|
1535
|
+
workspace,
|
|
1536
|
+
region,
|
|
1537
|
+
database,
|
|
1538
|
+
migrationRequest
|
|
1539
|
+
}) {
|
|
1263
1540
|
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
|
1264
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1541
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1265
1542
|
...this.extraProps
|
|
1266
1543
|
});
|
|
1267
1544
|
}
|
|
1268
1545
|
}
|
|
1269
|
-
class
|
|
1546
|
+
class MigrationsApi {
|
|
1270
1547
|
constructor(extraProps) {
|
|
1271
1548
|
this.extraProps = extraProps;
|
|
1272
1549
|
}
|
|
1273
|
-
getBranchMigrationHistory(
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
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 },
|
|
1277
1561
|
...this.extraProps
|
|
1278
1562
|
});
|
|
1279
1563
|
}
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
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,
|
|
1284
1574
|
...this.extraProps
|
|
1285
1575
|
});
|
|
1286
1576
|
}
|
|
1287
|
-
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
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,
|
|
1587
|
+
...this.extraProps
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
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 },
|
|
1291
1600
|
...this.extraProps
|
|
1292
1601
|
});
|
|
1293
1602
|
}
|
|
1294
|
-
compareBranchWithUserSchema(
|
|
1295
|
-
|
|
1296
|
-
|
|
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}` },
|
|
1297
1612
|
body: { schema },
|
|
1298
1613
|
...this.extraProps
|
|
1299
1614
|
});
|
|
1300
1615
|
}
|
|
1301
|
-
compareBranchSchemas(
|
|
1302
|
-
|
|
1303
|
-
|
|
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 },
|
|
1304
1626
|
body: { schema },
|
|
1305
1627
|
...this.extraProps
|
|
1306
1628
|
});
|
|
1307
1629
|
}
|
|
1308
|
-
updateBranchSchema(
|
|
1309
|
-
|
|
1310
|
-
|
|
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}` },
|
|
1311
1639
|
body: migration,
|
|
1312
1640
|
...this.extraProps
|
|
1313
1641
|
});
|
|
1314
1642
|
}
|
|
1315
|
-
previewBranchSchemaEdit(
|
|
1316
|
-
|
|
1317
|
-
|
|
1318
|
-
|
|
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,
|
|
1319
1653
|
...this.extraProps
|
|
1320
1654
|
});
|
|
1321
1655
|
}
|
|
1322
|
-
applyBranchSchemaEdit(
|
|
1323
|
-
|
|
1324
|
-
|
|
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}` },
|
|
1325
1665
|
body: { edits },
|
|
1326
1666
|
...this.extraProps
|
|
1327
1667
|
});
|
|
1328
1668
|
}
|
|
1329
|
-
|
|
1330
|
-
|
|
1331
|
-
|
|
1332
|
-
|
|
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 },
|
|
1333
1723
|
...this.extraProps
|
|
1334
1724
|
});
|
|
1335
1725
|
}
|
|
@@ -1660,7 +2050,7 @@ cleanFilterConstraint_fn = function(column, value) {
|
|
|
1660
2050
|
};
|
|
1661
2051
|
function cleanParent(data, parent) {
|
|
1662
2052
|
if (isCursorPaginationOptions(data.pagination)) {
|
|
1663
|
-
return { ...parent,
|
|
2053
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
|
1664
2054
|
}
|
|
1665
2055
|
return parent;
|
|
1666
2056
|
}
|
|
@@ -1762,8 +2152,9 @@ class RestRepository extends Query {
|
|
|
1762
2152
|
});
|
|
1763
2153
|
});
|
|
1764
2154
|
}
|
|
1765
|
-
async create(a, b, c) {
|
|
2155
|
+
async create(a, b, c, d) {
|
|
1766
2156
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
|
2157
|
+
const ifVersion = parseIfVersion(b, c, d);
|
|
1767
2158
|
if (Array.isArray(a)) {
|
|
1768
2159
|
if (a.length === 0)
|
|
1769
2160
|
return [];
|
|
@@ -1774,13 +2165,13 @@ class RestRepository extends Query {
|
|
|
1774
2165
|
if (a === "")
|
|
1775
2166
|
throw new Error("The id can't be empty");
|
|
1776
2167
|
const columns = isStringArray(c) ? c : void 0;
|
|
1777
|
-
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 });
|
|
1778
2169
|
}
|
|
1779
2170
|
if (isObject(a) && isString(a.id)) {
|
|
1780
2171
|
if (a.id === "")
|
|
1781
2172
|
throw new Error("The id can't be empty");
|
|
1782
2173
|
const columns = isStringArray(b) ? b : void 0;
|
|
1783
|
-
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 });
|
|
1784
2175
|
}
|
|
1785
2176
|
if (isObject(a)) {
|
|
1786
2177
|
const columns = isStringArray(b) ? b : void 0;
|
|
@@ -1811,6 +2202,7 @@ class RestRepository extends Query {
|
|
|
1811
2202
|
pathParams: {
|
|
1812
2203
|
workspace: "{workspaceId}",
|
|
1813
2204
|
dbBranchName: "{dbBranch}",
|
|
2205
|
+
region: "{region}",
|
|
1814
2206
|
tableName: __privateGet$4(this, _table),
|
|
1815
2207
|
recordId: id
|
|
1816
2208
|
},
|
|
@@ -1848,8 +2240,9 @@ class RestRepository extends Query {
|
|
|
1848
2240
|
return result;
|
|
1849
2241
|
});
|
|
1850
2242
|
}
|
|
1851
|
-
async update(a, b, c) {
|
|
2243
|
+
async update(a, b, c, d) {
|
|
1852
2244
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
|
2245
|
+
const ifVersion = parseIfVersion(b, c, d);
|
|
1853
2246
|
if (Array.isArray(a)) {
|
|
1854
2247
|
if (a.length === 0)
|
|
1855
2248
|
return [];
|
|
@@ -1861,18 +2254,18 @@ class RestRepository extends Query {
|
|
|
1861
2254
|
}
|
|
1862
2255
|
if (isString(a) && isObject(b)) {
|
|
1863
2256
|
const columns = isStringArray(c) ? c : void 0;
|
|
1864
|
-
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 });
|
|
1865
2258
|
}
|
|
1866
2259
|
if (isObject(a) && isString(a.id)) {
|
|
1867
2260
|
const columns = isStringArray(b) ? b : void 0;
|
|
1868
|
-
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 });
|
|
1869
2262
|
}
|
|
1870
2263
|
throw new Error("Invalid arguments for update method");
|
|
1871
2264
|
});
|
|
1872
2265
|
}
|
|
1873
|
-
async updateOrThrow(a, b, c) {
|
|
2266
|
+
async updateOrThrow(a, b, c, d) {
|
|
1874
2267
|
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
|
1875
|
-
const result = await this.update(a, b, c);
|
|
2268
|
+
const result = await this.update(a, b, c, d);
|
|
1876
2269
|
if (Array.isArray(result)) {
|
|
1877
2270
|
const missingIds = compact(
|
|
1878
2271
|
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
|
@@ -1889,8 +2282,9 @@ class RestRepository extends Query {
|
|
|
1889
2282
|
return result;
|
|
1890
2283
|
});
|
|
1891
2284
|
}
|
|
1892
|
-
async createOrUpdate(a, b, c) {
|
|
2285
|
+
async createOrUpdate(a, b, c, d) {
|
|
1893
2286
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
|
2287
|
+
const ifVersion = parseIfVersion(b, c, d);
|
|
1894
2288
|
if (Array.isArray(a)) {
|
|
1895
2289
|
if (a.length === 0)
|
|
1896
2290
|
return [];
|
|
@@ -1902,15 +2296,35 @@ class RestRepository extends Query {
|
|
|
1902
2296
|
}
|
|
1903
2297
|
if (isString(a) && isObject(b)) {
|
|
1904
2298
|
const columns = isStringArray(c) ? c : void 0;
|
|
1905
|
-
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 });
|
|
1906
2300
|
}
|
|
1907
2301
|
if (isObject(a) && isString(a.id)) {
|
|
1908
2302
|
const columns = isStringArray(c) ? c : void 0;
|
|
1909
|
-
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 });
|
|
1910
2304
|
}
|
|
1911
2305
|
throw new Error("Invalid arguments for createOrUpdate method");
|
|
1912
2306
|
});
|
|
1913
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
|
+
}
|
|
1914
2328
|
async delete(a, b) {
|
|
1915
2329
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
|
1916
2330
|
if (Array.isArray(a)) {
|
|
@@ -1952,7 +2366,12 @@ class RestRepository extends Query {
|
|
|
1952
2366
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
|
1953
2367
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
1954
2368
|
const { records } = await searchTable({
|
|
1955
|
-
pathParams: {
|
|
2369
|
+
pathParams: {
|
|
2370
|
+
workspace: "{workspaceId}",
|
|
2371
|
+
dbBranchName: "{dbBranch}",
|
|
2372
|
+
region: "{region}",
|
|
2373
|
+
tableName: __privateGet$4(this, _table)
|
|
2374
|
+
},
|
|
1956
2375
|
body: {
|
|
1957
2376
|
query,
|
|
1958
2377
|
fuzziness: options.fuzziness,
|
|
@@ -1971,7 +2390,12 @@ class RestRepository extends Query {
|
|
|
1971
2390
|
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
|
1972
2391
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
1973
2392
|
const result = await aggregateTable({
|
|
1974
|
-
pathParams: {
|
|
2393
|
+
pathParams: {
|
|
2394
|
+
workspace: "{workspaceId}",
|
|
2395
|
+
dbBranchName: "{dbBranch}",
|
|
2396
|
+
region: "{region}",
|
|
2397
|
+
tableName: __privateGet$4(this, _table)
|
|
2398
|
+
},
|
|
1975
2399
|
body: { aggs, filter },
|
|
1976
2400
|
...fetchProps
|
|
1977
2401
|
});
|
|
@@ -1986,7 +2410,12 @@ class RestRepository extends Query {
|
|
|
1986
2410
|
const data = query.getQueryOptions();
|
|
1987
2411
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
1988
2412
|
const { meta, records: objects } = await queryTable({
|
|
1989
|
-
pathParams: {
|
|
2413
|
+
pathParams: {
|
|
2414
|
+
workspace: "{workspaceId}",
|
|
2415
|
+
dbBranchName: "{dbBranch}",
|
|
2416
|
+
region: "{region}",
|
|
2417
|
+
tableName: __privateGet$4(this, _table)
|
|
2418
|
+
},
|
|
1990
2419
|
body: {
|
|
1991
2420
|
filter: cleanFilter(data.filter),
|
|
1992
2421
|
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
|
@@ -2008,11 +2437,17 @@ class RestRepository extends Query {
|
|
|
2008
2437
|
const data = query.getQueryOptions();
|
|
2009
2438
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2010
2439
|
const result = await summarizeTable({
|
|
2011
|
-
pathParams: {
|
|
2440
|
+
pathParams: {
|
|
2441
|
+
workspace: "{workspaceId}",
|
|
2442
|
+
dbBranchName: "{dbBranch}",
|
|
2443
|
+
region: "{region}",
|
|
2444
|
+
tableName: __privateGet$4(this, _table)
|
|
2445
|
+
},
|
|
2012
2446
|
body: {
|
|
2013
2447
|
filter: cleanFilter(data.filter),
|
|
2014
2448
|
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
|
2015
2449
|
columns: data.columns,
|
|
2450
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
|
2016
2451
|
summaries,
|
|
2017
2452
|
summariesFilter
|
|
2018
2453
|
},
|
|
@@ -2036,6 +2471,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
|
2036
2471
|
pathParams: {
|
|
2037
2472
|
workspace: "{workspaceId}",
|
|
2038
2473
|
dbBranchName: "{dbBranch}",
|
|
2474
|
+
region: "{region}",
|
|
2039
2475
|
tableName: __privateGet$4(this, _table)
|
|
2040
2476
|
},
|
|
2041
2477
|
queryParams: { columns },
|
|
@@ -2046,18 +2482,19 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
|
2046
2482
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
|
2047
2483
|
};
|
|
2048
2484
|
_insertRecordWithId = new WeakSet();
|
|
2049
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
|
2485
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
|
2050
2486
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2051
2487
|
const record = transformObjectLinks(object);
|
|
2052
2488
|
const response = await insertRecordWithID({
|
|
2053
2489
|
pathParams: {
|
|
2054
2490
|
workspace: "{workspaceId}",
|
|
2055
2491
|
dbBranchName: "{dbBranch}",
|
|
2492
|
+
region: "{region}",
|
|
2056
2493
|
tableName: __privateGet$4(this, _table),
|
|
2057
2494
|
recordId
|
|
2058
2495
|
},
|
|
2059
2496
|
body: record,
|
|
2060
|
-
queryParams: { createOnly
|
|
2497
|
+
queryParams: { createOnly, columns, ifVersion },
|
|
2061
2498
|
...fetchProps
|
|
2062
2499
|
});
|
|
2063
2500
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
|
@@ -2068,7 +2505,12 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
|
2068
2505
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2069
2506
|
const records = objects.map((object) => transformObjectLinks(object));
|
|
2070
2507
|
const response = await bulkInsertTableRecords({
|
|
2071
|
-
pathParams: {
|
|
2508
|
+
pathParams: {
|
|
2509
|
+
workspace: "{workspaceId}",
|
|
2510
|
+
dbBranchName: "{dbBranch}",
|
|
2511
|
+
region: "{region}",
|
|
2512
|
+
tableName: __privateGet$4(this, _table)
|
|
2513
|
+
},
|
|
2072
2514
|
queryParams: { columns },
|
|
2073
2515
|
body: { records },
|
|
2074
2516
|
...fetchProps
|
|
@@ -2080,13 +2522,19 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
|
2080
2522
|
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
|
2081
2523
|
};
|
|
2082
2524
|
_updateRecordWithID = new WeakSet();
|
|
2083
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
2525
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
|
2084
2526
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2085
2527
|
const record = transformObjectLinks(object);
|
|
2086
2528
|
try {
|
|
2087
2529
|
const response = await updateRecordWithID({
|
|
2088
|
-
pathParams: {
|
|
2089
|
-
|
|
2530
|
+
pathParams: {
|
|
2531
|
+
workspace: "{workspaceId}",
|
|
2532
|
+
dbBranchName: "{dbBranch}",
|
|
2533
|
+
region: "{region}",
|
|
2534
|
+
tableName: __privateGet$4(this, _table),
|
|
2535
|
+
recordId
|
|
2536
|
+
},
|
|
2537
|
+
queryParams: { columns, ifVersion },
|
|
2090
2538
|
body: record,
|
|
2091
2539
|
...fetchProps
|
|
2092
2540
|
});
|
|
@@ -2100,11 +2548,17 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
|
2100
2548
|
}
|
|
2101
2549
|
};
|
|
2102
2550
|
_upsertRecordWithID = new WeakSet();
|
|
2103
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
2551
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
|
2104
2552
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2105
2553
|
const response = await upsertRecordWithID({
|
|
2106
|
-
pathParams: {
|
|
2107
|
-
|
|
2554
|
+
pathParams: {
|
|
2555
|
+
workspace: "{workspaceId}",
|
|
2556
|
+
dbBranchName: "{dbBranch}",
|
|
2557
|
+
region: "{region}",
|
|
2558
|
+
tableName: __privateGet$4(this, _table),
|
|
2559
|
+
recordId
|
|
2560
|
+
},
|
|
2561
|
+
queryParams: { columns, ifVersion },
|
|
2108
2562
|
body: object,
|
|
2109
2563
|
...fetchProps
|
|
2110
2564
|
});
|
|
@@ -2116,7 +2570,13 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
|
2116
2570
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2117
2571
|
try {
|
|
2118
2572
|
const response = await deleteRecord({
|
|
2119
|
-
pathParams: {
|
|
2573
|
+
pathParams: {
|
|
2574
|
+
workspace: "{workspaceId}",
|
|
2575
|
+
dbBranchName: "{dbBranch}",
|
|
2576
|
+
region: "{region}",
|
|
2577
|
+
tableName: __privateGet$4(this, _table),
|
|
2578
|
+
recordId
|
|
2579
|
+
},
|
|
2120
2580
|
queryParams: { columns },
|
|
2121
2581
|
...fetchProps
|
|
2122
2582
|
});
|
|
@@ -2151,7 +2611,7 @@ getSchemaTables_fn$1 = async function() {
|
|
|
2151
2611
|
return __privateGet$4(this, _schemaTables$2);
|
|
2152
2612
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2153
2613
|
const { schema } = await getBranchDetails({
|
|
2154
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
|
2614
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
|
2155
2615
|
...fetchProps
|
|
2156
2616
|
});
|
|
2157
2617
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
|
@@ -2217,8 +2677,15 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
|
2217
2677
|
result.read = function(columns2) {
|
|
2218
2678
|
return db[table].read(result["id"], columns2);
|
|
2219
2679
|
};
|
|
2220
|
-
result.update = function(data,
|
|
2221
|
-
|
|
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 });
|
|
2222
2689
|
};
|
|
2223
2690
|
result.delete = function() {
|
|
2224
2691
|
return db[table].delete(result["id"]);
|
|
@@ -2251,6 +2718,14 @@ function isValidColumn(columns, column) {
|
|
|
2251
2718
|
}
|
|
2252
2719
|
return columns.includes(column.name);
|
|
2253
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
|
+
}
|
|
2254
2729
|
|
|
2255
2730
|
var __accessCheck$3 = (obj, member, msg) => {
|
|
2256
2731
|
if (!member.has(obj))
|
|
@@ -2438,7 +2913,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
|
2438
2913
|
const fetchProps = await getFetchProps();
|
|
2439
2914
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
|
2440
2915
|
const { records } = await searchBranch({
|
|
2441
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
|
2916
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
|
2442
2917
|
body: { tables, query, fuzziness, prefix, highlight },
|
|
2443
2918
|
...fetchProps
|
|
2444
2919
|
});
|
|
@@ -2450,7 +2925,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
|
2450
2925
|
return __privateGet$1(this, _schemaTables);
|
|
2451
2926
|
const fetchProps = await getFetchProps();
|
|
2452
2927
|
const { schema } = await getBranchDetails({
|
|
2453
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
|
2928
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
|
2454
2929
|
...fetchProps
|
|
2455
2930
|
});
|
|
2456
2931
|
__privateSet$1(this, _schemaTables, schema.tables);
|
|
@@ -2488,14 +2963,17 @@ async function resolveXataBranch(gitBranch, options) {
|
|
|
2488
2963
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
|
2489
2964
|
);
|
|
2490
2965
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
|
2491
|
-
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;
|
|
2492
2970
|
const { fallbackBranch } = getEnvironment();
|
|
2493
2971
|
const { branch } = await resolveBranch({
|
|
2494
2972
|
apiKey,
|
|
2495
2973
|
apiUrl: databaseURL,
|
|
2496
2974
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
|
2497
2975
|
workspacesApiUrl: `${protocol}//${host}`,
|
|
2498
|
-
pathParams: { dbName, workspace },
|
|
2976
|
+
pathParams: { dbName, workspace, region },
|
|
2499
2977
|
queryParams: { gitBranch, fallbackBranch },
|
|
2500
2978
|
trace: defaultTrace
|
|
2501
2979
|
});
|
|
@@ -2513,15 +2991,17 @@ async function getDatabaseBranch(branch, options) {
|
|
|
2513
2991
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
|
2514
2992
|
);
|
|
2515
2993
|
const [protocol, , host, , database] = databaseURL.split("/");
|
|
2516
|
-
const
|
|
2517
|
-
|
|
2994
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
|
2995
|
+
if (!urlParts)
|
|
2996
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
|
2997
|
+
const { workspace, region } = urlParts;
|
|
2518
2998
|
try {
|
|
2519
2999
|
return await getBranchDetails({
|
|
2520
3000
|
apiKey,
|
|
2521
3001
|
apiUrl: databaseURL,
|
|
2522
3002
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
|
2523
3003
|
workspacesApiUrl: `${protocol}//${host}`,
|
|
2524
|
-
pathParams: { dbBranchName
|
|
3004
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
|
2525
3005
|
trace: defaultTrace
|
|
2526
3006
|
});
|
|
2527
3007
|
} catch (err) {
|
|
@@ -2613,14 +3093,7 @@ const buildClient = (plugins) => {
|
|
|
2613
3093
|
throw new Error("Option databaseURL is required");
|
|
2614
3094
|
}
|
|
2615
3095
|
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
|
2616
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
|
2617
|
-
fetch,
|
|
2618
|
-
apiKey,
|
|
2619
|
-
databaseURL,
|
|
2620
|
-
branch,
|
|
2621
|
-
trace,
|
|
2622
|
-
clientID
|
|
2623
|
-
}) {
|
|
3096
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
|
2624
3097
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
|
2625
3098
|
if (!branchValue)
|
|
2626
3099
|
throw new Error("Unable to resolve branch value");
|
|
@@ -2746,5 +3219,5 @@ class XataError extends Error {
|
|
|
2746
3219
|
}
|
|
2747
3220
|
}
|
|
2748
3221
|
|
|
2749
|
-
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, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, 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 };
|
|
2750
3223
|
//# sourceMappingURL=index.mjs.map
|