@xata.io/client 0.0.0-alpha.vfbd878f → 0.0.0-alpha.vfc52d85
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 +104 -0
- package/README.md +28 -28
- package/Usage.md +2 -0
- package/dist/index.cjs +1497 -486
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4393 -1176
- package/dist/index.mjs +1469 -487
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
@@ -24,13 +24,11 @@ const defaultTrace = async (_name, fn, _options) => {
|
|
24
24
|
return await fn({
|
25
25
|
setAttributes: () => {
|
26
26
|
return;
|
27
|
-
},
|
28
|
-
onError: () => {
|
29
|
-
return;
|
30
27
|
}
|
31
28
|
});
|
32
29
|
};
|
33
30
|
const TraceAttributes = {
|
31
|
+
KIND: "xata.trace.kind",
|
34
32
|
VERSION: "xata.sdk.version",
|
35
33
|
TABLE: "xata.table",
|
36
34
|
HTTP_REQUEST_ID: "http.request_id",
|
@@ -62,6 +60,9 @@ function isString(value) {
|
|
62
60
|
function isStringArray(value) {
|
63
61
|
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
64
62
|
}
|
63
|
+
function isNumber(value) {
|
64
|
+
return isDefined(value) && typeof value === "number";
|
65
|
+
}
|
65
66
|
function toBase64(value) {
|
66
67
|
try {
|
67
68
|
return btoa(value);
|
@@ -70,6 +71,17 @@ function toBase64(value) {
|
|
70
71
|
return buf.from(value).toString("base64");
|
71
72
|
}
|
72
73
|
}
|
74
|
+
function deepMerge(a, b) {
|
75
|
+
const result = { ...a };
|
76
|
+
for (const [key, value] of Object.entries(b)) {
|
77
|
+
if (isObject(value) && isObject(result[key])) {
|
78
|
+
result[key] = deepMerge(result[key], value);
|
79
|
+
} else {
|
80
|
+
result[key] = value;
|
81
|
+
}
|
82
|
+
}
|
83
|
+
return result;
|
84
|
+
}
|
73
85
|
|
74
86
|
function getEnvironment() {
|
75
87
|
try {
|
@@ -174,7 +186,7 @@ function getFetchImplementation(userFetch) {
|
|
174
186
|
return fetchImpl;
|
175
187
|
}
|
176
188
|
|
177
|
-
const VERSION = "0.0.0-alpha.
|
189
|
+
const VERSION = "0.0.0-alpha.vfc52d85";
|
178
190
|
|
179
191
|
class ErrorWithCause extends Error {
|
180
192
|
constructor(message, options) {
|
@@ -225,18 +237,24 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
225
237
|
}, {});
|
226
238
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
227
239
|
const queryString = query.length > 0 ? `?${query}` : "";
|
228
|
-
|
240
|
+
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
241
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
|
242
|
+
}, {});
|
243
|
+
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
229
244
|
};
|
230
245
|
function buildBaseUrl({
|
246
|
+
endpoint,
|
231
247
|
path,
|
232
248
|
workspacesApiUrl,
|
233
249
|
apiUrl,
|
234
|
-
pathParams
|
250
|
+
pathParams = {}
|
235
251
|
}) {
|
236
|
-
if (
|
237
|
-
|
238
|
-
|
239
|
-
|
252
|
+
if (endpoint === "dataPlane") {
|
253
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
254
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
255
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
256
|
+
}
|
257
|
+
return `${apiUrl}${path}`;
|
240
258
|
}
|
241
259
|
function hostHeader(url) {
|
242
260
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -252,14 +270,18 @@ async function fetch$1({
|
|
252
270
|
queryParams,
|
253
271
|
fetchImpl,
|
254
272
|
apiKey,
|
273
|
+
endpoint,
|
255
274
|
apiUrl,
|
256
275
|
workspacesApiUrl,
|
257
|
-
trace
|
276
|
+
trace,
|
277
|
+
signal,
|
278
|
+
clientID,
|
279
|
+
sessionID
|
258
280
|
}) {
|
259
281
|
return trace(
|
260
282
|
`${method.toUpperCase()} ${path}`,
|
261
|
-
async ({ setAttributes
|
262
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
283
|
+
async ({ setAttributes }) => {
|
284
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
263
285
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
264
286
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
265
287
|
setAttributes({
|
@@ -272,10 +294,13 @@ async function fetch$1({
|
|
272
294
|
headers: {
|
273
295
|
"Content-Type": "application/json",
|
274
296
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
297
|
+
"X-Xata-Client-ID": clientID ?? "",
|
298
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
275
299
|
...headers,
|
276
300
|
...hostHeader(fullUrl),
|
277
301
|
Authorization: `Bearer ${apiKey}`
|
278
|
-
}
|
302
|
+
},
|
303
|
+
signal
|
279
304
|
});
|
280
305
|
if (response.status === 204) {
|
281
306
|
return {};
|
@@ -283,6 +308,7 @@ async function fetch$1({
|
|
283
308
|
const { host, protocol } = parseUrl(response.url);
|
284
309
|
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
285
310
|
setAttributes({
|
311
|
+
[TraceAttributes.KIND]: "http",
|
286
312
|
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
287
313
|
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
288
314
|
[TraceAttributes.HTTP_HOST]: host,
|
@@ -295,9 +321,7 @@ async function fetch$1({
|
|
295
321
|
}
|
296
322
|
throw new FetcherError(response.status, jsonResponse, requestId);
|
297
323
|
} catch (error) {
|
298
|
-
|
299
|
-
onError(fetcherError.message);
|
300
|
-
throw fetcherError;
|
324
|
+
throw new FetcherError(response.status, error, requestId);
|
301
325
|
}
|
302
326
|
},
|
303
327
|
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
@@ -312,245 +336,163 @@ function parseUrl(url) {
|
|
312
336
|
}
|
313
337
|
}
|
314
338
|
|
315
|
-
const
|
316
|
-
|
317
|
-
const
|
318
|
-
const
|
319
|
-
url: "/user/keys",
|
320
|
-
method: "get",
|
321
|
-
...variables
|
322
|
-
});
|
323
|
-
const createUserAPIKey = (variables) => fetch$1({
|
324
|
-
url: "/user/keys/{keyName}",
|
325
|
-
method: "post",
|
326
|
-
...variables
|
327
|
-
});
|
328
|
-
const deleteUserAPIKey = (variables) => fetch$1({
|
329
|
-
url: "/user/keys/{keyName}",
|
330
|
-
method: "delete",
|
331
|
-
...variables
|
332
|
-
});
|
333
|
-
const createWorkspace = (variables) => fetch$1({
|
334
|
-
url: "/workspaces",
|
335
|
-
method: "post",
|
336
|
-
...variables
|
337
|
-
});
|
338
|
-
const getWorkspacesList = (variables) => fetch$1({
|
339
|
-
url: "/workspaces",
|
340
|
-
method: "get",
|
341
|
-
...variables
|
342
|
-
});
|
343
|
-
const getWorkspace = (variables) => fetch$1({
|
344
|
-
url: "/workspaces/{workspaceId}",
|
345
|
-
method: "get",
|
346
|
-
...variables
|
347
|
-
});
|
348
|
-
const updateWorkspace = (variables) => fetch$1({
|
349
|
-
url: "/workspaces/{workspaceId}",
|
350
|
-
method: "put",
|
351
|
-
...variables
|
352
|
-
});
|
353
|
-
const deleteWorkspace = (variables) => fetch$1({
|
354
|
-
url: "/workspaces/{workspaceId}",
|
355
|
-
method: "delete",
|
356
|
-
...variables
|
357
|
-
});
|
358
|
-
const getWorkspaceMembersList = (variables) => fetch$1({
|
359
|
-
url: "/workspaces/{workspaceId}/members",
|
360
|
-
method: "get",
|
361
|
-
...variables
|
362
|
-
});
|
363
|
-
const updateWorkspaceMemberRole = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables });
|
364
|
-
const removeWorkspaceMember = (variables) => fetch$1({
|
365
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
366
|
-
method: "delete",
|
367
|
-
...variables
|
368
|
-
});
|
369
|
-
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
370
|
-
const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
371
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
372
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
373
|
-
method: "delete",
|
374
|
-
...variables
|
375
|
-
});
|
376
|
-
const resendWorkspaceMemberInvite = (variables) => fetch$1({
|
377
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
378
|
-
method: "post",
|
379
|
-
...variables
|
380
|
-
});
|
381
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
382
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
383
|
-
method: "post",
|
384
|
-
...variables
|
385
|
-
});
|
386
|
-
const getDatabaseList = (variables) => fetch$1({
|
387
|
-
url: "/dbs",
|
388
|
-
method: "get",
|
389
|
-
...variables
|
390
|
-
});
|
391
|
-
const getBranchList = (variables) => fetch$1({
|
392
|
-
url: "/dbs/{dbName}",
|
393
|
-
method: "get",
|
394
|
-
...variables
|
395
|
-
});
|
396
|
-
const createDatabase = (variables) => fetch$1({
|
397
|
-
url: "/dbs/{dbName}",
|
398
|
-
method: "put",
|
399
|
-
...variables
|
400
|
-
});
|
401
|
-
const deleteDatabase = (variables) => fetch$1({
|
339
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
340
|
+
|
341
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
342
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
402
343
|
url: "/dbs/{dbName}",
|
403
|
-
method: "delete",
|
404
|
-
...variables
|
405
|
-
});
|
406
|
-
const getDatabaseMetadata = (variables) => fetch$1({
|
407
|
-
url: "/dbs/{dbName}/metadata",
|
408
|
-
method: "get",
|
409
|
-
...variables
|
410
|
-
});
|
411
|
-
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
412
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
413
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
414
|
-
const resolveBranch = (variables) => fetch$1({
|
415
|
-
url: "/dbs/{dbName}/resolveBranch",
|
416
344
|
method: "get",
|
417
|
-
...variables
|
345
|
+
...variables,
|
346
|
+
signal
|
418
347
|
});
|
419
|
-
const
|
348
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
349
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
350
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
351
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
352
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
420
353
|
url: "/db/{dbBranchName}",
|
421
354
|
method: "get",
|
422
|
-
...variables
|
355
|
+
...variables,
|
356
|
+
signal
|
423
357
|
});
|
424
|
-
const createBranch = (variables) =>
|
425
|
-
const deleteBranch = (variables) =>
|
358
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
359
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
426
360
|
url: "/db/{dbBranchName}",
|
427
361
|
method: "delete",
|
428
|
-
...variables
|
362
|
+
...variables,
|
363
|
+
signal
|
429
364
|
});
|
430
|
-
const updateBranchMetadata = (variables) =>
|
365
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
431
366
|
url: "/db/{dbBranchName}/metadata",
|
432
367
|
method: "put",
|
433
|
-
...variables
|
368
|
+
...variables,
|
369
|
+
signal
|
434
370
|
});
|
435
|
-
const getBranchMetadata = (variables) =>
|
371
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
436
372
|
url: "/db/{dbBranchName}/metadata",
|
437
373
|
method: "get",
|
438
|
-
...variables
|
374
|
+
...variables,
|
375
|
+
signal
|
439
376
|
});
|
440
|
-
const
|
441
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
442
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
443
|
-
const getBranchStats = (variables) => fetch$1({
|
377
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
444
378
|
url: "/db/{dbBranchName}/stats",
|
445
379
|
method: "get",
|
446
|
-
...variables
|
380
|
+
...variables,
|
381
|
+
signal
|
382
|
+
});
|
383
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
384
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
385
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
386
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
387
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
388
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
389
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
390
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
391
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
392
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
393
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
394
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
395
|
+
method: "get",
|
396
|
+
...variables,
|
397
|
+
signal
|
398
|
+
});
|
399
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
400
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
401
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
402
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
403
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
404
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
405
|
+
method: "post",
|
406
|
+
...variables,
|
407
|
+
signal
|
447
408
|
});
|
448
|
-
const
|
409
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
410
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
411
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
412
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
413
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
414
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
415
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
449
416
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
450
417
|
method: "put",
|
451
|
-
...variables
|
418
|
+
...variables,
|
419
|
+
signal
|
452
420
|
});
|
453
|
-
const deleteTable = (variables) =>
|
421
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
454
422
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
455
423
|
method: "delete",
|
456
|
-
...variables
|
457
|
-
|
458
|
-
const updateTable = (variables) => fetch$1({
|
459
|
-
url: "/db/{dbBranchName}/tables/{tableName}",
|
460
|
-
method: "patch",
|
461
|
-
...variables
|
424
|
+
...variables,
|
425
|
+
signal
|
462
426
|
});
|
463
|
-
const
|
427
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
428
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
464
429
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
465
430
|
method: "get",
|
466
|
-
...variables
|
431
|
+
...variables,
|
432
|
+
signal
|
467
433
|
});
|
468
|
-
const setTableSchema = (variables) =>
|
469
|
-
|
470
|
-
method: "put",
|
471
|
-
...variables
|
472
|
-
});
|
473
|
-
const getTableColumns = (variables) => fetch$1({
|
434
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
435
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
474
436
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
475
437
|
method: "get",
|
476
|
-
...variables
|
438
|
+
...variables,
|
439
|
+
signal
|
477
440
|
});
|
478
|
-
const addTableColumn = (variables) =>
|
479
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
480
|
-
|
481
|
-
|
482
|
-
});
|
483
|
-
const getColumn = (variables) => fetch$1({
|
441
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
442
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
443
|
+
);
|
444
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
484
445
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
485
446
|
method: "get",
|
486
|
-
...variables
|
487
|
-
|
488
|
-
const deleteColumn = (variables) => fetch$1({
|
489
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
490
|
-
method: "delete",
|
491
|
-
...variables
|
447
|
+
...variables,
|
448
|
+
signal
|
492
449
|
});
|
493
|
-
const updateColumn = (variables) =>
|
450
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
451
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
494
452
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
495
|
-
method: "patch",
|
496
|
-
...variables
|
497
|
-
});
|
498
|
-
const insertRecord = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables });
|
499
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
500
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
501
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
502
|
-
const deleteRecord = (variables) => fetch$1({
|
503
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
504
453
|
method: "delete",
|
505
|
-
...variables
|
454
|
+
...variables,
|
455
|
+
signal
|
506
456
|
});
|
507
|
-
const
|
457
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
458
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
508
459
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
509
460
|
method: "get",
|
510
|
-
...variables
|
461
|
+
...variables,
|
462
|
+
signal
|
511
463
|
});
|
512
|
-
const
|
513
|
-
const
|
464
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
465
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
466
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
467
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
468
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
469
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
514
470
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
515
471
|
method: "post",
|
516
|
-
...variables
|
472
|
+
...variables,
|
473
|
+
signal
|
517
474
|
});
|
518
|
-
const
|
519
|
-
url: "/db/{dbBranchName}/
|
475
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
476
|
+
url: "/db/{dbBranchName}/search",
|
520
477
|
method: "post",
|
521
|
-
...variables
|
478
|
+
...variables,
|
479
|
+
signal
|
522
480
|
});
|
523
|
-
const
|
524
|
-
url: "/db/{dbBranchName}/search",
|
481
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
482
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
525
483
|
method: "post",
|
526
|
-
...variables
|
484
|
+
...variables,
|
485
|
+
signal
|
527
486
|
});
|
528
|
-
const
|
529
|
-
|
530
|
-
|
531
|
-
createWorkspace,
|
532
|
-
getWorkspacesList,
|
533
|
-
getWorkspace,
|
534
|
-
updateWorkspace,
|
535
|
-
deleteWorkspace,
|
536
|
-
getWorkspaceMembersList,
|
537
|
-
updateWorkspaceMemberRole,
|
538
|
-
removeWorkspaceMember,
|
539
|
-
inviteWorkspaceMember,
|
540
|
-
updateWorkspaceMemberInvite,
|
541
|
-
cancelWorkspaceMemberInvite,
|
542
|
-
resendWorkspaceMemberInvite,
|
543
|
-
acceptWorkspaceMemberInvite
|
544
|
-
},
|
487
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
488
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
489
|
+
const operationsByTag$2 = {
|
545
490
|
database: {
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
addGitBranchesEntry,
|
552
|
-
removeGitBranchesEntry,
|
553
|
-
resolveBranch
|
491
|
+
dEPRECATEDgetDatabaseList,
|
492
|
+
dEPRECATEDcreateDatabase,
|
493
|
+
dEPRECATEDdeleteDatabase,
|
494
|
+
dEPRECATEDgetDatabaseMetadata,
|
495
|
+
dEPRECATEDupdateDatabaseMetadata
|
554
496
|
},
|
555
497
|
branch: {
|
556
498
|
getBranchList,
|
@@ -559,10 +501,42 @@ const operationsByTag = {
|
|
559
501
|
deleteBranch,
|
560
502
|
updateBranchMetadata,
|
561
503
|
getBranchMetadata,
|
504
|
+
getBranchStats,
|
505
|
+
getGitBranchesMapping,
|
506
|
+
addGitBranchesEntry,
|
507
|
+
removeGitBranchesEntry,
|
508
|
+
resolveBranch
|
509
|
+
},
|
510
|
+
migrations: {
|
562
511
|
getBranchMigrationHistory,
|
563
|
-
executeBranchMigrationPlan,
|
564
512
|
getBranchMigrationPlan,
|
565
|
-
|
513
|
+
executeBranchMigrationPlan,
|
514
|
+
getBranchSchemaHistory,
|
515
|
+
compareBranchWithUserSchema,
|
516
|
+
compareBranchSchemas,
|
517
|
+
updateBranchSchema,
|
518
|
+
previewBranchSchemaEdit,
|
519
|
+
applyBranchSchemaEdit
|
520
|
+
},
|
521
|
+
records: {
|
522
|
+
branchTransaction,
|
523
|
+
insertRecord,
|
524
|
+
getRecord,
|
525
|
+
insertRecordWithID,
|
526
|
+
updateRecordWithID,
|
527
|
+
upsertRecordWithID,
|
528
|
+
deleteRecord,
|
529
|
+
bulkInsertTableRecords
|
530
|
+
},
|
531
|
+
migrationRequests: {
|
532
|
+
queryMigrationRequests,
|
533
|
+
createMigrationRequest,
|
534
|
+
getMigrationRequest,
|
535
|
+
updateMigrationRequest,
|
536
|
+
listMigrationRequestsCommits,
|
537
|
+
compareMigrationRequest,
|
538
|
+
getMigrationRequestIsMerged,
|
539
|
+
mergeMigrationRequest
|
566
540
|
},
|
567
541
|
table: {
|
568
542
|
createTable,
|
@@ -573,23 +547,146 @@ const operationsByTag = {
|
|
573
547
|
getTableColumns,
|
574
548
|
addTableColumn,
|
575
549
|
getColumn,
|
576
|
-
|
577
|
-
|
550
|
+
updateColumn,
|
551
|
+
deleteColumn
|
578
552
|
},
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
553
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
554
|
+
};
|
555
|
+
|
556
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
557
|
+
|
558
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
559
|
+
url: "/user",
|
560
|
+
method: "get",
|
561
|
+
...variables,
|
562
|
+
signal
|
563
|
+
});
|
564
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
565
|
+
url: "/user",
|
566
|
+
method: "put",
|
567
|
+
...variables,
|
568
|
+
signal
|
569
|
+
});
|
570
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
571
|
+
url: "/user",
|
572
|
+
method: "delete",
|
573
|
+
...variables,
|
574
|
+
signal
|
575
|
+
});
|
576
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
577
|
+
url: "/user/keys",
|
578
|
+
method: "get",
|
579
|
+
...variables,
|
580
|
+
signal
|
581
|
+
});
|
582
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
583
|
+
url: "/user/keys/{keyName}",
|
584
|
+
method: "post",
|
585
|
+
...variables,
|
586
|
+
signal
|
587
|
+
});
|
588
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
589
|
+
url: "/user/keys/{keyName}",
|
590
|
+
method: "delete",
|
591
|
+
...variables,
|
592
|
+
signal
|
593
|
+
});
|
594
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
595
|
+
url: "/workspaces",
|
596
|
+
method: "get",
|
597
|
+
...variables,
|
598
|
+
signal
|
599
|
+
});
|
600
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
601
|
+
url: "/workspaces",
|
602
|
+
method: "post",
|
603
|
+
...variables,
|
604
|
+
signal
|
605
|
+
});
|
606
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
607
|
+
url: "/workspaces/{workspaceId}",
|
608
|
+
method: "get",
|
609
|
+
...variables,
|
610
|
+
signal
|
611
|
+
});
|
612
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
613
|
+
url: "/workspaces/{workspaceId}",
|
614
|
+
method: "put",
|
615
|
+
...variables,
|
616
|
+
signal
|
617
|
+
});
|
618
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
619
|
+
url: "/workspaces/{workspaceId}",
|
620
|
+
method: "delete",
|
621
|
+
...variables,
|
622
|
+
signal
|
623
|
+
});
|
624
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
625
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
626
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
627
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
628
|
+
method: "delete",
|
629
|
+
...variables,
|
630
|
+
signal
|
631
|
+
});
|
632
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
633
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
634
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
635
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
636
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
637
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
638
|
+
url: "/workspaces/{workspaceId}/dbs",
|
639
|
+
method: "get",
|
640
|
+
...variables,
|
641
|
+
signal
|
642
|
+
});
|
643
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
644
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
645
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
646
|
+
method: "delete",
|
647
|
+
...variables,
|
648
|
+
signal
|
649
|
+
});
|
650
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
651
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
652
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
653
|
+
url: "/workspaces/{workspaceId}/regions",
|
654
|
+
method: "get",
|
655
|
+
...variables,
|
656
|
+
signal
|
657
|
+
});
|
658
|
+
const operationsByTag$1 = {
|
659
|
+
users: { getUser, updateUser, deleteUser },
|
660
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
661
|
+
workspaces: {
|
662
|
+
getWorkspacesList,
|
663
|
+
createWorkspace,
|
664
|
+
getWorkspace,
|
665
|
+
updateWorkspace,
|
666
|
+
deleteWorkspace,
|
667
|
+
getWorkspaceMembersList,
|
668
|
+
updateWorkspaceMemberRole,
|
669
|
+
removeWorkspaceMember
|
670
|
+
},
|
671
|
+
invites: {
|
672
|
+
inviteWorkspaceMember,
|
673
|
+
updateWorkspaceMemberInvite,
|
674
|
+
cancelWorkspaceMemberInvite,
|
675
|
+
acceptWorkspaceMemberInvite,
|
676
|
+
resendWorkspaceMemberInvite
|
677
|
+
},
|
678
|
+
databases: {
|
679
|
+
getDatabaseList,
|
680
|
+
createDatabase,
|
681
|
+
deleteDatabase,
|
682
|
+
getDatabaseMetadata,
|
683
|
+
updateDatabaseMetadata,
|
684
|
+
listRegions
|
590
685
|
}
|
591
686
|
};
|
592
687
|
|
688
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
689
|
+
|
593
690
|
function getHostUrl(provider, type) {
|
594
691
|
if (isHostProviderAlias(provider)) {
|
595
692
|
return providers[provider][type];
|
@@ -601,11 +698,11 @@ function getHostUrl(provider, type) {
|
|
601
698
|
const providers = {
|
602
699
|
production: {
|
603
700
|
main: "https://api.xata.io",
|
604
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
701
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
605
702
|
},
|
606
703
|
staging: {
|
607
704
|
main: "https://staging.xatabase.co",
|
608
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
705
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
609
706
|
}
|
610
707
|
};
|
611
708
|
function isHostProviderAlias(alias) {
|
@@ -614,6 +711,25 @@ function isHostProviderAlias(alias) {
|
|
614
711
|
function isHostProviderBuilder(builder) {
|
615
712
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
616
713
|
}
|
714
|
+
function parseProviderString(provider = "production") {
|
715
|
+
if (isHostProviderAlias(provider)) {
|
716
|
+
return provider;
|
717
|
+
}
|
718
|
+
const [main, workspaces] = provider.split(",");
|
719
|
+
if (!main || !workspaces)
|
720
|
+
return null;
|
721
|
+
return { main, workspaces };
|
722
|
+
}
|
723
|
+
function parseWorkspacesUrlParts(url) {
|
724
|
+
if (!isString(url))
|
725
|
+
return null;
|
726
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
727
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
728
|
+
const match = url.match(regex) || url.match(regexStaging);
|
729
|
+
if (!match)
|
730
|
+
return null;
|
731
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
732
|
+
}
|
617
733
|
|
618
734
|
var __accessCheck$7 = (obj, member, msg) => {
|
619
735
|
if (!member.has(obj))
|
@@ -657,21 +773,41 @@ class XataApiClient {
|
|
657
773
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
658
774
|
return __privateGet$7(this, _namespaces).user;
|
659
775
|
}
|
776
|
+
get authentication() {
|
777
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
778
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
779
|
+
return __privateGet$7(this, _namespaces).authentication;
|
780
|
+
}
|
660
781
|
get workspaces() {
|
661
782
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
662
783
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
663
784
|
return __privateGet$7(this, _namespaces).workspaces;
|
664
785
|
}
|
665
|
-
get
|
666
|
-
if (!__privateGet$7(this, _namespaces).
|
667
|
-
__privateGet$7(this, _namespaces).
|
668
|
-
return __privateGet$7(this, _namespaces).
|
786
|
+
get invites() {
|
787
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
788
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
789
|
+
return __privateGet$7(this, _namespaces).invites;
|
790
|
+
}
|
791
|
+
get database() {
|
792
|
+
if (!__privateGet$7(this, _namespaces).database)
|
793
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
794
|
+
return __privateGet$7(this, _namespaces).database;
|
669
795
|
}
|
670
796
|
get branches() {
|
671
797
|
if (!__privateGet$7(this, _namespaces).branches)
|
672
798
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
673
799
|
return __privateGet$7(this, _namespaces).branches;
|
674
800
|
}
|
801
|
+
get migrations() {
|
802
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
803
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
804
|
+
return __privateGet$7(this, _namespaces).migrations;
|
805
|
+
}
|
806
|
+
get migrationRequests() {
|
807
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
808
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
809
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
810
|
+
}
|
675
811
|
get tables() {
|
676
812
|
if (!__privateGet$7(this, _namespaces).tables)
|
677
813
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -682,6 +818,11 @@ class XataApiClient {
|
|
682
818
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
683
819
|
return __privateGet$7(this, _namespaces).records;
|
684
820
|
}
|
821
|
+
get searchAndFilter() {
|
822
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
823
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
824
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
825
|
+
}
|
685
826
|
}
|
686
827
|
_extraProps = new WeakMap();
|
687
828
|
_namespaces = new WeakMap();
|
@@ -692,24 +833,29 @@ class UserApi {
|
|
692
833
|
getUser() {
|
693
834
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
694
835
|
}
|
695
|
-
updateUser(user) {
|
836
|
+
updateUser({ user }) {
|
696
837
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
697
838
|
}
|
698
839
|
deleteUser() {
|
699
840
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
700
841
|
}
|
842
|
+
}
|
843
|
+
class AuthenticationApi {
|
844
|
+
constructor(extraProps) {
|
845
|
+
this.extraProps = extraProps;
|
846
|
+
}
|
701
847
|
getUserAPIKeys() {
|
702
|
-
return operationsByTag.
|
848
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
703
849
|
}
|
704
|
-
createUserAPIKey(
|
705
|
-
return operationsByTag.
|
706
|
-
pathParams: { keyName },
|
850
|
+
createUserAPIKey({ name }) {
|
851
|
+
return operationsByTag.authentication.createUserAPIKey({
|
852
|
+
pathParams: { keyName: name },
|
707
853
|
...this.extraProps
|
708
854
|
});
|
709
855
|
}
|
710
|
-
deleteUserAPIKey(
|
711
|
-
return operationsByTag.
|
712
|
-
pathParams: { keyName },
|
856
|
+
deleteUserAPIKey({ name }) {
|
857
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
858
|
+
pathParams: { keyName: name },
|
713
859
|
...this.extraProps
|
714
860
|
});
|
715
861
|
}
|
@@ -718,139 +864,114 @@ class WorkspaceApi {
|
|
718
864
|
constructor(extraProps) {
|
719
865
|
this.extraProps = extraProps;
|
720
866
|
}
|
721
|
-
|
867
|
+
getWorkspacesList() {
|
868
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
869
|
+
}
|
870
|
+
createWorkspace({ data }) {
|
722
871
|
return operationsByTag.workspaces.createWorkspace({
|
723
|
-
body:
|
872
|
+
body: data,
|
724
873
|
...this.extraProps
|
725
874
|
});
|
726
875
|
}
|
727
|
-
|
728
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
729
|
-
}
|
730
|
-
getWorkspace(workspaceId) {
|
876
|
+
getWorkspace({ workspace }) {
|
731
877
|
return operationsByTag.workspaces.getWorkspace({
|
732
|
-
pathParams: { workspaceId },
|
878
|
+
pathParams: { workspaceId: workspace },
|
733
879
|
...this.extraProps
|
734
880
|
});
|
735
881
|
}
|
736
|
-
updateWorkspace(
|
882
|
+
updateWorkspace({
|
883
|
+
workspace,
|
884
|
+
update
|
885
|
+
}) {
|
737
886
|
return operationsByTag.workspaces.updateWorkspace({
|
738
|
-
pathParams: { workspaceId },
|
739
|
-
body:
|
887
|
+
pathParams: { workspaceId: workspace },
|
888
|
+
body: update,
|
740
889
|
...this.extraProps
|
741
890
|
});
|
742
891
|
}
|
743
|
-
deleteWorkspace(
|
892
|
+
deleteWorkspace({ workspace }) {
|
744
893
|
return operationsByTag.workspaces.deleteWorkspace({
|
745
|
-
pathParams: { workspaceId },
|
894
|
+
pathParams: { workspaceId: workspace },
|
746
895
|
...this.extraProps
|
747
896
|
});
|
748
897
|
}
|
749
|
-
getWorkspaceMembersList(
|
898
|
+
getWorkspaceMembersList({ workspace }) {
|
750
899
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
751
|
-
pathParams: { workspaceId },
|
900
|
+
pathParams: { workspaceId: workspace },
|
752
901
|
...this.extraProps
|
753
902
|
});
|
754
903
|
}
|
755
|
-
updateWorkspaceMemberRole(
|
904
|
+
updateWorkspaceMemberRole({
|
905
|
+
workspace,
|
906
|
+
user,
|
907
|
+
role
|
908
|
+
}) {
|
756
909
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
757
|
-
pathParams: { workspaceId, userId },
|
910
|
+
pathParams: { workspaceId: workspace, userId: user },
|
758
911
|
body: { role },
|
759
912
|
...this.extraProps
|
760
913
|
});
|
761
914
|
}
|
762
|
-
removeWorkspaceMember(
|
915
|
+
removeWorkspaceMember({
|
916
|
+
workspace,
|
917
|
+
user
|
918
|
+
}) {
|
763
919
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
764
|
-
pathParams: { workspaceId, userId },
|
765
|
-
...this.extraProps
|
766
|
-
});
|
767
|
-
}
|
768
|
-
inviteWorkspaceMember(workspaceId, email, role) {
|
769
|
-
return operationsByTag.workspaces.inviteWorkspaceMember({
|
770
|
-
pathParams: { workspaceId },
|
771
|
-
body: { email, role },
|
772
|
-
...this.extraProps
|
773
|
-
});
|
774
|
-
}
|
775
|
-
updateWorkspaceMemberInvite(workspaceId, inviteId, role) {
|
776
|
-
return operationsByTag.workspaces.updateWorkspaceMemberInvite({
|
777
|
-
pathParams: { workspaceId, inviteId },
|
778
|
-
body: { role },
|
779
|
-
...this.extraProps
|
780
|
-
});
|
781
|
-
}
|
782
|
-
cancelWorkspaceMemberInvite(workspaceId, inviteId) {
|
783
|
-
return operationsByTag.workspaces.cancelWorkspaceMemberInvite({
|
784
|
-
pathParams: { workspaceId, inviteId },
|
785
|
-
...this.extraProps
|
786
|
-
});
|
787
|
-
}
|
788
|
-
resendWorkspaceMemberInvite(workspaceId, inviteId) {
|
789
|
-
return operationsByTag.workspaces.resendWorkspaceMemberInvite({
|
790
|
-
pathParams: { workspaceId, inviteId },
|
791
|
-
...this.extraProps
|
792
|
-
});
|
793
|
-
}
|
794
|
-
acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
|
795
|
-
return operationsByTag.workspaces.acceptWorkspaceMemberInvite({
|
796
|
-
pathParams: { workspaceId, inviteKey },
|
920
|
+
pathParams: { workspaceId: workspace, userId: user },
|
797
921
|
...this.extraProps
|
798
922
|
});
|
799
923
|
}
|
800
924
|
}
|
801
|
-
class
|
925
|
+
class InvitesApi {
|
802
926
|
constructor(extraProps) {
|
803
927
|
this.extraProps = extraProps;
|
804
928
|
}
|
805
|
-
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
811
|
-
|
812
|
-
|
813
|
-
pathParams: { workspace, dbName },
|
814
|
-
body: options,
|
815
|
-
...this.extraProps
|
816
|
-
});
|
817
|
-
}
|
818
|
-
deleteDatabase(workspace, dbName) {
|
819
|
-
return operationsByTag.database.deleteDatabase({
|
820
|
-
pathParams: { workspace, dbName },
|
821
|
-
...this.extraProps
|
822
|
-
});
|
823
|
-
}
|
824
|
-
getDatabaseMetadata(workspace, dbName) {
|
825
|
-
return operationsByTag.database.getDatabaseMetadata({
|
826
|
-
pathParams: { workspace, dbName },
|
929
|
+
inviteWorkspaceMember({
|
930
|
+
workspace,
|
931
|
+
email,
|
932
|
+
role
|
933
|
+
}) {
|
934
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
935
|
+
pathParams: { workspaceId: workspace },
|
936
|
+
body: { email, role },
|
827
937
|
...this.extraProps
|
828
938
|
});
|
829
939
|
}
|
830
|
-
|
831
|
-
|
832
|
-
|
940
|
+
updateWorkspaceMemberInvite({
|
941
|
+
workspace,
|
942
|
+
invite,
|
943
|
+
role
|
944
|
+
}) {
|
945
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
946
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
947
|
+
body: { role },
|
833
948
|
...this.extraProps
|
834
949
|
});
|
835
950
|
}
|
836
|
-
|
837
|
-
|
838
|
-
|
839
|
-
|
951
|
+
cancelWorkspaceMemberInvite({
|
952
|
+
workspace,
|
953
|
+
invite
|
954
|
+
}) {
|
955
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
956
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
840
957
|
...this.extraProps
|
841
958
|
});
|
842
959
|
}
|
843
|
-
|
844
|
-
|
845
|
-
|
846
|
-
|
960
|
+
acceptWorkspaceMemberInvite({
|
961
|
+
workspace,
|
962
|
+
key
|
963
|
+
}) {
|
964
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
965
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
847
966
|
...this.extraProps
|
848
967
|
});
|
849
968
|
}
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
969
|
+
resendWorkspaceMemberInvite({
|
970
|
+
workspace,
|
971
|
+
invite
|
972
|
+
}) {
|
973
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
974
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
854
975
|
...this.extraProps
|
855
976
|
});
|
856
977
|
}
|
@@ -859,69 +980,132 @@ class BranchApi {
|
|
859
980
|
constructor(extraProps) {
|
860
981
|
this.extraProps = extraProps;
|
861
982
|
}
|
862
|
-
getBranchList(
|
983
|
+
getBranchList({
|
984
|
+
workspace,
|
985
|
+
region,
|
986
|
+
database
|
987
|
+
}) {
|
863
988
|
return operationsByTag.branch.getBranchList({
|
864
|
-
pathParams: { workspace, dbName },
|
989
|
+
pathParams: { workspace, region, dbName: database },
|
865
990
|
...this.extraProps
|
866
991
|
});
|
867
992
|
}
|
868
|
-
getBranchDetails(
|
993
|
+
getBranchDetails({
|
994
|
+
workspace,
|
995
|
+
region,
|
996
|
+
database,
|
997
|
+
branch
|
998
|
+
}) {
|
869
999
|
return operationsByTag.branch.getBranchDetails({
|
870
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1000
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
871
1001
|
...this.extraProps
|
872
1002
|
});
|
873
1003
|
}
|
874
|
-
createBranch(
|
1004
|
+
createBranch({
|
1005
|
+
workspace,
|
1006
|
+
region,
|
1007
|
+
database,
|
1008
|
+
branch,
|
1009
|
+
from,
|
1010
|
+
metadata
|
1011
|
+
}) {
|
875
1012
|
return operationsByTag.branch.createBranch({
|
876
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
877
|
-
|
878
|
-
body: options,
|
1013
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1014
|
+
body: { from, metadata },
|
879
1015
|
...this.extraProps
|
880
1016
|
});
|
881
1017
|
}
|
882
|
-
deleteBranch(
|
1018
|
+
deleteBranch({
|
1019
|
+
workspace,
|
1020
|
+
region,
|
1021
|
+
database,
|
1022
|
+
branch
|
1023
|
+
}) {
|
883
1024
|
return operationsByTag.branch.deleteBranch({
|
884
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1025
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
885
1026
|
...this.extraProps
|
886
1027
|
});
|
887
1028
|
}
|
888
|
-
updateBranchMetadata(
|
1029
|
+
updateBranchMetadata({
|
1030
|
+
workspace,
|
1031
|
+
region,
|
1032
|
+
database,
|
1033
|
+
branch,
|
1034
|
+
metadata
|
1035
|
+
}) {
|
889
1036
|
return operationsByTag.branch.updateBranchMetadata({
|
890
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1037
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
891
1038
|
body: metadata,
|
892
1039
|
...this.extraProps
|
893
1040
|
});
|
894
1041
|
}
|
895
|
-
getBranchMetadata(
|
1042
|
+
getBranchMetadata({
|
1043
|
+
workspace,
|
1044
|
+
region,
|
1045
|
+
database,
|
1046
|
+
branch
|
1047
|
+
}) {
|
896
1048
|
return operationsByTag.branch.getBranchMetadata({
|
897
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1049
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
898
1050
|
...this.extraProps
|
899
1051
|
});
|
900
1052
|
}
|
901
|
-
|
902
|
-
|
903
|
-
|
904
|
-
|
1053
|
+
getBranchStats({
|
1054
|
+
workspace,
|
1055
|
+
region,
|
1056
|
+
database,
|
1057
|
+
branch
|
1058
|
+
}) {
|
1059
|
+
return operationsByTag.branch.getBranchStats({
|
1060
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
905
1061
|
...this.extraProps
|
906
1062
|
});
|
907
1063
|
}
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
1064
|
+
getGitBranchesMapping({
|
1065
|
+
workspace,
|
1066
|
+
region,
|
1067
|
+
database
|
1068
|
+
}) {
|
1069
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1070
|
+
pathParams: { workspace, region, dbName: database },
|
912
1071
|
...this.extraProps
|
913
1072
|
});
|
914
1073
|
}
|
915
|
-
|
916
|
-
|
917
|
-
|
918
|
-
|
1074
|
+
addGitBranchesEntry({
|
1075
|
+
workspace,
|
1076
|
+
region,
|
1077
|
+
database,
|
1078
|
+
gitBranch,
|
1079
|
+
xataBranch
|
1080
|
+
}) {
|
1081
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1082
|
+
pathParams: { workspace, region, dbName: database },
|
1083
|
+
body: { gitBranch, xataBranch },
|
919
1084
|
...this.extraProps
|
920
1085
|
});
|
921
1086
|
}
|
922
|
-
|
923
|
-
|
924
|
-
|
1087
|
+
removeGitBranchesEntry({
|
1088
|
+
workspace,
|
1089
|
+
region,
|
1090
|
+
database,
|
1091
|
+
gitBranch
|
1092
|
+
}) {
|
1093
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1094
|
+
pathParams: { workspace, region, dbName: database },
|
1095
|
+
queryParams: { gitBranch },
|
1096
|
+
...this.extraProps
|
1097
|
+
});
|
1098
|
+
}
|
1099
|
+
resolveBranch({
|
1100
|
+
workspace,
|
1101
|
+
region,
|
1102
|
+
database,
|
1103
|
+
gitBranch,
|
1104
|
+
fallbackBranch
|
1105
|
+
}) {
|
1106
|
+
return operationsByTag.branch.resolveBranch({
|
1107
|
+
pathParams: { workspace, region, dbName: database },
|
1108
|
+
queryParams: { gitBranch, fallbackBranch },
|
925
1109
|
...this.extraProps
|
926
1110
|
});
|
927
1111
|
}
|
@@ -930,67 +1114,134 @@ class TableApi {
|
|
930
1114
|
constructor(extraProps) {
|
931
1115
|
this.extraProps = extraProps;
|
932
1116
|
}
|
933
|
-
createTable(
|
1117
|
+
createTable({
|
1118
|
+
workspace,
|
1119
|
+
region,
|
1120
|
+
database,
|
1121
|
+
branch,
|
1122
|
+
table
|
1123
|
+
}) {
|
934
1124
|
return operationsByTag.table.createTable({
|
935
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1125
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
936
1126
|
...this.extraProps
|
937
1127
|
});
|
938
1128
|
}
|
939
|
-
deleteTable(
|
1129
|
+
deleteTable({
|
1130
|
+
workspace,
|
1131
|
+
region,
|
1132
|
+
database,
|
1133
|
+
branch,
|
1134
|
+
table
|
1135
|
+
}) {
|
940
1136
|
return operationsByTag.table.deleteTable({
|
941
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1137
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
942
1138
|
...this.extraProps
|
943
1139
|
});
|
944
1140
|
}
|
945
|
-
updateTable(
|
1141
|
+
updateTable({
|
1142
|
+
workspace,
|
1143
|
+
region,
|
1144
|
+
database,
|
1145
|
+
branch,
|
1146
|
+
table,
|
1147
|
+
update
|
1148
|
+
}) {
|
946
1149
|
return operationsByTag.table.updateTable({
|
947
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
948
|
-
body:
|
1150
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1151
|
+
body: update,
|
949
1152
|
...this.extraProps
|
950
1153
|
});
|
951
1154
|
}
|
952
|
-
getTableSchema(
|
1155
|
+
getTableSchema({
|
1156
|
+
workspace,
|
1157
|
+
region,
|
1158
|
+
database,
|
1159
|
+
branch,
|
1160
|
+
table
|
1161
|
+
}) {
|
953
1162
|
return operationsByTag.table.getTableSchema({
|
954
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1163
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
955
1164
|
...this.extraProps
|
956
1165
|
});
|
957
1166
|
}
|
958
|
-
setTableSchema(
|
1167
|
+
setTableSchema({
|
1168
|
+
workspace,
|
1169
|
+
region,
|
1170
|
+
database,
|
1171
|
+
branch,
|
1172
|
+
table,
|
1173
|
+
schema
|
1174
|
+
}) {
|
959
1175
|
return operationsByTag.table.setTableSchema({
|
960
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
961
|
-
body:
|
1176
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1177
|
+
body: schema,
|
962
1178
|
...this.extraProps
|
963
1179
|
});
|
964
1180
|
}
|
965
|
-
getTableColumns(
|
1181
|
+
getTableColumns({
|
1182
|
+
workspace,
|
1183
|
+
region,
|
1184
|
+
database,
|
1185
|
+
branch,
|
1186
|
+
table
|
1187
|
+
}) {
|
966
1188
|
return operationsByTag.table.getTableColumns({
|
967
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1189
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
968
1190
|
...this.extraProps
|
969
1191
|
});
|
970
1192
|
}
|
971
|
-
addTableColumn(
|
1193
|
+
addTableColumn({
|
1194
|
+
workspace,
|
1195
|
+
region,
|
1196
|
+
database,
|
1197
|
+
branch,
|
1198
|
+
table,
|
1199
|
+
column
|
1200
|
+
}) {
|
972
1201
|
return operationsByTag.table.addTableColumn({
|
973
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1202
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
974
1203
|
body: column,
|
975
1204
|
...this.extraProps
|
976
1205
|
});
|
977
1206
|
}
|
978
|
-
getColumn(
|
1207
|
+
getColumn({
|
1208
|
+
workspace,
|
1209
|
+
region,
|
1210
|
+
database,
|
1211
|
+
branch,
|
1212
|
+
table,
|
1213
|
+
column
|
1214
|
+
}) {
|
979
1215
|
return operationsByTag.table.getColumn({
|
980
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1216
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
981
1217
|
...this.extraProps
|
982
1218
|
});
|
983
1219
|
}
|
984
|
-
|
985
|
-
|
986
|
-
|
1220
|
+
updateColumn({
|
1221
|
+
workspace,
|
1222
|
+
region,
|
1223
|
+
database,
|
1224
|
+
branch,
|
1225
|
+
table,
|
1226
|
+
column,
|
1227
|
+
update
|
1228
|
+
}) {
|
1229
|
+
return operationsByTag.table.updateColumn({
|
1230
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1231
|
+
body: update,
|
987
1232
|
...this.extraProps
|
988
1233
|
});
|
989
1234
|
}
|
990
|
-
|
991
|
-
|
992
|
-
|
993
|
-
|
1235
|
+
deleteColumn({
|
1236
|
+
workspace,
|
1237
|
+
region,
|
1238
|
+
database,
|
1239
|
+
branch,
|
1240
|
+
table,
|
1241
|
+
column
|
1242
|
+
}) {
|
1243
|
+
return operationsByTag.table.deleteColumn({
|
1244
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
994
1245
|
...this.extraProps
|
995
1246
|
});
|
996
1247
|
}
|
@@ -999,78 +1250,509 @@ class RecordsApi {
|
|
999
1250
|
constructor(extraProps) {
|
1000
1251
|
this.extraProps = extraProps;
|
1001
1252
|
}
|
1002
|
-
insertRecord(
|
1253
|
+
insertRecord({
|
1254
|
+
workspace,
|
1255
|
+
region,
|
1256
|
+
database,
|
1257
|
+
branch,
|
1258
|
+
table,
|
1259
|
+
record,
|
1260
|
+
columns
|
1261
|
+
}) {
|
1003
1262
|
return operationsByTag.records.insertRecord({
|
1004
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1005
|
-
queryParams:
|
1263
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1264
|
+
queryParams: { columns },
|
1006
1265
|
body: record,
|
1007
1266
|
...this.extraProps
|
1008
1267
|
});
|
1009
1268
|
}
|
1010
|
-
|
1269
|
+
getRecord({
|
1270
|
+
workspace,
|
1271
|
+
region,
|
1272
|
+
database,
|
1273
|
+
branch,
|
1274
|
+
table,
|
1275
|
+
id,
|
1276
|
+
columns
|
1277
|
+
}) {
|
1278
|
+
return operationsByTag.records.getRecord({
|
1279
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1280
|
+
queryParams: { columns },
|
1281
|
+
...this.extraProps
|
1282
|
+
});
|
1283
|
+
}
|
1284
|
+
insertRecordWithID({
|
1285
|
+
workspace,
|
1286
|
+
region,
|
1287
|
+
database,
|
1288
|
+
branch,
|
1289
|
+
table,
|
1290
|
+
id,
|
1291
|
+
record,
|
1292
|
+
columns,
|
1293
|
+
createOnly,
|
1294
|
+
ifVersion
|
1295
|
+
}) {
|
1011
1296
|
return operationsByTag.records.insertRecordWithID({
|
1012
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1013
|
-
queryParams:
|
1297
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1298
|
+
queryParams: { columns, createOnly, ifVersion },
|
1014
1299
|
body: record,
|
1015
1300
|
...this.extraProps
|
1016
1301
|
});
|
1017
1302
|
}
|
1018
|
-
updateRecordWithID(
|
1303
|
+
updateRecordWithID({
|
1304
|
+
workspace,
|
1305
|
+
region,
|
1306
|
+
database,
|
1307
|
+
branch,
|
1308
|
+
table,
|
1309
|
+
id,
|
1310
|
+
record,
|
1311
|
+
columns,
|
1312
|
+
ifVersion
|
1313
|
+
}) {
|
1019
1314
|
return operationsByTag.records.updateRecordWithID({
|
1020
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1021
|
-
queryParams:
|
1315
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1316
|
+
queryParams: { columns, ifVersion },
|
1022
1317
|
body: record,
|
1023
1318
|
...this.extraProps
|
1024
1319
|
});
|
1025
1320
|
}
|
1026
|
-
upsertRecordWithID(
|
1321
|
+
upsertRecordWithID({
|
1322
|
+
workspace,
|
1323
|
+
region,
|
1324
|
+
database,
|
1325
|
+
branch,
|
1326
|
+
table,
|
1327
|
+
id,
|
1328
|
+
record,
|
1329
|
+
columns,
|
1330
|
+
ifVersion
|
1331
|
+
}) {
|
1027
1332
|
return operationsByTag.records.upsertRecordWithID({
|
1028
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1029
|
-
queryParams:
|
1333
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1334
|
+
queryParams: { columns, ifVersion },
|
1030
1335
|
body: record,
|
1031
1336
|
...this.extraProps
|
1032
1337
|
});
|
1033
1338
|
}
|
1034
|
-
deleteRecord(
|
1339
|
+
deleteRecord({
|
1340
|
+
workspace,
|
1341
|
+
region,
|
1342
|
+
database,
|
1343
|
+
branch,
|
1344
|
+
table,
|
1345
|
+
id,
|
1346
|
+
columns
|
1347
|
+
}) {
|
1035
1348
|
return operationsByTag.records.deleteRecord({
|
1036
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1037
|
-
queryParams:
|
1349
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1350
|
+
queryParams: { columns },
|
1038
1351
|
...this.extraProps
|
1039
1352
|
});
|
1040
1353
|
}
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1354
|
+
bulkInsertTableRecords({
|
1355
|
+
workspace,
|
1356
|
+
region,
|
1357
|
+
database,
|
1358
|
+
branch,
|
1359
|
+
table,
|
1360
|
+
records,
|
1361
|
+
columns
|
1362
|
+
}) {
|
1363
|
+
return operationsByTag.records.bulkInsertTableRecords({
|
1364
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1365
|
+
queryParams: { columns },
|
1366
|
+
body: { records },
|
1045
1367
|
...this.extraProps
|
1046
1368
|
});
|
1047
1369
|
}
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1370
|
+
branchTransaction({
|
1371
|
+
workspace,
|
1372
|
+
region,
|
1373
|
+
database,
|
1374
|
+
branch,
|
1375
|
+
operations
|
1376
|
+
}) {
|
1377
|
+
return operationsByTag.records.branchTransaction({
|
1378
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1379
|
+
body: { operations },
|
1380
|
+
...this.extraProps
|
1381
|
+
});
|
1382
|
+
}
|
1383
|
+
}
|
1384
|
+
class SearchAndFilterApi {
|
1385
|
+
constructor(extraProps) {
|
1386
|
+
this.extraProps = extraProps;
|
1387
|
+
}
|
1388
|
+
queryTable({
|
1389
|
+
workspace,
|
1390
|
+
region,
|
1391
|
+
database,
|
1392
|
+
branch,
|
1393
|
+
table,
|
1394
|
+
filter,
|
1395
|
+
sort,
|
1396
|
+
page,
|
1397
|
+
columns
|
1398
|
+
}) {
|
1399
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1400
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1401
|
+
body: { filter, sort, page, columns },
|
1402
|
+
...this.extraProps
|
1403
|
+
});
|
1404
|
+
}
|
1405
|
+
searchTable({
|
1406
|
+
workspace,
|
1407
|
+
region,
|
1408
|
+
database,
|
1409
|
+
branch,
|
1410
|
+
table,
|
1411
|
+
query,
|
1412
|
+
fuzziness,
|
1413
|
+
target,
|
1414
|
+
prefix,
|
1415
|
+
filter,
|
1416
|
+
highlight,
|
1417
|
+
boosters
|
1418
|
+
}) {
|
1419
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1420
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1421
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1422
|
+
...this.extraProps
|
1423
|
+
});
|
1424
|
+
}
|
1425
|
+
searchBranch({
|
1426
|
+
workspace,
|
1427
|
+
region,
|
1428
|
+
database,
|
1429
|
+
branch,
|
1430
|
+
tables,
|
1431
|
+
query,
|
1432
|
+
fuzziness,
|
1433
|
+
prefix,
|
1434
|
+
highlight
|
1435
|
+
}) {
|
1436
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1437
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1438
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1439
|
+
...this.extraProps
|
1440
|
+
});
|
1441
|
+
}
|
1442
|
+
summarizeTable({
|
1443
|
+
workspace,
|
1444
|
+
region,
|
1445
|
+
database,
|
1446
|
+
branch,
|
1447
|
+
table,
|
1448
|
+
filter,
|
1449
|
+
columns,
|
1450
|
+
summaries,
|
1451
|
+
sort,
|
1452
|
+
summariesFilter,
|
1453
|
+
page
|
1454
|
+
}) {
|
1455
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1456
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1457
|
+
body: { filter, columns, summaries, sort, summariesFilter, page },
|
1458
|
+
...this.extraProps
|
1459
|
+
});
|
1460
|
+
}
|
1461
|
+
aggregateTable({
|
1462
|
+
workspace,
|
1463
|
+
region,
|
1464
|
+
database,
|
1465
|
+
branch,
|
1466
|
+
table,
|
1467
|
+
filter,
|
1468
|
+
aggs
|
1469
|
+
}) {
|
1470
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1471
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1472
|
+
body: { filter, aggs },
|
1473
|
+
...this.extraProps
|
1474
|
+
});
|
1475
|
+
}
|
1476
|
+
}
|
1477
|
+
class MigrationRequestsApi {
|
1478
|
+
constructor(extraProps) {
|
1479
|
+
this.extraProps = extraProps;
|
1480
|
+
}
|
1481
|
+
queryMigrationRequests({
|
1482
|
+
workspace,
|
1483
|
+
region,
|
1484
|
+
database,
|
1485
|
+
filter,
|
1486
|
+
sort,
|
1487
|
+
page,
|
1488
|
+
columns
|
1489
|
+
}) {
|
1490
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1491
|
+
pathParams: { workspace, region, dbName: database },
|
1492
|
+
body: { filter, sort, page, columns },
|
1493
|
+
...this.extraProps
|
1494
|
+
});
|
1495
|
+
}
|
1496
|
+
createMigrationRequest({
|
1497
|
+
workspace,
|
1498
|
+
region,
|
1499
|
+
database,
|
1500
|
+
migration
|
1501
|
+
}) {
|
1502
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
1503
|
+
pathParams: { workspace, region, dbName: database },
|
1504
|
+
body: migration,
|
1505
|
+
...this.extraProps
|
1506
|
+
});
|
1507
|
+
}
|
1508
|
+
getMigrationRequest({
|
1509
|
+
workspace,
|
1510
|
+
region,
|
1511
|
+
database,
|
1512
|
+
migrationRequest
|
1513
|
+
}) {
|
1514
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1515
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1516
|
+
...this.extraProps
|
1517
|
+
});
|
1518
|
+
}
|
1519
|
+
updateMigrationRequest({
|
1520
|
+
workspace,
|
1521
|
+
region,
|
1522
|
+
database,
|
1523
|
+
migrationRequest,
|
1524
|
+
update
|
1525
|
+
}) {
|
1526
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1527
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1528
|
+
body: update,
|
1053
1529
|
...this.extraProps
|
1054
1530
|
});
|
1055
1531
|
}
|
1056
|
-
|
1057
|
-
|
1058
|
-
|
1059
|
-
|
1532
|
+
listMigrationRequestsCommits({
|
1533
|
+
workspace,
|
1534
|
+
region,
|
1535
|
+
database,
|
1536
|
+
migrationRequest,
|
1537
|
+
page
|
1538
|
+
}) {
|
1539
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1540
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1541
|
+
body: { page },
|
1060
1542
|
...this.extraProps
|
1061
1543
|
});
|
1062
1544
|
}
|
1063
|
-
|
1064
|
-
|
1065
|
-
|
1066
|
-
|
1545
|
+
compareMigrationRequest({
|
1546
|
+
workspace,
|
1547
|
+
region,
|
1548
|
+
database,
|
1549
|
+
migrationRequest
|
1550
|
+
}) {
|
1551
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1552
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1067
1553
|
...this.extraProps
|
1068
1554
|
});
|
1069
1555
|
}
|
1070
|
-
|
1071
|
-
|
1072
|
-
|
1073
|
-
|
1556
|
+
getMigrationRequestIsMerged({
|
1557
|
+
workspace,
|
1558
|
+
region,
|
1559
|
+
database,
|
1560
|
+
migrationRequest
|
1561
|
+
}) {
|
1562
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1563
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1564
|
+
...this.extraProps
|
1565
|
+
});
|
1566
|
+
}
|
1567
|
+
mergeMigrationRequest({
|
1568
|
+
workspace,
|
1569
|
+
region,
|
1570
|
+
database,
|
1571
|
+
migrationRequest
|
1572
|
+
}) {
|
1573
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1574
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1575
|
+
...this.extraProps
|
1576
|
+
});
|
1577
|
+
}
|
1578
|
+
}
|
1579
|
+
class MigrationsApi {
|
1580
|
+
constructor(extraProps) {
|
1581
|
+
this.extraProps = extraProps;
|
1582
|
+
}
|
1583
|
+
getBranchMigrationHistory({
|
1584
|
+
workspace,
|
1585
|
+
region,
|
1586
|
+
database,
|
1587
|
+
branch,
|
1588
|
+
limit,
|
1589
|
+
startFrom
|
1590
|
+
}) {
|
1591
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1592
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1593
|
+
body: { limit, startFrom },
|
1594
|
+
...this.extraProps
|
1595
|
+
});
|
1596
|
+
}
|
1597
|
+
getBranchMigrationPlan({
|
1598
|
+
workspace,
|
1599
|
+
region,
|
1600
|
+
database,
|
1601
|
+
branch,
|
1602
|
+
schema
|
1603
|
+
}) {
|
1604
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1605
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1606
|
+
body: schema,
|
1607
|
+
...this.extraProps
|
1608
|
+
});
|
1609
|
+
}
|
1610
|
+
executeBranchMigrationPlan({
|
1611
|
+
workspace,
|
1612
|
+
region,
|
1613
|
+
database,
|
1614
|
+
branch,
|
1615
|
+
plan
|
1616
|
+
}) {
|
1617
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1618
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1619
|
+
body: plan,
|
1620
|
+
...this.extraProps
|
1621
|
+
});
|
1622
|
+
}
|
1623
|
+
getBranchSchemaHistory({
|
1624
|
+
workspace,
|
1625
|
+
region,
|
1626
|
+
database,
|
1627
|
+
branch,
|
1628
|
+
page
|
1629
|
+
}) {
|
1630
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1631
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1632
|
+
body: { page },
|
1633
|
+
...this.extraProps
|
1634
|
+
});
|
1635
|
+
}
|
1636
|
+
compareBranchWithUserSchema({
|
1637
|
+
workspace,
|
1638
|
+
region,
|
1639
|
+
database,
|
1640
|
+
branch,
|
1641
|
+
schema
|
1642
|
+
}) {
|
1643
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1644
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1645
|
+
body: { schema },
|
1646
|
+
...this.extraProps
|
1647
|
+
});
|
1648
|
+
}
|
1649
|
+
compareBranchSchemas({
|
1650
|
+
workspace,
|
1651
|
+
region,
|
1652
|
+
database,
|
1653
|
+
branch,
|
1654
|
+
compare,
|
1655
|
+
schema
|
1656
|
+
}) {
|
1657
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1658
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1659
|
+
body: { schema },
|
1660
|
+
...this.extraProps
|
1661
|
+
});
|
1662
|
+
}
|
1663
|
+
updateBranchSchema({
|
1664
|
+
workspace,
|
1665
|
+
region,
|
1666
|
+
database,
|
1667
|
+
branch,
|
1668
|
+
migration
|
1669
|
+
}) {
|
1670
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1671
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1672
|
+
body: migration,
|
1673
|
+
...this.extraProps
|
1674
|
+
});
|
1675
|
+
}
|
1676
|
+
previewBranchSchemaEdit({
|
1677
|
+
workspace,
|
1678
|
+
region,
|
1679
|
+
database,
|
1680
|
+
branch,
|
1681
|
+
data
|
1682
|
+
}) {
|
1683
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1684
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1685
|
+
body: data,
|
1686
|
+
...this.extraProps
|
1687
|
+
});
|
1688
|
+
}
|
1689
|
+
applyBranchSchemaEdit({
|
1690
|
+
workspace,
|
1691
|
+
region,
|
1692
|
+
database,
|
1693
|
+
branch,
|
1694
|
+
edits
|
1695
|
+
}) {
|
1696
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1697
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1698
|
+
body: { edits },
|
1699
|
+
...this.extraProps
|
1700
|
+
});
|
1701
|
+
}
|
1702
|
+
}
|
1703
|
+
class DatabaseApi {
|
1704
|
+
constructor(extraProps) {
|
1705
|
+
this.extraProps = extraProps;
|
1706
|
+
}
|
1707
|
+
getDatabaseList({ workspace }) {
|
1708
|
+
return operationsByTag.databases.getDatabaseList({
|
1709
|
+
pathParams: { workspaceId: workspace },
|
1710
|
+
...this.extraProps
|
1711
|
+
});
|
1712
|
+
}
|
1713
|
+
createDatabase({
|
1714
|
+
workspace,
|
1715
|
+
database,
|
1716
|
+
data
|
1717
|
+
}) {
|
1718
|
+
return operationsByTag.databases.createDatabase({
|
1719
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1720
|
+
body: data,
|
1721
|
+
...this.extraProps
|
1722
|
+
});
|
1723
|
+
}
|
1724
|
+
deleteDatabase({
|
1725
|
+
workspace,
|
1726
|
+
database
|
1727
|
+
}) {
|
1728
|
+
return operationsByTag.databases.deleteDatabase({
|
1729
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1730
|
+
...this.extraProps
|
1731
|
+
});
|
1732
|
+
}
|
1733
|
+
getDatabaseMetadata({
|
1734
|
+
workspace,
|
1735
|
+
database
|
1736
|
+
}) {
|
1737
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1738
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1739
|
+
...this.extraProps
|
1740
|
+
});
|
1741
|
+
}
|
1742
|
+
updateDatabaseMetadata({
|
1743
|
+
workspace,
|
1744
|
+
database,
|
1745
|
+
metadata
|
1746
|
+
}) {
|
1747
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1748
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1749
|
+
body: metadata,
|
1750
|
+
...this.extraProps
|
1751
|
+
});
|
1752
|
+
}
|
1753
|
+
listRegions({ workspace }) {
|
1754
|
+
return operationsByTag.databases.listRegions({
|
1755
|
+
pathParams: { workspaceId: workspace },
|
1074
1756
|
...this.extraProps
|
1075
1757
|
});
|
1076
1758
|
}
|
@@ -1086,6 +1768,20 @@ class XataApiPlugin {
|
|
1086
1768
|
class XataPlugin {
|
1087
1769
|
}
|
1088
1770
|
|
1771
|
+
function generateUUID() {
|
1772
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1773
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1774
|
+
return v.toString(16);
|
1775
|
+
});
|
1776
|
+
}
|
1777
|
+
|
1778
|
+
function cleanFilter(filter) {
|
1779
|
+
if (!filter)
|
1780
|
+
return void 0;
|
1781
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1782
|
+
return values.length > 0 ? filter : void 0;
|
1783
|
+
}
|
1784
|
+
|
1089
1785
|
var __accessCheck$6 = (obj, member, msg) => {
|
1090
1786
|
if (!member.has(obj))
|
1091
1787
|
throw TypeError("Cannot " + msg);
|
@@ -1199,9 +1895,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1199
1895
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1200
1896
|
return value;
|
1201
1897
|
};
|
1202
|
-
var
|
1898
|
+
var __privateMethod$3 = (obj, member, method) => {
|
1899
|
+
__accessCheck$5(obj, member, "access private method");
|
1900
|
+
return method;
|
1901
|
+
};
|
1902
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1203
1903
|
const _Query = class {
|
1204
1904
|
constructor(repository, table, data, rawParent) {
|
1905
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1205
1906
|
__privateAdd$5(this, _table$1, void 0);
|
1206
1907
|
__privateAdd$5(this, _repository, void 0);
|
1207
1908
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1220,7 +1921,7 @@ const _Query = class {
|
|
1220
1921
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1221
1922
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1222
1923
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1223
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1924
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1224
1925
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1225
1926
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1226
1927
|
this.any = this.any.bind(this);
|
@@ -1258,11 +1959,14 @@ const _Query = class {
|
|
1258
1959
|
}
|
1259
1960
|
filter(a, b) {
|
1260
1961
|
if (arguments.length === 1) {
|
1261
|
-
const constraints = Object.entries(a).map(([column, constraint]) => ({
|
1962
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1963
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
1964
|
+
}));
|
1262
1965
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1263
1966
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1264
1967
|
} else {
|
1265
|
-
const
|
1968
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
1969
|
+
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1266
1970
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1267
1971
|
}
|
1268
1972
|
}
|
@@ -1300,11 +2004,20 @@ const _Query = class {
|
|
1300
2004
|
}
|
1301
2005
|
}
|
1302
2006
|
async getMany(options = {}) {
|
1303
|
-
const
|
2007
|
+
const { pagination = {}, ...rest } = options;
|
2008
|
+
const { size = PAGINATION_DEFAULT_SIZE, offset } = pagination;
|
2009
|
+
const batchSize = size <= PAGINATION_MAX_SIZE ? size : PAGINATION_MAX_SIZE;
|
2010
|
+
let page = await this.getPaginated({ ...rest, pagination: { size: batchSize, offset } });
|
2011
|
+
const results = [...page.records];
|
2012
|
+
while (page.hasNextPage() && results.length < size) {
|
2013
|
+
page = await page.nextPage();
|
2014
|
+
results.push(...page.records);
|
2015
|
+
}
|
1304
2016
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1305
2017
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1306
2018
|
}
|
1307
|
-
|
2019
|
+
const array = new RecordArray(page, results.slice(0, size));
|
2020
|
+
return array;
|
1308
2021
|
}
|
1309
2022
|
async getAll(options = {}) {
|
1310
2023
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1318,6 +2031,22 @@ const _Query = class {
|
|
1318
2031
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1319
2032
|
return records[0] ?? null;
|
1320
2033
|
}
|
2034
|
+
async getFirstOrThrow(options = {}) {
|
2035
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2036
|
+
if (records[0] === void 0)
|
2037
|
+
throw new Error("No results found.");
|
2038
|
+
return records[0];
|
2039
|
+
}
|
2040
|
+
async summarize(params = {}) {
|
2041
|
+
const { summaries, summariesFilter, ...options } = params;
|
2042
|
+
const query = new _Query(
|
2043
|
+
__privateGet$5(this, _repository),
|
2044
|
+
__privateGet$5(this, _table$1),
|
2045
|
+
options,
|
2046
|
+
__privateGet$5(this, _data)
|
2047
|
+
);
|
2048
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2049
|
+
}
|
1321
2050
|
cache(ttl) {
|
1322
2051
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1323
2052
|
}
|
@@ -1341,9 +2070,20 @@ let Query = _Query;
|
|
1341
2070
|
_table$1 = new WeakMap();
|
1342
2071
|
_repository = new WeakMap();
|
1343
2072
|
_data = new WeakMap();
|
2073
|
+
_cleanFilterConstraint = new WeakSet();
|
2074
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2075
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2076
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2077
|
+
return { $includes: value };
|
2078
|
+
}
|
2079
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2080
|
+
return value.id;
|
2081
|
+
}
|
2082
|
+
return value;
|
2083
|
+
};
|
1344
2084
|
function cleanParent(data, parent) {
|
1345
2085
|
if (isCursorPaginationOptions(data.pagination)) {
|
1346
|
-
return { ...parent,
|
2086
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1347
2087
|
}
|
1348
2088
|
return parent;
|
1349
2089
|
}
|
@@ -1402,18 +2142,23 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1402
2142
|
__accessCheck$4(obj, member, "access private method");
|
1403
2143
|
return method;
|
1404
2144
|
};
|
1405
|
-
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
|
2145
|
+
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _bulkInsertTableRecords, bulkInsertTableRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
|
1406
2146
|
class Repository extends Query {
|
1407
2147
|
}
|
1408
2148
|
class RestRepository extends Query {
|
1409
2149
|
constructor(options) {
|
1410
|
-
super(
|
2150
|
+
super(
|
2151
|
+
null,
|
2152
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2153
|
+
{}
|
2154
|
+
);
|
1411
2155
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1412
2156
|
__privateAdd$4(this, _insertRecordWithId);
|
1413
2157
|
__privateAdd$4(this, _bulkInsertTableRecords);
|
1414
2158
|
__privateAdd$4(this, _updateRecordWithID);
|
1415
2159
|
__privateAdd$4(this, _upsertRecordWithID);
|
1416
2160
|
__privateAdd$4(this, _deleteRecord);
|
2161
|
+
__privateAdd$4(this, _deleteRecords);
|
1417
2162
|
__privateAdd$4(this, _setCacheQuery);
|
1418
2163
|
__privateAdd$4(this, _getCacheQuery);
|
1419
2164
|
__privateAdd$4(this, _getSchemaTables$1);
|
@@ -1424,21 +2169,26 @@ class RestRepository extends Query {
|
|
1424
2169
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1425
2170
|
__privateAdd$4(this, _trace, void 0);
|
1426
2171
|
__privateSet$4(this, _table, options.table);
|
1427
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1428
2172
|
__privateSet$4(this, _db, options.db);
|
1429
2173
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1430
2174
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2175
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2176
|
+
const props = await options.pluginOptions.getFetchProps();
|
2177
|
+
return { ...props, sessionID: generateUUID() };
|
2178
|
+
});
|
1431
2179
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1432
2180
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1433
2181
|
return trace(name, fn, {
|
1434
2182
|
...options2,
|
1435
2183
|
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
2184
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
1436
2185
|
[TraceAttributes.VERSION]: VERSION
|
1437
2186
|
});
|
1438
2187
|
});
|
1439
2188
|
}
|
1440
|
-
async create(a, b, c) {
|
2189
|
+
async create(a, b, c, d) {
|
1441
2190
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2191
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1442
2192
|
if (Array.isArray(a)) {
|
1443
2193
|
if (a.length === 0)
|
1444
2194
|
return [];
|
@@ -1449,13 +2199,13 @@ class RestRepository extends Query {
|
|
1449
2199
|
if (a === "")
|
1450
2200
|
throw new Error("The id can't be empty");
|
1451
2201
|
const columns = isStringArray(c) ? c : void 0;
|
1452
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
2202
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1453
2203
|
}
|
1454
2204
|
if (isObject(a) && isString(a.id)) {
|
1455
2205
|
if (a.id === "")
|
1456
2206
|
throw new Error("The id can't be empty");
|
1457
2207
|
const columns = isStringArray(b) ? b : void 0;
|
1458
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2208
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1459
2209
|
}
|
1460
2210
|
if (isObject(a)) {
|
1461
2211
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1486,6 +2236,7 @@ class RestRepository extends Query {
|
|
1486
2236
|
pathParams: {
|
1487
2237
|
workspace: "{workspaceId}",
|
1488
2238
|
dbBranchName: "{dbBranch}",
|
2239
|
+
region: "{region}",
|
1489
2240
|
tableName: __privateGet$4(this, _table),
|
1490
2241
|
recordId: id
|
1491
2242
|
},
|
@@ -1493,7 +2244,7 @@ class RestRepository extends Query {
|
|
1493
2244
|
...fetchProps
|
1494
2245
|
});
|
1495
2246
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1496
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2247
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1497
2248
|
} catch (e) {
|
1498
2249
|
if (isObject(e) && e.status === 404) {
|
1499
2250
|
return null;
|
@@ -1504,8 +2255,28 @@ class RestRepository extends Query {
|
|
1504
2255
|
return null;
|
1505
2256
|
});
|
1506
2257
|
}
|
1507
|
-
async
|
2258
|
+
async readOrThrow(a, b) {
|
2259
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2260
|
+
const result = await this.read(a, b);
|
2261
|
+
if (Array.isArray(result)) {
|
2262
|
+
const missingIds = compact(
|
2263
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2264
|
+
);
|
2265
|
+
if (missingIds.length > 0) {
|
2266
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2267
|
+
}
|
2268
|
+
return result;
|
2269
|
+
}
|
2270
|
+
if (result === null) {
|
2271
|
+
const id = extractId(a) ?? "unknown";
|
2272
|
+
throw new Error(`Record with id ${id} not found`);
|
2273
|
+
}
|
2274
|
+
return result;
|
2275
|
+
});
|
2276
|
+
}
|
2277
|
+
async update(a, b, c, d) {
|
1508
2278
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2279
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1509
2280
|
if (Array.isArray(a)) {
|
1510
2281
|
if (a.length === 0)
|
1511
2282
|
return [];
|
@@ -1517,17 +2288,37 @@ class RestRepository extends Query {
|
|
1517
2288
|
}
|
1518
2289
|
if (isString(a) && isObject(b)) {
|
1519
2290
|
const columns = isStringArray(c) ? c : void 0;
|
1520
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
2291
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1521
2292
|
}
|
1522
2293
|
if (isObject(a) && isString(a.id)) {
|
1523
2294
|
const columns = isStringArray(b) ? b : void 0;
|
1524
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2295
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1525
2296
|
}
|
1526
2297
|
throw new Error("Invalid arguments for update method");
|
1527
2298
|
});
|
1528
2299
|
}
|
1529
|
-
async
|
2300
|
+
async updateOrThrow(a, b, c, d) {
|
2301
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2302
|
+
const result = await this.update(a, b, c, d);
|
2303
|
+
if (Array.isArray(result)) {
|
2304
|
+
const missingIds = compact(
|
2305
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2306
|
+
);
|
2307
|
+
if (missingIds.length > 0) {
|
2308
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2309
|
+
}
|
2310
|
+
return result;
|
2311
|
+
}
|
2312
|
+
if (result === null) {
|
2313
|
+
const id = extractId(a) ?? "unknown";
|
2314
|
+
throw new Error(`Record with id ${id} not found`);
|
2315
|
+
}
|
2316
|
+
return result;
|
2317
|
+
});
|
2318
|
+
}
|
2319
|
+
async createOrUpdate(a, b, c, d) {
|
1530
2320
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2321
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1531
2322
|
if (Array.isArray(a)) {
|
1532
2323
|
if (a.length === 0)
|
1533
2324
|
return [];
|
@@ -1539,24 +2330,48 @@ class RestRepository extends Query {
|
|
1539
2330
|
}
|
1540
2331
|
if (isString(a) && isObject(b)) {
|
1541
2332
|
const columns = isStringArray(c) ? c : void 0;
|
1542
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
2333
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1543
2334
|
}
|
1544
2335
|
if (isObject(a) && isString(a.id)) {
|
1545
2336
|
const columns = isStringArray(c) ? c : void 0;
|
1546
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2337
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1547
2338
|
}
|
1548
2339
|
throw new Error("Invalid arguments for createOrUpdate method");
|
1549
2340
|
});
|
1550
2341
|
}
|
2342
|
+
async createOrReplace(a, b, c, d) {
|
2343
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2344
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2345
|
+
if (Array.isArray(a)) {
|
2346
|
+
if (a.length === 0)
|
2347
|
+
return [];
|
2348
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2349
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
2350
|
+
}
|
2351
|
+
if (isString(a) && isObject(b)) {
|
2352
|
+
const columns = isStringArray(c) ? c : void 0;
|
2353
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2354
|
+
}
|
2355
|
+
if (isObject(a) && isString(a.id)) {
|
2356
|
+
const columns = isStringArray(c) ? c : void 0;
|
2357
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2358
|
+
}
|
2359
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2360
|
+
});
|
2361
|
+
}
|
1551
2362
|
async delete(a, b) {
|
1552
2363
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
1553
2364
|
if (Array.isArray(a)) {
|
1554
2365
|
if (a.length === 0)
|
1555
2366
|
return [];
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
2367
|
+
const ids = a.map((o) => {
|
2368
|
+
if (isString(o))
|
2369
|
+
return o;
|
2370
|
+
if (isString(o.id))
|
2371
|
+
return o.id;
|
2372
|
+
throw new Error("Invalid arguments for delete method");
|
2373
|
+
});
|
2374
|
+
return __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids, b);
|
1560
2375
|
}
|
1561
2376
|
if (isString(a)) {
|
1562
2377
|
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
@@ -1567,11 +2382,34 @@ class RestRepository extends Query {
|
|
1567
2382
|
throw new Error("Invalid arguments for delete method");
|
1568
2383
|
});
|
1569
2384
|
}
|
2385
|
+
async deleteOrThrow(a, b) {
|
2386
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2387
|
+
const result = await this.delete(a, b);
|
2388
|
+
if (Array.isArray(result)) {
|
2389
|
+
const missingIds = compact(
|
2390
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2391
|
+
);
|
2392
|
+
if (missingIds.length > 0) {
|
2393
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2394
|
+
}
|
2395
|
+
return result;
|
2396
|
+
} else if (result === null) {
|
2397
|
+
const id = extractId(a) ?? "unknown";
|
2398
|
+
throw new Error(`Record with id ${id} not found`);
|
2399
|
+
}
|
2400
|
+
return result;
|
2401
|
+
});
|
2402
|
+
}
|
1570
2403
|
async search(query, options = {}) {
|
1571
2404
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1572
2405
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1573
2406
|
const { records } = await searchTable({
|
1574
|
-
pathParams: {
|
2407
|
+
pathParams: {
|
2408
|
+
workspace: "{workspaceId}",
|
2409
|
+
dbBranchName: "{dbBranch}",
|
2410
|
+
region: "{region}",
|
2411
|
+
tableName: __privateGet$4(this, _table)
|
2412
|
+
},
|
1575
2413
|
body: {
|
1576
2414
|
query,
|
1577
2415
|
fuzziness: options.fuzziness,
|
@@ -1583,7 +2421,23 @@ class RestRepository extends Query {
|
|
1583
2421
|
...fetchProps
|
1584
2422
|
});
|
1585
2423
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1586
|
-
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2424
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2425
|
+
});
|
2426
|
+
}
|
2427
|
+
async aggregate(aggs, filter) {
|
2428
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2429
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2430
|
+
const result = await aggregateTable({
|
2431
|
+
pathParams: {
|
2432
|
+
workspace: "{workspaceId}",
|
2433
|
+
dbBranchName: "{dbBranch}",
|
2434
|
+
region: "{region}",
|
2435
|
+
tableName: __privateGet$4(this, _table)
|
2436
|
+
},
|
2437
|
+
body: { aggs, filter },
|
2438
|
+
...fetchProps
|
2439
|
+
});
|
2440
|
+
return result;
|
1587
2441
|
});
|
1588
2442
|
}
|
1589
2443
|
async query(query) {
|
@@ -1592,24 +2446,54 @@ class RestRepository extends Query {
|
|
1592
2446
|
if (cacheQuery)
|
1593
2447
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1594
2448
|
const data = query.getQueryOptions();
|
1595
|
-
const body = {
|
1596
|
-
filter: Object.values(data.filter ?? {}).some(Boolean) ? data.filter : void 0,
|
1597
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1598
|
-
page: data.pagination,
|
1599
|
-
columns: data.columns
|
1600
|
-
};
|
1601
2449
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1602
2450
|
const { meta, records: objects } = await queryTable({
|
1603
|
-
pathParams: {
|
1604
|
-
|
2451
|
+
pathParams: {
|
2452
|
+
workspace: "{workspaceId}",
|
2453
|
+
dbBranchName: "{dbBranch}",
|
2454
|
+
region: "{region}",
|
2455
|
+
tableName: __privateGet$4(this, _table)
|
2456
|
+
},
|
2457
|
+
body: {
|
2458
|
+
filter: cleanFilter(data.filter),
|
2459
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2460
|
+
page: data.pagination,
|
2461
|
+
columns: data.columns ?? ["*"]
|
2462
|
+
},
|
1605
2463
|
...fetchProps
|
1606
2464
|
});
|
1607
2465
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1608
|
-
const records = objects.map(
|
2466
|
+
const records = objects.map(
|
2467
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2468
|
+
);
|
1609
2469
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1610
2470
|
return new Page(query, meta, records);
|
1611
2471
|
});
|
1612
2472
|
}
|
2473
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2474
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2475
|
+
const data = query.getQueryOptions();
|
2476
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2477
|
+
const result = await summarizeTable({
|
2478
|
+
pathParams: {
|
2479
|
+
workspace: "{workspaceId}",
|
2480
|
+
dbBranchName: "{dbBranch}",
|
2481
|
+
region: "{region}",
|
2482
|
+
tableName: __privateGet$4(this, _table)
|
2483
|
+
},
|
2484
|
+
body: {
|
2485
|
+
filter: cleanFilter(data.filter),
|
2486
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2487
|
+
columns: data.columns,
|
2488
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2489
|
+
summaries,
|
2490
|
+
summariesFilter
|
2491
|
+
},
|
2492
|
+
...fetchProps
|
2493
|
+
});
|
2494
|
+
return result;
|
2495
|
+
});
|
2496
|
+
}
|
1613
2497
|
}
|
1614
2498
|
_table = new WeakMap();
|
1615
2499
|
_getFetchProps = new WeakMap();
|
@@ -1625,6 +2509,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1625
2509
|
pathParams: {
|
1626
2510
|
workspace: "{workspaceId}",
|
1627
2511
|
dbBranchName: "{dbBranch}",
|
2512
|
+
region: "{region}",
|
1628
2513
|
tableName: __privateGet$4(this, _table)
|
1629
2514
|
},
|
1630
2515
|
queryParams: { columns },
|
@@ -1632,32 +2517,38 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1632
2517
|
...fetchProps
|
1633
2518
|
});
|
1634
2519
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1635
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2520
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1636
2521
|
};
|
1637
2522
|
_insertRecordWithId = new WeakSet();
|
1638
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2523
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1639
2524
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1640
2525
|
const record = transformObjectLinks(object);
|
1641
2526
|
const response = await insertRecordWithID({
|
1642
2527
|
pathParams: {
|
1643
2528
|
workspace: "{workspaceId}",
|
1644
2529
|
dbBranchName: "{dbBranch}",
|
2530
|
+
region: "{region}",
|
1645
2531
|
tableName: __privateGet$4(this, _table),
|
1646
2532
|
recordId
|
1647
2533
|
},
|
1648
2534
|
body: record,
|
1649
|
-
queryParams: { createOnly
|
2535
|
+
queryParams: { createOnly, columns, ifVersion },
|
1650
2536
|
...fetchProps
|
1651
2537
|
});
|
1652
2538
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1653
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2539
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1654
2540
|
};
|
1655
2541
|
_bulkInsertTableRecords = new WeakSet();
|
1656
2542
|
bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
1657
2543
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1658
2544
|
const records = objects.map((object) => transformObjectLinks(object));
|
1659
2545
|
const response = await bulkInsertTableRecords({
|
1660
|
-
pathParams: {
|
2546
|
+
pathParams: {
|
2547
|
+
workspace: "{workspaceId}",
|
2548
|
+
dbBranchName: "{dbBranch}",
|
2549
|
+
region: "{region}",
|
2550
|
+
tableName: __privateGet$4(this, _table)
|
2551
|
+
},
|
1661
2552
|
queryParams: { columns },
|
1662
2553
|
body: { records },
|
1663
2554
|
...fetchProps
|
@@ -1666,21 +2557,27 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
1666
2557
|
throw new Error("Request included columns but server didn't include them");
|
1667
2558
|
}
|
1668
2559
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1669
|
-
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2560
|
+
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
1670
2561
|
};
|
1671
2562
|
_updateRecordWithID = new WeakSet();
|
1672
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2563
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1673
2564
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1674
2565
|
const record = transformObjectLinks(object);
|
1675
2566
|
try {
|
1676
2567
|
const response = await updateRecordWithID({
|
1677
|
-
pathParams: {
|
1678
|
-
|
2568
|
+
pathParams: {
|
2569
|
+
workspace: "{workspaceId}",
|
2570
|
+
dbBranchName: "{dbBranch}",
|
2571
|
+
region: "{region}",
|
2572
|
+
tableName: __privateGet$4(this, _table),
|
2573
|
+
recordId
|
2574
|
+
},
|
2575
|
+
queryParams: { columns, ifVersion },
|
1679
2576
|
body: record,
|
1680
2577
|
...fetchProps
|
1681
2578
|
});
|
1682
2579
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1683
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2580
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1684
2581
|
} catch (e) {
|
1685
2582
|
if (isObject(e) && e.status === 404) {
|
1686
2583
|
return null;
|
@@ -1689,28 +2586,63 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1689
2586
|
}
|
1690
2587
|
};
|
1691
2588
|
_upsertRecordWithID = new WeakSet();
|
1692
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2589
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1693
2590
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1694
2591
|
const response = await upsertRecordWithID({
|
1695
|
-
pathParams: {
|
1696
|
-
|
2592
|
+
pathParams: {
|
2593
|
+
workspace: "{workspaceId}",
|
2594
|
+
dbBranchName: "{dbBranch}",
|
2595
|
+
region: "{region}",
|
2596
|
+
tableName: __privateGet$4(this, _table),
|
2597
|
+
recordId
|
2598
|
+
},
|
2599
|
+
queryParams: { columns, ifVersion },
|
1697
2600
|
body: object,
|
1698
2601
|
...fetchProps
|
1699
2602
|
});
|
1700
2603
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1701
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2604
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1702
2605
|
};
|
1703
2606
|
_deleteRecord = new WeakSet();
|
1704
2607
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1705
2608
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1706
2609
|
try {
|
1707
2610
|
const response = await deleteRecord({
|
1708
|
-
pathParams: {
|
2611
|
+
pathParams: {
|
2612
|
+
workspace: "{workspaceId}",
|
2613
|
+
dbBranchName: "{dbBranch}",
|
2614
|
+
region: "{region}",
|
2615
|
+
tableName: __privateGet$4(this, _table),
|
2616
|
+
recordId
|
2617
|
+
},
|
1709
2618
|
queryParams: { columns },
|
1710
2619
|
...fetchProps
|
1711
2620
|
});
|
1712
2621
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1713
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2622
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2623
|
+
} catch (e) {
|
2624
|
+
if (isObject(e) && e.status === 404) {
|
2625
|
+
return null;
|
2626
|
+
}
|
2627
|
+
throw e;
|
2628
|
+
}
|
2629
|
+
};
|
2630
|
+
_deleteRecords = new WeakSet();
|
2631
|
+
deleteRecords_fn = async function(recordIds, columns = ["*"]) {
|
2632
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2633
|
+
const operations = recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } }));
|
2634
|
+
try {
|
2635
|
+
const objects = await this.read(recordIds, columns);
|
2636
|
+
await branchTransaction({
|
2637
|
+
pathParams: {
|
2638
|
+
workspace: "{workspaceId}",
|
2639
|
+
dbBranchName: "{dbBranch}",
|
2640
|
+
region: "{region}"
|
2641
|
+
},
|
2642
|
+
body: { operations },
|
2643
|
+
...fetchProps
|
2644
|
+
});
|
2645
|
+
return objects;
|
1714
2646
|
} catch (e) {
|
1715
2647
|
if (isObject(e) && e.status === 404) {
|
1716
2648
|
return null;
|
@@ -1740,7 +2672,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1740
2672
|
return __privateGet$4(this, _schemaTables$2);
|
1741
2673
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1742
2674
|
const { schema } = await getBranchDetails({
|
1743
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2675
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1744
2676
|
...fetchProps
|
1745
2677
|
});
|
1746
2678
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1753,7 +2685,7 @@ const transformObjectLinks = (object) => {
|
|
1753
2685
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1754
2686
|
}, {});
|
1755
2687
|
};
|
1756
|
-
const initObject = (db, schemaTables, table, object) => {
|
2688
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
1757
2689
|
const result = {};
|
1758
2690
|
const { xata, ...rest } = object ?? {};
|
1759
2691
|
Object.assign(result, rest);
|
@@ -1761,6 +2693,8 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1761
2693
|
if (!columns)
|
1762
2694
|
console.error(`Table ${table} not found in schema`);
|
1763
2695
|
for (const column of columns ?? []) {
|
2696
|
+
if (!isValidColumn(selectedColumns, column))
|
2697
|
+
continue;
|
1764
2698
|
const value = result[column.name];
|
1765
2699
|
switch (column.type) {
|
1766
2700
|
case "datetime": {
|
@@ -1777,17 +2711,42 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1777
2711
|
if (!linkTable) {
|
1778
2712
|
console.error(`Failed to parse link for field ${column.name}`);
|
1779
2713
|
} else if (isObject(value)) {
|
1780
|
-
|
2714
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2715
|
+
if (item === column.name) {
|
2716
|
+
return [...acc, "*"];
|
2717
|
+
}
|
2718
|
+
if (item.startsWith(`${column.name}.`)) {
|
2719
|
+
const [, ...path] = item.split(".");
|
2720
|
+
return [...acc, path.join(".")];
|
2721
|
+
}
|
2722
|
+
return acc;
|
2723
|
+
}, []);
|
2724
|
+
result[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2725
|
+
} else {
|
2726
|
+
result[column.name] = null;
|
1781
2727
|
}
|
1782
2728
|
break;
|
1783
2729
|
}
|
2730
|
+
default:
|
2731
|
+
result[column.name] = value ?? null;
|
2732
|
+
if (column.notNull === true && value === null) {
|
2733
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2734
|
+
}
|
2735
|
+
break;
|
1784
2736
|
}
|
1785
2737
|
}
|
1786
2738
|
result.read = function(columns2) {
|
1787
2739
|
return db[table].read(result["id"], columns2);
|
1788
2740
|
};
|
1789
|
-
result.update = function(data,
|
1790
|
-
|
2741
|
+
result.update = function(data, b, c) {
|
2742
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2743
|
+
const ifVersion = parseIfVersion(b, c);
|
2744
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2745
|
+
};
|
2746
|
+
result.replace = function(data, b, c) {
|
2747
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2748
|
+
const ifVersion = parseIfVersion(b, c);
|
2749
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
1791
2750
|
};
|
1792
2751
|
result.delete = function() {
|
1793
2752
|
return db[table].delete(result["id"]);
|
@@ -1795,7 +2754,7 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1795
2754
|
result.getMetadata = function() {
|
1796
2755
|
return xata;
|
1797
2756
|
};
|
1798
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2757
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
1799
2758
|
Object.defineProperty(result, prop, { enumerable: false });
|
1800
2759
|
}
|
1801
2760
|
Object.freeze(result);
|
@@ -1811,6 +2770,23 @@ function extractId(value) {
|
|
1811
2770
|
return value.id;
|
1812
2771
|
return void 0;
|
1813
2772
|
}
|
2773
|
+
function isValidColumn(columns, column) {
|
2774
|
+
if (columns.includes("*"))
|
2775
|
+
return true;
|
2776
|
+
if (column.type === "link") {
|
2777
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2778
|
+
return linkColumns.length > 0;
|
2779
|
+
}
|
2780
|
+
return columns.includes(column.name);
|
2781
|
+
}
|
2782
|
+
function parseIfVersion(...args) {
|
2783
|
+
for (const arg of args) {
|
2784
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2785
|
+
return arg.ifVersion;
|
2786
|
+
}
|
2787
|
+
}
|
2788
|
+
return void 0;
|
2789
|
+
}
|
1814
2790
|
|
1815
2791
|
var __accessCheck$3 = (obj, member, msg) => {
|
1816
2792
|
if (!member.has(obj))
|
@@ -1976,7 +2952,7 @@ class SearchPlugin extends XataPlugin {
|
|
1976
2952
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1977
2953
|
return records.map((record) => {
|
1978
2954
|
const { table = "orphan" } = record.xata;
|
1979
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
2955
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1980
2956
|
});
|
1981
2957
|
},
|
1982
2958
|
byTable: async (query, options = {}) => {
|
@@ -1985,7 +2961,7 @@ class SearchPlugin extends XataPlugin {
|
|
1985
2961
|
return records.reduce((acc, record) => {
|
1986
2962
|
const { table = "orphan" } = record.xata;
|
1987
2963
|
const items = acc[table] ?? [];
|
1988
|
-
const item = initObject(this.db, schemaTables, table, record);
|
2964
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1989
2965
|
return { ...acc, [table]: [...items, item] };
|
1990
2966
|
}, {});
|
1991
2967
|
}
|
@@ -1998,7 +2974,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
1998
2974
|
const fetchProps = await getFetchProps();
|
1999
2975
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
2000
2976
|
const { records } = await searchBranch({
|
2001
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2977
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2002
2978
|
body: { tables, query, fuzziness, prefix, highlight },
|
2003
2979
|
...fetchProps
|
2004
2980
|
});
|
@@ -2010,7 +2986,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
2010
2986
|
return __privateGet$1(this, _schemaTables);
|
2011
2987
|
const fetchProps = await getFetchProps();
|
2012
2988
|
const { schema } = await getBranchDetails({
|
2013
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2989
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2014
2990
|
...fetchProps
|
2015
2991
|
});
|
2016
2992
|
__privateSet$1(this, _schemaTables, schema.tables);
|
@@ -2048,14 +3024,17 @@ async function resolveXataBranch(gitBranch, options) {
|
|
2048
3024
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2049
3025
|
);
|
2050
3026
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2051
|
-
const
|
3027
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3028
|
+
if (!urlParts)
|
3029
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3030
|
+
const { workspace, region } = urlParts;
|
2052
3031
|
const { fallbackBranch } = getEnvironment();
|
2053
3032
|
const { branch } = await resolveBranch({
|
2054
3033
|
apiKey,
|
2055
3034
|
apiUrl: databaseURL,
|
2056
3035
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2057
3036
|
workspacesApiUrl: `${protocol}//${host}`,
|
2058
|
-
pathParams: { dbName, workspace },
|
3037
|
+
pathParams: { dbName, workspace, region },
|
2059
3038
|
queryParams: { gitBranch, fallbackBranch },
|
2060
3039
|
trace: defaultTrace
|
2061
3040
|
});
|
@@ -2073,15 +3052,17 @@ async function getDatabaseBranch(branch, options) {
|
|
2073
3052
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2074
3053
|
);
|
2075
3054
|
const [protocol, , host, , database] = databaseURL.split("/");
|
2076
|
-
const
|
2077
|
-
|
3055
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3056
|
+
if (!urlParts)
|
3057
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3058
|
+
const { workspace, region } = urlParts;
|
2078
3059
|
try {
|
2079
3060
|
return await getBranchDetails({
|
2080
3061
|
apiKey,
|
2081
3062
|
apiUrl: databaseURL,
|
2082
3063
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2083
3064
|
workspacesApiUrl: `${protocol}//${host}`,
|
2084
|
-
pathParams: { dbBranchName
|
3065
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
2085
3066
|
trace: defaultTrace
|
2086
3067
|
});
|
2087
3068
|
} catch (err) {
|
@@ -2172,8 +3153,8 @@ const buildClient = (plugins) => {
|
|
2172
3153
|
if (!databaseURL) {
|
2173
3154
|
throw new Error("Option databaseURL is required");
|
2174
3155
|
}
|
2175
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2176
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
|
3156
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
3157
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
2177
3158
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2178
3159
|
if (!branchValue)
|
2179
3160
|
throw new Error("Unable to resolve branch value");
|
@@ -2183,10 +3164,11 @@ const buildClient = (plugins) => {
|
|
2183
3164
|
apiUrl: "",
|
2184
3165
|
workspacesApiUrl: (path, params) => {
|
2185
3166
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2186
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3167
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2187
3168
|
return databaseURL + newPath;
|
2188
3169
|
},
|
2189
|
-
trace
|
3170
|
+
trace,
|
3171
|
+
clientID
|
2190
3172
|
};
|
2191
3173
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2192
3174
|
if (__privateGet(this, _branch))
|
@@ -2320,16 +3302,28 @@ exports.XataPlugin = XataPlugin;
|
|
2320
3302
|
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
2321
3303
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
2322
3304
|
exports.addTableColumn = addTableColumn;
|
3305
|
+
exports.aggregateTable = aggregateTable;
|
3306
|
+
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
3307
|
+
exports.branchTransaction = branchTransaction;
|
2323
3308
|
exports.buildClient = buildClient;
|
2324
3309
|
exports.buildWorkerRunner = buildWorkerRunner;
|
2325
3310
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
2326
3311
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
3312
|
+
exports.compareBranchSchemas = compareBranchSchemas;
|
3313
|
+
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
3314
|
+
exports.compareMigrationRequest = compareMigrationRequest;
|
2327
3315
|
exports.contains = contains;
|
2328
3316
|
exports.createBranch = createBranch;
|
2329
3317
|
exports.createDatabase = createDatabase;
|
3318
|
+
exports.createMigrationRequest = createMigrationRequest;
|
2330
3319
|
exports.createTable = createTable;
|
2331
3320
|
exports.createUserAPIKey = createUserAPIKey;
|
2332
3321
|
exports.createWorkspace = createWorkspace;
|
3322
|
+
exports.dEPRECATEDcreateDatabase = dEPRECATEDcreateDatabase;
|
3323
|
+
exports.dEPRECATEDdeleteDatabase = dEPRECATEDdeleteDatabase;
|
3324
|
+
exports.dEPRECATEDgetDatabaseList = dEPRECATEDgetDatabaseList;
|
3325
|
+
exports.dEPRECATEDgetDatabaseMetadata = dEPRECATEDgetDatabaseMetadata;
|
3326
|
+
exports.dEPRECATEDupdateDatabaseMetadata = dEPRECATEDupdateDatabaseMetadata;
|
2333
3327
|
exports.deleteBranch = deleteBranch;
|
2334
3328
|
exports.deleteColumn = deleteColumn;
|
2335
3329
|
exports.deleteDatabase = deleteDatabase;
|
@@ -2350,6 +3344,7 @@ exports.getBranchList = getBranchList;
|
|
2350
3344
|
exports.getBranchMetadata = getBranchMetadata;
|
2351
3345
|
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
2352
3346
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
3347
|
+
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
2353
3348
|
exports.getBranchStats = getBranchStats;
|
2354
3349
|
exports.getColumn = getColumn;
|
2355
3350
|
exports.getCurrentBranchDetails = getCurrentBranchDetails;
|
@@ -2358,6 +3353,9 @@ exports.getDatabaseList = getDatabaseList;
|
|
2358
3353
|
exports.getDatabaseMetadata = getDatabaseMetadata;
|
2359
3354
|
exports.getDatabaseURL = getDatabaseURL;
|
2360
3355
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
3356
|
+
exports.getHostUrl = getHostUrl;
|
3357
|
+
exports.getMigrationRequest = getMigrationRequest;
|
3358
|
+
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
2361
3359
|
exports.getRecord = getRecord;
|
2362
3360
|
exports.getTableColumns = getTableColumns;
|
2363
3361
|
exports.getTableSchema = getTableSchema;
|
@@ -2380,6 +3378,8 @@ exports.insertRecordWithID = insertRecordWithID;
|
|
2380
3378
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
2381
3379
|
exports.is = is;
|
2382
3380
|
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
3381
|
+
exports.isHostProviderAlias = isHostProviderAlias;
|
3382
|
+
exports.isHostProviderBuilder = isHostProviderBuilder;
|
2383
3383
|
exports.isIdentifiable = isIdentifiable;
|
2384
3384
|
exports.isNot = isNot;
|
2385
3385
|
exports.isXataRecord = isXataRecord;
|
@@ -2387,11 +3387,18 @@ exports.le = le;
|
|
2387
3387
|
exports.lessEquals = lessEquals;
|
2388
3388
|
exports.lessThan = lessThan;
|
2389
3389
|
exports.lessThanEquals = lessThanEquals;
|
3390
|
+
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
3391
|
+
exports.listRegions = listRegions;
|
2390
3392
|
exports.lt = lt;
|
2391
3393
|
exports.lte = lte;
|
3394
|
+
exports.mergeMigrationRequest = mergeMigrationRequest;
|
2392
3395
|
exports.notExists = notExists;
|
2393
3396
|
exports.operationsByTag = operationsByTag;
|
3397
|
+
exports.parseProviderString = parseProviderString;
|
3398
|
+
exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
|
2394
3399
|
exports.pattern = pattern;
|
3400
|
+
exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
|
3401
|
+
exports.queryMigrationRequests = queryMigrationRequests;
|
2395
3402
|
exports.queryTable = queryTable;
|
2396
3403
|
exports.removeGitBranchesEntry = removeGitBranchesEntry;
|
2397
3404
|
exports.removeWorkspaceMember = removeWorkspaceMember;
|
@@ -2402,8 +3409,12 @@ exports.searchTable = searchTable;
|
|
2402
3409
|
exports.serialize = serialize;
|
2403
3410
|
exports.setTableSchema = setTableSchema;
|
2404
3411
|
exports.startsWith = startsWith;
|
3412
|
+
exports.summarizeTable = summarizeTable;
|
2405
3413
|
exports.updateBranchMetadata = updateBranchMetadata;
|
3414
|
+
exports.updateBranchSchema = updateBranchSchema;
|
2406
3415
|
exports.updateColumn = updateColumn;
|
3416
|
+
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
3417
|
+
exports.updateMigrationRequest = updateMigrationRequest;
|
2407
3418
|
exports.updateRecordWithID = updateRecordWithID;
|
2408
3419
|
exports.updateTable = updateTable;
|
2409
3420
|
exports.updateUser = updateUser;
|