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