@xata.io/client 0.0.0-alpha.vfc5c289 → 0.0.0-alpha.vfcd664d
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 +88 -0
- package/README.md +7 -7
- package/Usage.md +7 -5
- package/dist/index.cjs +1360 -600
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4092 -1465
- package/dist/index.mjs +1346 -600
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- /package/{rollup.config.js → rollup.config.mjs} +0 -0
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.vfcd664d";
|
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,14 +248,18 @@ async function fetch$1({
|
|
231
248
|
queryParams,
|
232
249
|
fetchImpl,
|
233
250
|
apiKey,
|
251
|
+
endpoint,
|
234
252
|
apiUrl,
|
235
253
|
workspacesApiUrl,
|
236
|
-
trace
|
254
|
+
trace,
|
255
|
+
signal,
|
256
|
+
clientID,
|
257
|
+
sessionID
|
237
258
|
}) {
|
238
259
|
return trace(
|
239
260
|
`${method.toUpperCase()} ${path}`,
|
240
261
|
async ({ setAttributes }) => {
|
241
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
262
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
242
263
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
243
264
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
244
265
|
setAttributes({
|
@@ -251,10 +272,13 @@ async function fetch$1({
|
|
251
272
|
headers: {
|
252
273
|
"Content-Type": "application/json",
|
253
274
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
275
|
+
"X-Xata-Client-ID": clientID ?? "",
|
276
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
254
277
|
...headers,
|
255
278
|
...hostHeader(fullUrl),
|
256
279
|
Authorization: `Bearer ${apiKey}`
|
257
|
-
}
|
280
|
+
},
|
281
|
+
signal
|
258
282
|
});
|
259
283
|
if (response.status === 204) {
|
260
284
|
return {};
|
@@ -290,273 +314,163 @@ function parseUrl(url) {
|
|
290
314
|
}
|
291
315
|
}
|
292
316
|
|
293
|
-
const
|
294
|
-
|
295
|
-
const
|
296
|
-
const
|
297
|
-
url: "/user/keys",
|
298
|
-
method: "get",
|
299
|
-
...variables
|
300
|
-
});
|
301
|
-
const createUserAPIKey = (variables) => fetch$1({
|
302
|
-
url: "/user/keys/{keyName}",
|
303
|
-
method: "post",
|
304
|
-
...variables
|
305
|
-
});
|
306
|
-
const deleteUserAPIKey = (variables) => fetch$1({
|
307
|
-
url: "/user/keys/{keyName}",
|
308
|
-
method: "delete",
|
309
|
-
...variables
|
310
|
-
});
|
311
|
-
const createWorkspace = (variables) => fetch$1({
|
312
|
-
url: "/workspaces",
|
313
|
-
method: "post",
|
314
|
-
...variables
|
315
|
-
});
|
316
|
-
const getWorkspacesList = (variables) => fetch$1({
|
317
|
-
url: "/workspaces",
|
318
|
-
method: "get",
|
319
|
-
...variables
|
320
|
-
});
|
321
|
-
const getWorkspace = (variables) => fetch$1({
|
322
|
-
url: "/workspaces/{workspaceId}",
|
323
|
-
method: "get",
|
324
|
-
...variables
|
325
|
-
});
|
326
|
-
const updateWorkspace = (variables) => fetch$1({
|
327
|
-
url: "/workspaces/{workspaceId}",
|
328
|
-
method: "put",
|
329
|
-
...variables
|
330
|
-
});
|
331
|
-
const deleteWorkspace = (variables) => fetch$1({
|
332
|
-
url: "/workspaces/{workspaceId}",
|
333
|
-
method: "delete",
|
334
|
-
...variables
|
335
|
-
});
|
336
|
-
const getWorkspaceMembersList = (variables) => fetch$1({
|
337
|
-
url: "/workspaces/{workspaceId}/members",
|
338
|
-
method: "get",
|
339
|
-
...variables
|
340
|
-
});
|
341
|
-
const updateWorkspaceMemberRole = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables });
|
342
|
-
const removeWorkspaceMember = (variables) => fetch$1({
|
343
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
344
|
-
method: "delete",
|
345
|
-
...variables
|
346
|
-
});
|
347
|
-
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
348
|
-
const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
349
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
350
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
351
|
-
method: "delete",
|
352
|
-
...variables
|
353
|
-
});
|
354
|
-
const resendWorkspaceMemberInvite = (variables) => fetch$1({
|
355
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
356
|
-
method: "post",
|
357
|
-
...variables
|
358
|
-
});
|
359
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
360
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
361
|
-
method: "post",
|
362
|
-
...variables
|
363
|
-
});
|
364
|
-
const getDatabaseList = (variables) => fetch$1({
|
365
|
-
url: "/dbs",
|
366
|
-
method: "get",
|
367
|
-
...variables
|
368
|
-
});
|
369
|
-
const getBranchList = (variables) => fetch$1({
|
370
|
-
url: "/dbs/{dbName}",
|
371
|
-
method: "get",
|
372
|
-
...variables
|
373
|
-
});
|
374
|
-
const createDatabase = (variables) => fetch$1({
|
375
|
-
url: "/dbs/{dbName}",
|
376
|
-
method: "put",
|
377
|
-
...variables
|
378
|
-
});
|
379
|
-
const deleteDatabase = (variables) => fetch$1({
|
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({
|
380
321
|
url: "/dbs/{dbName}",
|
381
|
-
method: "delete",
|
382
|
-
...variables
|
383
|
-
});
|
384
|
-
const getDatabaseMetadata = (variables) => fetch$1({
|
385
|
-
url: "/dbs/{dbName}/metadata",
|
386
322
|
method: "get",
|
387
|
-
...variables
|
323
|
+
...variables,
|
324
|
+
signal
|
388
325
|
});
|
389
|
-
const
|
390
|
-
const
|
391
|
-
const
|
392
|
-
const
|
393
|
-
const
|
394
|
-
url: "/dbs/{dbName}/resolveBranch",
|
395
|
-
method: "get",
|
396
|
-
...variables
|
397
|
-
});
|
398
|
-
const listMigrationRequests = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/list", method: "post", ...variables });
|
399
|
-
const createMigrationRequest = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables });
|
400
|
-
const getMigrationRequest = (variables) => fetch$1({
|
401
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
402
|
-
method: "get",
|
403
|
-
...variables
|
404
|
-
});
|
405
|
-
const updateMigrationRequest = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables });
|
406
|
-
const listMigrationRequestsCommits = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables });
|
407
|
-
const compareMigrationRequest = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables });
|
408
|
-
const getMigrationRequestIsMerged = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables });
|
409
|
-
const mergeMigrationRequest = (variables) => fetch$1({
|
410
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
411
|
-
method: "post",
|
412
|
-
...variables
|
413
|
-
});
|
414
|
-
const getBranchDetails = (variables) => fetch$1({
|
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({
|
415
331
|
url: "/db/{dbBranchName}",
|
416
332
|
method: "get",
|
417
|
-
...variables
|
333
|
+
...variables,
|
334
|
+
signal
|
418
335
|
});
|
419
|
-
const createBranch = (variables) =>
|
420
|
-
const deleteBranch = (variables) =>
|
336
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
337
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
421
338
|
url: "/db/{dbBranchName}",
|
422
339
|
method: "delete",
|
423
|
-
...variables
|
340
|
+
...variables,
|
341
|
+
signal
|
424
342
|
});
|
425
|
-
const updateBranchMetadata = (variables) =>
|
343
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
426
344
|
url: "/db/{dbBranchName}/metadata",
|
427
345
|
method: "put",
|
428
|
-
...variables
|
346
|
+
...variables,
|
347
|
+
signal
|
429
348
|
});
|
430
|
-
const getBranchMetadata = (variables) =>
|
349
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
431
350
|
url: "/db/{dbBranchName}/metadata",
|
432
351
|
method: "get",
|
433
|
-
...variables
|
434
|
-
|
435
|
-
const getBranchMigrationHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables });
|
436
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
437
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
438
|
-
const compareBranchWithUserSchema = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables });
|
439
|
-
const compareBranchSchemas = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables });
|
440
|
-
const updateBranchSchema = (variables) => fetch$1({
|
441
|
-
url: "/db/{dbBranchName}/schema/update",
|
442
|
-
method: "post",
|
443
|
-
...variables
|
352
|
+
...variables,
|
353
|
+
signal
|
444
354
|
});
|
445
|
-
const
|
446
|
-
const applyBranchSchemaEdit = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables });
|
447
|
-
const getBranchSchemaHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables });
|
448
|
-
const getBranchStats = (variables) => fetch$1({
|
355
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
449
356
|
url: "/db/{dbBranchName}/stats",
|
450
357
|
method: "get",
|
451
|
-
...variables
|
358
|
+
...variables,
|
359
|
+
signal
|
360
|
+
});
|
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 branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
369
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
370
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
371
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
372
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
373
|
+
method: "get",
|
374
|
+
...variables,
|
375
|
+
signal
|
376
|
+
});
|
377
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
378
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
379
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
380
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
381
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
382
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
383
|
+
method: "post",
|
384
|
+
...variables,
|
385
|
+
signal
|
452
386
|
});
|
453
|
-
const
|
387
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
388
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
389
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
390
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
391
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
392
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
393
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
454
394
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
455
395
|
method: "put",
|
456
|
-
...variables
|
396
|
+
...variables,
|
397
|
+
signal
|
457
398
|
});
|
458
|
-
const deleteTable = (variables) =>
|
399
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
459
400
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
460
401
|
method: "delete",
|
461
|
-
...variables
|
462
|
-
|
463
|
-
const updateTable = (variables) => fetch$1({
|
464
|
-
url: "/db/{dbBranchName}/tables/{tableName}",
|
465
|
-
method: "patch",
|
466
|
-
...variables
|
402
|
+
...variables,
|
403
|
+
signal
|
467
404
|
});
|
468
|
-
const
|
405
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
406
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
469
407
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
470
408
|
method: "get",
|
471
|
-
...variables
|
472
|
-
|
473
|
-
const setTableSchema = (variables) => fetch$1({
|
474
|
-
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
475
|
-
method: "put",
|
476
|
-
...variables
|
409
|
+
...variables,
|
410
|
+
signal
|
477
411
|
});
|
478
|
-
const
|
412
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
413
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
479
414
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
480
415
|
method: "get",
|
481
|
-
...variables
|
416
|
+
...variables,
|
417
|
+
signal
|
482
418
|
});
|
483
|
-
const addTableColumn = (variables) =>
|
484
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
485
|
-
|
486
|
-
|
487
|
-
});
|
488
|
-
const getColumn = (variables) => fetch$1({
|
419
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
420
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
421
|
+
);
|
422
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
489
423
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
490
424
|
method: "get",
|
491
|
-
...variables
|
425
|
+
...variables,
|
426
|
+
signal
|
492
427
|
});
|
493
|
-
const
|
428
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
429
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
494
430
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
495
431
|
method: "delete",
|
496
|
-
...variables
|
432
|
+
...variables,
|
433
|
+
signal
|
497
434
|
});
|
498
|
-
const
|
499
|
-
|
500
|
-
method: "patch",
|
501
|
-
...variables
|
502
|
-
});
|
503
|
-
const insertRecord = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables });
|
504
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
505
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
506
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
507
|
-
const deleteRecord = (variables) => fetch$1({
|
508
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
509
|
-
method: "delete",
|
510
|
-
...variables
|
511
|
-
});
|
512
|
-
const getRecord = (variables) => fetch$1({
|
435
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
436
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
513
437
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
514
438
|
method: "get",
|
515
|
-
...variables
|
439
|
+
...variables,
|
440
|
+
signal
|
516
441
|
});
|
517
|
-
const
|
518
|
-
const
|
442
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
443
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
444
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
445
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
446
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
447
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
519
448
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
520
449
|
method: "post",
|
521
|
-
...variables
|
450
|
+
...variables,
|
451
|
+
signal
|
522
452
|
});
|
523
|
-
const
|
524
|
-
url: "/db/{dbBranchName}/
|
453
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
454
|
+
url: "/db/{dbBranchName}/search",
|
525
455
|
method: "post",
|
526
|
-
...variables
|
456
|
+
...variables,
|
457
|
+
signal
|
527
458
|
});
|
528
|
-
const
|
529
|
-
url: "/db/{dbBranchName}/search",
|
459
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
460
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
530
461
|
method: "post",
|
531
|
-
...variables
|
462
|
+
...variables,
|
463
|
+
signal
|
532
464
|
});
|
533
|
-
const
|
534
|
-
|
535
|
-
|
536
|
-
createWorkspace,
|
537
|
-
getWorkspacesList,
|
538
|
-
getWorkspace,
|
539
|
-
updateWorkspace,
|
540
|
-
deleteWorkspace,
|
541
|
-
getWorkspaceMembersList,
|
542
|
-
updateWorkspaceMemberRole,
|
543
|
-
removeWorkspaceMember,
|
544
|
-
inviteWorkspaceMember,
|
545
|
-
updateWorkspaceMemberInvite,
|
546
|
-
cancelWorkspaceMemberInvite,
|
547
|
-
resendWorkspaceMemberInvite,
|
548
|
-
acceptWorkspaceMemberInvite
|
549
|
-
},
|
465
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
466
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
467
|
+
const operationsByTag$2 = {
|
550
468
|
database: {
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
getGitBranchesMapping,
|
557
|
-
addGitBranchesEntry,
|
558
|
-
removeGitBranchesEntry,
|
559
|
-
resolveBranch
|
469
|
+
dEPRECATEDgetDatabaseList,
|
470
|
+
dEPRECATEDcreateDatabase,
|
471
|
+
dEPRECATEDdeleteDatabase,
|
472
|
+
dEPRECATEDgetDatabaseMetadata,
|
473
|
+
dEPRECATEDupdateDatabaseMetadata
|
560
474
|
},
|
561
475
|
branch: {
|
562
476
|
getBranchList,
|
@@ -565,10 +479,35 @@ const operationsByTag = {
|
|
565
479
|
deleteBranch,
|
566
480
|
updateBranchMetadata,
|
567
481
|
getBranchMetadata,
|
568
|
-
getBranchStats
|
482
|
+
getBranchStats,
|
483
|
+
getGitBranchesMapping,
|
484
|
+
addGitBranchesEntry,
|
485
|
+
removeGitBranchesEntry,
|
486
|
+
resolveBranch
|
487
|
+
},
|
488
|
+
migrations: {
|
489
|
+
getBranchMigrationHistory,
|
490
|
+
getBranchMigrationPlan,
|
491
|
+
executeBranchMigrationPlan,
|
492
|
+
getBranchSchemaHistory,
|
493
|
+
compareBranchWithUserSchema,
|
494
|
+
compareBranchSchemas,
|
495
|
+
updateBranchSchema,
|
496
|
+
previewBranchSchemaEdit,
|
497
|
+
applyBranchSchemaEdit
|
498
|
+
},
|
499
|
+
records: {
|
500
|
+
branchTransaction,
|
501
|
+
insertRecord,
|
502
|
+
getRecord,
|
503
|
+
insertRecordWithID,
|
504
|
+
updateRecordWithID,
|
505
|
+
upsertRecordWithID,
|
506
|
+
deleteRecord,
|
507
|
+
bulkInsertTableRecords
|
569
508
|
},
|
570
509
|
migrationRequests: {
|
571
|
-
|
510
|
+
queryMigrationRequests,
|
572
511
|
createMigrationRequest,
|
573
512
|
getMigrationRequest,
|
574
513
|
updateMigrationRequest,
|
@@ -577,17 +516,6 @@ const operationsByTag = {
|
|
577
516
|
getMigrationRequestIsMerged,
|
578
517
|
mergeMigrationRequest
|
579
518
|
},
|
580
|
-
branchSchema: {
|
581
|
-
getBranchMigrationHistory,
|
582
|
-
executeBranchMigrationPlan,
|
583
|
-
getBranchMigrationPlan,
|
584
|
-
compareBranchWithUserSchema,
|
585
|
-
compareBranchSchemas,
|
586
|
-
updateBranchSchema,
|
587
|
-
previewBranchSchemaEdit,
|
588
|
-
applyBranchSchemaEdit,
|
589
|
-
getBranchSchemaHistory
|
590
|
-
},
|
591
519
|
table: {
|
592
520
|
createTable,
|
593
521
|
deleteTable,
|
@@ -597,23 +525,146 @@ const operationsByTag = {
|
|
597
525
|
getTableColumns,
|
598
526
|
addTableColumn,
|
599
527
|
getColumn,
|
600
|
-
|
601
|
-
|
528
|
+
updateColumn,
|
529
|
+
deleteColumn
|
602
530
|
},
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
531
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
532
|
+
};
|
533
|
+
|
534
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
535
|
+
|
536
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
537
|
+
url: "/user",
|
538
|
+
method: "get",
|
539
|
+
...variables,
|
540
|
+
signal
|
541
|
+
});
|
542
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
543
|
+
url: "/user",
|
544
|
+
method: "put",
|
545
|
+
...variables,
|
546
|
+
signal
|
547
|
+
});
|
548
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
549
|
+
url: "/user",
|
550
|
+
method: "delete",
|
551
|
+
...variables,
|
552
|
+
signal
|
553
|
+
});
|
554
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
555
|
+
url: "/user/keys",
|
556
|
+
method: "get",
|
557
|
+
...variables,
|
558
|
+
signal
|
559
|
+
});
|
560
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
561
|
+
url: "/user/keys/{keyName}",
|
562
|
+
method: "post",
|
563
|
+
...variables,
|
564
|
+
signal
|
565
|
+
});
|
566
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
567
|
+
url: "/user/keys/{keyName}",
|
568
|
+
method: "delete",
|
569
|
+
...variables,
|
570
|
+
signal
|
571
|
+
});
|
572
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
573
|
+
url: "/workspaces",
|
574
|
+
method: "get",
|
575
|
+
...variables,
|
576
|
+
signal
|
577
|
+
});
|
578
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
579
|
+
url: "/workspaces",
|
580
|
+
method: "post",
|
581
|
+
...variables,
|
582
|
+
signal
|
583
|
+
});
|
584
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
585
|
+
url: "/workspaces/{workspaceId}",
|
586
|
+
method: "get",
|
587
|
+
...variables,
|
588
|
+
signal
|
589
|
+
});
|
590
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
591
|
+
url: "/workspaces/{workspaceId}",
|
592
|
+
method: "put",
|
593
|
+
...variables,
|
594
|
+
signal
|
595
|
+
});
|
596
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
597
|
+
url: "/workspaces/{workspaceId}",
|
598
|
+
method: "delete",
|
599
|
+
...variables,
|
600
|
+
signal
|
601
|
+
});
|
602
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
603
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
604
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
605
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
606
|
+
method: "delete",
|
607
|
+
...variables,
|
608
|
+
signal
|
609
|
+
});
|
610
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
611
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
612
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
613
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
614
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
615
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
616
|
+
url: "/workspaces/{workspaceId}/dbs",
|
617
|
+
method: "get",
|
618
|
+
...variables,
|
619
|
+
signal
|
620
|
+
});
|
621
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
622
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
623
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
624
|
+
method: "delete",
|
625
|
+
...variables,
|
626
|
+
signal
|
627
|
+
});
|
628
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
629
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
630
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
631
|
+
url: "/workspaces/{workspaceId}/regions",
|
632
|
+
method: "get",
|
633
|
+
...variables,
|
634
|
+
signal
|
635
|
+
});
|
636
|
+
const operationsByTag$1 = {
|
637
|
+
users: { getUser, updateUser, deleteUser },
|
638
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
639
|
+
workspaces: {
|
640
|
+
getWorkspacesList,
|
641
|
+
createWorkspace,
|
642
|
+
getWorkspace,
|
643
|
+
updateWorkspace,
|
644
|
+
deleteWorkspace,
|
645
|
+
getWorkspaceMembersList,
|
646
|
+
updateWorkspaceMemberRole,
|
647
|
+
removeWorkspaceMember
|
648
|
+
},
|
649
|
+
invites: {
|
650
|
+
inviteWorkspaceMember,
|
651
|
+
updateWorkspaceMemberInvite,
|
652
|
+
cancelWorkspaceMemberInvite,
|
653
|
+
acceptWorkspaceMemberInvite,
|
654
|
+
resendWorkspaceMemberInvite
|
655
|
+
},
|
656
|
+
databases: {
|
657
|
+
getDatabaseList,
|
658
|
+
createDatabase,
|
659
|
+
deleteDatabase,
|
660
|
+
getDatabaseMetadata,
|
661
|
+
updateDatabaseMetadata,
|
662
|
+
listRegions
|
614
663
|
}
|
615
664
|
};
|
616
665
|
|
666
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
667
|
+
|
617
668
|
function getHostUrl(provider, type) {
|
618
669
|
if (isHostProviderAlias(provider)) {
|
619
670
|
return providers[provider][type];
|
@@ -625,11 +676,11 @@ function getHostUrl(provider, type) {
|
|
625
676
|
const providers = {
|
626
677
|
production: {
|
627
678
|
main: "https://api.xata.io",
|
628
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
679
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
629
680
|
},
|
630
681
|
staging: {
|
631
682
|
main: "https://staging.xatabase.co",
|
632
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
683
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
633
684
|
}
|
634
685
|
};
|
635
686
|
function isHostProviderAlias(alias) {
|
@@ -638,6 +689,25 @@ function isHostProviderAlias(alias) {
|
|
638
689
|
function isHostProviderBuilder(builder) {
|
639
690
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
640
691
|
}
|
692
|
+
function parseProviderString(provider = "production") {
|
693
|
+
if (isHostProviderAlias(provider)) {
|
694
|
+
return provider;
|
695
|
+
}
|
696
|
+
const [main, workspaces] = provider.split(",");
|
697
|
+
if (!main || !workspaces)
|
698
|
+
return null;
|
699
|
+
return { main, workspaces };
|
700
|
+
}
|
701
|
+
function parseWorkspacesUrlParts(url) {
|
702
|
+
if (!isString(url))
|
703
|
+
return null;
|
704
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
705
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
706
|
+
const match = url.match(regex) || url.match(regexStaging);
|
707
|
+
if (!match)
|
708
|
+
return null;
|
709
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
710
|
+
}
|
641
711
|
|
642
712
|
var __accessCheck$7 = (obj, member, msg) => {
|
643
713
|
if (!member.has(obj))
|
@@ -681,21 +751,41 @@ class XataApiClient {
|
|
681
751
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
682
752
|
return __privateGet$7(this, _namespaces).user;
|
683
753
|
}
|
754
|
+
get authentication() {
|
755
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
756
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
757
|
+
return __privateGet$7(this, _namespaces).authentication;
|
758
|
+
}
|
684
759
|
get workspaces() {
|
685
760
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
686
761
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
687
762
|
return __privateGet$7(this, _namespaces).workspaces;
|
688
763
|
}
|
689
|
-
get
|
690
|
-
if (!__privateGet$7(this, _namespaces).
|
691
|
-
__privateGet$7(this, _namespaces).
|
692
|
-
return __privateGet$7(this, _namespaces).
|
764
|
+
get invites() {
|
765
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
766
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
767
|
+
return __privateGet$7(this, _namespaces).invites;
|
768
|
+
}
|
769
|
+
get database() {
|
770
|
+
if (!__privateGet$7(this, _namespaces).database)
|
771
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
772
|
+
return __privateGet$7(this, _namespaces).database;
|
693
773
|
}
|
694
774
|
get branches() {
|
695
775
|
if (!__privateGet$7(this, _namespaces).branches)
|
696
776
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
697
777
|
return __privateGet$7(this, _namespaces).branches;
|
698
778
|
}
|
779
|
+
get migrations() {
|
780
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
781
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
782
|
+
return __privateGet$7(this, _namespaces).migrations;
|
783
|
+
}
|
784
|
+
get migrationRequests() {
|
785
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
786
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
787
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
788
|
+
}
|
699
789
|
get tables() {
|
700
790
|
if (!__privateGet$7(this, _namespaces).tables)
|
701
791
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -706,15 +796,10 @@ class XataApiClient {
|
|
706
796
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
707
797
|
return __privateGet$7(this, _namespaces).records;
|
708
798
|
}
|
709
|
-
get
|
710
|
-
if (!__privateGet$7(this, _namespaces).
|
711
|
-
__privateGet$7(this, _namespaces).
|
712
|
-
return __privateGet$7(this, _namespaces).
|
713
|
-
}
|
714
|
-
get branchSchema() {
|
715
|
-
if (!__privateGet$7(this, _namespaces).branchSchema)
|
716
|
-
__privateGet$7(this, _namespaces).branchSchema = new BranchSchemaApi(__privateGet$7(this, _extraProps));
|
717
|
-
return __privateGet$7(this, _namespaces).branchSchema;
|
799
|
+
get searchAndFilter() {
|
800
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
801
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
802
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
718
803
|
}
|
719
804
|
}
|
720
805
|
_extraProps = new WeakMap();
|
@@ -726,24 +811,29 @@ class UserApi {
|
|
726
811
|
getUser() {
|
727
812
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
728
813
|
}
|
729
|
-
updateUser(user) {
|
814
|
+
updateUser({ user }) {
|
730
815
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
731
816
|
}
|
732
817
|
deleteUser() {
|
733
818
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
734
819
|
}
|
820
|
+
}
|
821
|
+
class AuthenticationApi {
|
822
|
+
constructor(extraProps) {
|
823
|
+
this.extraProps = extraProps;
|
824
|
+
}
|
735
825
|
getUserAPIKeys() {
|
736
|
-
return operationsByTag.
|
826
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
737
827
|
}
|
738
|
-
createUserAPIKey(
|
739
|
-
return operationsByTag.
|
740
|
-
pathParams: { keyName },
|
828
|
+
createUserAPIKey({ name }) {
|
829
|
+
return operationsByTag.authentication.createUserAPIKey({
|
830
|
+
pathParams: { keyName: name },
|
741
831
|
...this.extraProps
|
742
832
|
});
|
743
833
|
}
|
744
|
-
deleteUserAPIKey(
|
745
|
-
return operationsByTag.
|
746
|
-
pathParams: { keyName },
|
834
|
+
deleteUserAPIKey({ name }) {
|
835
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
836
|
+
pathParams: { keyName: name },
|
747
837
|
...this.extraProps
|
748
838
|
});
|
749
839
|
}
|
@@ -752,196 +842,248 @@ class WorkspaceApi {
|
|
752
842
|
constructor(extraProps) {
|
753
843
|
this.extraProps = extraProps;
|
754
844
|
}
|
755
|
-
|
845
|
+
getWorkspacesList() {
|
846
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
847
|
+
}
|
848
|
+
createWorkspace({ data }) {
|
756
849
|
return operationsByTag.workspaces.createWorkspace({
|
757
|
-
body:
|
850
|
+
body: data,
|
758
851
|
...this.extraProps
|
759
852
|
});
|
760
853
|
}
|
761
|
-
|
762
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
763
|
-
}
|
764
|
-
getWorkspace(workspaceId) {
|
854
|
+
getWorkspace({ workspace }) {
|
765
855
|
return operationsByTag.workspaces.getWorkspace({
|
766
|
-
pathParams: { workspaceId },
|
856
|
+
pathParams: { workspaceId: workspace },
|
767
857
|
...this.extraProps
|
768
858
|
});
|
769
859
|
}
|
770
|
-
updateWorkspace(
|
860
|
+
updateWorkspace({
|
861
|
+
workspace,
|
862
|
+
update
|
863
|
+
}) {
|
771
864
|
return operationsByTag.workspaces.updateWorkspace({
|
772
|
-
pathParams: { workspaceId },
|
773
|
-
body:
|
865
|
+
pathParams: { workspaceId: workspace },
|
866
|
+
body: update,
|
774
867
|
...this.extraProps
|
775
868
|
});
|
776
869
|
}
|
777
|
-
deleteWorkspace(
|
870
|
+
deleteWorkspace({ workspace }) {
|
778
871
|
return operationsByTag.workspaces.deleteWorkspace({
|
779
|
-
pathParams: { workspaceId },
|
872
|
+
pathParams: { workspaceId: workspace },
|
780
873
|
...this.extraProps
|
781
874
|
});
|
782
875
|
}
|
783
|
-
getWorkspaceMembersList(
|
876
|
+
getWorkspaceMembersList({ workspace }) {
|
784
877
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
785
|
-
pathParams: { workspaceId },
|
878
|
+
pathParams: { workspaceId: workspace },
|
786
879
|
...this.extraProps
|
787
880
|
});
|
788
881
|
}
|
789
|
-
updateWorkspaceMemberRole(
|
882
|
+
updateWorkspaceMemberRole({
|
883
|
+
workspace,
|
884
|
+
user,
|
885
|
+
role
|
886
|
+
}) {
|
790
887
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
791
|
-
pathParams: { workspaceId, userId },
|
888
|
+
pathParams: { workspaceId: workspace, userId: user },
|
792
889
|
body: { role },
|
793
890
|
...this.extraProps
|
794
891
|
});
|
795
892
|
}
|
796
|
-
removeWorkspaceMember(
|
893
|
+
removeWorkspaceMember({
|
894
|
+
workspace,
|
895
|
+
user
|
896
|
+
}) {
|
797
897
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
798
|
-
pathParams: { workspaceId, userId },
|
898
|
+
pathParams: { workspaceId: workspace, userId: user },
|
799
899
|
...this.extraProps
|
800
900
|
});
|
801
901
|
}
|
802
|
-
|
803
|
-
|
804
|
-
|
902
|
+
}
|
903
|
+
class InvitesApi {
|
904
|
+
constructor(extraProps) {
|
905
|
+
this.extraProps = extraProps;
|
906
|
+
}
|
907
|
+
inviteWorkspaceMember({
|
908
|
+
workspace,
|
909
|
+
email,
|
910
|
+
role
|
911
|
+
}) {
|
912
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
913
|
+
pathParams: { workspaceId: workspace },
|
805
914
|
body: { email, role },
|
806
915
|
...this.extraProps
|
807
916
|
});
|
808
917
|
}
|
809
|
-
updateWorkspaceMemberInvite(
|
810
|
-
|
811
|
-
|
918
|
+
updateWorkspaceMemberInvite({
|
919
|
+
workspace,
|
920
|
+
invite,
|
921
|
+
role
|
922
|
+
}) {
|
923
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
924
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
812
925
|
body: { role },
|
813
926
|
...this.extraProps
|
814
927
|
});
|
815
928
|
}
|
816
|
-
cancelWorkspaceMemberInvite(
|
817
|
-
|
818
|
-
|
929
|
+
cancelWorkspaceMemberInvite({
|
930
|
+
workspace,
|
931
|
+
invite
|
932
|
+
}) {
|
933
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
934
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
819
935
|
...this.extraProps
|
820
936
|
});
|
821
937
|
}
|
822
|
-
|
823
|
-
|
824
|
-
|
938
|
+
acceptWorkspaceMemberInvite({
|
939
|
+
workspace,
|
940
|
+
key
|
941
|
+
}) {
|
942
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
943
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
825
944
|
...this.extraProps
|
826
945
|
});
|
827
946
|
}
|
828
|
-
|
829
|
-
|
830
|
-
|
947
|
+
resendWorkspaceMemberInvite({
|
948
|
+
workspace,
|
949
|
+
invite
|
950
|
+
}) {
|
951
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
952
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
831
953
|
...this.extraProps
|
832
954
|
});
|
833
955
|
}
|
834
956
|
}
|
835
|
-
class
|
957
|
+
class BranchApi {
|
836
958
|
constructor(extraProps) {
|
837
959
|
this.extraProps = extraProps;
|
838
960
|
}
|
839
|
-
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
return operationsByTag.database.createDatabase({
|
847
|
-
pathParams: { workspace, dbName },
|
848
|
-
body: options,
|
849
|
-
...this.extraProps
|
850
|
-
});
|
851
|
-
}
|
852
|
-
deleteDatabase(workspace, dbName) {
|
853
|
-
return operationsByTag.database.deleteDatabase({
|
854
|
-
pathParams: { workspace, dbName },
|
855
|
-
...this.extraProps
|
856
|
-
});
|
857
|
-
}
|
858
|
-
getDatabaseMetadata(workspace, dbName) {
|
859
|
-
return operationsByTag.database.getDatabaseMetadata({
|
860
|
-
pathParams: { workspace, dbName },
|
861
|
-
...this.extraProps
|
862
|
-
});
|
863
|
-
}
|
864
|
-
updateDatabaseMetadata(workspace, dbName, options = {}) {
|
865
|
-
return operationsByTag.database.updateDatabaseMetadata({
|
866
|
-
pathParams: { workspace, dbName },
|
867
|
-
body: options,
|
868
|
-
...this.extraProps
|
869
|
-
});
|
870
|
-
}
|
871
|
-
getGitBranchesMapping(workspace, dbName) {
|
872
|
-
return operationsByTag.database.getGitBranchesMapping({
|
873
|
-
pathParams: { workspace, dbName },
|
961
|
+
getBranchList({
|
962
|
+
workspace,
|
963
|
+
region,
|
964
|
+
database
|
965
|
+
}) {
|
966
|
+
return operationsByTag.branch.getBranchList({
|
967
|
+
pathParams: { workspace, region, dbName: database },
|
874
968
|
...this.extraProps
|
875
969
|
});
|
876
970
|
}
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
971
|
+
getBranchDetails({
|
972
|
+
workspace,
|
973
|
+
region,
|
974
|
+
database,
|
975
|
+
branch
|
976
|
+
}) {
|
977
|
+
return operationsByTag.branch.getBranchDetails({
|
978
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
881
979
|
...this.extraProps
|
882
980
|
});
|
883
981
|
}
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
982
|
+
createBranch({
|
983
|
+
workspace,
|
984
|
+
region,
|
985
|
+
database,
|
986
|
+
branch,
|
987
|
+
from,
|
988
|
+
metadata
|
989
|
+
}) {
|
990
|
+
return operationsByTag.branch.createBranch({
|
991
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
992
|
+
body: { from, metadata },
|
888
993
|
...this.extraProps
|
889
994
|
});
|
890
995
|
}
|
891
|
-
|
892
|
-
|
893
|
-
|
894
|
-
|
996
|
+
deleteBranch({
|
997
|
+
workspace,
|
998
|
+
region,
|
999
|
+
database,
|
1000
|
+
branch
|
1001
|
+
}) {
|
1002
|
+
return operationsByTag.branch.deleteBranch({
|
1003
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
895
1004
|
...this.extraProps
|
896
1005
|
});
|
897
1006
|
}
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
905
|
-
|
1007
|
+
updateBranchMetadata({
|
1008
|
+
workspace,
|
1009
|
+
region,
|
1010
|
+
database,
|
1011
|
+
branch,
|
1012
|
+
metadata
|
1013
|
+
}) {
|
1014
|
+
return operationsByTag.branch.updateBranchMetadata({
|
1015
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1016
|
+
body: metadata,
|
906
1017
|
...this.extraProps
|
907
1018
|
});
|
908
1019
|
}
|
909
|
-
|
910
|
-
|
911
|
-
|
1020
|
+
getBranchMetadata({
|
1021
|
+
workspace,
|
1022
|
+
region,
|
1023
|
+
database,
|
1024
|
+
branch
|
1025
|
+
}) {
|
1026
|
+
return operationsByTag.branch.getBranchMetadata({
|
1027
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
912
1028
|
...this.extraProps
|
913
1029
|
});
|
914
1030
|
}
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
919
|
-
|
1031
|
+
getBranchStats({
|
1032
|
+
workspace,
|
1033
|
+
region,
|
1034
|
+
database,
|
1035
|
+
branch
|
1036
|
+
}) {
|
1037
|
+
return operationsByTag.branch.getBranchStats({
|
1038
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
920
1039
|
...this.extraProps
|
921
1040
|
});
|
922
1041
|
}
|
923
|
-
|
924
|
-
|
925
|
-
|
1042
|
+
getGitBranchesMapping({
|
1043
|
+
workspace,
|
1044
|
+
region,
|
1045
|
+
database
|
1046
|
+
}) {
|
1047
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1048
|
+
pathParams: { workspace, region, dbName: database },
|
926
1049
|
...this.extraProps
|
927
1050
|
});
|
928
1051
|
}
|
929
|
-
|
930
|
-
|
931
|
-
|
932
|
-
|
1052
|
+
addGitBranchesEntry({
|
1053
|
+
workspace,
|
1054
|
+
region,
|
1055
|
+
database,
|
1056
|
+
gitBranch,
|
1057
|
+
xataBranch
|
1058
|
+
}) {
|
1059
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1060
|
+
pathParams: { workspace, region, dbName: database },
|
1061
|
+
body: { gitBranch, xataBranch },
|
933
1062
|
...this.extraProps
|
934
1063
|
});
|
935
1064
|
}
|
936
|
-
|
937
|
-
|
938
|
-
|
1065
|
+
removeGitBranchesEntry({
|
1066
|
+
workspace,
|
1067
|
+
region,
|
1068
|
+
database,
|
1069
|
+
gitBranch
|
1070
|
+
}) {
|
1071
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1072
|
+
pathParams: { workspace, region, dbName: database },
|
1073
|
+
queryParams: { gitBranch },
|
939
1074
|
...this.extraProps
|
940
1075
|
});
|
941
1076
|
}
|
942
|
-
|
943
|
-
|
944
|
-
|
1077
|
+
resolveBranch({
|
1078
|
+
workspace,
|
1079
|
+
region,
|
1080
|
+
database,
|
1081
|
+
gitBranch,
|
1082
|
+
fallbackBranch
|
1083
|
+
}) {
|
1084
|
+
return operationsByTag.branch.resolveBranch({
|
1085
|
+
pathParams: { workspace, region, dbName: database },
|
1086
|
+
queryParams: { gitBranch, fallbackBranch },
|
945
1087
|
...this.extraProps
|
946
1088
|
});
|
947
1089
|
}
|
@@ -950,67 +1092,134 @@ class TableApi {
|
|
950
1092
|
constructor(extraProps) {
|
951
1093
|
this.extraProps = extraProps;
|
952
1094
|
}
|
953
|
-
createTable(
|
1095
|
+
createTable({
|
1096
|
+
workspace,
|
1097
|
+
region,
|
1098
|
+
database,
|
1099
|
+
branch,
|
1100
|
+
table
|
1101
|
+
}) {
|
954
1102
|
return operationsByTag.table.createTable({
|
955
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1103
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
956
1104
|
...this.extraProps
|
957
1105
|
});
|
958
1106
|
}
|
959
|
-
deleteTable(
|
1107
|
+
deleteTable({
|
1108
|
+
workspace,
|
1109
|
+
region,
|
1110
|
+
database,
|
1111
|
+
branch,
|
1112
|
+
table
|
1113
|
+
}) {
|
960
1114
|
return operationsByTag.table.deleteTable({
|
961
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1115
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
962
1116
|
...this.extraProps
|
963
1117
|
});
|
964
1118
|
}
|
965
|
-
updateTable(
|
1119
|
+
updateTable({
|
1120
|
+
workspace,
|
1121
|
+
region,
|
1122
|
+
database,
|
1123
|
+
branch,
|
1124
|
+
table,
|
1125
|
+
update
|
1126
|
+
}) {
|
966
1127
|
return operationsByTag.table.updateTable({
|
967
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
968
|
-
body:
|
1128
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1129
|
+
body: update,
|
969
1130
|
...this.extraProps
|
970
1131
|
});
|
971
1132
|
}
|
972
|
-
getTableSchema(
|
1133
|
+
getTableSchema({
|
1134
|
+
workspace,
|
1135
|
+
region,
|
1136
|
+
database,
|
1137
|
+
branch,
|
1138
|
+
table
|
1139
|
+
}) {
|
973
1140
|
return operationsByTag.table.getTableSchema({
|
974
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1141
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
975
1142
|
...this.extraProps
|
976
1143
|
});
|
977
1144
|
}
|
978
|
-
setTableSchema(
|
1145
|
+
setTableSchema({
|
1146
|
+
workspace,
|
1147
|
+
region,
|
1148
|
+
database,
|
1149
|
+
branch,
|
1150
|
+
table,
|
1151
|
+
schema
|
1152
|
+
}) {
|
979
1153
|
return operationsByTag.table.setTableSchema({
|
980
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
981
|
-
body:
|
1154
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1155
|
+
body: schema,
|
982
1156
|
...this.extraProps
|
983
1157
|
});
|
984
1158
|
}
|
985
|
-
getTableColumns(
|
1159
|
+
getTableColumns({
|
1160
|
+
workspace,
|
1161
|
+
region,
|
1162
|
+
database,
|
1163
|
+
branch,
|
1164
|
+
table
|
1165
|
+
}) {
|
986
1166
|
return operationsByTag.table.getTableColumns({
|
987
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1167
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
988
1168
|
...this.extraProps
|
989
1169
|
});
|
990
1170
|
}
|
991
|
-
addTableColumn(
|
1171
|
+
addTableColumn({
|
1172
|
+
workspace,
|
1173
|
+
region,
|
1174
|
+
database,
|
1175
|
+
branch,
|
1176
|
+
table,
|
1177
|
+
column
|
1178
|
+
}) {
|
992
1179
|
return operationsByTag.table.addTableColumn({
|
993
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1180
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
994
1181
|
body: column,
|
995
1182
|
...this.extraProps
|
996
1183
|
});
|
997
1184
|
}
|
998
|
-
getColumn(
|
1185
|
+
getColumn({
|
1186
|
+
workspace,
|
1187
|
+
region,
|
1188
|
+
database,
|
1189
|
+
branch,
|
1190
|
+
table,
|
1191
|
+
column
|
1192
|
+
}) {
|
999
1193
|
return operationsByTag.table.getColumn({
|
1000
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1194
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1001
1195
|
...this.extraProps
|
1002
1196
|
});
|
1003
1197
|
}
|
1004
|
-
|
1005
|
-
|
1006
|
-
|
1198
|
+
updateColumn({
|
1199
|
+
workspace,
|
1200
|
+
region,
|
1201
|
+
database,
|
1202
|
+
branch,
|
1203
|
+
table,
|
1204
|
+
column,
|
1205
|
+
update
|
1206
|
+
}) {
|
1207
|
+
return operationsByTag.table.updateColumn({
|
1208
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1209
|
+
body: update,
|
1007
1210
|
...this.extraProps
|
1008
1211
|
});
|
1009
1212
|
}
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1013
|
-
|
1213
|
+
deleteColumn({
|
1214
|
+
workspace,
|
1215
|
+
region,
|
1216
|
+
database,
|
1217
|
+
branch,
|
1218
|
+
table,
|
1219
|
+
column
|
1220
|
+
}) {
|
1221
|
+
return operationsByTag.table.deleteColumn({
|
1222
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1014
1223
|
...this.extraProps
|
1015
1224
|
});
|
1016
1225
|
}
|
@@ -1019,78 +1228,213 @@ class RecordsApi {
|
|
1019
1228
|
constructor(extraProps) {
|
1020
1229
|
this.extraProps = extraProps;
|
1021
1230
|
}
|
1022
|
-
insertRecord(
|
1231
|
+
insertRecord({
|
1232
|
+
workspace,
|
1233
|
+
region,
|
1234
|
+
database,
|
1235
|
+
branch,
|
1236
|
+
table,
|
1237
|
+
record,
|
1238
|
+
columns
|
1239
|
+
}) {
|
1023
1240
|
return operationsByTag.records.insertRecord({
|
1024
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1025
|
-
queryParams:
|
1241
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1242
|
+
queryParams: { columns },
|
1026
1243
|
body: record,
|
1027
1244
|
...this.extraProps
|
1028
1245
|
});
|
1029
1246
|
}
|
1030
|
-
|
1247
|
+
getRecord({
|
1248
|
+
workspace,
|
1249
|
+
region,
|
1250
|
+
database,
|
1251
|
+
branch,
|
1252
|
+
table,
|
1253
|
+
id,
|
1254
|
+
columns
|
1255
|
+
}) {
|
1256
|
+
return operationsByTag.records.getRecord({
|
1257
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1258
|
+
queryParams: { columns },
|
1259
|
+
...this.extraProps
|
1260
|
+
});
|
1261
|
+
}
|
1262
|
+
insertRecordWithID({
|
1263
|
+
workspace,
|
1264
|
+
region,
|
1265
|
+
database,
|
1266
|
+
branch,
|
1267
|
+
table,
|
1268
|
+
id,
|
1269
|
+
record,
|
1270
|
+
columns,
|
1271
|
+
createOnly,
|
1272
|
+
ifVersion
|
1273
|
+
}) {
|
1031
1274
|
return operationsByTag.records.insertRecordWithID({
|
1032
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1033
|
-
queryParams:
|
1275
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1276
|
+
queryParams: { columns, createOnly, ifVersion },
|
1034
1277
|
body: record,
|
1035
1278
|
...this.extraProps
|
1036
1279
|
});
|
1037
1280
|
}
|
1038
|
-
updateRecordWithID(
|
1281
|
+
updateRecordWithID({
|
1282
|
+
workspace,
|
1283
|
+
region,
|
1284
|
+
database,
|
1285
|
+
branch,
|
1286
|
+
table,
|
1287
|
+
id,
|
1288
|
+
record,
|
1289
|
+
columns,
|
1290
|
+
ifVersion
|
1291
|
+
}) {
|
1039
1292
|
return operationsByTag.records.updateRecordWithID({
|
1040
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1041
|
-
queryParams:
|
1293
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1294
|
+
queryParams: { columns, ifVersion },
|
1042
1295
|
body: record,
|
1043
1296
|
...this.extraProps
|
1044
1297
|
});
|
1045
1298
|
}
|
1046
|
-
upsertRecordWithID(
|
1299
|
+
upsertRecordWithID({
|
1300
|
+
workspace,
|
1301
|
+
region,
|
1302
|
+
database,
|
1303
|
+
branch,
|
1304
|
+
table,
|
1305
|
+
id,
|
1306
|
+
record,
|
1307
|
+
columns,
|
1308
|
+
ifVersion
|
1309
|
+
}) {
|
1047
1310
|
return operationsByTag.records.upsertRecordWithID({
|
1048
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1049
|
-
queryParams:
|
1311
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1312
|
+
queryParams: { columns, ifVersion },
|
1050
1313
|
body: record,
|
1051
1314
|
...this.extraProps
|
1052
1315
|
});
|
1053
1316
|
}
|
1054
|
-
deleteRecord(
|
1317
|
+
deleteRecord({
|
1318
|
+
workspace,
|
1319
|
+
region,
|
1320
|
+
database,
|
1321
|
+
branch,
|
1322
|
+
table,
|
1323
|
+
id,
|
1324
|
+
columns
|
1325
|
+
}) {
|
1055
1326
|
return operationsByTag.records.deleteRecord({
|
1056
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1057
|
-
queryParams:
|
1058
|
-
...this.extraProps
|
1059
|
-
});
|
1060
|
-
}
|
1061
|
-
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
1062
|
-
return operationsByTag.records.getRecord({
|
1063
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1064
|
-
queryParams: options,
|
1327
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1328
|
+
queryParams: { columns },
|
1065
1329
|
...this.extraProps
|
1066
1330
|
});
|
1067
1331
|
}
|
1068
|
-
bulkInsertTableRecords(
|
1332
|
+
bulkInsertTableRecords({
|
1333
|
+
workspace,
|
1334
|
+
region,
|
1335
|
+
database,
|
1336
|
+
branch,
|
1337
|
+
table,
|
1338
|
+
records,
|
1339
|
+
columns
|
1340
|
+
}) {
|
1069
1341
|
return operationsByTag.records.bulkInsertTableRecords({
|
1070
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1071
|
-
queryParams:
|
1342
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1343
|
+
queryParams: { columns },
|
1072
1344
|
body: { records },
|
1073
1345
|
...this.extraProps
|
1074
1346
|
});
|
1075
1347
|
}
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
1079
|
-
|
1080
|
-
...this.extraProps
|
1081
|
-
});
|
1082
|
-
}
|
1083
|
-
searchTable(workspace, database, branch, tableName, query) {
|
1084
|
-
return operationsByTag.records.searchTable({
|
1085
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1086
|
-
body: query,
|
1087
|
-
...this.extraProps
|
1088
|
-
});
|
1348
|
+
}
|
1349
|
+
class SearchAndFilterApi {
|
1350
|
+
constructor(extraProps) {
|
1351
|
+
this.extraProps = extraProps;
|
1089
1352
|
}
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
1093
|
-
|
1353
|
+
queryTable({
|
1354
|
+
workspace,
|
1355
|
+
region,
|
1356
|
+
database,
|
1357
|
+
branch,
|
1358
|
+
table,
|
1359
|
+
filter,
|
1360
|
+
sort,
|
1361
|
+
page,
|
1362
|
+
columns
|
1363
|
+
}) {
|
1364
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1365
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1366
|
+
body: { filter, sort, page, columns },
|
1367
|
+
...this.extraProps
|
1368
|
+
});
|
1369
|
+
}
|
1370
|
+
searchTable({
|
1371
|
+
workspace,
|
1372
|
+
region,
|
1373
|
+
database,
|
1374
|
+
branch,
|
1375
|
+
table,
|
1376
|
+
query,
|
1377
|
+
fuzziness,
|
1378
|
+
target,
|
1379
|
+
prefix,
|
1380
|
+
filter,
|
1381
|
+
highlight,
|
1382
|
+
boosters
|
1383
|
+
}) {
|
1384
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1385
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1386
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1387
|
+
...this.extraProps
|
1388
|
+
});
|
1389
|
+
}
|
1390
|
+
searchBranch({
|
1391
|
+
workspace,
|
1392
|
+
region,
|
1393
|
+
database,
|
1394
|
+
branch,
|
1395
|
+
tables,
|
1396
|
+
query,
|
1397
|
+
fuzziness,
|
1398
|
+
prefix,
|
1399
|
+
highlight
|
1400
|
+
}) {
|
1401
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1402
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1403
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1404
|
+
...this.extraProps
|
1405
|
+
});
|
1406
|
+
}
|
1407
|
+
summarizeTable({
|
1408
|
+
workspace,
|
1409
|
+
region,
|
1410
|
+
database,
|
1411
|
+
branch,
|
1412
|
+
table,
|
1413
|
+
filter,
|
1414
|
+
columns,
|
1415
|
+
summaries,
|
1416
|
+
sort,
|
1417
|
+
summariesFilter,
|
1418
|
+
page
|
1419
|
+
}) {
|
1420
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1421
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1422
|
+
body: { filter, columns, summaries, sort, summariesFilter, page },
|
1423
|
+
...this.extraProps
|
1424
|
+
});
|
1425
|
+
}
|
1426
|
+
aggregateTable({
|
1427
|
+
workspace,
|
1428
|
+
region,
|
1429
|
+
database,
|
1430
|
+
branch,
|
1431
|
+
table,
|
1432
|
+
filter,
|
1433
|
+
aggs
|
1434
|
+
}) {
|
1435
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1436
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1437
|
+
body: { filter, aggs },
|
1094
1438
|
...this.extraProps
|
1095
1439
|
});
|
1096
1440
|
}
|
@@ -1099,123 +1443,281 @@ class MigrationRequestsApi {
|
|
1099
1443
|
constructor(extraProps) {
|
1100
1444
|
this.extraProps = extraProps;
|
1101
1445
|
}
|
1102
|
-
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
1108
|
-
|
1109
|
-
|
1446
|
+
queryMigrationRequests({
|
1447
|
+
workspace,
|
1448
|
+
region,
|
1449
|
+
database,
|
1450
|
+
filter,
|
1451
|
+
sort,
|
1452
|
+
page,
|
1453
|
+
columns
|
1454
|
+
}) {
|
1455
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1456
|
+
pathParams: { workspace, region, dbName: database },
|
1457
|
+
body: { filter, sort, page, columns },
|
1458
|
+
...this.extraProps
|
1459
|
+
});
|
1460
|
+
}
|
1461
|
+
createMigrationRequest({
|
1462
|
+
workspace,
|
1463
|
+
region,
|
1464
|
+
database,
|
1465
|
+
migration
|
1466
|
+
}) {
|
1110
1467
|
return operationsByTag.migrationRequests.createMigrationRequest({
|
1111
|
-
pathParams: { workspace, dbName: database },
|
1112
|
-
body:
|
1468
|
+
pathParams: { workspace, region, dbName: database },
|
1469
|
+
body: migration,
|
1113
1470
|
...this.extraProps
|
1114
1471
|
});
|
1115
1472
|
}
|
1116
|
-
getMigrationRequest(
|
1473
|
+
getMigrationRequest({
|
1474
|
+
workspace,
|
1475
|
+
region,
|
1476
|
+
database,
|
1477
|
+
migrationRequest
|
1478
|
+
}) {
|
1117
1479
|
return operationsByTag.migrationRequests.getMigrationRequest({
|
1118
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1480
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1119
1481
|
...this.extraProps
|
1120
1482
|
});
|
1121
1483
|
}
|
1122
|
-
updateMigrationRequest(
|
1484
|
+
updateMigrationRequest({
|
1485
|
+
workspace,
|
1486
|
+
region,
|
1487
|
+
database,
|
1488
|
+
migrationRequest,
|
1489
|
+
update
|
1490
|
+
}) {
|
1123
1491
|
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1124
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1125
|
-
body:
|
1492
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1493
|
+
body: update,
|
1126
1494
|
...this.extraProps
|
1127
1495
|
});
|
1128
1496
|
}
|
1129
|
-
listMigrationRequestsCommits(
|
1497
|
+
listMigrationRequestsCommits({
|
1498
|
+
workspace,
|
1499
|
+
region,
|
1500
|
+
database,
|
1501
|
+
migrationRequest,
|
1502
|
+
page
|
1503
|
+
}) {
|
1130
1504
|
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1131
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1132
|
-
body:
|
1505
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1506
|
+
body: { page },
|
1133
1507
|
...this.extraProps
|
1134
1508
|
});
|
1135
1509
|
}
|
1136
|
-
compareMigrationRequest(
|
1510
|
+
compareMigrationRequest({
|
1511
|
+
workspace,
|
1512
|
+
region,
|
1513
|
+
database,
|
1514
|
+
migrationRequest
|
1515
|
+
}) {
|
1137
1516
|
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1138
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1517
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1139
1518
|
...this.extraProps
|
1140
1519
|
});
|
1141
1520
|
}
|
1142
|
-
getMigrationRequestIsMerged(
|
1521
|
+
getMigrationRequestIsMerged({
|
1522
|
+
workspace,
|
1523
|
+
region,
|
1524
|
+
database,
|
1525
|
+
migrationRequest
|
1526
|
+
}) {
|
1143
1527
|
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1144
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1528
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1145
1529
|
...this.extraProps
|
1146
1530
|
});
|
1147
1531
|
}
|
1148
|
-
mergeMigrationRequest(
|
1532
|
+
mergeMigrationRequest({
|
1533
|
+
workspace,
|
1534
|
+
region,
|
1535
|
+
database,
|
1536
|
+
migrationRequest
|
1537
|
+
}) {
|
1149
1538
|
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1150
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1539
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1151
1540
|
...this.extraProps
|
1152
1541
|
});
|
1153
1542
|
}
|
1154
1543
|
}
|
1155
|
-
class
|
1544
|
+
class MigrationsApi {
|
1156
1545
|
constructor(extraProps) {
|
1157
1546
|
this.extraProps = extraProps;
|
1158
1547
|
}
|
1159
|
-
getBranchMigrationHistory(
|
1160
|
-
|
1161
|
-
|
1162
|
-
|
1548
|
+
getBranchMigrationHistory({
|
1549
|
+
workspace,
|
1550
|
+
region,
|
1551
|
+
database,
|
1552
|
+
branch,
|
1553
|
+
limit,
|
1554
|
+
startFrom
|
1555
|
+
}) {
|
1556
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1557
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1558
|
+
body: { limit, startFrom },
|
1559
|
+
...this.extraProps
|
1560
|
+
});
|
1561
|
+
}
|
1562
|
+
getBranchMigrationPlan({
|
1563
|
+
workspace,
|
1564
|
+
region,
|
1565
|
+
database,
|
1566
|
+
branch,
|
1567
|
+
schema
|
1568
|
+
}) {
|
1569
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1570
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1571
|
+
body: schema,
|
1163
1572
|
...this.extraProps
|
1164
1573
|
});
|
1165
1574
|
}
|
1166
|
-
executeBranchMigrationPlan(
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1575
|
+
executeBranchMigrationPlan({
|
1576
|
+
workspace,
|
1577
|
+
region,
|
1578
|
+
database,
|
1579
|
+
branch,
|
1580
|
+
plan
|
1581
|
+
}) {
|
1582
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1583
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1584
|
+
body: plan,
|
1170
1585
|
...this.extraProps
|
1171
1586
|
});
|
1172
1587
|
}
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1588
|
+
getBranchSchemaHistory({
|
1589
|
+
workspace,
|
1590
|
+
region,
|
1591
|
+
database,
|
1592
|
+
branch,
|
1593
|
+
page
|
1594
|
+
}) {
|
1595
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1596
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1597
|
+
body: { page },
|
1177
1598
|
...this.extraProps
|
1178
1599
|
});
|
1179
1600
|
}
|
1180
|
-
compareBranchWithUserSchema(
|
1181
|
-
|
1182
|
-
|
1601
|
+
compareBranchWithUserSchema({
|
1602
|
+
workspace,
|
1603
|
+
region,
|
1604
|
+
database,
|
1605
|
+
branch,
|
1606
|
+
schema
|
1607
|
+
}) {
|
1608
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1609
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1183
1610
|
body: { schema },
|
1184
1611
|
...this.extraProps
|
1185
1612
|
});
|
1186
1613
|
}
|
1187
|
-
compareBranchSchemas(
|
1188
|
-
|
1189
|
-
|
1614
|
+
compareBranchSchemas({
|
1615
|
+
workspace,
|
1616
|
+
region,
|
1617
|
+
database,
|
1618
|
+
branch,
|
1619
|
+
compare,
|
1620
|
+
schema
|
1621
|
+
}) {
|
1622
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1623
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1190
1624
|
body: { schema },
|
1191
1625
|
...this.extraProps
|
1192
1626
|
});
|
1193
1627
|
}
|
1194
|
-
updateBranchSchema(
|
1195
|
-
|
1196
|
-
|
1628
|
+
updateBranchSchema({
|
1629
|
+
workspace,
|
1630
|
+
region,
|
1631
|
+
database,
|
1632
|
+
branch,
|
1633
|
+
migration
|
1634
|
+
}) {
|
1635
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1636
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1197
1637
|
body: migration,
|
1198
1638
|
...this.extraProps
|
1199
1639
|
});
|
1200
1640
|
}
|
1201
|
-
previewBranchSchemaEdit(
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1641
|
+
previewBranchSchemaEdit({
|
1642
|
+
workspace,
|
1643
|
+
region,
|
1644
|
+
database,
|
1645
|
+
branch,
|
1646
|
+
data
|
1647
|
+
}) {
|
1648
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1649
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1650
|
+
body: data,
|
1205
1651
|
...this.extraProps
|
1206
1652
|
});
|
1207
1653
|
}
|
1208
|
-
applyBranchSchemaEdit(
|
1209
|
-
|
1210
|
-
|
1654
|
+
applyBranchSchemaEdit({
|
1655
|
+
workspace,
|
1656
|
+
region,
|
1657
|
+
database,
|
1658
|
+
branch,
|
1659
|
+
edits
|
1660
|
+
}) {
|
1661
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1662
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1211
1663
|
body: { edits },
|
1212
1664
|
...this.extraProps
|
1213
1665
|
});
|
1214
1666
|
}
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1667
|
+
}
|
1668
|
+
class DatabaseApi {
|
1669
|
+
constructor(extraProps) {
|
1670
|
+
this.extraProps = extraProps;
|
1671
|
+
}
|
1672
|
+
getDatabaseList({ workspace }) {
|
1673
|
+
return operationsByTag.databases.getDatabaseList({
|
1674
|
+
pathParams: { workspaceId: workspace },
|
1675
|
+
...this.extraProps
|
1676
|
+
});
|
1677
|
+
}
|
1678
|
+
createDatabase({
|
1679
|
+
workspace,
|
1680
|
+
database,
|
1681
|
+
data
|
1682
|
+
}) {
|
1683
|
+
return operationsByTag.databases.createDatabase({
|
1684
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1685
|
+
body: data,
|
1686
|
+
...this.extraProps
|
1687
|
+
});
|
1688
|
+
}
|
1689
|
+
deleteDatabase({
|
1690
|
+
workspace,
|
1691
|
+
database
|
1692
|
+
}) {
|
1693
|
+
return operationsByTag.databases.deleteDatabase({
|
1694
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1695
|
+
...this.extraProps
|
1696
|
+
});
|
1697
|
+
}
|
1698
|
+
getDatabaseMetadata({
|
1699
|
+
workspace,
|
1700
|
+
database
|
1701
|
+
}) {
|
1702
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1703
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1704
|
+
...this.extraProps
|
1705
|
+
});
|
1706
|
+
}
|
1707
|
+
updateDatabaseMetadata({
|
1708
|
+
workspace,
|
1709
|
+
database,
|
1710
|
+
metadata
|
1711
|
+
}) {
|
1712
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1713
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1714
|
+
body: metadata,
|
1715
|
+
...this.extraProps
|
1716
|
+
});
|
1717
|
+
}
|
1718
|
+
listRegions({ workspace }) {
|
1719
|
+
return operationsByTag.databases.listRegions({
|
1720
|
+
pathParams: { workspaceId: workspace },
|
1219
1721
|
...this.extraProps
|
1220
1722
|
});
|
1221
1723
|
}
|
@@ -1231,6 +1733,20 @@ class XataApiPlugin {
|
|
1231
1733
|
class XataPlugin {
|
1232
1734
|
}
|
1233
1735
|
|
1736
|
+
function generateUUID() {
|
1737
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1738
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1739
|
+
return v.toString(16);
|
1740
|
+
});
|
1741
|
+
}
|
1742
|
+
|
1743
|
+
function cleanFilter(filter) {
|
1744
|
+
if (!filter)
|
1745
|
+
return void 0;
|
1746
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1747
|
+
return values.length > 0 ? filter : void 0;
|
1748
|
+
}
|
1749
|
+
|
1234
1750
|
var __accessCheck$6 = (obj, member, msg) => {
|
1235
1751
|
if (!member.has(obj))
|
1236
1752
|
throw TypeError("Cannot " + msg);
|
@@ -1263,11 +1779,11 @@ class Page {
|
|
1263
1779
|
async previousPage(size, offset) {
|
1264
1780
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1265
1781
|
}
|
1266
|
-
async
|
1267
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1782
|
+
async startPage(size, offset) {
|
1783
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
1268
1784
|
}
|
1269
|
-
async
|
1270
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1785
|
+
async endPage(size, offset) {
|
1786
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
1271
1787
|
}
|
1272
1788
|
hasNextPage() {
|
1273
1789
|
return this.meta.page.more;
|
@@ -1279,7 +1795,7 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1279
1795
|
const PAGINATION_MAX_OFFSET = 800;
|
1280
1796
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1281
1797
|
function isCursorPaginationOptions(options) {
|
1282
|
-
return isDefined(options) && (isDefined(options.
|
1798
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1283
1799
|
}
|
1284
1800
|
const _RecordArray = class extends Array {
|
1285
1801
|
constructor(...args) {
|
@@ -1311,12 +1827,12 @@ const _RecordArray = class extends Array {
|
|
1311
1827
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1312
1828
|
return new _RecordArray(newPage);
|
1313
1829
|
}
|
1314
|
-
async
|
1315
|
-
const newPage = await __privateGet$6(this, _page).
|
1830
|
+
async startPage(size, offset) {
|
1831
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1316
1832
|
return new _RecordArray(newPage);
|
1317
1833
|
}
|
1318
|
-
async
|
1319
|
-
const newPage = await __privateGet$6(this, _page).
|
1834
|
+
async endPage(size, offset) {
|
1835
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1320
1836
|
return new _RecordArray(newPage);
|
1321
1837
|
}
|
1322
1838
|
hasNextPage() {
|
@@ -1344,9 +1860,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1344
1860
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1345
1861
|
return value;
|
1346
1862
|
};
|
1347
|
-
var
|
1863
|
+
var __privateMethod$3 = (obj, member, method) => {
|
1864
|
+
__accessCheck$5(obj, member, "access private method");
|
1865
|
+
return method;
|
1866
|
+
};
|
1867
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1348
1868
|
const _Query = class {
|
1349
1869
|
constructor(repository, table, data, rawParent) {
|
1870
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1350
1871
|
__privateAdd$5(this, _table$1, void 0);
|
1351
1872
|
__privateAdd$5(this, _repository, void 0);
|
1352
1873
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1365,7 +1886,7 @@ const _Query = class {
|
|
1365
1886
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1366
1887
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1367
1888
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1368
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1889
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1369
1890
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1370
1891
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1371
1892
|
this.any = this.any.bind(this);
|
@@ -1403,22 +1924,17 @@ const _Query = class {
|
|
1403
1924
|
}
|
1404
1925
|
filter(a, b) {
|
1405
1926
|
if (arguments.length === 1) {
|
1406
|
-
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1927
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1928
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
1929
|
+
}));
|
1407
1930
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1408
1931
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1409
1932
|
} else {
|
1410
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.
|
1933
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
1411
1934
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1412
1935
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1413
1936
|
}
|
1414
1937
|
}
|
1415
|
-
defaultFilter(column, value) {
|
1416
|
-
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
1417
|
-
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
1418
|
-
return { $includes: value };
|
1419
|
-
}
|
1420
|
-
return value;
|
1421
|
-
}
|
1422
1938
|
sort(column, direction = "asc") {
|
1423
1939
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1424
1940
|
const sort = [...originalSort, { column, direction }];
|
@@ -1462,7 +1978,7 @@ const _Query = class {
|
|
1462
1978
|
page = await page.nextPage();
|
1463
1979
|
results.push(...page.records);
|
1464
1980
|
}
|
1465
|
-
if (page.hasNextPage()) {
|
1981
|
+
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1466
1982
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1467
1983
|
}
|
1468
1984
|
const array = new RecordArray(page, results.slice(0, size));
|
@@ -1480,19 +1996,35 @@ const _Query = class {
|
|
1480
1996
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1481
1997
|
return records[0] ?? null;
|
1482
1998
|
}
|
1999
|
+
async getFirstOrThrow(options = {}) {
|
2000
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2001
|
+
if (records[0] === void 0)
|
2002
|
+
throw new Error("No results found.");
|
2003
|
+
return records[0];
|
2004
|
+
}
|
2005
|
+
async summarize(params = {}) {
|
2006
|
+
const { summaries, summariesFilter, ...options } = params;
|
2007
|
+
const query = new _Query(
|
2008
|
+
__privateGet$5(this, _repository),
|
2009
|
+
__privateGet$5(this, _table$1),
|
2010
|
+
options,
|
2011
|
+
__privateGet$5(this, _data)
|
2012
|
+
);
|
2013
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2014
|
+
}
|
1483
2015
|
cache(ttl) {
|
1484
2016
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1485
2017
|
}
|
1486
2018
|
nextPage(size, offset) {
|
1487
|
-
return this.
|
2019
|
+
return this.startPage(size, offset);
|
1488
2020
|
}
|
1489
2021
|
previousPage(size, offset) {
|
1490
|
-
return this.
|
2022
|
+
return this.startPage(size, offset);
|
1491
2023
|
}
|
1492
|
-
|
2024
|
+
startPage(size, offset) {
|
1493
2025
|
return this.getPaginated({ pagination: { size, offset } });
|
1494
2026
|
}
|
1495
|
-
|
2027
|
+
endPage(size, offset) {
|
1496
2028
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1497
2029
|
}
|
1498
2030
|
hasNextPage() {
|
@@ -1503,9 +2035,20 @@ let Query = _Query;
|
|
1503
2035
|
_table$1 = new WeakMap();
|
1504
2036
|
_repository = new WeakMap();
|
1505
2037
|
_data = new WeakMap();
|
2038
|
+
_cleanFilterConstraint = new WeakSet();
|
2039
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2040
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2041
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2042
|
+
return { $includes: value };
|
2043
|
+
}
|
2044
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2045
|
+
return value.id;
|
2046
|
+
}
|
2047
|
+
return value;
|
2048
|
+
};
|
1506
2049
|
function cleanParent(data, parent) {
|
1507
2050
|
if (isCursorPaginationOptions(data.pagination)) {
|
1508
|
-
return { ...parent,
|
2051
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1509
2052
|
}
|
1510
2053
|
return parent;
|
1511
2054
|
}
|
@@ -1590,10 +2133,13 @@ class RestRepository extends Query {
|
|
1590
2133
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1591
2134
|
__privateAdd$4(this, _trace, void 0);
|
1592
2135
|
__privateSet$4(this, _table, options.table);
|
1593
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1594
2136
|
__privateSet$4(this, _db, options.db);
|
1595
2137
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1596
2138
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2139
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2140
|
+
const props = await options.pluginOptions.getFetchProps();
|
2141
|
+
return { ...props, sessionID: generateUUID() };
|
2142
|
+
});
|
1597
2143
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1598
2144
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1599
2145
|
return trace(name, fn, {
|
@@ -1604,8 +2150,9 @@ class RestRepository extends Query {
|
|
1604
2150
|
});
|
1605
2151
|
});
|
1606
2152
|
}
|
1607
|
-
async create(a, b, c) {
|
2153
|
+
async create(a, b, c, d) {
|
1608
2154
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2155
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1609
2156
|
if (Array.isArray(a)) {
|
1610
2157
|
if (a.length === 0)
|
1611
2158
|
return [];
|
@@ -1616,13 +2163,13 @@ class RestRepository extends Query {
|
|
1616
2163
|
if (a === "")
|
1617
2164
|
throw new Error("The id can't be empty");
|
1618
2165
|
const columns = isStringArray(c) ? c : void 0;
|
1619
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
2166
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1620
2167
|
}
|
1621
2168
|
if (isObject(a) && isString(a.id)) {
|
1622
2169
|
if (a.id === "")
|
1623
2170
|
throw new Error("The id can't be empty");
|
1624
2171
|
const columns = isStringArray(b) ? b : void 0;
|
1625
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2172
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1626
2173
|
}
|
1627
2174
|
if (isObject(a)) {
|
1628
2175
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1653,6 +2200,7 @@ class RestRepository extends Query {
|
|
1653
2200
|
pathParams: {
|
1654
2201
|
workspace: "{workspaceId}",
|
1655
2202
|
dbBranchName: "{dbBranch}",
|
2203
|
+
region: "{region}",
|
1656
2204
|
tableName: __privateGet$4(this, _table),
|
1657
2205
|
recordId: id
|
1658
2206
|
},
|
@@ -1660,7 +2208,7 @@ class RestRepository extends Query {
|
|
1660
2208
|
...fetchProps
|
1661
2209
|
});
|
1662
2210
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1663
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2211
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1664
2212
|
} catch (e) {
|
1665
2213
|
if (isObject(e) && e.status === 404) {
|
1666
2214
|
return null;
|
@@ -1671,8 +2219,28 @@ class RestRepository extends Query {
|
|
1671
2219
|
return null;
|
1672
2220
|
});
|
1673
2221
|
}
|
1674
|
-
async
|
2222
|
+
async readOrThrow(a, b) {
|
2223
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2224
|
+
const result = await this.read(a, b);
|
2225
|
+
if (Array.isArray(result)) {
|
2226
|
+
const missingIds = compact(
|
2227
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2228
|
+
);
|
2229
|
+
if (missingIds.length > 0) {
|
2230
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2231
|
+
}
|
2232
|
+
return result;
|
2233
|
+
}
|
2234
|
+
if (result === null) {
|
2235
|
+
const id = extractId(a) ?? "unknown";
|
2236
|
+
throw new Error(`Record with id ${id} not found`);
|
2237
|
+
}
|
2238
|
+
return result;
|
2239
|
+
});
|
2240
|
+
}
|
2241
|
+
async update(a, b, c, d) {
|
1675
2242
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2243
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1676
2244
|
if (Array.isArray(a)) {
|
1677
2245
|
if (a.length === 0)
|
1678
2246
|
return [];
|
@@ -1684,17 +2252,37 @@ class RestRepository extends Query {
|
|
1684
2252
|
}
|
1685
2253
|
if (isString(a) && isObject(b)) {
|
1686
2254
|
const columns = isStringArray(c) ? c : void 0;
|
1687
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
2255
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1688
2256
|
}
|
1689
2257
|
if (isObject(a) && isString(a.id)) {
|
1690
2258
|
const columns = isStringArray(b) ? b : void 0;
|
1691
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2259
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1692
2260
|
}
|
1693
2261
|
throw new Error("Invalid arguments for update method");
|
1694
2262
|
});
|
1695
2263
|
}
|
1696
|
-
async
|
2264
|
+
async updateOrThrow(a, b, c, d) {
|
2265
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2266
|
+
const result = await this.update(a, b, c, d);
|
2267
|
+
if (Array.isArray(result)) {
|
2268
|
+
const missingIds = compact(
|
2269
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2270
|
+
);
|
2271
|
+
if (missingIds.length > 0) {
|
2272
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2273
|
+
}
|
2274
|
+
return result;
|
2275
|
+
}
|
2276
|
+
if (result === null) {
|
2277
|
+
const id = extractId(a) ?? "unknown";
|
2278
|
+
throw new Error(`Record with id ${id} not found`);
|
2279
|
+
}
|
2280
|
+
return result;
|
2281
|
+
});
|
2282
|
+
}
|
2283
|
+
async createOrUpdate(a, b, c, d) {
|
1697
2284
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2285
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1698
2286
|
if (Array.isArray(a)) {
|
1699
2287
|
if (a.length === 0)
|
1700
2288
|
return [];
|
@@ -1706,15 +2294,35 @@ class RestRepository extends Query {
|
|
1706
2294
|
}
|
1707
2295
|
if (isString(a) && isObject(b)) {
|
1708
2296
|
const columns = isStringArray(c) ? c : void 0;
|
1709
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
2297
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1710
2298
|
}
|
1711
2299
|
if (isObject(a) && isString(a.id)) {
|
1712
2300
|
const columns = isStringArray(c) ? c : void 0;
|
1713
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2301
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1714
2302
|
}
|
1715
2303
|
throw new Error("Invalid arguments for createOrUpdate method");
|
1716
2304
|
});
|
1717
2305
|
}
|
2306
|
+
async createOrReplace(a, b, c, d) {
|
2307
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2308
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2309
|
+
if (Array.isArray(a)) {
|
2310
|
+
if (a.length === 0)
|
2311
|
+
return [];
|
2312
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2313
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
2314
|
+
}
|
2315
|
+
if (isString(a) && isObject(b)) {
|
2316
|
+
const columns = isStringArray(c) ? c : void 0;
|
2317
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2318
|
+
}
|
2319
|
+
if (isObject(a) && isString(a.id)) {
|
2320
|
+
const columns = isStringArray(c) ? c : void 0;
|
2321
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2322
|
+
}
|
2323
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2324
|
+
});
|
2325
|
+
}
|
1718
2326
|
async delete(a, b) {
|
1719
2327
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
1720
2328
|
if (Array.isArray(a)) {
|
@@ -1734,11 +2342,34 @@ class RestRepository extends Query {
|
|
1734
2342
|
throw new Error("Invalid arguments for delete method");
|
1735
2343
|
});
|
1736
2344
|
}
|
2345
|
+
async deleteOrThrow(a, b) {
|
2346
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2347
|
+
const result = await this.delete(a, b);
|
2348
|
+
if (Array.isArray(result)) {
|
2349
|
+
const missingIds = compact(
|
2350
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2351
|
+
);
|
2352
|
+
if (missingIds.length > 0) {
|
2353
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2354
|
+
}
|
2355
|
+
return result;
|
2356
|
+
} else if (result === null) {
|
2357
|
+
const id = extractId(a) ?? "unknown";
|
2358
|
+
throw new Error(`Record with id ${id} not found`);
|
2359
|
+
}
|
2360
|
+
return result;
|
2361
|
+
});
|
2362
|
+
}
|
1737
2363
|
async search(query, options = {}) {
|
1738
2364
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1739
2365
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1740
2366
|
const { records } = await searchTable({
|
1741
|
-
pathParams: {
|
2367
|
+
pathParams: {
|
2368
|
+
workspace: "{workspaceId}",
|
2369
|
+
dbBranchName: "{dbBranch}",
|
2370
|
+
region: "{region}",
|
2371
|
+
tableName: __privateGet$4(this, _table)
|
2372
|
+
},
|
1742
2373
|
body: {
|
1743
2374
|
query,
|
1744
2375
|
fuzziness: options.fuzziness,
|
@@ -1750,7 +2381,23 @@ class RestRepository extends Query {
|
|
1750
2381
|
...fetchProps
|
1751
2382
|
});
|
1752
2383
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1753
|
-
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2384
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2385
|
+
});
|
2386
|
+
}
|
2387
|
+
async aggregate(aggs, filter) {
|
2388
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2389
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2390
|
+
const result = await aggregateTable({
|
2391
|
+
pathParams: {
|
2392
|
+
workspace: "{workspaceId}",
|
2393
|
+
dbBranchName: "{dbBranch}",
|
2394
|
+
region: "{region}",
|
2395
|
+
tableName: __privateGet$4(this, _table)
|
2396
|
+
},
|
2397
|
+
body: { aggs, filter },
|
2398
|
+
...fetchProps
|
2399
|
+
});
|
2400
|
+
return result;
|
1754
2401
|
});
|
1755
2402
|
}
|
1756
2403
|
async query(query) {
|
@@ -1759,24 +2406,54 @@ class RestRepository extends Query {
|
|
1759
2406
|
if (cacheQuery)
|
1760
2407
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1761
2408
|
const data = query.getQueryOptions();
|
1762
|
-
const body = {
|
1763
|
-
filter: cleanFilter(data.filter),
|
1764
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1765
|
-
page: data.pagination,
|
1766
|
-
columns: data.columns
|
1767
|
-
};
|
1768
2409
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1769
2410
|
const { meta, records: objects } = await queryTable({
|
1770
|
-
pathParams: {
|
1771
|
-
|
2411
|
+
pathParams: {
|
2412
|
+
workspace: "{workspaceId}",
|
2413
|
+
dbBranchName: "{dbBranch}",
|
2414
|
+
region: "{region}",
|
2415
|
+
tableName: __privateGet$4(this, _table)
|
2416
|
+
},
|
2417
|
+
body: {
|
2418
|
+
filter: cleanFilter(data.filter),
|
2419
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2420
|
+
page: data.pagination,
|
2421
|
+
columns: data.columns ?? ["*"]
|
2422
|
+
},
|
1772
2423
|
...fetchProps
|
1773
2424
|
});
|
1774
2425
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1775
|
-
const records = objects.map(
|
2426
|
+
const records = objects.map(
|
2427
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2428
|
+
);
|
1776
2429
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1777
2430
|
return new Page(query, meta, records);
|
1778
2431
|
});
|
1779
2432
|
}
|
2433
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2434
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2435
|
+
const data = query.getQueryOptions();
|
2436
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2437
|
+
const result = await summarizeTable({
|
2438
|
+
pathParams: {
|
2439
|
+
workspace: "{workspaceId}",
|
2440
|
+
dbBranchName: "{dbBranch}",
|
2441
|
+
region: "{region}",
|
2442
|
+
tableName: __privateGet$4(this, _table)
|
2443
|
+
},
|
2444
|
+
body: {
|
2445
|
+
filter: cleanFilter(data.filter),
|
2446
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2447
|
+
columns: data.columns,
|
2448
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2449
|
+
summaries,
|
2450
|
+
summariesFilter
|
2451
|
+
},
|
2452
|
+
...fetchProps
|
2453
|
+
});
|
2454
|
+
return result;
|
2455
|
+
});
|
2456
|
+
}
|
1780
2457
|
}
|
1781
2458
|
_table = new WeakMap();
|
1782
2459
|
_getFetchProps = new WeakMap();
|
@@ -1792,6 +2469,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1792
2469
|
pathParams: {
|
1793
2470
|
workspace: "{workspaceId}",
|
1794
2471
|
dbBranchName: "{dbBranch}",
|
2472
|
+
region: "{region}",
|
1795
2473
|
tableName: __privateGet$4(this, _table)
|
1796
2474
|
},
|
1797
2475
|
queryParams: { columns },
|
@@ -1799,32 +2477,38 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1799
2477
|
...fetchProps
|
1800
2478
|
});
|
1801
2479
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1802
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2480
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1803
2481
|
};
|
1804
2482
|
_insertRecordWithId = new WeakSet();
|
1805
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2483
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1806
2484
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1807
2485
|
const record = transformObjectLinks(object);
|
1808
2486
|
const response = await insertRecordWithID({
|
1809
2487
|
pathParams: {
|
1810
2488
|
workspace: "{workspaceId}",
|
1811
2489
|
dbBranchName: "{dbBranch}",
|
2490
|
+
region: "{region}",
|
1812
2491
|
tableName: __privateGet$4(this, _table),
|
1813
2492
|
recordId
|
1814
2493
|
},
|
1815
2494
|
body: record,
|
1816
|
-
queryParams: { createOnly
|
2495
|
+
queryParams: { createOnly, columns, ifVersion },
|
1817
2496
|
...fetchProps
|
1818
2497
|
});
|
1819
2498
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1820
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2499
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1821
2500
|
};
|
1822
2501
|
_bulkInsertTableRecords = new WeakSet();
|
1823
2502
|
bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
1824
2503
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1825
2504
|
const records = objects.map((object) => transformObjectLinks(object));
|
1826
2505
|
const response = await bulkInsertTableRecords({
|
1827
|
-
pathParams: {
|
2506
|
+
pathParams: {
|
2507
|
+
workspace: "{workspaceId}",
|
2508
|
+
dbBranchName: "{dbBranch}",
|
2509
|
+
region: "{region}",
|
2510
|
+
tableName: __privateGet$4(this, _table)
|
2511
|
+
},
|
1828
2512
|
queryParams: { columns },
|
1829
2513
|
body: { records },
|
1830
2514
|
...fetchProps
|
@@ -1833,21 +2517,27 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
1833
2517
|
throw new Error("Request included columns but server didn't include them");
|
1834
2518
|
}
|
1835
2519
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1836
|
-
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2520
|
+
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
1837
2521
|
};
|
1838
2522
|
_updateRecordWithID = new WeakSet();
|
1839
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2523
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1840
2524
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1841
2525
|
const record = transformObjectLinks(object);
|
1842
2526
|
try {
|
1843
2527
|
const response = await updateRecordWithID({
|
1844
|
-
pathParams: {
|
1845
|
-
|
2528
|
+
pathParams: {
|
2529
|
+
workspace: "{workspaceId}",
|
2530
|
+
dbBranchName: "{dbBranch}",
|
2531
|
+
region: "{region}",
|
2532
|
+
tableName: __privateGet$4(this, _table),
|
2533
|
+
recordId
|
2534
|
+
},
|
2535
|
+
queryParams: { columns, ifVersion },
|
1846
2536
|
body: record,
|
1847
2537
|
...fetchProps
|
1848
2538
|
});
|
1849
2539
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1850
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2540
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1851
2541
|
} catch (e) {
|
1852
2542
|
if (isObject(e) && e.status === 404) {
|
1853
2543
|
return null;
|
@@ -1856,28 +2546,40 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1856
2546
|
}
|
1857
2547
|
};
|
1858
2548
|
_upsertRecordWithID = new WeakSet();
|
1859
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2549
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1860
2550
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1861
2551
|
const response = await upsertRecordWithID({
|
1862
|
-
pathParams: {
|
1863
|
-
|
2552
|
+
pathParams: {
|
2553
|
+
workspace: "{workspaceId}",
|
2554
|
+
dbBranchName: "{dbBranch}",
|
2555
|
+
region: "{region}",
|
2556
|
+
tableName: __privateGet$4(this, _table),
|
2557
|
+
recordId
|
2558
|
+
},
|
2559
|
+
queryParams: { columns, ifVersion },
|
1864
2560
|
body: object,
|
1865
2561
|
...fetchProps
|
1866
2562
|
});
|
1867
2563
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1868
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2564
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1869
2565
|
};
|
1870
2566
|
_deleteRecord = new WeakSet();
|
1871
2567
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1872
2568
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1873
2569
|
try {
|
1874
2570
|
const response = await deleteRecord({
|
1875
|
-
pathParams: {
|
2571
|
+
pathParams: {
|
2572
|
+
workspace: "{workspaceId}",
|
2573
|
+
dbBranchName: "{dbBranch}",
|
2574
|
+
region: "{region}",
|
2575
|
+
tableName: __privateGet$4(this, _table),
|
2576
|
+
recordId
|
2577
|
+
},
|
1876
2578
|
queryParams: { columns },
|
1877
2579
|
...fetchProps
|
1878
2580
|
});
|
1879
2581
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1880
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2582
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1881
2583
|
} catch (e) {
|
1882
2584
|
if (isObject(e) && e.status === 404) {
|
1883
2585
|
return null;
|
@@ -1907,7 +2609,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1907
2609
|
return __privateGet$4(this, _schemaTables$2);
|
1908
2610
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1909
2611
|
const { schema } = await getBranchDetails({
|
1910
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2612
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1911
2613
|
...fetchProps
|
1912
2614
|
});
|
1913
2615
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1920,7 +2622,7 @@ const transformObjectLinks = (object) => {
|
|
1920
2622
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1921
2623
|
}, {});
|
1922
2624
|
};
|
1923
|
-
const initObject = (db, schemaTables, table, object) => {
|
2625
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
1924
2626
|
const result = {};
|
1925
2627
|
const { xata, ...rest } = object ?? {};
|
1926
2628
|
Object.assign(result, rest);
|
@@ -1928,6 +2630,8 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1928
2630
|
if (!columns)
|
1929
2631
|
console.error(`Table ${table} not found in schema`);
|
1930
2632
|
for (const column of columns ?? []) {
|
2633
|
+
if (!isValidColumn(selectedColumns, column))
|
2634
|
+
continue;
|
1931
2635
|
const value = result[column.name];
|
1932
2636
|
switch (column.type) {
|
1933
2637
|
case "datetime": {
|
@@ -1944,17 +2648,42 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1944
2648
|
if (!linkTable) {
|
1945
2649
|
console.error(`Failed to parse link for field ${column.name}`);
|
1946
2650
|
} else if (isObject(value)) {
|
1947
|
-
|
2651
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2652
|
+
if (item === column.name) {
|
2653
|
+
return [...acc, "*"];
|
2654
|
+
}
|
2655
|
+
if (item.startsWith(`${column.name}.`)) {
|
2656
|
+
const [, ...path] = item.split(".");
|
2657
|
+
return [...acc, path.join(".")];
|
2658
|
+
}
|
2659
|
+
return acc;
|
2660
|
+
}, []);
|
2661
|
+
result[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2662
|
+
} else {
|
2663
|
+
result[column.name] = null;
|
1948
2664
|
}
|
1949
2665
|
break;
|
1950
2666
|
}
|
2667
|
+
default:
|
2668
|
+
result[column.name] = value ?? null;
|
2669
|
+
if (column.notNull === true && value === null) {
|
2670
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2671
|
+
}
|
2672
|
+
break;
|
1951
2673
|
}
|
1952
2674
|
}
|
1953
2675
|
result.read = function(columns2) {
|
1954
2676
|
return db[table].read(result["id"], columns2);
|
1955
2677
|
};
|
1956
|
-
result.update = function(data,
|
1957
|
-
|
2678
|
+
result.update = function(data, b, c) {
|
2679
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2680
|
+
const ifVersion = parseIfVersion(b, c);
|
2681
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2682
|
+
};
|
2683
|
+
result.replace = function(data, b, c) {
|
2684
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2685
|
+
const ifVersion = parseIfVersion(b, c);
|
2686
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
1958
2687
|
};
|
1959
2688
|
result.delete = function() {
|
1960
2689
|
return db[table].delete(result["id"]);
|
@@ -1962,7 +2691,7 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1962
2691
|
result.getMetadata = function() {
|
1963
2692
|
return xata;
|
1964
2693
|
};
|
1965
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2694
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
1966
2695
|
Object.defineProperty(result, prop, { enumerable: false });
|
1967
2696
|
}
|
1968
2697
|
Object.freeze(result);
|
@@ -1978,11 +2707,22 @@ function extractId(value) {
|
|
1978
2707
|
return value.id;
|
1979
2708
|
return void 0;
|
1980
2709
|
}
|
1981
|
-
function
|
1982
|
-
if (
|
1983
|
-
return
|
1984
|
-
|
1985
|
-
|
2710
|
+
function isValidColumn(columns, column) {
|
2711
|
+
if (columns.includes("*"))
|
2712
|
+
return true;
|
2713
|
+
if (column.type === "link") {
|
2714
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2715
|
+
return linkColumns.length > 0;
|
2716
|
+
}
|
2717
|
+
return columns.includes(column.name);
|
2718
|
+
}
|
2719
|
+
function parseIfVersion(...args) {
|
2720
|
+
for (const arg of args) {
|
2721
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2722
|
+
return arg.ifVersion;
|
2723
|
+
}
|
2724
|
+
}
|
2725
|
+
return void 0;
|
1986
2726
|
}
|
1987
2727
|
|
1988
2728
|
var __accessCheck$3 = (obj, member, msg) => {
|
@@ -2149,7 +2889,7 @@ class SearchPlugin extends XataPlugin {
|
|
2149
2889
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
2150
2890
|
return records.map((record) => {
|
2151
2891
|
const { table = "orphan" } = record.xata;
|
2152
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
2892
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
2153
2893
|
});
|
2154
2894
|
},
|
2155
2895
|
byTable: async (query, options = {}) => {
|
@@ -2158,7 +2898,7 @@ class SearchPlugin extends XataPlugin {
|
|
2158
2898
|
return records.reduce((acc, record) => {
|
2159
2899
|
const { table = "orphan" } = record.xata;
|
2160
2900
|
const items = acc[table] ?? [];
|
2161
|
-
const item = initObject(this.db, schemaTables, table, record);
|
2901
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
2162
2902
|
return { ...acc, [table]: [...items, item] };
|
2163
2903
|
}, {});
|
2164
2904
|
}
|
@@ -2171,7 +2911,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
2171
2911
|
const fetchProps = await getFetchProps();
|
2172
2912
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
2173
2913
|
const { records } = await searchBranch({
|
2174
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2914
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2175
2915
|
body: { tables, query, fuzziness, prefix, highlight },
|
2176
2916
|
...fetchProps
|
2177
2917
|
});
|
@@ -2183,7 +2923,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
2183
2923
|
return __privateGet$1(this, _schemaTables);
|
2184
2924
|
const fetchProps = await getFetchProps();
|
2185
2925
|
const { schema } = await getBranchDetails({
|
2186
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2926
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2187
2927
|
...fetchProps
|
2188
2928
|
});
|
2189
2929
|
__privateSet$1(this, _schemaTables, schema.tables);
|
@@ -2221,14 +2961,17 @@ async function resolveXataBranch(gitBranch, options) {
|
|
2221
2961
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2222
2962
|
);
|
2223
2963
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2224
|
-
const
|
2964
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
2965
|
+
if (!urlParts)
|
2966
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
2967
|
+
const { workspace, region } = urlParts;
|
2225
2968
|
const { fallbackBranch } = getEnvironment();
|
2226
2969
|
const { branch } = await resolveBranch({
|
2227
2970
|
apiKey,
|
2228
2971
|
apiUrl: databaseURL,
|
2229
2972
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2230
2973
|
workspacesApiUrl: `${protocol}//${host}`,
|
2231
|
-
pathParams: { dbName, workspace },
|
2974
|
+
pathParams: { dbName, workspace, region },
|
2232
2975
|
queryParams: { gitBranch, fallbackBranch },
|
2233
2976
|
trace: defaultTrace
|
2234
2977
|
});
|
@@ -2246,15 +2989,17 @@ async function getDatabaseBranch(branch, options) {
|
|
2246
2989
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2247
2990
|
);
|
2248
2991
|
const [protocol, , host, , database] = databaseURL.split("/");
|
2249
|
-
const
|
2250
|
-
|
2992
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
2993
|
+
if (!urlParts)
|
2994
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
2995
|
+
const { workspace, region } = urlParts;
|
2251
2996
|
try {
|
2252
2997
|
return await getBranchDetails({
|
2253
2998
|
apiKey,
|
2254
2999
|
apiUrl: databaseURL,
|
2255
3000
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2256
3001
|
workspacesApiUrl: `${protocol}//${host}`,
|
2257
|
-
pathParams: { dbBranchName
|
3002
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
2258
3003
|
trace: defaultTrace
|
2259
3004
|
});
|
2260
3005
|
} catch (err) {
|
@@ -2345,8 +3090,8 @@ const buildClient = (plugins) => {
|
|
2345
3090
|
if (!databaseURL) {
|
2346
3091
|
throw new Error("Option databaseURL is required");
|
2347
3092
|
}
|
2348
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2349
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
|
3093
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
3094
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
2350
3095
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2351
3096
|
if (!branchValue)
|
2352
3097
|
throw new Error("Unable to resolve branch value");
|
@@ -2359,7 +3104,8 @@ const buildClient = (plugins) => {
|
|
2359
3104
|
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2360
3105
|
return databaseURL + newPath;
|
2361
3106
|
},
|
2362
|
-
trace
|
3107
|
+
trace,
|
3108
|
+
clientID
|
2363
3109
|
};
|
2364
3110
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2365
3111
|
if (__privateGet(this, _branch))
|
@@ -2471,5 +3217,5 @@ class XataError extends Error {
|
|
2471
3217
|
}
|
2472
3218
|
}
|
2473
3219
|
|
2474
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals,
|
3220
|
+
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, branchTransaction, 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 };
|
2475
3221
|
//# sourceMappingURL=index.mjs.map
|