@xata.io/client 0.0.0-alpha.vf5ce72f → 0.0.0-alpha.vf672652
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 +2 -2
- package/CHANGELOG.md +202 -0
- package/README.md +30 -30
- package/Usage.md +7 -5
- package/dist/index.cjs +1848 -622
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +4926 -1549
- package/dist/index.mjs +1824 -604
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -3
- 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
|
+
};
|
176
297
|
|
177
|
-
|
298
|
+
function generateUUID() {
|
299
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
300
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
301
|
+
return v.toString(16);
|
302
|
+
});
|
303
|
+
}
|
304
|
+
|
305
|
+
const VERSION = "0.0.0-alpha.vf672652";
|
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 ({
|
262
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
404
|
+
async ({ name, 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
|
509
|
+
});
|
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 branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
518
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
519
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
520
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
521
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
522
|
+
method: "get",
|
523
|
+
...variables,
|
524
|
+
signal
|
525
|
+
});
|
526
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
527
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
528
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
529
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
530
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
531
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
532
|
+
method: "post",
|
533
|
+
...variables,
|
534
|
+
signal
|
447
535
|
});
|
448
|
-
const
|
536
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
537
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
538
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
539
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
540
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
541
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
542
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
449
543
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
450
544
|
method: "put",
|
451
|
-
...variables
|
545
|
+
...variables,
|
546
|
+
signal
|
452
547
|
});
|
453
|
-
const deleteTable = (variables) =>
|
548
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
454
549
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
455
550
|
method: "delete",
|
456
|
-
...variables
|
551
|
+
...variables,
|
552
|
+
signal
|
457
553
|
});
|
458
|
-
const updateTable = (variables) =>
|
459
|
-
|
460
|
-
method: "patch",
|
461
|
-
...variables
|
462
|
-
});
|
463
|
-
const getTableSchema = (variables) => fetch$1({
|
554
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
555
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
464
556
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
465
557
|
method: "get",
|
466
|
-
...variables
|
467
|
-
|
468
|
-
const setTableSchema = (variables) => fetch$1({
|
469
|
-
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
470
|
-
method: "put",
|
471
|
-
...variables
|
558
|
+
...variables,
|
559
|
+
signal
|
472
560
|
});
|
473
|
-
const
|
561
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
562
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
474
563
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
475
564
|
method: "get",
|
476
|
-
...variables
|
565
|
+
...variables,
|
566
|
+
signal
|
477
567
|
});
|
478
|
-
const addTableColumn = (variables) =>
|
479
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
480
|
-
|
481
|
-
|
482
|
-
});
|
483
|
-
const getColumn = (variables) => fetch$1({
|
568
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
569
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
570
|
+
);
|
571
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
484
572
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
485
573
|
method: "get",
|
486
|
-
...variables
|
487
|
-
|
488
|
-
const deleteColumn = (variables) => fetch$1({
|
489
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
490
|
-
method: "delete",
|
491
|
-
...variables
|
574
|
+
...variables,
|
575
|
+
signal
|
492
576
|
});
|
493
|
-
const updateColumn = (variables) =>
|
577
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
578
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
494
579
|
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
580
|
method: "delete",
|
505
|
-
...variables
|
581
|
+
...variables,
|
582
|
+
signal
|
506
583
|
});
|
507
|
-
const
|
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,42 @@ 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
|
+
records: {
|
642
|
+
branchTransaction,
|
643
|
+
insertRecord,
|
644
|
+
getRecord,
|
645
|
+
insertRecordWithID,
|
646
|
+
updateRecordWithID,
|
647
|
+
upsertRecordWithID,
|
648
|
+
deleteRecord,
|
649
|
+
bulkInsertTableRecords
|
650
|
+
},
|
651
|
+
migrationRequests: {
|
652
|
+
queryMigrationRequests,
|
653
|
+
createMigrationRequest,
|
654
|
+
getMigrationRequest,
|
655
|
+
updateMigrationRequest,
|
656
|
+
listMigrationRequestsCommits,
|
657
|
+
compareMigrationRequest,
|
658
|
+
getMigrationRequestIsMerged,
|
659
|
+
mergeMigrationRequest
|
566
660
|
},
|
567
661
|
table: {
|
568
662
|
createTable,
|
@@ -573,27 +667,150 @@ const operationsByTag = {
|
|
573
667
|
getTableColumns,
|
574
668
|
addTableColumn,
|
575
669
|
getColumn,
|
576
|
-
|
577
|
-
|
670
|
+
updateColumn,
|
671
|
+
deleteColumn
|
578
672
|
},
|
579
|
-
|
580
|
-
|
581
|
-
|
582
|
-
|
583
|
-
|
584
|
-
|
585
|
-
|
586
|
-
|
587
|
-
|
588
|
-
|
589
|
-
|
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,
|
996
|
+
...this.extraProps
|
997
|
+
});
|
998
|
+
}
|
999
|
+
getWorkspace({ workspace }) {
|
1000
|
+
return operationsByTag.workspaces.getWorkspace({
|
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 },
|
724
1219
|
...this.extraProps
|
725
1220
|
});
|
726
1221
|
}
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
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) {
|
@@ -1166,12 +1980,12 @@ const _RecordArray = class extends Array {
|
|
1166
1980
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1167
1981
|
return new _RecordArray(newPage);
|
1168
1982
|
}
|
1169
|
-
async
|
1170
|
-
const newPage = await __privateGet$6(this, _page).
|
1983
|
+
async startPage(size, offset) {
|
1984
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1171
1985
|
return new _RecordArray(newPage);
|
1172
1986
|
}
|
1173
|
-
async
|
1174
|
-
const newPage = await __privateGet$6(this, _page).
|
1987
|
+
async endPage(size, offset) {
|
1988
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1175
1989
|
return new _RecordArray(newPage);
|
1176
1990
|
}
|
1177
1991
|
hasNextPage() {
|
@@ -1199,9 +2013,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1199
2013
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1200
2014
|
return value;
|
1201
2015
|
};
|
1202
|
-
var
|
2016
|
+
var __privateMethod$3 = (obj, member, method) => {
|
2017
|
+
__accessCheck$5(obj, member, "access private method");
|
2018
|
+
return method;
|
2019
|
+
};
|
2020
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1203
2021
|
const _Query = class {
|
1204
2022
|
constructor(repository, table, data, rawParent) {
|
2023
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1205
2024
|
__privateAdd$5(this, _table$1, void 0);
|
1206
2025
|
__privateAdd$5(this, _repository, void 0);
|
1207
2026
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1220,9 +2039,11 @@ const _Query = class {
|
|
1220
2039
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1221
2040
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1222
2041
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1223
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
2042
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
2043
|
+
__privateGet$5(this, _data).consistency = data.consistency ?? parent?.consistency;
|
1224
2044
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1225
2045
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
2046
|
+
__privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
1226
2047
|
this.any = this.any.bind(this);
|
1227
2048
|
this.all = this.all.bind(this);
|
1228
2049
|
this.not = this.not.bind(this);
|
@@ -1258,11 +2079,14 @@ const _Query = class {
|
|
1258
2079
|
}
|
1259
2080
|
filter(a, b) {
|
1260
2081
|
if (arguments.length === 1) {
|
1261
|
-
const constraints = Object.entries(a).map(([column, constraint]) => ({
|
2082
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
2083
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
2084
|
+
}));
|
1262
2085
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1263
2086
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1264
2087
|
} else {
|
1265
|
-
const
|
2088
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
2089
|
+
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1266
2090
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1267
2091
|
}
|
1268
2092
|
}
|
@@ -1300,11 +2124,20 @@ const _Query = class {
|
|
1300
2124
|
}
|
1301
2125
|
}
|
1302
2126
|
async getMany(options = {}) {
|
1303
|
-
const
|
2127
|
+
const { pagination = {}, ...rest } = options;
|
2128
|
+
const { size = PAGINATION_DEFAULT_SIZE, offset } = pagination;
|
2129
|
+
const batchSize = size <= PAGINATION_MAX_SIZE ? size : PAGINATION_MAX_SIZE;
|
2130
|
+
let page = await this.getPaginated({ ...rest, pagination: { size: batchSize, offset } });
|
2131
|
+
const results = [...page.records];
|
2132
|
+
while (page.hasNextPage() && results.length < size) {
|
2133
|
+
page = await page.nextPage();
|
2134
|
+
results.push(...page.records);
|
2135
|
+
}
|
1304
2136
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1305
2137
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1306
2138
|
}
|
1307
|
-
|
2139
|
+
const array = new RecordArray(page, results.slice(0, size));
|
2140
|
+
return array;
|
1308
2141
|
}
|
1309
2142
|
async getAll(options = {}) {
|
1310
2143
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1318,19 +2151,35 @@ const _Query = class {
|
|
1318
2151
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1319
2152
|
return records[0] ?? null;
|
1320
2153
|
}
|
2154
|
+
async getFirstOrThrow(options = {}) {
|
2155
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2156
|
+
if (records[0] === void 0)
|
2157
|
+
throw new Error("No results found.");
|
2158
|
+
return records[0];
|
2159
|
+
}
|
2160
|
+
async summarize(params = {}) {
|
2161
|
+
const { summaries, summariesFilter, ...options } = params;
|
2162
|
+
const query = new _Query(
|
2163
|
+
__privateGet$5(this, _repository),
|
2164
|
+
__privateGet$5(this, _table$1),
|
2165
|
+
options,
|
2166
|
+
__privateGet$5(this, _data)
|
2167
|
+
);
|
2168
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2169
|
+
}
|
1321
2170
|
cache(ttl) {
|
1322
2171
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1323
2172
|
}
|
1324
2173
|
nextPage(size, offset) {
|
1325
|
-
return this.
|
2174
|
+
return this.startPage(size, offset);
|
1326
2175
|
}
|
1327
2176
|
previousPage(size, offset) {
|
1328
|
-
return this.
|
2177
|
+
return this.startPage(size, offset);
|
1329
2178
|
}
|
1330
|
-
|
2179
|
+
startPage(size, offset) {
|
1331
2180
|
return this.getPaginated({ pagination: { size, offset } });
|
1332
2181
|
}
|
1333
|
-
|
2182
|
+
endPage(size, offset) {
|
1334
2183
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1335
2184
|
}
|
1336
2185
|
hasNextPage() {
|
@@ -1341,9 +2190,20 @@ let Query = _Query;
|
|
1341
2190
|
_table$1 = new WeakMap();
|
1342
2191
|
_repository = new WeakMap();
|
1343
2192
|
_data = new WeakMap();
|
2193
|
+
_cleanFilterConstraint = new WeakSet();
|
2194
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2195
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2196
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2197
|
+
return { $includes: value };
|
2198
|
+
}
|
2199
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2200
|
+
return value.id;
|
2201
|
+
}
|
2202
|
+
return value;
|
2203
|
+
};
|
1344
2204
|
function cleanParent(data, parent) {
|
1345
2205
|
if (isCursorPaginationOptions(data.pagination)) {
|
1346
|
-
return { ...parent,
|
2206
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1347
2207
|
}
|
1348
2208
|
return parent;
|
1349
2209
|
}
|
@@ -1402,18 +2262,25 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1402
2262
|
__accessCheck$4(obj, member, "access private method");
|
1403
2263
|
return method;
|
1404
2264
|
};
|
1405
|
-
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn,
|
2265
|
+
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;
|
2266
|
+
const BULK_OPERATION_MAX_SIZE = 1e3;
|
1406
2267
|
class Repository extends Query {
|
1407
2268
|
}
|
1408
2269
|
class RestRepository extends Query {
|
1409
2270
|
constructor(options) {
|
1410
|
-
super(
|
2271
|
+
super(
|
2272
|
+
null,
|
2273
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2274
|
+
{}
|
2275
|
+
);
|
1411
2276
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1412
2277
|
__privateAdd$4(this, _insertRecordWithId);
|
1413
|
-
__privateAdd$4(this,
|
2278
|
+
__privateAdd$4(this, _insertRecords);
|
1414
2279
|
__privateAdd$4(this, _updateRecordWithID);
|
2280
|
+
__privateAdd$4(this, _updateRecords);
|
1415
2281
|
__privateAdd$4(this, _upsertRecordWithID);
|
1416
2282
|
__privateAdd$4(this, _deleteRecord);
|
2283
|
+
__privateAdd$4(this, _deleteRecords);
|
1417
2284
|
__privateAdd$4(this, _setCacheQuery);
|
1418
2285
|
__privateAdd$4(this, _getCacheQuery);
|
1419
2286
|
__privateAdd$4(this, _getSchemaTables$1);
|
@@ -1424,38 +2291,45 @@ class RestRepository extends Query {
|
|
1424
2291
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1425
2292
|
__privateAdd$4(this, _trace, void 0);
|
1426
2293
|
__privateSet$4(this, _table, options.table);
|
1427
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1428
2294
|
__privateSet$4(this, _db, options.db);
|
1429
2295
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1430
2296
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2297
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2298
|
+
const props = await options.pluginOptions.getFetchProps();
|
2299
|
+
return { ...props, sessionID: generateUUID() };
|
2300
|
+
});
|
1431
2301
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1432
2302
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1433
2303
|
return trace(name, fn, {
|
1434
2304
|
...options2,
|
1435
2305
|
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
2306
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
1436
2307
|
[TraceAttributes.VERSION]: VERSION
|
1437
2308
|
});
|
1438
2309
|
});
|
1439
2310
|
}
|
1440
|
-
async create(a, b, c) {
|
2311
|
+
async create(a, b, c, d) {
|
1441
2312
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2313
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1442
2314
|
if (Array.isArray(a)) {
|
1443
2315
|
if (a.length === 0)
|
1444
2316
|
return [];
|
1445
|
-
const
|
1446
|
-
|
2317
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
2318
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2319
|
+
const result = await this.read(ids, columns);
|
2320
|
+
return result;
|
1447
2321
|
}
|
1448
2322
|
if (isString(a) && isObject(b)) {
|
1449
2323
|
if (a === "")
|
1450
2324
|
throw new Error("The id can't be empty");
|
1451
2325
|
const columns = isStringArray(c) ? c : void 0;
|
1452
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
2326
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1453
2327
|
}
|
1454
2328
|
if (isObject(a) && isString(a.id)) {
|
1455
2329
|
if (a.id === "")
|
1456
2330
|
throw new Error("The id can't be empty");
|
1457
2331
|
const columns = isStringArray(b) ? b : void 0;
|
1458
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
2332
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1459
2333
|
}
|
1460
2334
|
if (isObject(a)) {
|
1461
2335
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1486,6 +2360,7 @@ class RestRepository extends Query {
|
|
1486
2360
|
pathParams: {
|
1487
2361
|
workspace: "{workspaceId}",
|
1488
2362
|
dbBranchName: "{dbBranch}",
|
2363
|
+
region: "{region}",
|
1489
2364
|
tableName: __privateGet$4(this, _table),
|
1490
2365
|
recordId: id
|
1491
2366
|
},
|
@@ -1493,7 +2368,7 @@ class RestRepository extends Query {
|
|
1493
2368
|
...fetchProps
|
1494
2369
|
});
|
1495
2370
|
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);
|
2371
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1497
2372
|
} catch (e) {
|
1498
2373
|
if (isObject(e) && e.status === 404) {
|
1499
2374
|
return null;
|
@@ -1504,48 +2379,122 @@ class RestRepository extends Query {
|
|
1504
2379
|
return null;
|
1505
2380
|
});
|
1506
2381
|
}
|
1507
|
-
async
|
2382
|
+
async readOrThrow(a, b) {
|
2383
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2384
|
+
const result = await this.read(a, b);
|
2385
|
+
if (Array.isArray(result)) {
|
2386
|
+
const missingIds = compact(
|
2387
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2388
|
+
);
|
2389
|
+
if (missingIds.length > 0) {
|
2390
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2391
|
+
}
|
2392
|
+
return result;
|
2393
|
+
}
|
2394
|
+
if (result === null) {
|
2395
|
+
const id = extractId(a) ?? "unknown";
|
2396
|
+
throw new Error(`Record with id ${id} not found`);
|
2397
|
+
}
|
2398
|
+
return result;
|
2399
|
+
});
|
2400
|
+
}
|
2401
|
+
async update(a, b, c, d) {
|
1508
2402
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2403
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1509
2404
|
if (Array.isArray(a)) {
|
1510
2405
|
if (a.length === 0)
|
1511
2406
|
return [];
|
1512
|
-
|
1513
|
-
|
2407
|
+
const existing = await this.read(a, ["id"]);
|
2408
|
+
const updates = a.filter((_item, index) => existing[index] !== null);
|
2409
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, updates, {
|
2410
|
+
ifVersion,
|
2411
|
+
upsert: false
|
2412
|
+
});
|
2413
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2414
|
+
const result = await this.read(a, columns);
|
2415
|
+
return result;
|
2416
|
+
}
|
2417
|
+
try {
|
2418
|
+
if (isString(a) && isObject(b)) {
|
2419
|
+
const columns = isStringArray(c) ? c : void 0;
|
2420
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
2421
|
+
}
|
2422
|
+
if (isObject(a) && isString(a.id)) {
|
2423
|
+
const columns = isStringArray(b) ? b : void 0;
|
2424
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1514
2425
|
}
|
2426
|
+
} catch (error) {
|
2427
|
+
if (error.status === 422)
|
2428
|
+
return null;
|
2429
|
+
throw error;
|
2430
|
+
}
|
2431
|
+
throw new Error("Invalid arguments for update method");
|
2432
|
+
});
|
2433
|
+
}
|
2434
|
+
async updateOrThrow(a, b, c, d) {
|
2435
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2436
|
+
const result = await this.update(a, b, c, d);
|
2437
|
+
if (Array.isArray(result)) {
|
2438
|
+
const missingIds = compact(
|
2439
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2440
|
+
);
|
2441
|
+
if (missingIds.length > 0) {
|
2442
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2443
|
+
}
|
2444
|
+
return result;
|
2445
|
+
}
|
2446
|
+
if (result === null) {
|
2447
|
+
const id = extractId(a) ?? "unknown";
|
2448
|
+
throw new Error(`Record with id ${id} not found`);
|
2449
|
+
}
|
2450
|
+
return result;
|
2451
|
+
});
|
2452
|
+
}
|
2453
|
+
async createOrUpdate(a, b, c, d) {
|
2454
|
+
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2455
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2456
|
+
if (Array.isArray(a)) {
|
2457
|
+
if (a.length === 0)
|
2458
|
+
return [];
|
2459
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
2460
|
+
ifVersion,
|
2461
|
+
upsert: true
|
2462
|
+
});
|
1515
2463
|
const columns = isStringArray(b) ? b : ["*"];
|
1516
|
-
|
2464
|
+
const result = await this.read(a, columns);
|
2465
|
+
return result;
|
1517
2466
|
}
|
1518
2467
|
if (isString(a) && isObject(b)) {
|
1519
2468
|
const columns = isStringArray(c) ? c : void 0;
|
1520
|
-
return __privateMethod$2(this,
|
2469
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1521
2470
|
}
|
1522
2471
|
if (isObject(a) && isString(a.id)) {
|
1523
|
-
const columns = isStringArray(
|
1524
|
-
return __privateMethod$2(this,
|
2472
|
+
const columns = isStringArray(c) ? c : void 0;
|
2473
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1525
2474
|
}
|
1526
|
-
throw new Error("Invalid arguments for
|
2475
|
+
throw new Error("Invalid arguments for createOrUpdate method");
|
1527
2476
|
});
|
1528
2477
|
}
|
1529
|
-
async
|
1530
|
-
return __privateGet$4(this, _trace).call(this, "
|
2478
|
+
async createOrReplace(a, b, c, d) {
|
2479
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2480
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1531
2481
|
if (Array.isArray(a)) {
|
1532
2482
|
if (a.length === 0)
|
1533
2483
|
return [];
|
1534
|
-
|
1535
|
-
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
1536
|
-
}
|
2484
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
1537
2485
|
const columns = isStringArray(b) ? b : ["*"];
|
1538
|
-
|
2486
|
+
const result = await this.read(ids, columns);
|
2487
|
+
return result;
|
1539
2488
|
}
|
1540
2489
|
if (isString(a) && isObject(b)) {
|
1541
2490
|
const columns = isStringArray(c) ? c : void 0;
|
1542
|
-
return __privateMethod$2(this,
|
2491
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
1543
2492
|
}
|
1544
2493
|
if (isObject(a) && isString(a.id)) {
|
1545
2494
|
const columns = isStringArray(c) ? c : void 0;
|
1546
|
-
return __privateMethod$2(this,
|
2495
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
1547
2496
|
}
|
1548
|
-
throw new Error("Invalid arguments for
|
2497
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
1549
2498
|
});
|
1550
2499
|
}
|
1551
2500
|
async delete(a, b) {
|
@@ -1553,10 +2502,17 @@ class RestRepository extends Query {
|
|
1553
2502
|
if (Array.isArray(a)) {
|
1554
2503
|
if (a.length === 0)
|
1555
2504
|
return [];
|
1556
|
-
|
1557
|
-
|
1558
|
-
|
1559
|
-
|
2505
|
+
const ids = a.map((o) => {
|
2506
|
+
if (isString(o))
|
2507
|
+
return o;
|
2508
|
+
if (isString(o.id))
|
2509
|
+
return o.id;
|
2510
|
+
throw new Error("Invalid arguments for delete method");
|
2511
|
+
});
|
2512
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2513
|
+
const result = await this.read(a, columns);
|
2514
|
+
await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
|
2515
|
+
return result;
|
1560
2516
|
}
|
1561
2517
|
if (isString(a)) {
|
1562
2518
|
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
@@ -1567,23 +2523,64 @@ class RestRepository extends Query {
|
|
1567
2523
|
throw new Error("Invalid arguments for delete method");
|
1568
2524
|
});
|
1569
2525
|
}
|
2526
|
+
async deleteOrThrow(a, b) {
|
2527
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2528
|
+
const result = await this.delete(a, b);
|
2529
|
+
if (Array.isArray(result)) {
|
2530
|
+
const missingIds = compact(
|
2531
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2532
|
+
);
|
2533
|
+
if (missingIds.length > 0) {
|
2534
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2535
|
+
}
|
2536
|
+
return result;
|
2537
|
+
} else if (result === null) {
|
2538
|
+
const id = extractId(a) ?? "unknown";
|
2539
|
+
throw new Error(`Record with id ${id} not found`);
|
2540
|
+
}
|
2541
|
+
return result;
|
2542
|
+
});
|
2543
|
+
}
|
1570
2544
|
async search(query, options = {}) {
|
1571
2545
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1572
2546
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1573
2547
|
const { records } = await searchTable({
|
1574
|
-
pathParams: {
|
2548
|
+
pathParams: {
|
2549
|
+
workspace: "{workspaceId}",
|
2550
|
+
dbBranchName: "{dbBranch}",
|
2551
|
+
region: "{region}",
|
2552
|
+
tableName: __privateGet$4(this, _table)
|
2553
|
+
},
|
1575
2554
|
body: {
|
1576
2555
|
query,
|
1577
2556
|
fuzziness: options.fuzziness,
|
1578
2557
|
prefix: options.prefix,
|
1579
2558
|
highlight: options.highlight,
|
1580
2559
|
filter: options.filter,
|
1581
|
-
boosters: options.boosters
|
2560
|
+
boosters: options.boosters,
|
2561
|
+
page: options.page,
|
2562
|
+
target: options.target
|
1582
2563
|
},
|
1583
2564
|
...fetchProps
|
1584
2565
|
});
|
1585
2566
|
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));
|
2567
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2568
|
+
});
|
2569
|
+
}
|
2570
|
+
async aggregate(aggs, filter) {
|
2571
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2572
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2573
|
+
const result = await aggregateTable({
|
2574
|
+
pathParams: {
|
2575
|
+
workspace: "{workspaceId}",
|
2576
|
+
dbBranchName: "{dbBranch}",
|
2577
|
+
region: "{region}",
|
2578
|
+
tableName: __privateGet$4(this, _table)
|
2579
|
+
},
|
2580
|
+
body: { aggs, filter },
|
2581
|
+
...fetchProps
|
2582
|
+
});
|
2583
|
+
return result;
|
1587
2584
|
});
|
1588
2585
|
}
|
1589
2586
|
async query(query) {
|
@@ -1592,24 +2589,57 @@ class RestRepository extends Query {
|
|
1592
2589
|
if (cacheQuery)
|
1593
2590
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1594
2591
|
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
2592
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1602
2593
|
const { meta, records: objects } = await queryTable({
|
1603
|
-
pathParams: {
|
1604
|
-
|
2594
|
+
pathParams: {
|
2595
|
+
workspace: "{workspaceId}",
|
2596
|
+
dbBranchName: "{dbBranch}",
|
2597
|
+
region: "{region}",
|
2598
|
+
tableName: __privateGet$4(this, _table)
|
2599
|
+
},
|
2600
|
+
body: {
|
2601
|
+
filter: cleanFilter(data.filter),
|
2602
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2603
|
+
page: data.pagination,
|
2604
|
+
columns: data.columns ?? ["*"],
|
2605
|
+
consistency: data.consistency
|
2606
|
+
},
|
2607
|
+
fetchOptions: data.fetchOptions,
|
1605
2608
|
...fetchProps
|
1606
2609
|
});
|
1607
2610
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1608
|
-
const records = objects.map(
|
2611
|
+
const records = objects.map(
|
2612
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2613
|
+
);
|
1609
2614
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1610
2615
|
return new Page(query, meta, records);
|
1611
2616
|
});
|
1612
2617
|
}
|
2618
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2619
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2620
|
+
const data = query.getQueryOptions();
|
2621
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2622
|
+
const result = await summarizeTable({
|
2623
|
+
pathParams: {
|
2624
|
+
workspace: "{workspaceId}",
|
2625
|
+
dbBranchName: "{dbBranch}",
|
2626
|
+
region: "{region}",
|
2627
|
+
tableName: __privateGet$4(this, _table)
|
2628
|
+
},
|
2629
|
+
body: {
|
2630
|
+
filter: cleanFilter(data.filter),
|
2631
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2632
|
+
columns: data.columns,
|
2633
|
+
consistency: data.consistency,
|
2634
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2635
|
+
summaries,
|
2636
|
+
summariesFilter
|
2637
|
+
},
|
2638
|
+
...fetchProps
|
2639
|
+
});
|
2640
|
+
return result;
|
2641
|
+
});
|
2642
|
+
}
|
1613
2643
|
}
|
1614
2644
|
_table = new WeakMap();
|
1615
2645
|
_getFetchProps = new WeakMap();
|
@@ -1625,6 +2655,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1625
2655
|
pathParams: {
|
1626
2656
|
workspace: "{workspaceId}",
|
1627
2657
|
dbBranchName: "{dbBranch}",
|
2658
|
+
region: "{region}",
|
1628
2659
|
tableName: __privateGet$4(this, _table)
|
1629
2660
|
},
|
1630
2661
|
queryParams: { columns },
|
@@ -1632,55 +2663,76 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1632
2663
|
...fetchProps
|
1633
2664
|
});
|
1634
2665
|
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);
|
2666
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1636
2667
|
};
|
1637
2668
|
_insertRecordWithId = new WeakSet();
|
1638
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2669
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1639
2670
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1640
2671
|
const record = transformObjectLinks(object);
|
1641
2672
|
const response = await insertRecordWithID({
|
1642
2673
|
pathParams: {
|
1643
2674
|
workspace: "{workspaceId}",
|
1644
2675
|
dbBranchName: "{dbBranch}",
|
2676
|
+
region: "{region}",
|
1645
2677
|
tableName: __privateGet$4(this, _table),
|
1646
2678
|
recordId
|
1647
2679
|
},
|
1648
2680
|
body: record,
|
1649
|
-
queryParams: { createOnly
|
2681
|
+
queryParams: { createOnly, columns, ifVersion },
|
1650
2682
|
...fetchProps
|
1651
2683
|
});
|
1652
2684
|
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);
|
2685
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1654
2686
|
};
|
1655
|
-
|
1656
|
-
|
2687
|
+
_insertRecords = new WeakSet();
|
2688
|
+
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
1657
2689
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1658
|
-
const
|
1659
|
-
|
1660
|
-
|
1661
|
-
|
1662
|
-
|
1663
|
-
|
1664
|
-
|
1665
|
-
|
1666
|
-
|
2690
|
+
const chunkedOperations = chunk(
|
2691
|
+
objects.map((object) => ({
|
2692
|
+
insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
|
2693
|
+
})),
|
2694
|
+
BULK_OPERATION_MAX_SIZE
|
2695
|
+
);
|
2696
|
+
const ids = [];
|
2697
|
+
for (const operations of chunkedOperations) {
|
2698
|
+
const { results } = await branchTransaction({
|
2699
|
+
pathParams: {
|
2700
|
+
workspace: "{workspaceId}",
|
2701
|
+
dbBranchName: "{dbBranch}",
|
2702
|
+
region: "{region}"
|
2703
|
+
},
|
2704
|
+
body: { operations },
|
2705
|
+
...fetchProps
|
2706
|
+
});
|
2707
|
+
for (const result of results) {
|
2708
|
+
if (result.operation === "insert") {
|
2709
|
+
ids.push(result.id);
|
2710
|
+
} else {
|
2711
|
+
ids.push(null);
|
2712
|
+
}
|
2713
|
+
}
|
1667
2714
|
}
|
1668
|
-
|
1669
|
-
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
2715
|
+
return ids;
|
1670
2716
|
};
|
1671
2717
|
_updateRecordWithID = new WeakSet();
|
1672
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2718
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1673
2719
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1674
|
-
const record = transformObjectLinks(object);
|
2720
|
+
const { id: _id, ...record } = transformObjectLinks(object);
|
1675
2721
|
try {
|
1676
2722
|
const response = await updateRecordWithID({
|
1677
|
-
pathParams: {
|
1678
|
-
|
2723
|
+
pathParams: {
|
2724
|
+
workspace: "{workspaceId}",
|
2725
|
+
dbBranchName: "{dbBranch}",
|
2726
|
+
region: "{region}",
|
2727
|
+
tableName: __privateGet$4(this, _table),
|
2728
|
+
recordId
|
2729
|
+
},
|
2730
|
+
queryParams: { columns, ifVersion },
|
1679
2731
|
body: record,
|
1680
2732
|
...fetchProps
|
1681
2733
|
});
|
1682
2734
|
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);
|
2735
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1684
2736
|
} catch (e) {
|
1685
2737
|
if (isObject(e) && e.status === 404) {
|
1686
2738
|
return null;
|
@@ -1688,29 +2740,71 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1688
2740
|
throw e;
|
1689
2741
|
}
|
1690
2742
|
};
|
2743
|
+
_updateRecords = new WeakSet();
|
2744
|
+
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
2745
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2746
|
+
const chunkedOperations = chunk(
|
2747
|
+
objects.map(({ id, ...object }) => ({
|
2748
|
+
update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
|
2749
|
+
})),
|
2750
|
+
BULK_OPERATION_MAX_SIZE
|
2751
|
+
);
|
2752
|
+
const ids = [];
|
2753
|
+
for (const operations of chunkedOperations) {
|
2754
|
+
const { results } = await branchTransaction({
|
2755
|
+
pathParams: {
|
2756
|
+
workspace: "{workspaceId}",
|
2757
|
+
dbBranchName: "{dbBranch}",
|
2758
|
+
region: "{region}"
|
2759
|
+
},
|
2760
|
+
body: { operations },
|
2761
|
+
...fetchProps
|
2762
|
+
});
|
2763
|
+
for (const result of results) {
|
2764
|
+
if (result.operation === "update") {
|
2765
|
+
ids.push(result.id);
|
2766
|
+
} else {
|
2767
|
+
ids.push(null);
|
2768
|
+
}
|
2769
|
+
}
|
2770
|
+
}
|
2771
|
+
return ids;
|
2772
|
+
};
|
1691
2773
|
_upsertRecordWithID = new WeakSet();
|
1692
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2774
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1693
2775
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1694
2776
|
const response = await upsertRecordWithID({
|
1695
|
-
pathParams: {
|
1696
|
-
|
2777
|
+
pathParams: {
|
2778
|
+
workspace: "{workspaceId}",
|
2779
|
+
dbBranchName: "{dbBranch}",
|
2780
|
+
region: "{region}",
|
2781
|
+
tableName: __privateGet$4(this, _table),
|
2782
|
+
recordId
|
2783
|
+
},
|
2784
|
+
queryParams: { columns, ifVersion },
|
1697
2785
|
body: object,
|
1698
2786
|
...fetchProps
|
1699
2787
|
});
|
1700
2788
|
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);
|
2789
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1702
2790
|
};
|
1703
2791
|
_deleteRecord = new WeakSet();
|
1704
2792
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1705
2793
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1706
2794
|
try {
|
1707
2795
|
const response = await deleteRecord({
|
1708
|
-
pathParams: {
|
2796
|
+
pathParams: {
|
2797
|
+
workspace: "{workspaceId}",
|
2798
|
+
dbBranchName: "{dbBranch}",
|
2799
|
+
region: "{region}",
|
2800
|
+
tableName: __privateGet$4(this, _table),
|
2801
|
+
recordId
|
2802
|
+
},
|
1709
2803
|
queryParams: { columns },
|
1710
2804
|
...fetchProps
|
1711
2805
|
});
|
1712
2806
|
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);
|
2807
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1714
2808
|
} catch (e) {
|
1715
2809
|
if (isObject(e) && e.status === 404) {
|
1716
2810
|
return null;
|
@@ -1718,6 +2812,25 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
1718
2812
|
throw e;
|
1719
2813
|
}
|
1720
2814
|
};
|
2815
|
+
_deleteRecords = new WeakSet();
|
2816
|
+
deleteRecords_fn = async function(recordIds) {
|
2817
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2818
|
+
const chunkedOperations = chunk(
|
2819
|
+
recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
2820
|
+
BULK_OPERATION_MAX_SIZE
|
2821
|
+
);
|
2822
|
+
for (const operations of chunkedOperations) {
|
2823
|
+
await branchTransaction({
|
2824
|
+
pathParams: {
|
2825
|
+
workspace: "{workspaceId}",
|
2826
|
+
dbBranchName: "{dbBranch}",
|
2827
|
+
region: "{region}"
|
2828
|
+
},
|
2829
|
+
body: { operations },
|
2830
|
+
...fetchProps
|
2831
|
+
});
|
2832
|
+
}
|
2833
|
+
};
|
1721
2834
|
_setCacheQuery = new WeakSet();
|
1722
2835
|
setCacheQuery_fn = async function(query, meta, records) {
|
1723
2836
|
await __privateGet$4(this, _cache).set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
|
@@ -1740,7 +2853,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1740
2853
|
return __privateGet$4(this, _schemaTables$2);
|
1741
2854
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1742
2855
|
const { schema } = await getBranchDetails({
|
1743
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2856
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1744
2857
|
...fetchProps
|
1745
2858
|
});
|
1746
2859
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1753,22 +2866,24 @@ const transformObjectLinks = (object) => {
|
|
1753
2866
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1754
2867
|
}, {});
|
1755
2868
|
};
|
1756
|
-
const initObject = (db, schemaTables, table, object) => {
|
1757
|
-
const
|
2869
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
2870
|
+
const data = {};
|
1758
2871
|
const { xata, ...rest } = object ?? {};
|
1759
|
-
Object.assign(
|
2872
|
+
Object.assign(data, rest);
|
1760
2873
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
1761
2874
|
if (!columns)
|
1762
2875
|
console.error(`Table ${table} not found in schema`);
|
1763
2876
|
for (const column of columns ?? []) {
|
1764
|
-
|
2877
|
+
if (!isValidColumn(selectedColumns, column))
|
2878
|
+
continue;
|
2879
|
+
const value = data[column.name];
|
1765
2880
|
switch (column.type) {
|
1766
2881
|
case "datetime": {
|
1767
|
-
const date = value !== void 0 ? new Date(value) :
|
1768
|
-
if (date && isNaN(date.getTime())) {
|
2882
|
+
const date = value !== void 0 ? new Date(value) : null;
|
2883
|
+
if (date !== null && isNaN(date.getTime())) {
|
1769
2884
|
console.error(`Failed to parse date ${value} for field ${column.name}`);
|
1770
|
-
} else
|
1771
|
-
|
2885
|
+
} else {
|
2886
|
+
data[column.name] = date;
|
1772
2887
|
}
|
1773
2888
|
break;
|
1774
2889
|
}
|
@@ -1777,33 +2892,59 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1777
2892
|
if (!linkTable) {
|
1778
2893
|
console.error(`Failed to parse link for field ${column.name}`);
|
1779
2894
|
} else if (isObject(value)) {
|
1780
|
-
|
2895
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2896
|
+
if (item === column.name) {
|
2897
|
+
return [...acc, "*"];
|
2898
|
+
}
|
2899
|
+
if (item.startsWith(`${column.name}.`)) {
|
2900
|
+
const [, ...path] = item.split(".");
|
2901
|
+
return [...acc, path.join(".")];
|
2902
|
+
}
|
2903
|
+
return acc;
|
2904
|
+
}, []);
|
2905
|
+
data[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2906
|
+
} else {
|
2907
|
+
data[column.name] = null;
|
1781
2908
|
}
|
1782
2909
|
break;
|
1783
2910
|
}
|
2911
|
+
default:
|
2912
|
+
data[column.name] = value ?? null;
|
2913
|
+
if (column.notNull === true && value === null) {
|
2914
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2915
|
+
}
|
2916
|
+
break;
|
1784
2917
|
}
|
1785
2918
|
}
|
1786
|
-
|
1787
|
-
|
2919
|
+
const record = { ...data };
|
2920
|
+
record.read = function(columns2) {
|
2921
|
+
return db[table].read(record["id"], columns2);
|
1788
2922
|
};
|
1789
|
-
|
1790
|
-
|
2923
|
+
record.update = function(data2, b, c) {
|
2924
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2925
|
+
const ifVersion = parseIfVersion(b, c);
|
2926
|
+
return db[table].update(record["id"], data2, columns2, { ifVersion });
|
1791
2927
|
};
|
1792
|
-
|
1793
|
-
|
2928
|
+
record.replace = function(data2, b, c) {
|
2929
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2930
|
+
const ifVersion = parseIfVersion(b, c);
|
2931
|
+
return db[table].createOrReplace(record["id"], data2, columns2, { ifVersion });
|
1794
2932
|
};
|
1795
|
-
|
2933
|
+
record.delete = function() {
|
2934
|
+
return db[table].delete(record["id"]);
|
2935
|
+
};
|
2936
|
+
record.getMetadata = function() {
|
1796
2937
|
return xata;
|
1797
2938
|
};
|
1798
|
-
|
1799
|
-
|
2939
|
+
record.toJSON = function() {
|
2940
|
+
return JSON.parse(JSON.stringify(transformObjectLinks(data)));
|
2941
|
+
};
|
2942
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toJSON"]) {
|
2943
|
+
Object.defineProperty(record, prop, { enumerable: false });
|
1800
2944
|
}
|
1801
|
-
Object.freeze(
|
1802
|
-
return
|
2945
|
+
Object.freeze(record);
|
2946
|
+
return record;
|
1803
2947
|
};
|
1804
|
-
function isResponseWithRecords(value) {
|
1805
|
-
return isObject(value) && Array.isArray(value.records);
|
1806
|
-
}
|
1807
2948
|
function extractId(value) {
|
1808
2949
|
if (isString(value))
|
1809
2950
|
return value;
|
@@ -1811,6 +2952,23 @@ function extractId(value) {
|
|
1811
2952
|
return value.id;
|
1812
2953
|
return void 0;
|
1813
2954
|
}
|
2955
|
+
function isValidColumn(columns, column) {
|
2956
|
+
if (columns.includes("*"))
|
2957
|
+
return true;
|
2958
|
+
if (column.type === "link") {
|
2959
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
2960
|
+
return linkColumns.length > 0;
|
2961
|
+
}
|
2962
|
+
return columns.includes(column.name);
|
2963
|
+
}
|
2964
|
+
function parseIfVersion(...args) {
|
2965
|
+
for (const arg of args) {
|
2966
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
2967
|
+
return arg.ifVersion;
|
2968
|
+
}
|
2969
|
+
}
|
2970
|
+
return void 0;
|
2971
|
+
}
|
1814
2972
|
|
1815
2973
|
var __accessCheck$3 = (obj, member, msg) => {
|
1816
2974
|
if (!member.has(obj))
|
@@ -1976,7 +3134,7 @@ class SearchPlugin extends XataPlugin {
|
|
1976
3134
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1977
3135
|
return records.map((record) => {
|
1978
3136
|
const { table = "orphan" } = record.xata;
|
1979
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
3137
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1980
3138
|
});
|
1981
3139
|
},
|
1982
3140
|
byTable: async (query, options = {}) => {
|
@@ -1985,7 +3143,7 @@ class SearchPlugin extends XataPlugin {
|
|
1985
3143
|
return records.reduce((acc, record) => {
|
1986
3144
|
const { table = "orphan" } = record.xata;
|
1987
3145
|
const items = acc[table] ?? [];
|
1988
|
-
const item = initObject(this.db, schemaTables, table, record);
|
3146
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1989
3147
|
return { ...acc, [table]: [...items, item] };
|
1990
3148
|
}, {});
|
1991
3149
|
}
|
@@ -1996,10 +3154,10 @@ _schemaTables = new WeakMap();
|
|
1996
3154
|
_search = new WeakSet();
|
1997
3155
|
search_fn = async function(query, options, getFetchProps) {
|
1998
3156
|
const fetchProps = await getFetchProps();
|
1999
|
-
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
3157
|
+
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
2000
3158
|
const { records } = await searchBranch({
|
2001
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2002
|
-
body: { tables, query, fuzziness, prefix, highlight },
|
3159
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3160
|
+
body: { tables, query, fuzziness, prefix, highlight, page },
|
2003
3161
|
...fetchProps
|
2004
3162
|
});
|
2005
3163
|
return records;
|
@@ -2010,25 +3168,37 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
2010
3168
|
return __privateGet$1(this, _schemaTables);
|
2011
3169
|
const fetchProps = await getFetchProps();
|
2012
3170
|
const { schema } = await getBranchDetails({
|
2013
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
3171
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2014
3172
|
...fetchProps
|
2015
3173
|
});
|
2016
3174
|
__privateSet$1(this, _schemaTables, schema.tables);
|
2017
3175
|
return schema.tables;
|
2018
3176
|
};
|
2019
3177
|
|
3178
|
+
class TransactionPlugin extends XataPlugin {
|
3179
|
+
build({ getFetchProps }) {
|
3180
|
+
return {
|
3181
|
+
run: async (operations) => {
|
3182
|
+
const fetchProps = await getFetchProps();
|
3183
|
+
const response = await branchTransaction({
|
3184
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3185
|
+
body: { operations },
|
3186
|
+
...fetchProps
|
3187
|
+
});
|
3188
|
+
return response;
|
3189
|
+
}
|
3190
|
+
};
|
3191
|
+
}
|
3192
|
+
}
|
3193
|
+
|
2020
3194
|
const isBranchStrategyBuilder = (strategy) => {
|
2021
3195
|
return typeof strategy === "function";
|
2022
3196
|
};
|
2023
3197
|
|
2024
3198
|
async function getCurrentBranchName(options) {
|
2025
3199
|
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
|
-
}
|
3200
|
+
if (branch)
|
3201
|
+
return branch;
|
2032
3202
|
const gitBranch = envBranch || await getGitBranch();
|
2033
3203
|
return resolveXataBranch(gitBranch, options);
|
2034
3204
|
}
|
@@ -2048,16 +3218,20 @@ async function resolveXataBranch(gitBranch, options) {
|
|
2048
3218
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2049
3219
|
);
|
2050
3220
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2051
|
-
const
|
3221
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3222
|
+
if (!urlParts)
|
3223
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3224
|
+
const { workspace, region } = urlParts;
|
2052
3225
|
const { fallbackBranch } = getEnvironment();
|
2053
3226
|
const { branch } = await resolveBranch({
|
2054
3227
|
apiKey,
|
2055
3228
|
apiUrl: databaseURL,
|
2056
3229
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2057
3230
|
workspacesApiUrl: `${protocol}//${host}`,
|
2058
|
-
pathParams: { dbName, workspace },
|
3231
|
+
pathParams: { dbName, workspace, region },
|
2059
3232
|
queryParams: { gitBranch, fallbackBranch },
|
2060
|
-
trace: defaultTrace
|
3233
|
+
trace: defaultTrace,
|
3234
|
+
clientName: options?.clientName
|
2061
3235
|
});
|
2062
3236
|
return branch;
|
2063
3237
|
}
|
@@ -2073,15 +3247,17 @@ async function getDatabaseBranch(branch, options) {
|
|
2073
3247
|
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2074
3248
|
);
|
2075
3249
|
const [protocol, , host, , database] = databaseURL.split("/");
|
2076
|
-
const
|
2077
|
-
|
3250
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3251
|
+
if (!urlParts)
|
3252
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3253
|
+
const { workspace, region } = urlParts;
|
2078
3254
|
try {
|
2079
3255
|
return await getBranchDetails({
|
2080
3256
|
apiKey,
|
2081
3257
|
apiUrl: databaseURL,
|
2082
3258
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2083
3259
|
workspacesApiUrl: `${protocol}//${host}`,
|
2084
|
-
pathParams: { dbBranchName
|
3260
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
2085
3261
|
trace: defaultTrace
|
2086
3262
|
});
|
2087
3263
|
} catch (err) {
|
@@ -2139,8 +3315,10 @@ const buildClient = (plugins) => {
|
|
2139
3315
|
};
|
2140
3316
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
2141
3317
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
3318
|
+
const transactions = new TransactionPlugin().build(pluginOptions);
|
2142
3319
|
this.db = db;
|
2143
3320
|
this.search = search;
|
3321
|
+
this.transactions = transactions;
|
2144
3322
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
2145
3323
|
if (namespace === void 0)
|
2146
3324
|
continue;
|
@@ -2160,20 +3338,41 @@ const buildClient = (plugins) => {
|
|
2160
3338
|
return { databaseURL, branch };
|
2161
3339
|
}
|
2162
3340
|
}, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
3341
|
+
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
3342
|
+
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
3343
|
+
if (isBrowser && !enableBrowser) {
|
3344
|
+
throw new Error(
|
3345
|
+
"You are trying to use Xata from the browser, which is potentially a non-secure environment. If you understand the security concerns, such as leaking your credentials, pass `enableBrowser: true` to the client options to remove this error."
|
3346
|
+
);
|
3347
|
+
}
|
2163
3348
|
const fetch = getFetchImplementation(options?.fetch);
|
2164
3349
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2165
3350
|
const apiKey = options?.apiKey || getAPIKey();
|
2166
3351
|
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
2167
3352
|
const trace = options?.trace ?? defaultTrace;
|
2168
|
-
const
|
3353
|
+
const clientName = options?.clientName;
|
3354
|
+
const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({
|
3355
|
+
apiKey,
|
3356
|
+
databaseURL,
|
3357
|
+
fetchImpl: options?.fetch,
|
3358
|
+
clientName: options?.clientName
|
3359
|
+
});
|
2169
3360
|
if (!apiKey) {
|
2170
3361
|
throw new Error("Option apiKey is required");
|
2171
3362
|
}
|
2172
3363
|
if (!databaseURL) {
|
2173
3364
|
throw new Error("Option databaseURL is required");
|
2174
3365
|
}
|
2175
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace };
|
2176
|
-
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
3366
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID(), enableBrowser, clientName };
|
3367
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
3368
|
+
fetch,
|
3369
|
+
apiKey,
|
3370
|
+
databaseURL,
|
3371
|
+
branch,
|
3372
|
+
trace,
|
3373
|
+
clientID,
|
3374
|
+
clientName
|
3375
|
+
}) {
|
2177
3376
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2178
3377
|
if (!branchValue)
|
2179
3378
|
throw new Error("Unable to resolve branch value");
|
@@ -2183,10 +3382,12 @@ const buildClient = (plugins) => {
|
|
2183
3382
|
apiUrl: "",
|
2184
3383
|
workspacesApiUrl: (path, params) => {
|
2185
3384
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2186
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3385
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2187
3386
|
return databaseURL + newPath;
|
2188
3387
|
},
|
2189
|
-
trace
|
3388
|
+
trace,
|
3389
|
+
clientID,
|
3390
|
+
clientName
|
2190
3391
|
};
|
2191
3392
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2192
3393
|
if (__privateGet(this, _branch))
|
@@ -2277,7 +3478,7 @@ const deserialize = (json) => {
|
|
2277
3478
|
};
|
2278
3479
|
|
2279
3480
|
function buildWorkerRunner(config) {
|
2280
|
-
return function xataWorker(name,
|
3481
|
+
return function xataWorker(name, worker) {
|
2281
3482
|
return async (...args) => {
|
2282
3483
|
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
2283
3484
|
const result = await fetch(url, {
|
@@ -2299,6 +3500,7 @@ class XataError extends Error {
|
|
2299
3500
|
}
|
2300
3501
|
|
2301
3502
|
exports.BaseClient = BaseClient;
|
3503
|
+
exports.FetcherError = FetcherError;
|
2302
3504
|
exports.Operations = operationsByTag;
|
2303
3505
|
exports.PAGINATION_DEFAULT_OFFSET = PAGINATION_DEFAULT_OFFSET;
|
2304
3506
|
exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
|
@@ -2320,13 +3522,20 @@ exports.XataPlugin = XataPlugin;
|
|
2320
3522
|
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
2321
3523
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
2322
3524
|
exports.addTableColumn = addTableColumn;
|
3525
|
+
exports.aggregateTable = aggregateTable;
|
3526
|
+
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
3527
|
+
exports.branchTransaction = branchTransaction;
|
2323
3528
|
exports.buildClient = buildClient;
|
2324
3529
|
exports.buildWorkerRunner = buildWorkerRunner;
|
2325
3530
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
2326
3531
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
3532
|
+
exports.compareBranchSchemas = compareBranchSchemas;
|
3533
|
+
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
3534
|
+
exports.compareMigrationRequest = compareMigrationRequest;
|
2327
3535
|
exports.contains = contains;
|
2328
3536
|
exports.createBranch = createBranch;
|
2329
3537
|
exports.createDatabase = createDatabase;
|
3538
|
+
exports.createMigrationRequest = createMigrationRequest;
|
2330
3539
|
exports.createTable = createTable;
|
2331
3540
|
exports.createUserAPIKey = createUserAPIKey;
|
2332
3541
|
exports.createWorkspace = createWorkspace;
|
@@ -2350,6 +3559,7 @@ exports.getBranchList = getBranchList;
|
|
2350
3559
|
exports.getBranchMetadata = getBranchMetadata;
|
2351
3560
|
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
2352
3561
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
3562
|
+
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
2353
3563
|
exports.getBranchStats = getBranchStats;
|
2354
3564
|
exports.getColumn = getColumn;
|
2355
3565
|
exports.getCurrentBranchDetails = getCurrentBranchDetails;
|
@@ -2358,6 +3568,9 @@ exports.getDatabaseList = getDatabaseList;
|
|
2358
3568
|
exports.getDatabaseMetadata = getDatabaseMetadata;
|
2359
3569
|
exports.getDatabaseURL = getDatabaseURL;
|
2360
3570
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
3571
|
+
exports.getHostUrl = getHostUrl;
|
3572
|
+
exports.getMigrationRequest = getMigrationRequest;
|
3573
|
+
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
2361
3574
|
exports.getRecord = getRecord;
|
2362
3575
|
exports.getTableColumns = getTableColumns;
|
2363
3576
|
exports.getTableSchema = getTableSchema;
|
@@ -2380,6 +3593,8 @@ exports.insertRecordWithID = insertRecordWithID;
|
|
2380
3593
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
2381
3594
|
exports.is = is;
|
2382
3595
|
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
3596
|
+
exports.isHostProviderAlias = isHostProviderAlias;
|
3597
|
+
exports.isHostProviderBuilder = isHostProviderBuilder;
|
2383
3598
|
exports.isIdentifiable = isIdentifiable;
|
2384
3599
|
exports.isNot = isNot;
|
2385
3600
|
exports.isXataRecord = isXataRecord;
|
@@ -2387,11 +3602,18 @@ exports.le = le;
|
|
2387
3602
|
exports.lessEquals = lessEquals;
|
2388
3603
|
exports.lessThan = lessThan;
|
2389
3604
|
exports.lessThanEquals = lessThanEquals;
|
3605
|
+
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
3606
|
+
exports.listRegions = listRegions;
|
2390
3607
|
exports.lt = lt;
|
2391
3608
|
exports.lte = lte;
|
3609
|
+
exports.mergeMigrationRequest = mergeMigrationRequest;
|
2392
3610
|
exports.notExists = notExists;
|
2393
3611
|
exports.operationsByTag = operationsByTag;
|
3612
|
+
exports.parseProviderString = parseProviderString;
|
3613
|
+
exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
|
2394
3614
|
exports.pattern = pattern;
|
3615
|
+
exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
|
3616
|
+
exports.queryMigrationRequests = queryMigrationRequests;
|
2395
3617
|
exports.queryTable = queryTable;
|
2396
3618
|
exports.removeGitBranchesEntry = removeGitBranchesEntry;
|
2397
3619
|
exports.removeWorkspaceMember = removeWorkspaceMember;
|
@@ -2402,8 +3624,12 @@ exports.searchTable = searchTable;
|
|
2402
3624
|
exports.serialize = serialize;
|
2403
3625
|
exports.setTableSchema = setTableSchema;
|
2404
3626
|
exports.startsWith = startsWith;
|
3627
|
+
exports.summarizeTable = summarizeTable;
|
2405
3628
|
exports.updateBranchMetadata = updateBranchMetadata;
|
3629
|
+
exports.updateBranchSchema = updateBranchSchema;
|
2406
3630
|
exports.updateColumn = updateColumn;
|
3631
|
+
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
3632
|
+
exports.updateMigrationRequest = updateMigrationRequest;
|
2407
3633
|
exports.updateRecordWithID = updateRecordWithID;
|
2408
3634
|
exports.updateTable = updateTable;
|
2409
3635
|
exports.updateUser = updateUser;
|