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