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