@xata.io/client 0.0.0-alpha.vf7fccd9 → 0.0.0-alpha.vf882519
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 +144 -0
- package/README.md +7 -7
- package/Usage.md +5 -5
- package/dist/index.cjs +1645 -704
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3989 -1981
- package/dist/index.mjs +1631 -683
- 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
@@ -1,5 +1,6 @@
|
|
1
|
-
const defaultTrace = async (
|
1
|
+
const defaultTrace = async (name, fn, _options) => {
|
2
2
|
return await fn({
|
3
|
+
name,
|
3
4
|
setAttributes: () => {
|
4
5
|
return;
|
5
6
|
}
|
@@ -38,6 +39,21 @@ function isString(value) {
|
|
38
39
|
function isStringArray(value) {
|
39
40
|
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
40
41
|
}
|
42
|
+
function isNumber(value) {
|
43
|
+
return isDefined(value) && typeof value === "number";
|
44
|
+
}
|
45
|
+
function parseNumber(value) {
|
46
|
+
if (isNumber(value)) {
|
47
|
+
return value;
|
48
|
+
}
|
49
|
+
if (isString(value)) {
|
50
|
+
const parsed = Number(value);
|
51
|
+
if (!Number.isNaN(parsed)) {
|
52
|
+
return parsed;
|
53
|
+
}
|
54
|
+
}
|
55
|
+
return void 0;
|
56
|
+
}
|
41
57
|
function toBase64(value) {
|
42
58
|
try {
|
43
59
|
return btoa(value);
|
@@ -46,10 +62,31 @@ function toBase64(value) {
|
|
46
62
|
return buf.from(value).toString("base64");
|
47
63
|
}
|
48
64
|
}
|
65
|
+
function deepMerge(a, b) {
|
66
|
+
const result = { ...a };
|
67
|
+
for (const [key, value] of Object.entries(b)) {
|
68
|
+
if (isObject(value) && isObject(result[key])) {
|
69
|
+
result[key] = deepMerge(result[key], value);
|
70
|
+
} else {
|
71
|
+
result[key] = value;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
return result;
|
75
|
+
}
|
76
|
+
function chunk(array, chunkSize) {
|
77
|
+
const result = [];
|
78
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
79
|
+
result.push(array.slice(i, i + chunkSize));
|
80
|
+
}
|
81
|
+
return result;
|
82
|
+
}
|
83
|
+
async function timeout(ms) {
|
84
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
85
|
+
}
|
49
86
|
|
50
87
|
function getEnvironment() {
|
51
88
|
try {
|
52
|
-
if (
|
89
|
+
if (isDefined(process) && isDefined(process.env)) {
|
53
90
|
return {
|
54
91
|
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
55
92
|
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
@@ -80,6 +117,25 @@ function getEnvironment() {
|
|
80
117
|
fallbackBranch: getGlobalFallbackBranch()
|
81
118
|
};
|
82
119
|
}
|
120
|
+
function getEnableBrowserVariable() {
|
121
|
+
try {
|
122
|
+
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
123
|
+
return process.env.XATA_ENABLE_BROWSER === "true";
|
124
|
+
}
|
125
|
+
} catch (err) {
|
126
|
+
}
|
127
|
+
try {
|
128
|
+
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
129
|
+
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
130
|
+
}
|
131
|
+
} catch (err) {
|
132
|
+
}
|
133
|
+
try {
|
134
|
+
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
135
|
+
} catch (err) {
|
136
|
+
return void 0;
|
137
|
+
}
|
138
|
+
}
|
83
139
|
function getGlobalApiKey() {
|
84
140
|
try {
|
85
141
|
return XATA_API_KEY;
|
@@ -139,6 +195,29 @@ function getAPIKey() {
|
|
139
195
|
}
|
140
196
|
}
|
141
197
|
|
198
|
+
var __accessCheck$8 = (obj, member, msg) => {
|
199
|
+
if (!member.has(obj))
|
200
|
+
throw TypeError("Cannot " + msg);
|
201
|
+
};
|
202
|
+
var __privateGet$8 = (obj, member, getter) => {
|
203
|
+
__accessCheck$8(obj, member, "read from private field");
|
204
|
+
return getter ? getter.call(obj) : member.get(obj);
|
205
|
+
};
|
206
|
+
var __privateAdd$8 = (obj, member, value) => {
|
207
|
+
if (member.has(obj))
|
208
|
+
throw TypeError("Cannot add the same private member more than once");
|
209
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
210
|
+
};
|
211
|
+
var __privateSet$8 = (obj, member, value, setter) => {
|
212
|
+
__accessCheck$8(obj, member, "write to private field");
|
213
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
214
|
+
return value;
|
215
|
+
};
|
216
|
+
var __privateMethod$4 = (obj, member, method) => {
|
217
|
+
__accessCheck$8(obj, member, "access private method");
|
218
|
+
return method;
|
219
|
+
};
|
220
|
+
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
142
221
|
function getFetchImplementation(userFetch) {
|
143
222
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
144
223
|
const fetchImpl = userFetch ?? globalFetch;
|
@@ -149,8 +228,81 @@ function getFetchImplementation(userFetch) {
|
|
149
228
|
}
|
150
229
|
return fetchImpl;
|
151
230
|
}
|
231
|
+
class ApiRequestPool {
|
232
|
+
constructor(concurrency = 10) {
|
233
|
+
__privateAdd$8(this, _enqueue);
|
234
|
+
__privateAdd$8(this, _fetch, void 0);
|
235
|
+
__privateAdd$8(this, _queue, void 0);
|
236
|
+
__privateAdd$8(this, _concurrency, void 0);
|
237
|
+
__privateSet$8(this, _queue, []);
|
238
|
+
__privateSet$8(this, _concurrency, concurrency);
|
239
|
+
this.running = 0;
|
240
|
+
this.started = 0;
|
241
|
+
}
|
242
|
+
setFetch(fetch2) {
|
243
|
+
__privateSet$8(this, _fetch, fetch2);
|
244
|
+
}
|
245
|
+
getFetch() {
|
246
|
+
if (!__privateGet$8(this, _fetch)) {
|
247
|
+
throw new Error("Fetch not set");
|
248
|
+
}
|
249
|
+
return __privateGet$8(this, _fetch);
|
250
|
+
}
|
251
|
+
request(url, options) {
|
252
|
+
const start = new Date();
|
253
|
+
const fetch2 = this.getFetch();
|
254
|
+
const runRequest = async (stalled = false) => {
|
255
|
+
const response = await fetch2(url, options);
|
256
|
+
if (response.status === 429) {
|
257
|
+
const rateLimitReset = parseNumber(response.headers?.get("x-ratelimit-reset")) ?? 1;
|
258
|
+
await timeout(rateLimitReset * 1e3);
|
259
|
+
return await runRequest(true);
|
260
|
+
}
|
261
|
+
if (stalled) {
|
262
|
+
const stalledTime = new Date().getTime() - start.getTime();
|
263
|
+
console.warn(`A request to Xata hit your workspace limits, was retried and stalled for ${stalledTime}ms`);
|
264
|
+
}
|
265
|
+
return response;
|
266
|
+
};
|
267
|
+
return __privateMethod$4(this, _enqueue, enqueue_fn).call(this, async () => {
|
268
|
+
return await runRequest();
|
269
|
+
});
|
270
|
+
}
|
271
|
+
}
|
272
|
+
_fetch = new WeakMap();
|
273
|
+
_queue = new WeakMap();
|
274
|
+
_concurrency = new WeakMap();
|
275
|
+
_enqueue = new WeakSet();
|
276
|
+
enqueue_fn = function(task) {
|
277
|
+
const promise = new Promise((resolve) => __privateGet$8(this, _queue).push(resolve)).finally(() => {
|
278
|
+
this.started--;
|
279
|
+
this.running++;
|
280
|
+
}).then(() => task()).finally(() => {
|
281
|
+
this.running--;
|
282
|
+
const next = __privateGet$8(this, _queue).shift();
|
283
|
+
if (next !== void 0) {
|
284
|
+
this.started++;
|
285
|
+
next();
|
286
|
+
}
|
287
|
+
});
|
288
|
+
if (this.running + this.started < __privateGet$8(this, _concurrency)) {
|
289
|
+
const next = __privateGet$8(this, _queue).shift();
|
290
|
+
if (next !== void 0) {
|
291
|
+
this.started++;
|
292
|
+
next();
|
293
|
+
}
|
294
|
+
}
|
295
|
+
return promise;
|
296
|
+
};
|
152
297
|
|
153
|
-
|
298
|
+
function generateUUID() {
|
299
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
300
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
301
|
+
return v.toString(16);
|
302
|
+
});
|
303
|
+
}
|
304
|
+
|
305
|
+
const VERSION = "0.0.0-alpha.vf882519";
|
154
306
|
|
155
307
|
class ErrorWithCause extends Error {
|
156
308
|
constructor(message, options) {
|
@@ -161,7 +313,7 @@ class FetcherError extends ErrorWithCause {
|
|
161
313
|
constructor(status, data, requestId) {
|
162
314
|
super(getMessage(data));
|
163
315
|
this.status = status;
|
164
|
-
this.errors = isBulkError(data) ? data.errors :
|
316
|
+
this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
|
165
317
|
this.requestId = requestId;
|
166
318
|
if (data instanceof Error) {
|
167
319
|
this.stack = data.stack;
|
@@ -193,6 +345,7 @@ function getMessage(data) {
|
|
193
345
|
}
|
194
346
|
}
|
195
347
|
|
348
|
+
const pool = new ApiRequestPool();
|
196
349
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
197
350
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
198
351
|
if (value === void 0 || value === null)
|
@@ -207,58 +360,77 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
207
360
|
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
208
361
|
};
|
209
362
|
function buildBaseUrl({
|
363
|
+
endpoint,
|
210
364
|
path,
|
211
365
|
workspacesApiUrl,
|
212
366
|
apiUrl,
|
213
|
-
pathParams
|
367
|
+
pathParams = {}
|
214
368
|
}) {
|
215
|
-
if (
|
216
|
-
|
217
|
-
|
218
|
-
|
369
|
+
if (endpoint === "dataPlane") {
|
370
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
371
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
372
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
373
|
+
}
|
374
|
+
return `${apiUrl}${path}`;
|
219
375
|
}
|
220
376
|
function hostHeader(url) {
|
221
377
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
222
378
|
const { groups } = pattern.exec(url) ?? {};
|
223
379
|
return groups?.host ? { Host: groups.host } : {};
|
224
380
|
}
|
381
|
+
const defaultClientID = generateUUID();
|
225
382
|
async function fetch$1({
|
226
383
|
url: path,
|
227
384
|
method,
|
228
385
|
body,
|
229
|
-
headers,
|
386
|
+
headers: customHeaders,
|
230
387
|
pathParams,
|
231
388
|
queryParams,
|
232
389
|
fetchImpl,
|
233
390
|
apiKey,
|
391
|
+
endpoint,
|
234
392
|
apiUrl,
|
235
393
|
workspacesApiUrl,
|
236
|
-
trace
|
394
|
+
trace,
|
395
|
+
signal,
|
396
|
+
clientID,
|
397
|
+
sessionID,
|
398
|
+
clientName,
|
399
|
+
fetchOptions = {}
|
237
400
|
}) {
|
238
|
-
|
401
|
+
pool.setFetch(fetchImpl);
|
402
|
+
return await trace(
|
239
403
|
`${method.toUpperCase()} ${path}`,
|
240
|
-
async ({ setAttributes }) => {
|
241
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
404
|
+
async ({ name, setAttributes }) => {
|
405
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
242
406
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
243
407
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
244
408
|
setAttributes({
|
245
409
|
[TraceAttributes.HTTP_URL]: url,
|
246
410
|
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
247
411
|
});
|
248
|
-
const
|
412
|
+
const xataAgent = compact([
|
413
|
+
["client", "TS_SDK"],
|
414
|
+
["version", VERSION],
|
415
|
+
isDefined(clientName) ? ["service", clientName] : void 0
|
416
|
+
]).map(([key, value]) => `${key}=${value}`).join("; ");
|
417
|
+
const headers = {
|
418
|
+
"Accept-Encoding": "identity",
|
419
|
+
"Content-Type": "application/json",
|
420
|
+
"X-Xata-Client-ID": clientID ?? defaultClientID,
|
421
|
+
"X-Xata-Session-ID": sessionID ?? generateUUID(),
|
422
|
+
"X-Xata-Agent": xataAgent,
|
423
|
+
...customHeaders,
|
424
|
+
...hostHeader(fullUrl),
|
425
|
+
Authorization: `Bearer ${apiKey}`
|
426
|
+
};
|
427
|
+
const response = await pool.request(url, {
|
428
|
+
...fetchOptions,
|
249
429
|
method: method.toUpperCase(),
|
250
430
|
body: body ? JSON.stringify(body) : void 0,
|
251
|
-
headers
|
252
|
-
|
253
|
-
"User-Agent": `Xata client-ts/${VERSION}`,
|
254
|
-
...headers,
|
255
|
-
...hostHeader(fullUrl),
|
256
|
-
Authorization: `Bearer ${apiKey}`
|
257
|
-
}
|
431
|
+
headers,
|
432
|
+
signal
|
258
433
|
});
|
259
|
-
if (response.status === 204) {
|
260
|
-
return {};
|
261
|
-
}
|
262
434
|
const { host, protocol } = parseUrl(response.url);
|
263
435
|
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
264
436
|
setAttributes({
|
@@ -268,6 +440,12 @@ async function fetch$1({
|
|
268
440
|
[TraceAttributes.HTTP_HOST]: host,
|
269
441
|
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
270
442
|
});
|
443
|
+
if (response.status === 204) {
|
444
|
+
return {};
|
445
|
+
}
|
446
|
+
if (response.status === 429) {
|
447
|
+
throw new FetcherError(response.status, "Rate limit exceeded", requestId);
|
448
|
+
}
|
271
449
|
try {
|
272
450
|
const jsonResponse = await response.json();
|
273
451
|
if (response.ok) {
|
@@ -290,278 +468,163 @@ function parseUrl(url) {
|
|
290
468
|
}
|
291
469
|
}
|
292
470
|
|
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({
|
471
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
472
|
+
|
473
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
474
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
380
475
|
url: "/dbs/{dbName}",
|
381
|
-
method: "delete",
|
382
|
-
...variables
|
383
|
-
});
|
384
|
-
const getDatabaseMetadata = (variables) => fetch$1({
|
385
|
-
url: "/dbs/{dbName}/metadata",
|
386
|
-
method: "get",
|
387
|
-
...variables
|
388
|
-
});
|
389
|
-
const updateDatabaseMetadata = (variables) => fetch$1({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables });
|
390
|
-
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
391
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
392
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
393
|
-
const resolveBranch = (variables) => fetch$1({
|
394
|
-
url: "/dbs/{dbName}/resolveBranch",
|
395
|
-
method: "get",
|
396
|
-
...variables
|
397
|
-
});
|
398
|
-
const listMigrationRequests = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/list", method: "post", ...variables });
|
399
|
-
const createMigrationRequest = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables });
|
400
|
-
const getMigrationRequest = (variables) => fetch$1({
|
401
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
402
476
|
method: "get",
|
403
|
-
...variables
|
477
|
+
...variables,
|
478
|
+
signal
|
404
479
|
});
|
405
|
-
const
|
406
|
-
const
|
407
|
-
const
|
408
|
-
const
|
409
|
-
const
|
410
|
-
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
411
|
-
method: "post",
|
412
|
-
...variables
|
413
|
-
});
|
414
|
-
const getBranchDetails = (variables) => fetch$1({
|
480
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
481
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
482
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
483
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
484
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
415
485
|
url: "/db/{dbBranchName}",
|
416
486
|
method: "get",
|
417
|
-
...variables
|
487
|
+
...variables,
|
488
|
+
signal
|
418
489
|
});
|
419
|
-
const createBranch = (variables) =>
|
420
|
-
const deleteBranch = (variables) =>
|
490
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
491
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
421
492
|
url: "/db/{dbBranchName}",
|
422
493
|
method: "delete",
|
423
|
-
...variables
|
494
|
+
...variables,
|
495
|
+
signal
|
424
496
|
});
|
425
|
-
const updateBranchMetadata = (variables) =>
|
497
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
426
498
|
url: "/db/{dbBranchName}/metadata",
|
427
499
|
method: "put",
|
428
|
-
...variables
|
500
|
+
...variables,
|
501
|
+
signal
|
429
502
|
});
|
430
|
-
const getBranchMetadata = (variables) =>
|
503
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
431
504
|
url: "/db/{dbBranchName}/metadata",
|
432
505
|
method: "get",
|
433
|
-
...variables
|
434
|
-
|
435
|
-
const getBranchMigrationHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables });
|
436
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
437
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
438
|
-
const compareBranchWithUserSchema = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables });
|
439
|
-
const compareBranchSchemas = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables });
|
440
|
-
const updateBranchSchema = (variables) => fetch$1({
|
441
|
-
url: "/db/{dbBranchName}/schema/update",
|
442
|
-
method: "post",
|
443
|
-
...variables
|
506
|
+
...variables,
|
507
|
+
signal
|
444
508
|
});
|
445
|
-
const
|
446
|
-
const applyBranchSchemaEdit = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables });
|
447
|
-
const getBranchSchemaHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables });
|
448
|
-
const getBranchStats = (variables) => fetch$1({
|
509
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
449
510
|
url: "/db/{dbBranchName}/stats",
|
450
511
|
method: "get",
|
451
|
-
...variables
|
512
|
+
...variables,
|
513
|
+
signal
|
452
514
|
});
|
453
|
-
const
|
515
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
516
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
517
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
518
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
519
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
520
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
521
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
522
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
523
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
524
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
525
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
526
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
527
|
+
method: "get",
|
528
|
+
...variables,
|
529
|
+
signal
|
530
|
+
});
|
531
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
532
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
533
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
534
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
535
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
536
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
537
|
+
method: "post",
|
538
|
+
...variables,
|
539
|
+
signal
|
540
|
+
});
|
541
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
542
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
543
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
544
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
545
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
546
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
547
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
454
548
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
455
549
|
method: "put",
|
456
|
-
...variables
|
550
|
+
...variables,
|
551
|
+
signal
|
457
552
|
});
|
458
|
-
const deleteTable = (variables) =>
|
553
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
459
554
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
460
555
|
method: "delete",
|
461
|
-
...variables
|
556
|
+
...variables,
|
557
|
+
signal
|
462
558
|
});
|
463
|
-
const updateTable = (variables) =>
|
464
|
-
|
465
|
-
method: "patch",
|
466
|
-
...variables
|
467
|
-
});
|
468
|
-
const getTableSchema = (variables) => fetch$1({
|
559
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
560
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
469
561
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
470
562
|
method: "get",
|
471
|
-
...variables
|
563
|
+
...variables,
|
564
|
+
signal
|
472
565
|
});
|
473
|
-
const setTableSchema = (variables) =>
|
474
|
-
|
475
|
-
method: "put",
|
476
|
-
...variables
|
477
|
-
});
|
478
|
-
const getTableColumns = (variables) => fetch$1({
|
566
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
567
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
479
568
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
480
569
|
method: "get",
|
481
|
-
...variables
|
570
|
+
...variables,
|
571
|
+
signal
|
482
572
|
});
|
483
|
-
const addTableColumn = (variables) =>
|
484
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
485
|
-
|
486
|
-
|
487
|
-
});
|
488
|
-
const getColumn = (variables) => fetch$1({
|
573
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
574
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
575
|
+
);
|
576
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
489
577
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
490
578
|
method: "get",
|
491
|
-
...variables
|
492
|
-
|
493
|
-
const deleteColumn = (variables) => fetch$1({
|
494
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
495
|
-
method: "delete",
|
496
|
-
...variables
|
579
|
+
...variables,
|
580
|
+
signal
|
497
581
|
});
|
498
|
-
const updateColumn = (variables) =>
|
582
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
583
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
499
584
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
500
|
-
method: "patch",
|
501
|
-
...variables
|
502
|
-
});
|
503
|
-
const insertRecord = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables });
|
504
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
505
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
506
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
507
|
-
const deleteRecord = (variables) => fetch$1({
|
508
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
509
585
|
method: "delete",
|
510
|
-
...variables
|
586
|
+
...variables,
|
587
|
+
signal
|
511
588
|
});
|
512
|
-
const
|
589
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
590
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
513
591
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
514
592
|
method: "get",
|
515
|
-
...variables
|
593
|
+
...variables,
|
594
|
+
signal
|
516
595
|
});
|
517
|
-
const
|
518
|
-
const
|
596
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
597
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
598
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
599
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
600
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
601
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
519
602
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
520
603
|
method: "post",
|
521
|
-
...variables
|
604
|
+
...variables,
|
605
|
+
signal
|
522
606
|
});
|
523
|
-
const
|
524
|
-
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
525
|
-
method: "post",
|
526
|
-
...variables
|
527
|
-
});
|
528
|
-
const searchBranch = (variables) => fetch$1({
|
607
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
529
608
|
url: "/db/{dbBranchName}/search",
|
530
609
|
method: "post",
|
531
|
-
...variables
|
610
|
+
...variables,
|
611
|
+
signal
|
532
612
|
});
|
533
|
-
const
|
534
|
-
url: "/db/{dbBranchName}/tables/{tableName}/
|
613
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
614
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
535
615
|
method: "post",
|
536
|
-
...variables
|
616
|
+
...variables,
|
617
|
+
signal
|
537
618
|
});
|
538
|
-
const
|
539
|
-
|
540
|
-
|
541
|
-
createWorkspace,
|
542
|
-
getWorkspacesList,
|
543
|
-
getWorkspace,
|
544
|
-
updateWorkspace,
|
545
|
-
deleteWorkspace,
|
546
|
-
getWorkspaceMembersList,
|
547
|
-
updateWorkspaceMemberRole,
|
548
|
-
removeWorkspaceMember,
|
549
|
-
inviteWorkspaceMember,
|
550
|
-
updateWorkspaceMemberInvite,
|
551
|
-
cancelWorkspaceMemberInvite,
|
552
|
-
resendWorkspaceMemberInvite,
|
553
|
-
acceptWorkspaceMemberInvite
|
554
|
-
},
|
619
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
620
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
621
|
+
const operationsByTag$2 = {
|
555
622
|
database: {
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
getGitBranchesMapping,
|
562
|
-
addGitBranchesEntry,
|
563
|
-
removeGitBranchesEntry,
|
564
|
-
resolveBranch
|
623
|
+
dEPRECATEDgetDatabaseList,
|
624
|
+
dEPRECATEDcreateDatabase,
|
625
|
+
dEPRECATEDdeleteDatabase,
|
626
|
+
dEPRECATEDgetDatabaseMetadata,
|
627
|
+
dEPRECATEDupdateDatabaseMetadata
|
565
628
|
},
|
566
629
|
branch: {
|
567
630
|
getBranchList,
|
@@ -570,10 +633,35 @@ const operationsByTag = {
|
|
570
633
|
deleteBranch,
|
571
634
|
updateBranchMetadata,
|
572
635
|
getBranchMetadata,
|
573
|
-
getBranchStats
|
636
|
+
getBranchStats,
|
637
|
+
getGitBranchesMapping,
|
638
|
+
addGitBranchesEntry,
|
639
|
+
removeGitBranchesEntry,
|
640
|
+
resolveBranch
|
641
|
+
},
|
642
|
+
migrations: {
|
643
|
+
getBranchMigrationHistory,
|
644
|
+
getBranchMigrationPlan,
|
645
|
+
executeBranchMigrationPlan,
|
646
|
+
getBranchSchemaHistory,
|
647
|
+
compareBranchWithUserSchema,
|
648
|
+
compareBranchSchemas,
|
649
|
+
updateBranchSchema,
|
650
|
+
previewBranchSchemaEdit,
|
651
|
+
applyBranchSchemaEdit
|
652
|
+
},
|
653
|
+
records: {
|
654
|
+
branchTransaction,
|
655
|
+
insertRecord,
|
656
|
+
getRecord,
|
657
|
+
insertRecordWithID,
|
658
|
+
updateRecordWithID,
|
659
|
+
upsertRecordWithID,
|
660
|
+
deleteRecord,
|
661
|
+
bulkInsertTableRecords
|
574
662
|
},
|
575
663
|
migrationRequests: {
|
576
|
-
|
664
|
+
queryMigrationRequests,
|
577
665
|
createMigrationRequest,
|
578
666
|
getMigrationRequest,
|
579
667
|
updateMigrationRequest,
|
@@ -582,17 +670,6 @@ const operationsByTag = {
|
|
582
670
|
getMigrationRequestIsMerged,
|
583
671
|
mergeMigrationRequest
|
584
672
|
},
|
585
|
-
branchSchema: {
|
586
|
-
getBranchMigrationHistory,
|
587
|
-
executeBranchMigrationPlan,
|
588
|
-
getBranchMigrationPlan,
|
589
|
-
compareBranchWithUserSchema,
|
590
|
-
compareBranchSchemas,
|
591
|
-
updateBranchSchema,
|
592
|
-
previewBranchSchemaEdit,
|
593
|
-
applyBranchSchemaEdit,
|
594
|
-
getBranchSchemaHistory
|
595
|
-
},
|
596
673
|
table: {
|
597
674
|
createTable,
|
598
675
|
deleteTable,
|
@@ -602,24 +679,146 @@ const operationsByTag = {
|
|
602
679
|
getTableColumns,
|
603
680
|
addTableColumn,
|
604
681
|
getColumn,
|
605
|
-
|
606
|
-
|
682
|
+
updateColumn,
|
683
|
+
deleteColumn
|
607
684
|
},
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
685
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
686
|
+
};
|
687
|
+
|
688
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
689
|
+
|
690
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
691
|
+
url: "/user",
|
692
|
+
method: "get",
|
693
|
+
...variables,
|
694
|
+
signal
|
695
|
+
});
|
696
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
697
|
+
url: "/user",
|
698
|
+
method: "put",
|
699
|
+
...variables,
|
700
|
+
signal
|
701
|
+
});
|
702
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
703
|
+
url: "/user",
|
704
|
+
method: "delete",
|
705
|
+
...variables,
|
706
|
+
signal
|
707
|
+
});
|
708
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
709
|
+
url: "/user/keys",
|
710
|
+
method: "get",
|
711
|
+
...variables,
|
712
|
+
signal
|
713
|
+
});
|
714
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
715
|
+
url: "/user/keys/{keyName}",
|
716
|
+
method: "post",
|
717
|
+
...variables,
|
718
|
+
signal
|
719
|
+
});
|
720
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
721
|
+
url: "/user/keys/{keyName}",
|
722
|
+
method: "delete",
|
723
|
+
...variables,
|
724
|
+
signal
|
725
|
+
});
|
726
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
727
|
+
url: "/workspaces",
|
728
|
+
method: "get",
|
729
|
+
...variables,
|
730
|
+
signal
|
731
|
+
});
|
732
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
733
|
+
url: "/workspaces",
|
734
|
+
method: "post",
|
735
|
+
...variables,
|
736
|
+
signal
|
737
|
+
});
|
738
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
739
|
+
url: "/workspaces/{workspaceId}",
|
740
|
+
method: "get",
|
741
|
+
...variables,
|
742
|
+
signal
|
743
|
+
});
|
744
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
745
|
+
url: "/workspaces/{workspaceId}",
|
746
|
+
method: "put",
|
747
|
+
...variables,
|
748
|
+
signal
|
749
|
+
});
|
750
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
751
|
+
url: "/workspaces/{workspaceId}",
|
752
|
+
method: "delete",
|
753
|
+
...variables,
|
754
|
+
signal
|
755
|
+
});
|
756
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
757
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
758
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
759
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
760
|
+
method: "delete",
|
761
|
+
...variables,
|
762
|
+
signal
|
763
|
+
});
|
764
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
765
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
766
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
767
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
768
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
769
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
770
|
+
url: "/workspaces/{workspaceId}/dbs",
|
771
|
+
method: "get",
|
772
|
+
...variables,
|
773
|
+
signal
|
774
|
+
});
|
775
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
776
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
777
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
778
|
+
method: "delete",
|
779
|
+
...variables,
|
780
|
+
signal
|
781
|
+
});
|
782
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
783
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
784
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
785
|
+
url: "/workspaces/{workspaceId}/regions",
|
786
|
+
method: "get",
|
787
|
+
...variables,
|
788
|
+
signal
|
789
|
+
});
|
790
|
+
const operationsByTag$1 = {
|
791
|
+
users: { getUser, updateUser, deleteUser },
|
792
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
793
|
+
workspaces: {
|
794
|
+
getWorkspacesList,
|
795
|
+
createWorkspace,
|
796
|
+
getWorkspace,
|
797
|
+
updateWorkspace,
|
798
|
+
deleteWorkspace,
|
799
|
+
getWorkspaceMembersList,
|
800
|
+
updateWorkspaceMemberRole,
|
801
|
+
removeWorkspaceMember
|
802
|
+
},
|
803
|
+
invites: {
|
804
|
+
inviteWorkspaceMember,
|
805
|
+
updateWorkspaceMemberInvite,
|
806
|
+
cancelWorkspaceMemberInvite,
|
807
|
+
acceptWorkspaceMemberInvite,
|
808
|
+
resendWorkspaceMemberInvite
|
809
|
+
},
|
810
|
+
databases: {
|
811
|
+
getDatabaseList,
|
812
|
+
createDatabase,
|
813
|
+
deleteDatabase,
|
814
|
+
getDatabaseMetadata,
|
815
|
+
updateDatabaseMetadata,
|
816
|
+
listRegions
|
620
817
|
}
|
621
818
|
};
|
622
819
|
|
820
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
821
|
+
|
623
822
|
function getHostUrl(provider, type) {
|
624
823
|
if (isHostProviderAlias(provider)) {
|
625
824
|
return providers[provider][type];
|
@@ -631,11 +830,11 @@ function getHostUrl(provider, type) {
|
|
631
830
|
const providers = {
|
632
831
|
production: {
|
633
832
|
main: "https://api.xata.io",
|
634
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
833
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
635
834
|
},
|
636
835
|
staging: {
|
637
836
|
main: "https://staging.xatabase.co",
|
638
|
-
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
837
|
+
workspaces: "https://{workspaceId}.staging.{region}.xatabase.co"
|
639
838
|
}
|
640
839
|
};
|
641
840
|
function isHostProviderAlias(alias) {
|
@@ -644,6 +843,25 @@ function isHostProviderAlias(alias) {
|
|
644
843
|
function isHostProviderBuilder(builder) {
|
645
844
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
646
845
|
}
|
846
|
+
function parseProviderString(provider = "production") {
|
847
|
+
if (isHostProviderAlias(provider)) {
|
848
|
+
return provider;
|
849
|
+
}
|
850
|
+
const [main, workspaces] = provider.split(",");
|
851
|
+
if (!main || !workspaces)
|
852
|
+
return null;
|
853
|
+
return { main, workspaces };
|
854
|
+
}
|
855
|
+
function parseWorkspacesUrlParts(url) {
|
856
|
+
if (!isString(url))
|
857
|
+
return null;
|
858
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
|
859
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)\.staging(?:\.([^.]+))\.xatabase\.co.*/;
|
860
|
+
const match = url.match(regex) || url.match(regexStaging);
|
861
|
+
if (!match)
|
862
|
+
return null;
|
863
|
+
return { workspace: match[1], region: match[2] };
|
864
|
+
}
|
647
865
|
|
648
866
|
var __accessCheck$7 = (obj, member, msg) => {
|
649
867
|
if (!member.has(obj))
|
@@ -671,6 +889,7 @@ class XataApiClient {
|
|
671
889
|
const provider = options.host ?? "production";
|
672
890
|
const apiKey = options.apiKey ?? getAPIKey();
|
673
891
|
const trace = options.trace ?? defaultTrace;
|
892
|
+
const clientID = generateUUID();
|
674
893
|
if (!apiKey) {
|
675
894
|
throw new Error("Could not resolve a valid apiKey");
|
676
895
|
}
|
@@ -679,7 +898,9 @@ class XataApiClient {
|
|
679
898
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
680
899
|
fetchImpl: getFetchImplementation(options.fetch),
|
681
900
|
apiKey,
|
682
|
-
trace
|
901
|
+
trace,
|
902
|
+
clientName: options.clientName,
|
903
|
+
clientID
|
683
904
|
});
|
684
905
|
}
|
685
906
|
get user() {
|
@@ -687,21 +908,41 @@ class XataApiClient {
|
|
687
908
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
688
909
|
return __privateGet$7(this, _namespaces).user;
|
689
910
|
}
|
911
|
+
get authentication() {
|
912
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
913
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
914
|
+
return __privateGet$7(this, _namespaces).authentication;
|
915
|
+
}
|
690
916
|
get workspaces() {
|
691
917
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
692
918
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
693
919
|
return __privateGet$7(this, _namespaces).workspaces;
|
694
920
|
}
|
695
|
-
get
|
696
|
-
if (!__privateGet$7(this, _namespaces).
|
697
|
-
__privateGet$7(this, _namespaces).
|
698
|
-
return __privateGet$7(this, _namespaces).
|
921
|
+
get invites() {
|
922
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
923
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
924
|
+
return __privateGet$7(this, _namespaces).invites;
|
925
|
+
}
|
926
|
+
get database() {
|
927
|
+
if (!__privateGet$7(this, _namespaces).database)
|
928
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
929
|
+
return __privateGet$7(this, _namespaces).database;
|
699
930
|
}
|
700
931
|
get branches() {
|
701
932
|
if (!__privateGet$7(this, _namespaces).branches)
|
702
933
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
703
934
|
return __privateGet$7(this, _namespaces).branches;
|
704
935
|
}
|
936
|
+
get migrations() {
|
937
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
938
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
939
|
+
return __privateGet$7(this, _namespaces).migrations;
|
940
|
+
}
|
941
|
+
get migrationRequests() {
|
942
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
943
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
944
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
945
|
+
}
|
705
946
|
get tables() {
|
706
947
|
if (!__privateGet$7(this, _namespaces).tables)
|
707
948
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -709,18 +950,13 @@ class XataApiClient {
|
|
709
950
|
}
|
710
951
|
get records() {
|
711
952
|
if (!__privateGet$7(this, _namespaces).records)
|
712
|
-
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
713
|
-
return __privateGet$7(this, _namespaces).records;
|
714
|
-
}
|
715
|
-
get migrationRequests() {
|
716
|
-
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
717
|
-
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
718
|
-
return __privateGet$7(this, _namespaces).migrationRequests;
|
953
|
+
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
954
|
+
return __privateGet$7(this, _namespaces).records;
|
719
955
|
}
|
720
|
-
get
|
721
|
-
if (!__privateGet$7(this, _namespaces).
|
722
|
-
__privateGet$7(this, _namespaces).
|
723
|
-
return __privateGet$7(this, _namespaces).
|
956
|
+
get searchAndFilter() {
|
957
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
958
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
959
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
724
960
|
}
|
725
961
|
}
|
726
962
|
_extraProps = new WeakMap();
|
@@ -732,24 +968,29 @@ class UserApi {
|
|
732
968
|
getUser() {
|
733
969
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
734
970
|
}
|
735
|
-
updateUser(user) {
|
971
|
+
updateUser({ user }) {
|
736
972
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
737
973
|
}
|
738
974
|
deleteUser() {
|
739
975
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
740
976
|
}
|
977
|
+
}
|
978
|
+
class AuthenticationApi {
|
979
|
+
constructor(extraProps) {
|
980
|
+
this.extraProps = extraProps;
|
981
|
+
}
|
741
982
|
getUserAPIKeys() {
|
742
|
-
return operationsByTag.
|
983
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
743
984
|
}
|
744
|
-
createUserAPIKey(
|
745
|
-
return operationsByTag.
|
746
|
-
pathParams: { keyName },
|
985
|
+
createUserAPIKey({ name }) {
|
986
|
+
return operationsByTag.authentication.createUserAPIKey({
|
987
|
+
pathParams: { keyName: name },
|
747
988
|
...this.extraProps
|
748
989
|
});
|
749
990
|
}
|
750
|
-
deleteUserAPIKey(
|
751
|
-
return operationsByTag.
|
752
|
-
pathParams: { keyName },
|
991
|
+
deleteUserAPIKey({ name }) {
|
992
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
993
|
+
pathParams: { keyName: name },
|
753
994
|
...this.extraProps
|
754
995
|
});
|
755
996
|
}
|
@@ -758,196 +999,248 @@ class WorkspaceApi {
|
|
758
999
|
constructor(extraProps) {
|
759
1000
|
this.extraProps = extraProps;
|
760
1001
|
}
|
761
|
-
|
1002
|
+
getWorkspacesList() {
|
1003
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
1004
|
+
}
|
1005
|
+
createWorkspace({ data }) {
|
762
1006
|
return operationsByTag.workspaces.createWorkspace({
|
763
|
-
body:
|
1007
|
+
body: data,
|
764
1008
|
...this.extraProps
|
765
1009
|
});
|
766
1010
|
}
|
767
|
-
|
768
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
769
|
-
}
|
770
|
-
getWorkspace(workspaceId) {
|
1011
|
+
getWorkspace({ workspace }) {
|
771
1012
|
return operationsByTag.workspaces.getWorkspace({
|
772
|
-
pathParams: { workspaceId },
|
1013
|
+
pathParams: { workspaceId: workspace },
|
773
1014
|
...this.extraProps
|
774
1015
|
});
|
775
1016
|
}
|
776
|
-
updateWorkspace(
|
1017
|
+
updateWorkspace({
|
1018
|
+
workspace,
|
1019
|
+
update
|
1020
|
+
}) {
|
777
1021
|
return operationsByTag.workspaces.updateWorkspace({
|
778
|
-
pathParams: { workspaceId },
|
779
|
-
body:
|
1022
|
+
pathParams: { workspaceId: workspace },
|
1023
|
+
body: update,
|
780
1024
|
...this.extraProps
|
781
1025
|
});
|
782
1026
|
}
|
783
|
-
deleteWorkspace(
|
1027
|
+
deleteWorkspace({ workspace }) {
|
784
1028
|
return operationsByTag.workspaces.deleteWorkspace({
|
785
|
-
pathParams: { workspaceId },
|
1029
|
+
pathParams: { workspaceId: workspace },
|
786
1030
|
...this.extraProps
|
787
1031
|
});
|
788
1032
|
}
|
789
|
-
getWorkspaceMembersList(
|
1033
|
+
getWorkspaceMembersList({ workspace }) {
|
790
1034
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
791
|
-
pathParams: { workspaceId },
|
1035
|
+
pathParams: { workspaceId: workspace },
|
792
1036
|
...this.extraProps
|
793
1037
|
});
|
794
1038
|
}
|
795
|
-
updateWorkspaceMemberRole(
|
1039
|
+
updateWorkspaceMemberRole({
|
1040
|
+
workspace,
|
1041
|
+
user,
|
1042
|
+
role
|
1043
|
+
}) {
|
796
1044
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
797
|
-
pathParams: { workspaceId, userId },
|
1045
|
+
pathParams: { workspaceId: workspace, userId: user },
|
798
1046
|
body: { role },
|
799
1047
|
...this.extraProps
|
800
1048
|
});
|
801
1049
|
}
|
802
|
-
removeWorkspaceMember(
|
1050
|
+
removeWorkspaceMember({
|
1051
|
+
workspace,
|
1052
|
+
user
|
1053
|
+
}) {
|
803
1054
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
804
|
-
pathParams: { workspaceId, userId },
|
1055
|
+
pathParams: { workspaceId: workspace, userId: user },
|
805
1056
|
...this.extraProps
|
806
1057
|
});
|
807
1058
|
}
|
808
|
-
|
809
|
-
|
810
|
-
|
1059
|
+
}
|
1060
|
+
class InvitesApi {
|
1061
|
+
constructor(extraProps) {
|
1062
|
+
this.extraProps = extraProps;
|
1063
|
+
}
|
1064
|
+
inviteWorkspaceMember({
|
1065
|
+
workspace,
|
1066
|
+
email,
|
1067
|
+
role
|
1068
|
+
}) {
|
1069
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
1070
|
+
pathParams: { workspaceId: workspace },
|
811
1071
|
body: { email, role },
|
812
1072
|
...this.extraProps
|
813
1073
|
});
|
814
1074
|
}
|
815
|
-
updateWorkspaceMemberInvite(
|
816
|
-
|
817
|
-
|
1075
|
+
updateWorkspaceMemberInvite({
|
1076
|
+
workspace,
|
1077
|
+
invite,
|
1078
|
+
role
|
1079
|
+
}) {
|
1080
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
1081
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
818
1082
|
body: { role },
|
819
1083
|
...this.extraProps
|
820
1084
|
});
|
821
1085
|
}
|
822
|
-
cancelWorkspaceMemberInvite(
|
823
|
-
|
824
|
-
|
1086
|
+
cancelWorkspaceMemberInvite({
|
1087
|
+
workspace,
|
1088
|
+
invite
|
1089
|
+
}) {
|
1090
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
1091
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
825
1092
|
...this.extraProps
|
826
1093
|
});
|
827
1094
|
}
|
828
|
-
|
829
|
-
|
830
|
-
|
1095
|
+
acceptWorkspaceMemberInvite({
|
1096
|
+
workspace,
|
1097
|
+
key
|
1098
|
+
}) {
|
1099
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
1100
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
831
1101
|
...this.extraProps
|
832
1102
|
});
|
833
1103
|
}
|
834
|
-
|
835
|
-
|
836
|
-
|
1104
|
+
resendWorkspaceMemberInvite({
|
1105
|
+
workspace,
|
1106
|
+
invite
|
1107
|
+
}) {
|
1108
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
1109
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
837
1110
|
...this.extraProps
|
838
1111
|
});
|
839
1112
|
}
|
840
1113
|
}
|
841
|
-
class
|
1114
|
+
class BranchApi {
|
842
1115
|
constructor(extraProps) {
|
843
1116
|
this.extraProps = extraProps;
|
844
1117
|
}
|
845
|
-
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
return operationsByTag.database.createDatabase({
|
853
|
-
pathParams: { workspace, dbName },
|
854
|
-
body: options,
|
855
|
-
...this.extraProps
|
856
|
-
});
|
857
|
-
}
|
858
|
-
deleteDatabase(workspace, dbName) {
|
859
|
-
return operationsByTag.database.deleteDatabase({
|
860
|
-
pathParams: { workspace, dbName },
|
861
|
-
...this.extraProps
|
862
|
-
});
|
863
|
-
}
|
864
|
-
getDatabaseMetadata(workspace, dbName) {
|
865
|
-
return operationsByTag.database.getDatabaseMetadata({
|
866
|
-
pathParams: { workspace, dbName },
|
867
|
-
...this.extraProps
|
868
|
-
});
|
869
|
-
}
|
870
|
-
updateDatabaseMetadata(workspace, dbName, options = {}) {
|
871
|
-
return operationsByTag.database.updateDatabaseMetadata({
|
872
|
-
pathParams: { workspace, dbName },
|
873
|
-
body: options,
|
874
|
-
...this.extraProps
|
875
|
-
});
|
876
|
-
}
|
877
|
-
getGitBranchesMapping(workspace, dbName) {
|
878
|
-
return operationsByTag.database.getGitBranchesMapping({
|
879
|
-
pathParams: { workspace, dbName },
|
1118
|
+
getBranchList({
|
1119
|
+
workspace,
|
1120
|
+
region,
|
1121
|
+
database
|
1122
|
+
}) {
|
1123
|
+
return operationsByTag.branch.getBranchList({
|
1124
|
+
pathParams: { workspace, region, dbName: database },
|
880
1125
|
...this.extraProps
|
881
1126
|
});
|
882
1127
|
}
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
1128
|
+
getBranchDetails({
|
1129
|
+
workspace,
|
1130
|
+
region,
|
1131
|
+
database,
|
1132
|
+
branch
|
1133
|
+
}) {
|
1134
|
+
return operationsByTag.branch.getBranchDetails({
|
1135
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
887
1136
|
...this.extraProps
|
888
1137
|
});
|
889
1138
|
}
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
1139
|
+
createBranch({
|
1140
|
+
workspace,
|
1141
|
+
region,
|
1142
|
+
database,
|
1143
|
+
branch,
|
1144
|
+
from,
|
1145
|
+
metadata
|
1146
|
+
}) {
|
1147
|
+
return operationsByTag.branch.createBranch({
|
1148
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1149
|
+
body: { from, metadata },
|
894
1150
|
...this.extraProps
|
895
1151
|
});
|
896
1152
|
}
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
1153
|
+
deleteBranch({
|
1154
|
+
workspace,
|
1155
|
+
region,
|
1156
|
+
database,
|
1157
|
+
branch
|
1158
|
+
}) {
|
1159
|
+
return operationsByTag.branch.deleteBranch({
|
1160
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
901
1161
|
...this.extraProps
|
902
1162
|
});
|
903
1163
|
}
|
904
|
-
|
905
|
-
|
906
|
-
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
911
|
-
|
1164
|
+
updateBranchMetadata({
|
1165
|
+
workspace,
|
1166
|
+
region,
|
1167
|
+
database,
|
1168
|
+
branch,
|
1169
|
+
metadata
|
1170
|
+
}) {
|
1171
|
+
return operationsByTag.branch.updateBranchMetadata({
|
1172
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1173
|
+
body: metadata,
|
912
1174
|
...this.extraProps
|
913
1175
|
});
|
914
1176
|
}
|
915
|
-
|
916
|
-
|
917
|
-
|
1177
|
+
getBranchMetadata({
|
1178
|
+
workspace,
|
1179
|
+
region,
|
1180
|
+
database,
|
1181
|
+
branch
|
1182
|
+
}) {
|
1183
|
+
return operationsByTag.branch.getBranchMetadata({
|
1184
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
918
1185
|
...this.extraProps
|
919
1186
|
});
|
920
1187
|
}
|
921
|
-
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
1188
|
+
getBranchStats({
|
1189
|
+
workspace,
|
1190
|
+
region,
|
1191
|
+
database,
|
1192
|
+
branch
|
1193
|
+
}) {
|
1194
|
+
return operationsByTag.branch.getBranchStats({
|
1195
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
926
1196
|
...this.extraProps
|
927
1197
|
});
|
928
1198
|
}
|
929
|
-
|
930
|
-
|
931
|
-
|
1199
|
+
getGitBranchesMapping({
|
1200
|
+
workspace,
|
1201
|
+
region,
|
1202
|
+
database
|
1203
|
+
}) {
|
1204
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1205
|
+
pathParams: { workspace, region, dbName: database },
|
932
1206
|
...this.extraProps
|
933
1207
|
});
|
934
1208
|
}
|
935
|
-
|
936
|
-
|
937
|
-
|
938
|
-
|
1209
|
+
addGitBranchesEntry({
|
1210
|
+
workspace,
|
1211
|
+
region,
|
1212
|
+
database,
|
1213
|
+
gitBranch,
|
1214
|
+
xataBranch
|
1215
|
+
}) {
|
1216
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1217
|
+
pathParams: { workspace, region, dbName: database },
|
1218
|
+
body: { gitBranch, xataBranch },
|
939
1219
|
...this.extraProps
|
940
1220
|
});
|
941
1221
|
}
|
942
|
-
|
943
|
-
|
944
|
-
|
1222
|
+
removeGitBranchesEntry({
|
1223
|
+
workspace,
|
1224
|
+
region,
|
1225
|
+
database,
|
1226
|
+
gitBranch
|
1227
|
+
}) {
|
1228
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1229
|
+
pathParams: { workspace, region, dbName: database },
|
1230
|
+
queryParams: { gitBranch },
|
945
1231
|
...this.extraProps
|
946
1232
|
});
|
947
1233
|
}
|
948
|
-
|
949
|
-
|
950
|
-
|
1234
|
+
resolveBranch({
|
1235
|
+
workspace,
|
1236
|
+
region,
|
1237
|
+
database,
|
1238
|
+
gitBranch,
|
1239
|
+
fallbackBranch
|
1240
|
+
}) {
|
1241
|
+
return operationsByTag.branch.resolveBranch({
|
1242
|
+
pathParams: { workspace, region, dbName: database },
|
1243
|
+
queryParams: { gitBranch, fallbackBranch },
|
951
1244
|
...this.extraProps
|
952
1245
|
});
|
953
1246
|
}
|
@@ -956,67 +1249,134 @@ class TableApi {
|
|
956
1249
|
constructor(extraProps) {
|
957
1250
|
this.extraProps = extraProps;
|
958
1251
|
}
|
959
|
-
createTable(
|
1252
|
+
createTable({
|
1253
|
+
workspace,
|
1254
|
+
region,
|
1255
|
+
database,
|
1256
|
+
branch,
|
1257
|
+
table
|
1258
|
+
}) {
|
960
1259
|
return operationsByTag.table.createTable({
|
961
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1260
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
962
1261
|
...this.extraProps
|
963
1262
|
});
|
964
1263
|
}
|
965
|
-
deleteTable(
|
1264
|
+
deleteTable({
|
1265
|
+
workspace,
|
1266
|
+
region,
|
1267
|
+
database,
|
1268
|
+
branch,
|
1269
|
+
table
|
1270
|
+
}) {
|
966
1271
|
return operationsByTag.table.deleteTable({
|
967
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1272
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
968
1273
|
...this.extraProps
|
969
1274
|
});
|
970
1275
|
}
|
971
|
-
updateTable(
|
1276
|
+
updateTable({
|
1277
|
+
workspace,
|
1278
|
+
region,
|
1279
|
+
database,
|
1280
|
+
branch,
|
1281
|
+
table,
|
1282
|
+
update
|
1283
|
+
}) {
|
972
1284
|
return operationsByTag.table.updateTable({
|
973
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
974
|
-
body:
|
1285
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1286
|
+
body: update,
|
975
1287
|
...this.extraProps
|
976
1288
|
});
|
977
1289
|
}
|
978
|
-
getTableSchema(
|
1290
|
+
getTableSchema({
|
1291
|
+
workspace,
|
1292
|
+
region,
|
1293
|
+
database,
|
1294
|
+
branch,
|
1295
|
+
table
|
1296
|
+
}) {
|
979
1297
|
return operationsByTag.table.getTableSchema({
|
980
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1298
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
981
1299
|
...this.extraProps
|
982
1300
|
});
|
983
1301
|
}
|
984
|
-
setTableSchema(
|
1302
|
+
setTableSchema({
|
1303
|
+
workspace,
|
1304
|
+
region,
|
1305
|
+
database,
|
1306
|
+
branch,
|
1307
|
+
table,
|
1308
|
+
schema
|
1309
|
+
}) {
|
985
1310
|
return operationsByTag.table.setTableSchema({
|
986
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
987
|
-
body:
|
1311
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1312
|
+
body: schema,
|
988
1313
|
...this.extraProps
|
989
1314
|
});
|
990
1315
|
}
|
991
|
-
getTableColumns(
|
1316
|
+
getTableColumns({
|
1317
|
+
workspace,
|
1318
|
+
region,
|
1319
|
+
database,
|
1320
|
+
branch,
|
1321
|
+
table
|
1322
|
+
}) {
|
992
1323
|
return operationsByTag.table.getTableColumns({
|
993
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1324
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
994
1325
|
...this.extraProps
|
995
1326
|
});
|
996
1327
|
}
|
997
|
-
addTableColumn(
|
1328
|
+
addTableColumn({
|
1329
|
+
workspace,
|
1330
|
+
region,
|
1331
|
+
database,
|
1332
|
+
branch,
|
1333
|
+
table,
|
1334
|
+
column
|
1335
|
+
}) {
|
998
1336
|
return operationsByTag.table.addTableColumn({
|
999
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1337
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1000
1338
|
body: column,
|
1001
1339
|
...this.extraProps
|
1002
1340
|
});
|
1003
1341
|
}
|
1004
|
-
getColumn(
|
1342
|
+
getColumn({
|
1343
|
+
workspace,
|
1344
|
+
region,
|
1345
|
+
database,
|
1346
|
+
branch,
|
1347
|
+
table,
|
1348
|
+
column
|
1349
|
+
}) {
|
1005
1350
|
return operationsByTag.table.getColumn({
|
1006
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName },
|
1351
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1007
1352
|
...this.extraProps
|
1008
1353
|
});
|
1009
1354
|
}
|
1010
|
-
|
1011
|
-
|
1012
|
-
|
1355
|
+
updateColumn({
|
1356
|
+
workspace,
|
1357
|
+
region,
|
1358
|
+
database,
|
1359
|
+
branch,
|
1360
|
+
table,
|
1361
|
+
column,
|
1362
|
+
update
|
1363
|
+
}) {
|
1364
|
+
return operationsByTag.table.updateColumn({
|
1365
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1366
|
+
body: update,
|
1013
1367
|
...this.extraProps
|
1014
1368
|
});
|
1015
1369
|
}
|
1016
|
-
|
1017
|
-
|
1018
|
-
|
1019
|
-
|
1370
|
+
deleteColumn({
|
1371
|
+
workspace,
|
1372
|
+
region,
|
1373
|
+
database,
|
1374
|
+
branch,
|
1375
|
+
table,
|
1376
|
+
column
|
1377
|
+
}) {
|
1378
|
+
return operationsByTag.table.deleteColumn({
|
1379
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1020
1380
|
...this.extraProps
|
1021
1381
|
});
|
1022
1382
|
}
|
@@ -1025,85 +1385,228 @@ class RecordsApi {
|
|
1025
1385
|
constructor(extraProps) {
|
1026
1386
|
this.extraProps = extraProps;
|
1027
1387
|
}
|
1028
|
-
insertRecord(
|
1388
|
+
insertRecord({
|
1389
|
+
workspace,
|
1390
|
+
region,
|
1391
|
+
database,
|
1392
|
+
branch,
|
1393
|
+
table,
|
1394
|
+
record,
|
1395
|
+
columns
|
1396
|
+
}) {
|
1029
1397
|
return operationsByTag.records.insertRecord({
|
1030
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1031
|
-
queryParams:
|
1398
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1399
|
+
queryParams: { columns },
|
1032
1400
|
body: record,
|
1033
1401
|
...this.extraProps
|
1034
1402
|
});
|
1035
1403
|
}
|
1036
|
-
|
1404
|
+
getRecord({
|
1405
|
+
workspace,
|
1406
|
+
region,
|
1407
|
+
database,
|
1408
|
+
branch,
|
1409
|
+
table,
|
1410
|
+
id,
|
1411
|
+
columns
|
1412
|
+
}) {
|
1413
|
+
return operationsByTag.records.getRecord({
|
1414
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1415
|
+
queryParams: { columns },
|
1416
|
+
...this.extraProps
|
1417
|
+
});
|
1418
|
+
}
|
1419
|
+
insertRecordWithID({
|
1420
|
+
workspace,
|
1421
|
+
region,
|
1422
|
+
database,
|
1423
|
+
branch,
|
1424
|
+
table,
|
1425
|
+
id,
|
1426
|
+
record,
|
1427
|
+
columns,
|
1428
|
+
createOnly,
|
1429
|
+
ifVersion
|
1430
|
+
}) {
|
1037
1431
|
return operationsByTag.records.insertRecordWithID({
|
1038
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1039
|
-
queryParams:
|
1432
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1433
|
+
queryParams: { columns, createOnly, ifVersion },
|
1040
1434
|
body: record,
|
1041
1435
|
...this.extraProps
|
1042
1436
|
});
|
1043
1437
|
}
|
1044
|
-
updateRecordWithID(
|
1438
|
+
updateRecordWithID({
|
1439
|
+
workspace,
|
1440
|
+
region,
|
1441
|
+
database,
|
1442
|
+
branch,
|
1443
|
+
table,
|
1444
|
+
id,
|
1445
|
+
record,
|
1446
|
+
columns,
|
1447
|
+
ifVersion
|
1448
|
+
}) {
|
1045
1449
|
return operationsByTag.records.updateRecordWithID({
|
1046
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1047
|
-
queryParams:
|
1450
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1451
|
+
queryParams: { columns, ifVersion },
|
1048
1452
|
body: record,
|
1049
1453
|
...this.extraProps
|
1050
1454
|
});
|
1051
1455
|
}
|
1052
|
-
upsertRecordWithID(
|
1456
|
+
upsertRecordWithID({
|
1457
|
+
workspace,
|
1458
|
+
region,
|
1459
|
+
database,
|
1460
|
+
branch,
|
1461
|
+
table,
|
1462
|
+
id,
|
1463
|
+
record,
|
1464
|
+
columns,
|
1465
|
+
ifVersion
|
1466
|
+
}) {
|
1053
1467
|
return operationsByTag.records.upsertRecordWithID({
|
1054
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1055
|
-
queryParams:
|
1468
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1469
|
+
queryParams: { columns, ifVersion },
|
1056
1470
|
body: record,
|
1057
1471
|
...this.extraProps
|
1058
1472
|
});
|
1059
1473
|
}
|
1060
|
-
deleteRecord(
|
1474
|
+
deleteRecord({
|
1475
|
+
workspace,
|
1476
|
+
region,
|
1477
|
+
database,
|
1478
|
+
branch,
|
1479
|
+
table,
|
1480
|
+
id,
|
1481
|
+
columns
|
1482
|
+
}) {
|
1061
1483
|
return operationsByTag.records.deleteRecord({
|
1062
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1063
|
-
queryParams:
|
1064
|
-
...this.extraProps
|
1065
|
-
});
|
1066
|
-
}
|
1067
|
-
getRecord(workspace, database, branch, tableName, recordId, options = {}) {
|
1068
|
-
return operationsByTag.records.getRecord({
|
1069
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
1070
|
-
queryParams: options,
|
1484
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1485
|
+
queryParams: { columns },
|
1071
1486
|
...this.extraProps
|
1072
1487
|
});
|
1073
1488
|
}
|
1074
|
-
bulkInsertTableRecords(
|
1489
|
+
bulkInsertTableRecords({
|
1490
|
+
workspace,
|
1491
|
+
region,
|
1492
|
+
database,
|
1493
|
+
branch,
|
1494
|
+
table,
|
1495
|
+
records,
|
1496
|
+
columns
|
1497
|
+
}) {
|
1075
1498
|
return operationsByTag.records.bulkInsertTableRecords({
|
1076
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName },
|
1077
|
-
queryParams:
|
1499
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1500
|
+
queryParams: { columns },
|
1078
1501
|
body: { records },
|
1079
1502
|
...this.extraProps
|
1080
1503
|
});
|
1081
1504
|
}
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
1086
|
-
|
1087
|
-
|
1088
|
-
}
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
body: query,
|
1505
|
+
branchTransaction({
|
1506
|
+
workspace,
|
1507
|
+
region,
|
1508
|
+
database,
|
1509
|
+
branch,
|
1510
|
+
operations
|
1511
|
+
}) {
|
1512
|
+
return operationsByTag.records.branchTransaction({
|
1513
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1514
|
+
body: { operations },
|
1093
1515
|
...this.extraProps
|
1094
1516
|
});
|
1095
1517
|
}
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
...this.extraProps
|
1101
|
-
});
|
1518
|
+
}
|
1519
|
+
class SearchAndFilterApi {
|
1520
|
+
constructor(extraProps) {
|
1521
|
+
this.extraProps = extraProps;
|
1102
1522
|
}
|
1103
|
-
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1523
|
+
queryTable({
|
1524
|
+
workspace,
|
1525
|
+
region,
|
1526
|
+
database,
|
1527
|
+
branch,
|
1528
|
+
table,
|
1529
|
+
filter,
|
1530
|
+
sort,
|
1531
|
+
page,
|
1532
|
+
columns,
|
1533
|
+
consistency
|
1534
|
+
}) {
|
1535
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1536
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1537
|
+
body: { filter, sort, page, columns, consistency },
|
1538
|
+
...this.extraProps
|
1539
|
+
});
|
1540
|
+
}
|
1541
|
+
searchTable({
|
1542
|
+
workspace,
|
1543
|
+
region,
|
1544
|
+
database,
|
1545
|
+
branch,
|
1546
|
+
table,
|
1547
|
+
query,
|
1548
|
+
fuzziness,
|
1549
|
+
target,
|
1550
|
+
prefix,
|
1551
|
+
filter,
|
1552
|
+
highlight,
|
1553
|
+
boosters
|
1554
|
+
}) {
|
1555
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1556
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1557
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1558
|
+
...this.extraProps
|
1559
|
+
});
|
1560
|
+
}
|
1561
|
+
searchBranch({
|
1562
|
+
workspace,
|
1563
|
+
region,
|
1564
|
+
database,
|
1565
|
+
branch,
|
1566
|
+
tables,
|
1567
|
+
query,
|
1568
|
+
fuzziness,
|
1569
|
+
prefix,
|
1570
|
+
highlight
|
1571
|
+
}) {
|
1572
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1573
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1574
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1575
|
+
...this.extraProps
|
1576
|
+
});
|
1577
|
+
}
|
1578
|
+
summarizeTable({
|
1579
|
+
workspace,
|
1580
|
+
region,
|
1581
|
+
database,
|
1582
|
+
branch,
|
1583
|
+
table,
|
1584
|
+
filter,
|
1585
|
+
columns,
|
1586
|
+
summaries,
|
1587
|
+
sort,
|
1588
|
+
summariesFilter,
|
1589
|
+
page,
|
1590
|
+
consistency
|
1591
|
+
}) {
|
1592
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1593
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1594
|
+
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
1595
|
+
...this.extraProps
|
1596
|
+
});
|
1597
|
+
}
|
1598
|
+
aggregateTable({
|
1599
|
+
workspace,
|
1600
|
+
region,
|
1601
|
+
database,
|
1602
|
+
branch,
|
1603
|
+
table,
|
1604
|
+
filter,
|
1605
|
+
aggs
|
1606
|
+
}) {
|
1607
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1608
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1609
|
+
body: { filter, aggs },
|
1107
1610
|
...this.extraProps
|
1108
1611
|
});
|
1109
1612
|
}
|
@@ -1112,123 +1615,281 @@ class MigrationRequestsApi {
|
|
1112
1615
|
constructor(extraProps) {
|
1113
1616
|
this.extraProps = extraProps;
|
1114
1617
|
}
|
1115
|
-
|
1116
|
-
|
1117
|
-
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
1122
|
-
|
1618
|
+
queryMigrationRequests({
|
1619
|
+
workspace,
|
1620
|
+
region,
|
1621
|
+
database,
|
1622
|
+
filter,
|
1623
|
+
sort,
|
1624
|
+
page,
|
1625
|
+
columns
|
1626
|
+
}) {
|
1627
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1628
|
+
pathParams: { workspace, region, dbName: database },
|
1629
|
+
body: { filter, sort, page, columns },
|
1630
|
+
...this.extraProps
|
1631
|
+
});
|
1632
|
+
}
|
1633
|
+
createMigrationRequest({
|
1634
|
+
workspace,
|
1635
|
+
region,
|
1636
|
+
database,
|
1637
|
+
migration
|
1638
|
+
}) {
|
1123
1639
|
return operationsByTag.migrationRequests.createMigrationRequest({
|
1124
|
-
pathParams: { workspace, dbName: database },
|
1125
|
-
body:
|
1640
|
+
pathParams: { workspace, region, dbName: database },
|
1641
|
+
body: migration,
|
1126
1642
|
...this.extraProps
|
1127
1643
|
});
|
1128
1644
|
}
|
1129
|
-
getMigrationRequest(
|
1645
|
+
getMigrationRequest({
|
1646
|
+
workspace,
|
1647
|
+
region,
|
1648
|
+
database,
|
1649
|
+
migrationRequest
|
1650
|
+
}) {
|
1130
1651
|
return operationsByTag.migrationRequests.getMigrationRequest({
|
1131
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1652
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1132
1653
|
...this.extraProps
|
1133
1654
|
});
|
1134
1655
|
}
|
1135
|
-
updateMigrationRequest(
|
1656
|
+
updateMigrationRequest({
|
1657
|
+
workspace,
|
1658
|
+
region,
|
1659
|
+
database,
|
1660
|
+
migrationRequest,
|
1661
|
+
update
|
1662
|
+
}) {
|
1136
1663
|
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1137
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1138
|
-
body:
|
1664
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1665
|
+
body: update,
|
1139
1666
|
...this.extraProps
|
1140
1667
|
});
|
1141
1668
|
}
|
1142
|
-
listMigrationRequestsCommits(
|
1669
|
+
listMigrationRequestsCommits({
|
1670
|
+
workspace,
|
1671
|
+
region,
|
1672
|
+
database,
|
1673
|
+
migrationRequest,
|
1674
|
+
page
|
1675
|
+
}) {
|
1143
1676
|
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1144
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1145
|
-
body:
|
1677
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1678
|
+
body: { page },
|
1146
1679
|
...this.extraProps
|
1147
1680
|
});
|
1148
1681
|
}
|
1149
|
-
compareMigrationRequest(
|
1682
|
+
compareMigrationRequest({
|
1683
|
+
workspace,
|
1684
|
+
region,
|
1685
|
+
database,
|
1686
|
+
migrationRequest
|
1687
|
+
}) {
|
1150
1688
|
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1151
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1689
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1152
1690
|
...this.extraProps
|
1153
1691
|
});
|
1154
1692
|
}
|
1155
|
-
getMigrationRequestIsMerged(
|
1693
|
+
getMigrationRequestIsMerged({
|
1694
|
+
workspace,
|
1695
|
+
region,
|
1696
|
+
database,
|
1697
|
+
migrationRequest
|
1698
|
+
}) {
|
1156
1699
|
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1157
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1700
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1158
1701
|
...this.extraProps
|
1159
1702
|
});
|
1160
1703
|
}
|
1161
|
-
mergeMigrationRequest(
|
1704
|
+
mergeMigrationRequest({
|
1705
|
+
workspace,
|
1706
|
+
region,
|
1707
|
+
database,
|
1708
|
+
migrationRequest
|
1709
|
+
}) {
|
1162
1710
|
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1163
|
-
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1711
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1164
1712
|
...this.extraProps
|
1165
1713
|
});
|
1166
1714
|
}
|
1167
1715
|
}
|
1168
|
-
class
|
1716
|
+
class MigrationsApi {
|
1169
1717
|
constructor(extraProps) {
|
1170
1718
|
this.extraProps = extraProps;
|
1171
1719
|
}
|
1172
|
-
getBranchMigrationHistory(
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1720
|
+
getBranchMigrationHistory({
|
1721
|
+
workspace,
|
1722
|
+
region,
|
1723
|
+
database,
|
1724
|
+
branch,
|
1725
|
+
limit,
|
1726
|
+
startFrom
|
1727
|
+
}) {
|
1728
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1729
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1730
|
+
body: { limit, startFrom },
|
1731
|
+
...this.extraProps
|
1732
|
+
});
|
1733
|
+
}
|
1734
|
+
getBranchMigrationPlan({
|
1735
|
+
workspace,
|
1736
|
+
region,
|
1737
|
+
database,
|
1738
|
+
branch,
|
1739
|
+
schema
|
1740
|
+
}) {
|
1741
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1742
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1743
|
+
body: schema,
|
1176
1744
|
...this.extraProps
|
1177
1745
|
});
|
1178
1746
|
}
|
1179
|
-
executeBranchMigrationPlan(
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1747
|
+
executeBranchMigrationPlan({
|
1748
|
+
workspace,
|
1749
|
+
region,
|
1750
|
+
database,
|
1751
|
+
branch,
|
1752
|
+
plan
|
1753
|
+
}) {
|
1754
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1755
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1756
|
+
body: plan,
|
1183
1757
|
...this.extraProps
|
1184
1758
|
});
|
1185
1759
|
}
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
|
1760
|
+
getBranchSchemaHistory({
|
1761
|
+
workspace,
|
1762
|
+
region,
|
1763
|
+
database,
|
1764
|
+
branch,
|
1765
|
+
page
|
1766
|
+
}) {
|
1767
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1768
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1769
|
+
body: { page },
|
1190
1770
|
...this.extraProps
|
1191
1771
|
});
|
1192
1772
|
}
|
1193
|
-
compareBranchWithUserSchema(
|
1194
|
-
|
1195
|
-
|
1773
|
+
compareBranchWithUserSchema({
|
1774
|
+
workspace,
|
1775
|
+
region,
|
1776
|
+
database,
|
1777
|
+
branch,
|
1778
|
+
schema
|
1779
|
+
}) {
|
1780
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1781
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1196
1782
|
body: { schema },
|
1197
1783
|
...this.extraProps
|
1198
1784
|
});
|
1199
1785
|
}
|
1200
|
-
compareBranchSchemas(
|
1201
|
-
|
1202
|
-
|
1786
|
+
compareBranchSchemas({
|
1787
|
+
workspace,
|
1788
|
+
region,
|
1789
|
+
database,
|
1790
|
+
branch,
|
1791
|
+
compare,
|
1792
|
+
schema
|
1793
|
+
}) {
|
1794
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1795
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1203
1796
|
body: { schema },
|
1204
1797
|
...this.extraProps
|
1205
1798
|
});
|
1206
1799
|
}
|
1207
|
-
updateBranchSchema(
|
1208
|
-
|
1209
|
-
|
1800
|
+
updateBranchSchema({
|
1801
|
+
workspace,
|
1802
|
+
region,
|
1803
|
+
database,
|
1804
|
+
branch,
|
1805
|
+
migration
|
1806
|
+
}) {
|
1807
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1808
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1210
1809
|
body: migration,
|
1211
1810
|
...this.extraProps
|
1212
1811
|
});
|
1213
1812
|
}
|
1214
|
-
previewBranchSchemaEdit(
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1813
|
+
previewBranchSchemaEdit({
|
1814
|
+
workspace,
|
1815
|
+
region,
|
1816
|
+
database,
|
1817
|
+
branch,
|
1818
|
+
data
|
1819
|
+
}) {
|
1820
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1821
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1822
|
+
body: data,
|
1218
1823
|
...this.extraProps
|
1219
1824
|
});
|
1220
1825
|
}
|
1221
|
-
applyBranchSchemaEdit(
|
1222
|
-
|
1223
|
-
|
1826
|
+
applyBranchSchemaEdit({
|
1827
|
+
workspace,
|
1828
|
+
region,
|
1829
|
+
database,
|
1830
|
+
branch,
|
1831
|
+
edits
|
1832
|
+
}) {
|
1833
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1834
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1224
1835
|
body: { edits },
|
1225
1836
|
...this.extraProps
|
1226
1837
|
});
|
1227
1838
|
}
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1839
|
+
}
|
1840
|
+
class DatabaseApi {
|
1841
|
+
constructor(extraProps) {
|
1842
|
+
this.extraProps = extraProps;
|
1843
|
+
}
|
1844
|
+
getDatabaseList({ workspace }) {
|
1845
|
+
return operationsByTag.databases.getDatabaseList({
|
1846
|
+
pathParams: { workspaceId: workspace },
|
1847
|
+
...this.extraProps
|
1848
|
+
});
|
1849
|
+
}
|
1850
|
+
createDatabase({
|
1851
|
+
workspace,
|
1852
|
+
database,
|
1853
|
+
data
|
1854
|
+
}) {
|
1855
|
+
return operationsByTag.databases.createDatabase({
|
1856
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1857
|
+
body: data,
|
1858
|
+
...this.extraProps
|
1859
|
+
});
|
1860
|
+
}
|
1861
|
+
deleteDatabase({
|
1862
|
+
workspace,
|
1863
|
+
database
|
1864
|
+
}) {
|
1865
|
+
return operationsByTag.databases.deleteDatabase({
|
1866
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1867
|
+
...this.extraProps
|
1868
|
+
});
|
1869
|
+
}
|
1870
|
+
getDatabaseMetadata({
|
1871
|
+
workspace,
|
1872
|
+
database
|
1873
|
+
}) {
|
1874
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1875
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1876
|
+
...this.extraProps
|
1877
|
+
});
|
1878
|
+
}
|
1879
|
+
updateDatabaseMetadata({
|
1880
|
+
workspace,
|
1881
|
+
database,
|
1882
|
+
metadata
|
1883
|
+
}) {
|
1884
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1885
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1886
|
+
body: metadata,
|
1887
|
+
...this.extraProps
|
1888
|
+
});
|
1889
|
+
}
|
1890
|
+
listRegions({ workspace }) {
|
1891
|
+
return operationsByTag.databases.listRegions({
|
1892
|
+
pathParams: { workspaceId: workspace },
|
1232
1893
|
...this.extraProps
|
1233
1894
|
});
|
1234
1895
|
}
|
@@ -1244,6 +1905,13 @@ class XataApiPlugin {
|
|
1244
1905
|
class XataPlugin {
|
1245
1906
|
}
|
1246
1907
|
|
1908
|
+
function cleanFilter(filter) {
|
1909
|
+
if (!filter)
|
1910
|
+
return void 0;
|
1911
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1912
|
+
return values.length > 0 ? filter : void 0;
|
1913
|
+
}
|
1914
|
+
|
1247
1915
|
var __accessCheck$6 = (obj, member, msg) => {
|
1248
1916
|
if (!member.has(obj))
|
1249
1917
|
throw TypeError("Cannot " + msg);
|
@@ -1276,11 +1944,11 @@ class Page {
|
|
1276
1944
|
async previousPage(size, offset) {
|
1277
1945
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1278
1946
|
}
|
1279
|
-
async
|
1280
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1947
|
+
async startPage(size, offset) {
|
1948
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
1281
1949
|
}
|
1282
|
-
async
|
1283
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1950
|
+
async endPage(size, offset) {
|
1951
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
1284
1952
|
}
|
1285
1953
|
hasNextPage() {
|
1286
1954
|
return this.meta.page.more;
|
@@ -1292,7 +1960,7 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1292
1960
|
const PAGINATION_MAX_OFFSET = 800;
|
1293
1961
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1294
1962
|
function isCursorPaginationOptions(options) {
|
1295
|
-
return isDefined(options) && (isDefined(options.
|
1963
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1296
1964
|
}
|
1297
1965
|
const _RecordArray = class extends Array {
|
1298
1966
|
constructor(...args) {
|
@@ -1324,12 +1992,12 @@ const _RecordArray = class extends Array {
|
|
1324
1992
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1325
1993
|
return new _RecordArray(newPage);
|
1326
1994
|
}
|
1327
|
-
async
|
1328
|
-
const newPage = await __privateGet$6(this, _page).
|
1995
|
+
async startPage(size, offset) {
|
1996
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1329
1997
|
return new _RecordArray(newPage);
|
1330
1998
|
}
|
1331
|
-
async
|
1332
|
-
const newPage = await __privateGet$6(this, _page).
|
1999
|
+
async endPage(size, offset) {
|
2000
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1333
2001
|
return new _RecordArray(newPage);
|
1334
2002
|
}
|
1335
2003
|
hasNextPage() {
|
@@ -1357,9 +2025,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1357
2025
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1358
2026
|
return value;
|
1359
2027
|
};
|
1360
|
-
var
|
2028
|
+
var __privateMethod$3 = (obj, member, method) => {
|
2029
|
+
__accessCheck$5(obj, member, "access private method");
|
2030
|
+
return method;
|
2031
|
+
};
|
2032
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1361
2033
|
const _Query = class {
|
1362
2034
|
constructor(repository, table, data, rawParent) {
|
2035
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1363
2036
|
__privateAdd$5(this, _table$1, void 0);
|
1364
2037
|
__privateAdd$5(this, _repository, void 0);
|
1365
2038
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1378,9 +2051,11 @@ const _Query = class {
|
|
1378
2051
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1379
2052
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1380
2053
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1381
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
2054
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
2055
|
+
__privateGet$5(this, _data).consistency = data.consistency ?? parent?.consistency;
|
1382
2056
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1383
2057
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
2058
|
+
__privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
1384
2059
|
this.any = this.any.bind(this);
|
1385
2060
|
this.all = this.all.bind(this);
|
1386
2061
|
this.not = this.not.bind(this);
|
@@ -1417,26 +2092,16 @@ const _Query = class {
|
|
1417
2092
|
filter(a, b) {
|
1418
2093
|
if (arguments.length === 1) {
|
1419
2094
|
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
1420
|
-
[column]: this.
|
2095
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
1421
2096
|
}));
|
1422
2097
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1423
2098
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1424
2099
|
} else {
|
1425
|
-
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.
|
2100
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
1426
2101
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1427
2102
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1428
2103
|
}
|
1429
2104
|
}
|
1430
|
-
cleanFilterConstraint(column, value) {
|
1431
|
-
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
1432
|
-
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
1433
|
-
return { $includes: value };
|
1434
|
-
}
|
1435
|
-
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
1436
|
-
return value.id;
|
1437
|
-
}
|
1438
|
-
return value;
|
1439
|
-
}
|
1440
2105
|
sort(column, direction = "asc") {
|
1441
2106
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1442
2107
|
const sort = [...originalSort, { column, direction }];
|
@@ -1504,19 +2169,29 @@ const _Query = class {
|
|
1504
2169
|
throw new Error("No results found.");
|
1505
2170
|
return records[0];
|
1506
2171
|
}
|
2172
|
+
async summarize(params = {}) {
|
2173
|
+
const { summaries, summariesFilter, ...options } = params;
|
2174
|
+
const query = new _Query(
|
2175
|
+
__privateGet$5(this, _repository),
|
2176
|
+
__privateGet$5(this, _table$1),
|
2177
|
+
options,
|
2178
|
+
__privateGet$5(this, _data)
|
2179
|
+
);
|
2180
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2181
|
+
}
|
1507
2182
|
cache(ttl) {
|
1508
2183
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1509
2184
|
}
|
1510
2185
|
nextPage(size, offset) {
|
1511
|
-
return this.
|
2186
|
+
return this.startPage(size, offset);
|
1512
2187
|
}
|
1513
2188
|
previousPage(size, offset) {
|
1514
|
-
return this.
|
2189
|
+
return this.startPage(size, offset);
|
1515
2190
|
}
|
1516
|
-
|
2191
|
+
startPage(size, offset) {
|
1517
2192
|
return this.getPaginated({ pagination: { size, offset } });
|
1518
2193
|
}
|
1519
|
-
|
2194
|
+
endPage(size, offset) {
|
1520
2195
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1521
2196
|
}
|
1522
2197
|
hasNextPage() {
|
@@ -1527,9 +2202,20 @@ let Query = _Query;
|
|
1527
2202
|
_table$1 = new WeakMap();
|
1528
2203
|
_repository = new WeakMap();
|
1529
2204
|
_data = new WeakMap();
|
2205
|
+
_cleanFilterConstraint = new WeakSet();
|
2206
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2207
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2208
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2209
|
+
return { $includes: value };
|
2210
|
+
}
|
2211
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2212
|
+
return value.id;
|
2213
|
+
}
|
2214
|
+
return value;
|
2215
|
+
};
|
1530
2216
|
function cleanParent(data, parent) {
|
1531
2217
|
if (isCursorPaginationOptions(data.pagination)) {
|
1532
|
-
return { ...parent,
|
2218
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1533
2219
|
}
|
1534
2220
|
return parent;
|
1535
2221
|
}
|
@@ -1588,7 +2274,8 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1588
2274
|
__accessCheck$4(obj, member, "access private method");
|
1589
2275
|
return method;
|
1590
2276
|
};
|
1591
|
-
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn,
|
2277
|
+
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
|
2278
|
+
const BULK_OPERATION_MAX_SIZE = 1e3;
|
1592
2279
|
class Repository extends Query {
|
1593
2280
|
}
|
1594
2281
|
class RestRepository extends Query {
|
@@ -1600,10 +2287,12 @@ class RestRepository extends Query {
|
|
1600
2287
|
);
|
1601
2288
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1602
2289
|
__privateAdd$4(this, _insertRecordWithId);
|
1603
|
-
__privateAdd$4(this,
|
2290
|
+
__privateAdd$4(this, _insertRecords);
|
1604
2291
|
__privateAdd$4(this, _updateRecordWithID);
|
2292
|
+
__privateAdd$4(this, _updateRecords);
|
1605
2293
|
__privateAdd$4(this, _upsertRecordWithID);
|
1606
2294
|
__privateAdd$4(this, _deleteRecord);
|
2295
|
+
__privateAdd$4(this, _deleteRecords);
|
1607
2296
|
__privateAdd$4(this, _setCacheQuery);
|
1608
2297
|
__privateAdd$4(this, _getCacheQuery);
|
1609
2298
|
__privateAdd$4(this, _getSchemaTables$1);
|
@@ -1614,10 +2303,13 @@ class RestRepository extends Query {
|
|
1614
2303
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1615
2304
|
__privateAdd$4(this, _trace, void 0);
|
1616
2305
|
__privateSet$4(this, _table, options.table);
|
1617
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1618
2306
|
__privateSet$4(this, _db, options.db);
|
1619
2307
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1620
2308
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2309
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2310
|
+
const props = await options.pluginOptions.getFetchProps();
|
2311
|
+
return { ...props, sessionID: generateUUID() };
|
2312
|
+
});
|
1621
2313
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1622
2314
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1623
2315
|
return trace(name, fn, {
|
@@ -1628,25 +2320,28 @@ class RestRepository extends Query {
|
|
1628
2320
|
});
|
1629
2321
|
});
|
1630
2322
|
}
|
1631
|
-
async create(a, b, c) {
|
2323
|
+
async create(a, b, c, d) {
|
1632
2324
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2325
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1633
2326
|
if (Array.isArray(a)) {
|
1634
2327
|
if (a.length === 0)
|
1635
2328
|
return [];
|
1636
|
-
const
|
1637
|
-
|
2329
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
2330
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2331
|
+
const result = await this.read(ids, columns);
|
2332
|
+
return result;
|
1638
2333
|
}
|
1639
2334
|
if (isString(a) && isObject(b)) {
|
1640
2335
|
if (a === "")
|
1641
2336
|
throw new Error("The id can't be empty");
|
1642
2337
|
const columns = isStringArray(c) ? c : void 0;
|
1643
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
2338
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1644
2339
|
}
|
1645
2340
|
if (isObject(a) && isString(a.id)) {
|
1646
2341
|
if (a.id === "")
|
1647
2342
|
throw new Error("The id can't be empty");
|
1648
2343
|
const columns = isStringArray(b) ? b : void 0;
|
1649
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2344
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1650
2345
|
}
|
1651
2346
|
if (isObject(a)) {
|
1652
2347
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1677,6 +2372,7 @@ class RestRepository extends Query {
|
|
1677
2372
|
pathParams: {
|
1678
2373
|
workspace: "{workspaceId}",
|
1679
2374
|
dbBranchName: "{dbBranch}",
|
2375
|
+
region: "{region}",
|
1680
2376
|
tableName: __privateGet$4(this, _table),
|
1681
2377
|
recordId: id
|
1682
2378
|
},
|
@@ -1684,7 +2380,7 @@ class RestRepository extends Query {
|
|
1684
2380
|
...fetchProps
|
1685
2381
|
});
|
1686
2382
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1687
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2383
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1688
2384
|
} catch (e) {
|
1689
2385
|
if (isObject(e) && e.status === 404) {
|
1690
2386
|
return null;
|
@@ -1714,31 +2410,42 @@ class RestRepository extends Query {
|
|
1714
2410
|
return result;
|
1715
2411
|
});
|
1716
2412
|
}
|
1717
|
-
async update(a, b, c) {
|
2413
|
+
async update(a, b, c, d) {
|
1718
2414
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2415
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1719
2416
|
if (Array.isArray(a)) {
|
1720
2417
|
if (a.length === 0)
|
1721
2418
|
return [];
|
1722
|
-
|
1723
|
-
|
1724
|
-
|
2419
|
+
const existing = await this.read(a, ["id"]);
|
2420
|
+
const updates = a.filter((_item, index) => existing[index] !== null);
|
2421
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, updates, {
|
2422
|
+
ifVersion,
|
2423
|
+
upsert: false
|
2424
|
+
});
|
1725
2425
|
const columns = isStringArray(b) ? b : ["*"];
|
1726
|
-
|
1727
|
-
|
1728
|
-
if (isString(a) && isObject(b)) {
|
1729
|
-
const columns = isStringArray(c) ? c : void 0;
|
1730
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
2426
|
+
const result = await this.read(a, columns);
|
2427
|
+
return result;
|
1731
2428
|
}
|
1732
|
-
|
1733
|
-
|
1734
|
-
|
2429
|
+
try {
|
2430
|
+
if (isString(a) && isObject(b)) {
|
2431
|
+
const columns = isStringArray(c) ? c : void 0;
|
2432
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
2433
|
+
}
|
2434
|
+
if (isObject(a) && isString(a.id)) {
|
2435
|
+
const columns = isStringArray(b) ? b : void 0;
|
2436
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
2437
|
+
}
|
2438
|
+
} catch (error) {
|
2439
|
+
if (error.status === 422)
|
2440
|
+
return null;
|
2441
|
+
throw error;
|
1735
2442
|
}
|
1736
2443
|
throw new Error("Invalid arguments for update method");
|
1737
2444
|
});
|
1738
2445
|
}
|
1739
|
-
async updateOrThrow(a, b, c) {
|
2446
|
+
async updateOrThrow(a, b, c, d) {
|
1740
2447
|
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
1741
|
-
const result = await this.update(a, b, c);
|
2448
|
+
const result = await this.update(a, b, c, d);
|
1742
2449
|
if (Array.isArray(result)) {
|
1743
2450
|
const missingIds = compact(
|
1744
2451
|
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
@@ -1755,37 +2462,69 @@ class RestRepository extends Query {
|
|
1755
2462
|
return result;
|
1756
2463
|
});
|
1757
2464
|
}
|
1758
|
-
async createOrUpdate(a, b, c) {
|
2465
|
+
async createOrUpdate(a, b, c, d) {
|
1759
2466
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2467
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1760
2468
|
if (Array.isArray(a)) {
|
1761
2469
|
if (a.length === 0)
|
1762
2470
|
return [];
|
1763
|
-
|
1764
|
-
|
1765
|
-
|
2471
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
2472
|
+
ifVersion,
|
2473
|
+
upsert: true
|
2474
|
+
});
|
1766
2475
|
const columns = isStringArray(b) ? b : ["*"];
|
1767
|
-
|
2476
|
+
const result = await this.read(a, columns);
|
2477
|
+
return result;
|
1768
2478
|
}
|
1769
2479
|
if (isString(a) && isObject(b)) {
|
1770
2480
|
const columns = isStringArray(c) ? c : void 0;
|
1771
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
2481
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1772
2482
|
}
|
1773
2483
|
if (isObject(a) && isString(a.id)) {
|
1774
2484
|
const columns = isStringArray(c) ? c : void 0;
|
1775
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2485
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1776
2486
|
}
|
1777
2487
|
throw new Error("Invalid arguments for createOrUpdate method");
|
1778
2488
|
});
|
1779
2489
|
}
|
2490
|
+
async createOrReplace(a, b, c, d) {
|
2491
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2492
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2493
|
+
if (Array.isArray(a)) {
|
2494
|
+
if (a.length === 0)
|
2495
|
+
return [];
|
2496
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
2497
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2498
|
+
const result = await this.read(ids, columns);
|
2499
|
+
return result;
|
2500
|
+
}
|
2501
|
+
if (isString(a) && isObject(b)) {
|
2502
|
+
const columns = isStringArray(c) ? c : void 0;
|
2503
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2504
|
+
}
|
2505
|
+
if (isObject(a) && isString(a.id)) {
|
2506
|
+
const columns = isStringArray(c) ? c : void 0;
|
2507
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2508
|
+
}
|
2509
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2510
|
+
});
|
2511
|
+
}
|
1780
2512
|
async delete(a, b) {
|
1781
2513
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
1782
2514
|
if (Array.isArray(a)) {
|
1783
2515
|
if (a.length === 0)
|
1784
2516
|
return [];
|
1785
|
-
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
2517
|
+
const ids = a.map((o) => {
|
2518
|
+
if (isString(o))
|
2519
|
+
return o;
|
2520
|
+
if (isString(o.id))
|
2521
|
+
return o.id;
|
2522
|
+
throw new Error("Invalid arguments for delete method");
|
2523
|
+
});
|
2524
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2525
|
+
const result = await this.read(a, columns);
|
2526
|
+
await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
|
2527
|
+
return result;
|
1789
2528
|
}
|
1790
2529
|
if (isString(a)) {
|
1791
2530
|
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
@@ -1818,19 +2557,42 @@ class RestRepository extends Query {
|
|
1818
2557
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1819
2558
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1820
2559
|
const { records } = await searchTable({
|
1821
|
-
pathParams: {
|
2560
|
+
pathParams: {
|
2561
|
+
workspace: "{workspaceId}",
|
2562
|
+
dbBranchName: "{dbBranch}",
|
2563
|
+
region: "{region}",
|
2564
|
+
tableName: __privateGet$4(this, _table)
|
2565
|
+
},
|
1822
2566
|
body: {
|
1823
2567
|
query,
|
1824
2568
|
fuzziness: options.fuzziness,
|
1825
2569
|
prefix: options.prefix,
|
1826
2570
|
highlight: options.highlight,
|
1827
2571
|
filter: options.filter,
|
1828
|
-
boosters: options.boosters
|
2572
|
+
boosters: options.boosters,
|
2573
|
+
page: options.page,
|
2574
|
+
target: options.target
|
1829
2575
|
},
|
1830
2576
|
...fetchProps
|
1831
2577
|
});
|
1832
2578
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1833
|
-
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2579
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2580
|
+
});
|
2581
|
+
}
|
2582
|
+
async aggregate(aggs, filter) {
|
2583
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2584
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2585
|
+
const result = await aggregateTable({
|
2586
|
+
pathParams: {
|
2587
|
+
workspace: "{workspaceId}",
|
2588
|
+
dbBranchName: "{dbBranch}",
|
2589
|
+
region: "{region}",
|
2590
|
+
tableName: __privateGet$4(this, _table)
|
2591
|
+
},
|
2592
|
+
body: { aggs, filter },
|
2593
|
+
...fetchProps
|
2594
|
+
});
|
2595
|
+
return result;
|
1834
2596
|
});
|
1835
2597
|
}
|
1836
2598
|
async query(query) {
|
@@ -1839,24 +2601,57 @@ class RestRepository extends Query {
|
|
1839
2601
|
if (cacheQuery)
|
1840
2602
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1841
2603
|
const data = query.getQueryOptions();
|
1842
|
-
const body = {
|
1843
|
-
filter: cleanFilter(data.filter),
|
1844
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1845
|
-
page: data.pagination,
|
1846
|
-
columns: data.columns
|
1847
|
-
};
|
1848
2604
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1849
2605
|
const { meta, records: objects } = await queryTable({
|
1850
|
-
pathParams: {
|
1851
|
-
|
2606
|
+
pathParams: {
|
2607
|
+
workspace: "{workspaceId}",
|
2608
|
+
dbBranchName: "{dbBranch}",
|
2609
|
+
region: "{region}",
|
2610
|
+
tableName: __privateGet$4(this, _table)
|
2611
|
+
},
|
2612
|
+
body: {
|
2613
|
+
filter: cleanFilter(data.filter),
|
2614
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2615
|
+
page: data.pagination,
|
2616
|
+
columns: data.columns ?? ["*"],
|
2617
|
+
consistency: data.consistency
|
2618
|
+
},
|
2619
|
+
fetchOptions: data.fetchOptions,
|
1852
2620
|
...fetchProps
|
1853
2621
|
});
|
1854
2622
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1855
|
-
const records = objects.map(
|
2623
|
+
const records = objects.map(
|
2624
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2625
|
+
);
|
1856
2626
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1857
2627
|
return new Page(query, meta, records);
|
1858
2628
|
});
|
1859
2629
|
}
|
2630
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2631
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2632
|
+
const data = query.getQueryOptions();
|
2633
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2634
|
+
const result = await summarizeTable({
|
2635
|
+
pathParams: {
|
2636
|
+
workspace: "{workspaceId}",
|
2637
|
+
dbBranchName: "{dbBranch}",
|
2638
|
+
region: "{region}",
|
2639
|
+
tableName: __privateGet$4(this, _table)
|
2640
|
+
},
|
2641
|
+
body: {
|
2642
|
+
filter: cleanFilter(data.filter),
|
2643
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2644
|
+
columns: data.columns,
|
2645
|
+
consistency: data.consistency,
|
2646
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2647
|
+
summaries,
|
2648
|
+
summariesFilter
|
2649
|
+
},
|
2650
|
+
...fetchProps
|
2651
|
+
});
|
2652
|
+
return result;
|
2653
|
+
});
|
2654
|
+
}
|
1860
2655
|
}
|
1861
2656
|
_table = new WeakMap();
|
1862
2657
|
_getFetchProps = new WeakMap();
|
@@ -1872,6 +2667,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1872
2667
|
pathParams: {
|
1873
2668
|
workspace: "{workspaceId}",
|
1874
2669
|
dbBranchName: "{dbBranch}",
|
2670
|
+
region: "{region}",
|
1875
2671
|
tableName: __privateGet$4(this, _table)
|
1876
2672
|
},
|
1877
2673
|
queryParams: { columns },
|
@@ -1879,55 +2675,76 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1879
2675
|
...fetchProps
|
1880
2676
|
});
|
1881
2677
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1882
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2678
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1883
2679
|
};
|
1884
2680
|
_insertRecordWithId = new WeakSet();
|
1885
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2681
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1886
2682
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1887
2683
|
const record = transformObjectLinks(object);
|
1888
2684
|
const response = await insertRecordWithID({
|
1889
2685
|
pathParams: {
|
1890
2686
|
workspace: "{workspaceId}",
|
1891
2687
|
dbBranchName: "{dbBranch}",
|
2688
|
+
region: "{region}",
|
1892
2689
|
tableName: __privateGet$4(this, _table),
|
1893
2690
|
recordId
|
1894
2691
|
},
|
1895
2692
|
body: record,
|
1896
|
-
queryParams: { createOnly
|
2693
|
+
queryParams: { createOnly, columns, ifVersion },
|
1897
2694
|
...fetchProps
|
1898
2695
|
});
|
1899
2696
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1900
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2697
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1901
2698
|
};
|
1902
|
-
|
1903
|
-
|
2699
|
+
_insertRecords = new WeakSet();
|
2700
|
+
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
1904
2701
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1905
|
-
const
|
1906
|
-
|
1907
|
-
|
1908
|
-
|
1909
|
-
|
1910
|
-
|
1911
|
-
|
1912
|
-
|
1913
|
-
|
2702
|
+
const chunkedOperations = chunk(
|
2703
|
+
objects.map((object) => ({
|
2704
|
+
insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
|
2705
|
+
})),
|
2706
|
+
BULK_OPERATION_MAX_SIZE
|
2707
|
+
);
|
2708
|
+
const ids = [];
|
2709
|
+
for (const operations of chunkedOperations) {
|
2710
|
+
const { results } = await branchTransaction({
|
2711
|
+
pathParams: {
|
2712
|
+
workspace: "{workspaceId}",
|
2713
|
+
dbBranchName: "{dbBranch}",
|
2714
|
+
region: "{region}"
|
2715
|
+
},
|
2716
|
+
body: { operations },
|
2717
|
+
...fetchProps
|
2718
|
+
});
|
2719
|
+
for (const result of results) {
|
2720
|
+
if (result.operation === "insert") {
|
2721
|
+
ids.push(result.id);
|
2722
|
+
} else {
|
2723
|
+
ids.push(null);
|
2724
|
+
}
|
2725
|
+
}
|
1914
2726
|
}
|
1915
|
-
|
1916
|
-
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2727
|
+
return ids;
|
1917
2728
|
};
|
1918
2729
|
_updateRecordWithID = new WeakSet();
|
1919
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2730
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1920
2731
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1921
|
-
const record = transformObjectLinks(object);
|
2732
|
+
const { id: _id, ...record } = transformObjectLinks(object);
|
1922
2733
|
try {
|
1923
2734
|
const response = await updateRecordWithID({
|
1924
|
-
pathParams: {
|
1925
|
-
|
2735
|
+
pathParams: {
|
2736
|
+
workspace: "{workspaceId}",
|
2737
|
+
dbBranchName: "{dbBranch}",
|
2738
|
+
region: "{region}",
|
2739
|
+
tableName: __privateGet$4(this, _table),
|
2740
|
+
recordId
|
2741
|
+
},
|
2742
|
+
queryParams: { columns, ifVersion },
|
1926
2743
|
body: record,
|
1927
2744
|
...fetchProps
|
1928
2745
|
});
|
1929
2746
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1930
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2747
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1931
2748
|
} catch (e) {
|
1932
2749
|
if (isObject(e) && e.status === 404) {
|
1933
2750
|
return null;
|
@@ -1935,29 +2752,71 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1935
2752
|
throw e;
|
1936
2753
|
}
|
1937
2754
|
};
|
2755
|
+
_updateRecords = new WeakSet();
|
2756
|
+
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
2757
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2758
|
+
const chunkedOperations = chunk(
|
2759
|
+
objects.map(({ id, ...object }) => ({
|
2760
|
+
update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
|
2761
|
+
})),
|
2762
|
+
BULK_OPERATION_MAX_SIZE
|
2763
|
+
);
|
2764
|
+
const ids = [];
|
2765
|
+
for (const operations of chunkedOperations) {
|
2766
|
+
const { results } = await branchTransaction({
|
2767
|
+
pathParams: {
|
2768
|
+
workspace: "{workspaceId}",
|
2769
|
+
dbBranchName: "{dbBranch}",
|
2770
|
+
region: "{region}"
|
2771
|
+
},
|
2772
|
+
body: { operations },
|
2773
|
+
...fetchProps
|
2774
|
+
});
|
2775
|
+
for (const result of results) {
|
2776
|
+
if (result.operation === "update") {
|
2777
|
+
ids.push(result.id);
|
2778
|
+
} else {
|
2779
|
+
ids.push(null);
|
2780
|
+
}
|
2781
|
+
}
|
2782
|
+
}
|
2783
|
+
return ids;
|
2784
|
+
};
|
1938
2785
|
_upsertRecordWithID = new WeakSet();
|
1939
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2786
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1940
2787
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1941
2788
|
const response = await upsertRecordWithID({
|
1942
|
-
pathParams: {
|
1943
|
-
|
2789
|
+
pathParams: {
|
2790
|
+
workspace: "{workspaceId}",
|
2791
|
+
dbBranchName: "{dbBranch}",
|
2792
|
+
region: "{region}",
|
2793
|
+
tableName: __privateGet$4(this, _table),
|
2794
|
+
recordId
|
2795
|
+
},
|
2796
|
+
queryParams: { columns, ifVersion },
|
1944
2797
|
body: object,
|
1945
2798
|
...fetchProps
|
1946
2799
|
});
|
1947
2800
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1948
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2801
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1949
2802
|
};
|
1950
2803
|
_deleteRecord = new WeakSet();
|
1951
2804
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1952
2805
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1953
2806
|
try {
|
1954
2807
|
const response = await deleteRecord({
|
1955
|
-
pathParams: {
|
2808
|
+
pathParams: {
|
2809
|
+
workspace: "{workspaceId}",
|
2810
|
+
dbBranchName: "{dbBranch}",
|
2811
|
+
region: "{region}",
|
2812
|
+
tableName: __privateGet$4(this, _table),
|
2813
|
+
recordId
|
2814
|
+
},
|
1956
2815
|
queryParams: { columns },
|
1957
2816
|
...fetchProps
|
1958
2817
|
});
|
1959
2818
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1960
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
2819
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1961
2820
|
} catch (e) {
|
1962
2821
|
if (isObject(e) && e.status === 404) {
|
1963
2822
|
return null;
|
@@ -1965,6 +2824,25 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
1965
2824
|
throw e;
|
1966
2825
|
}
|
1967
2826
|
};
|
2827
|
+
_deleteRecords = new WeakSet();
|
2828
|
+
deleteRecords_fn = async function(recordIds) {
|
2829
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2830
|
+
const chunkedOperations = chunk(
|
2831
|
+
recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
2832
|
+
BULK_OPERATION_MAX_SIZE
|
2833
|
+
);
|
2834
|
+
for (const operations of chunkedOperations) {
|
2835
|
+
await branchTransaction({
|
2836
|
+
pathParams: {
|
2837
|
+
workspace: "{workspaceId}",
|
2838
|
+
dbBranchName: "{dbBranch}",
|
2839
|
+
region: "{region}"
|
2840
|
+
},
|
2841
|
+
body: { operations },
|
2842
|
+
...fetchProps
|
2843
|
+
});
|
2844
|
+
}
|
2845
|
+
};
|
1968
2846
|
_setCacheQuery = new WeakSet();
|
1969
2847
|
setCacheQuery_fn = async function(query, meta, records) {
|
1970
2848
|
await __privateGet$4(this, _cache).set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
|
@@ -1987,7 +2865,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1987
2865
|
return __privateGet$4(this, _schemaTables$2);
|
1988
2866
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1989
2867
|
const { schema } = await getBranchDetails({
|
1990
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2868
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1991
2869
|
...fetchProps
|
1992
2870
|
});
|
1993
2871
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -2000,7 +2878,7 @@ const transformObjectLinks = (object) => {
|
|
2000
2878
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
2001
2879
|
}, {});
|
2002
2880
|
};
|
2003
|
-
const initObject = (db, schemaTables, table, object) => {
|
2881
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
2004
2882
|
const result = {};
|
2005
2883
|
const { xata, ...rest } = object ?? {};
|
2006
2884
|
Object.assign(result, rest);
|
@@ -2008,13 +2886,15 @@ const initObject = (db, schemaTables, table, object) => {
|
|
2008
2886
|
if (!columns)
|
2009
2887
|
console.error(`Table ${table} not found in schema`);
|
2010
2888
|
for (const column of columns ?? []) {
|
2889
|
+
if (!isValidColumn(selectedColumns, column))
|
2890
|
+
continue;
|
2011
2891
|
const value = result[column.name];
|
2012
2892
|
switch (column.type) {
|
2013
2893
|
case "datetime": {
|
2014
|
-
const date = value !== void 0 ? new Date(value) :
|
2015
|
-
if (date && isNaN(date.getTime())) {
|
2894
|
+
const date = value !== void 0 ? new Date(value) : null;
|
2895
|
+
if (date !== null && isNaN(date.getTime())) {
|
2016
2896
|
console.error(`Failed to parse date ${value} for field ${column.name}`);
|
2017
|
-
} else
|
2897
|
+
} else {
|
2018
2898
|
result[column.name] = date;
|
2019
2899
|
}
|
2020
2900
|
break;
|
@@ -2024,7 +2904,17 @@ const initObject = (db, schemaTables, table, object) => {
|
|
2024
2904
|
if (!linkTable) {
|
2025
2905
|
console.error(`Failed to parse link for field ${column.name}`);
|
2026
2906
|
} else if (isObject(value)) {
|
2027
|
-
|
2907
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2908
|
+
if (item === column.name) {
|
2909
|
+
return [...acc, "*"];
|
2910
|
+
}
|
2911
|
+
if (item.startsWith(`${column.name}.`)) {
|
2912
|
+
const [, ...path] = item.split(".");
|
2913
|
+
return [...acc, path.join(".")];
|
2914
|
+
}
|
2915
|
+
return acc;
|
2916
|
+
}, []);
|
2917
|
+
result[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2028
2918
|
} else {
|
2029
2919
|
result[column.name] = null;
|
2030
2920
|
}
|
@@ -2041,8 +2931,15 @@ const initObject = (db, schemaTables, table, object) => {
|
|
2041
2931
|
result.read = function(columns2) {
|
2042
2932
|
return db[table].read(result["id"], columns2);
|
2043
2933
|
};
|
2044
|
-
result.update = function(data,
|
2045
|
-
|
2934
|
+
result.update = function(data, b, c) {
|
2935
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2936
|
+
const ifVersion = parseIfVersion(b, c);
|
2937
|
+
return db[table].update(result["id"], data, columns2, { ifVersion });
|
2938
|
+
};
|
2939
|
+
result.replace = function(data, b, c) {
|
2940
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2941
|
+
const ifVersion = parseIfVersion(b, c);
|
2942
|
+
return db[table].createOrReplace(result["id"], data, columns2, { ifVersion });
|
2046
2943
|
};
|
2047
2944
|
result.delete = function() {
|
2048
2945
|
return db[table].delete(result["id"]);
|
@@ -2050,15 +2947,12 @@ const initObject = (db, schemaTables, table, object) => {
|
|
2050
2947
|
result.getMetadata = function() {
|
2051
2948
|
return xata;
|
2052
2949
|
};
|
2053
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2950
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
2054
2951
|
Object.defineProperty(result, prop, { enumerable: false });
|
2055
2952
|
}
|
2056
2953
|
Object.freeze(result);
|
2057
2954
|
return result;
|
2058
2955
|
};
|
2059
|
-
function isResponseWithRecords(value) {
|
2060
|
-
return isObject(value) && Array.isArray(value.records);
|
2061
|
-
}
|
2062
2956
|
function extractId(value) {
|
2063
2957
|
if (isString(value))
|
2064
2958
|
return value;
|
@@ -2066,11 +2960,22 @@ function extractId(value) {
|
|
2066
2960
|
return value.id;
|
2067
2961
|
return void 0;
|
2068
2962
|
}
|
2069
|
-
function
|
2070
|
-
if (
|
2071
|
-
return
|
2072
|
-
|
2073
|
-
|
2963
|
+
function isValidColumn(columns, column) {
|
2964
|
+
if (columns.includes("*"))
|
2965
|
+
return true;
|
2966
|
+
if (column.type === "link") {
|
2967
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2968
|
+
return linkColumns.length > 0;
|
2969
|
+
}
|
2970
|
+
return columns.includes(column.name);
|
2971
|
+
}
|
2972
|
+
function parseIfVersion(...args) {
|
2973
|
+
for (const arg of args) {
|
2974
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2975
|
+
return arg.ifVersion;
|
2976
|
+
}
|
2977
|
+
}
|
2978
|
+
return void 0;
|
2074
2979
|
}
|
2075
2980
|
|
2076
2981
|
var __accessCheck$3 = (obj, member, msg) => {
|
@@ -2237,7 +3142,7 @@ class SearchPlugin extends XataPlugin {
|
|
2237
3142
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
2238
3143
|
return records.map((record) => {
|
2239
3144
|
const { table = "orphan" } = record.xata;
|
2240
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
3145
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
2241
3146
|
});
|
2242
3147
|
},
|
2243
3148
|
byTable: async (query, options = {}) => {
|
@@ -2246,7 +3151,7 @@ class SearchPlugin extends XataPlugin {
|
|
2246
3151
|
return records.reduce((acc, record) => {
|
2247
3152
|
const { table = "orphan" } = record.xata;
|
2248
3153
|
const items = acc[table] ?? [];
|
2249
|
-
const item = initObject(this.db, schemaTables, table, record);
|
3154
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
2250
3155
|
return { ...acc, [table]: [...items, item] };
|
2251
3156
|
}, {});
|
2252
3157
|
}
|
@@ -2257,10 +3162,10 @@ _schemaTables = new WeakMap();
|
|
2257
3162
|
_search = new WeakSet();
|
2258
3163
|
search_fn = async function(query, options, getFetchProps) {
|
2259
3164
|
const fetchProps = await getFetchProps();
|
2260
|
-
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
3165
|
+
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
2261
3166
|
const { records } = await searchBranch({
|
2262
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2263
|
-
body: { tables, query, fuzziness, prefix, highlight },
|
3167
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3168
|
+
body: { tables, query, fuzziness, prefix, highlight, page },
|
2264
3169
|
...fetchProps
|
2265
3170
|
});
|
2266
3171
|
return records;
|
@@ -2271,25 +3176,37 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
2271
3176
|
return __privateGet$1(this, _schemaTables);
|
2272
3177
|
const fetchProps = await getFetchProps();
|
2273
3178
|
const { schema } = await getBranchDetails({
|
2274
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
3179
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2275
3180
|
...fetchProps
|
2276
3181
|
});
|
2277
3182
|
__privateSet$1(this, _schemaTables, schema.tables);
|
2278
3183
|
return schema.tables;
|
2279
3184
|
};
|
2280
3185
|
|
3186
|
+
class TransactionPlugin extends XataPlugin {
|
3187
|
+
build({ getFetchProps }) {
|
3188
|
+
return {
|
3189
|
+
run: async (operations) => {
|
3190
|
+
const fetchProps = await getFetchProps();
|
3191
|
+
const response = await branchTransaction({
|
3192
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3193
|
+
body: { operations },
|
3194
|
+
...fetchProps
|
3195
|
+
});
|
3196
|
+
return response;
|
3197
|
+
}
|
3198
|
+
};
|
3199
|
+
}
|
3200
|
+
}
|
3201
|
+
|
2281
3202
|
const isBranchStrategyBuilder = (strategy) => {
|
2282
3203
|
return typeof strategy === "function";
|
2283
3204
|
};
|
2284
3205
|
|
2285
3206
|
async function getCurrentBranchName(options) {
|
2286
3207
|
const { branch, envBranch } = getEnvironment();
|
2287
|
-
if (branch)
|
2288
|
-
|
2289
|
-
if (details)
|
2290
|
-
return branch;
|
2291
|
-
console.warn(`Branch ${branch} not found in Xata. Ignoring...`);
|
2292
|
-
}
|
3208
|
+
if (branch)
|
3209
|
+
return branch;
|
2293
3210
|
const gitBranch = envBranch || await getGitBranch();
|
2294
3211
|
return resolveXataBranch(gitBranch, options);
|
2295
3212
|
}
|
@@ -2309,16 +3226,20 @@ async function resolveXataBranch(gitBranch, options) {
|
|
2309
3226
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2310
3227
|
);
|
2311
3228
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2312
|
-
const
|
3229
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3230
|
+
if (!urlParts)
|
3231
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3232
|
+
const { workspace, region } = urlParts;
|
2313
3233
|
const { fallbackBranch } = getEnvironment();
|
2314
3234
|
const { branch } = await resolveBranch({
|
2315
3235
|
apiKey,
|
2316
3236
|
apiUrl: databaseURL,
|
2317
3237
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2318
3238
|
workspacesApiUrl: `${protocol}//${host}`,
|
2319
|
-
pathParams: { dbName, workspace },
|
3239
|
+
pathParams: { dbName, workspace, region },
|
2320
3240
|
queryParams: { gitBranch, fallbackBranch },
|
2321
|
-
trace: defaultTrace
|
3241
|
+
trace: defaultTrace,
|
3242
|
+
clientName: options?.clientName
|
2322
3243
|
});
|
2323
3244
|
return branch;
|
2324
3245
|
}
|
@@ -2334,15 +3255,17 @@ async function getDatabaseBranch(branch, options) {
|
|
2334
3255
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2335
3256
|
);
|
2336
3257
|
const [protocol, , host, , database] = databaseURL.split("/");
|
2337
|
-
const
|
2338
|
-
|
3258
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3259
|
+
if (!urlParts)
|
3260
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3261
|
+
const { workspace, region } = urlParts;
|
2339
3262
|
try {
|
2340
3263
|
return await getBranchDetails({
|
2341
3264
|
apiKey,
|
2342
3265
|
apiUrl: databaseURL,
|
2343
3266
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2344
3267
|
workspacesApiUrl: `${protocol}//${host}`,
|
2345
|
-
pathParams: { dbBranchName
|
3268
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
2346
3269
|
trace: defaultTrace
|
2347
3270
|
});
|
2348
3271
|
} catch (err) {
|
@@ -2400,8 +3323,10 @@ const buildClient = (plugins) => {
|
|
2400
3323
|
};
|
2401
3324
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
2402
3325
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
3326
|
+
const transactions = new TransactionPlugin().build(pluginOptions);
|
2403
3327
|
this.db = db;
|
2404
3328
|
this.search = search;
|
3329
|
+
this.transactions = transactions;
|
2405
3330
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
2406
3331
|
if (namespace === void 0)
|
2407
3332
|
continue;
|
@@ -2421,20 +3346,41 @@ const buildClient = (plugins) => {
|
|
2421
3346
|
return { databaseURL, branch };
|
2422
3347
|
}
|
2423
3348
|
}, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
3349
|
+
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
3350
|
+
const isBrowser = typeof window !== "undefined";
|
3351
|
+
if (isBrowser && !enableBrowser) {
|
3352
|
+
throw new Error(
|
3353
|
+
"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."
|
3354
|
+
);
|
3355
|
+
}
|
2424
3356
|
const fetch = getFetchImplementation(options?.fetch);
|
2425
3357
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2426
3358
|
const apiKey = options?.apiKey || getAPIKey();
|
2427
3359
|
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
2428
3360
|
const trace = options?.trace ?? defaultTrace;
|
2429
|
-
const
|
3361
|
+
const clientName = options?.clientName;
|
3362
|
+
const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({
|
3363
|
+
apiKey,
|
3364
|
+
databaseURL,
|
3365
|
+
fetchImpl: options?.fetch,
|
3366
|
+
clientName: options?.clientName
|
3367
|
+
});
|
2430
3368
|
if (!apiKey) {
|
2431
3369
|
throw new Error("Option apiKey is required");
|
2432
3370
|
}
|
2433
3371
|
if (!databaseURL) {
|
2434
3372
|
throw new Error("Option databaseURL is required");
|
2435
3373
|
}
|
2436
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2437
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
3374
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID(), enableBrowser, clientName };
|
3375
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
3376
|
+
fetch,
|
3377
|
+
apiKey,
|
3378
|
+
databaseURL,
|
3379
|
+
branch,
|
3380
|
+
trace,
|
3381
|
+
clientID,
|
3382
|
+
clientName
|
3383
|
+
}) {
|
2438
3384
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2439
3385
|
if (!branchValue)
|
2440
3386
|
throw new Error("Unable to resolve branch value");
|
@@ -2447,7 +3393,9 @@ const buildClient = (plugins) => {
|
|
2447
3393
|
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2448
3394
|
return databaseURL + newPath;
|
2449
3395
|
},
|
2450
|
-
trace
|
3396
|
+
trace,
|
3397
|
+
clientID,
|
3398
|
+
clientName
|
2451
3399
|
};
|
2452
3400
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2453
3401
|
if (__privateGet(this, _branch))
|
@@ -2538,7 +3486,7 @@ const deserialize = (json) => {
|
|
2538
3486
|
};
|
2539
3487
|
|
2540
3488
|
function buildWorkerRunner(config) {
|
2541
|
-
return function xataWorker(name,
|
3489
|
+
return function xataWorker(name, worker) {
|
2542
3490
|
return async (...args) => {
|
2543
3491
|
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
2544
3492
|
const result = await fetch(url, {
|
@@ -2559,5 +3507,5 @@ class XataError extends Error {
|
|
2559
3507
|
}
|
2560
3508
|
}
|
2561
3509
|
|
2562
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals,
|
3510
|
+
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 };
|
2563
3511
|
//# sourceMappingURL=index.mjs.map
|