@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.mjs
CHANGED
@@ -2,13 +2,11 @@ const defaultTrace = async (_name, fn, _options) => {
|
|
2
2
|
return await fn({
|
3
3
|
setAttributes: () => {
|
4
4
|
return;
|
5
|
-
},
|
6
|
-
onError: () => {
|
7
|
-
return;
|
8
5
|
}
|
9
6
|
});
|
10
7
|
};
|
11
8
|
const TraceAttributes = {
|
9
|
+
KIND: "xata.trace.kind",
|
12
10
|
VERSION: "xata.sdk.version",
|
13
11
|
TABLE: "xata.table",
|
14
12
|
HTTP_REQUEST_ID: "http.request_id",
|
@@ -40,6 +38,9 @@ function isString(value) {
|
|
40
38
|
function isStringArray(value) {
|
41
39
|
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
42
40
|
}
|
41
|
+
function isNumber(value) {
|
42
|
+
return isDefined(value) && typeof value === "number";
|
43
|
+
}
|
43
44
|
function toBase64(value) {
|
44
45
|
try {
|
45
46
|
return btoa(value);
|
@@ -48,6 +49,17 @@ function toBase64(value) {
|
|
48
49
|
return buf.from(value).toString("base64");
|
49
50
|
}
|
50
51
|
}
|
52
|
+
function deepMerge(a, b) {
|
53
|
+
const result = { ...a };
|
54
|
+
for (const [key, value] of Object.entries(b)) {
|
55
|
+
if (isObject(value) && isObject(result[key])) {
|
56
|
+
result[key] = deepMerge(result[key], value);
|
57
|
+
} else {
|
58
|
+
result[key] = value;
|
59
|
+
}
|
60
|
+
}
|
61
|
+
return result;
|
62
|
+
}
|
51
63
|
|
52
64
|
function getEnvironment() {
|
53
65
|
try {
|
@@ -152,7 +164,7 @@ function getFetchImplementation(userFetch) {
|
|
152
164
|
return fetchImpl;
|
153
165
|
}
|
154
166
|
|
155
|
-
const VERSION = "0.0.0-alpha.
|
167
|
+
const VERSION = "0.0.0-alpha.vfc52d85";
|
156
168
|
|
157
169
|
class ErrorWithCause extends Error {
|
158
170
|
constructor(message, options) {
|
@@ -203,18 +215,24 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
203
215
|
}, {});
|
204
216
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
205
217
|
const queryString = query.length > 0 ? `?${query}` : "";
|
206
|
-
|
218
|
+
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
219
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
|
220
|
+
}, {});
|
221
|
+
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
207
222
|
};
|
208
223
|
function buildBaseUrl({
|
224
|
+
endpoint,
|
209
225
|
path,
|
210
226
|
workspacesApiUrl,
|
211
227
|
apiUrl,
|
212
|
-
pathParams
|
228
|
+
pathParams = {}
|
213
229
|
}) {
|
214
|
-
if (
|
215
|
-
|
216
|
-
|
217
|
-
|
230
|
+
if (endpoint === "dataPlane") {
|
231
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
232
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
233
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
234
|
+
}
|
235
|
+
return `${apiUrl}${path}`;
|
218
236
|
}
|
219
237
|
function hostHeader(url) {
|
220
238
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -230,14 +248,18 @@ async function fetch$1({
|
|
230
248
|
queryParams,
|
231
249
|
fetchImpl,
|
232
250
|
apiKey,
|
251
|
+
endpoint,
|
233
252
|
apiUrl,
|
234
253
|
workspacesApiUrl,
|
235
|
-
trace
|
254
|
+
trace,
|
255
|
+
signal,
|
256
|
+
clientID,
|
257
|
+
sessionID
|
236
258
|
}) {
|
237
259
|
return trace(
|
238
260
|
`${method.toUpperCase()} ${path}`,
|
239
|
-
async ({ setAttributes
|
240
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
261
|
+
async ({ setAttributes }) => {
|
262
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
241
263
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
242
264
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
243
265
|
setAttributes({
|
@@ -250,10 +272,13 @@ async function fetch$1({
|
|
250
272
|
headers: {
|
251
273
|
"Content-Type": "application/json",
|
252
274
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
275
|
+
"X-Xata-Client-ID": clientID ?? "",
|
276
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
253
277
|
...headers,
|
254
278
|
...hostHeader(fullUrl),
|
255
279
|
Authorization: `Bearer ${apiKey}`
|
256
|
-
}
|
280
|
+
},
|
281
|
+
signal
|
257
282
|
});
|
258
283
|
if (response.status === 204) {
|
259
284
|
return {};
|
@@ -261,6 +286,7 @@ async function fetch$1({
|
|
261
286
|
const { host, protocol } = parseUrl(response.url);
|
262
287
|
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
263
288
|
setAttributes({
|
289
|
+
[TraceAttributes.KIND]: "http",
|
264
290
|
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
265
291
|
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
266
292
|
[TraceAttributes.HTTP_HOST]: host,
|
@@ -273,9 +299,7 @@ async function fetch$1({
|
|
273
299
|
}
|
274
300
|
throw new FetcherError(response.status, jsonResponse, requestId);
|
275
301
|
} catch (error) {
|
276
|
-
|
277
|
-
onError(fetcherError.message);
|
278
|
-
throw fetcherError;
|
302
|
+
throw new FetcherError(response.status, error, requestId);
|
279
303
|
}
|
280
304
|
},
|
281
305
|
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
@@ -290,245 +314,163 @@ function parseUrl(url) {
|
|
290
314
|
}
|
291
315
|
}
|
292
316
|
|
293
|
-
const
|
294
|
-
|
295
|
-
const
|
296
|
-
const
|
297
|
-
url: "/user/keys",
|
298
|
-
method: "get",
|
299
|
-
...variables
|
300
|
-
});
|
301
|
-
const createUserAPIKey = (variables) => fetch$1({
|
302
|
-
url: "/user/keys/{keyName}",
|
303
|
-
method: "post",
|
304
|
-
...variables
|
305
|
-
});
|
306
|
-
const deleteUserAPIKey = (variables) => fetch$1({
|
307
|
-
url: "/user/keys/{keyName}",
|
308
|
-
method: "delete",
|
309
|
-
...variables
|
310
|
-
});
|
311
|
-
const createWorkspace = (variables) => fetch$1({
|
312
|
-
url: "/workspaces",
|
313
|
-
method: "post",
|
314
|
-
...variables
|
315
|
-
});
|
316
|
-
const getWorkspacesList = (variables) => fetch$1({
|
317
|
-
url: "/workspaces",
|
318
|
-
method: "get",
|
319
|
-
...variables
|
320
|
-
});
|
321
|
-
const getWorkspace = (variables) => fetch$1({
|
322
|
-
url: "/workspaces/{workspaceId}",
|
323
|
-
method: "get",
|
324
|
-
...variables
|
325
|
-
});
|
326
|
-
const updateWorkspace = (variables) => fetch$1({
|
327
|
-
url: "/workspaces/{workspaceId}",
|
328
|
-
method: "put",
|
329
|
-
...variables
|
330
|
-
});
|
331
|
-
const deleteWorkspace = (variables) => fetch$1({
|
332
|
-
url: "/workspaces/{workspaceId}",
|
333
|
-
method: "delete",
|
334
|
-
...variables
|
335
|
-
});
|
336
|
-
const getWorkspaceMembersList = (variables) => fetch$1({
|
337
|
-
url: "/workspaces/{workspaceId}/members",
|
338
|
-
method: "get",
|
339
|
-
...variables
|
340
|
-
});
|
341
|
-
const updateWorkspaceMemberRole = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables });
|
342
|
-
const removeWorkspaceMember = (variables) => fetch$1({
|
343
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
344
|
-
method: "delete",
|
345
|
-
...variables
|
346
|
-
});
|
347
|
-
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
348
|
-
const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
349
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
350
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
351
|
-
method: "delete",
|
352
|
-
...variables
|
353
|
-
});
|
354
|
-
const resendWorkspaceMemberInvite = (variables) => fetch$1({
|
355
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
356
|
-
method: "post",
|
357
|
-
...variables
|
358
|
-
});
|
359
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
360
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
361
|
-
method: "post",
|
362
|
-
...variables
|
363
|
-
});
|
364
|
-
const getDatabaseList = (variables) => fetch$1({
|
365
|
-
url: "/dbs",
|
366
|
-
method: "get",
|
367
|
-
...variables
|
368
|
-
});
|
369
|
-
const getBranchList = (variables) => fetch$1({
|
370
|
-
url: "/dbs/{dbName}",
|
371
|
-
method: "get",
|
372
|
-
...variables
|
373
|
-
});
|
374
|
-
const createDatabase = (variables) => fetch$1({
|
375
|
-
url: "/dbs/{dbName}",
|
376
|
-
method: "put",
|
377
|
-
...variables
|
378
|
-
});
|
379
|
-
const deleteDatabase = (variables) => fetch$1({
|
317
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
318
|
+
|
319
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
320
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
380
321
|
url: "/dbs/{dbName}",
|
381
|
-
method: "delete",
|
382
|
-
...variables
|
383
|
-
});
|
384
|
-
const getDatabaseMetadata = (variables) => fetch$1({
|
385
|
-
url: "/dbs/{dbName}/metadata",
|
386
|
-
method: "get",
|
387
|
-
...variables
|
388
|
-
});
|
389
|
-
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
390
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
391
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
392
|
-
const resolveBranch = (variables) => fetch$1({
|
393
|
-
url: "/dbs/{dbName}/resolveBranch",
|
394
322
|
method: "get",
|
395
|
-
...variables
|
323
|
+
...variables,
|
324
|
+
signal
|
396
325
|
});
|
397
|
-
const
|
326
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
327
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
328
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
329
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
330
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
398
331
|
url: "/db/{dbBranchName}",
|
399
332
|
method: "get",
|
400
|
-
...variables
|
333
|
+
...variables,
|
334
|
+
signal
|
401
335
|
});
|
402
|
-
const createBranch = (variables) =>
|
403
|
-
const deleteBranch = (variables) =>
|
336
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
337
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
404
338
|
url: "/db/{dbBranchName}",
|
405
339
|
method: "delete",
|
406
|
-
...variables
|
340
|
+
...variables,
|
341
|
+
signal
|
407
342
|
});
|
408
|
-
const updateBranchMetadata = (variables) =>
|
343
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
409
344
|
url: "/db/{dbBranchName}/metadata",
|
410
345
|
method: "put",
|
411
|
-
...variables
|
346
|
+
...variables,
|
347
|
+
signal
|
412
348
|
});
|
413
|
-
const getBranchMetadata = (variables) =>
|
349
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
414
350
|
url: "/db/{dbBranchName}/metadata",
|
415
351
|
method: "get",
|
416
|
-
...variables
|
352
|
+
...variables,
|
353
|
+
signal
|
417
354
|
});
|
418
|
-
const
|
419
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
420
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
421
|
-
const getBranchStats = (variables) => fetch$1({
|
355
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
422
356
|
url: "/db/{dbBranchName}/stats",
|
423
357
|
method: "get",
|
424
|
-
...variables
|
358
|
+
...variables,
|
359
|
+
signal
|
360
|
+
});
|
361
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
362
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
363
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
364
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
365
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
366
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
367
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
368
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
369
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
370
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
371
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
372
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
373
|
+
method: "get",
|
374
|
+
...variables,
|
375
|
+
signal
|
376
|
+
});
|
377
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
378
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
379
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
380
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
381
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
382
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
383
|
+
method: "post",
|
384
|
+
...variables,
|
385
|
+
signal
|
425
386
|
});
|
426
|
-
const
|
387
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
388
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
389
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
390
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
391
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
392
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
393
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
427
394
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
428
395
|
method: "put",
|
429
|
-
...variables
|
396
|
+
...variables,
|
397
|
+
signal
|
430
398
|
});
|
431
|
-
const deleteTable = (variables) =>
|
399
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
432
400
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
433
401
|
method: "delete",
|
434
|
-
...variables
|
435
|
-
|
436
|
-
const updateTable = (variables) => fetch$1({
|
437
|
-
url: "/db/{dbBranchName}/tables/{tableName}",
|
438
|
-
method: "patch",
|
439
|
-
...variables
|
402
|
+
...variables,
|
403
|
+
signal
|
440
404
|
});
|
441
|
-
const
|
405
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
406
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
442
407
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
443
408
|
method: "get",
|
444
|
-
...variables
|
409
|
+
...variables,
|
410
|
+
signal
|
445
411
|
});
|
446
|
-
const setTableSchema = (variables) =>
|
447
|
-
|
448
|
-
method: "put",
|
449
|
-
...variables
|
450
|
-
});
|
451
|
-
const getTableColumns = (variables) => fetch$1({
|
412
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
413
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
452
414
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
453
415
|
method: "get",
|
454
|
-
...variables
|
416
|
+
...variables,
|
417
|
+
signal
|
455
418
|
});
|
456
|
-
const addTableColumn = (variables) =>
|
457
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
458
|
-
|
459
|
-
|
460
|
-
});
|
461
|
-
const getColumn = (variables) => fetch$1({
|
419
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
420
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
421
|
+
);
|
422
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
462
423
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
463
424
|
method: "get",
|
464
|
-
...variables
|
465
|
-
|
466
|
-
const deleteColumn = (variables) => fetch$1({
|
467
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
468
|
-
method: "delete",
|
469
|
-
...variables
|
425
|
+
...variables,
|
426
|
+
signal
|
470
427
|
});
|
471
|
-
const updateColumn = (variables) =>
|
428
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
429
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
472
430
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
473
|
-
method: "patch",
|
474
|
-
...variables
|
475
|
-
});
|
476
|
-
const insertRecord = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables });
|
477
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
478
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
479
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
480
|
-
const deleteRecord = (variables) => fetch$1({
|
481
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
482
431
|
method: "delete",
|
483
|
-
...variables
|
432
|
+
...variables,
|
433
|
+
signal
|
484
434
|
});
|
485
|
-
const
|
435
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
436
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
486
437
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
487
438
|
method: "get",
|
488
|
-
...variables
|
439
|
+
...variables,
|
440
|
+
signal
|
489
441
|
});
|
490
|
-
const
|
491
|
-
const
|
442
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
443
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
444
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
445
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
446
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
447
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
492
448
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
493
449
|
method: "post",
|
494
|
-
...variables
|
450
|
+
...variables,
|
451
|
+
signal
|
495
452
|
});
|
496
|
-
const
|
497
|
-
url: "/db/{dbBranchName}/
|
453
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
454
|
+
url: "/db/{dbBranchName}/search",
|
498
455
|
method: "post",
|
499
|
-
...variables
|
456
|
+
...variables,
|
457
|
+
signal
|
500
458
|
});
|
501
|
-
const
|
502
|
-
url: "/db/{dbBranchName}/search",
|
459
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
460
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
503
461
|
method: "post",
|
504
|
-
...variables
|
462
|
+
...variables,
|
463
|
+
signal
|
505
464
|
});
|
506
|
-
const
|
507
|
-
|
508
|
-
|
509
|
-
createWorkspace,
|
510
|
-
getWorkspacesList,
|
511
|
-
getWorkspace,
|
512
|
-
updateWorkspace,
|
513
|
-
deleteWorkspace,
|
514
|
-
getWorkspaceMembersList,
|
515
|
-
updateWorkspaceMemberRole,
|
516
|
-
removeWorkspaceMember,
|
517
|
-
inviteWorkspaceMember,
|
518
|
-
updateWorkspaceMemberInvite,
|
519
|
-
cancelWorkspaceMemberInvite,
|
520
|
-
resendWorkspaceMemberInvite,
|
521
|
-
acceptWorkspaceMemberInvite
|
522
|
-
},
|
465
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
466
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
467
|
+
const operationsByTag$2 = {
|
523
468
|
database: {
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
addGitBranchesEntry,
|
530
|
-
removeGitBranchesEntry,
|
531
|
-
resolveBranch
|
469
|
+
dEPRECATEDgetDatabaseList,
|
470
|
+
dEPRECATEDcreateDatabase,
|
471
|
+
dEPRECATEDdeleteDatabase,
|
472
|
+
dEPRECATEDgetDatabaseMetadata,
|
473
|
+
dEPRECATEDupdateDatabaseMetadata
|
532
474
|
},
|
533
475
|
branch: {
|
534
476
|
getBranchList,
|
@@ -537,10 +479,42 @@ const operationsByTag = {
|
|
537
479
|
deleteBranch,
|
538
480
|
updateBranchMetadata,
|
539
481
|
getBranchMetadata,
|
482
|
+
getBranchStats,
|
483
|
+
getGitBranchesMapping,
|
484
|
+
addGitBranchesEntry,
|
485
|
+
removeGitBranchesEntry,
|
486
|
+
resolveBranch
|
487
|
+
},
|
488
|
+
migrations: {
|
540
489
|
getBranchMigrationHistory,
|
541
|
-
executeBranchMigrationPlan,
|
542
490
|
getBranchMigrationPlan,
|
543
|
-
|
491
|
+
executeBranchMigrationPlan,
|
492
|
+
getBranchSchemaHistory,
|
493
|
+
compareBranchWithUserSchema,
|
494
|
+
compareBranchSchemas,
|
495
|
+
updateBranchSchema,
|
496
|
+
previewBranchSchemaEdit,
|
497
|
+
applyBranchSchemaEdit
|
498
|
+
},
|
499
|
+
records: {
|
500
|
+
branchTransaction,
|
501
|
+
insertRecord,
|
502
|
+
getRecord,
|
503
|
+
insertRecordWithID,
|
504
|
+
updateRecordWithID,
|
505
|
+
upsertRecordWithID,
|
506
|
+
deleteRecord,
|
507
|
+
bulkInsertTableRecords
|
508
|
+
},
|
509
|
+
migrationRequests: {
|
510
|
+
queryMigrationRequests,
|
511
|
+
createMigrationRequest,
|
512
|
+
getMigrationRequest,
|
513
|
+
updateMigrationRequest,
|
514
|
+
listMigrationRequestsCommits,
|
515
|
+
compareMigrationRequest,
|
516
|
+
getMigrationRequestIsMerged,
|
517
|
+
mergeMigrationRequest
|
544
518
|
},
|
545
519
|
table: {
|
546
520
|
createTable,
|
@@ -551,23 +525,146 @@ const operationsByTag = {
|
|
551
525
|
getTableColumns,
|
552
526
|
addTableColumn,
|
553
527
|
getColumn,
|
554
|
-
|
555
|
-
|
528
|
+
updateColumn,
|
529
|
+
deleteColumn
|
556
530
|
},
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
531
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
532
|
+
};
|
533
|
+
|
534
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
535
|
+
|
536
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
537
|
+
url: "/user",
|
538
|
+
method: "get",
|
539
|
+
...variables,
|
540
|
+
signal
|
541
|
+
});
|
542
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
543
|
+
url: "/user",
|
544
|
+
method: "put",
|
545
|
+
...variables,
|
546
|
+
signal
|
547
|
+
});
|
548
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
549
|
+
url: "/user",
|
550
|
+
method: "delete",
|
551
|
+
...variables,
|
552
|
+
signal
|
553
|
+
});
|
554
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
555
|
+
url: "/user/keys",
|
556
|
+
method: "get",
|
557
|
+
...variables,
|
558
|
+
signal
|
559
|
+
});
|
560
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
561
|
+
url: "/user/keys/{keyName}",
|
562
|
+
method: "post",
|
563
|
+
...variables,
|
564
|
+
signal
|
565
|
+
});
|
566
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
567
|
+
url: "/user/keys/{keyName}",
|
568
|
+
method: "delete",
|
569
|
+
...variables,
|
570
|
+
signal
|
571
|
+
});
|
572
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
573
|
+
url: "/workspaces",
|
574
|
+
method: "get",
|
575
|
+
...variables,
|
576
|
+
signal
|
577
|
+
});
|
578
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
579
|
+
url: "/workspaces",
|
580
|
+
method: "post",
|
581
|
+
...variables,
|
582
|
+
signal
|
583
|
+
});
|
584
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
585
|
+
url: "/workspaces/{workspaceId}",
|
586
|
+
method: "get",
|
587
|
+
...variables,
|
588
|
+
signal
|
589
|
+
});
|
590
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
591
|
+
url: "/workspaces/{workspaceId}",
|
592
|
+
method: "put",
|
593
|
+
...variables,
|
594
|
+
signal
|
595
|
+
});
|
596
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
597
|
+
url: "/workspaces/{workspaceId}",
|
598
|
+
method: "delete",
|
599
|
+
...variables,
|
600
|
+
signal
|
601
|
+
});
|
602
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
603
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
604
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
605
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
606
|
+
method: "delete",
|
607
|
+
...variables,
|
608
|
+
signal
|
609
|
+
});
|
610
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
611
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
612
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
613
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
614
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
615
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
616
|
+
url: "/workspaces/{workspaceId}/dbs",
|
617
|
+
method: "get",
|
618
|
+
...variables,
|
619
|
+
signal
|
620
|
+
});
|
621
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
622
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
623
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
624
|
+
method: "delete",
|
625
|
+
...variables,
|
626
|
+
signal
|
627
|
+
});
|
628
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
629
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
630
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
631
|
+
url: "/workspaces/{workspaceId}/regions",
|
632
|
+
method: "get",
|
633
|
+
...variables,
|
634
|
+
signal
|
635
|
+
});
|
636
|
+
const operationsByTag$1 = {
|
637
|
+
users: { getUser, updateUser, deleteUser },
|
638
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
639
|
+
workspaces: {
|
640
|
+
getWorkspacesList,
|
641
|
+
createWorkspace,
|
642
|
+
getWorkspace,
|
643
|
+
updateWorkspace,
|
644
|
+
deleteWorkspace,
|
645
|
+
getWorkspaceMembersList,
|
646
|
+
updateWorkspaceMemberRole,
|
647
|
+
removeWorkspaceMember
|
648
|
+
},
|
649
|
+
invites: {
|
650
|
+
inviteWorkspaceMember,
|
651
|
+
updateWorkspaceMemberInvite,
|
652
|
+
cancelWorkspaceMemberInvite,
|
653
|
+
acceptWorkspaceMemberInvite,
|
654
|
+
resendWorkspaceMemberInvite
|
655
|
+
},
|
656
|
+
databases: {
|
657
|
+
getDatabaseList,
|
658
|
+
createDatabase,
|
659
|
+
deleteDatabase,
|
660
|
+
getDatabaseMetadata,
|
661
|
+
updateDatabaseMetadata,
|
662
|
+
listRegions
|
568
663
|
}
|
569
664
|
};
|
570
665
|
|
666
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
667
|
+
|
571
668
|
function getHostUrl(provider, type) {
|
572
669
|
if (isHostProviderAlias(provider)) {
|
573
670
|
return providers[provider][type];
|
@@ -579,11 +676,11 @@ function getHostUrl(provider, type) {
|
|
579
676
|
const providers = {
|
580
677
|
production: {
|
581
678
|
main: "https://api.xata.io",
|
582
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
679
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
583
680
|
},
|
584
681
|
staging: {
|
585
682
|
main: "https://staging.xatabase.co",
|
586
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
683
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
587
684
|
}
|
588
685
|
};
|
589
686
|
function isHostProviderAlias(alias) {
|
@@ -592,6 +689,25 @@ function isHostProviderAlias(alias) {
|
|
592
689
|
function isHostProviderBuilder(builder) {
|
593
690
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
594
691
|
}
|
692
|
+
function parseProviderString(provider = "production") {
|
693
|
+
if (isHostProviderAlias(provider)) {
|
694
|
+
return provider;
|
695
|
+
}
|
696
|
+
const [main, workspaces] = provider.split(",");
|
697
|
+
if (!main || !workspaces)
|
698
|
+
return null;
|
699
|
+
return { main, workspaces };
|
700
|
+
}
|
701
|
+
function parseWorkspacesUrlParts(url) {
|
702
|
+
if (!isString(url))
|
703
|
+
return null;
|
704
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
705
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
706
|
+
const match = url.match(regex) || url.match(regexStaging);
|
707
|
+
if (!match)
|
708
|
+
return null;
|
709
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
710
|
+
}
|
595
711
|
|
596
712
|
var __accessCheck$7 = (obj, member, msg) => {
|
597
713
|
if (!member.has(obj))
|
@@ -635,21 +751,41 @@ class XataApiClient {
|
|
635
751
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
636
752
|
return __privateGet$7(this, _namespaces).user;
|
637
753
|
}
|
754
|
+
get authentication() {
|
755
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
756
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
757
|
+
return __privateGet$7(this, _namespaces).authentication;
|
758
|
+
}
|
638
759
|
get workspaces() {
|
639
760
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
640
761
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
641
762
|
return __privateGet$7(this, _namespaces).workspaces;
|
642
763
|
}
|
643
|
-
get
|
644
|
-
if (!__privateGet$7(this, _namespaces).
|
645
|
-
__privateGet$7(this, _namespaces).
|
646
|
-
return __privateGet$7(this, _namespaces).
|
764
|
+
get invites() {
|
765
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
766
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
767
|
+
return __privateGet$7(this, _namespaces).invites;
|
768
|
+
}
|
769
|
+
get database() {
|
770
|
+
if (!__privateGet$7(this, _namespaces).database)
|
771
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
772
|
+
return __privateGet$7(this, _namespaces).database;
|
647
773
|
}
|
648
774
|
get branches() {
|
649
775
|
if (!__privateGet$7(this, _namespaces).branches)
|
650
776
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
651
777
|
return __privateGet$7(this, _namespaces).branches;
|
652
778
|
}
|
779
|
+
get migrations() {
|
780
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
781
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
782
|
+
return __privateGet$7(this, _namespaces).migrations;
|
783
|
+
}
|
784
|
+
get migrationRequests() {
|
785
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
786
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
787
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
788
|
+
}
|
653
789
|
get tables() {
|
654
790
|
if (!__privateGet$7(this, _namespaces).tables)
|
655
791
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -660,6 +796,11 @@ class XataApiClient {
|
|
660
796
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
661
797
|
return __privateGet$7(this, _namespaces).records;
|
662
798
|
}
|
799
|
+
get searchAndFilter() {
|
800
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
801
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
802
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
803
|
+
}
|
663
804
|
}
|
664
805
|
_extraProps = new WeakMap();
|
665
806
|
_namespaces = new WeakMap();
|
@@ -670,24 +811,29 @@ class UserApi {
|
|
670
811
|
getUser() {
|
671
812
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
672
813
|
}
|
673
|
-
updateUser(user) {
|
814
|
+
updateUser({ user }) {
|
674
815
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
675
816
|
}
|
676
817
|
deleteUser() {
|
677
818
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
678
819
|
}
|
820
|
+
}
|
821
|
+
class AuthenticationApi {
|
822
|
+
constructor(extraProps) {
|
823
|
+
this.extraProps = extraProps;
|
824
|
+
}
|
679
825
|
getUserAPIKeys() {
|
680
|
-
return operationsByTag.
|
826
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
681
827
|
}
|
682
|
-
createUserAPIKey(
|
683
|
-
return operationsByTag.
|
684
|
-
pathParams: { keyName },
|
828
|
+
createUserAPIKey({ name }) {
|
829
|
+
return operationsByTag.authentication.createUserAPIKey({
|
830
|
+
pathParams: { keyName: name },
|
685
831
|
...this.extraProps
|
686
832
|
});
|
687
833
|
}
|
688
|
-
deleteUserAPIKey(
|
689
|
-
return operationsByTag.
|
690
|
-
pathParams: { keyName },
|
834
|
+
deleteUserAPIKey({ name }) {
|
835
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
836
|
+
pathParams: { keyName: name },
|
691
837
|
...this.extraProps
|
692
838
|
});
|
693
839
|
}
|
@@ -696,139 +842,114 @@ class WorkspaceApi {
|
|
696
842
|
constructor(extraProps) {
|
697
843
|
this.extraProps = extraProps;
|
698
844
|
}
|
699
|
-
|
845
|
+
getWorkspacesList() {
|
846
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
847
|
+
}
|
848
|
+
createWorkspace({ data }) {
|
700
849
|
return operationsByTag.workspaces.createWorkspace({
|
701
|
-
body:
|
850
|
+
body: data,
|
702
851
|
...this.extraProps
|
703
852
|
});
|
704
853
|
}
|
705
|
-
|
706
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
707
|
-
}
|
708
|
-
getWorkspace(workspaceId) {
|
854
|
+
getWorkspace({ workspace }) {
|
709
855
|
return operationsByTag.workspaces.getWorkspace({
|
710
|
-
pathParams: { workspaceId },
|
856
|
+
pathParams: { workspaceId: workspace },
|
711
857
|
...this.extraProps
|
712
858
|
});
|
713
859
|
}
|
714
|
-
updateWorkspace(
|
860
|
+
updateWorkspace({
|
861
|
+
workspace,
|
862
|
+
update
|
863
|
+
}) {
|
715
864
|
return operationsByTag.workspaces.updateWorkspace({
|
716
|
-
pathParams: { workspaceId },
|
717
|
-
body:
|
865
|
+
pathParams: { workspaceId: workspace },
|
866
|
+
body: update,
|
718
867
|
...this.extraProps
|
719
868
|
});
|
720
869
|
}
|
721
|
-
deleteWorkspace(
|
870
|
+
deleteWorkspace({ workspace }) {
|
722
871
|
return operationsByTag.workspaces.deleteWorkspace({
|
723
|
-
pathParams: { workspaceId },
|
872
|
+
pathParams: { workspaceId: workspace },
|
724
873
|
...this.extraProps
|
725
874
|
});
|
726
875
|
}
|
727
|
-
getWorkspaceMembersList(
|
876
|
+
getWorkspaceMembersList({ workspace }) {
|
728
877
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
729
|
-
pathParams: { workspaceId },
|
878
|
+
pathParams: { workspaceId: workspace },
|
730
879
|
...this.extraProps
|
731
880
|
});
|
732
881
|
}
|
733
|
-
updateWorkspaceMemberRole(
|
882
|
+
updateWorkspaceMemberRole({
|
883
|
+
workspace,
|
884
|
+
user,
|
885
|
+
role
|
886
|
+
}) {
|
734
887
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
735
|
-
pathParams: { workspaceId, userId },
|
888
|
+
pathParams: { workspaceId: workspace, userId: user },
|
736
889
|
body: { role },
|
737
890
|
...this.extraProps
|
738
891
|
});
|
739
892
|
}
|
740
|
-
removeWorkspaceMember(
|
893
|
+
removeWorkspaceMember({
|
894
|
+
workspace,
|
895
|
+
user
|
896
|
+
}) {
|
741
897
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
742
|
-
pathParams: { workspaceId, userId },
|
743
|
-
...this.extraProps
|
744
|
-
});
|
745
|
-
}
|
746
|
-
inviteWorkspaceMember(workspaceId, email, role) {
|
747
|
-
return operationsByTag.workspaces.inviteWorkspaceMember({
|
748
|
-
pathParams: { workspaceId },
|
749
|
-
body: { email, role },
|
750
|
-
...this.extraProps
|
751
|
-
});
|
752
|
-
}
|
753
|
-
updateWorkspaceMemberInvite(workspaceId, inviteId, role) {
|
754
|
-
return operationsByTag.workspaces.updateWorkspaceMemberInvite({
|
755
|
-
pathParams: { workspaceId, inviteId },
|
756
|
-
body: { role },
|
757
|
-
...this.extraProps
|
758
|
-
});
|
759
|
-
}
|
760
|
-
cancelWorkspaceMemberInvite(workspaceId, inviteId) {
|
761
|
-
return operationsByTag.workspaces.cancelWorkspaceMemberInvite({
|
762
|
-
pathParams: { workspaceId, inviteId },
|
763
|
-
...this.extraProps
|
764
|
-
});
|
765
|
-
}
|
766
|
-
resendWorkspaceMemberInvite(workspaceId, inviteId) {
|
767
|
-
return operationsByTag.workspaces.resendWorkspaceMemberInvite({
|
768
|
-
pathParams: { workspaceId, inviteId },
|
769
|
-
...this.extraProps
|
770
|
-
});
|
771
|
-
}
|
772
|
-
acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
|
773
|
-
return operationsByTag.workspaces.acceptWorkspaceMemberInvite({
|
774
|
-
pathParams: { workspaceId, inviteKey },
|
898
|
+
pathParams: { workspaceId: workspace, userId: user },
|
775
899
|
...this.extraProps
|
776
900
|
});
|
777
901
|
}
|
778
902
|
}
|
779
|
-
class
|
903
|
+
class InvitesApi {
|
780
904
|
constructor(extraProps) {
|
781
905
|
this.extraProps = extraProps;
|
782
906
|
}
|
783
|
-
|
784
|
-
|
785
|
-
|
786
|
-
|
787
|
-
|
788
|
-
|
789
|
-
|
790
|
-
|
791
|
-
pathParams: { workspace, dbName },
|
792
|
-
body: options,
|
793
|
-
...this.extraProps
|
794
|
-
});
|
795
|
-
}
|
796
|
-
deleteDatabase(workspace, dbName) {
|
797
|
-
return operationsByTag.database.deleteDatabase({
|
798
|
-
pathParams: { workspace, dbName },
|
799
|
-
...this.extraProps
|
800
|
-
});
|
801
|
-
}
|
802
|
-
getDatabaseMetadata(workspace, dbName) {
|
803
|
-
return operationsByTag.database.getDatabaseMetadata({
|
804
|
-
pathParams: { workspace, dbName },
|
907
|
+
inviteWorkspaceMember({
|
908
|
+
workspace,
|
909
|
+
email,
|
910
|
+
role
|
911
|
+
}) {
|
912
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
913
|
+
pathParams: { workspaceId: workspace },
|
914
|
+
body: { email, role },
|
805
915
|
...this.extraProps
|
806
916
|
});
|
807
917
|
}
|
808
|
-
|
809
|
-
|
810
|
-
|
918
|
+
updateWorkspaceMemberInvite({
|
919
|
+
workspace,
|
920
|
+
invite,
|
921
|
+
role
|
922
|
+
}) {
|
923
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
924
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
925
|
+
body: { role },
|
811
926
|
...this.extraProps
|
812
927
|
});
|
813
928
|
}
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
929
|
+
cancelWorkspaceMemberInvite({
|
930
|
+
workspace,
|
931
|
+
invite
|
932
|
+
}) {
|
933
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
934
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
818
935
|
...this.extraProps
|
819
936
|
});
|
820
937
|
}
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
938
|
+
acceptWorkspaceMemberInvite({
|
939
|
+
workspace,
|
940
|
+
key
|
941
|
+
}) {
|
942
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
943
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
825
944
|
...this.extraProps
|
826
945
|
});
|
827
946
|
}
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
947
|
+
resendWorkspaceMemberInvite({
|
948
|
+
workspace,
|
949
|
+
invite
|
950
|
+
}) {
|
951
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
952
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
832
953
|
...this.extraProps
|
833
954
|
});
|
834
955
|
}
|
@@ -837,69 +958,132 @@ class BranchApi {
|
|
837
958
|
constructor(extraProps) {
|
838
959
|
this.extraProps = extraProps;
|
839
960
|
}
|
840
|
-
getBranchList(
|
961
|
+
getBranchList({
|
962
|
+
workspace,
|
963
|
+
region,
|
964
|
+
database
|
965
|
+
}) {
|
841
966
|
return operationsByTag.branch.getBranchList({
|
842
|
-
pathParams: { workspace, dbName },
|
967
|
+
pathParams: { workspace, region, dbName: database },
|
843
968
|
...this.extraProps
|
844
969
|
});
|
845
970
|
}
|
846
|
-
getBranchDetails(
|
971
|
+
getBranchDetails({
|
972
|
+
workspace,
|
973
|
+
region,
|
974
|
+
database,
|
975
|
+
branch
|
976
|
+
}) {
|
847
977
|
return operationsByTag.branch.getBranchDetails({
|
848
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
978
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
849
979
|
...this.extraProps
|
850
980
|
});
|
851
981
|
}
|
852
|
-
createBranch(
|
982
|
+
createBranch({
|
983
|
+
workspace,
|
984
|
+
region,
|
985
|
+
database,
|
986
|
+
branch,
|
987
|
+
from,
|
988
|
+
metadata
|
989
|
+
}) {
|
853
990
|
return operationsByTag.branch.createBranch({
|
854
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
855
|
-
|
856
|
-
body: options,
|
991
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
992
|
+
body: { from, metadata },
|
857
993
|
...this.extraProps
|
858
994
|
});
|
859
995
|
}
|
860
|
-
deleteBranch(
|
996
|
+
deleteBranch({
|
997
|
+
workspace,
|
998
|
+
region,
|
999
|
+
database,
|
1000
|
+
branch
|
1001
|
+
}) {
|
861
1002
|
return operationsByTag.branch.deleteBranch({
|
862
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1003
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
863
1004
|
...this.extraProps
|
864
1005
|
});
|
865
1006
|
}
|
866
|
-
updateBranchMetadata(
|
1007
|
+
updateBranchMetadata({
|
1008
|
+
workspace,
|
1009
|
+
region,
|
1010
|
+
database,
|
1011
|
+
branch,
|
1012
|
+
metadata
|
1013
|
+
}) {
|
867
1014
|
return operationsByTag.branch.updateBranchMetadata({
|
868
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1015
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
869
1016
|
body: metadata,
|
870
1017
|
...this.extraProps
|
871
1018
|
});
|
872
1019
|
}
|
873
|
-
getBranchMetadata(
|
1020
|
+
getBranchMetadata({
|
1021
|
+
workspace,
|
1022
|
+
region,
|
1023
|
+
database,
|
1024
|
+
branch
|
1025
|
+
}) {
|
874
1026
|
return operationsByTag.branch.getBranchMetadata({
|
875
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1027
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
876
1028
|
...this.extraProps
|
877
1029
|
});
|
878
1030
|
}
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
1031
|
+
getBranchStats({
|
1032
|
+
workspace,
|
1033
|
+
region,
|
1034
|
+
database,
|
1035
|
+
branch
|
1036
|
+
}) {
|
1037
|
+
return operationsByTag.branch.getBranchStats({
|
1038
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
883
1039
|
...this.extraProps
|
884
1040
|
});
|
885
1041
|
}
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
1042
|
+
getGitBranchesMapping({
|
1043
|
+
workspace,
|
1044
|
+
region,
|
1045
|
+
database
|
1046
|
+
}) {
|
1047
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1048
|
+
pathParams: { workspace, region, dbName: database },
|
890
1049
|
...this.extraProps
|
891
1050
|
});
|
892
1051
|
}
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
1052
|
+
addGitBranchesEntry({
|
1053
|
+
workspace,
|
1054
|
+
region,
|
1055
|
+
database,
|
1056
|
+
gitBranch,
|
1057
|
+
xataBranch
|
1058
|
+
}) {
|
1059
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1060
|
+
pathParams: { workspace, region, dbName: database },
|
1061
|
+
body: { gitBranch, xataBranch },
|
897
1062
|
...this.extraProps
|
898
1063
|
});
|
899
1064
|
}
|
900
|
-
|
901
|
-
|
902
|
-
|
1065
|
+
removeGitBranchesEntry({
|
1066
|
+
workspace,
|
1067
|
+
region,
|
1068
|
+
database,
|
1069
|
+
gitBranch
|
1070
|
+
}) {
|
1071
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1072
|
+
pathParams: { workspace, region, dbName: database },
|
1073
|
+
queryParams: { gitBranch },
|
1074
|
+
...this.extraProps
|
1075
|
+
});
|
1076
|
+
}
|
1077
|
+
resolveBranch({
|
1078
|
+
workspace,
|
1079
|
+
region,
|
1080
|
+
database,
|
1081
|
+
gitBranch,
|
1082
|
+
fallbackBranch
|
1083
|
+
}) {
|
1084
|
+
return operationsByTag.branch.resolveBranch({
|
1085
|
+
pathParams: { workspace, region, dbName: database },
|
1086
|
+
queryParams: { gitBranch, fallbackBranch },
|
903
1087
|
...this.extraProps
|
904
1088
|
});
|
905
1089
|
}
|
@@ -908,67 +1092,134 @@ class TableApi {
|
|
908
1092
|
constructor(extraProps) {
|
909
1093
|
this.extraProps = extraProps;
|
910
1094
|
}
|
911
|
-
createTable(
|
1095
|
+
createTable({
|
1096
|
+
workspace,
|
1097
|
+
region,
|
1098
|
+
database,
|
1099
|
+
branch,
|
1100
|
+
table
|
1101
|
+
}) {
|
912
1102
|
return operationsByTag.table.createTable({
|
913
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1103
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
914
1104
|
...this.extraProps
|
915
1105
|
});
|
916
1106
|
}
|
917
|
-
deleteTable(
|
1107
|
+
deleteTable({
|
1108
|
+
workspace,
|
1109
|
+
region,
|
1110
|
+
database,
|
1111
|
+
branch,
|
1112
|
+
table
|
1113
|
+
}) {
|
918
1114
|
return operationsByTag.table.deleteTable({
|
919
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1115
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
920
1116
|
...this.extraProps
|
921
1117
|
});
|
922
1118
|
}
|
923
|
-
updateTable(
|
1119
|
+
updateTable({
|
1120
|
+
workspace,
|
1121
|
+
region,
|
1122
|
+
database,
|
1123
|
+
branch,
|
1124
|
+
table,
|
1125
|
+
update
|
1126
|
+
}) {
|
924
1127
|
return operationsByTag.table.updateTable({
|
925
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
926
|
-
body:
|
1128
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1129
|
+
body: update,
|
927
1130
|
...this.extraProps
|
928
1131
|
});
|
929
1132
|
}
|
930
|
-
getTableSchema(
|
1133
|
+
getTableSchema({
|
1134
|
+
workspace,
|
1135
|
+
region,
|
1136
|
+
database,
|
1137
|
+
branch,
|
1138
|
+
table
|
1139
|
+
}) {
|
931
1140
|
return operationsByTag.table.getTableSchema({
|
932
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1141
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
933
1142
|
...this.extraProps
|
934
1143
|
});
|
935
1144
|
}
|
936
|
-
setTableSchema(
|
1145
|
+
setTableSchema({
|
1146
|
+
workspace,
|
1147
|
+
region,
|
1148
|
+
database,
|
1149
|
+
branch,
|
1150
|
+
table,
|
1151
|
+
schema
|
1152
|
+
}) {
|
937
1153
|
return operationsByTag.table.setTableSchema({
|
938
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
939
|
-
body:
|
1154
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1155
|
+
body: schema,
|
940
1156
|
...this.extraProps
|
941
1157
|
});
|
942
1158
|
}
|
943
|
-
getTableColumns(
|
1159
|
+
getTableColumns({
|
1160
|
+
workspace,
|
1161
|
+
region,
|
1162
|
+
database,
|
1163
|
+
branch,
|
1164
|
+
table
|
1165
|
+
}) {
|
944
1166
|
return operationsByTag.table.getTableColumns({
|
945
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1167
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
946
1168
|
...this.extraProps
|
947
1169
|
});
|
948
1170
|
}
|
949
|
-
addTableColumn(
|
1171
|
+
addTableColumn({
|
1172
|
+
workspace,
|
1173
|
+
region,
|
1174
|
+
database,
|
1175
|
+
branch,
|
1176
|
+
table,
|
1177
|
+
column
|
1178
|
+
}) {
|
950
1179
|
return operationsByTag.table.addTableColumn({
|
951
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1180
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
952
1181
|
body: column,
|
953
1182
|
...this.extraProps
|
954
1183
|
});
|
955
1184
|
}
|
956
|
-
getColumn(
|
1185
|
+
getColumn({
|
1186
|
+
workspace,
|
1187
|
+
region,
|
1188
|
+
database,
|
1189
|
+
branch,
|
1190
|
+
table,
|
1191
|
+
column
|
1192
|
+
}) {
|
957
1193
|
return operationsByTag.table.getColumn({
|
958
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1194
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
959
1195
|
...this.extraProps
|
960
1196
|
});
|
961
1197
|
}
|
962
|
-
|
963
|
-
|
964
|
-
|
1198
|
+
updateColumn({
|
1199
|
+
workspace,
|
1200
|
+
region,
|
1201
|
+
database,
|
1202
|
+
branch,
|
1203
|
+
table,
|
1204
|
+
column,
|
1205
|
+
update
|
1206
|
+
}) {
|
1207
|
+
return operationsByTag.table.updateColumn({
|
1208
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1209
|
+
body: update,
|
965
1210
|
...this.extraProps
|
966
1211
|
});
|
967
1212
|
}
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
1213
|
+
deleteColumn({
|
1214
|
+
workspace,
|
1215
|
+
region,
|
1216
|
+
database,
|
1217
|
+
branch,
|
1218
|
+
table,
|
1219
|
+
column
|
1220
|
+
}) {
|
1221
|
+
return operationsByTag.table.deleteColumn({
|
1222
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
972
1223
|
...this.extraProps
|
973
1224
|
});
|
974
1225
|
}
|
@@ -977,78 +1228,509 @@ class RecordsApi {
|
|
977
1228
|
constructor(extraProps) {
|
978
1229
|
this.extraProps = extraProps;
|
979
1230
|
}
|
980
|
-
insertRecord(
|
1231
|
+
insertRecord({
|
1232
|
+
workspace,
|
1233
|
+
region,
|
1234
|
+
database,
|
1235
|
+
branch,
|
1236
|
+
table,
|
1237
|
+
record,
|
1238
|
+
columns
|
1239
|
+
}) {
|
981
1240
|
return operationsByTag.records.insertRecord({
|
982
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
983
|
-
queryParams:
|
1241
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1242
|
+
queryParams: { columns },
|
984
1243
|
body: record,
|
985
1244
|
...this.extraProps
|
986
1245
|
});
|
987
1246
|
}
|
988
|
-
|
1247
|
+
getRecord({
|
1248
|
+
workspace,
|
1249
|
+
region,
|
1250
|
+
database,
|
1251
|
+
branch,
|
1252
|
+
table,
|
1253
|
+
id,
|
1254
|
+
columns
|
1255
|
+
}) {
|
1256
|
+
return operationsByTag.records.getRecord({
|
1257
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1258
|
+
queryParams: { columns },
|
1259
|
+
...this.extraProps
|
1260
|
+
});
|
1261
|
+
}
|
1262
|
+
insertRecordWithID({
|
1263
|
+
workspace,
|
1264
|
+
region,
|
1265
|
+
database,
|
1266
|
+
branch,
|
1267
|
+
table,
|
1268
|
+
id,
|
1269
|
+
record,
|
1270
|
+
columns,
|
1271
|
+
createOnly,
|
1272
|
+
ifVersion
|
1273
|
+
}) {
|
989
1274
|
return operationsByTag.records.insertRecordWithID({
|
990
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
991
|
-
queryParams:
|
1275
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1276
|
+
queryParams: { columns, createOnly, ifVersion },
|
992
1277
|
body: record,
|
993
1278
|
...this.extraProps
|
994
1279
|
});
|
995
1280
|
}
|
996
|
-
updateRecordWithID(
|
1281
|
+
updateRecordWithID({
|
1282
|
+
workspace,
|
1283
|
+
region,
|
1284
|
+
database,
|
1285
|
+
branch,
|
1286
|
+
table,
|
1287
|
+
id,
|
1288
|
+
record,
|
1289
|
+
columns,
|
1290
|
+
ifVersion
|
1291
|
+
}) {
|
997
1292
|
return operationsByTag.records.updateRecordWithID({
|
998
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
999
|
-
queryParams:
|
1293
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1294
|
+
queryParams: { columns, ifVersion },
|
1000
1295
|
body: record,
|
1001
1296
|
...this.extraProps
|
1002
1297
|
});
|
1003
1298
|
}
|
1004
|
-
upsertRecordWithID(
|
1299
|
+
upsertRecordWithID({
|
1300
|
+
workspace,
|
1301
|
+
region,
|
1302
|
+
database,
|
1303
|
+
branch,
|
1304
|
+
table,
|
1305
|
+
id,
|
1306
|
+
record,
|
1307
|
+
columns,
|
1308
|
+
ifVersion
|
1309
|
+
}) {
|
1005
1310
|
return operationsByTag.records.upsertRecordWithID({
|
1006
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1007
|
-
queryParams:
|
1311
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1312
|
+
queryParams: { columns, ifVersion },
|
1008
1313
|
body: record,
|
1009
1314
|
...this.extraProps
|
1010
1315
|
});
|
1011
1316
|
}
|
1012
|
-
deleteRecord(
|
1317
|
+
deleteRecord({
|
1318
|
+
workspace,
|
1319
|
+
region,
|
1320
|
+
database,
|
1321
|
+
branch,
|
1322
|
+
table,
|
1323
|
+
id,
|
1324
|
+
columns
|
1325
|
+
}) {
|
1013
1326
|
return operationsByTag.records.deleteRecord({
|
1014
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1015
|
-
queryParams:
|
1327
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1328
|
+
queryParams: { columns },
|
1016
1329
|
...this.extraProps
|
1017
1330
|
});
|
1018
1331
|
}
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1332
|
+
bulkInsertTableRecords({
|
1333
|
+
workspace,
|
1334
|
+
region,
|
1335
|
+
database,
|
1336
|
+
branch,
|
1337
|
+
table,
|
1338
|
+
records,
|
1339
|
+
columns
|
1340
|
+
}) {
|
1341
|
+
return operationsByTag.records.bulkInsertTableRecords({
|
1342
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1343
|
+
queryParams: { columns },
|
1344
|
+
body: { records },
|
1023
1345
|
...this.extraProps
|
1024
1346
|
});
|
1025
1347
|
}
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1348
|
+
branchTransaction({
|
1349
|
+
workspace,
|
1350
|
+
region,
|
1351
|
+
database,
|
1352
|
+
branch,
|
1353
|
+
operations
|
1354
|
+
}) {
|
1355
|
+
return operationsByTag.records.branchTransaction({
|
1356
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1357
|
+
body: { operations },
|
1358
|
+
...this.extraProps
|
1359
|
+
});
|
1360
|
+
}
|
1361
|
+
}
|
1362
|
+
class SearchAndFilterApi {
|
1363
|
+
constructor(extraProps) {
|
1364
|
+
this.extraProps = extraProps;
|
1365
|
+
}
|
1366
|
+
queryTable({
|
1367
|
+
workspace,
|
1368
|
+
region,
|
1369
|
+
database,
|
1370
|
+
branch,
|
1371
|
+
table,
|
1372
|
+
filter,
|
1373
|
+
sort,
|
1374
|
+
page,
|
1375
|
+
columns
|
1376
|
+
}) {
|
1377
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1378
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1379
|
+
body: { filter, sort, page, columns },
|
1380
|
+
...this.extraProps
|
1381
|
+
});
|
1382
|
+
}
|
1383
|
+
searchTable({
|
1384
|
+
workspace,
|
1385
|
+
region,
|
1386
|
+
database,
|
1387
|
+
branch,
|
1388
|
+
table,
|
1389
|
+
query,
|
1390
|
+
fuzziness,
|
1391
|
+
target,
|
1392
|
+
prefix,
|
1393
|
+
filter,
|
1394
|
+
highlight,
|
1395
|
+
boosters
|
1396
|
+
}) {
|
1397
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1398
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1399
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1400
|
+
...this.extraProps
|
1401
|
+
});
|
1402
|
+
}
|
1403
|
+
searchBranch({
|
1404
|
+
workspace,
|
1405
|
+
region,
|
1406
|
+
database,
|
1407
|
+
branch,
|
1408
|
+
tables,
|
1409
|
+
query,
|
1410
|
+
fuzziness,
|
1411
|
+
prefix,
|
1412
|
+
highlight
|
1413
|
+
}) {
|
1414
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1415
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1416
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1417
|
+
...this.extraProps
|
1418
|
+
});
|
1419
|
+
}
|
1420
|
+
summarizeTable({
|
1421
|
+
workspace,
|
1422
|
+
region,
|
1423
|
+
database,
|
1424
|
+
branch,
|
1425
|
+
table,
|
1426
|
+
filter,
|
1427
|
+
columns,
|
1428
|
+
summaries,
|
1429
|
+
sort,
|
1430
|
+
summariesFilter,
|
1431
|
+
page
|
1432
|
+
}) {
|
1433
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1434
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1435
|
+
body: { filter, columns, summaries, sort, summariesFilter, page },
|
1436
|
+
...this.extraProps
|
1437
|
+
});
|
1438
|
+
}
|
1439
|
+
aggregateTable({
|
1440
|
+
workspace,
|
1441
|
+
region,
|
1442
|
+
database,
|
1443
|
+
branch,
|
1444
|
+
table,
|
1445
|
+
filter,
|
1446
|
+
aggs
|
1447
|
+
}) {
|
1448
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1449
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1450
|
+
body: { filter, aggs },
|
1451
|
+
...this.extraProps
|
1452
|
+
});
|
1453
|
+
}
|
1454
|
+
}
|
1455
|
+
class MigrationRequestsApi {
|
1456
|
+
constructor(extraProps) {
|
1457
|
+
this.extraProps = extraProps;
|
1458
|
+
}
|
1459
|
+
queryMigrationRequests({
|
1460
|
+
workspace,
|
1461
|
+
region,
|
1462
|
+
database,
|
1463
|
+
filter,
|
1464
|
+
sort,
|
1465
|
+
page,
|
1466
|
+
columns
|
1467
|
+
}) {
|
1468
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1469
|
+
pathParams: { workspace, region, dbName: database },
|
1470
|
+
body: { filter, sort, page, columns },
|
1471
|
+
...this.extraProps
|
1472
|
+
});
|
1473
|
+
}
|
1474
|
+
createMigrationRequest({
|
1475
|
+
workspace,
|
1476
|
+
region,
|
1477
|
+
database,
|
1478
|
+
migration
|
1479
|
+
}) {
|
1480
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
1481
|
+
pathParams: { workspace, region, dbName: database },
|
1482
|
+
body: migration,
|
1483
|
+
...this.extraProps
|
1484
|
+
});
|
1485
|
+
}
|
1486
|
+
getMigrationRequest({
|
1487
|
+
workspace,
|
1488
|
+
region,
|
1489
|
+
database,
|
1490
|
+
migrationRequest
|
1491
|
+
}) {
|
1492
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1493
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1494
|
+
...this.extraProps
|
1495
|
+
});
|
1496
|
+
}
|
1497
|
+
updateMigrationRequest({
|
1498
|
+
workspace,
|
1499
|
+
region,
|
1500
|
+
database,
|
1501
|
+
migrationRequest,
|
1502
|
+
update
|
1503
|
+
}) {
|
1504
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1505
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1506
|
+
body: update,
|
1031
1507
|
...this.extraProps
|
1032
1508
|
});
|
1033
1509
|
}
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1510
|
+
listMigrationRequestsCommits({
|
1511
|
+
workspace,
|
1512
|
+
region,
|
1513
|
+
database,
|
1514
|
+
migrationRequest,
|
1515
|
+
page
|
1516
|
+
}) {
|
1517
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1518
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1519
|
+
body: { page },
|
1038
1520
|
...this.extraProps
|
1039
1521
|
});
|
1040
1522
|
}
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1523
|
+
compareMigrationRequest({
|
1524
|
+
workspace,
|
1525
|
+
region,
|
1526
|
+
database,
|
1527
|
+
migrationRequest
|
1528
|
+
}) {
|
1529
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1530
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1045
1531
|
...this.extraProps
|
1046
1532
|
});
|
1047
1533
|
}
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1534
|
+
getMigrationRequestIsMerged({
|
1535
|
+
workspace,
|
1536
|
+
region,
|
1537
|
+
database,
|
1538
|
+
migrationRequest
|
1539
|
+
}) {
|
1540
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1541
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1542
|
+
...this.extraProps
|
1543
|
+
});
|
1544
|
+
}
|
1545
|
+
mergeMigrationRequest({
|
1546
|
+
workspace,
|
1547
|
+
region,
|
1548
|
+
database,
|
1549
|
+
migrationRequest
|
1550
|
+
}) {
|
1551
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1552
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1553
|
+
...this.extraProps
|
1554
|
+
});
|
1555
|
+
}
|
1556
|
+
}
|
1557
|
+
class MigrationsApi {
|
1558
|
+
constructor(extraProps) {
|
1559
|
+
this.extraProps = extraProps;
|
1560
|
+
}
|
1561
|
+
getBranchMigrationHistory({
|
1562
|
+
workspace,
|
1563
|
+
region,
|
1564
|
+
database,
|
1565
|
+
branch,
|
1566
|
+
limit,
|
1567
|
+
startFrom
|
1568
|
+
}) {
|
1569
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1570
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1571
|
+
body: { limit, startFrom },
|
1572
|
+
...this.extraProps
|
1573
|
+
});
|
1574
|
+
}
|
1575
|
+
getBranchMigrationPlan({
|
1576
|
+
workspace,
|
1577
|
+
region,
|
1578
|
+
database,
|
1579
|
+
branch,
|
1580
|
+
schema
|
1581
|
+
}) {
|
1582
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1583
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1584
|
+
body: schema,
|
1585
|
+
...this.extraProps
|
1586
|
+
});
|
1587
|
+
}
|
1588
|
+
executeBranchMigrationPlan({
|
1589
|
+
workspace,
|
1590
|
+
region,
|
1591
|
+
database,
|
1592
|
+
branch,
|
1593
|
+
plan
|
1594
|
+
}) {
|
1595
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1596
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1597
|
+
body: plan,
|
1598
|
+
...this.extraProps
|
1599
|
+
});
|
1600
|
+
}
|
1601
|
+
getBranchSchemaHistory({
|
1602
|
+
workspace,
|
1603
|
+
region,
|
1604
|
+
database,
|
1605
|
+
branch,
|
1606
|
+
page
|
1607
|
+
}) {
|
1608
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1609
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1610
|
+
body: { page },
|
1611
|
+
...this.extraProps
|
1612
|
+
});
|
1613
|
+
}
|
1614
|
+
compareBranchWithUserSchema({
|
1615
|
+
workspace,
|
1616
|
+
region,
|
1617
|
+
database,
|
1618
|
+
branch,
|
1619
|
+
schema
|
1620
|
+
}) {
|
1621
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1622
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1623
|
+
body: { schema },
|
1624
|
+
...this.extraProps
|
1625
|
+
});
|
1626
|
+
}
|
1627
|
+
compareBranchSchemas({
|
1628
|
+
workspace,
|
1629
|
+
region,
|
1630
|
+
database,
|
1631
|
+
branch,
|
1632
|
+
compare,
|
1633
|
+
schema
|
1634
|
+
}) {
|
1635
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1636
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1637
|
+
body: { schema },
|
1638
|
+
...this.extraProps
|
1639
|
+
});
|
1640
|
+
}
|
1641
|
+
updateBranchSchema({
|
1642
|
+
workspace,
|
1643
|
+
region,
|
1644
|
+
database,
|
1645
|
+
branch,
|
1646
|
+
migration
|
1647
|
+
}) {
|
1648
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1649
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1650
|
+
body: migration,
|
1651
|
+
...this.extraProps
|
1652
|
+
});
|
1653
|
+
}
|
1654
|
+
previewBranchSchemaEdit({
|
1655
|
+
workspace,
|
1656
|
+
region,
|
1657
|
+
database,
|
1658
|
+
branch,
|
1659
|
+
data
|
1660
|
+
}) {
|
1661
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1662
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1663
|
+
body: data,
|
1664
|
+
...this.extraProps
|
1665
|
+
});
|
1666
|
+
}
|
1667
|
+
applyBranchSchemaEdit({
|
1668
|
+
workspace,
|
1669
|
+
region,
|
1670
|
+
database,
|
1671
|
+
branch,
|
1672
|
+
edits
|
1673
|
+
}) {
|
1674
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1675
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1676
|
+
body: { edits },
|
1677
|
+
...this.extraProps
|
1678
|
+
});
|
1679
|
+
}
|
1680
|
+
}
|
1681
|
+
class DatabaseApi {
|
1682
|
+
constructor(extraProps) {
|
1683
|
+
this.extraProps = extraProps;
|
1684
|
+
}
|
1685
|
+
getDatabaseList({ workspace }) {
|
1686
|
+
return operationsByTag.databases.getDatabaseList({
|
1687
|
+
pathParams: { workspaceId: workspace },
|
1688
|
+
...this.extraProps
|
1689
|
+
});
|
1690
|
+
}
|
1691
|
+
createDatabase({
|
1692
|
+
workspace,
|
1693
|
+
database,
|
1694
|
+
data
|
1695
|
+
}) {
|
1696
|
+
return operationsByTag.databases.createDatabase({
|
1697
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1698
|
+
body: data,
|
1699
|
+
...this.extraProps
|
1700
|
+
});
|
1701
|
+
}
|
1702
|
+
deleteDatabase({
|
1703
|
+
workspace,
|
1704
|
+
database
|
1705
|
+
}) {
|
1706
|
+
return operationsByTag.databases.deleteDatabase({
|
1707
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1708
|
+
...this.extraProps
|
1709
|
+
});
|
1710
|
+
}
|
1711
|
+
getDatabaseMetadata({
|
1712
|
+
workspace,
|
1713
|
+
database
|
1714
|
+
}) {
|
1715
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1716
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1717
|
+
...this.extraProps
|
1718
|
+
});
|
1719
|
+
}
|
1720
|
+
updateDatabaseMetadata({
|
1721
|
+
workspace,
|
1722
|
+
database,
|
1723
|
+
metadata
|
1724
|
+
}) {
|
1725
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1726
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1727
|
+
body: metadata,
|
1728
|
+
...this.extraProps
|
1729
|
+
});
|
1730
|
+
}
|
1731
|
+
listRegions({ workspace }) {
|
1732
|
+
return operationsByTag.databases.listRegions({
|
1733
|
+
pathParams: { workspaceId: workspace },
|
1052
1734
|
...this.extraProps
|
1053
1735
|
});
|
1054
1736
|
}
|
@@ -1064,6 +1746,20 @@ class XataApiPlugin {
|
|
1064
1746
|
class XataPlugin {
|
1065
1747
|
}
|
1066
1748
|
|
1749
|
+
function generateUUID() {
|
1750
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1751
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1752
|
+
return v.toString(16);
|
1753
|
+
});
|
1754
|
+
}
|
1755
|
+
|
1756
|
+
function cleanFilter(filter) {
|
1757
|
+
if (!filter)
|
1758
|
+
return void 0;
|
1759
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1760
|
+
return values.length > 0 ? filter : void 0;
|
1761
|
+
}
|
1762
|
+
|
1067
1763
|
var __accessCheck$6 = (obj, member, msg) => {
|
1068
1764
|
if (!member.has(obj))
|
1069
1765
|
throw TypeError("Cannot " + msg);
|
@@ -1177,9 +1873,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1177
1873
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1178
1874
|
return value;
|
1179
1875
|
};
|
1180
|
-
var
|
1876
|
+
var __privateMethod$3 = (obj, member, method) => {
|
1877
|
+
__accessCheck$5(obj, member, "access private method");
|
1878
|
+
return method;
|
1879
|
+
};
|
1880
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1181
1881
|
const _Query = class {
|
1182
1882
|
constructor(repository, table, data, rawParent) {
|
1883
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1183
1884
|
__privateAdd$5(this, _table$1, void 0);
|
1184
1885
|
__privateAdd$5(this, _repository, void 0);
|
1185
1886
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1198,7 +1899,7 @@ const _Query = class {
|
|
1198
1899
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1199
1900
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1200
1901
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1201
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1902
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1202
1903
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1203
1904
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1204
1905
|
this.any = this.any.bind(this);
|
@@ -1236,11 +1937,14 @@ const _Query = class {
|
|
1236
1937
|
}
|
1237
1938
|
filter(a, b) {
|
1238
1939
|
if (arguments.length === 1) {
|
1239
|
-
const constraints = Object.entries(a).map(([column, constraint]) => ({
|
1940
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1941
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
1942
|
+
}));
|
1240
1943
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1241
1944
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1242
1945
|
} else {
|
1243
|
-
const
|
1946
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
1947
|
+
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1244
1948
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1245
1949
|
}
|
1246
1950
|
}
|
@@ -1278,11 +1982,20 @@ const _Query = class {
|
|
1278
1982
|
}
|
1279
1983
|
}
|
1280
1984
|
async getMany(options = {}) {
|
1281
|
-
const
|
1985
|
+
const { pagination = {}, ...rest } = options;
|
1986
|
+
const { size = PAGINATION_DEFAULT_SIZE, offset } = pagination;
|
1987
|
+
const batchSize = size <= PAGINATION_MAX_SIZE ? size : PAGINATION_MAX_SIZE;
|
1988
|
+
let page = await this.getPaginated({ ...rest, pagination: { size: batchSize, offset } });
|
1989
|
+
const results = [...page.records];
|
1990
|
+
while (page.hasNextPage() && results.length < size) {
|
1991
|
+
page = await page.nextPage();
|
1992
|
+
results.push(...page.records);
|
1993
|
+
}
|
1282
1994
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1283
1995
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1284
1996
|
}
|
1285
|
-
|
1997
|
+
const array = new RecordArray(page, results.slice(0, size));
|
1998
|
+
return array;
|
1286
1999
|
}
|
1287
2000
|
async getAll(options = {}) {
|
1288
2001
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1296,6 +2009,22 @@ const _Query = class {
|
|
1296
2009
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1297
2010
|
return records[0] ?? null;
|
1298
2011
|
}
|
2012
|
+
async getFirstOrThrow(options = {}) {
|
2013
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2014
|
+
if (records[0] === void 0)
|
2015
|
+
throw new Error("No results found.");
|
2016
|
+
return records[0];
|
2017
|
+
}
|
2018
|
+
async summarize(params = {}) {
|
2019
|
+
const { summaries, summariesFilter, ...options } = params;
|
2020
|
+
const query = new _Query(
|
2021
|
+
__privateGet$5(this, _repository),
|
2022
|
+
__privateGet$5(this, _table$1),
|
2023
|
+
options,
|
2024
|
+
__privateGet$5(this, _data)
|
2025
|
+
);
|
2026
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2027
|
+
}
|
1299
2028
|
cache(ttl) {
|
1300
2029
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1301
2030
|
}
|
@@ -1319,9 +2048,20 @@ let Query = _Query;
|
|
1319
2048
|
_table$1 = new WeakMap();
|
1320
2049
|
_repository = new WeakMap();
|
1321
2050
|
_data = new WeakMap();
|
2051
|
+
_cleanFilterConstraint = new WeakSet();
|
2052
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2053
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2054
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2055
|
+
return { $includes: value };
|
2056
|
+
}
|
2057
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2058
|
+
return value.id;
|
2059
|
+
}
|
2060
|
+
return value;
|
2061
|
+
};
|
1322
2062
|
function cleanParent(data, parent) {
|
1323
2063
|
if (isCursorPaginationOptions(data.pagination)) {
|
1324
|
-
return { ...parent,
|
2064
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1325
2065
|
}
|
1326
2066
|
return parent;
|
1327
2067
|
}
|
@@ -1380,18 +2120,23 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1380
2120
|
__accessCheck$4(obj, member, "access private method");
|
1381
2121
|
return method;
|
1382
2122
|
};
|
1383
|
-
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;
|
2123
|
+
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;
|
1384
2124
|
class Repository extends Query {
|
1385
2125
|
}
|
1386
2126
|
class RestRepository extends Query {
|
1387
2127
|
constructor(options) {
|
1388
|
-
super(
|
2128
|
+
super(
|
2129
|
+
null,
|
2130
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2131
|
+
{}
|
2132
|
+
);
|
1389
2133
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1390
2134
|
__privateAdd$4(this, _insertRecordWithId);
|
1391
2135
|
__privateAdd$4(this, _bulkInsertTableRecords);
|
1392
2136
|
__privateAdd$4(this, _updateRecordWithID);
|
1393
2137
|
__privateAdd$4(this, _upsertRecordWithID);
|
1394
2138
|
__privateAdd$4(this, _deleteRecord);
|
2139
|
+
__privateAdd$4(this, _deleteRecords);
|
1395
2140
|
__privateAdd$4(this, _setCacheQuery);
|
1396
2141
|
__privateAdd$4(this, _getCacheQuery);
|
1397
2142
|
__privateAdd$4(this, _getSchemaTables$1);
|
@@ -1402,21 +2147,26 @@ class RestRepository extends Query {
|
|
1402
2147
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1403
2148
|
__privateAdd$4(this, _trace, void 0);
|
1404
2149
|
__privateSet$4(this, _table, options.table);
|
1405
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1406
2150
|
__privateSet$4(this, _db, options.db);
|
1407
2151
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1408
2152
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2153
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2154
|
+
const props = await options.pluginOptions.getFetchProps();
|
2155
|
+
return { ...props, sessionID: generateUUID() };
|
2156
|
+
});
|
1409
2157
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1410
2158
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1411
2159
|
return trace(name, fn, {
|
1412
2160
|
...options2,
|
1413
2161
|
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
2162
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
1414
2163
|
[TraceAttributes.VERSION]: VERSION
|
1415
2164
|
});
|
1416
2165
|
});
|
1417
2166
|
}
|
1418
|
-
async create(a, b, c) {
|
2167
|
+
async create(a, b, c, d) {
|
1419
2168
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2169
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1420
2170
|
if (Array.isArray(a)) {
|
1421
2171
|
if (a.length === 0)
|
1422
2172
|
return [];
|
@@ -1427,13 +2177,13 @@ class RestRepository extends Query {
|
|
1427
2177
|
if (a === "")
|
1428
2178
|
throw new Error("The id can't be empty");
|
1429
2179
|
const columns = isStringArray(c) ? c : void 0;
|
1430
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
2180
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1431
2181
|
}
|
1432
2182
|
if (isObject(a) && isString(a.id)) {
|
1433
2183
|
if (a.id === "")
|
1434
2184
|
throw new Error("The id can't be empty");
|
1435
2185
|
const columns = isStringArray(b) ? b : void 0;
|
1436
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2186
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1437
2187
|
}
|
1438
2188
|
if (isObject(a)) {
|
1439
2189
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1464,6 +2214,7 @@ class RestRepository extends Query {
|
|
1464
2214
|
pathParams: {
|
1465
2215
|
workspace: "{workspaceId}",
|
1466
2216
|
dbBranchName: "{dbBranch}",
|
2217
|
+
region: "{region}",
|
1467
2218
|
tableName: __privateGet$4(this, _table),
|
1468
2219
|
recordId: id
|
1469
2220
|
},
|
@@ -1471,7 +2222,7 @@ class RestRepository extends Query {
|
|
1471
2222
|
...fetchProps
|
1472
2223
|
});
|
1473
2224
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1474
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2225
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1475
2226
|
} catch (e) {
|
1476
2227
|
if (isObject(e) && e.status === 404) {
|
1477
2228
|
return null;
|
@@ -1482,8 +2233,28 @@ class RestRepository extends Query {
|
|
1482
2233
|
return null;
|
1483
2234
|
});
|
1484
2235
|
}
|
1485
|
-
async
|
2236
|
+
async readOrThrow(a, b) {
|
2237
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2238
|
+
const result = await this.read(a, b);
|
2239
|
+
if (Array.isArray(result)) {
|
2240
|
+
const missingIds = compact(
|
2241
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2242
|
+
);
|
2243
|
+
if (missingIds.length > 0) {
|
2244
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2245
|
+
}
|
2246
|
+
return result;
|
2247
|
+
}
|
2248
|
+
if (result === null) {
|
2249
|
+
const id = extractId(a) ?? "unknown";
|
2250
|
+
throw new Error(`Record with id ${id} not found`);
|
2251
|
+
}
|
2252
|
+
return result;
|
2253
|
+
});
|
2254
|
+
}
|
2255
|
+
async update(a, b, c, d) {
|
1486
2256
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2257
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1487
2258
|
if (Array.isArray(a)) {
|
1488
2259
|
if (a.length === 0)
|
1489
2260
|
return [];
|
@@ -1495,17 +2266,37 @@ class RestRepository extends Query {
|
|
1495
2266
|
}
|
1496
2267
|
if (isString(a) && isObject(b)) {
|
1497
2268
|
const columns = isStringArray(c) ? c : void 0;
|
1498
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
2269
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1499
2270
|
}
|
1500
2271
|
if (isObject(a) && isString(a.id)) {
|
1501
2272
|
const columns = isStringArray(b) ? b : void 0;
|
1502
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2273
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1503
2274
|
}
|
1504
2275
|
throw new Error("Invalid arguments for update method");
|
1505
2276
|
});
|
1506
2277
|
}
|
1507
|
-
async
|
2278
|
+
async updateOrThrow(a, b, c, d) {
|
2279
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2280
|
+
const result = await this.update(a, b, c, d);
|
2281
|
+
if (Array.isArray(result)) {
|
2282
|
+
const missingIds = compact(
|
2283
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2284
|
+
);
|
2285
|
+
if (missingIds.length > 0) {
|
2286
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2287
|
+
}
|
2288
|
+
return result;
|
2289
|
+
}
|
2290
|
+
if (result === null) {
|
2291
|
+
const id = extractId(a) ?? "unknown";
|
2292
|
+
throw new Error(`Record with id ${id} not found`);
|
2293
|
+
}
|
2294
|
+
return result;
|
2295
|
+
});
|
2296
|
+
}
|
2297
|
+
async createOrUpdate(a, b, c, d) {
|
1508
2298
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2299
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1509
2300
|
if (Array.isArray(a)) {
|
1510
2301
|
if (a.length === 0)
|
1511
2302
|
return [];
|
@@ -1517,24 +2308,48 @@ class RestRepository extends Query {
|
|
1517
2308
|
}
|
1518
2309
|
if (isString(a) && isObject(b)) {
|
1519
2310
|
const columns = isStringArray(c) ? c : void 0;
|
1520
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
2311
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1521
2312
|
}
|
1522
2313
|
if (isObject(a) && isString(a.id)) {
|
1523
2314
|
const columns = isStringArray(c) ? c : void 0;
|
1524
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2315
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1525
2316
|
}
|
1526
2317
|
throw new Error("Invalid arguments for createOrUpdate method");
|
1527
2318
|
});
|
1528
2319
|
}
|
2320
|
+
async createOrReplace(a, b, c, d) {
|
2321
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2322
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2323
|
+
if (Array.isArray(a)) {
|
2324
|
+
if (a.length === 0)
|
2325
|
+
return [];
|
2326
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2327
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
2328
|
+
}
|
2329
|
+
if (isString(a) && isObject(b)) {
|
2330
|
+
const columns = isStringArray(c) ? c : void 0;
|
2331
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2332
|
+
}
|
2333
|
+
if (isObject(a) && isString(a.id)) {
|
2334
|
+
const columns = isStringArray(c) ? c : void 0;
|
2335
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2336
|
+
}
|
2337
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2338
|
+
});
|
2339
|
+
}
|
1529
2340
|
async delete(a, b) {
|
1530
2341
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
1531
2342
|
if (Array.isArray(a)) {
|
1532
2343
|
if (a.length === 0)
|
1533
2344
|
return [];
|
1534
|
-
|
1535
|
-
|
1536
|
-
|
1537
|
-
|
2345
|
+
const ids = a.map((o) => {
|
2346
|
+
if (isString(o))
|
2347
|
+
return o;
|
2348
|
+
if (isString(o.id))
|
2349
|
+
return o.id;
|
2350
|
+
throw new Error("Invalid arguments for delete method");
|
2351
|
+
});
|
2352
|
+
return __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids, b);
|
1538
2353
|
}
|
1539
2354
|
if (isString(a)) {
|
1540
2355
|
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
@@ -1545,11 +2360,34 @@ class RestRepository extends Query {
|
|
1545
2360
|
throw new Error("Invalid arguments for delete method");
|
1546
2361
|
});
|
1547
2362
|
}
|
2363
|
+
async deleteOrThrow(a, b) {
|
2364
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2365
|
+
const result = await this.delete(a, b);
|
2366
|
+
if (Array.isArray(result)) {
|
2367
|
+
const missingIds = compact(
|
2368
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2369
|
+
);
|
2370
|
+
if (missingIds.length > 0) {
|
2371
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2372
|
+
}
|
2373
|
+
return result;
|
2374
|
+
} else if (result === null) {
|
2375
|
+
const id = extractId(a) ?? "unknown";
|
2376
|
+
throw new Error(`Record with id ${id} not found`);
|
2377
|
+
}
|
2378
|
+
return result;
|
2379
|
+
});
|
2380
|
+
}
|
1548
2381
|
async search(query, options = {}) {
|
1549
2382
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1550
2383
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1551
2384
|
const { records } = await searchTable({
|
1552
|
-
pathParams: {
|
2385
|
+
pathParams: {
|
2386
|
+
workspace: "{workspaceId}",
|
2387
|
+
dbBranchName: "{dbBranch}",
|
2388
|
+
region: "{region}",
|
2389
|
+
tableName: __privateGet$4(this, _table)
|
2390
|
+
},
|
1553
2391
|
body: {
|
1554
2392
|
query,
|
1555
2393
|
fuzziness: options.fuzziness,
|
@@ -1561,7 +2399,23 @@ class RestRepository extends Query {
|
|
1561
2399
|
...fetchProps
|
1562
2400
|
});
|
1563
2401
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1564
|
-
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2402
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2403
|
+
});
|
2404
|
+
}
|
2405
|
+
async aggregate(aggs, filter) {
|
2406
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2407
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2408
|
+
const result = await aggregateTable({
|
2409
|
+
pathParams: {
|
2410
|
+
workspace: "{workspaceId}",
|
2411
|
+
dbBranchName: "{dbBranch}",
|
2412
|
+
region: "{region}",
|
2413
|
+
tableName: __privateGet$4(this, _table)
|
2414
|
+
},
|
2415
|
+
body: { aggs, filter },
|
2416
|
+
...fetchProps
|
2417
|
+
});
|
2418
|
+
return result;
|
1565
2419
|
});
|
1566
2420
|
}
|
1567
2421
|
async query(query) {
|
@@ -1570,24 +2424,54 @@ class RestRepository extends Query {
|
|
1570
2424
|
if (cacheQuery)
|
1571
2425
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1572
2426
|
const data = query.getQueryOptions();
|
1573
|
-
const body = {
|
1574
|
-
filter: Object.values(data.filter ?? {}).some(Boolean) ? data.filter : void 0,
|
1575
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1576
|
-
page: data.pagination,
|
1577
|
-
columns: data.columns
|
1578
|
-
};
|
1579
2427
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1580
2428
|
const { meta, records: objects } = await queryTable({
|
1581
|
-
pathParams: {
|
1582
|
-
|
2429
|
+
pathParams: {
|
2430
|
+
workspace: "{workspaceId}",
|
2431
|
+
dbBranchName: "{dbBranch}",
|
2432
|
+
region: "{region}",
|
2433
|
+
tableName: __privateGet$4(this, _table)
|
2434
|
+
},
|
2435
|
+
body: {
|
2436
|
+
filter: cleanFilter(data.filter),
|
2437
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2438
|
+
page: data.pagination,
|
2439
|
+
columns: data.columns ?? ["*"]
|
2440
|
+
},
|
1583
2441
|
...fetchProps
|
1584
2442
|
});
|
1585
2443
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1586
|
-
const records = objects.map(
|
2444
|
+
const records = objects.map(
|
2445
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2446
|
+
);
|
1587
2447
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1588
2448
|
return new Page(query, meta, records);
|
1589
2449
|
});
|
1590
2450
|
}
|
2451
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2452
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2453
|
+
const data = query.getQueryOptions();
|
2454
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2455
|
+
const result = await summarizeTable({
|
2456
|
+
pathParams: {
|
2457
|
+
workspace: "{workspaceId}",
|
2458
|
+
dbBranchName: "{dbBranch}",
|
2459
|
+
region: "{region}",
|
2460
|
+
tableName: __privateGet$4(this, _table)
|
2461
|
+
},
|
2462
|
+
body: {
|
2463
|
+
filter: cleanFilter(data.filter),
|
2464
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2465
|
+
columns: data.columns,
|
2466
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2467
|
+
summaries,
|
2468
|
+
summariesFilter
|
2469
|
+
},
|
2470
|
+
...fetchProps
|
2471
|
+
});
|
2472
|
+
return result;
|
2473
|
+
});
|
2474
|
+
}
|
1591
2475
|
}
|
1592
2476
|
_table = new WeakMap();
|
1593
2477
|
_getFetchProps = new WeakMap();
|
@@ -1603,6 +2487,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1603
2487
|
pathParams: {
|
1604
2488
|
workspace: "{workspaceId}",
|
1605
2489
|
dbBranchName: "{dbBranch}",
|
2490
|
+
region: "{region}",
|
1606
2491
|
tableName: __privateGet$4(this, _table)
|
1607
2492
|
},
|
1608
2493
|
queryParams: { columns },
|
@@ -1610,32 +2495,38 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1610
2495
|
...fetchProps
|
1611
2496
|
});
|
1612
2497
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1613
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2498
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1614
2499
|
};
|
1615
2500
|
_insertRecordWithId = new WeakSet();
|
1616
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2501
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1617
2502
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1618
2503
|
const record = transformObjectLinks(object);
|
1619
2504
|
const response = await insertRecordWithID({
|
1620
2505
|
pathParams: {
|
1621
2506
|
workspace: "{workspaceId}",
|
1622
2507
|
dbBranchName: "{dbBranch}",
|
2508
|
+
region: "{region}",
|
1623
2509
|
tableName: __privateGet$4(this, _table),
|
1624
2510
|
recordId
|
1625
2511
|
},
|
1626
2512
|
body: record,
|
1627
|
-
queryParams: { createOnly
|
2513
|
+
queryParams: { createOnly, columns, ifVersion },
|
1628
2514
|
...fetchProps
|
1629
2515
|
});
|
1630
2516
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1631
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2517
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1632
2518
|
};
|
1633
2519
|
_bulkInsertTableRecords = new WeakSet();
|
1634
2520
|
bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
1635
2521
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1636
2522
|
const records = objects.map((object) => transformObjectLinks(object));
|
1637
2523
|
const response = await bulkInsertTableRecords({
|
1638
|
-
pathParams: {
|
2524
|
+
pathParams: {
|
2525
|
+
workspace: "{workspaceId}",
|
2526
|
+
dbBranchName: "{dbBranch}",
|
2527
|
+
region: "{region}",
|
2528
|
+
tableName: __privateGet$4(this, _table)
|
2529
|
+
},
|
1639
2530
|
queryParams: { columns },
|
1640
2531
|
body: { records },
|
1641
2532
|
...fetchProps
|
@@ -1644,21 +2535,27 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
1644
2535
|
throw new Error("Request included columns but server didn't include them");
|
1645
2536
|
}
|
1646
2537
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1647
|
-
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2538
|
+
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
1648
2539
|
};
|
1649
2540
|
_updateRecordWithID = new WeakSet();
|
1650
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2541
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1651
2542
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1652
2543
|
const record = transformObjectLinks(object);
|
1653
2544
|
try {
|
1654
2545
|
const response = await updateRecordWithID({
|
1655
|
-
pathParams: {
|
1656
|
-
|
2546
|
+
pathParams: {
|
2547
|
+
workspace: "{workspaceId}",
|
2548
|
+
dbBranchName: "{dbBranch}",
|
2549
|
+
region: "{region}",
|
2550
|
+
tableName: __privateGet$4(this, _table),
|
2551
|
+
recordId
|
2552
|
+
},
|
2553
|
+
queryParams: { columns, ifVersion },
|
1657
2554
|
body: record,
|
1658
2555
|
...fetchProps
|
1659
2556
|
});
|
1660
2557
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1661
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2558
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1662
2559
|
} catch (e) {
|
1663
2560
|
if (isObject(e) && e.status === 404) {
|
1664
2561
|
return null;
|
@@ -1667,28 +2564,63 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1667
2564
|
}
|
1668
2565
|
};
|
1669
2566
|
_upsertRecordWithID = new WeakSet();
|
1670
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2567
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1671
2568
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1672
2569
|
const response = await upsertRecordWithID({
|
1673
|
-
pathParams: {
|
1674
|
-
|
2570
|
+
pathParams: {
|
2571
|
+
workspace: "{workspaceId}",
|
2572
|
+
dbBranchName: "{dbBranch}",
|
2573
|
+
region: "{region}",
|
2574
|
+
tableName: __privateGet$4(this, _table),
|
2575
|
+
recordId
|
2576
|
+
},
|
2577
|
+
queryParams: { columns, ifVersion },
|
1675
2578
|
body: object,
|
1676
2579
|
...fetchProps
|
1677
2580
|
});
|
1678
2581
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1679
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2582
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1680
2583
|
};
|
1681
2584
|
_deleteRecord = new WeakSet();
|
1682
2585
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1683
2586
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1684
2587
|
try {
|
1685
2588
|
const response = await deleteRecord({
|
1686
|
-
pathParams: {
|
2589
|
+
pathParams: {
|
2590
|
+
workspace: "{workspaceId}",
|
2591
|
+
dbBranchName: "{dbBranch}",
|
2592
|
+
region: "{region}",
|
2593
|
+
tableName: __privateGet$4(this, _table),
|
2594
|
+
recordId
|
2595
|
+
},
|
1687
2596
|
queryParams: { columns },
|
1688
2597
|
...fetchProps
|
1689
2598
|
});
|
1690
2599
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1691
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2600
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2601
|
+
} catch (e) {
|
2602
|
+
if (isObject(e) && e.status === 404) {
|
2603
|
+
return null;
|
2604
|
+
}
|
2605
|
+
throw e;
|
2606
|
+
}
|
2607
|
+
};
|
2608
|
+
_deleteRecords = new WeakSet();
|
2609
|
+
deleteRecords_fn = async function(recordIds, columns = ["*"]) {
|
2610
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2611
|
+
const operations = recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } }));
|
2612
|
+
try {
|
2613
|
+
const objects = await this.read(recordIds, columns);
|
2614
|
+
await branchTransaction({
|
2615
|
+
pathParams: {
|
2616
|
+
workspace: "{workspaceId}",
|
2617
|
+
dbBranchName: "{dbBranch}",
|
2618
|
+
region: "{region}"
|
2619
|
+
},
|
2620
|
+
body: { operations },
|
2621
|
+
...fetchProps
|
2622
|
+
});
|
2623
|
+
return objects;
|
1692
2624
|
} catch (e) {
|
1693
2625
|
if (isObject(e) && e.status === 404) {
|
1694
2626
|
return null;
|
@@ -1718,7 +2650,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1718
2650
|
return __privateGet$4(this, _schemaTables$2);
|
1719
2651
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1720
2652
|
const { schema } = await getBranchDetails({
|
1721
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2653
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1722
2654
|
...fetchProps
|
1723
2655
|
});
|
1724
2656
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1731,7 +2663,7 @@ const transformObjectLinks = (object) => {
|
|
1731
2663
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1732
2664
|
}, {});
|
1733
2665
|
};
|
1734
|
-
const initObject = (db, schemaTables, table, object) => {
|
2666
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
1735
2667
|
const result = {};
|
1736
2668
|
const { xata, ...rest } = object ?? {};
|
1737
2669
|
Object.assign(result, rest);
|
@@ -1739,6 +2671,8 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1739
2671
|
if (!columns)
|
1740
2672
|
console.error(`Table ${table} not found in schema`);
|
1741
2673
|
for (const column of columns ?? []) {
|
2674
|
+
if (!isValidColumn(selectedColumns, column))
|
2675
|
+
continue;
|
1742
2676
|
const value = result[column.name];
|
1743
2677
|
switch (column.type) {
|
1744
2678
|
case "datetime": {
|
@@ -1755,17 +2689,42 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1755
2689
|
if (!linkTable) {
|
1756
2690
|
console.error(`Failed to parse link for field ${column.name}`);
|
1757
2691
|
} else if (isObject(value)) {
|
1758
|
-
|
2692
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2693
|
+
if (item === column.name) {
|
2694
|
+
return [...acc, "*"];
|
2695
|
+
}
|
2696
|
+
if (item.startsWith(`${column.name}.`)) {
|
2697
|
+
const [, ...path] = item.split(".");
|
2698
|
+
return [...acc, path.join(".")];
|
2699
|
+
}
|
2700
|
+
return acc;
|
2701
|
+
}, []);
|
2702
|
+
result[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2703
|
+
} else {
|
2704
|
+
result[column.name] = null;
|
1759
2705
|
}
|
1760
2706
|
break;
|
1761
2707
|
}
|
2708
|
+
default:
|
2709
|
+
result[column.name] = value ?? null;
|
2710
|
+
if (column.notNull === true && value === null) {
|
2711
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2712
|
+
}
|
2713
|
+
break;
|
1762
2714
|
}
|
1763
2715
|
}
|
1764
2716
|
result.read = function(columns2) {
|
1765
2717
|
return db[table].read(result["id"], columns2);
|
1766
2718
|
};
|
1767
|
-
result.update = function(data,
|
1768
|
-
|
2719
|
+
result.update = function(data, b, c) {
|
2720
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2721
|
+
const ifVersion = parseIfVersion(b, c);
|
2722
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2723
|
+
};
|
2724
|
+
result.replace = function(data, b, c) {
|
2725
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2726
|
+
const ifVersion = parseIfVersion(b, c);
|
2727
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
1769
2728
|
};
|
1770
2729
|
result.delete = function() {
|
1771
2730
|
return db[table].delete(result["id"]);
|
@@ -1773,7 +2732,7 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1773
2732
|
result.getMetadata = function() {
|
1774
2733
|
return xata;
|
1775
2734
|
};
|
1776
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2735
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
1777
2736
|
Object.defineProperty(result, prop, { enumerable: false });
|
1778
2737
|
}
|
1779
2738
|
Object.freeze(result);
|
@@ -1789,6 +2748,23 @@ function extractId(value) {
|
|
1789
2748
|
return value.id;
|
1790
2749
|
return void 0;
|
1791
2750
|
}
|
2751
|
+
function isValidColumn(columns, column) {
|
2752
|
+
if (columns.includes("*"))
|
2753
|
+
return true;
|
2754
|
+
if (column.type === "link") {
|
2755
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2756
|
+
return linkColumns.length > 0;
|
2757
|
+
}
|
2758
|
+
return columns.includes(column.name);
|
2759
|
+
}
|
2760
|
+
function parseIfVersion(...args) {
|
2761
|
+
for (const arg of args) {
|
2762
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2763
|
+
return arg.ifVersion;
|
2764
|
+
}
|
2765
|
+
}
|
2766
|
+
return void 0;
|
2767
|
+
}
|
1792
2768
|
|
1793
2769
|
var __accessCheck$3 = (obj, member, msg) => {
|
1794
2770
|
if (!member.has(obj))
|
@@ -1954,7 +2930,7 @@ class SearchPlugin extends XataPlugin {
|
|
1954
2930
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1955
2931
|
return records.map((record) => {
|
1956
2932
|
const { table = "orphan" } = record.xata;
|
1957
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
2933
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1958
2934
|
});
|
1959
2935
|
},
|
1960
2936
|
byTable: async (query, options = {}) => {
|
@@ -1963,7 +2939,7 @@ class SearchPlugin extends XataPlugin {
|
|
1963
2939
|
return records.reduce((acc, record) => {
|
1964
2940
|
const { table = "orphan" } = record.xata;
|
1965
2941
|
const items = acc[table] ?? [];
|
1966
|
-
const item = initObject(this.db, schemaTables, table, record);
|
2942
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1967
2943
|
return { ...acc, [table]: [...items, item] };
|
1968
2944
|
}, {});
|
1969
2945
|
}
|
@@ -1976,7 +2952,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
1976
2952
|
const fetchProps = await getFetchProps();
|
1977
2953
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
1978
2954
|
const { records } = await searchBranch({
|
1979
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2955
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1980
2956
|
body: { tables, query, fuzziness, prefix, highlight },
|
1981
2957
|
...fetchProps
|
1982
2958
|
});
|
@@ -1988,7 +2964,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
1988
2964
|
return __privateGet$1(this, _schemaTables);
|
1989
2965
|
const fetchProps = await getFetchProps();
|
1990
2966
|
const { schema } = await getBranchDetails({
|
1991
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2967
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1992
2968
|
...fetchProps
|
1993
2969
|
});
|
1994
2970
|
__privateSet$1(this, _schemaTables, schema.tables);
|
@@ -2026,14 +3002,17 @@ async function resolveXataBranch(gitBranch, options) {
|
|
2026
3002
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2027
3003
|
);
|
2028
3004
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2029
|
-
const
|
3005
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3006
|
+
if (!urlParts)
|
3007
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3008
|
+
const { workspace, region } = urlParts;
|
2030
3009
|
const { fallbackBranch } = getEnvironment();
|
2031
3010
|
const { branch } = await resolveBranch({
|
2032
3011
|
apiKey,
|
2033
3012
|
apiUrl: databaseURL,
|
2034
3013
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2035
3014
|
workspacesApiUrl: `${protocol}//${host}`,
|
2036
|
-
pathParams: { dbName, workspace },
|
3015
|
+
pathParams: { dbName, workspace, region },
|
2037
3016
|
queryParams: { gitBranch, fallbackBranch },
|
2038
3017
|
trace: defaultTrace
|
2039
3018
|
});
|
@@ -2051,15 +3030,17 @@ async function getDatabaseBranch(branch, options) {
|
|
2051
3030
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2052
3031
|
);
|
2053
3032
|
const [protocol, , host, , database] = databaseURL.split("/");
|
2054
|
-
const
|
2055
|
-
|
3033
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3034
|
+
if (!urlParts)
|
3035
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3036
|
+
const { workspace, region } = urlParts;
|
2056
3037
|
try {
|
2057
3038
|
return await getBranchDetails({
|
2058
3039
|
apiKey,
|
2059
3040
|
apiUrl: databaseURL,
|
2060
3041
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2061
3042
|
workspacesApiUrl: `${protocol}//${host}`,
|
2062
|
-
pathParams: { dbBranchName
|
3043
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
2063
3044
|
trace: defaultTrace
|
2064
3045
|
});
|
2065
3046
|
} catch (err) {
|
@@ -2150,8 +3131,8 @@ const buildClient = (plugins) => {
|
|
2150
3131
|
if (!databaseURL) {
|
2151
3132
|
throw new Error("Option databaseURL is required");
|
2152
3133
|
}
|
2153
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2154
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
|
3134
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
3135
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
2155
3136
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2156
3137
|
if (!branchValue)
|
2157
3138
|
throw new Error("Unable to resolve branch value");
|
@@ -2161,10 +3142,11 @@ const buildClient = (plugins) => {
|
|
2161
3142
|
apiUrl: "",
|
2162
3143
|
workspacesApiUrl: (path, params) => {
|
2163
3144
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2164
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3145
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2165
3146
|
return databaseURL + newPath;
|
2166
3147
|
},
|
2167
|
-
trace
|
3148
|
+
trace,
|
3149
|
+
clientID
|
2168
3150
|
};
|
2169
3151
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2170
3152
|
if (__privateGet(this, _branch))
|
@@ -2276,5 +3258,5 @@ class XataError extends Error {
|
|
2276
3258
|
}
|
2277
3259
|
}
|
2278
3260
|
|
2279
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
3261
|
+
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, branchTransaction, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, dEPRECATEDcreateDatabase, dEPRECATEDdeleteDatabase, dEPRECATEDgetDatabaseList, dEPRECATEDgetDatabaseMetadata, dEPRECATEDupdateDatabaseMetadata, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, previewBranchSchemaEdit, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, summarizeTable, updateBranchMetadata, updateBranchSchema, updateColumn, updateDatabaseMetadata, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
2280
3262
|
//# sourceMappingURL=index.mjs.map
|