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