@xata.io/client 0.0.0-alpha.vf79e7d8 → 0.0.0-alpha.vf7c7a24
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 +126 -0
- package/README.md +30 -30
- package/Usage.md +7 -5
- package/dist/index.cjs +1495 -520
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4465 -1200
- package/dist/index.mjs +1466 -500
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- /package/{rollup.config.js → rollup.config.mjs} +0 -0
package/dist/index.mjs
CHANGED
@@ -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 {
|
@@ -82,6 +94,25 @@ function getEnvironment() {
|
|
82
94
|
fallbackBranch: getGlobalFallbackBranch()
|
83
95
|
};
|
84
96
|
}
|
97
|
+
function getEnableBrowserVariable() {
|
98
|
+
try {
|
99
|
+
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
100
|
+
return process.env.XATA_ENABLE_BROWSER === "true";
|
101
|
+
}
|
102
|
+
} catch (err) {
|
103
|
+
}
|
104
|
+
try {
|
105
|
+
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
106
|
+
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
107
|
+
}
|
108
|
+
} catch (err) {
|
109
|
+
}
|
110
|
+
try {
|
111
|
+
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
112
|
+
} catch (err) {
|
113
|
+
return void 0;
|
114
|
+
}
|
115
|
+
}
|
85
116
|
function getGlobalApiKey() {
|
86
117
|
try {
|
87
118
|
return XATA_API_KEY;
|
@@ -152,7 +183,7 @@ function getFetchImplementation(userFetch) {
|
|
152
183
|
return fetchImpl;
|
153
184
|
}
|
154
185
|
|
155
|
-
const VERSION = "0.0.0-alpha.
|
186
|
+
const VERSION = "0.0.0-alpha.vf7c7a24";
|
156
187
|
|
157
188
|
class ErrorWithCause extends Error {
|
158
189
|
constructor(message, options) {
|
@@ -203,18 +234,24 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
203
234
|
}, {});
|
204
235
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
205
236
|
const queryString = query.length > 0 ? `?${query}` : "";
|
206
|
-
|
237
|
+
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
238
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
|
239
|
+
}, {});
|
240
|
+
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
207
241
|
};
|
208
242
|
function buildBaseUrl({
|
243
|
+
endpoint,
|
209
244
|
path,
|
210
245
|
workspacesApiUrl,
|
211
246
|
apiUrl,
|
212
|
-
pathParams
|
247
|
+
pathParams = {}
|
213
248
|
}) {
|
214
|
-
if (
|
215
|
-
|
216
|
-
|
217
|
-
|
249
|
+
if (endpoint === "dataPlane") {
|
250
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
251
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
252
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
253
|
+
}
|
254
|
+
return `${apiUrl}${path}`;
|
218
255
|
}
|
219
256
|
function hostHeader(url) {
|
220
257
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -230,14 +267,19 @@ async function fetch$1({
|
|
230
267
|
queryParams,
|
231
268
|
fetchImpl,
|
232
269
|
apiKey,
|
270
|
+
endpoint,
|
233
271
|
apiUrl,
|
234
272
|
workspacesApiUrl,
|
235
|
-
trace
|
273
|
+
trace,
|
274
|
+
signal,
|
275
|
+
clientID,
|
276
|
+
sessionID,
|
277
|
+
fetchOptions = {}
|
236
278
|
}) {
|
237
279
|
return trace(
|
238
280
|
`${method.toUpperCase()} ${path}`,
|
239
|
-
async ({ setAttributes
|
240
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
281
|
+
async ({ setAttributes }) => {
|
282
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
241
283
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
242
284
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
243
285
|
setAttributes({
|
@@ -245,15 +287,19 @@ async function fetch$1({
|
|
245
287
|
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
246
288
|
});
|
247
289
|
const response = await fetchImpl(url, {
|
290
|
+
...fetchOptions,
|
248
291
|
method: method.toUpperCase(),
|
249
292
|
body: body ? JSON.stringify(body) : void 0,
|
250
293
|
headers: {
|
251
294
|
"Content-Type": "application/json",
|
252
295
|
"User-Agent": `Xata client-ts/${VERSION}`,
|
296
|
+
"X-Xata-Client-ID": clientID ?? "",
|
297
|
+
"X-Xata-Session-ID": sessionID ?? "",
|
253
298
|
...headers,
|
254
299
|
...hostHeader(fullUrl),
|
255
300
|
Authorization: `Bearer ${apiKey}`
|
256
|
-
}
|
301
|
+
},
|
302
|
+
signal
|
257
303
|
});
|
258
304
|
if (response.status === 204) {
|
259
305
|
return {};
|
@@ -261,6 +307,7 @@ async function fetch$1({
|
|
261
307
|
const { host, protocol } = parseUrl(response.url);
|
262
308
|
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
263
309
|
setAttributes({
|
310
|
+
[TraceAttributes.KIND]: "http",
|
264
311
|
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
265
312
|
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
266
313
|
[TraceAttributes.HTTP_HOST]: host,
|
@@ -273,9 +320,7 @@ async function fetch$1({
|
|
273
320
|
}
|
274
321
|
throw new FetcherError(response.status, jsonResponse, requestId);
|
275
322
|
} catch (error) {
|
276
|
-
|
277
|
-
onError(fetcherError.message);
|
278
|
-
throw fetcherError;
|
323
|
+
throw new FetcherError(response.status, error, requestId);
|
279
324
|
}
|
280
325
|
},
|
281
326
|
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
@@ -290,245 +335,163 @@ function parseUrl(url) {
|
|
290
335
|
}
|
291
336
|
}
|
292
337
|
|
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({
|
338
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
339
|
+
|
340
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
341
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
380
342
|
url: "/dbs/{dbName}",
|
381
|
-
method: "delete",
|
382
|
-
...variables
|
383
|
-
});
|
384
|
-
const getDatabaseMetadata = (variables) => fetch$1({
|
385
|
-
url: "/dbs/{dbName}/metadata",
|
386
343
|
method: "get",
|
387
|
-
...variables
|
344
|
+
...variables,
|
345
|
+
signal
|
388
346
|
});
|
389
|
-
const
|
390
|
-
const
|
391
|
-
const
|
392
|
-
const
|
393
|
-
|
394
|
-
method: "get",
|
395
|
-
...variables
|
396
|
-
});
|
397
|
-
const getBranchDetails = (variables) => fetch$1({
|
347
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
348
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
349
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
350
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
351
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
398
352
|
url: "/db/{dbBranchName}",
|
399
353
|
method: "get",
|
400
|
-
...variables
|
354
|
+
...variables,
|
355
|
+
signal
|
401
356
|
});
|
402
|
-
const createBranch = (variables) =>
|
403
|
-
const deleteBranch = (variables) =>
|
357
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
358
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
404
359
|
url: "/db/{dbBranchName}",
|
405
360
|
method: "delete",
|
406
|
-
...variables
|
361
|
+
...variables,
|
362
|
+
signal
|
407
363
|
});
|
408
|
-
const updateBranchMetadata = (variables) =>
|
364
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
409
365
|
url: "/db/{dbBranchName}/metadata",
|
410
366
|
method: "put",
|
411
|
-
...variables
|
367
|
+
...variables,
|
368
|
+
signal
|
412
369
|
});
|
413
|
-
const getBranchMetadata = (variables) =>
|
370
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
414
371
|
url: "/db/{dbBranchName}/metadata",
|
415
372
|
method: "get",
|
416
|
-
...variables
|
373
|
+
...variables,
|
374
|
+
signal
|
417
375
|
});
|
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({
|
376
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
422
377
|
url: "/db/{dbBranchName}/stats",
|
423
378
|
method: "get",
|
424
|
-
...variables
|
379
|
+
...variables,
|
380
|
+
signal
|
381
|
+
});
|
382
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
383
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
384
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
385
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
386
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
387
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
388
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
389
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
390
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
391
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
392
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
393
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
394
|
+
method: "get",
|
395
|
+
...variables,
|
396
|
+
signal
|
425
397
|
});
|
426
|
-
const
|
398
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
399
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
400
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
401
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
402
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
403
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
404
|
+
method: "post",
|
405
|
+
...variables,
|
406
|
+
signal
|
407
|
+
});
|
408
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
409
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
410
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
411
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
412
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
413
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
414
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
427
415
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
428
416
|
method: "put",
|
429
|
-
...variables
|
417
|
+
...variables,
|
418
|
+
signal
|
430
419
|
});
|
431
|
-
const deleteTable = (variables) =>
|
420
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
432
421
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
433
422
|
method: "delete",
|
434
|
-
...variables
|
435
|
-
|
436
|
-
const updateTable = (variables) => fetch$1({
|
437
|
-
url: "/db/{dbBranchName}/tables/{tableName}",
|
438
|
-
method: "patch",
|
439
|
-
...variables
|
423
|
+
...variables,
|
424
|
+
signal
|
440
425
|
});
|
441
|
-
const
|
426
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
427
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
442
428
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
443
429
|
method: "get",
|
444
|
-
...variables
|
430
|
+
...variables,
|
431
|
+
signal
|
445
432
|
});
|
446
|
-
const setTableSchema = (variables) =>
|
447
|
-
|
448
|
-
method: "put",
|
449
|
-
...variables
|
450
|
-
});
|
451
|
-
const getTableColumns = (variables) => fetch$1({
|
433
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
434
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
452
435
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
453
436
|
method: "get",
|
454
|
-
...variables
|
437
|
+
...variables,
|
438
|
+
signal
|
455
439
|
});
|
456
|
-
const addTableColumn = (variables) =>
|
457
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
458
|
-
|
459
|
-
|
460
|
-
});
|
461
|
-
const getColumn = (variables) => fetch$1({
|
440
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
441
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
442
|
+
);
|
443
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
462
444
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
463
445
|
method: "get",
|
464
|
-
...variables
|
446
|
+
...variables,
|
447
|
+
signal
|
465
448
|
});
|
466
|
-
const
|
449
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
450
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
467
451
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
468
452
|
method: "delete",
|
469
|
-
...variables
|
470
|
-
|
471
|
-
const updateColumn = (variables) => fetch$1({
|
472
|
-
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
|
-
method: "delete",
|
483
|
-
...variables
|
453
|
+
...variables,
|
454
|
+
signal
|
484
455
|
});
|
485
|
-
const
|
456
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
457
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
486
458
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
487
459
|
method: "get",
|
488
|
-
...variables
|
460
|
+
...variables,
|
461
|
+
signal
|
489
462
|
});
|
490
|
-
const
|
491
|
-
const
|
463
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
464
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
465
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
466
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
467
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
468
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
492
469
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
493
470
|
method: "post",
|
494
|
-
...variables
|
471
|
+
...variables,
|
472
|
+
signal
|
495
473
|
});
|
496
|
-
const
|
497
|
-
url: "/db/{dbBranchName}/
|
474
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
475
|
+
url: "/db/{dbBranchName}/search",
|
498
476
|
method: "post",
|
499
|
-
...variables
|
477
|
+
...variables,
|
478
|
+
signal
|
500
479
|
});
|
501
|
-
const
|
502
|
-
url: "/db/{dbBranchName}/search",
|
480
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
481
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
503
482
|
method: "post",
|
504
|
-
...variables
|
483
|
+
...variables,
|
484
|
+
signal
|
505
485
|
});
|
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
|
-
},
|
486
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
487
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
488
|
+
const operationsByTag$2 = {
|
523
489
|
database: {
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
addGitBranchesEntry,
|
530
|
-
removeGitBranchesEntry,
|
531
|
-
resolveBranch
|
490
|
+
dEPRECATEDgetDatabaseList,
|
491
|
+
dEPRECATEDcreateDatabase,
|
492
|
+
dEPRECATEDdeleteDatabase,
|
493
|
+
dEPRECATEDgetDatabaseMetadata,
|
494
|
+
dEPRECATEDupdateDatabaseMetadata
|
532
495
|
},
|
533
496
|
branch: {
|
534
497
|
getBranchList,
|
@@ -537,10 +500,42 @@ const operationsByTag = {
|
|
537
500
|
deleteBranch,
|
538
501
|
updateBranchMetadata,
|
539
502
|
getBranchMetadata,
|
503
|
+
getBranchStats,
|
504
|
+
getGitBranchesMapping,
|
505
|
+
addGitBranchesEntry,
|
506
|
+
removeGitBranchesEntry,
|
507
|
+
resolveBranch
|
508
|
+
},
|
509
|
+
migrations: {
|
540
510
|
getBranchMigrationHistory,
|
541
|
-
executeBranchMigrationPlan,
|
542
511
|
getBranchMigrationPlan,
|
543
|
-
|
512
|
+
executeBranchMigrationPlan,
|
513
|
+
getBranchSchemaHistory,
|
514
|
+
compareBranchWithUserSchema,
|
515
|
+
compareBranchSchemas,
|
516
|
+
updateBranchSchema,
|
517
|
+
previewBranchSchemaEdit,
|
518
|
+
applyBranchSchemaEdit
|
519
|
+
},
|
520
|
+
records: {
|
521
|
+
branchTransaction,
|
522
|
+
insertRecord,
|
523
|
+
getRecord,
|
524
|
+
insertRecordWithID,
|
525
|
+
updateRecordWithID,
|
526
|
+
upsertRecordWithID,
|
527
|
+
deleteRecord,
|
528
|
+
bulkInsertTableRecords
|
529
|
+
},
|
530
|
+
migrationRequests: {
|
531
|
+
queryMigrationRequests,
|
532
|
+
createMigrationRequest,
|
533
|
+
getMigrationRequest,
|
534
|
+
updateMigrationRequest,
|
535
|
+
listMigrationRequestsCommits,
|
536
|
+
compareMigrationRequest,
|
537
|
+
getMigrationRequestIsMerged,
|
538
|
+
mergeMigrationRequest
|
544
539
|
},
|
545
540
|
table: {
|
546
541
|
createTable,
|
@@ -551,23 +546,146 @@ const operationsByTag = {
|
|
551
546
|
getTableColumns,
|
552
547
|
addTableColumn,
|
553
548
|
getColumn,
|
554
|
-
|
555
|
-
|
549
|
+
updateColumn,
|
550
|
+
deleteColumn
|
556
551
|
},
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
552
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
553
|
+
};
|
554
|
+
|
555
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
556
|
+
|
557
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
558
|
+
url: "/user",
|
559
|
+
method: "get",
|
560
|
+
...variables,
|
561
|
+
signal
|
562
|
+
});
|
563
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
564
|
+
url: "/user",
|
565
|
+
method: "put",
|
566
|
+
...variables,
|
567
|
+
signal
|
568
|
+
});
|
569
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
570
|
+
url: "/user",
|
571
|
+
method: "delete",
|
572
|
+
...variables,
|
573
|
+
signal
|
574
|
+
});
|
575
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
576
|
+
url: "/user/keys",
|
577
|
+
method: "get",
|
578
|
+
...variables,
|
579
|
+
signal
|
580
|
+
});
|
581
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
582
|
+
url: "/user/keys/{keyName}",
|
583
|
+
method: "post",
|
584
|
+
...variables,
|
585
|
+
signal
|
586
|
+
});
|
587
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
588
|
+
url: "/user/keys/{keyName}",
|
589
|
+
method: "delete",
|
590
|
+
...variables,
|
591
|
+
signal
|
592
|
+
});
|
593
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
594
|
+
url: "/workspaces",
|
595
|
+
method: "get",
|
596
|
+
...variables,
|
597
|
+
signal
|
598
|
+
});
|
599
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
600
|
+
url: "/workspaces",
|
601
|
+
method: "post",
|
602
|
+
...variables,
|
603
|
+
signal
|
604
|
+
});
|
605
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
606
|
+
url: "/workspaces/{workspaceId}",
|
607
|
+
method: "get",
|
608
|
+
...variables,
|
609
|
+
signal
|
610
|
+
});
|
611
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
612
|
+
url: "/workspaces/{workspaceId}",
|
613
|
+
method: "put",
|
614
|
+
...variables,
|
615
|
+
signal
|
616
|
+
});
|
617
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
618
|
+
url: "/workspaces/{workspaceId}",
|
619
|
+
method: "delete",
|
620
|
+
...variables,
|
621
|
+
signal
|
622
|
+
});
|
623
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
624
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
625
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
626
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
627
|
+
method: "delete",
|
628
|
+
...variables,
|
629
|
+
signal
|
630
|
+
});
|
631
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
632
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
633
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
634
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
635
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
636
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
637
|
+
url: "/workspaces/{workspaceId}/dbs",
|
638
|
+
method: "get",
|
639
|
+
...variables,
|
640
|
+
signal
|
641
|
+
});
|
642
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
643
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
644
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
645
|
+
method: "delete",
|
646
|
+
...variables,
|
647
|
+
signal
|
648
|
+
});
|
649
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
650
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
651
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
652
|
+
url: "/workspaces/{workspaceId}/regions",
|
653
|
+
method: "get",
|
654
|
+
...variables,
|
655
|
+
signal
|
656
|
+
});
|
657
|
+
const operationsByTag$1 = {
|
658
|
+
users: { getUser, updateUser, deleteUser },
|
659
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
660
|
+
workspaces: {
|
661
|
+
getWorkspacesList,
|
662
|
+
createWorkspace,
|
663
|
+
getWorkspace,
|
664
|
+
updateWorkspace,
|
665
|
+
deleteWorkspace,
|
666
|
+
getWorkspaceMembersList,
|
667
|
+
updateWorkspaceMemberRole,
|
668
|
+
removeWorkspaceMember
|
669
|
+
},
|
670
|
+
invites: {
|
671
|
+
inviteWorkspaceMember,
|
672
|
+
updateWorkspaceMemberInvite,
|
673
|
+
cancelWorkspaceMemberInvite,
|
674
|
+
acceptWorkspaceMemberInvite,
|
675
|
+
resendWorkspaceMemberInvite
|
676
|
+
},
|
677
|
+
databases: {
|
678
|
+
getDatabaseList,
|
679
|
+
createDatabase,
|
680
|
+
deleteDatabase,
|
681
|
+
getDatabaseMetadata,
|
682
|
+
updateDatabaseMetadata,
|
683
|
+
listRegions
|
568
684
|
}
|
569
685
|
};
|
570
686
|
|
687
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
688
|
+
|
571
689
|
function getHostUrl(provider, type) {
|
572
690
|
if (isHostProviderAlias(provider)) {
|
573
691
|
return providers[provider][type];
|
@@ -579,11 +697,11 @@ function getHostUrl(provider, type) {
|
|
579
697
|
const providers = {
|
580
698
|
production: {
|
581
699
|
main: "https://api.xata.io",
|
582
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
700
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
583
701
|
},
|
584
702
|
staging: {
|
585
703
|
main: "https://staging.xatabase.co",
|
586
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
704
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
587
705
|
}
|
588
706
|
};
|
589
707
|
function isHostProviderAlias(alias) {
|
@@ -592,6 +710,25 @@ function isHostProviderAlias(alias) {
|
|
592
710
|
function isHostProviderBuilder(builder) {
|
593
711
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
594
712
|
}
|
713
|
+
function parseProviderString(provider = "production") {
|
714
|
+
if (isHostProviderAlias(provider)) {
|
715
|
+
return provider;
|
716
|
+
}
|
717
|
+
const [main, workspaces] = provider.split(",");
|
718
|
+
if (!main || !workspaces)
|
719
|
+
return null;
|
720
|
+
return { main, workspaces };
|
721
|
+
}
|
722
|
+
function parseWorkspacesUrlParts(url) {
|
723
|
+
if (!isString(url))
|
724
|
+
return null;
|
725
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))?\.xata\.sh.*/;
|
726
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))?\.xatabase\.co.*/;
|
727
|
+
const match = url.match(regex) || url.match(regexStaging);
|
728
|
+
if (!match)
|
729
|
+
return null;
|
730
|
+
return { workspace: match[1], region: match[2] ?? "eu-west-1" };
|
731
|
+
}
|
595
732
|
|
596
733
|
var __accessCheck$7 = (obj, member, msg) => {
|
597
734
|
if (!member.has(obj))
|
@@ -635,21 +772,41 @@ class XataApiClient {
|
|
635
772
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
636
773
|
return __privateGet$7(this, _namespaces).user;
|
637
774
|
}
|
775
|
+
get authentication() {
|
776
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
777
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
778
|
+
return __privateGet$7(this, _namespaces).authentication;
|
779
|
+
}
|
638
780
|
get workspaces() {
|
639
781
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
640
782
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
641
783
|
return __privateGet$7(this, _namespaces).workspaces;
|
642
784
|
}
|
643
|
-
get
|
644
|
-
if (!__privateGet$7(this, _namespaces).
|
645
|
-
__privateGet$7(this, _namespaces).
|
646
|
-
return __privateGet$7(this, _namespaces).
|
785
|
+
get invites() {
|
786
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
787
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
788
|
+
return __privateGet$7(this, _namespaces).invites;
|
789
|
+
}
|
790
|
+
get database() {
|
791
|
+
if (!__privateGet$7(this, _namespaces).database)
|
792
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
793
|
+
return __privateGet$7(this, _namespaces).database;
|
647
794
|
}
|
648
795
|
get branches() {
|
649
796
|
if (!__privateGet$7(this, _namespaces).branches)
|
650
797
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
651
798
|
return __privateGet$7(this, _namespaces).branches;
|
652
799
|
}
|
800
|
+
get migrations() {
|
801
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
802
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
803
|
+
return __privateGet$7(this, _namespaces).migrations;
|
804
|
+
}
|
805
|
+
get migrationRequests() {
|
806
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
807
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
808
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
809
|
+
}
|
653
810
|
get tables() {
|
654
811
|
if (!__privateGet$7(this, _namespaces).tables)
|
655
812
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -660,6 +817,11 @@ class XataApiClient {
|
|
660
817
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
661
818
|
return __privateGet$7(this, _namespaces).records;
|
662
819
|
}
|
820
|
+
get searchAndFilter() {
|
821
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
822
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
823
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
824
|
+
}
|
663
825
|
}
|
664
826
|
_extraProps = new WeakMap();
|
665
827
|
_namespaces = new WeakMap();
|
@@ -670,24 +832,29 @@ class UserApi {
|
|
670
832
|
getUser() {
|
671
833
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
672
834
|
}
|
673
|
-
updateUser(user) {
|
835
|
+
updateUser({ user }) {
|
674
836
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
675
837
|
}
|
676
838
|
deleteUser() {
|
677
839
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
678
840
|
}
|
841
|
+
}
|
842
|
+
class AuthenticationApi {
|
843
|
+
constructor(extraProps) {
|
844
|
+
this.extraProps = extraProps;
|
845
|
+
}
|
679
846
|
getUserAPIKeys() {
|
680
|
-
return operationsByTag.
|
847
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
681
848
|
}
|
682
|
-
createUserAPIKey(
|
683
|
-
return operationsByTag.
|
684
|
-
pathParams: { keyName },
|
849
|
+
createUserAPIKey({ name }) {
|
850
|
+
return operationsByTag.authentication.createUserAPIKey({
|
851
|
+
pathParams: { keyName: name },
|
685
852
|
...this.extraProps
|
686
853
|
});
|
687
854
|
}
|
688
|
-
deleteUserAPIKey(
|
689
|
-
return operationsByTag.
|
690
|
-
pathParams: { keyName },
|
855
|
+
deleteUserAPIKey({ name }) {
|
856
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
857
|
+
pathParams: { keyName: name },
|
691
858
|
...this.extraProps
|
692
859
|
});
|
693
860
|
}
|
@@ -696,139 +863,114 @@ class WorkspaceApi {
|
|
696
863
|
constructor(extraProps) {
|
697
864
|
this.extraProps = extraProps;
|
698
865
|
}
|
699
|
-
|
866
|
+
getWorkspacesList() {
|
867
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
868
|
+
}
|
869
|
+
createWorkspace({ data }) {
|
700
870
|
return operationsByTag.workspaces.createWorkspace({
|
701
|
-
body:
|
871
|
+
body: data,
|
702
872
|
...this.extraProps
|
703
873
|
});
|
704
874
|
}
|
705
|
-
|
706
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
707
|
-
}
|
708
|
-
getWorkspace(workspaceId) {
|
875
|
+
getWorkspace({ workspace }) {
|
709
876
|
return operationsByTag.workspaces.getWorkspace({
|
710
|
-
pathParams: { workspaceId },
|
877
|
+
pathParams: { workspaceId: workspace },
|
711
878
|
...this.extraProps
|
712
879
|
});
|
713
880
|
}
|
714
|
-
updateWorkspace(
|
881
|
+
updateWorkspace({
|
882
|
+
workspace,
|
883
|
+
update
|
884
|
+
}) {
|
715
885
|
return operationsByTag.workspaces.updateWorkspace({
|
716
|
-
pathParams: { workspaceId },
|
717
|
-
body:
|
886
|
+
pathParams: { workspaceId: workspace },
|
887
|
+
body: update,
|
718
888
|
...this.extraProps
|
719
889
|
});
|
720
890
|
}
|
721
|
-
deleteWorkspace(
|
891
|
+
deleteWorkspace({ workspace }) {
|
722
892
|
return operationsByTag.workspaces.deleteWorkspace({
|
723
|
-
pathParams: { workspaceId },
|
893
|
+
pathParams: { workspaceId: workspace },
|
724
894
|
...this.extraProps
|
725
895
|
});
|
726
896
|
}
|
727
|
-
getWorkspaceMembersList(
|
897
|
+
getWorkspaceMembersList({ workspace }) {
|
728
898
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
729
|
-
pathParams: { workspaceId },
|
899
|
+
pathParams: { workspaceId: workspace },
|
730
900
|
...this.extraProps
|
731
901
|
});
|
732
902
|
}
|
733
|
-
updateWorkspaceMemberRole(
|
903
|
+
updateWorkspaceMemberRole({
|
904
|
+
workspace,
|
905
|
+
user,
|
906
|
+
role
|
907
|
+
}) {
|
734
908
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
735
|
-
pathParams: { workspaceId, userId },
|
909
|
+
pathParams: { workspaceId: workspace, userId: user },
|
736
910
|
body: { role },
|
737
911
|
...this.extraProps
|
738
912
|
});
|
739
913
|
}
|
740
|
-
removeWorkspaceMember(
|
914
|
+
removeWorkspaceMember({
|
915
|
+
workspace,
|
916
|
+
user
|
917
|
+
}) {
|
741
918
|
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 },
|
919
|
+
pathParams: { workspaceId: workspace, userId: user },
|
775
920
|
...this.extraProps
|
776
921
|
});
|
777
922
|
}
|
778
923
|
}
|
779
|
-
class
|
924
|
+
class InvitesApi {
|
780
925
|
constructor(extraProps) {
|
781
926
|
this.extraProps = extraProps;
|
782
927
|
}
|
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 },
|
928
|
+
inviteWorkspaceMember({
|
929
|
+
workspace,
|
930
|
+
email,
|
931
|
+
role
|
932
|
+
}) {
|
933
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
934
|
+
pathParams: { workspaceId: workspace },
|
935
|
+
body: { email, role },
|
805
936
|
...this.extraProps
|
806
937
|
});
|
807
938
|
}
|
808
|
-
|
809
|
-
|
810
|
-
|
939
|
+
updateWorkspaceMemberInvite({
|
940
|
+
workspace,
|
941
|
+
invite,
|
942
|
+
role
|
943
|
+
}) {
|
944
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
945
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
946
|
+
body: { role },
|
811
947
|
...this.extraProps
|
812
948
|
});
|
813
949
|
}
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
950
|
+
cancelWorkspaceMemberInvite({
|
951
|
+
workspace,
|
952
|
+
invite
|
953
|
+
}) {
|
954
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
955
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
818
956
|
...this.extraProps
|
819
957
|
});
|
820
958
|
}
|
821
|
-
|
822
|
-
|
823
|
-
|
824
|
-
|
959
|
+
acceptWorkspaceMemberInvite({
|
960
|
+
workspace,
|
961
|
+
key
|
962
|
+
}) {
|
963
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
964
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
825
965
|
...this.extraProps
|
826
966
|
});
|
827
967
|
}
|
828
|
-
|
829
|
-
|
830
|
-
|
831
|
-
|
968
|
+
resendWorkspaceMemberInvite({
|
969
|
+
workspace,
|
970
|
+
invite
|
971
|
+
}) {
|
972
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
973
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
832
974
|
...this.extraProps
|
833
975
|
});
|
834
976
|
}
|
@@ -837,69 +979,132 @@ class BranchApi {
|
|
837
979
|
constructor(extraProps) {
|
838
980
|
this.extraProps = extraProps;
|
839
981
|
}
|
840
|
-
getBranchList(
|
982
|
+
getBranchList({
|
983
|
+
workspace,
|
984
|
+
region,
|
985
|
+
database
|
986
|
+
}) {
|
841
987
|
return operationsByTag.branch.getBranchList({
|
842
|
-
pathParams: { workspace, dbName },
|
988
|
+
pathParams: { workspace, region, dbName: database },
|
843
989
|
...this.extraProps
|
844
990
|
});
|
845
991
|
}
|
846
|
-
getBranchDetails(
|
992
|
+
getBranchDetails({
|
993
|
+
workspace,
|
994
|
+
region,
|
995
|
+
database,
|
996
|
+
branch
|
997
|
+
}) {
|
847
998
|
return operationsByTag.branch.getBranchDetails({
|
848
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
999
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
849
1000
|
...this.extraProps
|
850
1001
|
});
|
851
1002
|
}
|
852
|
-
createBranch(
|
1003
|
+
createBranch({
|
1004
|
+
workspace,
|
1005
|
+
region,
|
1006
|
+
database,
|
1007
|
+
branch,
|
1008
|
+
from,
|
1009
|
+
metadata
|
1010
|
+
}) {
|
853
1011
|
return operationsByTag.branch.createBranch({
|
854
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
855
|
-
|
856
|
-
body: options,
|
1012
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1013
|
+
body: { from, metadata },
|
857
1014
|
...this.extraProps
|
858
1015
|
});
|
859
1016
|
}
|
860
|
-
deleteBranch(
|
1017
|
+
deleteBranch({
|
1018
|
+
workspace,
|
1019
|
+
region,
|
1020
|
+
database,
|
1021
|
+
branch
|
1022
|
+
}) {
|
861
1023
|
return operationsByTag.branch.deleteBranch({
|
862
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1024
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
863
1025
|
...this.extraProps
|
864
1026
|
});
|
865
1027
|
}
|
866
|
-
updateBranchMetadata(
|
1028
|
+
updateBranchMetadata({
|
1029
|
+
workspace,
|
1030
|
+
region,
|
1031
|
+
database,
|
1032
|
+
branch,
|
1033
|
+
metadata
|
1034
|
+
}) {
|
867
1035
|
return operationsByTag.branch.updateBranchMetadata({
|
868
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1036
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
869
1037
|
body: metadata,
|
870
1038
|
...this.extraProps
|
871
1039
|
});
|
872
1040
|
}
|
873
|
-
getBranchMetadata(
|
1041
|
+
getBranchMetadata({
|
1042
|
+
workspace,
|
1043
|
+
region,
|
1044
|
+
database,
|
1045
|
+
branch
|
1046
|
+
}) {
|
874
1047
|
return operationsByTag.branch.getBranchMetadata({
|
875
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1048
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
876
1049
|
...this.extraProps
|
877
1050
|
});
|
878
1051
|
}
|
879
|
-
|
880
|
-
|
881
|
-
|
882
|
-
|
1052
|
+
getBranchStats({
|
1053
|
+
workspace,
|
1054
|
+
region,
|
1055
|
+
database,
|
1056
|
+
branch
|
1057
|
+
}) {
|
1058
|
+
return operationsByTag.branch.getBranchStats({
|
1059
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
883
1060
|
...this.extraProps
|
884
1061
|
});
|
885
1062
|
}
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
1063
|
+
getGitBranchesMapping({
|
1064
|
+
workspace,
|
1065
|
+
region,
|
1066
|
+
database
|
1067
|
+
}) {
|
1068
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1069
|
+
pathParams: { workspace, region, dbName: database },
|
890
1070
|
...this.extraProps
|
891
1071
|
});
|
892
1072
|
}
|
893
|
-
|
894
|
-
|
895
|
-
|
896
|
-
|
1073
|
+
addGitBranchesEntry({
|
1074
|
+
workspace,
|
1075
|
+
region,
|
1076
|
+
database,
|
1077
|
+
gitBranch,
|
1078
|
+
xataBranch
|
1079
|
+
}) {
|
1080
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1081
|
+
pathParams: { workspace, region, dbName: database },
|
1082
|
+
body: { gitBranch, xataBranch },
|
897
1083
|
...this.extraProps
|
898
1084
|
});
|
899
1085
|
}
|
900
|
-
|
901
|
-
|
902
|
-
|
1086
|
+
removeGitBranchesEntry({
|
1087
|
+
workspace,
|
1088
|
+
region,
|
1089
|
+
database,
|
1090
|
+
gitBranch
|
1091
|
+
}) {
|
1092
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1093
|
+
pathParams: { workspace, region, dbName: database },
|
1094
|
+
queryParams: { gitBranch },
|
1095
|
+
...this.extraProps
|
1096
|
+
});
|
1097
|
+
}
|
1098
|
+
resolveBranch({
|
1099
|
+
workspace,
|
1100
|
+
region,
|
1101
|
+
database,
|
1102
|
+
gitBranch,
|
1103
|
+
fallbackBranch
|
1104
|
+
}) {
|
1105
|
+
return operationsByTag.branch.resolveBranch({
|
1106
|
+
pathParams: { workspace, region, dbName: database },
|
1107
|
+
queryParams: { gitBranch, fallbackBranch },
|
903
1108
|
...this.extraProps
|
904
1109
|
});
|
905
1110
|
}
|
@@ -908,67 +1113,134 @@ class TableApi {
|
|
908
1113
|
constructor(extraProps) {
|
909
1114
|
this.extraProps = extraProps;
|
910
1115
|
}
|
911
|
-
createTable(
|
1116
|
+
createTable({
|
1117
|
+
workspace,
|
1118
|
+
region,
|
1119
|
+
database,
|
1120
|
+
branch,
|
1121
|
+
table
|
1122
|
+
}) {
|
912
1123
|
return operationsByTag.table.createTable({
|
913
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1124
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
914
1125
|
...this.extraProps
|
915
1126
|
});
|
916
1127
|
}
|
917
|
-
deleteTable(
|
1128
|
+
deleteTable({
|
1129
|
+
workspace,
|
1130
|
+
region,
|
1131
|
+
database,
|
1132
|
+
branch,
|
1133
|
+
table
|
1134
|
+
}) {
|
918
1135
|
return operationsByTag.table.deleteTable({
|
919
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1136
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
920
1137
|
...this.extraProps
|
921
1138
|
});
|
922
1139
|
}
|
923
|
-
updateTable(
|
1140
|
+
updateTable({
|
1141
|
+
workspace,
|
1142
|
+
region,
|
1143
|
+
database,
|
1144
|
+
branch,
|
1145
|
+
table,
|
1146
|
+
update
|
1147
|
+
}) {
|
924
1148
|
return operationsByTag.table.updateTable({
|
925
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
926
|
-
body:
|
1149
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1150
|
+
body: update,
|
927
1151
|
...this.extraProps
|
928
1152
|
});
|
929
1153
|
}
|
930
|
-
getTableSchema(
|
1154
|
+
getTableSchema({
|
1155
|
+
workspace,
|
1156
|
+
region,
|
1157
|
+
database,
|
1158
|
+
branch,
|
1159
|
+
table
|
1160
|
+
}) {
|
931
1161
|
return operationsByTag.table.getTableSchema({
|
932
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1162
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
933
1163
|
...this.extraProps
|
934
1164
|
});
|
935
1165
|
}
|
936
|
-
setTableSchema(
|
1166
|
+
setTableSchema({
|
1167
|
+
workspace,
|
1168
|
+
region,
|
1169
|
+
database,
|
1170
|
+
branch,
|
1171
|
+
table,
|
1172
|
+
schema
|
1173
|
+
}) {
|
937
1174
|
return operationsByTag.table.setTableSchema({
|
938
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
939
|
-
body:
|
1175
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1176
|
+
body: schema,
|
940
1177
|
...this.extraProps
|
941
1178
|
});
|
942
1179
|
}
|
943
|
-
getTableColumns(
|
1180
|
+
getTableColumns({
|
1181
|
+
workspace,
|
1182
|
+
region,
|
1183
|
+
database,
|
1184
|
+
branch,
|
1185
|
+
table
|
1186
|
+
}) {
|
944
1187
|
return operationsByTag.table.getTableColumns({
|
945
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1188
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
946
1189
|
...this.extraProps
|
947
1190
|
});
|
948
1191
|
}
|
949
|
-
addTableColumn(
|
1192
|
+
addTableColumn({
|
1193
|
+
workspace,
|
1194
|
+
region,
|
1195
|
+
database,
|
1196
|
+
branch,
|
1197
|
+
table,
|
1198
|
+
column
|
1199
|
+
}) {
|
950
1200
|
return operationsByTag.table.addTableColumn({
|
951
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1201
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
952
1202
|
body: column,
|
953
1203
|
...this.extraProps
|
954
1204
|
});
|
955
1205
|
}
|
956
|
-
getColumn(
|
1206
|
+
getColumn({
|
1207
|
+
workspace,
|
1208
|
+
region,
|
1209
|
+
database,
|
1210
|
+
branch,
|
1211
|
+
table,
|
1212
|
+
column
|
1213
|
+
}) {
|
957
1214
|
return operationsByTag.table.getColumn({
|
958
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1215
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
959
1216
|
...this.extraProps
|
960
1217
|
});
|
961
1218
|
}
|
962
|
-
|
963
|
-
|
964
|
-
|
1219
|
+
updateColumn({
|
1220
|
+
workspace,
|
1221
|
+
region,
|
1222
|
+
database,
|
1223
|
+
branch,
|
1224
|
+
table,
|
1225
|
+
column,
|
1226
|
+
update
|
1227
|
+
}) {
|
1228
|
+
return operationsByTag.table.updateColumn({
|
1229
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1230
|
+
body: update,
|
965
1231
|
...this.extraProps
|
966
1232
|
});
|
967
1233
|
}
|
968
|
-
|
969
|
-
|
970
|
-
|
971
|
-
|
1234
|
+
deleteColumn({
|
1235
|
+
workspace,
|
1236
|
+
region,
|
1237
|
+
database,
|
1238
|
+
branch,
|
1239
|
+
table,
|
1240
|
+
column
|
1241
|
+
}) {
|
1242
|
+
return operationsByTag.table.deleteColumn({
|
1243
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
972
1244
|
...this.extraProps
|
973
1245
|
});
|
974
1246
|
}
|
@@ -977,78 +1249,498 @@ class RecordsApi {
|
|
977
1249
|
constructor(extraProps) {
|
978
1250
|
this.extraProps = extraProps;
|
979
1251
|
}
|
980
|
-
insertRecord(
|
1252
|
+
insertRecord({
|
1253
|
+
workspace,
|
1254
|
+
region,
|
1255
|
+
database,
|
1256
|
+
branch,
|
1257
|
+
table,
|
1258
|
+
record,
|
1259
|
+
columns
|
1260
|
+
}) {
|
981
1261
|
return operationsByTag.records.insertRecord({
|
982
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
983
|
-
queryParams:
|
1262
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1263
|
+
queryParams: { columns },
|
984
1264
|
body: record,
|
985
1265
|
...this.extraProps
|
986
1266
|
});
|
987
1267
|
}
|
988
|
-
|
1268
|
+
getRecord({
|
1269
|
+
workspace,
|
1270
|
+
region,
|
1271
|
+
database,
|
1272
|
+
branch,
|
1273
|
+
table,
|
1274
|
+
id,
|
1275
|
+
columns
|
1276
|
+
}) {
|
1277
|
+
return operationsByTag.records.getRecord({
|
1278
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1279
|
+
queryParams: { columns },
|
1280
|
+
...this.extraProps
|
1281
|
+
});
|
1282
|
+
}
|
1283
|
+
insertRecordWithID({
|
1284
|
+
workspace,
|
1285
|
+
region,
|
1286
|
+
database,
|
1287
|
+
branch,
|
1288
|
+
table,
|
1289
|
+
id,
|
1290
|
+
record,
|
1291
|
+
columns,
|
1292
|
+
createOnly,
|
1293
|
+
ifVersion
|
1294
|
+
}) {
|
989
1295
|
return operationsByTag.records.insertRecordWithID({
|
990
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
991
|
-
queryParams:
|
1296
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1297
|
+
queryParams: { columns, createOnly, ifVersion },
|
992
1298
|
body: record,
|
993
1299
|
...this.extraProps
|
994
1300
|
});
|
995
1301
|
}
|
996
|
-
updateRecordWithID(
|
1302
|
+
updateRecordWithID({
|
1303
|
+
workspace,
|
1304
|
+
region,
|
1305
|
+
database,
|
1306
|
+
branch,
|
1307
|
+
table,
|
1308
|
+
id,
|
1309
|
+
record,
|
1310
|
+
columns,
|
1311
|
+
ifVersion
|
1312
|
+
}) {
|
997
1313
|
return operationsByTag.records.updateRecordWithID({
|
998
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
999
|
-
queryParams:
|
1314
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1315
|
+
queryParams: { columns, ifVersion },
|
1000
1316
|
body: record,
|
1001
1317
|
...this.extraProps
|
1002
1318
|
});
|
1003
1319
|
}
|
1004
|
-
upsertRecordWithID(
|
1320
|
+
upsertRecordWithID({
|
1321
|
+
workspace,
|
1322
|
+
region,
|
1323
|
+
database,
|
1324
|
+
branch,
|
1325
|
+
table,
|
1326
|
+
id,
|
1327
|
+
record,
|
1328
|
+
columns,
|
1329
|
+
ifVersion
|
1330
|
+
}) {
|
1005
1331
|
return operationsByTag.records.upsertRecordWithID({
|
1006
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1007
|
-
queryParams:
|
1332
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1333
|
+
queryParams: { columns, ifVersion },
|
1008
1334
|
body: record,
|
1009
1335
|
...this.extraProps
|
1010
1336
|
});
|
1011
1337
|
}
|
1012
|
-
deleteRecord(
|
1338
|
+
deleteRecord({
|
1339
|
+
workspace,
|
1340
|
+
region,
|
1341
|
+
database,
|
1342
|
+
branch,
|
1343
|
+
table,
|
1344
|
+
id,
|
1345
|
+
columns
|
1346
|
+
}) {
|
1013
1347
|
return operationsByTag.records.deleteRecord({
|
1014
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1015
|
-
queryParams:
|
1348
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1349
|
+
queryParams: { columns },
|
1016
1350
|
...this.extraProps
|
1017
1351
|
});
|
1018
1352
|
}
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
1353
|
+
bulkInsertTableRecords({
|
1354
|
+
workspace,
|
1355
|
+
region,
|
1356
|
+
database,
|
1357
|
+
branch,
|
1358
|
+
table,
|
1359
|
+
records,
|
1360
|
+
columns
|
1361
|
+
}) {
|
1362
|
+
return operationsByTag.records.bulkInsertTableRecords({
|
1363
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1364
|
+
queryParams: { columns },
|
1365
|
+
body: { records },
|
1023
1366
|
...this.extraProps
|
1024
1367
|
});
|
1025
1368
|
}
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
1029
|
-
|
1030
|
-
|
1369
|
+
}
|
1370
|
+
class SearchAndFilterApi {
|
1371
|
+
constructor(extraProps) {
|
1372
|
+
this.extraProps = extraProps;
|
1373
|
+
}
|
1374
|
+
queryTable({
|
1375
|
+
workspace,
|
1376
|
+
region,
|
1377
|
+
database,
|
1378
|
+
branch,
|
1379
|
+
table,
|
1380
|
+
filter,
|
1381
|
+
sort,
|
1382
|
+
page,
|
1383
|
+
columns,
|
1384
|
+
consistency
|
1385
|
+
}) {
|
1386
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1387
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1388
|
+
body: { filter, sort, page, columns, consistency },
|
1389
|
+
...this.extraProps
|
1390
|
+
});
|
1391
|
+
}
|
1392
|
+
searchTable({
|
1393
|
+
workspace,
|
1394
|
+
region,
|
1395
|
+
database,
|
1396
|
+
branch,
|
1397
|
+
table,
|
1398
|
+
query,
|
1399
|
+
fuzziness,
|
1400
|
+
target,
|
1401
|
+
prefix,
|
1402
|
+
filter,
|
1403
|
+
highlight,
|
1404
|
+
boosters
|
1405
|
+
}) {
|
1406
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1407
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1408
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1409
|
+
...this.extraProps
|
1410
|
+
});
|
1411
|
+
}
|
1412
|
+
searchBranch({
|
1413
|
+
workspace,
|
1414
|
+
region,
|
1415
|
+
database,
|
1416
|
+
branch,
|
1417
|
+
tables,
|
1418
|
+
query,
|
1419
|
+
fuzziness,
|
1420
|
+
prefix,
|
1421
|
+
highlight
|
1422
|
+
}) {
|
1423
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1424
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1425
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1426
|
+
...this.extraProps
|
1427
|
+
});
|
1428
|
+
}
|
1429
|
+
summarizeTable({
|
1430
|
+
workspace,
|
1431
|
+
region,
|
1432
|
+
database,
|
1433
|
+
branch,
|
1434
|
+
table,
|
1435
|
+
filter,
|
1436
|
+
columns,
|
1437
|
+
summaries,
|
1438
|
+
sort,
|
1439
|
+
summariesFilter,
|
1440
|
+
page,
|
1441
|
+
consistency
|
1442
|
+
}) {
|
1443
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1444
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1445
|
+
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
1446
|
+
...this.extraProps
|
1447
|
+
});
|
1448
|
+
}
|
1449
|
+
aggregateTable({
|
1450
|
+
workspace,
|
1451
|
+
region,
|
1452
|
+
database,
|
1453
|
+
branch,
|
1454
|
+
table,
|
1455
|
+
filter,
|
1456
|
+
aggs
|
1457
|
+
}) {
|
1458
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1459
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1460
|
+
body: { filter, aggs },
|
1461
|
+
...this.extraProps
|
1462
|
+
});
|
1463
|
+
}
|
1464
|
+
}
|
1465
|
+
class MigrationRequestsApi {
|
1466
|
+
constructor(extraProps) {
|
1467
|
+
this.extraProps = extraProps;
|
1468
|
+
}
|
1469
|
+
queryMigrationRequests({
|
1470
|
+
workspace,
|
1471
|
+
region,
|
1472
|
+
database,
|
1473
|
+
filter,
|
1474
|
+
sort,
|
1475
|
+
page,
|
1476
|
+
columns
|
1477
|
+
}) {
|
1478
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1479
|
+
pathParams: { workspace, region, dbName: database },
|
1480
|
+
body: { filter, sort, page, columns },
|
1481
|
+
...this.extraProps
|
1482
|
+
});
|
1483
|
+
}
|
1484
|
+
createMigrationRequest({
|
1485
|
+
workspace,
|
1486
|
+
region,
|
1487
|
+
database,
|
1488
|
+
migration
|
1489
|
+
}) {
|
1490
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
1491
|
+
pathParams: { workspace, region, dbName: database },
|
1492
|
+
body: migration,
|
1493
|
+
...this.extraProps
|
1494
|
+
});
|
1495
|
+
}
|
1496
|
+
getMigrationRequest({
|
1497
|
+
workspace,
|
1498
|
+
region,
|
1499
|
+
database,
|
1500
|
+
migrationRequest
|
1501
|
+
}) {
|
1502
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1503
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1504
|
+
...this.extraProps
|
1505
|
+
});
|
1506
|
+
}
|
1507
|
+
updateMigrationRequest({
|
1508
|
+
workspace,
|
1509
|
+
region,
|
1510
|
+
database,
|
1511
|
+
migrationRequest,
|
1512
|
+
update
|
1513
|
+
}) {
|
1514
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1515
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1516
|
+
body: update,
|
1517
|
+
...this.extraProps
|
1518
|
+
});
|
1519
|
+
}
|
1520
|
+
listMigrationRequestsCommits({
|
1521
|
+
workspace,
|
1522
|
+
region,
|
1523
|
+
database,
|
1524
|
+
migrationRequest,
|
1525
|
+
page
|
1526
|
+
}) {
|
1527
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1528
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1529
|
+
body: { page },
|
1530
|
+
...this.extraProps
|
1531
|
+
});
|
1532
|
+
}
|
1533
|
+
compareMigrationRequest({
|
1534
|
+
workspace,
|
1535
|
+
region,
|
1536
|
+
database,
|
1537
|
+
migrationRequest
|
1538
|
+
}) {
|
1539
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1540
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1541
|
+
...this.extraProps
|
1542
|
+
});
|
1543
|
+
}
|
1544
|
+
getMigrationRequestIsMerged({
|
1545
|
+
workspace,
|
1546
|
+
region,
|
1547
|
+
database,
|
1548
|
+
migrationRequest
|
1549
|
+
}) {
|
1550
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1551
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1552
|
+
...this.extraProps
|
1553
|
+
});
|
1554
|
+
}
|
1555
|
+
mergeMigrationRequest({
|
1556
|
+
workspace,
|
1557
|
+
region,
|
1558
|
+
database,
|
1559
|
+
migrationRequest
|
1560
|
+
}) {
|
1561
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1562
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1563
|
+
...this.extraProps
|
1564
|
+
});
|
1565
|
+
}
|
1566
|
+
}
|
1567
|
+
class MigrationsApi {
|
1568
|
+
constructor(extraProps) {
|
1569
|
+
this.extraProps = extraProps;
|
1570
|
+
}
|
1571
|
+
getBranchMigrationHistory({
|
1572
|
+
workspace,
|
1573
|
+
region,
|
1574
|
+
database,
|
1575
|
+
branch,
|
1576
|
+
limit,
|
1577
|
+
startFrom
|
1578
|
+
}) {
|
1579
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1580
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1581
|
+
body: { limit, startFrom },
|
1582
|
+
...this.extraProps
|
1583
|
+
});
|
1584
|
+
}
|
1585
|
+
getBranchMigrationPlan({
|
1586
|
+
workspace,
|
1587
|
+
region,
|
1588
|
+
database,
|
1589
|
+
branch,
|
1590
|
+
schema
|
1591
|
+
}) {
|
1592
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1593
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1594
|
+
body: schema,
|
1595
|
+
...this.extraProps
|
1596
|
+
});
|
1597
|
+
}
|
1598
|
+
executeBranchMigrationPlan({
|
1599
|
+
workspace,
|
1600
|
+
region,
|
1601
|
+
database,
|
1602
|
+
branch,
|
1603
|
+
plan
|
1604
|
+
}) {
|
1605
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1606
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1607
|
+
body: plan,
|
1608
|
+
...this.extraProps
|
1609
|
+
});
|
1610
|
+
}
|
1611
|
+
getBranchSchemaHistory({
|
1612
|
+
workspace,
|
1613
|
+
region,
|
1614
|
+
database,
|
1615
|
+
branch,
|
1616
|
+
page
|
1617
|
+
}) {
|
1618
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1619
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1620
|
+
body: { page },
|
1621
|
+
...this.extraProps
|
1622
|
+
});
|
1623
|
+
}
|
1624
|
+
compareBranchWithUserSchema({
|
1625
|
+
workspace,
|
1626
|
+
region,
|
1627
|
+
database,
|
1628
|
+
branch,
|
1629
|
+
schema
|
1630
|
+
}) {
|
1631
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1632
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1633
|
+
body: { schema },
|
1634
|
+
...this.extraProps
|
1635
|
+
});
|
1636
|
+
}
|
1637
|
+
compareBranchSchemas({
|
1638
|
+
workspace,
|
1639
|
+
region,
|
1640
|
+
database,
|
1641
|
+
branch,
|
1642
|
+
compare,
|
1643
|
+
schema
|
1644
|
+
}) {
|
1645
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1646
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1647
|
+
body: { schema },
|
1648
|
+
...this.extraProps
|
1649
|
+
});
|
1650
|
+
}
|
1651
|
+
updateBranchSchema({
|
1652
|
+
workspace,
|
1653
|
+
region,
|
1654
|
+
database,
|
1655
|
+
branch,
|
1656
|
+
migration
|
1657
|
+
}) {
|
1658
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1659
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1660
|
+
body: migration,
|
1661
|
+
...this.extraProps
|
1662
|
+
});
|
1663
|
+
}
|
1664
|
+
previewBranchSchemaEdit({
|
1665
|
+
workspace,
|
1666
|
+
region,
|
1667
|
+
database,
|
1668
|
+
branch,
|
1669
|
+
data
|
1670
|
+
}) {
|
1671
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1672
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1673
|
+
body: data,
|
1674
|
+
...this.extraProps
|
1675
|
+
});
|
1676
|
+
}
|
1677
|
+
applyBranchSchemaEdit({
|
1678
|
+
workspace,
|
1679
|
+
region,
|
1680
|
+
database,
|
1681
|
+
branch,
|
1682
|
+
edits
|
1683
|
+
}) {
|
1684
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1685
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1686
|
+
body: { edits },
|
1687
|
+
...this.extraProps
|
1688
|
+
});
|
1689
|
+
}
|
1690
|
+
}
|
1691
|
+
class DatabaseApi {
|
1692
|
+
constructor(extraProps) {
|
1693
|
+
this.extraProps = extraProps;
|
1694
|
+
}
|
1695
|
+
getDatabaseList({ workspace }) {
|
1696
|
+
return operationsByTag.databases.getDatabaseList({
|
1697
|
+
pathParams: { workspaceId: workspace },
|
1031
1698
|
...this.extraProps
|
1032
1699
|
});
|
1033
1700
|
}
|
1034
|
-
|
1035
|
-
|
1036
|
-
|
1037
|
-
|
1701
|
+
createDatabase({
|
1702
|
+
workspace,
|
1703
|
+
database,
|
1704
|
+
data
|
1705
|
+
}) {
|
1706
|
+
return operationsByTag.databases.createDatabase({
|
1707
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1708
|
+
body: data,
|
1038
1709
|
...this.extraProps
|
1039
1710
|
});
|
1040
1711
|
}
|
1041
|
-
|
1042
|
-
|
1043
|
-
|
1044
|
-
|
1712
|
+
deleteDatabase({
|
1713
|
+
workspace,
|
1714
|
+
database
|
1715
|
+
}) {
|
1716
|
+
return operationsByTag.databases.deleteDatabase({
|
1717
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1045
1718
|
...this.extraProps
|
1046
1719
|
});
|
1047
1720
|
}
|
1048
|
-
|
1049
|
-
|
1050
|
-
|
1051
|
-
|
1721
|
+
getDatabaseMetadata({
|
1722
|
+
workspace,
|
1723
|
+
database
|
1724
|
+
}) {
|
1725
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1726
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1727
|
+
...this.extraProps
|
1728
|
+
});
|
1729
|
+
}
|
1730
|
+
updateDatabaseMetadata({
|
1731
|
+
workspace,
|
1732
|
+
database,
|
1733
|
+
metadata
|
1734
|
+
}) {
|
1735
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1736
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1737
|
+
body: metadata,
|
1738
|
+
...this.extraProps
|
1739
|
+
});
|
1740
|
+
}
|
1741
|
+
listRegions({ workspace }) {
|
1742
|
+
return operationsByTag.databases.listRegions({
|
1743
|
+
pathParams: { workspaceId: workspace },
|
1052
1744
|
...this.extraProps
|
1053
1745
|
});
|
1054
1746
|
}
|
@@ -1064,6 +1756,20 @@ class XataApiPlugin {
|
|
1064
1756
|
class XataPlugin {
|
1065
1757
|
}
|
1066
1758
|
|
1759
|
+
function generateUUID() {
|
1760
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
1761
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
1762
|
+
return v.toString(16);
|
1763
|
+
});
|
1764
|
+
}
|
1765
|
+
|
1766
|
+
function cleanFilter(filter) {
|
1767
|
+
if (!filter)
|
1768
|
+
return void 0;
|
1769
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1770
|
+
return values.length > 0 ? filter : void 0;
|
1771
|
+
}
|
1772
|
+
|
1067
1773
|
var __accessCheck$6 = (obj, member, msg) => {
|
1068
1774
|
if (!member.has(obj))
|
1069
1775
|
throw TypeError("Cannot " + msg);
|
@@ -1096,11 +1802,11 @@ class Page {
|
|
1096
1802
|
async previousPage(size, offset) {
|
1097
1803
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1098
1804
|
}
|
1099
|
-
async
|
1100
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1805
|
+
async startPage(size, offset) {
|
1806
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
1101
1807
|
}
|
1102
|
-
async
|
1103
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1808
|
+
async endPage(size, offset) {
|
1809
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
1104
1810
|
}
|
1105
1811
|
hasNextPage() {
|
1106
1812
|
return this.meta.page.more;
|
@@ -1112,7 +1818,7 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1112
1818
|
const PAGINATION_MAX_OFFSET = 800;
|
1113
1819
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1114
1820
|
function isCursorPaginationOptions(options) {
|
1115
|
-
return isDefined(options) && (isDefined(options.
|
1821
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1116
1822
|
}
|
1117
1823
|
const _RecordArray = class extends Array {
|
1118
1824
|
constructor(...args) {
|
@@ -1144,12 +1850,12 @@ const _RecordArray = class extends Array {
|
|
1144
1850
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1145
1851
|
return new _RecordArray(newPage);
|
1146
1852
|
}
|
1147
|
-
async
|
1148
|
-
const newPage = await __privateGet$6(this, _page).
|
1853
|
+
async startPage(size, offset) {
|
1854
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1149
1855
|
return new _RecordArray(newPage);
|
1150
1856
|
}
|
1151
|
-
async
|
1152
|
-
const newPage = await __privateGet$6(this, _page).
|
1857
|
+
async endPage(size, offset) {
|
1858
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1153
1859
|
return new _RecordArray(newPage);
|
1154
1860
|
}
|
1155
1861
|
hasNextPage() {
|
@@ -1177,9 +1883,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1177
1883
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1178
1884
|
return value;
|
1179
1885
|
};
|
1180
|
-
var
|
1886
|
+
var __privateMethod$3 = (obj, member, method) => {
|
1887
|
+
__accessCheck$5(obj, member, "access private method");
|
1888
|
+
return method;
|
1889
|
+
};
|
1890
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1181
1891
|
const _Query = class {
|
1182
1892
|
constructor(repository, table, data, rawParent) {
|
1893
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1183
1894
|
__privateAdd$5(this, _table$1, void 0);
|
1184
1895
|
__privateAdd$5(this, _repository, void 0);
|
1185
1896
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1198,9 +1909,10 @@ const _Query = class {
|
|
1198
1909
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1199
1910
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1200
1911
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1201
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
1912
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1202
1913
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1203
1914
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1915
|
+
__privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
1204
1916
|
this.any = this.any.bind(this);
|
1205
1917
|
this.all = this.all.bind(this);
|
1206
1918
|
this.not = this.not.bind(this);
|
@@ -1236,11 +1948,13 @@ const _Query = class {
|
|
1236
1948
|
}
|
1237
1949
|
filter(a, b) {
|
1238
1950
|
if (arguments.length === 1) {
|
1239
|
-
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1951
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1952
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
1953
|
+
}));
|
1240
1954
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1241
1955
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1242
1956
|
} else {
|
1243
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: b }] : void 0;
|
1957
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
1244
1958
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1245
1959
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1246
1960
|
}
|
@@ -1279,11 +1993,20 @@ const _Query = class {
|
|
1279
1993
|
}
|
1280
1994
|
}
|
1281
1995
|
async getMany(options = {}) {
|
1282
|
-
const
|
1996
|
+
const { pagination = {}, ...rest } = options;
|
1997
|
+
const { size = PAGINATION_DEFAULT_SIZE, offset } = pagination;
|
1998
|
+
const batchSize = size <= PAGINATION_MAX_SIZE ? size : PAGINATION_MAX_SIZE;
|
1999
|
+
let page = await this.getPaginated({ ...rest, pagination: { size: batchSize, offset } });
|
2000
|
+
const results = [...page.records];
|
2001
|
+
while (page.hasNextPage() && results.length < size) {
|
2002
|
+
page = await page.nextPage();
|
2003
|
+
results.push(...page.records);
|
2004
|
+
}
|
1283
2005
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1284
2006
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1285
2007
|
}
|
1286
|
-
|
2008
|
+
const array = new RecordArray(page, results.slice(0, size));
|
2009
|
+
return array;
|
1287
2010
|
}
|
1288
2011
|
async getAll(options = {}) {
|
1289
2012
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1297,19 +2020,35 @@ const _Query = class {
|
|
1297
2020
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1298
2021
|
return records[0] ?? null;
|
1299
2022
|
}
|
2023
|
+
async getFirstOrThrow(options = {}) {
|
2024
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2025
|
+
if (records[0] === void 0)
|
2026
|
+
throw new Error("No results found.");
|
2027
|
+
return records[0];
|
2028
|
+
}
|
2029
|
+
async summarize(params = {}) {
|
2030
|
+
const { summaries, summariesFilter, ...options } = params;
|
2031
|
+
const query = new _Query(
|
2032
|
+
__privateGet$5(this, _repository),
|
2033
|
+
__privateGet$5(this, _table$1),
|
2034
|
+
options,
|
2035
|
+
__privateGet$5(this, _data)
|
2036
|
+
);
|
2037
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2038
|
+
}
|
1300
2039
|
cache(ttl) {
|
1301
2040
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1302
2041
|
}
|
1303
2042
|
nextPage(size, offset) {
|
1304
|
-
return this.
|
2043
|
+
return this.startPage(size, offset);
|
1305
2044
|
}
|
1306
2045
|
previousPage(size, offset) {
|
1307
|
-
return this.
|
2046
|
+
return this.startPage(size, offset);
|
1308
2047
|
}
|
1309
|
-
|
2048
|
+
startPage(size, offset) {
|
1310
2049
|
return this.getPaginated({ pagination: { size, offset } });
|
1311
2050
|
}
|
1312
|
-
|
2051
|
+
endPage(size, offset) {
|
1313
2052
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1314
2053
|
}
|
1315
2054
|
hasNextPage() {
|
@@ -1320,9 +2059,20 @@ let Query = _Query;
|
|
1320
2059
|
_table$1 = new WeakMap();
|
1321
2060
|
_repository = new WeakMap();
|
1322
2061
|
_data = new WeakMap();
|
2062
|
+
_cleanFilterConstraint = new WeakSet();
|
2063
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2064
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2065
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2066
|
+
return { $includes: value };
|
2067
|
+
}
|
2068
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2069
|
+
return value.id;
|
2070
|
+
}
|
2071
|
+
return value;
|
2072
|
+
};
|
1323
2073
|
function cleanParent(data, parent) {
|
1324
2074
|
if (isCursorPaginationOptions(data.pagination)) {
|
1325
|
-
return { ...parent,
|
2075
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1326
2076
|
}
|
1327
2077
|
return parent;
|
1328
2078
|
}
|
@@ -1386,7 +2136,11 @@ class Repository extends Query {
|
|
1386
2136
|
}
|
1387
2137
|
class RestRepository extends Query {
|
1388
2138
|
constructor(options) {
|
1389
|
-
super(
|
2139
|
+
super(
|
2140
|
+
null,
|
2141
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2142
|
+
{}
|
2143
|
+
);
|
1390
2144
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1391
2145
|
__privateAdd$4(this, _insertRecordWithId);
|
1392
2146
|
__privateAdd$4(this, _bulkInsertTableRecords);
|
@@ -1403,21 +2157,26 @@ class RestRepository extends Query {
|
|
1403
2157
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1404
2158
|
__privateAdd$4(this, _trace, void 0);
|
1405
2159
|
__privateSet$4(this, _table, options.table);
|
1406
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1407
2160
|
__privateSet$4(this, _db, options.db);
|
1408
2161
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1409
2162
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2163
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2164
|
+
const props = await options.pluginOptions.getFetchProps();
|
2165
|
+
return { ...props, sessionID: generateUUID() };
|
2166
|
+
});
|
1410
2167
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1411
2168
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1412
2169
|
return trace(name, fn, {
|
1413
2170
|
...options2,
|
1414
2171
|
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
2172
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
1415
2173
|
[TraceAttributes.VERSION]: VERSION
|
1416
2174
|
});
|
1417
2175
|
});
|
1418
2176
|
}
|
1419
|
-
async create(a, b, c) {
|
2177
|
+
async create(a, b, c, d) {
|
1420
2178
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2179
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1421
2180
|
if (Array.isArray(a)) {
|
1422
2181
|
if (a.length === 0)
|
1423
2182
|
return [];
|
@@ -1428,13 +2187,13 @@ class RestRepository extends Query {
|
|
1428
2187
|
if (a === "")
|
1429
2188
|
throw new Error("The id can't be empty");
|
1430
2189
|
const columns = isStringArray(c) ? c : void 0;
|
1431
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
2190
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1432
2191
|
}
|
1433
2192
|
if (isObject(a) && isString(a.id)) {
|
1434
2193
|
if (a.id === "")
|
1435
2194
|
throw new Error("The id can't be empty");
|
1436
2195
|
const columns = isStringArray(b) ? b : void 0;
|
1437
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2196
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1438
2197
|
}
|
1439
2198
|
if (isObject(a)) {
|
1440
2199
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1465,6 +2224,7 @@ class RestRepository extends Query {
|
|
1465
2224
|
pathParams: {
|
1466
2225
|
workspace: "{workspaceId}",
|
1467
2226
|
dbBranchName: "{dbBranch}",
|
2227
|
+
region: "{region}",
|
1468
2228
|
tableName: __privateGet$4(this, _table),
|
1469
2229
|
recordId: id
|
1470
2230
|
},
|
@@ -1472,7 +2232,7 @@ class RestRepository extends Query {
|
|
1472
2232
|
...fetchProps
|
1473
2233
|
});
|
1474
2234
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1475
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2235
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1476
2236
|
} catch (e) {
|
1477
2237
|
if (isObject(e) && e.status === 404) {
|
1478
2238
|
return null;
|
@@ -1483,8 +2243,28 @@ class RestRepository extends Query {
|
|
1483
2243
|
return null;
|
1484
2244
|
});
|
1485
2245
|
}
|
1486
|
-
async
|
2246
|
+
async readOrThrow(a, b) {
|
2247
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2248
|
+
const result = await this.read(a, b);
|
2249
|
+
if (Array.isArray(result)) {
|
2250
|
+
const missingIds = compact(
|
2251
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2252
|
+
);
|
2253
|
+
if (missingIds.length > 0) {
|
2254
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2255
|
+
}
|
2256
|
+
return result;
|
2257
|
+
}
|
2258
|
+
if (result === null) {
|
2259
|
+
const id = extractId(a) ?? "unknown";
|
2260
|
+
throw new Error(`Record with id ${id} not found`);
|
2261
|
+
}
|
2262
|
+
return result;
|
2263
|
+
});
|
2264
|
+
}
|
2265
|
+
async update(a, b, c, d) {
|
1487
2266
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2267
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1488
2268
|
if (Array.isArray(a)) {
|
1489
2269
|
if (a.length === 0)
|
1490
2270
|
return [];
|
@@ -1496,17 +2276,37 @@ class RestRepository extends Query {
|
|
1496
2276
|
}
|
1497
2277
|
if (isString(a) && isObject(b)) {
|
1498
2278
|
const columns = isStringArray(c) ? c : void 0;
|
1499
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
2279
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1500
2280
|
}
|
1501
2281
|
if (isObject(a) && isString(a.id)) {
|
1502
2282
|
const columns = isStringArray(b) ? b : void 0;
|
1503
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2283
|
+
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1504
2284
|
}
|
1505
2285
|
throw new Error("Invalid arguments for update method");
|
1506
2286
|
});
|
1507
2287
|
}
|
1508
|
-
async
|
2288
|
+
async updateOrThrow(a, b, c, d) {
|
2289
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2290
|
+
const result = await this.update(a, b, c, d);
|
2291
|
+
if (Array.isArray(result)) {
|
2292
|
+
const missingIds = compact(
|
2293
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2294
|
+
);
|
2295
|
+
if (missingIds.length > 0) {
|
2296
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2297
|
+
}
|
2298
|
+
return result;
|
2299
|
+
}
|
2300
|
+
if (result === null) {
|
2301
|
+
const id = extractId(a) ?? "unknown";
|
2302
|
+
throw new Error(`Record with id ${id} not found`);
|
2303
|
+
}
|
2304
|
+
return result;
|
2305
|
+
});
|
2306
|
+
}
|
2307
|
+
async createOrUpdate(a, b, c, d) {
|
1509
2308
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2309
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1510
2310
|
if (Array.isArray(a)) {
|
1511
2311
|
if (a.length === 0)
|
1512
2312
|
return [];
|
@@ -1518,15 +2318,35 @@ class RestRepository extends Query {
|
|
1518
2318
|
}
|
1519
2319
|
if (isString(a) && isObject(b)) {
|
1520
2320
|
const columns = isStringArray(c) ? c : void 0;
|
1521
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
2321
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1522
2322
|
}
|
1523
2323
|
if (isObject(a) && isString(a.id)) {
|
1524
2324
|
const columns = isStringArray(c) ? c : void 0;
|
1525
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2325
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1526
2326
|
}
|
1527
2327
|
throw new Error("Invalid arguments for createOrUpdate method");
|
1528
2328
|
});
|
1529
2329
|
}
|
2330
|
+
async createOrReplace(a, b, c, d) {
|
2331
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2332
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2333
|
+
if (Array.isArray(a)) {
|
2334
|
+
if (a.length === 0)
|
2335
|
+
return [];
|
2336
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2337
|
+
return __privateMethod$2(this, _bulkInsertTableRecords, bulkInsertTableRecords_fn).call(this, a, columns);
|
2338
|
+
}
|
2339
|
+
if (isString(a) && isObject(b)) {
|
2340
|
+
const columns = isStringArray(c) ? c : void 0;
|
2341
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2342
|
+
}
|
2343
|
+
if (isObject(a) && isString(a.id)) {
|
2344
|
+
const columns = isStringArray(c) ? c : void 0;
|
2345
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2346
|
+
}
|
2347
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2348
|
+
});
|
2349
|
+
}
|
1530
2350
|
async delete(a, b) {
|
1531
2351
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
1532
2352
|
if (Array.isArray(a)) {
|
@@ -1546,11 +2366,34 @@ class RestRepository extends Query {
|
|
1546
2366
|
throw new Error("Invalid arguments for delete method");
|
1547
2367
|
});
|
1548
2368
|
}
|
2369
|
+
async deleteOrThrow(a, b) {
|
2370
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2371
|
+
const result = await this.delete(a, b);
|
2372
|
+
if (Array.isArray(result)) {
|
2373
|
+
const missingIds = compact(
|
2374
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2375
|
+
);
|
2376
|
+
if (missingIds.length > 0) {
|
2377
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2378
|
+
}
|
2379
|
+
return result;
|
2380
|
+
} else if (result === null) {
|
2381
|
+
const id = extractId(a) ?? "unknown";
|
2382
|
+
throw new Error(`Record with id ${id} not found`);
|
2383
|
+
}
|
2384
|
+
return result;
|
2385
|
+
});
|
2386
|
+
}
|
1549
2387
|
async search(query, options = {}) {
|
1550
2388
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1551
2389
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1552
2390
|
const { records } = await searchTable({
|
1553
|
-
pathParams: {
|
2391
|
+
pathParams: {
|
2392
|
+
workspace: "{workspaceId}",
|
2393
|
+
dbBranchName: "{dbBranch}",
|
2394
|
+
region: "{region}",
|
2395
|
+
tableName: __privateGet$4(this, _table)
|
2396
|
+
},
|
1554
2397
|
body: {
|
1555
2398
|
query,
|
1556
2399
|
fuzziness: options.fuzziness,
|
@@ -1562,7 +2405,23 @@ class RestRepository extends Query {
|
|
1562
2405
|
...fetchProps
|
1563
2406
|
});
|
1564
2407
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1565
|
-
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2408
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2409
|
+
});
|
2410
|
+
}
|
2411
|
+
async aggregate(aggs, filter) {
|
2412
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2413
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2414
|
+
const result = await aggregateTable({
|
2415
|
+
pathParams: {
|
2416
|
+
workspace: "{workspaceId}",
|
2417
|
+
dbBranchName: "{dbBranch}",
|
2418
|
+
region: "{region}",
|
2419
|
+
tableName: __privateGet$4(this, _table)
|
2420
|
+
},
|
2421
|
+
body: { aggs, filter },
|
2422
|
+
...fetchProps
|
2423
|
+
});
|
2424
|
+
return result;
|
1566
2425
|
});
|
1567
2426
|
}
|
1568
2427
|
async query(query) {
|
@@ -1571,24 +2430,55 @@ class RestRepository extends Query {
|
|
1571
2430
|
if (cacheQuery)
|
1572
2431
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1573
2432
|
const data = query.getQueryOptions();
|
1574
|
-
const body = {
|
1575
|
-
filter: cleanFilter(data.filter),
|
1576
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1577
|
-
page: data.pagination,
|
1578
|
-
columns: data.columns
|
1579
|
-
};
|
1580
2433
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1581
2434
|
const { meta, records: objects } = await queryTable({
|
1582
|
-
pathParams: {
|
1583
|
-
|
2435
|
+
pathParams: {
|
2436
|
+
workspace: "{workspaceId}",
|
2437
|
+
dbBranchName: "{dbBranch}",
|
2438
|
+
region: "{region}",
|
2439
|
+
tableName: __privateGet$4(this, _table)
|
2440
|
+
},
|
2441
|
+
body: {
|
2442
|
+
filter: cleanFilter(data.filter),
|
2443
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2444
|
+
page: data.pagination,
|
2445
|
+
columns: data.columns ?? ["*"]
|
2446
|
+
},
|
2447
|
+
fetchOptions: data.fetchOptions,
|
1584
2448
|
...fetchProps
|
1585
2449
|
});
|
1586
2450
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1587
|
-
const records = objects.map(
|
2451
|
+
const records = objects.map(
|
2452
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2453
|
+
);
|
1588
2454
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1589
2455
|
return new Page(query, meta, records);
|
1590
2456
|
});
|
1591
2457
|
}
|
2458
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2459
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2460
|
+
const data = query.getQueryOptions();
|
2461
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2462
|
+
const result = await summarizeTable({
|
2463
|
+
pathParams: {
|
2464
|
+
workspace: "{workspaceId}",
|
2465
|
+
dbBranchName: "{dbBranch}",
|
2466
|
+
region: "{region}",
|
2467
|
+
tableName: __privateGet$4(this, _table)
|
2468
|
+
},
|
2469
|
+
body: {
|
2470
|
+
filter: cleanFilter(data.filter),
|
2471
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2472
|
+
columns: data.columns,
|
2473
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2474
|
+
summaries,
|
2475
|
+
summariesFilter
|
2476
|
+
},
|
2477
|
+
...fetchProps
|
2478
|
+
});
|
2479
|
+
return result;
|
2480
|
+
});
|
2481
|
+
}
|
1592
2482
|
}
|
1593
2483
|
_table = new WeakMap();
|
1594
2484
|
_getFetchProps = new WeakMap();
|
@@ -1604,6 +2494,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1604
2494
|
pathParams: {
|
1605
2495
|
workspace: "{workspaceId}",
|
1606
2496
|
dbBranchName: "{dbBranch}",
|
2497
|
+
region: "{region}",
|
1607
2498
|
tableName: __privateGet$4(this, _table)
|
1608
2499
|
},
|
1609
2500
|
queryParams: { columns },
|
@@ -1611,32 +2502,38 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1611
2502
|
...fetchProps
|
1612
2503
|
});
|
1613
2504
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1614
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2505
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1615
2506
|
};
|
1616
2507
|
_insertRecordWithId = new WeakSet();
|
1617
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2508
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1618
2509
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1619
2510
|
const record = transformObjectLinks(object);
|
1620
2511
|
const response = await insertRecordWithID({
|
1621
2512
|
pathParams: {
|
1622
2513
|
workspace: "{workspaceId}",
|
1623
2514
|
dbBranchName: "{dbBranch}",
|
2515
|
+
region: "{region}",
|
1624
2516
|
tableName: __privateGet$4(this, _table),
|
1625
2517
|
recordId
|
1626
2518
|
},
|
1627
2519
|
body: record,
|
1628
|
-
queryParams: { createOnly
|
2520
|
+
queryParams: { createOnly, columns, ifVersion },
|
1629
2521
|
...fetchProps
|
1630
2522
|
});
|
1631
2523
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1632
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2524
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1633
2525
|
};
|
1634
2526
|
_bulkInsertTableRecords = new WeakSet();
|
1635
2527
|
bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
1636
2528
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1637
2529
|
const records = objects.map((object) => transformObjectLinks(object));
|
1638
2530
|
const response = await bulkInsertTableRecords({
|
1639
|
-
pathParams: {
|
2531
|
+
pathParams: {
|
2532
|
+
workspace: "{workspaceId}",
|
2533
|
+
dbBranchName: "{dbBranch}",
|
2534
|
+
region: "{region}",
|
2535
|
+
tableName: __privateGet$4(this, _table)
|
2536
|
+
},
|
1640
2537
|
queryParams: { columns },
|
1641
2538
|
body: { records },
|
1642
2539
|
...fetchProps
|
@@ -1645,21 +2542,27 @@ bulkInsertTableRecords_fn = async function(objects, columns = ["*"]) {
|
|
1645
2542
|
throw new Error("Request included columns but server didn't include them");
|
1646
2543
|
}
|
1647
2544
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1648
|
-
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2545
|
+
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, columns));
|
1649
2546
|
};
|
1650
2547
|
_updateRecordWithID = new WeakSet();
|
1651
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2548
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1652
2549
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1653
2550
|
const record = transformObjectLinks(object);
|
1654
2551
|
try {
|
1655
2552
|
const response = await updateRecordWithID({
|
1656
|
-
pathParams: {
|
1657
|
-
|
2553
|
+
pathParams: {
|
2554
|
+
workspace: "{workspaceId}",
|
2555
|
+
dbBranchName: "{dbBranch}",
|
2556
|
+
region: "{region}",
|
2557
|
+
tableName: __privateGet$4(this, _table),
|
2558
|
+
recordId
|
2559
|
+
},
|
2560
|
+
queryParams: { columns, ifVersion },
|
1658
2561
|
body: record,
|
1659
2562
|
...fetchProps
|
1660
2563
|
});
|
1661
2564
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1662
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2565
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1663
2566
|
} catch (e) {
|
1664
2567
|
if (isObject(e) && e.status === 404) {
|
1665
2568
|
return null;
|
@@ -1668,28 +2571,40 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1668
2571
|
}
|
1669
2572
|
};
|
1670
2573
|
_upsertRecordWithID = new WeakSet();
|
1671
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2574
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1672
2575
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1673
2576
|
const response = await upsertRecordWithID({
|
1674
|
-
pathParams: {
|
1675
|
-
|
2577
|
+
pathParams: {
|
2578
|
+
workspace: "{workspaceId}",
|
2579
|
+
dbBranchName: "{dbBranch}",
|
2580
|
+
region: "{region}",
|
2581
|
+
tableName: __privateGet$4(this, _table),
|
2582
|
+
recordId
|
2583
|
+
},
|
2584
|
+
queryParams: { columns, ifVersion },
|
1676
2585
|
body: object,
|
1677
2586
|
...fetchProps
|
1678
2587
|
});
|
1679
2588
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1680
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2589
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1681
2590
|
};
|
1682
2591
|
_deleteRecord = new WeakSet();
|
1683
2592
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1684
2593
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1685
2594
|
try {
|
1686
2595
|
const response = await deleteRecord({
|
1687
|
-
pathParams: {
|
2596
|
+
pathParams: {
|
2597
|
+
workspace: "{workspaceId}",
|
2598
|
+
dbBranchName: "{dbBranch}",
|
2599
|
+
region: "{region}",
|
2600
|
+
tableName: __privateGet$4(this, _table),
|
2601
|
+
recordId
|
2602
|
+
},
|
1688
2603
|
queryParams: { columns },
|
1689
2604
|
...fetchProps
|
1690
2605
|
});
|
1691
2606
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1692
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2607
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1693
2608
|
} catch (e) {
|
1694
2609
|
if (isObject(e) && e.status === 404) {
|
1695
2610
|
return null;
|
@@ -1719,7 +2634,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1719
2634
|
return __privateGet$4(this, _schemaTables$2);
|
1720
2635
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1721
2636
|
const { schema } = await getBranchDetails({
|
1722
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2637
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1723
2638
|
...fetchProps
|
1724
2639
|
});
|
1725
2640
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1732,7 +2647,7 @@ const transformObjectLinks = (object) => {
|
|
1732
2647
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1733
2648
|
}, {});
|
1734
2649
|
};
|
1735
|
-
const initObject = (db, schemaTables, table, object) => {
|
2650
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
1736
2651
|
const result = {};
|
1737
2652
|
const { xata, ...rest } = object ?? {};
|
1738
2653
|
Object.assign(result, rest);
|
@@ -1740,6 +2655,8 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1740
2655
|
if (!columns)
|
1741
2656
|
console.error(`Table ${table} not found in schema`);
|
1742
2657
|
for (const column of columns ?? []) {
|
2658
|
+
if (!isValidColumn(selectedColumns, column))
|
2659
|
+
continue;
|
1743
2660
|
const value = result[column.name];
|
1744
2661
|
switch (column.type) {
|
1745
2662
|
case "datetime": {
|
@@ -1756,17 +2673,42 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1756
2673
|
if (!linkTable) {
|
1757
2674
|
console.error(`Failed to parse link for field ${column.name}`);
|
1758
2675
|
} else if (isObject(value)) {
|
1759
|
-
|
2676
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2677
|
+
if (item === column.name) {
|
2678
|
+
return [...acc, "*"];
|
2679
|
+
}
|
2680
|
+
if (item.startsWith(`${column.name}.`)) {
|
2681
|
+
const [, ...path] = item.split(".");
|
2682
|
+
return [...acc, path.join(".")];
|
2683
|
+
}
|
2684
|
+
return acc;
|
2685
|
+
}, []);
|
2686
|
+
result[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2687
|
+
} else {
|
2688
|
+
result[column.name] = null;
|
1760
2689
|
}
|
1761
2690
|
break;
|
1762
2691
|
}
|
2692
|
+
default:
|
2693
|
+
result[column.name] = value ?? null;
|
2694
|
+
if (column.notNull === true && value === null) {
|
2695
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2696
|
+
}
|
2697
|
+
break;
|
1763
2698
|
}
|
1764
2699
|
}
|
1765
2700
|
result.read = function(columns2) {
|
1766
2701
|
return db[table].read(result["id"], columns2);
|
1767
2702
|
};
|
1768
|
-
result.update = function(data,
|
1769
|
-
|
2703
|
+
result.update = function(data, b, c) {
|
2704
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2705
|
+
const ifVersion = parseIfVersion(b, c);
|
2706
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2707
|
+
};
|
2708
|
+
result.replace = function(data, b, c) {
|
2709
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2710
|
+
const ifVersion = parseIfVersion(b, c);
|
2711
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
1770
2712
|
};
|
1771
2713
|
result.delete = function() {
|
1772
2714
|
return db[table].delete(result["id"]);
|
@@ -1774,7 +2716,7 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1774
2716
|
result.getMetadata = function() {
|
1775
2717
|
return xata;
|
1776
2718
|
};
|
1777
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2719
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
1778
2720
|
Object.defineProperty(result, prop, { enumerable: false });
|
1779
2721
|
}
|
1780
2722
|
Object.freeze(result);
|
@@ -1790,11 +2732,22 @@ function extractId(value) {
|
|
1790
2732
|
return value.id;
|
1791
2733
|
return void 0;
|
1792
2734
|
}
|
1793
|
-
function
|
1794
|
-
if (
|
1795
|
-
return
|
1796
|
-
|
1797
|
-
|
2735
|
+
function isValidColumn(columns, column) {
|
2736
|
+
if (columns.includes("*"))
|
2737
|
+
return true;
|
2738
|
+
if (column.type === "link") {
|
2739
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2740
|
+
return linkColumns.length > 0;
|
2741
|
+
}
|
2742
|
+
return columns.includes(column.name);
|
2743
|
+
}
|
2744
|
+
function parseIfVersion(...args) {
|
2745
|
+
for (const arg of args) {
|
2746
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2747
|
+
return arg.ifVersion;
|
2748
|
+
}
|
2749
|
+
}
|
2750
|
+
return void 0;
|
1798
2751
|
}
|
1799
2752
|
|
1800
2753
|
var __accessCheck$3 = (obj, member, msg) => {
|
@@ -1961,7 +2914,7 @@ class SearchPlugin extends XataPlugin {
|
|
1961
2914
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1962
2915
|
return records.map((record) => {
|
1963
2916
|
const { table = "orphan" } = record.xata;
|
1964
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
2917
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1965
2918
|
});
|
1966
2919
|
},
|
1967
2920
|
byTable: async (query, options = {}) => {
|
@@ -1970,7 +2923,7 @@ class SearchPlugin extends XataPlugin {
|
|
1970
2923
|
return records.reduce((acc, record) => {
|
1971
2924
|
const { table = "orphan" } = record.xata;
|
1972
2925
|
const items = acc[table] ?? [];
|
1973
|
-
const item = initObject(this.db, schemaTables, table, record);
|
2926
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1974
2927
|
return { ...acc, [table]: [...items, item] };
|
1975
2928
|
}, {});
|
1976
2929
|
}
|
@@ -1983,7 +2936,7 @@ search_fn = async function(query, options, getFetchProps) {
|
|
1983
2936
|
const fetchProps = await getFetchProps();
|
1984
2937
|
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
1985
2938
|
const { records } = await searchBranch({
|
1986
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2939
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1987
2940
|
body: { tables, query, fuzziness, prefix, highlight },
|
1988
2941
|
...fetchProps
|
1989
2942
|
});
|
@@ -1995,7 +2948,7 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
1995
2948
|
return __privateGet$1(this, _schemaTables);
|
1996
2949
|
const fetchProps = await getFetchProps();
|
1997
2950
|
const { schema } = await getBranchDetails({
|
1998
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2951
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1999
2952
|
...fetchProps
|
2000
2953
|
});
|
2001
2954
|
__privateSet$1(this, _schemaTables, schema.tables);
|
@@ -2033,14 +2986,17 @@ async function resolveXataBranch(gitBranch, options) {
|
|
2033
2986
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2034
2987
|
);
|
2035
2988
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2036
|
-
const
|
2989
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
2990
|
+
if (!urlParts)
|
2991
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
2992
|
+
const { workspace, region } = urlParts;
|
2037
2993
|
const { fallbackBranch } = getEnvironment();
|
2038
2994
|
const { branch } = await resolveBranch({
|
2039
2995
|
apiKey,
|
2040
2996
|
apiUrl: databaseURL,
|
2041
2997
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2042
2998
|
workspacesApiUrl: `${protocol}//${host}`,
|
2043
|
-
pathParams: { dbName, workspace },
|
2999
|
+
pathParams: { dbName, workspace, region },
|
2044
3000
|
queryParams: { gitBranch, fallbackBranch },
|
2045
3001
|
trace: defaultTrace
|
2046
3002
|
});
|
@@ -2058,15 +3014,17 @@ async function getDatabaseBranch(branch, options) {
|
|
2058
3014
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2059
3015
|
);
|
2060
3016
|
const [protocol, , host, , database] = databaseURL.split("/");
|
2061
|
-
const
|
2062
|
-
|
3017
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3018
|
+
if (!urlParts)
|
3019
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3020
|
+
const { workspace, region } = urlParts;
|
2063
3021
|
try {
|
2064
3022
|
return await getBranchDetails({
|
2065
3023
|
apiKey,
|
2066
3024
|
apiUrl: databaseURL,
|
2067
3025
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2068
3026
|
workspacesApiUrl: `${protocol}//${host}`,
|
2069
|
-
pathParams: { dbBranchName
|
3027
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
2070
3028
|
trace: defaultTrace
|
2071
3029
|
});
|
2072
3030
|
} catch (err) {
|
@@ -2145,6 +3103,13 @@ const buildClient = (plugins) => {
|
|
2145
3103
|
return { databaseURL, branch };
|
2146
3104
|
}
|
2147
3105
|
}, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
3106
|
+
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
3107
|
+
const isBrowser = typeof window !== "undefined";
|
3108
|
+
if (isBrowser && !enableBrowser) {
|
3109
|
+
throw new Error(
|
3110
|
+
"You are trying to use Xata from the browser, which is potentially a non-secure environment. If you understand the security concerns, such as leaking your credentials, pass `enableBrowser: true` to the client options to remove this error."
|
3111
|
+
);
|
3112
|
+
}
|
2148
3113
|
const fetch = getFetchImplementation(options?.fetch);
|
2149
3114
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2150
3115
|
const apiKey = options?.apiKey || getAPIKey();
|
@@ -2157,8 +3122,8 @@ const buildClient = (plugins) => {
|
|
2157
3122
|
if (!databaseURL) {
|
2158
3123
|
throw new Error("Option databaseURL is required");
|
2159
3124
|
}
|
2160
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2161
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace }) {
|
3125
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID(), enableBrowser };
|
3126
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
2162
3127
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2163
3128
|
if (!branchValue)
|
2164
3129
|
throw new Error("Unable to resolve branch value");
|
@@ -2168,10 +3133,11 @@ const buildClient = (plugins) => {
|
|
2168
3133
|
apiUrl: "",
|
2169
3134
|
workspacesApiUrl: (path, params) => {
|
2170
3135
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2171
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3136
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2172
3137
|
return databaseURL + newPath;
|
2173
3138
|
},
|
2174
|
-
trace
|
3139
|
+
trace,
|
3140
|
+
clientID
|
2175
3141
|
};
|
2176
3142
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2177
3143
|
if (__privateGet(this, _branch))
|
@@ -2283,5 +3249,5 @@ class XataError extends Error {
|
|
2283
3249
|
}
|
2284
3250
|
}
|
2285
3251
|
|
2286
|
-
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 };
|
3252
|
+
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 };
|
2287
3253
|
//# sourceMappingURL=index.mjs.map
|