@xata.io/client 0.0.0-alpha.vecd13ea → 0.0.0-alpha.vecdf10f
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +30 -0
- package/README.md +5 -5
- package/dist/index.cjs +1083 -561
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3045 -2039
- package/dist/index.mjs +1077 -562
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
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.0.0-alpha.
|
|
167
|
+
const VERSION = "0.0.0-alpha.vecdf10f";
|
|
154
168
|
|
|
155
169
|
class ErrorWithCause extends Error {
|
|
156
170
|
constructor(message, options) {
|
|
@@ -207,15 +221,18 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
|
207
221
|
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
|
208
222
|
};
|
|
209
223
|
function buildBaseUrl({
|
|
224
|
+
endpoint,
|
|
210
225
|
path,
|
|
211
226
|
workspacesApiUrl,
|
|
212
227
|
apiUrl,
|
|
213
|
-
pathParams
|
|
228
|
+
pathParams = {}
|
|
214
229
|
}) {
|
|
215
|
-
if (
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
230
|
+
if (endpoint === "dataPlane") {
|
|
231
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
|
232
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
|
233
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
|
234
|
+
}
|
|
235
|
+
return `${apiUrl}${path}`;
|
|
219
236
|
}
|
|
220
237
|
function hostHeader(url) {
|
|
221
238
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
|
@@ -231,15 +248,18 @@ async function fetch$1({
|
|
|
231
248
|
queryParams,
|
|
232
249
|
fetchImpl,
|
|
233
250
|
apiKey,
|
|
251
|
+
endpoint,
|
|
234
252
|
apiUrl,
|
|
235
253
|
workspacesApiUrl,
|
|
236
254
|
trace,
|
|
237
|
-
signal
|
|
255
|
+
signal,
|
|
256
|
+
clientID,
|
|
257
|
+
sessionID
|
|
238
258
|
}) {
|
|
239
259
|
return trace(
|
|
240
260
|
`${method.toUpperCase()} ${path}`,
|
|
241
261
|
async ({ setAttributes }) => {
|
|
242
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
|
262
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
|
243
263
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
|
244
264
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
|
245
265
|
setAttributes({
|
|
@@ -252,6 +272,8 @@ async function fetch$1({
|
|
|
252
272
|
headers: {
|
|
253
273
|
"Content-Type": "application/json",
|
|
254
274
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
|
275
|
+
"X-Xata-Client-ID": clientID ?? "",
|
|
276
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
|
255
277
|
...headers,
|
|
256
278
|
...hostHeader(fullUrl),
|
|
257
279
|
Authorization: `Bearer ${apiKey}`
|
|
@@ -292,391 +314,355 @@ function parseUrl(url) {
|
|
|
292
314
|
}
|
|
293
315
|
}
|
|
294
316
|
|
|
295
|
-
const
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
signal
|
|
301
|
-
});
|
|
302
|
-
const deleteUser = (variables, signal) => fetch$1({ url: "/user", method: "delete", ...variables, signal });
|
|
303
|
-
const getUserAPIKeys = (variables, signal) => fetch$1({
|
|
304
|
-
url: "/user/keys",
|
|
317
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
|
318
|
+
|
|
319
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
|
320
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
|
321
|
+
url: "/dbs/{dbName}",
|
|
305
322
|
method: "get",
|
|
306
323
|
...variables,
|
|
307
324
|
signal
|
|
308
325
|
});
|
|
309
|
-
const
|
|
310
|
-
|
|
311
|
-
|
|
326
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
|
327
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
|
328
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
|
329
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
|
330
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
|
331
|
+
url: "/db/{dbBranchName}",
|
|
332
|
+
method: "get",
|
|
312
333
|
...variables,
|
|
313
334
|
signal
|
|
314
335
|
});
|
|
315
|
-
const
|
|
316
|
-
|
|
336
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
|
337
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
|
338
|
+
url: "/db/{dbBranchName}",
|
|
317
339
|
method: "delete",
|
|
318
340
|
...variables,
|
|
319
341
|
signal
|
|
320
342
|
});
|
|
321
|
-
const
|
|
322
|
-
url: "/
|
|
323
|
-
method: "
|
|
343
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
|
344
|
+
url: "/db/{dbBranchName}/metadata",
|
|
345
|
+
method: "put",
|
|
324
346
|
...variables,
|
|
325
347
|
signal
|
|
326
348
|
});
|
|
327
|
-
const
|
|
328
|
-
url: "/
|
|
349
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
|
350
|
+
url: "/db/{dbBranchName}/metadata",
|
|
329
351
|
method: "get",
|
|
330
352
|
...variables,
|
|
331
353
|
signal
|
|
332
354
|
});
|
|
333
|
-
const
|
|
334
|
-
url: "/
|
|
355
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
|
356
|
+
url: "/db/{dbBranchName}/stats",
|
|
335
357
|
method: "get",
|
|
336
358
|
...variables,
|
|
337
359
|
signal
|
|
338
360
|
});
|
|
339
|
-
const
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
});
|
|
345
|
-
const
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
});
|
|
351
|
-
const getWorkspaceMembersList = (variables, signal) => fetch$1({
|
|
352
|
-
url: "/workspaces/{workspaceId}/members",
|
|
361
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
|
362
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
|
363
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
|
364
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
|
365
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
|
366
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
|
367
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
|
368
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
|
369
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
|
370
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
371
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
|
353
372
|
method: "get",
|
|
354
373
|
...variables,
|
|
355
374
|
signal
|
|
356
375
|
});
|
|
357
|
-
const
|
|
358
|
-
const
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
});
|
|
364
|
-
const inviteWorkspaceMember = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
|
365
|
-
const updateWorkspaceMemberInvite = (variables, signal) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
|
366
|
-
const cancelWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
|
367
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
|
368
|
-
method: "delete",
|
|
369
|
-
...variables,
|
|
370
|
-
signal
|
|
371
|
-
});
|
|
372
|
-
const resendWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
|
373
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
|
374
|
-
method: "post",
|
|
375
|
-
...variables,
|
|
376
|
-
signal
|
|
377
|
-
});
|
|
378
|
-
const acceptWorkspaceMemberInvite = (variables, signal) => fetch$1({
|
|
379
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
|
376
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
|
377
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
|
378
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
|
379
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
|
380
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
|
381
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
|
380
382
|
method: "post",
|
|
381
383
|
...variables,
|
|
382
384
|
signal
|
|
383
385
|
});
|
|
384
|
-
const
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
});
|
|
390
|
-
const
|
|
391
|
-
url: "/
|
|
392
|
-
method: "get",
|
|
393
|
-
...variables,
|
|
394
|
-
signal
|
|
395
|
-
});
|
|
396
|
-
const createDatabase = (variables, signal) => fetch$1({
|
|
397
|
-
url: "/dbs/{dbName}",
|
|
386
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
|
387
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
|
388
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
|
389
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
|
390
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
|
391
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
|
392
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
|
393
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
|
398
394
|
method: "put",
|
|
399
395
|
...variables,
|
|
400
396
|
signal
|
|
401
397
|
});
|
|
402
|
-
const
|
|
403
|
-
url: "/
|
|
398
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
|
399
|
+
url: "/db/{dbBranchName}/tables/{tableName}",
|
|
404
400
|
method: "delete",
|
|
405
401
|
...variables,
|
|
406
402
|
signal
|
|
407
403
|
});
|
|
408
|
-
const
|
|
409
|
-
|
|
404
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
|
405
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
|
406
|
+
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
|
410
407
|
method: "get",
|
|
411
408
|
...variables,
|
|
412
409
|
signal
|
|
413
410
|
});
|
|
414
|
-
const
|
|
415
|
-
const
|
|
416
|
-
|
|
417
|
-
const removeGitBranchesEntry = (variables, signal) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
|
418
|
-
const resolveBranch = (variables, signal) => fetch$1({
|
|
419
|
-
url: "/dbs/{dbName}/resolveBranch",
|
|
411
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
|
412
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
|
413
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
|
420
414
|
method: "get",
|
|
421
415
|
...variables,
|
|
422
416
|
signal
|
|
423
417
|
});
|
|
424
|
-
const
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
418
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
|
419
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
|
420
|
+
);
|
|
421
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
|
422
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
|
428
423
|
method: "get",
|
|
429
424
|
...variables,
|
|
430
425
|
signal
|
|
431
426
|
});
|
|
432
|
-
const
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
const mergeMigrationRequest = (variables, signal) => fetch$1({
|
|
437
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
|
438
|
-
method: "post",
|
|
427
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
|
428
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
|
429
|
+
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
|
430
|
+
method: "delete",
|
|
439
431
|
...variables,
|
|
440
432
|
signal
|
|
441
433
|
});
|
|
442
|
-
const
|
|
443
|
-
|
|
434
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
|
435
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
|
436
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
|
444
437
|
method: "get",
|
|
445
438
|
...variables,
|
|
446
439
|
signal
|
|
447
440
|
});
|
|
448
|
-
const
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
455
|
-
|
|
456
|
-
url: "/db/{dbBranchName}/metadata",
|
|
457
|
-
method: "put",
|
|
441
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
|
442
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
|
443
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
|
444
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
|
445
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
|
446
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
|
447
|
+
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
|
448
|
+
method: "post",
|
|
458
449
|
...variables,
|
|
459
450
|
signal
|
|
460
451
|
});
|
|
461
|
-
const
|
|
462
|
-
url: "/db/{dbBranchName}/
|
|
463
|
-
method: "
|
|
452
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
|
453
|
+
url: "/db/{dbBranchName}/search",
|
|
454
|
+
method: "post",
|
|
464
455
|
...variables,
|
|
465
456
|
signal
|
|
466
457
|
});
|
|
467
|
-
const
|
|
468
|
-
|
|
469
|
-
const getBranchMigrationPlan = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
|
470
|
-
const compareBranchWithUserSchema = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
|
471
|
-
const compareBranchSchemas = (variables, signal) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
|
472
|
-
const updateBranchSchema = (variables, signal) => fetch$1({
|
|
473
|
-
url: "/db/{dbBranchName}/schema/update",
|
|
458
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
|
459
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
|
474
460
|
method: "post",
|
|
475
461
|
...variables,
|
|
476
462
|
signal
|
|
477
463
|
});
|
|
478
|
-
const
|
|
479
|
-
const
|
|
480
|
-
const
|
|
481
|
-
|
|
482
|
-
|
|
464
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
|
465
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
|
466
|
+
const operationsByTag$2 = {
|
|
467
|
+
database: {
|
|
468
|
+
dEPRECATEDgetDatabaseList,
|
|
469
|
+
dEPRECATEDcreateDatabase,
|
|
470
|
+
dEPRECATEDdeleteDatabase,
|
|
471
|
+
dEPRECATEDgetDatabaseMetadata,
|
|
472
|
+
dEPRECATEDupdateDatabaseMetadata
|
|
473
|
+
},
|
|
474
|
+
branch: {
|
|
475
|
+
getBranchList,
|
|
476
|
+
getBranchDetails,
|
|
477
|
+
createBranch,
|
|
478
|
+
deleteBranch,
|
|
479
|
+
updateBranchMetadata,
|
|
480
|
+
getBranchMetadata,
|
|
481
|
+
getBranchStats,
|
|
482
|
+
getGitBranchesMapping,
|
|
483
|
+
addGitBranchesEntry,
|
|
484
|
+
removeGitBranchesEntry,
|
|
485
|
+
resolveBranch
|
|
486
|
+
},
|
|
487
|
+
migrations: {
|
|
488
|
+
getBranchMigrationHistory,
|
|
489
|
+
getBranchMigrationPlan,
|
|
490
|
+
executeBranchMigrationPlan,
|
|
491
|
+
getBranchSchemaHistory,
|
|
492
|
+
compareBranchWithUserSchema,
|
|
493
|
+
compareBranchSchemas,
|
|
494
|
+
updateBranchSchema,
|
|
495
|
+
previewBranchSchemaEdit,
|
|
496
|
+
applyBranchSchemaEdit
|
|
497
|
+
},
|
|
498
|
+
migrationRequests: {
|
|
499
|
+
queryMigrationRequests,
|
|
500
|
+
createMigrationRequest,
|
|
501
|
+
getMigrationRequest,
|
|
502
|
+
updateMigrationRequest,
|
|
503
|
+
listMigrationRequestsCommits,
|
|
504
|
+
compareMigrationRequest,
|
|
505
|
+
getMigrationRequestIsMerged,
|
|
506
|
+
mergeMigrationRequest
|
|
507
|
+
},
|
|
508
|
+
table: {
|
|
509
|
+
createTable,
|
|
510
|
+
deleteTable,
|
|
511
|
+
updateTable,
|
|
512
|
+
getTableSchema,
|
|
513
|
+
setTableSchema,
|
|
514
|
+
getTableColumns,
|
|
515
|
+
addTableColumn,
|
|
516
|
+
getColumn,
|
|
517
|
+
updateColumn,
|
|
518
|
+
deleteColumn
|
|
519
|
+
},
|
|
520
|
+
records: {
|
|
521
|
+
insertRecord,
|
|
522
|
+
getRecord,
|
|
523
|
+
insertRecordWithID,
|
|
524
|
+
updateRecordWithID,
|
|
525
|
+
upsertRecordWithID,
|
|
526
|
+
deleteRecord,
|
|
527
|
+
bulkInsertTableRecords
|
|
528
|
+
},
|
|
529
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
|
530
|
+
};
|
|
531
|
+
|
|
532
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
|
533
|
+
|
|
534
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
|
535
|
+
url: "/user",
|
|
483
536
|
method: "get",
|
|
484
537
|
...variables,
|
|
485
538
|
signal
|
|
486
539
|
});
|
|
487
|
-
const
|
|
488
|
-
url: "/
|
|
540
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
|
541
|
+
url: "/user",
|
|
489
542
|
method: "put",
|
|
490
543
|
...variables,
|
|
491
544
|
signal
|
|
492
545
|
});
|
|
493
|
-
const
|
|
494
|
-
url: "/
|
|
546
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
|
547
|
+
url: "/user",
|
|
495
548
|
method: "delete",
|
|
496
549
|
...variables,
|
|
497
550
|
signal
|
|
498
551
|
});
|
|
499
|
-
const
|
|
500
|
-
url: "/
|
|
501
|
-
method: "
|
|
552
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
|
553
|
+
url: "/user/keys",
|
|
554
|
+
method: "get",
|
|
502
555
|
...variables,
|
|
503
556
|
signal
|
|
504
557
|
});
|
|
505
|
-
const
|
|
506
|
-
url: "/
|
|
507
|
-
method: "
|
|
558
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
|
559
|
+
url: "/user/keys/{keyName}",
|
|
560
|
+
method: "post",
|
|
508
561
|
...variables,
|
|
509
562
|
signal
|
|
510
563
|
});
|
|
511
|
-
const
|
|
512
|
-
url: "/
|
|
513
|
-
method: "
|
|
564
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
|
565
|
+
url: "/user/keys/{keyName}",
|
|
566
|
+
method: "delete",
|
|
514
567
|
...variables,
|
|
515
568
|
signal
|
|
516
569
|
});
|
|
517
|
-
const
|
|
518
|
-
url: "/
|
|
570
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
|
571
|
+
url: "/workspaces",
|
|
519
572
|
method: "get",
|
|
520
573
|
...variables,
|
|
521
574
|
signal
|
|
522
575
|
});
|
|
523
|
-
const
|
|
524
|
-
url: "/
|
|
576
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
|
577
|
+
url: "/workspaces",
|
|
525
578
|
method: "post",
|
|
526
579
|
...variables,
|
|
527
580
|
signal
|
|
528
581
|
});
|
|
529
|
-
const
|
|
530
|
-
url: "/
|
|
582
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
|
583
|
+
url: "/workspaces/{workspaceId}",
|
|
531
584
|
method: "get",
|
|
532
585
|
...variables,
|
|
533
586
|
signal
|
|
534
587
|
});
|
|
535
|
-
const
|
|
536
|
-
url: "/
|
|
537
|
-
method: "
|
|
588
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
|
589
|
+
url: "/workspaces/{workspaceId}",
|
|
590
|
+
method: "put",
|
|
538
591
|
...variables,
|
|
539
592
|
signal
|
|
540
593
|
});
|
|
541
|
-
const
|
|
542
|
-
url: "/
|
|
543
|
-
method: "
|
|
594
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
595
|
+
url: "/workspaces/{workspaceId}",
|
|
596
|
+
method: "delete",
|
|
544
597
|
...variables,
|
|
545
598
|
signal
|
|
546
599
|
});
|
|
547
|
-
const
|
|
548
|
-
const
|
|
549
|
-
const
|
|
550
|
-
|
|
551
|
-
const deleteRecord = (variables, signal) => fetch$1({
|
|
552
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
|
600
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
|
601
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
|
602
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
|
603
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
|
553
604
|
method: "delete",
|
|
554
605
|
...variables,
|
|
555
606
|
signal
|
|
556
607
|
});
|
|
557
|
-
const
|
|
558
|
-
|
|
608
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
|
609
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
|
610
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
|
611
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
|
612
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
|
613
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
|
614
|
+
url: "/workspaces/{workspaceId}/dbs",
|
|
559
615
|
method: "get",
|
|
560
616
|
...variables,
|
|
561
617
|
signal
|
|
562
618
|
});
|
|
563
|
-
const
|
|
564
|
-
const
|
|
565
|
-
url: "/
|
|
566
|
-
method: "
|
|
567
|
-
...variables,
|
|
568
|
-
signal
|
|
569
|
-
});
|
|
570
|
-
const searchTable = (variables, signal) => fetch$1({
|
|
571
|
-
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
|
572
|
-
method: "post",
|
|
573
|
-
...variables,
|
|
574
|
-
signal
|
|
575
|
-
});
|
|
576
|
-
const searchBranch = (variables, signal) => fetch$1({
|
|
577
|
-
url: "/db/{dbBranchName}/search",
|
|
578
|
-
method: "post",
|
|
579
|
-
...variables,
|
|
580
|
-
signal
|
|
581
|
-
});
|
|
582
|
-
const summarizeTable = (variables, signal) => fetch$1({
|
|
583
|
-
url: "/db/{dbBranchName}/tables/{tableName}/summarize",
|
|
584
|
-
method: "post",
|
|
619
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
|
620
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
|
621
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
|
622
|
+
method: "delete",
|
|
585
623
|
...variables,
|
|
586
624
|
signal
|
|
587
625
|
});
|
|
588
|
-
const
|
|
589
|
-
|
|
590
|
-
|
|
626
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
|
627
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
|
628
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
|
629
|
+
url: "/workspaces/{workspaceId}/regions",
|
|
630
|
+
method: "get",
|
|
591
631
|
...variables,
|
|
592
632
|
signal
|
|
593
633
|
});
|
|
594
|
-
const operationsByTag = {
|
|
595
|
-
users: { getUser, updateUser, deleteUser
|
|
634
|
+
const operationsByTag$1 = {
|
|
635
|
+
users: { getUser, updateUser, deleteUser },
|
|
636
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
|
596
637
|
workspaces: {
|
|
597
|
-
createWorkspace,
|
|
598
638
|
getWorkspacesList,
|
|
639
|
+
createWorkspace,
|
|
599
640
|
getWorkspace,
|
|
600
641
|
updateWorkspace,
|
|
601
642
|
deleteWorkspace,
|
|
602
643
|
getWorkspaceMembersList,
|
|
603
644
|
updateWorkspaceMemberRole,
|
|
604
|
-
removeWorkspaceMember
|
|
645
|
+
removeWorkspaceMember
|
|
646
|
+
},
|
|
647
|
+
invites: {
|
|
605
648
|
inviteWorkspaceMember,
|
|
606
649
|
updateWorkspaceMemberInvite,
|
|
607
650
|
cancelWorkspaceMemberInvite,
|
|
608
|
-
|
|
609
|
-
|
|
651
|
+
acceptWorkspaceMemberInvite,
|
|
652
|
+
resendWorkspaceMemberInvite
|
|
610
653
|
},
|
|
611
|
-
|
|
654
|
+
databases: {
|
|
612
655
|
getDatabaseList,
|
|
613
656
|
createDatabase,
|
|
614
657
|
deleteDatabase,
|
|
615
658
|
getDatabaseMetadata,
|
|
616
659
|
updateDatabaseMetadata,
|
|
617
|
-
|
|
618
|
-
addGitBranchesEntry,
|
|
619
|
-
removeGitBranchesEntry,
|
|
620
|
-
resolveBranch
|
|
621
|
-
},
|
|
622
|
-
branch: {
|
|
623
|
-
getBranchList,
|
|
624
|
-
getBranchDetails,
|
|
625
|
-
createBranch,
|
|
626
|
-
deleteBranch,
|
|
627
|
-
updateBranchMetadata,
|
|
628
|
-
getBranchMetadata,
|
|
629
|
-
getBranchStats
|
|
630
|
-
},
|
|
631
|
-
migrationRequests: {
|
|
632
|
-
queryMigrationRequests,
|
|
633
|
-
createMigrationRequest,
|
|
634
|
-
getMigrationRequest,
|
|
635
|
-
updateMigrationRequest,
|
|
636
|
-
listMigrationRequestsCommits,
|
|
637
|
-
compareMigrationRequest,
|
|
638
|
-
getMigrationRequestIsMerged,
|
|
639
|
-
mergeMigrationRequest
|
|
640
|
-
},
|
|
641
|
-
branchSchema: {
|
|
642
|
-
getBranchMigrationHistory,
|
|
643
|
-
executeBranchMigrationPlan,
|
|
644
|
-
getBranchMigrationPlan,
|
|
645
|
-
compareBranchWithUserSchema,
|
|
646
|
-
compareBranchSchemas,
|
|
647
|
-
updateBranchSchema,
|
|
648
|
-
previewBranchSchemaEdit,
|
|
649
|
-
applyBranchSchemaEdit,
|
|
650
|
-
getBranchSchemaHistory
|
|
651
|
-
},
|
|
652
|
-
table: {
|
|
653
|
-
createTable,
|
|
654
|
-
deleteTable,
|
|
655
|
-
updateTable,
|
|
656
|
-
getTableSchema,
|
|
657
|
-
setTableSchema,
|
|
658
|
-
getTableColumns,
|
|
659
|
-
addTableColumn,
|
|
660
|
-
getColumn,
|
|
661
|
-
deleteColumn,
|
|
662
|
-
updateColumn
|
|
663
|
-
},
|
|
664
|
-
records: {
|
|
665
|
-
insertRecord,
|
|
666
|
-
insertRecordWithID,
|
|
667
|
-
updateRecordWithID,
|
|
668
|
-
upsertRecordWithID,
|
|
669
|
-
deleteRecord,
|
|
670
|
-
getRecord,
|
|
671
|
-
bulkInsertTableRecords,
|
|
672
|
-
queryTable,
|
|
673
|
-
searchTable,
|
|
674
|
-
searchBranch,
|
|
675
|
-
summarizeTable,
|
|
676
|
-
aggregateTable
|
|
660
|
+
listRegions
|
|
677
661
|
}
|
|
678
662
|
};
|
|
679
663
|
|
|
664
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
|
665
|
+
|
|
680
666
|
function getHostUrl(provider, type) {
|
|
681
667
|
if (isHostProviderAlias(provider)) {
|
|
682
668
|
return providers[provider][type];
|
|
@@ -688,11 +674,11 @@ function getHostUrl(provider, type) {
|
|
|
688
674
|
const providers = {
|
|
689
675
|
production: {
|
|
690
676
|
main: "https://api.xata.io",
|
|
691
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
|
677
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
|
692
678
|
},
|
|
693
679
|
staging: {
|
|
694
680
|
main: "https://staging.xatabase.co",
|
|
695
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
|
681
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
|
696
682
|
}
|
|
697
683
|
};
|
|
698
684
|
function isHostProviderAlias(alias) {
|
|
@@ -710,6 +696,16 @@ function parseProviderString(provider = "production") {
|
|
|
710
696
|
return null;
|
|
711
697
|
return { main, workspaces };
|
|
712
698
|
}
|
|
699
|
+
function parseWorkspacesUrlParts(url) {
|
|
700
|
+
if (!isString(url))
|
|
701
|
+
return null;
|
|
702
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
|
703
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
|
704
|
+
const match = url.match(regex) || url.match(regexStaging);
|
|
705
|
+
if (!match)
|
|
706
|
+
return null;
|
|
707
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
|
708
|
+
}
|
|
713
709
|
|
|
714
710
|
var __accessCheck$7 = (obj, member, msg) => {
|
|
715
711
|
if (!member.has(obj))
|
|
@@ -753,21 +749,41 @@ class XataApiClient {
|
|
|
753
749
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
|
754
750
|
return __privateGet$7(this, _namespaces).user;
|
|
755
751
|
}
|
|
752
|
+
get authentication() {
|
|
753
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
|
754
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
|
755
|
+
return __privateGet$7(this, _namespaces).authentication;
|
|
756
|
+
}
|
|
756
757
|
get workspaces() {
|
|
757
758
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
|
758
759
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
|
759
760
|
return __privateGet$7(this, _namespaces).workspaces;
|
|
760
761
|
}
|
|
761
|
-
get
|
|
762
|
-
if (!__privateGet$7(this, _namespaces).
|
|
763
|
-
__privateGet$7(this, _namespaces).
|
|
764
|
-
return __privateGet$7(this, _namespaces).
|
|
762
|
+
get invites() {
|
|
763
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
|
764
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
|
765
|
+
return __privateGet$7(this, _namespaces).invites;
|
|
766
|
+
}
|
|
767
|
+
get database() {
|
|
768
|
+
if (!__privateGet$7(this, _namespaces).database)
|
|
769
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
|
770
|
+
return __privateGet$7(this, _namespaces).database;
|
|
765
771
|
}
|
|
766
772
|
get branches() {
|
|
767
773
|
if (!__privateGet$7(this, _namespaces).branches)
|
|
768
774
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
|
769
775
|
return __privateGet$7(this, _namespaces).branches;
|
|
770
776
|
}
|
|
777
|
+
get migrations() {
|
|
778
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
|
779
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
|
780
|
+
return __privateGet$7(this, _namespaces).migrations;
|
|
781
|
+
}
|
|
782
|
+
get migrationRequests() {
|
|
783
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
|
784
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
|
785
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
|
786
|
+
}
|
|
771
787
|
get tables() {
|
|
772
788
|
if (!__privateGet$7(this, _namespaces).tables)
|
|
773
789
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
|
@@ -778,15 +794,10 @@ class XataApiClient {
|
|
|
778
794
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
|
779
795
|
return __privateGet$7(this, _namespaces).records;
|
|
780
796
|
}
|
|
781
|
-
get
|
|
782
|
-
if (!__privateGet$7(this, _namespaces).
|
|
783
|
-
__privateGet$7(this, _namespaces).
|
|
784
|
-
return __privateGet$7(this, _namespaces).
|
|
785
|
-
}
|
|
786
|
-
get branchSchema() {
|
|
787
|
-
if (!__privateGet$7(this, _namespaces).branchSchema)
|
|
788
|
-
__privateGet$7(this, _namespaces).branchSchema = new BranchSchemaApi(__privateGet$7(this, _extraProps));
|
|
789
|
-
return __privateGet$7(this, _namespaces).branchSchema;
|
|
797
|
+
get searchAndFilter() {
|
|
798
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
|
799
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
|
800
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
|
790
801
|
}
|
|
791
802
|
}
|
|
792
803
|
_extraProps = new WeakMap();
|
|
@@ -798,24 +809,29 @@ class UserApi {
|
|
|
798
809
|
getUser() {
|
|
799
810
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
|
800
811
|
}
|
|
801
|
-
updateUser(user) {
|
|
812
|
+
updateUser({ user }) {
|
|
802
813
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
|
803
814
|
}
|
|
804
815
|
deleteUser() {
|
|
805
816
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
|
806
817
|
}
|
|
818
|
+
}
|
|
819
|
+
class AuthenticationApi {
|
|
820
|
+
constructor(extraProps) {
|
|
821
|
+
this.extraProps = extraProps;
|
|
822
|
+
}
|
|
807
823
|
getUserAPIKeys() {
|
|
808
|
-
return operationsByTag.
|
|
824
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
|
809
825
|
}
|
|
810
|
-
createUserAPIKey(
|
|
811
|
-
return operationsByTag.
|
|
812
|
-
pathParams: { keyName },
|
|
826
|
+
createUserAPIKey({ name }) {
|
|
827
|
+
return operationsByTag.authentication.createUserAPIKey({
|
|
828
|
+
pathParams: { keyName: name },
|
|
813
829
|
...this.extraProps
|
|
814
830
|
});
|
|
815
831
|
}
|
|
816
|
-
deleteUserAPIKey(
|
|
817
|
-
return operationsByTag.
|
|
818
|
-
pathParams: { keyName },
|
|
832
|
+
deleteUserAPIKey({ name }) {
|
|
833
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
|
834
|
+
pathParams: { keyName: name },
|
|
819
835
|
...this.extraProps
|
|
820
836
|
});
|
|
821
837
|
}
|
|
@@ -824,196 +840,248 @@ class WorkspaceApi {
|
|
|
824
840
|
constructor(extraProps) {
|
|
825
841
|
this.extraProps = extraProps;
|
|
826
842
|
}
|
|
827
|
-
|
|
843
|
+
getWorkspacesList() {
|
|
844
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
|
845
|
+
}
|
|
846
|
+
createWorkspace({ data }) {
|
|
828
847
|
return operationsByTag.workspaces.createWorkspace({
|
|
829
|
-
body:
|
|
848
|
+
body: data,
|
|
830
849
|
...this.extraProps
|
|
831
850
|
});
|
|
832
851
|
}
|
|
833
|
-
|
|
834
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
|
835
|
-
}
|
|
836
|
-
getWorkspace(workspaceId) {
|
|
852
|
+
getWorkspace({ workspace }) {
|
|
837
853
|
return operationsByTag.workspaces.getWorkspace({
|
|
838
|
-
pathParams: { workspaceId },
|
|
854
|
+
pathParams: { workspaceId: workspace },
|
|
839
855
|
...this.extraProps
|
|
840
856
|
});
|
|
841
857
|
}
|
|
842
|
-
updateWorkspace(
|
|
858
|
+
updateWorkspace({
|
|
859
|
+
workspace,
|
|
860
|
+
update
|
|
861
|
+
}) {
|
|
843
862
|
return operationsByTag.workspaces.updateWorkspace({
|
|
844
|
-
pathParams: { workspaceId },
|
|
845
|
-
body:
|
|
863
|
+
pathParams: { workspaceId: workspace },
|
|
864
|
+
body: update,
|
|
846
865
|
...this.extraProps
|
|
847
866
|
});
|
|
848
867
|
}
|
|
849
|
-
deleteWorkspace(
|
|
868
|
+
deleteWorkspace({ workspace }) {
|
|
850
869
|
return operationsByTag.workspaces.deleteWorkspace({
|
|
851
|
-
pathParams: { workspaceId },
|
|
870
|
+
pathParams: { workspaceId: workspace },
|
|
852
871
|
...this.extraProps
|
|
853
872
|
});
|
|
854
873
|
}
|
|
855
|
-
getWorkspaceMembersList(
|
|
874
|
+
getWorkspaceMembersList({ workspace }) {
|
|
856
875
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
|
857
|
-
pathParams: { workspaceId },
|
|
876
|
+
pathParams: { workspaceId: workspace },
|
|
858
877
|
...this.extraProps
|
|
859
878
|
});
|
|
860
879
|
}
|
|
861
|
-
updateWorkspaceMemberRole(
|
|
880
|
+
updateWorkspaceMemberRole({
|
|
881
|
+
workspace,
|
|
882
|
+
user,
|
|
883
|
+
role
|
|
884
|
+
}) {
|
|
862
885
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
|
863
|
-
pathParams: { workspaceId, userId },
|
|
886
|
+
pathParams: { workspaceId: workspace, userId: user },
|
|
864
887
|
body: { role },
|
|
865
888
|
...this.extraProps
|
|
866
889
|
});
|
|
867
890
|
}
|
|
868
|
-
removeWorkspaceMember(
|
|
891
|
+
removeWorkspaceMember({
|
|
892
|
+
workspace,
|
|
893
|
+
user
|
|
894
|
+
}) {
|
|
869
895
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
|
870
|
-
pathParams: { workspaceId, userId },
|
|
896
|
+
pathParams: { workspaceId: workspace, userId: user },
|
|
871
897
|
...this.extraProps
|
|
872
898
|
});
|
|
873
899
|
}
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
900
|
+
}
|
|
901
|
+
class InvitesApi {
|
|
902
|
+
constructor(extraProps) {
|
|
903
|
+
this.extraProps = extraProps;
|
|
904
|
+
}
|
|
905
|
+
inviteWorkspaceMember({
|
|
906
|
+
workspace,
|
|
907
|
+
email,
|
|
908
|
+
role
|
|
909
|
+
}) {
|
|
910
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
|
911
|
+
pathParams: { workspaceId: workspace },
|
|
877
912
|
body: { email, role },
|
|
878
913
|
...this.extraProps
|
|
879
914
|
});
|
|
880
915
|
}
|
|
881
|
-
updateWorkspaceMemberInvite(
|
|
882
|
-
|
|
883
|
-
|
|
916
|
+
updateWorkspaceMemberInvite({
|
|
917
|
+
workspace,
|
|
918
|
+
invite,
|
|
919
|
+
role
|
|
920
|
+
}) {
|
|
921
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
|
922
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
|
884
923
|
body: { role },
|
|
885
924
|
...this.extraProps
|
|
886
925
|
});
|
|
887
926
|
}
|
|
888
|
-
cancelWorkspaceMemberInvite(
|
|
889
|
-
|
|
890
|
-
|
|
927
|
+
cancelWorkspaceMemberInvite({
|
|
928
|
+
workspace,
|
|
929
|
+
invite
|
|
930
|
+
}) {
|
|
931
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
|
932
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
|
891
933
|
...this.extraProps
|
|
892
934
|
});
|
|
893
935
|
}
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
936
|
+
acceptWorkspaceMemberInvite({
|
|
937
|
+
workspace,
|
|
938
|
+
key
|
|
939
|
+
}) {
|
|
940
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
|
941
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
|
897
942
|
...this.extraProps
|
|
898
943
|
});
|
|
899
944
|
}
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
945
|
+
resendWorkspaceMemberInvite({
|
|
946
|
+
workspace,
|
|
947
|
+
invite
|
|
948
|
+
}) {
|
|
949
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
|
950
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
|
903
951
|
...this.extraProps
|
|
904
952
|
});
|
|
905
953
|
}
|
|
906
954
|
}
|
|
907
|
-
class
|
|
955
|
+
class BranchApi {
|
|
908
956
|
constructor(extraProps) {
|
|
909
957
|
this.extraProps = extraProps;
|
|
910
958
|
}
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
return operationsByTag.database.createDatabase({
|
|
919
|
-
pathParams: { workspace, dbName },
|
|
920
|
-
body: options,
|
|
921
|
-
...this.extraProps
|
|
922
|
-
});
|
|
923
|
-
}
|
|
924
|
-
deleteDatabase(workspace, dbName) {
|
|
925
|
-
return operationsByTag.database.deleteDatabase({
|
|
926
|
-
pathParams: { workspace, dbName },
|
|
927
|
-
...this.extraProps
|
|
928
|
-
});
|
|
929
|
-
}
|
|
930
|
-
getDatabaseMetadata(workspace, dbName) {
|
|
931
|
-
return operationsByTag.database.getDatabaseMetadata({
|
|
932
|
-
pathParams: { workspace, dbName },
|
|
933
|
-
...this.extraProps
|
|
934
|
-
});
|
|
935
|
-
}
|
|
936
|
-
updateDatabaseMetadata(workspace, dbName, options = {}) {
|
|
937
|
-
return operationsByTag.database.updateDatabaseMetadata({
|
|
938
|
-
pathParams: { workspace, dbName },
|
|
939
|
-
body: options,
|
|
940
|
-
...this.extraProps
|
|
941
|
-
});
|
|
942
|
-
}
|
|
943
|
-
getGitBranchesMapping(workspace, dbName) {
|
|
944
|
-
return operationsByTag.database.getGitBranchesMapping({
|
|
945
|
-
pathParams: { workspace, dbName },
|
|
959
|
+
getBranchList({
|
|
960
|
+
workspace,
|
|
961
|
+
region,
|
|
962
|
+
database
|
|
963
|
+
}) {
|
|
964
|
+
return operationsByTag.branch.getBranchList({
|
|
965
|
+
pathParams: { workspace, region, dbName: database },
|
|
946
966
|
...this.extraProps
|
|
947
967
|
});
|
|
948
968
|
}
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
969
|
+
getBranchDetails({
|
|
970
|
+
workspace,
|
|
971
|
+
region,
|
|
972
|
+
database,
|
|
973
|
+
branch
|
|
974
|
+
}) {
|
|
975
|
+
return operationsByTag.branch.getBranchDetails({
|
|
976
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
953
977
|
...this.extraProps
|
|
954
978
|
});
|
|
955
979
|
}
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
980
|
+
createBranch({
|
|
981
|
+
workspace,
|
|
982
|
+
region,
|
|
983
|
+
database,
|
|
984
|
+
branch,
|
|
985
|
+
from,
|
|
986
|
+
metadata
|
|
987
|
+
}) {
|
|
988
|
+
return operationsByTag.branch.createBranch({
|
|
989
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
990
|
+
body: { from, metadata },
|
|
960
991
|
...this.extraProps
|
|
961
992
|
});
|
|
962
993
|
}
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
994
|
+
deleteBranch({
|
|
995
|
+
workspace,
|
|
996
|
+
region,
|
|
997
|
+
database,
|
|
998
|
+
branch
|
|
999
|
+
}) {
|
|
1000
|
+
return operationsByTag.branch.deleteBranch({
|
|
1001
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
967
1002
|
...this.extraProps
|
|
968
1003
|
});
|
|
969
1004
|
}
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
1005
|
+
updateBranchMetadata({
|
|
1006
|
+
workspace,
|
|
1007
|
+
region,
|
|
1008
|
+
database,
|
|
1009
|
+
branch,
|
|
1010
|
+
metadata
|
|
1011
|
+
}) {
|
|
1012
|
+
return operationsByTag.branch.updateBranchMetadata({
|
|
1013
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1014
|
+
body: metadata,
|
|
978
1015
|
...this.extraProps
|
|
979
1016
|
});
|
|
980
1017
|
}
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
1018
|
+
getBranchMetadata({
|
|
1019
|
+
workspace,
|
|
1020
|
+
region,
|
|
1021
|
+
database,
|
|
1022
|
+
branch
|
|
1023
|
+
}) {
|
|
1024
|
+
return operationsByTag.branch.getBranchMetadata({
|
|
1025
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
984
1026
|
...this.extraProps
|
|
985
1027
|
});
|
|
986
1028
|
}
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
1029
|
+
getBranchStats({
|
|
1030
|
+
workspace,
|
|
1031
|
+
region,
|
|
1032
|
+
database,
|
|
1033
|
+
branch
|
|
1034
|
+
}) {
|
|
1035
|
+
return operationsByTag.branch.getBranchStats({
|
|
1036
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
992
1037
|
...this.extraProps
|
|
993
1038
|
});
|
|
994
1039
|
}
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
1040
|
+
getGitBranchesMapping({
|
|
1041
|
+
workspace,
|
|
1042
|
+
region,
|
|
1043
|
+
database
|
|
1044
|
+
}) {
|
|
1045
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
|
1046
|
+
pathParams: { workspace, region, dbName: database },
|
|
998
1047
|
...this.extraProps
|
|
999
1048
|
});
|
|
1000
1049
|
}
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1050
|
+
addGitBranchesEntry({
|
|
1051
|
+
workspace,
|
|
1052
|
+
region,
|
|
1053
|
+
database,
|
|
1054
|
+
gitBranch,
|
|
1055
|
+
xataBranch
|
|
1056
|
+
}) {
|
|
1057
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
|
1058
|
+
pathParams: { workspace, region, dbName: database },
|
|
1059
|
+
body: { gitBranch, xataBranch },
|
|
1005
1060
|
...this.extraProps
|
|
1006
1061
|
});
|
|
1007
1062
|
}
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1063
|
+
removeGitBranchesEntry({
|
|
1064
|
+
workspace,
|
|
1065
|
+
region,
|
|
1066
|
+
database,
|
|
1067
|
+
gitBranch
|
|
1068
|
+
}) {
|
|
1069
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
|
1070
|
+
pathParams: { workspace, region, dbName: database },
|
|
1071
|
+
queryParams: { gitBranch },
|
|
1011
1072
|
...this.extraProps
|
|
1012
1073
|
});
|
|
1013
1074
|
}
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1075
|
+
resolveBranch({
|
|
1076
|
+
workspace,
|
|
1077
|
+
region,
|
|
1078
|
+
database,
|
|
1079
|
+
gitBranch,
|
|
1080
|
+
fallbackBranch
|
|
1081
|
+
}) {
|
|
1082
|
+
return operationsByTag.branch.resolveBranch({
|
|
1083
|
+
pathParams: { workspace, region, dbName: database },
|
|
1084
|
+
queryParams: { gitBranch, fallbackBranch },
|
|
1017
1085
|
...this.extraProps
|
|
1018
1086
|
});
|
|
1019
1087
|
}
|
|
@@ -1022,67 +1090,134 @@ class TableApi {
|
|
|
1022
1090
|
constructor(extraProps) {
|
|
1023
1091
|
this.extraProps = extraProps;
|
|
1024
1092
|
}
|
|
1025
|
-
createTable(
|
|
1093
|
+
createTable({
|
|
1094
|
+
workspace,
|
|
1095
|
+
region,
|
|
1096
|
+
database,
|
|
1097
|
+
branch,
|
|
1098
|
+
table
|
|
1099
|
+
}) {
|
|
1026
1100
|
return operationsByTag.table.createTable({
|
|
1027
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1101
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1028
1102
|
...this.extraProps
|
|
1029
1103
|
});
|
|
1030
1104
|
}
|
|
1031
|
-
deleteTable(
|
|
1105
|
+
deleteTable({
|
|
1106
|
+
workspace,
|
|
1107
|
+
region,
|
|
1108
|
+
database,
|
|
1109
|
+
branch,
|
|
1110
|
+
table
|
|
1111
|
+
}) {
|
|
1032
1112
|
return operationsByTag.table.deleteTable({
|
|
1033
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1113
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1034
1114
|
...this.extraProps
|
|
1035
1115
|
});
|
|
1036
1116
|
}
|
|
1037
|
-
updateTable(
|
|
1117
|
+
updateTable({
|
|
1118
|
+
workspace,
|
|
1119
|
+
region,
|
|
1120
|
+
database,
|
|
1121
|
+
branch,
|
|
1122
|
+
table,
|
|
1123
|
+
update
|
|
1124
|
+
}) {
|
|
1038
1125
|
return operationsByTag.table.updateTable({
|
|
1039
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1040
|
-
body:
|
|
1126
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1127
|
+
body: update,
|
|
1041
1128
|
...this.extraProps
|
|
1042
1129
|
});
|
|
1043
1130
|
}
|
|
1044
|
-
getTableSchema(
|
|
1131
|
+
getTableSchema({
|
|
1132
|
+
workspace,
|
|
1133
|
+
region,
|
|
1134
|
+
database,
|
|
1135
|
+
branch,
|
|
1136
|
+
table
|
|
1137
|
+
}) {
|
|
1045
1138
|
return operationsByTag.table.getTableSchema({
|
|
1046
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1139
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1047
1140
|
...this.extraProps
|
|
1048
1141
|
});
|
|
1049
1142
|
}
|
|
1050
|
-
setTableSchema(
|
|
1143
|
+
setTableSchema({
|
|
1144
|
+
workspace,
|
|
1145
|
+
region,
|
|
1146
|
+
database,
|
|
1147
|
+
branch,
|
|
1148
|
+
table,
|
|
1149
|
+
schema
|
|
1150
|
+
}) {
|
|
1051
1151
|
return operationsByTag.table.setTableSchema({
|
|
1052
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1053
|
-
body:
|
|
1152
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1153
|
+
body: schema,
|
|
1054
1154
|
...this.extraProps
|
|
1055
1155
|
});
|
|
1056
1156
|
}
|
|
1057
|
-
getTableColumns(
|
|
1157
|
+
getTableColumns({
|
|
1158
|
+
workspace,
|
|
1159
|
+
region,
|
|
1160
|
+
database,
|
|
1161
|
+
branch,
|
|
1162
|
+
table
|
|
1163
|
+
}) {
|
|
1058
1164
|
return operationsByTag.table.getTableColumns({
|
|
1059
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1165
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1060
1166
|
...this.extraProps
|
|
1061
1167
|
});
|
|
1062
1168
|
}
|
|
1063
|
-
addTableColumn(
|
|
1169
|
+
addTableColumn({
|
|
1170
|
+
workspace,
|
|
1171
|
+
region,
|
|
1172
|
+
database,
|
|
1173
|
+
branch,
|
|
1174
|
+
table,
|
|
1175
|
+
column
|
|
1176
|
+
}) {
|
|
1064
1177
|
return operationsByTag.table.addTableColumn({
|
|
1065
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1178
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1066
1179
|
body: column,
|
|
1067
1180
|
...this.extraProps
|
|
1068
1181
|
});
|
|
1069
1182
|
}
|
|
1070
|
-
getColumn(
|
|
1183
|
+
getColumn({
|
|
1184
|
+
workspace,
|
|
1185
|
+
region,
|
|
1186
|
+
database,
|
|
1187
|
+
branch,
|
|
1188
|
+
table,
|
|
1189
|
+
column
|
|
1190
|
+
}) {
|
|
1071
1191
|
return operationsByTag.table.getColumn({
|
|
1072
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
|
1192
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
|
1073
1193
|
...this.extraProps
|
|
1074
1194
|
});
|
|
1075
1195
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1196
|
+
updateColumn({
|
|
1197
|
+
workspace,
|
|
1198
|
+
region,
|
|
1199
|
+
database,
|
|
1200
|
+
branch,
|
|
1201
|
+
table,
|
|
1202
|
+
column,
|
|
1203
|
+
update
|
|
1204
|
+
}) {
|
|
1205
|
+
return operationsByTag.table.updateColumn({
|
|
1206
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
|
1207
|
+
body: update,
|
|
1079
1208
|
...this.extraProps
|
|
1080
1209
|
});
|
|
1081
1210
|
}
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1211
|
+
deleteColumn({
|
|
1212
|
+
workspace,
|
|
1213
|
+
region,
|
|
1214
|
+
database,
|
|
1215
|
+
branch,
|
|
1216
|
+
table,
|
|
1217
|
+
column
|
|
1218
|
+
}) {
|
|
1219
|
+
return operationsByTag.table.deleteColumn({
|
|
1220
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
|
1086
1221
|
...this.extraProps
|
|
1087
1222
|
});
|
|
1088
1223
|
}
|
|
@@ -1091,92 +1226,213 @@ class RecordsApi {
|
|
|
1091
1226
|
constructor(extraProps) {
|
|
1092
1227
|
this.extraProps = extraProps;
|
|
1093
1228
|
}
|
|
1094
|
-
insertRecord(
|
|
1229
|
+
insertRecord({
|
|
1230
|
+
workspace,
|
|
1231
|
+
region,
|
|
1232
|
+
database,
|
|
1233
|
+
branch,
|
|
1234
|
+
table,
|
|
1235
|
+
record,
|
|
1236
|
+
columns
|
|
1237
|
+
}) {
|
|
1095
1238
|
return operationsByTag.records.insertRecord({
|
|
1096
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1097
|
-
queryParams:
|
|
1239
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1240
|
+
queryParams: { columns },
|
|
1098
1241
|
body: record,
|
|
1099
1242
|
...this.extraProps
|
|
1100
1243
|
});
|
|
1101
1244
|
}
|
|
1102
|
-
|
|
1245
|
+
getRecord({
|
|
1246
|
+
workspace,
|
|
1247
|
+
region,
|
|
1248
|
+
database,
|
|
1249
|
+
branch,
|
|
1250
|
+
table,
|
|
1251
|
+
id,
|
|
1252
|
+
columns
|
|
1253
|
+
}) {
|
|
1254
|
+
return operationsByTag.records.getRecord({
|
|
1255
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1256
|
+
queryParams: { columns },
|
|
1257
|
+
...this.extraProps
|
|
1258
|
+
});
|
|
1259
|
+
}
|
|
1260
|
+
insertRecordWithID({
|
|
1261
|
+
workspace,
|
|
1262
|
+
region,
|
|
1263
|
+
database,
|
|
1264
|
+
branch,
|
|
1265
|
+
table,
|
|
1266
|
+
id,
|
|
1267
|
+
record,
|
|
1268
|
+
columns,
|
|
1269
|
+
createOnly,
|
|
1270
|
+
ifVersion
|
|
1271
|
+
}) {
|
|
1103
1272
|
return operationsByTag.records.insertRecordWithID({
|
|
1104
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1105
|
-
queryParams:
|
|
1273
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1274
|
+
queryParams: { columns, createOnly, ifVersion },
|
|
1106
1275
|
body: record,
|
|
1107
1276
|
...this.extraProps
|
|
1108
1277
|
});
|
|
1109
1278
|
}
|
|
1110
|
-
updateRecordWithID(
|
|
1279
|
+
updateRecordWithID({
|
|
1280
|
+
workspace,
|
|
1281
|
+
region,
|
|
1282
|
+
database,
|
|
1283
|
+
branch,
|
|
1284
|
+
table,
|
|
1285
|
+
id,
|
|
1286
|
+
record,
|
|
1287
|
+
columns,
|
|
1288
|
+
ifVersion
|
|
1289
|
+
}) {
|
|
1111
1290
|
return operationsByTag.records.updateRecordWithID({
|
|
1112
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1113
|
-
queryParams:
|
|
1291
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1292
|
+
queryParams: { columns, ifVersion },
|
|
1114
1293
|
body: record,
|
|
1115
1294
|
...this.extraProps
|
|
1116
1295
|
});
|
|
1117
1296
|
}
|
|
1118
|
-
upsertRecordWithID(
|
|
1297
|
+
upsertRecordWithID({
|
|
1298
|
+
workspace,
|
|
1299
|
+
region,
|
|
1300
|
+
database,
|
|
1301
|
+
branch,
|
|
1302
|
+
table,
|
|
1303
|
+
id,
|
|
1304
|
+
record,
|
|
1305
|
+
columns,
|
|
1306
|
+
ifVersion
|
|
1307
|
+
}) {
|
|
1119
1308
|
return operationsByTag.records.upsertRecordWithID({
|
|
1120
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1121
|
-
queryParams:
|
|
1309
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1310
|
+
queryParams: { columns, ifVersion },
|
|
1122
1311
|
body: record,
|
|
1123
1312
|
...this.extraProps
|
|
1124
1313
|
});
|
|
1125
1314
|
}
|
|
1126
|
-
deleteRecord(
|
|
1315
|
+
deleteRecord({
|
|
1316
|
+
workspace,
|
|
1317
|
+
region,
|
|
1318
|
+
database,
|
|
1319
|
+
branch,
|
|
1320
|
+
table,
|
|
1321
|
+
id,
|
|
1322
|
+
columns
|
|
1323
|
+
}) {
|
|
1127
1324
|
return operationsByTag.records.deleteRecord({
|
|
1128
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1129
|
-
queryParams:
|
|
1130
|
-
...this.extraProps
|
|
1131
|
-
});
|
|
1132
|
-
}
|
|
1133
|
-
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
|
1134
|
-
return operationsByTag.records.getRecord({
|
|
1135
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
|
1136
|
-
queryParams: options,
|
|
1325
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
|
1326
|
+
queryParams: { columns },
|
|
1137
1327
|
...this.extraProps
|
|
1138
1328
|
});
|
|
1139
1329
|
}
|
|
1140
|
-
bulkInsertTableRecords(
|
|
1330
|
+
bulkInsertTableRecords({
|
|
1331
|
+
workspace,
|
|
1332
|
+
region,
|
|
1333
|
+
database,
|
|
1334
|
+
branch,
|
|
1335
|
+
table,
|
|
1336
|
+
records,
|
|
1337
|
+
columns
|
|
1338
|
+
}) {
|
|
1141
1339
|
return operationsByTag.records.bulkInsertTableRecords({
|
|
1142
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1143
|
-
queryParams:
|
|
1340
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1341
|
+
queryParams: { columns },
|
|
1144
1342
|
body: { records },
|
|
1145
1343
|
...this.extraProps
|
|
1146
1344
|
});
|
|
1147
1345
|
}
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
...this.extraProps
|
|
1153
|
-
});
|
|
1154
|
-
}
|
|
1155
|
-
searchTable(workspace, database, branch, tableName, query) {
|
|
1156
|
-
return operationsByTag.records.searchTable({
|
|
1157
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1158
|
-
body: query,
|
|
1159
|
-
...this.extraProps
|
|
1160
|
-
});
|
|
1161
|
-
}
|
|
1162
|
-
searchBranch(workspace, database, branch, query) {
|
|
1163
|
-
return operationsByTag.records.searchBranch({
|
|
1164
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
|
1165
|
-
body: query,
|
|
1166
|
-
...this.extraProps
|
|
1167
|
-
});
|
|
1168
|
-
}
|
|
1169
|
-
summarizeTable(workspace, database, branch, tableName, query) {
|
|
1170
|
-
return operationsByTag.records.summarizeTable({
|
|
1171
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
|
1172
|
-
body: query,
|
|
1173
|
-
...this.extraProps
|
|
1174
|
-
});
|
|
1346
|
+
}
|
|
1347
|
+
class SearchAndFilterApi {
|
|
1348
|
+
constructor(extraProps) {
|
|
1349
|
+
this.extraProps = extraProps;
|
|
1175
1350
|
}
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1351
|
+
queryTable({
|
|
1352
|
+
workspace,
|
|
1353
|
+
region,
|
|
1354
|
+
database,
|
|
1355
|
+
branch,
|
|
1356
|
+
table,
|
|
1357
|
+
filter,
|
|
1358
|
+
sort,
|
|
1359
|
+
page,
|
|
1360
|
+
columns
|
|
1361
|
+
}) {
|
|
1362
|
+
return operationsByTag.searchAndFilter.queryTable({
|
|
1363
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1364
|
+
body: { filter, sort, page, columns },
|
|
1365
|
+
...this.extraProps
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
searchTable({
|
|
1369
|
+
workspace,
|
|
1370
|
+
region,
|
|
1371
|
+
database,
|
|
1372
|
+
branch,
|
|
1373
|
+
table,
|
|
1374
|
+
query,
|
|
1375
|
+
fuzziness,
|
|
1376
|
+
target,
|
|
1377
|
+
prefix,
|
|
1378
|
+
filter,
|
|
1379
|
+
highlight,
|
|
1380
|
+
boosters
|
|
1381
|
+
}) {
|
|
1382
|
+
return operationsByTag.searchAndFilter.searchTable({
|
|
1383
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1384
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
|
1385
|
+
...this.extraProps
|
|
1386
|
+
});
|
|
1387
|
+
}
|
|
1388
|
+
searchBranch({
|
|
1389
|
+
workspace,
|
|
1390
|
+
region,
|
|
1391
|
+
database,
|
|
1392
|
+
branch,
|
|
1393
|
+
tables,
|
|
1394
|
+
query,
|
|
1395
|
+
fuzziness,
|
|
1396
|
+
prefix,
|
|
1397
|
+
highlight
|
|
1398
|
+
}) {
|
|
1399
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
|
1400
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1401
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
|
1402
|
+
...this.extraProps
|
|
1403
|
+
});
|
|
1404
|
+
}
|
|
1405
|
+
summarizeTable({
|
|
1406
|
+
workspace,
|
|
1407
|
+
region,
|
|
1408
|
+
database,
|
|
1409
|
+
branch,
|
|
1410
|
+
table,
|
|
1411
|
+
filter,
|
|
1412
|
+
columns,
|
|
1413
|
+
summaries,
|
|
1414
|
+
sort,
|
|
1415
|
+
summariesFilter,
|
|
1416
|
+
page
|
|
1417
|
+
}) {
|
|
1418
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
|
1419
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1420
|
+
body: { filter, columns, summaries, sort, summariesFilter, page },
|
|
1421
|
+
...this.extraProps
|
|
1422
|
+
});
|
|
1423
|
+
}
|
|
1424
|
+
aggregateTable({
|
|
1425
|
+
workspace,
|
|
1426
|
+
region,
|
|
1427
|
+
database,
|
|
1428
|
+
branch,
|
|
1429
|
+
table,
|
|
1430
|
+
filter,
|
|
1431
|
+
aggs
|
|
1432
|
+
}) {
|
|
1433
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
|
1434
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
|
1435
|
+
body: { filter, aggs },
|
|
1180
1436
|
...this.extraProps
|
|
1181
1437
|
});
|
|
1182
1438
|
}
|
|
@@ -1185,123 +1441,281 @@ class MigrationRequestsApi {
|
|
|
1185
1441
|
constructor(extraProps) {
|
|
1186
1442
|
this.extraProps = extraProps;
|
|
1187
1443
|
}
|
|
1188
|
-
queryMigrationRequests(
|
|
1444
|
+
queryMigrationRequests({
|
|
1445
|
+
workspace,
|
|
1446
|
+
region,
|
|
1447
|
+
database,
|
|
1448
|
+
filter,
|
|
1449
|
+
sort,
|
|
1450
|
+
page,
|
|
1451
|
+
columns
|
|
1452
|
+
}) {
|
|
1189
1453
|
return operationsByTag.migrationRequests.queryMigrationRequests({
|
|
1190
|
-
pathParams: { workspace, dbName: database },
|
|
1191
|
-
body:
|
|
1454
|
+
pathParams: { workspace, region, dbName: database },
|
|
1455
|
+
body: { filter, sort, page, columns },
|
|
1192
1456
|
...this.extraProps
|
|
1193
1457
|
});
|
|
1194
1458
|
}
|
|
1195
|
-
createMigrationRequest(
|
|
1459
|
+
createMigrationRequest({
|
|
1460
|
+
workspace,
|
|
1461
|
+
region,
|
|
1462
|
+
database,
|
|
1463
|
+
migration
|
|
1464
|
+
}) {
|
|
1196
1465
|
return operationsByTag.migrationRequests.createMigrationRequest({
|
|
1197
|
-
pathParams: { workspace, dbName: database },
|
|
1198
|
-
body:
|
|
1466
|
+
pathParams: { workspace, region, dbName: database },
|
|
1467
|
+
body: migration,
|
|
1199
1468
|
...this.extraProps
|
|
1200
1469
|
});
|
|
1201
1470
|
}
|
|
1202
|
-
getMigrationRequest(
|
|
1471
|
+
getMigrationRequest({
|
|
1472
|
+
workspace,
|
|
1473
|
+
region,
|
|
1474
|
+
database,
|
|
1475
|
+
migrationRequest
|
|
1476
|
+
}) {
|
|
1203
1477
|
return operationsByTag.migrationRequests.getMigrationRequest({
|
|
1204
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1478
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1205
1479
|
...this.extraProps
|
|
1206
1480
|
});
|
|
1207
1481
|
}
|
|
1208
|
-
updateMigrationRequest(
|
|
1482
|
+
updateMigrationRequest({
|
|
1483
|
+
workspace,
|
|
1484
|
+
region,
|
|
1485
|
+
database,
|
|
1486
|
+
migrationRequest,
|
|
1487
|
+
update
|
|
1488
|
+
}) {
|
|
1209
1489
|
return operationsByTag.migrationRequests.updateMigrationRequest({
|
|
1210
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1211
|
-
body:
|
|
1490
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1491
|
+
body: update,
|
|
1212
1492
|
...this.extraProps
|
|
1213
1493
|
});
|
|
1214
1494
|
}
|
|
1215
|
-
listMigrationRequestsCommits(
|
|
1495
|
+
listMigrationRequestsCommits({
|
|
1496
|
+
workspace,
|
|
1497
|
+
region,
|
|
1498
|
+
database,
|
|
1499
|
+
migrationRequest,
|
|
1500
|
+
page
|
|
1501
|
+
}) {
|
|
1216
1502
|
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
|
1217
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1218
|
-
body:
|
|
1503
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1504
|
+
body: { page },
|
|
1219
1505
|
...this.extraProps
|
|
1220
1506
|
});
|
|
1221
1507
|
}
|
|
1222
|
-
compareMigrationRequest(
|
|
1508
|
+
compareMigrationRequest({
|
|
1509
|
+
workspace,
|
|
1510
|
+
region,
|
|
1511
|
+
database,
|
|
1512
|
+
migrationRequest
|
|
1513
|
+
}) {
|
|
1223
1514
|
return operationsByTag.migrationRequests.compareMigrationRequest({
|
|
1224
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1515
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1225
1516
|
...this.extraProps
|
|
1226
1517
|
});
|
|
1227
1518
|
}
|
|
1228
|
-
getMigrationRequestIsMerged(
|
|
1519
|
+
getMigrationRequestIsMerged({
|
|
1520
|
+
workspace,
|
|
1521
|
+
region,
|
|
1522
|
+
database,
|
|
1523
|
+
migrationRequest
|
|
1524
|
+
}) {
|
|
1229
1525
|
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
|
1230
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1526
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1231
1527
|
...this.extraProps
|
|
1232
1528
|
});
|
|
1233
1529
|
}
|
|
1234
|
-
mergeMigrationRequest(
|
|
1530
|
+
mergeMigrationRequest({
|
|
1531
|
+
workspace,
|
|
1532
|
+
region,
|
|
1533
|
+
database,
|
|
1534
|
+
migrationRequest
|
|
1535
|
+
}) {
|
|
1235
1536
|
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
|
1236
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
|
1537
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
|
1237
1538
|
...this.extraProps
|
|
1238
1539
|
});
|
|
1239
1540
|
}
|
|
1240
1541
|
}
|
|
1241
|
-
class
|
|
1542
|
+
class MigrationsApi {
|
|
1242
1543
|
constructor(extraProps) {
|
|
1243
1544
|
this.extraProps = extraProps;
|
|
1244
1545
|
}
|
|
1245
|
-
getBranchMigrationHistory(
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1546
|
+
getBranchMigrationHistory({
|
|
1547
|
+
workspace,
|
|
1548
|
+
region,
|
|
1549
|
+
database,
|
|
1550
|
+
branch,
|
|
1551
|
+
limit,
|
|
1552
|
+
startFrom
|
|
1553
|
+
}) {
|
|
1554
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
|
1555
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1556
|
+
body: { limit, startFrom },
|
|
1557
|
+
...this.extraProps
|
|
1558
|
+
});
|
|
1559
|
+
}
|
|
1560
|
+
getBranchMigrationPlan({
|
|
1561
|
+
workspace,
|
|
1562
|
+
region,
|
|
1563
|
+
database,
|
|
1564
|
+
branch,
|
|
1565
|
+
schema
|
|
1566
|
+
}) {
|
|
1567
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
|
1568
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1569
|
+
body: schema,
|
|
1249
1570
|
...this.extraProps
|
|
1250
1571
|
});
|
|
1251
1572
|
}
|
|
1252
|
-
executeBranchMigrationPlan(
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1573
|
+
executeBranchMigrationPlan({
|
|
1574
|
+
workspace,
|
|
1575
|
+
region,
|
|
1576
|
+
database,
|
|
1577
|
+
branch,
|
|
1578
|
+
plan
|
|
1579
|
+
}) {
|
|
1580
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
|
1581
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1582
|
+
body: plan,
|
|
1256
1583
|
...this.extraProps
|
|
1257
1584
|
});
|
|
1258
1585
|
}
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1586
|
+
getBranchSchemaHistory({
|
|
1587
|
+
workspace,
|
|
1588
|
+
region,
|
|
1589
|
+
database,
|
|
1590
|
+
branch,
|
|
1591
|
+
page
|
|
1592
|
+
}) {
|
|
1593
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
|
1594
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1595
|
+
body: { page },
|
|
1263
1596
|
...this.extraProps
|
|
1264
1597
|
});
|
|
1265
1598
|
}
|
|
1266
|
-
compareBranchWithUserSchema(
|
|
1267
|
-
|
|
1268
|
-
|
|
1599
|
+
compareBranchWithUserSchema({
|
|
1600
|
+
workspace,
|
|
1601
|
+
region,
|
|
1602
|
+
database,
|
|
1603
|
+
branch,
|
|
1604
|
+
schema
|
|
1605
|
+
}) {
|
|
1606
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
|
1607
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1269
1608
|
body: { schema },
|
|
1270
1609
|
...this.extraProps
|
|
1271
1610
|
});
|
|
1272
1611
|
}
|
|
1273
|
-
compareBranchSchemas(
|
|
1274
|
-
|
|
1275
|
-
|
|
1612
|
+
compareBranchSchemas({
|
|
1613
|
+
workspace,
|
|
1614
|
+
region,
|
|
1615
|
+
database,
|
|
1616
|
+
branch,
|
|
1617
|
+
compare,
|
|
1618
|
+
schema
|
|
1619
|
+
}) {
|
|
1620
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
|
1621
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
|
1276
1622
|
body: { schema },
|
|
1277
1623
|
...this.extraProps
|
|
1278
1624
|
});
|
|
1279
1625
|
}
|
|
1280
|
-
updateBranchSchema(
|
|
1281
|
-
|
|
1282
|
-
|
|
1626
|
+
updateBranchSchema({
|
|
1627
|
+
workspace,
|
|
1628
|
+
region,
|
|
1629
|
+
database,
|
|
1630
|
+
branch,
|
|
1631
|
+
migration
|
|
1632
|
+
}) {
|
|
1633
|
+
return operationsByTag.migrations.updateBranchSchema({
|
|
1634
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1283
1635
|
body: migration,
|
|
1284
1636
|
...this.extraProps
|
|
1285
1637
|
});
|
|
1286
1638
|
}
|
|
1287
|
-
previewBranchSchemaEdit(
|
|
1288
|
-
|
|
1289
|
-
|
|
1290
|
-
|
|
1639
|
+
previewBranchSchemaEdit({
|
|
1640
|
+
workspace,
|
|
1641
|
+
region,
|
|
1642
|
+
database,
|
|
1643
|
+
branch,
|
|
1644
|
+
data
|
|
1645
|
+
}) {
|
|
1646
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
|
1647
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1648
|
+
body: data,
|
|
1291
1649
|
...this.extraProps
|
|
1292
1650
|
});
|
|
1293
1651
|
}
|
|
1294
|
-
applyBranchSchemaEdit(
|
|
1295
|
-
|
|
1296
|
-
|
|
1652
|
+
applyBranchSchemaEdit({
|
|
1653
|
+
workspace,
|
|
1654
|
+
region,
|
|
1655
|
+
database,
|
|
1656
|
+
branch,
|
|
1657
|
+
edits
|
|
1658
|
+
}) {
|
|
1659
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
|
1660
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
|
1297
1661
|
body: { edits },
|
|
1298
1662
|
...this.extraProps
|
|
1299
1663
|
});
|
|
1300
1664
|
}
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
1304
|
-
|
|
1665
|
+
}
|
|
1666
|
+
class DatabaseApi {
|
|
1667
|
+
constructor(extraProps) {
|
|
1668
|
+
this.extraProps = extraProps;
|
|
1669
|
+
}
|
|
1670
|
+
getDatabaseList({ workspace }) {
|
|
1671
|
+
return operationsByTag.databases.getDatabaseList({
|
|
1672
|
+
pathParams: { workspaceId: workspace },
|
|
1673
|
+
...this.extraProps
|
|
1674
|
+
});
|
|
1675
|
+
}
|
|
1676
|
+
createDatabase({
|
|
1677
|
+
workspace,
|
|
1678
|
+
database,
|
|
1679
|
+
data
|
|
1680
|
+
}) {
|
|
1681
|
+
return operationsByTag.databases.createDatabase({
|
|
1682
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
|
1683
|
+
body: data,
|
|
1684
|
+
...this.extraProps
|
|
1685
|
+
});
|
|
1686
|
+
}
|
|
1687
|
+
deleteDatabase({
|
|
1688
|
+
workspace,
|
|
1689
|
+
database
|
|
1690
|
+
}) {
|
|
1691
|
+
return operationsByTag.databases.deleteDatabase({
|
|
1692
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
|
1693
|
+
...this.extraProps
|
|
1694
|
+
});
|
|
1695
|
+
}
|
|
1696
|
+
getDatabaseMetadata({
|
|
1697
|
+
workspace,
|
|
1698
|
+
database
|
|
1699
|
+
}) {
|
|
1700
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
|
1701
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
|
1702
|
+
...this.extraProps
|
|
1703
|
+
});
|
|
1704
|
+
}
|
|
1705
|
+
updateDatabaseMetadata({
|
|
1706
|
+
workspace,
|
|
1707
|
+
database,
|
|
1708
|
+
metadata
|
|
1709
|
+
}) {
|
|
1710
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
|
1711
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
|
1712
|
+
body: metadata,
|
|
1713
|
+
...this.extraProps
|
|
1714
|
+
});
|
|
1715
|
+
}
|
|
1716
|
+
listRegions({ workspace }) {
|
|
1717
|
+
return operationsByTag.databases.listRegions({
|
|
1718
|
+
pathParams: { workspaceId: workspace },
|
|
1305
1719
|
...this.extraProps
|
|
1306
1720
|
});
|
|
1307
1721
|
}
|
|
@@ -1317,6 +1731,13 @@ class XataApiPlugin {
|
|
|
1317
1731
|
class XataPlugin {
|
|
1318
1732
|
}
|
|
1319
1733
|
|
|
1734
|
+
function generateUUID() {
|
|
1735
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
|
1736
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
|
1737
|
+
return v.toString(16);
|
|
1738
|
+
});
|
|
1739
|
+
}
|
|
1740
|
+
|
|
1320
1741
|
function cleanFilter(filter) {
|
|
1321
1742
|
if (!filter)
|
|
1322
1743
|
return void 0;
|
|
@@ -1625,7 +2046,7 @@ cleanFilterConstraint_fn = function(column, value) {
|
|
|
1625
2046
|
};
|
|
1626
2047
|
function cleanParent(data, parent) {
|
|
1627
2048
|
if (isCursorPaginationOptions(data.pagination)) {
|
|
1628
|
-
return { ...parent,
|
|
2049
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
|
1629
2050
|
}
|
|
1630
2051
|
return parent;
|
|
1631
2052
|
}
|
|
@@ -1710,10 +2131,13 @@ class RestRepository extends Query {
|
|
|
1710
2131
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
|
1711
2132
|
__privateAdd$4(this, _trace, void 0);
|
|
1712
2133
|
__privateSet$4(this, _table, options.table);
|
|
1713
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
|
1714
2134
|
__privateSet$4(this, _db, options.db);
|
|
1715
2135
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
|
1716
2136
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
|
2137
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
|
2138
|
+
const props = await options.pluginOptions.getFetchProps();
|
|
2139
|
+
return { ...props, sessionID: generateUUID() };
|
|
2140
|
+
});
|
|
1717
2141
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
|
1718
2142
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
|
1719
2143
|
return trace(name, fn, {
|
|
@@ -1724,8 +2148,9 @@ class RestRepository extends Query {
|
|
|
1724
2148
|
});
|
|
1725
2149
|
});
|
|
1726
2150
|
}
|
|
1727
|
-
async create(a, b, c) {
|
|
2151
|
+
async create(a, b, c, d) {
|
|
1728
2152
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
|
2153
|
+
const ifVersion = parseIfVersion(b, c, d);
|
|
1729
2154
|
if (Array.isArray(a)) {
|
|
1730
2155
|
if (a.length === 0)
|
|
1731
2156
|
return [];
|
|
@@ -1736,13 +2161,13 @@ class RestRepository extends Query {
|
|
|
1736
2161
|
if (a === "")
|
|
1737
2162
|
throw new Error("The id can't be empty");
|
|
1738
2163
|
const columns = isStringArray(c) ? c : void 0;
|
|
1739
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
|
2164
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
|
1740
2165
|
}
|
|
1741
2166
|
if (isObject(a) && isString(a.id)) {
|
|
1742
2167
|
if (a.id === "")
|
|
1743
2168
|
throw new Error("The id can't be empty");
|
|
1744
2169
|
const columns = isStringArray(b) ? b : void 0;
|
|
1745
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
|
2170
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
|
1746
2171
|
}
|
|
1747
2172
|
if (isObject(a)) {
|
|
1748
2173
|
const columns = isStringArray(b) ? b : void 0;
|
|
@@ -1773,6 +2198,7 @@ class RestRepository extends Query {
|
|
|
1773
2198
|
pathParams: {
|
|
1774
2199
|
workspace: "{workspaceId}",
|
|
1775
2200
|
dbBranchName: "{dbBranch}",
|
|
2201
|
+
region: "{region}",
|
|
1776
2202
|
tableName: __privateGet$4(this, _table),
|
|
1777
2203
|
recordId: id
|
|
1778
2204
|
},
|
|
@@ -1810,8 +2236,9 @@ class RestRepository extends Query {
|
|
|
1810
2236
|
return result;
|
|
1811
2237
|
});
|
|
1812
2238
|
}
|
|
1813
|
-
async update(a, b, c) {
|
|
2239
|
+
async update(a, b, c, d) {
|
|
1814
2240
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
|
2241
|
+
const ifVersion = parseIfVersion(b, c, d);
|
|
1815
2242
|
if (Array.isArray(a)) {
|
|
1816
2243
|
if (a.length === 0)
|
|
1817
2244
|
return [];
|
|
@@ -1823,18 +2250,18 @@ class RestRepository extends Query {
|
|
|
1823
2250
|
}
|
|
1824
2251
|
if (isString(a) && isObject(b)) {
|
|
1825
2252
|
const columns = isStringArray(c) ? c : void 0;
|
|
1826
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
|
2253
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
|
1827
2254
|
}
|
|
1828
2255
|
if (isObject(a) && isString(a.id)) {
|
|
1829
2256
|
const columns = isStringArray(b) ? b : void 0;
|
|
1830
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
|
2257
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
|
1831
2258
|
}
|
|
1832
2259
|
throw new Error("Invalid arguments for update method");
|
|
1833
2260
|
});
|
|
1834
2261
|
}
|
|
1835
|
-
async updateOrThrow(a, b, c) {
|
|
2262
|
+
async updateOrThrow(a, b, c, d) {
|
|
1836
2263
|
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
|
1837
|
-
const result = await this.update(a, b, c);
|
|
2264
|
+
const result = await this.update(a, b, c, d);
|
|
1838
2265
|
if (Array.isArray(result)) {
|
|
1839
2266
|
const missingIds = compact(
|
|
1840
2267
|
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
|
@@ -1851,8 +2278,9 @@ class RestRepository extends Query {
|
|
|
1851
2278
|
return result;
|
|
1852
2279
|
});
|
|
1853
2280
|
}
|
|
1854
|
-
async createOrUpdate(a, b, c) {
|
|
2281
|
+
async createOrUpdate(a, b, c, d) {
|
|
1855
2282
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
|
2283
|
+
const ifVersion = parseIfVersion(b, c, d);
|
|
1856
2284
|
if (Array.isArray(a)) {
|
|
1857
2285
|
if (a.length === 0)
|
|
1858
2286
|
return [];
|
|
@@ -1864,15 +2292,35 @@ class RestRepository extends Query {
|
|
|
1864
2292
|
}
|
|
1865
2293
|
if (isString(a) && isObject(b)) {
|
|
1866
2294
|
const columns = isStringArray(c) ? c : void 0;
|
|
1867
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
|
2295
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
|
1868
2296
|
}
|
|
1869
2297
|
if (isObject(a) && isString(a.id)) {
|
|
1870
2298
|
const columns = isStringArray(c) ? c : void 0;
|
|
1871
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
|
2299
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
|
1872
2300
|
}
|
|
1873
2301
|
throw new Error("Invalid arguments for createOrUpdate method");
|
|
1874
2302
|
});
|
|
1875
2303
|
}
|
|
2304
|
+
async createOrReplace(a, b, c, d) {
|
|
2305
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
|
2306
|
+
const ifVersion = parseIfVersion(b, c, d);
|
|
2307
|
+
if (Array.isArray(a)) {
|
|
2308
|
+
if (a.length === 0)
|
|
2309
|
+
return [];
|
|
2310
|
+
const columns = isStringArray(b) ? b : ["*"];
|
|
2311
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
|
2312
|
+
}
|
|
2313
|
+
if (isString(a) && isObject(b)) {
|
|
2314
|
+
const columns = isStringArray(c) ? c : void 0;
|
|
2315
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
|
2316
|
+
}
|
|
2317
|
+
if (isObject(a) && isString(a.id)) {
|
|
2318
|
+
const columns = isStringArray(c) ? c : void 0;
|
|
2319
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
|
2320
|
+
}
|
|
2321
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
|
2322
|
+
});
|
|
2323
|
+
}
|
|
1876
2324
|
async delete(a, b) {
|
|
1877
2325
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
|
1878
2326
|
if (Array.isArray(a)) {
|
|
@@ -1914,7 +2362,12 @@ class RestRepository extends Query {
|
|
|
1914
2362
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
|
1915
2363
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
1916
2364
|
const { records } = await searchTable({
|
|
1917
|
-
pathParams: {
|
|
2365
|
+
pathParams: {
|
|
2366
|
+
workspace: "{workspaceId}",
|
|
2367
|
+
dbBranchName: "{dbBranch}",
|
|
2368
|
+
region: "{region}",
|
|
2369
|
+
tableName: __privateGet$4(this, _table)
|
|
2370
|
+
},
|
|
1918
2371
|
body: {
|
|
1919
2372
|
query,
|
|
1920
2373
|
fuzziness: options.fuzziness,
|
|
@@ -1933,7 +2386,12 @@ class RestRepository extends Query {
|
|
|
1933
2386
|
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
|
1934
2387
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
1935
2388
|
const result = await aggregateTable({
|
|
1936
|
-
pathParams: {
|
|
2389
|
+
pathParams: {
|
|
2390
|
+
workspace: "{workspaceId}",
|
|
2391
|
+
dbBranchName: "{dbBranch}",
|
|
2392
|
+
region: "{region}",
|
|
2393
|
+
tableName: __privateGet$4(this, _table)
|
|
2394
|
+
},
|
|
1937
2395
|
body: { aggs, filter },
|
|
1938
2396
|
...fetchProps
|
|
1939
2397
|
});
|
|
@@ -1948,7 +2406,12 @@ class RestRepository extends Query {
|
|
|
1948
2406
|
const data = query.getQueryOptions();
|
|
1949
2407
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
1950
2408
|
const { meta, records: objects } = await queryTable({
|
|
1951
|
-
pathParams: {
|
|
2409
|
+
pathParams: {
|
|
2410
|
+
workspace: "{workspaceId}",
|
|
2411
|
+
dbBranchName: "{dbBranch}",
|
|
2412
|
+
region: "{region}",
|
|
2413
|
+
tableName: __privateGet$4(this, _table)
|
|
2414
|
+
},
|
|
1952
2415
|
body: {
|
|
1953
2416
|
filter: cleanFilter(data.filter),
|
|
1954
2417
|
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
|
@@ -1970,11 +2433,17 @@ class RestRepository extends Query {
|
|
|
1970
2433
|
const data = query.getQueryOptions();
|
|
1971
2434
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
1972
2435
|
const result = await summarizeTable({
|
|
1973
|
-
pathParams: {
|
|
2436
|
+
pathParams: {
|
|
2437
|
+
workspace: "{workspaceId}",
|
|
2438
|
+
dbBranchName: "{dbBranch}",
|
|
2439
|
+
region: "{region}",
|
|
2440
|
+
tableName: __privateGet$4(this, _table)
|
|
2441
|
+
},
|
|
1974
2442
|
body: {
|
|
1975
2443
|
filter: cleanFilter(data.filter),
|
|
1976
2444
|
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
|
1977
2445
|
columns: data.columns,
|
|
2446
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
|
1978
2447
|
summaries,
|
|
1979
2448
|
summariesFilter
|
|
1980
2449
|
},
|
|
@@ -1998,6 +2467,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
|
1998
2467
|
pathParams: {
|
|
1999
2468
|
workspace: "{workspaceId}",
|
|
2000
2469
|
dbBranchName: "{dbBranch}",
|
|
2470
|
+
region: "{region}",
|
|
2001
2471
|
tableName: __privateGet$4(this, _table)
|
|
2002
2472
|
},
|
|
2003
2473
|
queryParams: { columns },
|
|
@@ -2008,18 +2478,19 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
|
2008
2478
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
|
2009
2479
|
};
|
|
2010
2480
|
_insertRecordWithId = new WeakSet();
|
|
2011
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
|
2481
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
|
2012
2482
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2013
2483
|
const record = transformObjectLinks(object);
|
|
2014
2484
|
const response = await insertRecordWithID({
|
|
2015
2485
|
pathParams: {
|
|
2016
2486
|
workspace: "{workspaceId}",
|
|
2017
2487
|
dbBranchName: "{dbBranch}",
|
|
2488
|
+
region: "{region}",
|
|
2018
2489
|
tableName: __privateGet$4(this, _table),
|
|
2019
2490
|
recordId
|
|
2020
2491
|
},
|
|
2021
2492
|
body: record,
|
|
2022
|
-
queryParams: { createOnly
|
|
2493
|
+
queryParams: { createOnly, columns, ifVersion },
|
|
2023
2494
|
...fetchProps
|
|
2024
2495
|
});
|
|
2025
2496
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
|
@@ -2030,7 +2501,12 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
|
2030
2501
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2031
2502
|
const records = objects.map((object) => transformObjectLinks(object));
|
|
2032
2503
|
const response = await bulkInsertTableRecords({
|
|
2033
|
-
pathParams: {
|
|
2504
|
+
pathParams: {
|
|
2505
|
+
workspace: "{workspaceId}",
|
|
2506
|
+
dbBranchName: "{dbBranch}",
|
|
2507
|
+
region: "{region}",
|
|
2508
|
+
tableName: __privateGet$4(this, _table)
|
|
2509
|
+
},
|
|
2034
2510
|
queryParams: { columns },
|
|
2035
2511
|
body: { records },
|
|
2036
2512
|
...fetchProps
|
|
@@ -2042,13 +2518,19 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
|
2042
2518
|
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
|
2043
2519
|
};
|
|
2044
2520
|
_updateRecordWithID = new WeakSet();
|
|
2045
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
2521
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
|
2046
2522
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2047
2523
|
const record = transformObjectLinks(object);
|
|
2048
2524
|
try {
|
|
2049
2525
|
const response = await updateRecordWithID({
|
|
2050
|
-
pathParams: {
|
|
2051
|
-
|
|
2526
|
+
pathParams: {
|
|
2527
|
+
workspace: "{workspaceId}",
|
|
2528
|
+
dbBranchName: "{dbBranch}",
|
|
2529
|
+
region: "{region}",
|
|
2530
|
+
tableName: __privateGet$4(this, _table),
|
|
2531
|
+
recordId
|
|
2532
|
+
},
|
|
2533
|
+
queryParams: { columns, ifVersion },
|
|
2052
2534
|
body: record,
|
|
2053
2535
|
...fetchProps
|
|
2054
2536
|
});
|
|
@@ -2062,11 +2544,17 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
|
2062
2544
|
}
|
|
2063
2545
|
};
|
|
2064
2546
|
_upsertRecordWithID = new WeakSet();
|
|
2065
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
2547
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
|
2066
2548
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2067
2549
|
const response = await upsertRecordWithID({
|
|
2068
|
-
pathParams: {
|
|
2069
|
-
|
|
2550
|
+
pathParams: {
|
|
2551
|
+
workspace: "{workspaceId}",
|
|
2552
|
+
dbBranchName: "{dbBranch}",
|
|
2553
|
+
region: "{region}",
|
|
2554
|
+
tableName: __privateGet$4(this, _table),
|
|
2555
|
+
recordId
|
|
2556
|
+
},
|
|
2557
|
+
queryParams: { columns, ifVersion },
|
|
2070
2558
|
body: object,
|
|
2071
2559
|
...fetchProps
|
|
2072
2560
|
});
|
|
@@ -2078,7 +2566,13 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
|
2078
2566
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2079
2567
|
try {
|
|
2080
2568
|
const response = await deleteRecord({
|
|
2081
|
-
pathParams: {
|
|
2569
|
+
pathParams: {
|
|
2570
|
+
workspace: "{workspaceId}",
|
|
2571
|
+
dbBranchName: "{dbBranch}",
|
|
2572
|
+
region: "{region}",
|
|
2573
|
+
tableName: __privateGet$4(this, _table),
|
|
2574
|
+
recordId
|
|
2575
|
+
},
|
|
2082
2576
|
queryParams: { columns },
|
|
2083
2577
|
...fetchProps
|
|
2084
2578
|
});
|
|
@@ -2113,7 +2607,7 @@ getSchemaTables_fn$1 = async function() {
|
|
|
2113
2607
|
return __privateGet$4(this, _schemaTables$2);
|
|
2114
2608
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
|
2115
2609
|
const { schema } = await getBranchDetails({
|
|
2116
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
|
2610
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
|
2117
2611
|
...fetchProps
|
|
2118
2612
|
});
|
|
2119
2613
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
|
@@ -2179,8 +2673,15 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
|
2179
2673
|
result.read = function(columns2) {
|
|
2180
2674
|
return db[table].read(result["id"], columns2);
|
|
2181
2675
|
};
|
|
2182
|
-
result.update = function(data,
|
|
2183
|
-
|
|
2676
|
+
result.update = function(data, b, c) {
|
|
2677
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
|
2678
|
+
const ifVersion = parseIfVersion(b, c);
|
|
2679
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
|
2680
|
+
};
|
|
2681
|
+
result.replace = function(data, b, c) {
|
|
2682
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
|
2683
|
+
const ifVersion = parseIfVersion(b, c);
|
|
2684
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
|
2184
2685
|
};
|
|
2185
2686
|
result.delete = function() {
|
|
2186
2687
|
return db[table].delete(result["id"]);
|
|
@@ -2213,6 +2714,14 @@ function isValidColumn(columns, column) {
|
|
|
2213
2714
|
}
|
|
2214
2715
|
return columns.includes(column.name);
|
|
2215
2716
|
}
|
|
2717
|
+
function parseIfVersion(...args) {
|
|
2718
|
+
for (const arg of args) {
|
|
2719
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
|
2720
|
+
return arg.ifVersion;
|
|
2721
|
+
}
|
|
2722
|
+
}
|
|
2723
|
+
return void 0;
|
|
2724
|
+
}
|
|
2216
2725
|
|
|
2217
2726
|
var __accessCheck$3 = (obj, member, msg) => {
|
|
2218
2727
|
if (!member.has(obj))
|
|
@@ -2400,7 +2909,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
|
2400
2909
|
const fetchProps = await getFetchProps();
|
|
2401
2910
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
|
2402
2911
|
const { records } = await searchBranch({
|
|
2403
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
|
2912
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
|
2404
2913
|
body: { tables, query, fuzziness, prefix, highlight },
|
|
2405
2914
|
...fetchProps
|
|
2406
2915
|
});
|
|
@@ -2412,7 +2921,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
|
2412
2921
|
return __privateGet$1(this, _schemaTables);
|
|
2413
2922
|
const fetchProps = await getFetchProps();
|
|
2414
2923
|
const { schema } = await getBranchDetails({
|
|
2415
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
|
2924
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
|
2416
2925
|
...fetchProps
|
|
2417
2926
|
});
|
|
2418
2927
|
__privateSet$1(this, _schemaTables, schema.tables);
|
|
@@ -2450,14 +2959,17 @@ async function resolveXataBranch(gitBranch, options) {
|
|
|
2450
2959
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
|
2451
2960
|
);
|
|
2452
2961
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
|
2453
|
-
const
|
|
2962
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
|
2963
|
+
if (!urlParts)
|
|
2964
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
|
2965
|
+
const { workspace, region } = urlParts;
|
|
2454
2966
|
const { fallbackBranch } = getEnvironment();
|
|
2455
2967
|
const { branch } = await resolveBranch({
|
|
2456
2968
|
apiKey,
|
|
2457
2969
|
apiUrl: databaseURL,
|
|
2458
2970
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
|
2459
2971
|
workspacesApiUrl: `${protocol}//${host}`,
|
|
2460
|
-
pathParams: { dbName, workspace },
|
|
2972
|
+
pathParams: { dbName, workspace, region },
|
|
2461
2973
|
queryParams: { gitBranch, fallbackBranch },
|
|
2462
2974
|
trace: defaultTrace
|
|
2463
2975
|
});
|
|
@@ -2475,15 +2987,17 @@ async function getDatabaseBranch(branch, options) {
|
|
|
2475
2987
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
|
2476
2988
|
);
|
|
2477
2989
|
const [protocol, , host, , database] = databaseURL.split("/");
|
|
2478
|
-
const
|
|
2479
|
-
|
|
2990
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
|
2991
|
+
if (!urlParts)
|
|
2992
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
|
2993
|
+
const { workspace, region } = urlParts;
|
|
2480
2994
|
try {
|
|
2481
2995
|
return await getBranchDetails({
|
|
2482
2996
|
apiKey,
|
|
2483
2997
|
apiUrl: databaseURL,
|
|
2484
2998
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
|
2485
2999
|
workspacesApiUrl: `${protocol}//${host}`,
|
|
2486
|
-
pathParams: { dbBranchName
|
|
3000
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
|
2487
3001
|
trace: defaultTrace
|
|
2488
3002
|
});
|
|
2489
3003
|
} catch (err) {
|
|
@@ -2574,8 +3088,8 @@ const buildClient = (plugins) => {
|
|
|
2574
3088
|
if (!databaseURL) {
|
|
2575
3089
|
throw new Error("Option databaseURL is required");
|
|
2576
3090
|
}
|
|
2577
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
|
2578
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
|
|
3091
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
|
3092
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
|
2579
3093
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
|
2580
3094
|
if (!branchValue)
|
|
2581
3095
|
throw new Error("Unable to resolve branch value");
|
|
@@ -2588,7 +3102,8 @@ const buildClient = (plugins) => {
|
|
|
2588
3102
|
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
|
2589
3103
|
return databaseURL + newPath;
|
|
2590
3104
|
},
|
|
2591
|
-
trace
|
|
3105
|
+
trace,
|
|
3106
|
+
clientID
|
|
2592
3107
|
};
|
|
2593
3108
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
|
2594
3109
|
if (__privateGet(this, _branch))
|
|
@@ -2700,5 +3215,5 @@ class XataError extends Error {
|
|
|
2700
3215
|
}
|
|
2701
3216
|
}
|
|
2702
3217
|
|
|
2703
|
-
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, 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 };
|
|
3218
|
+
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, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, dEPRECATEDcreateDatabase, dEPRECATEDdeleteDatabase, dEPRECATEDgetDatabaseList, dEPRECATEDgetDatabaseMetadata, dEPRECATEDupdateDatabaseMetadata, 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 };
|
|
2704
3219
|
//# sourceMappingURL=index.mjs.map
|