@xata.io/client 0.0.0-alpha.vfbbe3c7 → 0.0.0-alpha.vfbde008
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +3 -2
- package/.turbo/turbo-add-version.log +4 -0
- package/.turbo/turbo-build.log +13 -0
- package/CHANGELOG.md +260 -0
- package/README.md +3 -267
- package/dist/index.cjs +2294 -725
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5374 -1522
- package/dist/index.mjs +2255 -708
- package/dist/index.mjs.map +1 -1
- package/package.json +8 -9
- package/rollup.config.mjs +44 -0
- package/Usage.md +0 -428
- package/rollup.config.js +0 -29
package/dist/index.cjs
CHANGED
@@ -1,24 +1,27 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
3
|
+
const defaultTrace = async (name, fn, _options) => {
|
4
|
+
return await fn({
|
5
|
+
name,
|
6
|
+
setAttributes: () => {
|
7
|
+
return;
|
8
|
+
}
|
9
|
+
});
|
10
|
+
};
|
11
|
+
const TraceAttributes = {
|
12
|
+
KIND: "xata.trace.kind",
|
13
|
+
VERSION: "xata.sdk.version",
|
14
|
+
TABLE: "xata.table",
|
15
|
+
HTTP_REQUEST_ID: "http.request_id",
|
16
|
+
HTTP_STATUS_CODE: "http.status_code",
|
17
|
+
HTTP_HOST: "http.host",
|
18
|
+
HTTP_SCHEME: "http.scheme",
|
19
|
+
HTTP_USER_AGENT: "http.user_agent",
|
20
|
+
HTTP_METHOD: "http.method",
|
21
|
+
HTTP_URL: "http.url",
|
22
|
+
HTTP_ROUTE: "http.route",
|
23
|
+
HTTP_TARGET: "http.target"
|
24
|
+
};
|
22
25
|
|
23
26
|
function notEmpty(value) {
|
24
27
|
return value !== null && value !== void 0;
|
@@ -38,6 +41,21 @@ function isString(value) {
|
|
38
41
|
function isStringArray(value) {
|
39
42
|
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
40
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
|
+
}
|
41
59
|
function toBase64(value) {
|
42
60
|
try {
|
43
61
|
return btoa(value);
|
@@ -46,10 +64,31 @@ function toBase64(value) {
|
|
46
64
|
return buf.from(value).toString("base64");
|
47
65
|
}
|
48
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
|
+
}
|
49
88
|
|
50
89
|
function getEnvironment() {
|
51
90
|
try {
|
52
|
-
if (
|
91
|
+
if (isDefined(process) && isDefined(process.env)) {
|
53
92
|
return {
|
54
93
|
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
55
94
|
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
@@ -80,6 +119,25 @@ function getEnvironment() {
|
|
80
119
|
fallbackBranch: getGlobalFallbackBranch()
|
81
120
|
};
|
82
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
|
+
}
|
83
141
|
function getGlobalApiKey() {
|
84
142
|
try {
|
85
143
|
return XATA_API_KEY;
|
@@ -117,8 +175,6 @@ async function getGitBranch() {
|
|
117
175
|
if (typeof require === "function") {
|
118
176
|
return require(nodeModule).execSync(fullCmd, execOptions).trim();
|
119
177
|
}
|
120
|
-
const { execSync } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(nodeModule);
|
121
|
-
return execSync(fullCmd, execOptions).toString().trim();
|
122
178
|
} catch (err) {
|
123
179
|
}
|
124
180
|
try {
|
@@ -139,16 +195,114 @@ function getAPIKey() {
|
|
139
195
|
}
|
140
196
|
}
|
141
197
|
|
198
|
+
var __accessCheck$8 = (obj, member, msg) => {
|
199
|
+
if (!member.has(obj))
|
200
|
+
throw TypeError("Cannot " + msg);
|
201
|
+
};
|
202
|
+
var __privateGet$8 = (obj, member, getter) => {
|
203
|
+
__accessCheck$8(obj, member, "read from private field");
|
204
|
+
return getter ? getter.call(obj) : member.get(obj);
|
205
|
+
};
|
206
|
+
var __privateAdd$8 = (obj, member, value) => {
|
207
|
+
if (member.has(obj))
|
208
|
+
throw TypeError("Cannot add the same private member more than once");
|
209
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
210
|
+
};
|
211
|
+
var __privateSet$8 = (obj, member, value, setter) => {
|
212
|
+
__accessCheck$8(obj, member, "write to private field");
|
213
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
214
|
+
return value;
|
215
|
+
};
|
216
|
+
var __privateMethod$4 = (obj, member, method) => {
|
217
|
+
__accessCheck$8(obj, member, "access private method");
|
218
|
+
return method;
|
219
|
+
};
|
220
|
+
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
142
221
|
function getFetchImplementation(userFetch) {
|
143
222
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
144
223
|
const fetchImpl = userFetch ?? globalFetch;
|
145
224
|
if (!fetchImpl) {
|
146
|
-
throw new Error(
|
225
|
+
throw new Error(
|
226
|
+
`Couldn't find \`fetch\`. Install a fetch implementation such as \`node-fetch\` and pass it explicitly.`
|
227
|
+
);
|
147
228
|
}
|
148
229
|
return fetchImpl;
|
149
230
|
}
|
231
|
+
class ApiRequestPool {
|
232
|
+
constructor(concurrency = 10) {
|
233
|
+
__privateAdd$8(this, _enqueue);
|
234
|
+
__privateAdd$8(this, _fetch, void 0);
|
235
|
+
__privateAdd$8(this, _queue, void 0);
|
236
|
+
__privateAdd$8(this, _concurrency, void 0);
|
237
|
+
__privateSet$8(this, _queue, []);
|
238
|
+
__privateSet$8(this, _concurrency, concurrency);
|
239
|
+
this.running = 0;
|
240
|
+
this.started = 0;
|
241
|
+
}
|
242
|
+
setFetch(fetch2) {
|
243
|
+
__privateSet$8(this, _fetch, fetch2);
|
244
|
+
}
|
245
|
+
getFetch() {
|
246
|
+
if (!__privateGet$8(this, _fetch)) {
|
247
|
+
throw new Error("Fetch not set");
|
248
|
+
}
|
249
|
+
return __privateGet$8(this, _fetch);
|
250
|
+
}
|
251
|
+
request(url, options) {
|
252
|
+
const start = new Date();
|
253
|
+
const fetch2 = this.getFetch();
|
254
|
+
const runRequest = async (stalled = false) => {
|
255
|
+
const response = await fetch2(url, options);
|
256
|
+
if (response.status === 429) {
|
257
|
+
const rateLimitReset = parseNumber(response.headers?.get("x-ratelimit-reset")) ?? 1;
|
258
|
+
await timeout(rateLimitReset * 1e3);
|
259
|
+
return await runRequest(true);
|
260
|
+
}
|
261
|
+
if (stalled) {
|
262
|
+
const stalledTime = new Date().getTime() - start.getTime();
|
263
|
+
console.warn(`A request to Xata hit your workspace limits, was retried and stalled for ${stalledTime}ms`);
|
264
|
+
}
|
265
|
+
return response;
|
266
|
+
};
|
267
|
+
return __privateMethod$4(this, _enqueue, enqueue_fn).call(this, async () => {
|
268
|
+
return await runRequest();
|
269
|
+
});
|
270
|
+
}
|
271
|
+
}
|
272
|
+
_fetch = new WeakMap();
|
273
|
+
_queue = new WeakMap();
|
274
|
+
_concurrency = new WeakMap();
|
275
|
+
_enqueue = new WeakSet();
|
276
|
+
enqueue_fn = function(task) {
|
277
|
+
const promise = new Promise((resolve) => __privateGet$8(this, _queue).push(resolve)).finally(() => {
|
278
|
+
this.started--;
|
279
|
+
this.running++;
|
280
|
+
}).then(() => task()).finally(() => {
|
281
|
+
this.running--;
|
282
|
+
const next = __privateGet$8(this, _queue).shift();
|
283
|
+
if (next !== void 0) {
|
284
|
+
this.started++;
|
285
|
+
next();
|
286
|
+
}
|
287
|
+
});
|
288
|
+
if (this.running + this.started < __privateGet$8(this, _concurrency)) {
|
289
|
+
const next = __privateGet$8(this, _queue).shift();
|
290
|
+
if (next !== void 0) {
|
291
|
+
this.started++;
|
292
|
+
next();
|
293
|
+
}
|
294
|
+
}
|
295
|
+
return promise;
|
296
|
+
};
|
297
|
+
|
298
|
+
function generateUUID() {
|
299
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
300
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
301
|
+
return v.toString(16);
|
302
|
+
});
|
303
|
+
}
|
150
304
|
|
151
|
-
const VERSION = "0.
|
305
|
+
const VERSION = "0.22.1";
|
152
306
|
|
153
307
|
class ErrorWithCause extends Error {
|
154
308
|
constructor(message, options) {
|
@@ -159,7 +313,7 @@ class FetcherError extends ErrorWithCause {
|
|
159
313
|
constructor(status, data, requestId) {
|
160
314
|
super(getMessage(data));
|
161
315
|
this.status = status;
|
162
|
-
this.errors = isBulkError(data) ? data.errors :
|
316
|
+
this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
|
163
317
|
this.requestId = requestId;
|
164
318
|
if (data instanceof Error) {
|
165
319
|
this.stack = data.stack;
|
@@ -191,6 +345,7 @@ function getMessage(data) {
|
|
191
345
|
}
|
192
346
|
}
|
193
347
|
|
348
|
+
const pool = new ApiRequestPool();
|
194
349
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
195
350
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
196
351
|
if (value === void 0 || value === null)
|
@@ -199,299 +354,269 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
199
354
|
}, {});
|
200
355
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
201
356
|
const queryString = query.length > 0 ? `?${query}` : "";
|
202
|
-
|
357
|
+
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
358
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
|
359
|
+
}, {});
|
360
|
+
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
203
361
|
};
|
204
362
|
function buildBaseUrl({
|
363
|
+
endpoint,
|
205
364
|
path,
|
206
365
|
workspacesApiUrl,
|
207
366
|
apiUrl,
|
208
|
-
pathParams
|
367
|
+
pathParams = {}
|
209
368
|
}) {
|
210
|
-
if (
|
211
|
-
|
212
|
-
|
213
|
-
|
369
|
+
if (endpoint === "dataPlane") {
|
370
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
371
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
372
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
373
|
+
}
|
374
|
+
return `${apiUrl}${path}`;
|
214
375
|
}
|
215
376
|
function hostHeader(url) {
|
216
377
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
217
378
|
const { groups } = pattern.exec(url) ?? {};
|
218
379
|
return groups?.host ? { Host: groups.host } : {};
|
219
380
|
}
|
381
|
+
const defaultClientID = generateUUID();
|
220
382
|
async function fetch$1({
|
221
383
|
url: path,
|
222
384
|
method,
|
223
385
|
body,
|
224
|
-
headers,
|
386
|
+
headers: customHeaders,
|
225
387
|
pathParams,
|
226
388
|
queryParams,
|
227
389
|
fetchImpl,
|
228
390
|
apiKey,
|
391
|
+
endpoint,
|
229
392
|
apiUrl,
|
230
|
-
workspacesApiUrl
|
393
|
+
workspacesApiUrl,
|
394
|
+
trace,
|
395
|
+
signal,
|
396
|
+
clientID,
|
397
|
+
sessionID,
|
398
|
+
clientName,
|
399
|
+
xataAgentExtra,
|
400
|
+
fetchOptions = {}
|
231
401
|
}) {
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
402
|
+
pool.setFetch(fetchImpl);
|
403
|
+
return await trace(
|
404
|
+
`${method.toUpperCase()} ${path}`,
|
405
|
+
async ({ setAttributes }) => {
|
406
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
407
|
+
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
408
|
+
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
409
|
+
setAttributes({
|
410
|
+
[TraceAttributes.HTTP_URL]: url,
|
411
|
+
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
412
|
+
});
|
413
|
+
const xataAgent = compact([
|
414
|
+
["client", "TS_SDK"],
|
415
|
+
["version", VERSION],
|
416
|
+
isDefined(clientName) ? ["service", clientName] : void 0,
|
417
|
+
...Object.entries(xataAgentExtra ?? {})
|
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,
|
431
|
+
method: method.toUpperCase(),
|
432
|
+
body: body ? JSON.stringify(body) : void 0,
|
433
|
+
headers,
|
434
|
+
signal
|
435
|
+
});
|
436
|
+
const { host, protocol } = parseUrl(response.url);
|
437
|
+
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
438
|
+
setAttributes({
|
439
|
+
[TraceAttributes.KIND]: "http",
|
440
|
+
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
441
|
+
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
442
|
+
[TraceAttributes.HTTP_HOST]: host,
|
443
|
+
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
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
|
+
}
|
451
|
+
try {
|
452
|
+
const jsonResponse = await response.json();
|
453
|
+
if (response.ok) {
|
454
|
+
return jsonResponse;
|
455
|
+
}
|
456
|
+
throw new FetcherError(response.status, jsonResponse, requestId);
|
457
|
+
} catch (error) {
|
458
|
+
throw new FetcherError(response.status, error, requestId);
|
459
|
+
}
|
460
|
+
},
|
461
|
+
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
462
|
+
);
|
463
|
+
}
|
464
|
+
function parseUrl(url) {
|
250
465
|
try {
|
251
|
-
const
|
252
|
-
|
253
|
-
return jsonResponse;
|
254
|
-
}
|
255
|
-
throw new FetcherError(response.status, jsonResponse, requestId);
|
466
|
+
const { host, protocol } = new URL(url);
|
467
|
+
return { host, protocol };
|
256
468
|
} catch (error) {
|
257
|
-
|
469
|
+
return {};
|
258
470
|
}
|
259
471
|
}
|
260
472
|
|
261
|
-
const
|
262
|
-
|
263
|
-
const
|
264
|
-
const getUserAPIKeys = (variables) => fetch$1({
|
265
|
-
url: "/user/keys",
|
266
|
-
method: "get",
|
267
|
-
...variables
|
268
|
-
});
|
269
|
-
const createUserAPIKey = (variables) => fetch$1({
|
270
|
-
url: "/user/keys/{keyName}",
|
271
|
-
method: "post",
|
272
|
-
...variables
|
273
|
-
});
|
274
|
-
const deleteUserAPIKey = (variables) => fetch$1({
|
275
|
-
url: "/user/keys/{keyName}",
|
276
|
-
method: "delete",
|
277
|
-
...variables
|
278
|
-
});
|
279
|
-
const createWorkspace = (variables) => fetch$1({
|
280
|
-
url: "/workspaces",
|
281
|
-
method: "post",
|
282
|
-
...variables
|
283
|
-
});
|
284
|
-
const getWorkspacesList = (variables) => fetch$1({
|
285
|
-
url: "/workspaces",
|
286
|
-
method: "get",
|
287
|
-
...variables
|
288
|
-
});
|
289
|
-
const getWorkspace = (variables) => fetch$1({
|
290
|
-
url: "/workspaces/{workspaceId}",
|
291
|
-
method: "get",
|
292
|
-
...variables
|
293
|
-
});
|
294
|
-
const updateWorkspace = (variables) => fetch$1({
|
295
|
-
url: "/workspaces/{workspaceId}",
|
296
|
-
method: "put",
|
297
|
-
...variables
|
298
|
-
});
|
299
|
-
const deleteWorkspace = (variables) => fetch$1({
|
300
|
-
url: "/workspaces/{workspaceId}",
|
301
|
-
method: "delete",
|
302
|
-
...variables
|
303
|
-
});
|
304
|
-
const getWorkspaceMembersList = (variables) => fetch$1({
|
305
|
-
url: "/workspaces/{workspaceId}/members",
|
306
|
-
method: "get",
|
307
|
-
...variables
|
308
|
-
});
|
309
|
-
const updateWorkspaceMemberRole = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables });
|
310
|
-
const removeWorkspaceMember = (variables) => fetch$1({
|
311
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
312
|
-
method: "delete",
|
313
|
-
...variables
|
314
|
-
});
|
315
|
-
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
316
|
-
const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
317
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
318
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
319
|
-
method: "delete",
|
320
|
-
...variables
|
321
|
-
});
|
322
|
-
const resendWorkspaceMemberInvite = (variables) => fetch$1({
|
323
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}/resend",
|
324
|
-
method: "post",
|
325
|
-
...variables
|
326
|
-
});
|
327
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
328
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
329
|
-
method: "post",
|
330
|
-
...variables
|
331
|
-
});
|
332
|
-
const getDatabaseList = (variables) => fetch$1({
|
333
|
-
url: "/dbs",
|
334
|
-
method: "get",
|
335
|
-
...variables
|
336
|
-
});
|
337
|
-
const getBranchList = (variables) => fetch$1({
|
338
|
-
url: "/dbs/{dbName}",
|
339
|
-
method: "get",
|
340
|
-
...variables
|
341
|
-
});
|
342
|
-
const createDatabase = (variables) => fetch$1({
|
343
|
-
url: "/dbs/{dbName}",
|
344
|
-
method: "put",
|
345
|
-
...variables
|
346
|
-
});
|
347
|
-
const deleteDatabase = (variables) => fetch$1({
|
473
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
474
|
+
|
475
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
348
476
|
url: "/dbs/{dbName}",
|
349
|
-
method: "delete",
|
350
|
-
...variables
|
351
|
-
});
|
352
|
-
const getGitBranchesMapping = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables });
|
353
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
354
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
355
|
-
const resolveBranch = (variables) => fetch$1({
|
356
|
-
url: "/dbs/{dbName}/resolveBranch",
|
357
477
|
method: "get",
|
358
|
-
...variables
|
478
|
+
...variables,
|
479
|
+
signal
|
359
480
|
});
|
360
|
-
const getBranchDetails = (variables) =>
|
481
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
361
482
|
url: "/db/{dbBranchName}",
|
362
483
|
method: "get",
|
363
|
-
...variables
|
484
|
+
...variables,
|
485
|
+
signal
|
364
486
|
});
|
365
|
-
const createBranch = (variables) =>
|
366
|
-
const deleteBranch = (variables) =>
|
487
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
488
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
367
489
|
url: "/db/{dbBranchName}",
|
368
490
|
method: "delete",
|
369
|
-
...variables
|
491
|
+
...variables,
|
492
|
+
signal
|
370
493
|
});
|
371
|
-
const updateBranchMetadata = (variables) =>
|
494
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
372
495
|
url: "/db/{dbBranchName}/metadata",
|
373
496
|
method: "put",
|
374
|
-
...variables
|
497
|
+
...variables,
|
498
|
+
signal
|
375
499
|
});
|
376
|
-
const getBranchMetadata = (variables) =>
|
500
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
377
501
|
url: "/db/{dbBranchName}/metadata",
|
378
502
|
method: "get",
|
379
|
-
...variables
|
503
|
+
...variables,
|
504
|
+
signal
|
380
505
|
});
|
381
|
-
const
|
382
|
-
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
383
|
-
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
384
|
-
const getBranchStats = (variables) => fetch$1({
|
506
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
385
507
|
url: "/db/{dbBranchName}/stats",
|
386
508
|
method: "get",
|
387
|
-
...variables
|
509
|
+
...variables,
|
510
|
+
signal
|
511
|
+
});
|
512
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
513
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
514
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
515
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
516
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
517
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
518
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
519
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
520
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
521
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
522
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
523
|
+
method: "get",
|
524
|
+
...variables,
|
525
|
+
signal
|
388
526
|
});
|
389
|
-
const
|
527
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
528
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
529
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
530
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
531
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
532
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
533
|
+
method: "post",
|
534
|
+
...variables,
|
535
|
+
signal
|
536
|
+
});
|
537
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
538
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
539
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
540
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
541
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
542
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
543
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
390
544
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
391
545
|
method: "put",
|
392
|
-
...variables
|
546
|
+
...variables,
|
547
|
+
signal
|
393
548
|
});
|
394
|
-
const deleteTable = (variables) =>
|
549
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
395
550
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
396
551
|
method: "delete",
|
397
|
-
...variables
|
398
|
-
|
399
|
-
const updateTable = (variables) => fetch$1({
|
400
|
-
url: "/db/{dbBranchName}/tables/{tableName}",
|
401
|
-
method: "patch",
|
402
|
-
...variables
|
552
|
+
...variables,
|
553
|
+
signal
|
403
554
|
});
|
404
|
-
const
|
555
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
556
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
405
557
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
406
558
|
method: "get",
|
407
|
-
...variables
|
408
|
-
|
409
|
-
const setTableSchema = (variables) => fetch$1({
|
410
|
-
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
411
|
-
method: "put",
|
412
|
-
...variables
|
559
|
+
...variables,
|
560
|
+
signal
|
413
561
|
});
|
414
|
-
const
|
562
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
563
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
415
564
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
416
565
|
method: "get",
|
417
|
-
...variables
|
418
|
-
|
419
|
-
const addTableColumn = (variables) => fetch$1({
|
420
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
421
|
-
method: "post",
|
422
|
-
...variables
|
566
|
+
...variables,
|
567
|
+
signal
|
423
568
|
});
|
424
|
-
const
|
569
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
570
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
571
|
+
);
|
572
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
425
573
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
426
574
|
method: "get",
|
427
|
-
...variables
|
575
|
+
...variables,
|
576
|
+
signal
|
428
577
|
});
|
429
|
-
const
|
578
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
579
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
430
580
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
431
581
|
method: "delete",
|
432
|
-
...variables
|
582
|
+
...variables,
|
583
|
+
signal
|
433
584
|
});
|
434
|
-
const
|
435
|
-
|
436
|
-
|
437
|
-
...variables
|
438
|
-
});
|
439
|
-
const insertRecord = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables });
|
440
|
-
const insertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables });
|
441
|
-
const updateRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables });
|
442
|
-
const upsertRecordWithID = (variables) => fetch$1({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables });
|
443
|
-
const deleteRecord = (variables) => fetch$1({
|
444
|
-
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
445
|
-
method: "delete",
|
446
|
-
...variables
|
447
|
-
});
|
448
|
-
const getRecord = (variables) => fetch$1({
|
585
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
586
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
587
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
449
588
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
450
589
|
method: "get",
|
451
|
-
...variables
|
590
|
+
...variables,
|
591
|
+
signal
|
452
592
|
});
|
453
|
-
const
|
454
|
-
const
|
593
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
594
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
595
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
596
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
597
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
598
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
455
599
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
456
600
|
method: "post",
|
457
|
-
...variables
|
601
|
+
...variables,
|
602
|
+
signal
|
458
603
|
});
|
459
|
-
const
|
460
|
-
url: "/db/{dbBranchName}/
|
604
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
605
|
+
url: "/db/{dbBranchName}/search",
|
461
606
|
method: "post",
|
462
|
-
...variables
|
607
|
+
...variables,
|
608
|
+
signal
|
463
609
|
});
|
464
|
-
const
|
465
|
-
url: "/db/{dbBranchName}/search",
|
610
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
611
|
+
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
466
612
|
method: "post",
|
467
|
-
...variables
|
613
|
+
...variables,
|
614
|
+
signal
|
468
615
|
});
|
469
|
-
const
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
getWorkspacesList,
|
474
|
-
getWorkspace,
|
475
|
-
updateWorkspace,
|
476
|
-
deleteWorkspace,
|
477
|
-
getWorkspaceMembersList,
|
478
|
-
updateWorkspaceMemberRole,
|
479
|
-
removeWorkspaceMember,
|
480
|
-
inviteWorkspaceMember,
|
481
|
-
updateWorkspaceMemberInvite,
|
482
|
-
cancelWorkspaceMemberInvite,
|
483
|
-
resendWorkspaceMemberInvite,
|
484
|
-
acceptWorkspaceMemberInvite
|
485
|
-
},
|
486
|
-
database: {
|
487
|
-
getDatabaseList,
|
488
|
-
createDatabase,
|
489
|
-
deleteDatabase,
|
490
|
-
getGitBranchesMapping,
|
491
|
-
addGitBranchesEntry,
|
492
|
-
removeGitBranchesEntry,
|
493
|
-
resolveBranch
|
494
|
-
},
|
616
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch", method: "post", ...variables, signal });
|
617
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
618
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
619
|
+
const operationsByTag$2 = {
|
495
620
|
branch: {
|
496
621
|
getBranchList,
|
497
622
|
getBranchDetails,
|
@@ -499,10 +624,32 @@ const operationsByTag = {
|
|
499
624
|
deleteBranch,
|
500
625
|
updateBranchMetadata,
|
501
626
|
getBranchMetadata,
|
627
|
+
getBranchStats,
|
628
|
+
getGitBranchesMapping,
|
629
|
+
addGitBranchesEntry,
|
630
|
+
removeGitBranchesEntry,
|
631
|
+
resolveBranch
|
632
|
+
},
|
633
|
+
migrations: {
|
502
634
|
getBranchMigrationHistory,
|
503
|
-
executeBranchMigrationPlan,
|
504
635
|
getBranchMigrationPlan,
|
505
|
-
|
636
|
+
executeBranchMigrationPlan,
|
637
|
+
getBranchSchemaHistory,
|
638
|
+
compareBranchWithUserSchema,
|
639
|
+
compareBranchSchemas,
|
640
|
+
updateBranchSchema,
|
641
|
+
previewBranchSchemaEdit,
|
642
|
+
applyBranchSchemaEdit
|
643
|
+
},
|
644
|
+
migrationRequests: {
|
645
|
+
queryMigrationRequests,
|
646
|
+
createMigrationRequest,
|
647
|
+
getMigrationRequest,
|
648
|
+
updateMigrationRequest,
|
649
|
+
listMigrationRequestsCommits,
|
650
|
+
compareMigrationRequest,
|
651
|
+
getMigrationRequestIsMerged,
|
652
|
+
mergeMigrationRequest
|
506
653
|
},
|
507
654
|
table: {
|
508
655
|
createTable,
|
@@ -513,27 +660,166 @@ const operationsByTag = {
|
|
513
660
|
getTableColumns,
|
514
661
|
addTableColumn,
|
515
662
|
getColumn,
|
516
|
-
|
517
|
-
|
663
|
+
updateColumn,
|
664
|
+
deleteColumn
|
518
665
|
},
|
519
666
|
records: {
|
667
|
+
branchTransaction,
|
520
668
|
insertRecord,
|
669
|
+
getRecord,
|
521
670
|
insertRecordWithID,
|
522
671
|
updateRecordWithID,
|
523
672
|
upsertRecordWithID,
|
524
673
|
deleteRecord,
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
674
|
+
bulkInsertTableRecords
|
675
|
+
},
|
676
|
+
searchAndFilter: { queryTable, searchBranch, searchTable, vectorSearchTable, summarizeTable, aggregateTable }
|
677
|
+
};
|
678
|
+
|
679
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
680
|
+
|
681
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
682
|
+
url: "/user",
|
683
|
+
method: "get",
|
684
|
+
...variables,
|
685
|
+
signal
|
686
|
+
});
|
687
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
688
|
+
url: "/user",
|
689
|
+
method: "put",
|
690
|
+
...variables,
|
691
|
+
signal
|
692
|
+
});
|
693
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
694
|
+
url: "/user",
|
695
|
+
method: "delete",
|
696
|
+
...variables,
|
697
|
+
signal
|
698
|
+
});
|
699
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
700
|
+
url: "/user/keys",
|
701
|
+
method: "get",
|
702
|
+
...variables,
|
703
|
+
signal
|
704
|
+
});
|
705
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
706
|
+
url: "/user/keys/{keyName}",
|
707
|
+
method: "post",
|
708
|
+
...variables,
|
709
|
+
signal
|
710
|
+
});
|
711
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
712
|
+
url: "/user/keys/{keyName}",
|
713
|
+
method: "delete",
|
714
|
+
...variables,
|
715
|
+
signal
|
716
|
+
});
|
717
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
718
|
+
url: "/workspaces",
|
719
|
+
method: "get",
|
720
|
+
...variables,
|
721
|
+
signal
|
722
|
+
});
|
723
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
724
|
+
url: "/workspaces",
|
725
|
+
method: "post",
|
726
|
+
...variables,
|
727
|
+
signal
|
728
|
+
});
|
729
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
730
|
+
url: "/workspaces/{workspaceId}",
|
731
|
+
method: "get",
|
732
|
+
...variables,
|
733
|
+
signal
|
734
|
+
});
|
735
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
736
|
+
url: "/workspaces/{workspaceId}",
|
737
|
+
method: "put",
|
738
|
+
...variables,
|
739
|
+
signal
|
740
|
+
});
|
741
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
742
|
+
url: "/workspaces/{workspaceId}",
|
743
|
+
method: "delete",
|
744
|
+
...variables,
|
745
|
+
signal
|
746
|
+
});
|
747
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
748
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
749
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
750
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
751
|
+
method: "delete",
|
752
|
+
...variables,
|
753
|
+
signal
|
754
|
+
});
|
755
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
756
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
757
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
758
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
759
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
760
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
761
|
+
url: "/workspaces/{workspaceId}/dbs",
|
762
|
+
method: "get",
|
763
|
+
...variables,
|
764
|
+
signal
|
765
|
+
});
|
766
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
767
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
768
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
769
|
+
method: "delete",
|
770
|
+
...variables,
|
771
|
+
signal
|
772
|
+
});
|
773
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
774
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
775
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "get", ...variables, signal });
|
776
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "put", ...variables, signal });
|
777
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "delete", ...variables, signal });
|
778
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
779
|
+
url: "/workspaces/{workspaceId}/regions",
|
780
|
+
method: "get",
|
781
|
+
...variables,
|
782
|
+
signal
|
783
|
+
});
|
784
|
+
const operationsByTag$1 = {
|
785
|
+
users: { getUser, updateUser, deleteUser },
|
786
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
787
|
+
workspaces: {
|
788
|
+
getWorkspacesList,
|
789
|
+
createWorkspace,
|
790
|
+
getWorkspace,
|
791
|
+
updateWorkspace,
|
792
|
+
deleteWorkspace,
|
793
|
+
getWorkspaceMembersList,
|
794
|
+
updateWorkspaceMemberRole,
|
795
|
+
removeWorkspaceMember
|
796
|
+
},
|
797
|
+
invites: {
|
798
|
+
inviteWorkspaceMember,
|
799
|
+
updateWorkspaceMemberInvite,
|
800
|
+
cancelWorkspaceMemberInvite,
|
801
|
+
acceptWorkspaceMemberInvite,
|
802
|
+
resendWorkspaceMemberInvite
|
803
|
+
},
|
804
|
+
databases: {
|
805
|
+
getDatabaseList,
|
806
|
+
createDatabase,
|
807
|
+
deleteDatabase,
|
808
|
+
getDatabaseMetadata,
|
809
|
+
updateDatabaseMetadata,
|
810
|
+
getDatabaseGithubSettings,
|
811
|
+
updateDatabaseGithubSettings,
|
812
|
+
deleteDatabaseGithubSettings,
|
813
|
+
listRegions
|
530
814
|
}
|
531
815
|
};
|
532
816
|
|
817
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
818
|
+
|
533
819
|
function getHostUrl(provider, type) {
|
534
|
-
if (
|
820
|
+
if (isHostProviderAlias(provider)) {
|
535
821
|
return providers[provider][type];
|
536
|
-
} else if (
|
822
|
+
} else if (isHostProviderBuilder(provider)) {
|
537
823
|
return provider[type];
|
538
824
|
}
|
539
825
|
throw new Error("Invalid API provider");
|
@@ -541,19 +827,40 @@ function getHostUrl(provider, type) {
|
|
541
827
|
const providers = {
|
542
828
|
production: {
|
543
829
|
main: "https://api.xata.io",
|
544
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
830
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
545
831
|
},
|
546
832
|
staging: {
|
547
|
-
main: "https://staging.
|
548
|
-
workspaces: "https://{workspaceId}.staging.
|
833
|
+
main: "https://api.staging-xata.dev",
|
834
|
+
workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
|
549
835
|
}
|
550
836
|
};
|
551
|
-
function
|
837
|
+
function isHostProviderAlias(alias) {
|
552
838
|
return isString(alias) && Object.keys(providers).includes(alias);
|
553
839
|
}
|
554
|
-
function
|
840
|
+
function isHostProviderBuilder(builder) {
|
555
841
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
556
842
|
}
|
843
|
+
function parseProviderString(provider = "production") {
|
844
|
+
if (isHostProviderAlias(provider)) {
|
845
|
+
return provider;
|
846
|
+
}
|
847
|
+
const [main, workspaces] = provider.split(",");
|
848
|
+
if (!main || !workspaces)
|
849
|
+
return null;
|
850
|
+
return { main, workspaces };
|
851
|
+
}
|
852
|
+
function parseWorkspacesUrlParts(url) {
|
853
|
+
if (!isString(url))
|
854
|
+
return null;
|
855
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
|
856
|
+
const regexDev = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/;
|
857
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/;
|
858
|
+
const regexProdTesting = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.tech.*/;
|
859
|
+
const match = url.match(regex) || url.match(regexDev) || url.match(regexStaging) || url.match(regexProdTesting);
|
860
|
+
if (!match)
|
861
|
+
return null;
|
862
|
+
return { workspace: match[1], region: match[2] };
|
863
|
+
}
|
557
864
|
|
558
865
|
var __accessCheck$7 = (obj, member, msg) => {
|
559
866
|
if (!member.has(obj))
|
@@ -579,7 +886,9 @@ class XataApiClient {
|
|
579
886
|
__privateAdd$7(this, _extraProps, void 0);
|
580
887
|
__privateAdd$7(this, _namespaces, {});
|
581
888
|
const provider = options.host ?? "production";
|
582
|
-
const apiKey = options
|
889
|
+
const apiKey = options.apiKey ?? getAPIKey();
|
890
|
+
const trace = options.trace ?? defaultTrace;
|
891
|
+
const clientID = generateUUID();
|
583
892
|
if (!apiKey) {
|
584
893
|
throw new Error("Could not resolve a valid apiKey");
|
585
894
|
}
|
@@ -587,7 +896,11 @@ class XataApiClient {
|
|
587
896
|
apiUrl: getHostUrl(provider, "main"),
|
588
897
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
589
898
|
fetchImpl: getFetchImplementation(options.fetch),
|
590
|
-
apiKey
|
899
|
+
apiKey,
|
900
|
+
trace,
|
901
|
+
clientName: options.clientName,
|
902
|
+
xataAgentExtra: options.xataAgentExtra,
|
903
|
+
clientID
|
591
904
|
});
|
592
905
|
}
|
593
906
|
get user() {
|
@@ -595,21 +908,41 @@ class XataApiClient {
|
|
595
908
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
596
909
|
return __privateGet$7(this, _namespaces).user;
|
597
910
|
}
|
911
|
+
get authentication() {
|
912
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
913
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
914
|
+
return __privateGet$7(this, _namespaces).authentication;
|
915
|
+
}
|
598
916
|
get workspaces() {
|
599
917
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
600
918
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
601
919
|
return __privateGet$7(this, _namespaces).workspaces;
|
602
920
|
}
|
603
|
-
get
|
604
|
-
if (!__privateGet$7(this, _namespaces).
|
605
|
-
__privateGet$7(this, _namespaces).
|
606
|
-
return __privateGet$7(this, _namespaces).
|
921
|
+
get invites() {
|
922
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
923
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
924
|
+
return __privateGet$7(this, _namespaces).invites;
|
925
|
+
}
|
926
|
+
get database() {
|
927
|
+
if (!__privateGet$7(this, _namespaces).database)
|
928
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
929
|
+
return __privateGet$7(this, _namespaces).database;
|
607
930
|
}
|
608
931
|
get branches() {
|
609
932
|
if (!__privateGet$7(this, _namespaces).branches)
|
610
933
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
611
934
|
return __privateGet$7(this, _namespaces).branches;
|
612
935
|
}
|
936
|
+
get migrations() {
|
937
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
938
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
939
|
+
return __privateGet$7(this, _namespaces).migrations;
|
940
|
+
}
|
941
|
+
get migrationRequests() {
|
942
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
943
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
944
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
945
|
+
}
|
613
946
|
get tables() {
|
614
947
|
if (!__privateGet$7(this, _namespaces).tables)
|
615
948
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -620,6 +953,11 @@ class XataApiClient {
|
|
620
953
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
621
954
|
return __privateGet$7(this, _namespaces).records;
|
622
955
|
}
|
956
|
+
get searchAndFilter() {
|
957
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
958
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
959
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
960
|
+
}
|
623
961
|
}
|
624
962
|
_extraProps = new WeakMap();
|
625
963
|
_namespaces = new WeakMap();
|
@@ -630,24 +968,29 @@ class UserApi {
|
|
630
968
|
getUser() {
|
631
969
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
632
970
|
}
|
633
|
-
updateUser(user) {
|
971
|
+
updateUser({ user }) {
|
634
972
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
635
973
|
}
|
636
974
|
deleteUser() {
|
637
975
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
638
976
|
}
|
977
|
+
}
|
978
|
+
class AuthenticationApi {
|
979
|
+
constructor(extraProps) {
|
980
|
+
this.extraProps = extraProps;
|
981
|
+
}
|
639
982
|
getUserAPIKeys() {
|
640
|
-
return operationsByTag.
|
983
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
641
984
|
}
|
642
|
-
createUserAPIKey(
|
643
|
-
return operationsByTag.
|
644
|
-
pathParams: { keyName },
|
985
|
+
createUserAPIKey({ name }) {
|
986
|
+
return operationsByTag.authentication.createUserAPIKey({
|
987
|
+
pathParams: { keyName: name },
|
645
988
|
...this.extraProps
|
646
989
|
});
|
647
990
|
}
|
648
|
-
deleteUserAPIKey(
|
649
|
-
return operationsByTag.
|
650
|
-
pathParams: { keyName },
|
991
|
+
deleteUserAPIKey({ name }) {
|
992
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
993
|
+
pathParams: { keyName: name },
|
651
994
|
...this.extraProps
|
652
995
|
});
|
653
996
|
}
|
@@ -656,353 +999,929 @@ class WorkspaceApi {
|
|
656
999
|
constructor(extraProps) {
|
657
1000
|
this.extraProps = extraProps;
|
658
1001
|
}
|
659
|
-
|
1002
|
+
getWorkspacesList() {
|
1003
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
1004
|
+
}
|
1005
|
+
createWorkspace({ data }) {
|
660
1006
|
return operationsByTag.workspaces.createWorkspace({
|
661
|
-
body:
|
1007
|
+
body: data,
|
662
1008
|
...this.extraProps
|
663
1009
|
});
|
664
1010
|
}
|
665
|
-
|
666
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
667
|
-
}
|
668
|
-
getWorkspace(workspaceId) {
|
1011
|
+
getWorkspace({ workspace }) {
|
669
1012
|
return operationsByTag.workspaces.getWorkspace({
|
670
|
-
pathParams: { workspaceId },
|
1013
|
+
pathParams: { workspaceId: workspace },
|
671
1014
|
...this.extraProps
|
672
1015
|
});
|
673
1016
|
}
|
674
|
-
updateWorkspace(
|
1017
|
+
updateWorkspace({
|
1018
|
+
workspace,
|
1019
|
+
update
|
1020
|
+
}) {
|
675
1021
|
return operationsByTag.workspaces.updateWorkspace({
|
676
|
-
pathParams: { workspaceId },
|
677
|
-
body:
|
1022
|
+
pathParams: { workspaceId: workspace },
|
1023
|
+
body: update,
|
678
1024
|
...this.extraProps
|
679
1025
|
});
|
680
1026
|
}
|
681
|
-
deleteWorkspace(
|
1027
|
+
deleteWorkspace({ workspace }) {
|
682
1028
|
return operationsByTag.workspaces.deleteWorkspace({
|
683
|
-
pathParams: { workspaceId },
|
1029
|
+
pathParams: { workspaceId: workspace },
|
684
1030
|
...this.extraProps
|
685
1031
|
});
|
686
1032
|
}
|
687
|
-
getWorkspaceMembersList(
|
1033
|
+
getWorkspaceMembersList({ workspace }) {
|
688
1034
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
689
|
-
pathParams: { workspaceId },
|
1035
|
+
pathParams: { workspaceId: workspace },
|
690
1036
|
...this.extraProps
|
691
1037
|
});
|
692
1038
|
}
|
693
|
-
updateWorkspaceMemberRole(
|
1039
|
+
updateWorkspaceMemberRole({
|
1040
|
+
workspace,
|
1041
|
+
user,
|
1042
|
+
role
|
1043
|
+
}) {
|
694
1044
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
695
|
-
pathParams: { workspaceId, userId },
|
1045
|
+
pathParams: { workspaceId: workspace, userId: user },
|
696
1046
|
body: { role },
|
697
1047
|
...this.extraProps
|
698
1048
|
});
|
699
1049
|
}
|
700
|
-
removeWorkspaceMember(
|
1050
|
+
removeWorkspaceMember({
|
1051
|
+
workspace,
|
1052
|
+
user
|
1053
|
+
}) {
|
701
1054
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
702
|
-
pathParams: { workspaceId, userId },
|
1055
|
+
pathParams: { workspaceId: workspace, userId: user },
|
703
1056
|
...this.extraProps
|
704
1057
|
});
|
705
1058
|
}
|
706
|
-
|
707
|
-
|
708
|
-
|
1059
|
+
}
|
1060
|
+
class InvitesApi {
|
1061
|
+
constructor(extraProps) {
|
1062
|
+
this.extraProps = extraProps;
|
1063
|
+
}
|
1064
|
+
inviteWorkspaceMember({
|
1065
|
+
workspace,
|
1066
|
+
email,
|
1067
|
+
role
|
1068
|
+
}) {
|
1069
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
1070
|
+
pathParams: { workspaceId: workspace },
|
709
1071
|
body: { email, role },
|
710
1072
|
...this.extraProps
|
711
1073
|
});
|
712
1074
|
}
|
713
|
-
updateWorkspaceMemberInvite(
|
714
|
-
|
715
|
-
|
1075
|
+
updateWorkspaceMemberInvite({
|
1076
|
+
workspace,
|
1077
|
+
invite,
|
1078
|
+
role
|
1079
|
+
}) {
|
1080
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
1081
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
716
1082
|
body: { role },
|
717
1083
|
...this.extraProps
|
718
1084
|
});
|
719
1085
|
}
|
720
|
-
cancelWorkspaceMemberInvite(
|
721
|
-
|
722
|
-
|
1086
|
+
cancelWorkspaceMemberInvite({
|
1087
|
+
workspace,
|
1088
|
+
invite
|
1089
|
+
}) {
|
1090
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
1091
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
723
1092
|
...this.extraProps
|
724
1093
|
});
|
725
1094
|
}
|
726
|
-
|
727
|
-
|
728
|
-
|
1095
|
+
acceptWorkspaceMemberInvite({
|
1096
|
+
workspace,
|
1097
|
+
key
|
1098
|
+
}) {
|
1099
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
1100
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
729
1101
|
...this.extraProps
|
730
1102
|
});
|
731
1103
|
}
|
732
|
-
|
733
|
-
|
734
|
-
|
1104
|
+
resendWorkspaceMemberInvite({
|
1105
|
+
workspace,
|
1106
|
+
invite
|
1107
|
+
}) {
|
1108
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
1109
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
735
1110
|
...this.extraProps
|
736
1111
|
});
|
737
1112
|
}
|
738
1113
|
}
|
739
|
-
class
|
1114
|
+
class BranchApi {
|
740
1115
|
constructor(extraProps) {
|
741
1116
|
this.extraProps = extraProps;
|
742
1117
|
}
|
743
|
-
|
744
|
-
|
745
|
-
|
1118
|
+
getBranchList({
|
1119
|
+
workspace,
|
1120
|
+
region,
|
1121
|
+
database
|
1122
|
+
}) {
|
1123
|
+
return operationsByTag.branch.getBranchList({
|
1124
|
+
pathParams: { workspace, region, dbName: database },
|
746
1125
|
...this.extraProps
|
747
1126
|
});
|
748
1127
|
}
|
749
|
-
|
750
|
-
|
751
|
-
|
752
|
-
|
1128
|
+
getBranchDetails({
|
1129
|
+
workspace,
|
1130
|
+
region,
|
1131
|
+
database,
|
1132
|
+
branch
|
1133
|
+
}) {
|
1134
|
+
return operationsByTag.branch.getBranchDetails({
|
1135
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
753
1136
|
...this.extraProps
|
754
1137
|
});
|
755
1138
|
}
|
756
|
-
|
757
|
-
|
758
|
-
|
1139
|
+
createBranch({
|
1140
|
+
workspace,
|
1141
|
+
region,
|
1142
|
+
database,
|
1143
|
+
branch,
|
1144
|
+
from,
|
1145
|
+
metadata
|
1146
|
+
}) {
|
1147
|
+
return operationsByTag.branch.createBranch({
|
1148
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1149
|
+
body: { from, metadata },
|
1150
|
+
...this.extraProps
|
1151
|
+
});
|
1152
|
+
}
|
1153
|
+
deleteBranch({
|
1154
|
+
workspace,
|
1155
|
+
region,
|
1156
|
+
database,
|
1157
|
+
branch
|
1158
|
+
}) {
|
1159
|
+
return operationsByTag.branch.deleteBranch({
|
1160
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1161
|
+
...this.extraProps
|
1162
|
+
});
|
1163
|
+
}
|
1164
|
+
updateBranchMetadata({
|
1165
|
+
workspace,
|
1166
|
+
region,
|
1167
|
+
database,
|
1168
|
+
branch,
|
1169
|
+
metadata
|
1170
|
+
}) {
|
1171
|
+
return operationsByTag.branch.updateBranchMetadata({
|
1172
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1173
|
+
body: metadata,
|
1174
|
+
...this.extraProps
|
1175
|
+
});
|
1176
|
+
}
|
1177
|
+
getBranchMetadata({
|
1178
|
+
workspace,
|
1179
|
+
region,
|
1180
|
+
database,
|
1181
|
+
branch
|
1182
|
+
}) {
|
1183
|
+
return operationsByTag.branch.getBranchMetadata({
|
1184
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1185
|
+
...this.extraProps
|
1186
|
+
});
|
1187
|
+
}
|
1188
|
+
getBranchStats({
|
1189
|
+
workspace,
|
1190
|
+
region,
|
1191
|
+
database,
|
1192
|
+
branch
|
1193
|
+
}) {
|
1194
|
+
return operationsByTag.branch.getBranchStats({
|
1195
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
759
1196
|
...this.extraProps
|
760
1197
|
});
|
761
1198
|
}
|
762
|
-
getGitBranchesMapping(
|
763
|
-
|
764
|
-
|
1199
|
+
getGitBranchesMapping({
|
1200
|
+
workspace,
|
1201
|
+
region,
|
1202
|
+
database
|
1203
|
+
}) {
|
1204
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1205
|
+
pathParams: { workspace, region, dbName: database },
|
765
1206
|
...this.extraProps
|
766
1207
|
});
|
767
1208
|
}
|
768
|
-
addGitBranchesEntry(
|
769
|
-
|
770
|
-
|
771
|
-
|
1209
|
+
addGitBranchesEntry({
|
1210
|
+
workspace,
|
1211
|
+
region,
|
1212
|
+
database,
|
1213
|
+
gitBranch,
|
1214
|
+
xataBranch
|
1215
|
+
}) {
|
1216
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1217
|
+
pathParams: { workspace, region, dbName: database },
|
1218
|
+
body: { gitBranch, xataBranch },
|
772
1219
|
...this.extraProps
|
773
1220
|
});
|
774
1221
|
}
|
775
|
-
removeGitBranchesEntry(
|
776
|
-
|
777
|
-
|
1222
|
+
removeGitBranchesEntry({
|
1223
|
+
workspace,
|
1224
|
+
region,
|
1225
|
+
database,
|
1226
|
+
gitBranch
|
1227
|
+
}) {
|
1228
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1229
|
+
pathParams: { workspace, region, dbName: database },
|
778
1230
|
queryParams: { gitBranch },
|
779
1231
|
...this.extraProps
|
780
1232
|
});
|
781
1233
|
}
|
782
|
-
resolveBranch(
|
783
|
-
|
784
|
-
|
1234
|
+
resolveBranch({
|
1235
|
+
workspace,
|
1236
|
+
region,
|
1237
|
+
database,
|
1238
|
+
gitBranch,
|
1239
|
+
fallbackBranch
|
1240
|
+
}) {
|
1241
|
+
return operationsByTag.branch.resolveBranch({
|
1242
|
+
pathParams: { workspace, region, dbName: database },
|
785
1243
|
queryParams: { gitBranch, fallbackBranch },
|
786
1244
|
...this.extraProps
|
787
1245
|
});
|
788
1246
|
}
|
789
1247
|
}
|
790
|
-
class
|
1248
|
+
class TableApi {
|
791
1249
|
constructor(extraProps) {
|
792
1250
|
this.extraProps = extraProps;
|
793
1251
|
}
|
794
|
-
|
795
|
-
|
796
|
-
|
1252
|
+
createTable({
|
1253
|
+
workspace,
|
1254
|
+
region,
|
1255
|
+
database,
|
1256
|
+
branch,
|
1257
|
+
table
|
1258
|
+
}) {
|
1259
|
+
return operationsByTag.table.createTable({
|
1260
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
797
1261
|
...this.extraProps
|
798
1262
|
});
|
799
1263
|
}
|
800
|
-
|
801
|
-
|
802
|
-
|
1264
|
+
deleteTable({
|
1265
|
+
workspace,
|
1266
|
+
region,
|
1267
|
+
database,
|
1268
|
+
branch,
|
1269
|
+
table
|
1270
|
+
}) {
|
1271
|
+
return operationsByTag.table.deleteTable({
|
1272
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
803
1273
|
...this.extraProps
|
804
1274
|
});
|
805
1275
|
}
|
806
|
-
|
807
|
-
|
808
|
-
|
809
|
-
|
810
|
-
|
1276
|
+
updateTable({
|
1277
|
+
workspace,
|
1278
|
+
region,
|
1279
|
+
database,
|
1280
|
+
branch,
|
1281
|
+
table,
|
1282
|
+
update
|
1283
|
+
}) {
|
1284
|
+
return operationsByTag.table.updateTable({
|
1285
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1286
|
+
body: update,
|
811
1287
|
...this.extraProps
|
812
1288
|
});
|
813
1289
|
}
|
814
|
-
|
815
|
-
|
816
|
-
|
1290
|
+
getTableSchema({
|
1291
|
+
workspace,
|
1292
|
+
region,
|
1293
|
+
database,
|
1294
|
+
branch,
|
1295
|
+
table
|
1296
|
+
}) {
|
1297
|
+
return operationsByTag.table.getTableSchema({
|
1298
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
817
1299
|
...this.extraProps
|
818
1300
|
});
|
819
1301
|
}
|
820
|
-
|
821
|
-
|
822
|
-
|
823
|
-
|
1302
|
+
setTableSchema({
|
1303
|
+
workspace,
|
1304
|
+
region,
|
1305
|
+
database,
|
1306
|
+
branch,
|
1307
|
+
table,
|
1308
|
+
schema
|
1309
|
+
}) {
|
1310
|
+
return operationsByTag.table.setTableSchema({
|
1311
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1312
|
+
body: schema,
|
824
1313
|
...this.extraProps
|
825
1314
|
});
|
826
1315
|
}
|
827
|
-
|
828
|
-
|
829
|
-
|
1316
|
+
getTableColumns({
|
1317
|
+
workspace,
|
1318
|
+
region,
|
1319
|
+
database,
|
1320
|
+
branch,
|
1321
|
+
table
|
1322
|
+
}) {
|
1323
|
+
return operationsByTag.table.getTableColumns({
|
1324
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
830
1325
|
...this.extraProps
|
831
1326
|
});
|
832
1327
|
}
|
833
|
-
|
834
|
-
|
835
|
-
|
836
|
-
|
1328
|
+
addTableColumn({
|
1329
|
+
workspace,
|
1330
|
+
region,
|
1331
|
+
database,
|
1332
|
+
branch,
|
1333
|
+
table,
|
1334
|
+
column
|
1335
|
+
}) {
|
1336
|
+
return operationsByTag.table.addTableColumn({
|
1337
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1338
|
+
body: column,
|
837
1339
|
...this.extraProps
|
838
1340
|
});
|
839
1341
|
}
|
840
|
-
|
841
|
-
|
842
|
-
|
843
|
-
|
1342
|
+
getColumn({
|
1343
|
+
workspace,
|
1344
|
+
region,
|
1345
|
+
database,
|
1346
|
+
branch,
|
1347
|
+
table,
|
1348
|
+
column
|
1349
|
+
}) {
|
1350
|
+
return operationsByTag.table.getColumn({
|
1351
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
844
1352
|
...this.extraProps
|
845
1353
|
});
|
846
1354
|
}
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
1355
|
+
updateColumn({
|
1356
|
+
workspace,
|
1357
|
+
region,
|
1358
|
+
database,
|
1359
|
+
branch,
|
1360
|
+
table,
|
1361
|
+
column,
|
1362
|
+
update
|
1363
|
+
}) {
|
1364
|
+
return operationsByTag.table.updateColumn({
|
1365
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1366
|
+
body: update,
|
851
1367
|
...this.extraProps
|
852
1368
|
});
|
853
1369
|
}
|
854
|
-
|
855
|
-
|
856
|
-
|
1370
|
+
deleteColumn({
|
1371
|
+
workspace,
|
1372
|
+
region,
|
1373
|
+
database,
|
1374
|
+
branch,
|
1375
|
+
table,
|
1376
|
+
column
|
1377
|
+
}) {
|
1378
|
+
return operationsByTag.table.deleteColumn({
|
1379
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
857
1380
|
...this.extraProps
|
858
1381
|
});
|
859
1382
|
}
|
860
1383
|
}
|
861
|
-
class
|
1384
|
+
class RecordsApi {
|
862
1385
|
constructor(extraProps) {
|
863
1386
|
this.extraProps = extraProps;
|
864
1387
|
}
|
865
|
-
|
866
|
-
|
867
|
-
|
1388
|
+
insertRecord({
|
1389
|
+
workspace,
|
1390
|
+
region,
|
1391
|
+
database,
|
1392
|
+
branch,
|
1393
|
+
table,
|
1394
|
+
record,
|
1395
|
+
columns
|
1396
|
+
}) {
|
1397
|
+
return operationsByTag.records.insertRecord({
|
1398
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1399
|
+
queryParams: { columns },
|
1400
|
+
body: record,
|
1401
|
+
...this.extraProps
|
1402
|
+
});
|
1403
|
+
}
|
1404
|
+
getRecord({
|
1405
|
+
workspace,
|
1406
|
+
region,
|
1407
|
+
database,
|
1408
|
+
branch,
|
1409
|
+
table,
|
1410
|
+
id,
|
1411
|
+
columns
|
1412
|
+
}) {
|
1413
|
+
return operationsByTag.records.getRecord({
|
1414
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1415
|
+
queryParams: { columns },
|
1416
|
+
...this.extraProps
|
1417
|
+
});
|
1418
|
+
}
|
1419
|
+
insertRecordWithID({
|
1420
|
+
workspace,
|
1421
|
+
region,
|
1422
|
+
database,
|
1423
|
+
branch,
|
1424
|
+
table,
|
1425
|
+
id,
|
1426
|
+
record,
|
1427
|
+
columns,
|
1428
|
+
createOnly,
|
1429
|
+
ifVersion
|
1430
|
+
}) {
|
1431
|
+
return operationsByTag.records.insertRecordWithID({
|
1432
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1433
|
+
queryParams: { columns, createOnly, ifVersion },
|
1434
|
+
body: record,
|
1435
|
+
...this.extraProps
|
1436
|
+
});
|
1437
|
+
}
|
1438
|
+
updateRecordWithID({
|
1439
|
+
workspace,
|
1440
|
+
region,
|
1441
|
+
database,
|
1442
|
+
branch,
|
1443
|
+
table,
|
1444
|
+
id,
|
1445
|
+
record,
|
1446
|
+
columns,
|
1447
|
+
ifVersion
|
1448
|
+
}) {
|
1449
|
+
return operationsByTag.records.updateRecordWithID({
|
1450
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1451
|
+
queryParams: { columns, ifVersion },
|
1452
|
+
body: record,
|
1453
|
+
...this.extraProps
|
1454
|
+
});
|
1455
|
+
}
|
1456
|
+
upsertRecordWithID({
|
1457
|
+
workspace,
|
1458
|
+
region,
|
1459
|
+
database,
|
1460
|
+
branch,
|
1461
|
+
table,
|
1462
|
+
id,
|
1463
|
+
record,
|
1464
|
+
columns,
|
1465
|
+
ifVersion
|
1466
|
+
}) {
|
1467
|
+
return operationsByTag.records.upsertRecordWithID({
|
1468
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1469
|
+
queryParams: { columns, ifVersion },
|
1470
|
+
body: record,
|
1471
|
+
...this.extraProps
|
1472
|
+
});
|
1473
|
+
}
|
1474
|
+
deleteRecord({
|
1475
|
+
workspace,
|
1476
|
+
region,
|
1477
|
+
database,
|
1478
|
+
branch,
|
1479
|
+
table,
|
1480
|
+
id,
|
1481
|
+
columns
|
1482
|
+
}) {
|
1483
|
+
return operationsByTag.records.deleteRecord({
|
1484
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1485
|
+
queryParams: { columns },
|
1486
|
+
...this.extraProps
|
1487
|
+
});
|
1488
|
+
}
|
1489
|
+
bulkInsertTableRecords({
|
1490
|
+
workspace,
|
1491
|
+
region,
|
1492
|
+
database,
|
1493
|
+
branch,
|
1494
|
+
table,
|
1495
|
+
records,
|
1496
|
+
columns
|
1497
|
+
}) {
|
1498
|
+
return operationsByTag.records.bulkInsertTableRecords({
|
1499
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1500
|
+
queryParams: { columns },
|
1501
|
+
body: { records },
|
1502
|
+
...this.extraProps
|
1503
|
+
});
|
1504
|
+
}
|
1505
|
+
branchTransaction({
|
1506
|
+
workspace,
|
1507
|
+
region,
|
1508
|
+
database,
|
1509
|
+
branch,
|
1510
|
+
operations
|
1511
|
+
}) {
|
1512
|
+
return operationsByTag.records.branchTransaction({
|
1513
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1514
|
+
body: { operations },
|
1515
|
+
...this.extraProps
|
1516
|
+
});
|
1517
|
+
}
|
1518
|
+
}
|
1519
|
+
class SearchAndFilterApi {
|
1520
|
+
constructor(extraProps) {
|
1521
|
+
this.extraProps = extraProps;
|
1522
|
+
}
|
1523
|
+
queryTable({
|
1524
|
+
workspace,
|
1525
|
+
region,
|
1526
|
+
database,
|
1527
|
+
branch,
|
1528
|
+
table,
|
1529
|
+
filter,
|
1530
|
+
sort,
|
1531
|
+
page,
|
1532
|
+
columns,
|
1533
|
+
consistency
|
1534
|
+
}) {
|
1535
|
+
return operationsByTag.searchAndFilter.queryTable({
|
1536
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1537
|
+
body: { filter, sort, page, columns, consistency },
|
1538
|
+
...this.extraProps
|
1539
|
+
});
|
1540
|
+
}
|
1541
|
+
searchTable({
|
1542
|
+
workspace,
|
1543
|
+
region,
|
1544
|
+
database,
|
1545
|
+
branch,
|
1546
|
+
table,
|
1547
|
+
query,
|
1548
|
+
fuzziness,
|
1549
|
+
target,
|
1550
|
+
prefix,
|
1551
|
+
filter,
|
1552
|
+
highlight,
|
1553
|
+
boosters
|
1554
|
+
}) {
|
1555
|
+
return operationsByTag.searchAndFilter.searchTable({
|
1556
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1557
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1558
|
+
...this.extraProps
|
1559
|
+
});
|
1560
|
+
}
|
1561
|
+
searchBranch({
|
1562
|
+
workspace,
|
1563
|
+
region,
|
1564
|
+
database,
|
1565
|
+
branch,
|
1566
|
+
tables,
|
1567
|
+
query,
|
1568
|
+
fuzziness,
|
1569
|
+
prefix,
|
1570
|
+
highlight
|
1571
|
+
}) {
|
1572
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
1573
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1574
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1575
|
+
...this.extraProps
|
1576
|
+
});
|
1577
|
+
}
|
1578
|
+
summarizeTable({
|
1579
|
+
workspace,
|
1580
|
+
region,
|
1581
|
+
database,
|
1582
|
+
branch,
|
1583
|
+
table,
|
1584
|
+
filter,
|
1585
|
+
columns,
|
1586
|
+
summaries,
|
1587
|
+
sort,
|
1588
|
+
summariesFilter,
|
1589
|
+
page,
|
1590
|
+
consistency
|
1591
|
+
}) {
|
1592
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
1593
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1594
|
+
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
1595
|
+
...this.extraProps
|
1596
|
+
});
|
1597
|
+
}
|
1598
|
+
aggregateTable({
|
1599
|
+
workspace,
|
1600
|
+
region,
|
1601
|
+
database,
|
1602
|
+
branch,
|
1603
|
+
table,
|
1604
|
+
filter,
|
1605
|
+
aggs
|
1606
|
+
}) {
|
1607
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
1608
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1609
|
+
body: { filter, aggs },
|
1610
|
+
...this.extraProps
|
1611
|
+
});
|
1612
|
+
}
|
1613
|
+
}
|
1614
|
+
class MigrationRequestsApi {
|
1615
|
+
constructor(extraProps) {
|
1616
|
+
this.extraProps = extraProps;
|
1617
|
+
}
|
1618
|
+
queryMigrationRequests({
|
1619
|
+
workspace,
|
1620
|
+
region,
|
1621
|
+
database,
|
1622
|
+
filter,
|
1623
|
+
sort,
|
1624
|
+
page,
|
1625
|
+
columns
|
1626
|
+
}) {
|
1627
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
1628
|
+
pathParams: { workspace, region, dbName: database },
|
1629
|
+
body: { filter, sort, page, columns },
|
1630
|
+
...this.extraProps
|
1631
|
+
});
|
1632
|
+
}
|
1633
|
+
createMigrationRequest({
|
1634
|
+
workspace,
|
1635
|
+
region,
|
1636
|
+
database,
|
1637
|
+
migration
|
1638
|
+
}) {
|
1639
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
1640
|
+
pathParams: { workspace, region, dbName: database },
|
1641
|
+
body: migration,
|
1642
|
+
...this.extraProps
|
1643
|
+
});
|
1644
|
+
}
|
1645
|
+
getMigrationRequest({
|
1646
|
+
workspace,
|
1647
|
+
region,
|
1648
|
+
database,
|
1649
|
+
migrationRequest
|
1650
|
+
}) {
|
1651
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1652
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1653
|
+
...this.extraProps
|
1654
|
+
});
|
1655
|
+
}
|
1656
|
+
updateMigrationRequest({
|
1657
|
+
workspace,
|
1658
|
+
region,
|
1659
|
+
database,
|
1660
|
+
migrationRequest,
|
1661
|
+
update
|
1662
|
+
}) {
|
1663
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1664
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1665
|
+
body: update,
|
1666
|
+
...this.extraProps
|
1667
|
+
});
|
1668
|
+
}
|
1669
|
+
listMigrationRequestsCommits({
|
1670
|
+
workspace,
|
1671
|
+
region,
|
1672
|
+
database,
|
1673
|
+
migrationRequest,
|
1674
|
+
page
|
1675
|
+
}) {
|
1676
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1677
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1678
|
+
body: { page },
|
868
1679
|
...this.extraProps
|
869
1680
|
});
|
870
1681
|
}
|
871
|
-
|
872
|
-
|
873
|
-
|
1682
|
+
compareMigrationRequest({
|
1683
|
+
workspace,
|
1684
|
+
region,
|
1685
|
+
database,
|
1686
|
+
migrationRequest
|
1687
|
+
}) {
|
1688
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1689
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1690
|
+
...this.extraProps
|
1691
|
+
});
|
1692
|
+
}
|
1693
|
+
getMigrationRequestIsMerged({
|
1694
|
+
workspace,
|
1695
|
+
region,
|
1696
|
+
database,
|
1697
|
+
migrationRequest
|
1698
|
+
}) {
|
1699
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1700
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1701
|
+
...this.extraProps
|
1702
|
+
});
|
1703
|
+
}
|
1704
|
+
mergeMigrationRequest({
|
1705
|
+
workspace,
|
1706
|
+
region,
|
1707
|
+
database,
|
1708
|
+
migrationRequest
|
1709
|
+
}) {
|
1710
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1711
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1712
|
+
...this.extraProps
|
1713
|
+
});
|
1714
|
+
}
|
1715
|
+
}
|
1716
|
+
class MigrationsApi {
|
1717
|
+
constructor(extraProps) {
|
1718
|
+
this.extraProps = extraProps;
|
1719
|
+
}
|
1720
|
+
getBranchMigrationHistory({
|
1721
|
+
workspace,
|
1722
|
+
region,
|
1723
|
+
database,
|
1724
|
+
branch,
|
1725
|
+
limit,
|
1726
|
+
startFrom
|
1727
|
+
}) {
|
1728
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
1729
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1730
|
+
body: { limit, startFrom },
|
874
1731
|
...this.extraProps
|
875
1732
|
});
|
876
1733
|
}
|
877
|
-
|
878
|
-
|
879
|
-
|
880
|
-
|
1734
|
+
getBranchMigrationPlan({
|
1735
|
+
workspace,
|
1736
|
+
region,
|
1737
|
+
database,
|
1738
|
+
branch,
|
1739
|
+
schema
|
1740
|
+
}) {
|
1741
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
1742
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1743
|
+
body: schema,
|
881
1744
|
...this.extraProps
|
882
1745
|
});
|
883
1746
|
}
|
884
|
-
|
885
|
-
|
886
|
-
|
1747
|
+
executeBranchMigrationPlan({
|
1748
|
+
workspace,
|
1749
|
+
region,
|
1750
|
+
database,
|
1751
|
+
branch,
|
1752
|
+
plan
|
1753
|
+
}) {
|
1754
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
1755
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1756
|
+
body: plan,
|
887
1757
|
...this.extraProps
|
888
1758
|
});
|
889
1759
|
}
|
890
|
-
|
891
|
-
|
892
|
-
|
893
|
-
|
1760
|
+
getBranchSchemaHistory({
|
1761
|
+
workspace,
|
1762
|
+
region,
|
1763
|
+
database,
|
1764
|
+
branch,
|
1765
|
+
page
|
1766
|
+
}) {
|
1767
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
1768
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1769
|
+
body: { page },
|
894
1770
|
...this.extraProps
|
895
1771
|
});
|
896
1772
|
}
|
897
|
-
|
898
|
-
|
899
|
-
|
1773
|
+
compareBranchWithUserSchema({
|
1774
|
+
workspace,
|
1775
|
+
region,
|
1776
|
+
database,
|
1777
|
+
branch,
|
1778
|
+
schema,
|
1779
|
+
schemaOperations,
|
1780
|
+
branchOperations
|
1781
|
+
}) {
|
1782
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1783
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1784
|
+
body: { schema, schemaOperations, branchOperations },
|
900
1785
|
...this.extraProps
|
901
1786
|
});
|
902
1787
|
}
|
903
|
-
|
904
|
-
|
905
|
-
|
906
|
-
|
1788
|
+
compareBranchSchemas({
|
1789
|
+
workspace,
|
1790
|
+
region,
|
1791
|
+
database,
|
1792
|
+
branch,
|
1793
|
+
compare,
|
1794
|
+
sourceBranchOperations,
|
1795
|
+
targetBranchOperations
|
1796
|
+
}) {
|
1797
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
1798
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1799
|
+
body: { sourceBranchOperations, targetBranchOperations },
|
907
1800
|
...this.extraProps
|
908
1801
|
});
|
909
1802
|
}
|
910
|
-
|
911
|
-
|
912
|
-
|
1803
|
+
updateBranchSchema({
|
1804
|
+
workspace,
|
1805
|
+
region,
|
1806
|
+
database,
|
1807
|
+
branch,
|
1808
|
+
migration
|
1809
|
+
}) {
|
1810
|
+
return operationsByTag.migrations.updateBranchSchema({
|
1811
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1812
|
+
body: migration,
|
913
1813
|
...this.extraProps
|
914
1814
|
});
|
915
1815
|
}
|
916
|
-
|
917
|
-
|
918
|
-
|
1816
|
+
previewBranchSchemaEdit({
|
1817
|
+
workspace,
|
1818
|
+
region,
|
1819
|
+
database,
|
1820
|
+
branch,
|
1821
|
+
data
|
1822
|
+
}) {
|
1823
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
1824
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1825
|
+
body: data,
|
919
1826
|
...this.extraProps
|
920
1827
|
});
|
921
1828
|
}
|
922
|
-
|
923
|
-
|
924
|
-
|
925
|
-
|
1829
|
+
applyBranchSchemaEdit({
|
1830
|
+
workspace,
|
1831
|
+
region,
|
1832
|
+
database,
|
1833
|
+
branch,
|
1834
|
+
edits
|
1835
|
+
}) {
|
1836
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
1837
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1838
|
+
body: { edits },
|
926
1839
|
...this.extraProps
|
927
1840
|
});
|
928
1841
|
}
|
929
1842
|
}
|
930
|
-
class
|
1843
|
+
class DatabaseApi {
|
931
1844
|
constructor(extraProps) {
|
932
1845
|
this.extraProps = extraProps;
|
933
1846
|
}
|
934
|
-
|
935
|
-
return operationsByTag.
|
936
|
-
pathParams: {
|
937
|
-
queryParams: options,
|
938
|
-
body: record,
|
939
|
-
...this.extraProps
|
940
|
-
});
|
941
|
-
}
|
942
|
-
insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
943
|
-
return operationsByTag.records.insertRecordWithID({
|
944
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId },
|
945
|
-
queryParams: options,
|
946
|
-
body: record,
|
1847
|
+
getDatabaseList({ workspace }) {
|
1848
|
+
return operationsByTag.databases.getDatabaseList({
|
1849
|
+
pathParams: { workspaceId: workspace },
|
947
1850
|
...this.extraProps
|
948
1851
|
});
|
949
1852
|
}
|
950
|
-
|
951
|
-
|
952
|
-
|
953
|
-
|
954
|
-
|
1853
|
+
createDatabase({
|
1854
|
+
workspace,
|
1855
|
+
database,
|
1856
|
+
data
|
1857
|
+
}) {
|
1858
|
+
return operationsByTag.databases.createDatabase({
|
1859
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1860
|
+
body: data,
|
955
1861
|
...this.extraProps
|
956
1862
|
});
|
957
1863
|
}
|
958
|
-
|
959
|
-
|
960
|
-
|
961
|
-
|
962
|
-
|
1864
|
+
deleteDatabase({
|
1865
|
+
workspace,
|
1866
|
+
database
|
1867
|
+
}) {
|
1868
|
+
return operationsByTag.databases.deleteDatabase({
|
1869
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
963
1870
|
...this.extraProps
|
964
1871
|
});
|
965
1872
|
}
|
966
|
-
|
967
|
-
|
968
|
-
|
969
|
-
|
1873
|
+
getDatabaseMetadata({
|
1874
|
+
workspace,
|
1875
|
+
database
|
1876
|
+
}) {
|
1877
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1878
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
970
1879
|
...this.extraProps
|
971
1880
|
});
|
972
1881
|
}
|
973
|
-
|
974
|
-
|
975
|
-
|
976
|
-
|
1882
|
+
updateDatabaseMetadata({
|
1883
|
+
workspace,
|
1884
|
+
database,
|
1885
|
+
metadata
|
1886
|
+
}) {
|
1887
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1888
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1889
|
+
body: metadata,
|
977
1890
|
...this.extraProps
|
978
1891
|
});
|
979
1892
|
}
|
980
|
-
|
981
|
-
|
982
|
-
|
983
|
-
|
984
|
-
|
1893
|
+
getDatabaseGithubSettings({
|
1894
|
+
workspace,
|
1895
|
+
database
|
1896
|
+
}) {
|
1897
|
+
return operationsByTag.databases.getDatabaseGithubSettings({
|
1898
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
985
1899
|
...this.extraProps
|
986
1900
|
});
|
987
1901
|
}
|
988
|
-
|
989
|
-
|
990
|
-
|
991
|
-
|
1902
|
+
updateDatabaseGithubSettings({
|
1903
|
+
workspace,
|
1904
|
+
database,
|
1905
|
+
settings
|
1906
|
+
}) {
|
1907
|
+
return operationsByTag.databases.updateDatabaseGithubSettings({
|
1908
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1909
|
+
body: settings,
|
992
1910
|
...this.extraProps
|
993
1911
|
});
|
994
1912
|
}
|
995
|
-
|
996
|
-
|
997
|
-
|
998
|
-
|
1913
|
+
deleteDatabaseGithubSettings({
|
1914
|
+
workspace,
|
1915
|
+
database
|
1916
|
+
}) {
|
1917
|
+
return operationsByTag.databases.deleteDatabaseGithubSettings({
|
1918
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
999
1919
|
...this.extraProps
|
1000
1920
|
});
|
1001
1921
|
}
|
1002
|
-
|
1003
|
-
return operationsByTag.
|
1004
|
-
pathParams: {
|
1005
|
-
body: query,
|
1922
|
+
listRegions({ workspace }) {
|
1923
|
+
return operationsByTag.databases.listRegions({
|
1924
|
+
pathParams: { workspaceId: workspace },
|
1006
1925
|
...this.extraProps
|
1007
1926
|
});
|
1008
1927
|
}
|
@@ -1018,6 +1937,13 @@ class XataApiPlugin {
|
|
1018
1937
|
class XataPlugin {
|
1019
1938
|
}
|
1020
1939
|
|
1940
|
+
function cleanFilter(filter) {
|
1941
|
+
if (!filter)
|
1942
|
+
return void 0;
|
1943
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1944
|
+
return values.length > 0 ? filter : void 0;
|
1945
|
+
}
|
1946
|
+
|
1021
1947
|
var __accessCheck$6 = (obj, member, msg) => {
|
1022
1948
|
if (!member.has(obj))
|
1023
1949
|
throw TypeError("Cannot " + msg);
|
@@ -1050,11 +1976,11 @@ class Page {
|
|
1050
1976
|
async previousPage(size, offset) {
|
1051
1977
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1052
1978
|
}
|
1053
|
-
async
|
1054
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1979
|
+
async startPage(size, offset) {
|
1980
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
1055
1981
|
}
|
1056
|
-
async
|
1057
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1982
|
+
async endPage(size, offset) {
|
1983
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
1058
1984
|
}
|
1059
1985
|
hasNextPage() {
|
1060
1986
|
return this.meta.page.more;
|
@@ -1066,7 +1992,7 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1066
1992
|
const PAGINATION_MAX_OFFSET = 800;
|
1067
1993
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1068
1994
|
function isCursorPaginationOptions(options) {
|
1069
|
-
return isDefined(options) && (isDefined(options.
|
1995
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1070
1996
|
}
|
1071
1997
|
const _RecordArray = class extends Array {
|
1072
1998
|
constructor(...args) {
|
@@ -1087,6 +2013,12 @@ const _RecordArray = class extends Array {
|
|
1087
2013
|
toArray() {
|
1088
2014
|
return new Array(...this);
|
1089
2015
|
}
|
2016
|
+
toSerializable() {
|
2017
|
+
return JSON.parse(this.toString());
|
2018
|
+
}
|
2019
|
+
toString() {
|
2020
|
+
return JSON.stringify(this.toArray());
|
2021
|
+
}
|
1090
2022
|
map(callbackfn, thisArg) {
|
1091
2023
|
return this.toArray().map(callbackfn, thisArg);
|
1092
2024
|
}
|
@@ -1098,12 +2030,12 @@ const _RecordArray = class extends Array {
|
|
1098
2030
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1099
2031
|
return new _RecordArray(newPage);
|
1100
2032
|
}
|
1101
|
-
async
|
1102
|
-
const newPage = await __privateGet$6(this, _page).
|
2033
|
+
async startPage(size, offset) {
|
2034
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1103
2035
|
return new _RecordArray(newPage);
|
1104
2036
|
}
|
1105
|
-
async
|
1106
|
-
const newPage = await __privateGet$6(this, _page).
|
2037
|
+
async endPage(size, offset) {
|
2038
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1107
2039
|
return new _RecordArray(newPage);
|
1108
2040
|
}
|
1109
2041
|
hasNextPage() {
|
@@ -1131,9 +2063,14 @@ var __privateSet$5 = (obj, member, value, setter) => {
|
|
1131
2063
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1132
2064
|
return value;
|
1133
2065
|
};
|
1134
|
-
var
|
2066
|
+
var __privateMethod$3 = (obj, member, method) => {
|
2067
|
+
__accessCheck$5(obj, member, "access private method");
|
2068
|
+
return method;
|
2069
|
+
};
|
2070
|
+
var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
|
1135
2071
|
const _Query = class {
|
1136
2072
|
constructor(repository, table, data, rawParent) {
|
2073
|
+
__privateAdd$5(this, _cleanFilterConstraint);
|
1137
2074
|
__privateAdd$5(this, _table$1, void 0);
|
1138
2075
|
__privateAdd$5(this, _repository, void 0);
|
1139
2076
|
__privateAdd$5(this, _data, { filter: {} });
|
@@ -1152,9 +2089,11 @@ const _Query = class {
|
|
1152
2089
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1153
2090
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1154
2091
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1155
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
2092
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
2093
|
+
__privateGet$5(this, _data).consistency = data.consistency ?? parent?.consistency;
|
1156
2094
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1157
2095
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
2096
|
+
__privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
1158
2097
|
this.any = this.any.bind(this);
|
1159
2098
|
this.all = this.all.bind(this);
|
1160
2099
|
this.not = this.not.bind(this);
|
@@ -1190,21 +2129,29 @@ const _Query = class {
|
|
1190
2129
|
}
|
1191
2130
|
filter(a, b) {
|
1192
2131
|
if (arguments.length === 1) {
|
1193
|
-
const constraints = Object.entries(a).map(([column, constraint]) => ({
|
2132
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
2133
|
+
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
2134
|
+
}));
|
1194
2135
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1195
2136
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1196
2137
|
} else {
|
1197
|
-
const
|
2138
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
2139
|
+
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1198
2140
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1199
2141
|
}
|
1200
2142
|
}
|
1201
|
-
sort(column, direction) {
|
2143
|
+
sort(column, direction = "asc") {
|
1202
2144
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1203
2145
|
const sort = [...originalSort, { column, direction }];
|
1204
2146
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
|
1205
2147
|
}
|
1206
2148
|
select(columns) {
|
1207
|
-
return new _Query(
|
2149
|
+
return new _Query(
|
2150
|
+
__privateGet$5(this, _repository),
|
2151
|
+
__privateGet$5(this, _table$1),
|
2152
|
+
{ columns },
|
2153
|
+
__privateGet$5(this, _data)
|
2154
|
+
);
|
1208
2155
|
}
|
1209
2156
|
getPaginated(options = {}) {
|
1210
2157
|
const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
|
@@ -1227,11 +2174,20 @@ const _Query = class {
|
|
1227
2174
|
}
|
1228
2175
|
}
|
1229
2176
|
async getMany(options = {}) {
|
1230
|
-
const
|
2177
|
+
const { pagination = {}, ...rest } = options;
|
2178
|
+
const { size = PAGINATION_DEFAULT_SIZE, offset } = pagination;
|
2179
|
+
const batchSize = size <= PAGINATION_MAX_SIZE ? size : PAGINATION_MAX_SIZE;
|
2180
|
+
let page = await this.getPaginated({ ...rest, pagination: { size: batchSize, offset } });
|
2181
|
+
const results = [...page.records];
|
2182
|
+
while (page.hasNextPage() && results.length < size) {
|
2183
|
+
page = await page.nextPage();
|
2184
|
+
results.push(...page.records);
|
2185
|
+
}
|
1231
2186
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
1232
2187
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
1233
2188
|
}
|
1234
|
-
|
2189
|
+
const array = new RecordArray(page, results.slice(0, size));
|
2190
|
+
return array;
|
1235
2191
|
}
|
1236
2192
|
async getAll(options = {}) {
|
1237
2193
|
const { batchSize = PAGINATION_MAX_SIZE, ...rest } = options;
|
@@ -1245,19 +2201,35 @@ const _Query = class {
|
|
1245
2201
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
1246
2202
|
return records[0] ?? null;
|
1247
2203
|
}
|
2204
|
+
async getFirstOrThrow(options = {}) {
|
2205
|
+
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
2206
|
+
if (records[0] === void 0)
|
2207
|
+
throw new Error("No results found.");
|
2208
|
+
return records[0];
|
2209
|
+
}
|
2210
|
+
async summarize(params = {}) {
|
2211
|
+
const { summaries, summariesFilter, ...options } = params;
|
2212
|
+
const query = new _Query(
|
2213
|
+
__privateGet$5(this, _repository),
|
2214
|
+
__privateGet$5(this, _table$1),
|
2215
|
+
options,
|
2216
|
+
__privateGet$5(this, _data)
|
2217
|
+
);
|
2218
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2219
|
+
}
|
1248
2220
|
cache(ttl) {
|
1249
2221
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1250
2222
|
}
|
1251
2223
|
nextPage(size, offset) {
|
1252
|
-
return this.
|
2224
|
+
return this.startPage(size, offset);
|
1253
2225
|
}
|
1254
2226
|
previousPage(size, offset) {
|
1255
|
-
return this.
|
2227
|
+
return this.startPage(size, offset);
|
1256
2228
|
}
|
1257
|
-
|
2229
|
+
startPage(size, offset) {
|
1258
2230
|
return this.getPaginated({ pagination: { size, offset } });
|
1259
2231
|
}
|
1260
|
-
|
2232
|
+
endPage(size, offset) {
|
1261
2233
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1262
2234
|
}
|
1263
2235
|
hasNextPage() {
|
@@ -1268,9 +2240,20 @@ let Query = _Query;
|
|
1268
2240
|
_table$1 = new WeakMap();
|
1269
2241
|
_repository = new WeakMap();
|
1270
2242
|
_data = new WeakMap();
|
2243
|
+
_cleanFilterConstraint = new WeakSet();
|
2244
|
+
cleanFilterConstraint_fn = function(column, value) {
|
2245
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
2246
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
2247
|
+
return { $includes: value };
|
2248
|
+
}
|
2249
|
+
if (columnType === "link" && isObject(value) && isString(value.id)) {
|
2250
|
+
return value.id;
|
2251
|
+
}
|
2252
|
+
return value;
|
2253
|
+
};
|
1271
2254
|
function cleanParent(data, parent) {
|
1272
2255
|
if (isCursorPaginationOptions(data.pagination)) {
|
1273
|
-
return { ...parent,
|
2256
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1274
2257
|
}
|
1275
2258
|
return parent;
|
1276
2259
|
}
|
@@ -1329,193 +2312,414 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1329
2312
|
__accessCheck$4(obj, member, "access private method");
|
1330
2313
|
return method;
|
1331
2314
|
};
|
1332
|
-
var _table, _getFetchProps, _cache, _schemaTables$2, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn,
|
2315
|
+
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;
|
2316
|
+
const BULK_OPERATION_MAX_SIZE = 1e3;
|
1333
2317
|
class Repository extends Query {
|
1334
2318
|
}
|
1335
2319
|
class RestRepository extends Query {
|
1336
2320
|
constructor(options) {
|
1337
|
-
super(
|
2321
|
+
super(
|
2322
|
+
null,
|
2323
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
2324
|
+
{}
|
2325
|
+
);
|
1338
2326
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1339
2327
|
__privateAdd$4(this, _insertRecordWithId);
|
1340
|
-
__privateAdd$4(this,
|
2328
|
+
__privateAdd$4(this, _insertRecords);
|
1341
2329
|
__privateAdd$4(this, _updateRecordWithID);
|
2330
|
+
__privateAdd$4(this, _updateRecords);
|
1342
2331
|
__privateAdd$4(this, _upsertRecordWithID);
|
1343
2332
|
__privateAdd$4(this, _deleteRecord);
|
2333
|
+
__privateAdd$4(this, _deleteRecords);
|
1344
2334
|
__privateAdd$4(this, _setCacheQuery);
|
1345
2335
|
__privateAdd$4(this, _getCacheQuery);
|
1346
2336
|
__privateAdd$4(this, _getSchemaTables$1);
|
1347
2337
|
__privateAdd$4(this, _table, void 0);
|
1348
2338
|
__privateAdd$4(this, _getFetchProps, void 0);
|
2339
|
+
__privateAdd$4(this, _db, void 0);
|
1349
2340
|
__privateAdd$4(this, _cache, void 0);
|
1350
2341
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
2342
|
+
__privateAdd$4(this, _trace, void 0);
|
1351
2343
|
__privateSet$4(this, _table, options.table);
|
1352
|
-
__privateSet$4(this,
|
1353
|
-
this.db = options.db;
|
2344
|
+
__privateSet$4(this, _db, options.db);
|
1354
2345
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1355
2346
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2347
|
+
__privateSet$4(this, _getFetchProps, async () => {
|
2348
|
+
const props = await options.pluginOptions.getFetchProps();
|
2349
|
+
return { ...props, sessionID: generateUUID() };
|
2350
|
+
});
|
2351
|
+
const trace = options.pluginOptions.trace ?? defaultTrace;
|
2352
|
+
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
2353
|
+
return trace(name, fn, {
|
2354
|
+
...options2,
|
2355
|
+
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
2356
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
2357
|
+
[TraceAttributes.VERSION]: VERSION
|
2358
|
+
});
|
2359
|
+
});
|
1356
2360
|
}
|
1357
|
-
async create(a, b, c) {
|
1358
|
-
|
1359
|
-
|
1360
|
-
|
1361
|
-
|
1362
|
-
|
1363
|
-
|
1364
|
-
|
1365
|
-
|
1366
|
-
|
1367
|
-
|
1368
|
-
|
1369
|
-
|
1370
|
-
|
1371
|
-
|
1372
|
-
|
1373
|
-
|
1374
|
-
|
1375
|
-
|
1376
|
-
|
1377
|
-
|
1378
|
-
|
1379
|
-
|
1380
|
-
|
2361
|
+
async create(a, b, c, d) {
|
2362
|
+
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
2363
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2364
|
+
if (Array.isArray(a)) {
|
2365
|
+
if (a.length === 0)
|
2366
|
+
return [];
|
2367
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
2368
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2369
|
+
const result = await this.read(ids, columns);
|
2370
|
+
return result;
|
2371
|
+
}
|
2372
|
+
if (isString(a) && isObject(b)) {
|
2373
|
+
if (a === "")
|
2374
|
+
throw new Error("The id can't be empty");
|
2375
|
+
const columns = isStringArray(c) ? c : void 0;
|
2376
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
2377
|
+
}
|
2378
|
+
if (isObject(a) && isString(a.id)) {
|
2379
|
+
if (a.id === "")
|
2380
|
+
throw new Error("The id can't be empty");
|
2381
|
+
const columns = isStringArray(b) ? b : void 0;
|
2382
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
2383
|
+
}
|
2384
|
+
if (isObject(a)) {
|
2385
|
+
const columns = isStringArray(b) ? b : void 0;
|
2386
|
+
return __privateMethod$2(this, _insertRecordWithoutId, insertRecordWithoutId_fn).call(this, a, columns);
|
2387
|
+
}
|
2388
|
+
throw new Error("Invalid arguments for create method");
|
2389
|
+
});
|
1381
2390
|
}
|
1382
2391
|
async read(a, b) {
|
1383
|
-
|
1384
|
-
|
1385
|
-
if (a
|
1386
|
-
|
1387
|
-
|
1388
|
-
|
1389
|
-
|
1390
|
-
acc
|
1391
|
-
|
1392
|
-
|
1393
|
-
|
1394
|
-
|
1395
|
-
|
1396
|
-
|
1397
|
-
|
1398
|
-
|
1399
|
-
|
1400
|
-
|
1401
|
-
|
1402
|
-
|
2392
|
+
return __privateGet$4(this, _trace).call(this, "read", async () => {
|
2393
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2394
|
+
if (Array.isArray(a)) {
|
2395
|
+
if (a.length === 0)
|
2396
|
+
return [];
|
2397
|
+
const ids = a.map((item) => extractId(item));
|
2398
|
+
const finalObjects = await this.getAll({ filter: { id: { $any: compact(ids) } }, columns });
|
2399
|
+
const dictionary = finalObjects.reduce((acc, object) => {
|
2400
|
+
acc[object.id] = object;
|
2401
|
+
return acc;
|
2402
|
+
}, {});
|
2403
|
+
return ids.map((id2) => dictionary[id2 ?? ""] ?? null);
|
2404
|
+
}
|
2405
|
+
const id = extractId(a);
|
2406
|
+
if (id) {
|
2407
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2408
|
+
try {
|
2409
|
+
const response = await getRecord({
|
2410
|
+
pathParams: {
|
2411
|
+
workspace: "{workspaceId}",
|
2412
|
+
dbBranchName: "{dbBranch}",
|
2413
|
+
region: "{region}",
|
2414
|
+
tableName: __privateGet$4(this, _table),
|
2415
|
+
recordId: id
|
2416
|
+
},
|
2417
|
+
queryParams: { columns },
|
2418
|
+
...fetchProps
|
2419
|
+
});
|
2420
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2421
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2422
|
+
} catch (e) {
|
2423
|
+
if (isObject(e) && e.status === 404) {
|
2424
|
+
return null;
|
2425
|
+
}
|
2426
|
+
throw e;
|
2427
|
+
}
|
2428
|
+
}
|
2429
|
+
return null;
|
2430
|
+
});
|
2431
|
+
}
|
2432
|
+
async readOrThrow(a, b) {
|
2433
|
+
return __privateGet$4(this, _trace).call(this, "readOrThrow", async () => {
|
2434
|
+
const result = await this.read(a, b);
|
2435
|
+
if (Array.isArray(result)) {
|
2436
|
+
const missingIds = compact(
|
2437
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2438
|
+
);
|
2439
|
+
if (missingIds.length > 0) {
|
2440
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2441
|
+
}
|
2442
|
+
return result;
|
2443
|
+
}
|
2444
|
+
if (result === null) {
|
2445
|
+
const id = extractId(a) ?? "unknown";
|
2446
|
+
throw new Error(`Record with id ${id} not found`);
|
2447
|
+
}
|
2448
|
+
return result;
|
2449
|
+
});
|
2450
|
+
}
|
2451
|
+
async update(a, b, c, d) {
|
2452
|
+
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
2453
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2454
|
+
if (Array.isArray(a)) {
|
2455
|
+
if (a.length === 0)
|
2456
|
+
return [];
|
2457
|
+
const existing = await this.read(a, ["id"]);
|
2458
|
+
const updates = a.filter((_item, index) => existing[index] !== null);
|
2459
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, updates, {
|
2460
|
+
ifVersion,
|
2461
|
+
upsert: false
|
1403
2462
|
});
|
1404
|
-
const
|
1405
|
-
|
1406
|
-
|
1407
|
-
|
2463
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2464
|
+
const result = await this.read(a, columns);
|
2465
|
+
return result;
|
2466
|
+
}
|
2467
|
+
try {
|
2468
|
+
if (isString(a) && isObject(b)) {
|
2469
|
+
const columns = isStringArray(c) ? c : void 0;
|
2470
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
2471
|
+
}
|
2472
|
+
if (isObject(a) && isString(a.id)) {
|
2473
|
+
const columns = isStringArray(b) ? b : void 0;
|
2474
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
2475
|
+
}
|
2476
|
+
} catch (error) {
|
2477
|
+
if (error.status === 422)
|
1408
2478
|
return null;
|
2479
|
+
throw error;
|
2480
|
+
}
|
2481
|
+
throw new Error("Invalid arguments for update method");
|
2482
|
+
});
|
2483
|
+
}
|
2484
|
+
async updateOrThrow(a, b, c, d) {
|
2485
|
+
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
2486
|
+
const result = await this.update(a, b, c, d);
|
2487
|
+
if (Array.isArray(result)) {
|
2488
|
+
const missingIds = compact(
|
2489
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2490
|
+
);
|
2491
|
+
if (missingIds.length > 0) {
|
2492
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
1409
2493
|
}
|
1410
|
-
|
2494
|
+
return result;
|
1411
2495
|
}
|
1412
|
-
|
1413
|
-
|
2496
|
+
if (result === null) {
|
2497
|
+
const id = extractId(a) ?? "unknown";
|
2498
|
+
throw new Error(`Record with id ${id} not found`);
|
2499
|
+
}
|
2500
|
+
return result;
|
2501
|
+
});
|
1414
2502
|
}
|
1415
|
-
async
|
1416
|
-
|
1417
|
-
|
1418
|
-
|
1419
|
-
|
1420
|
-
|
2503
|
+
async createOrUpdate(a, b, c, d) {
|
2504
|
+
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
2505
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2506
|
+
if (Array.isArray(a)) {
|
2507
|
+
if (a.length === 0)
|
2508
|
+
return [];
|
2509
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
2510
|
+
ifVersion,
|
2511
|
+
upsert: true
|
2512
|
+
});
|
2513
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2514
|
+
const result = await this.read(a, columns);
|
2515
|
+
return result;
|
1421
2516
|
}
|
1422
|
-
|
1423
|
-
|
1424
|
-
|
1425
|
-
if (isString(a) && isObject(b)) {
|
1426
|
-
const columns = isStringArray(c) ? c : void 0;
|
1427
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
1428
|
-
}
|
1429
|
-
if (isObject(a) && isString(a.id)) {
|
1430
|
-
const columns = isStringArray(b) ? b : void 0;
|
1431
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
1432
|
-
}
|
1433
|
-
throw new Error("Invalid arguments for update method");
|
1434
|
-
}
|
1435
|
-
async createOrUpdate(a, b, c) {
|
1436
|
-
if (Array.isArray(a)) {
|
1437
|
-
if (a.length === 0)
|
1438
|
-
return [];
|
1439
|
-
if (a.length > 100) {
|
1440
|
-
console.warn("Bulk update operation is not optimized in the Xata API yet, this request might be slow");
|
2517
|
+
if (isString(a) && isObject(b)) {
|
2518
|
+
const columns = isStringArray(c) ? c : void 0;
|
2519
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1441
2520
|
}
|
1442
|
-
|
1443
|
-
|
1444
|
-
|
1445
|
-
if (isString(a) && isObject(b)) {
|
1446
|
-
const columns = isStringArray(c) ? c : void 0;
|
1447
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
1448
|
-
}
|
1449
|
-
if (isObject(a) && isString(a.id)) {
|
1450
|
-
const columns = isStringArray(c) ? c : void 0;
|
1451
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
1452
|
-
}
|
1453
|
-
throw new Error("Invalid arguments for createOrUpdate method");
|
1454
|
-
}
|
1455
|
-
async delete(a) {
|
1456
|
-
if (Array.isArray(a)) {
|
1457
|
-
if (a.length === 0)
|
1458
|
-
return;
|
1459
|
-
if (a.length > 100) {
|
1460
|
-
console.warn("Bulk delete operation is not optimized in the Xata API yet, this request might be slow");
|
2521
|
+
if (isObject(a) && isString(a.id)) {
|
2522
|
+
const columns = isStringArray(c) ? c : void 0;
|
2523
|
+
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
1461
2524
|
}
|
1462
|
-
|
1463
|
-
|
1464
|
-
|
1465
|
-
|
1466
|
-
|
1467
|
-
|
1468
|
-
|
1469
|
-
|
1470
|
-
|
1471
|
-
|
1472
|
-
|
1473
|
-
|
2525
|
+
throw new Error("Invalid arguments for createOrUpdate method");
|
2526
|
+
});
|
2527
|
+
}
|
2528
|
+
async createOrReplace(a, b, c, d) {
|
2529
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
2530
|
+
const ifVersion = parseIfVersion(b, c, d);
|
2531
|
+
if (Array.isArray(a)) {
|
2532
|
+
if (a.length === 0)
|
2533
|
+
return [];
|
2534
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
2535
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2536
|
+
const result = await this.read(ids, columns);
|
2537
|
+
return result;
|
2538
|
+
}
|
2539
|
+
if (isString(a) && isObject(b)) {
|
2540
|
+
const columns = isStringArray(c) ? c : void 0;
|
2541
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
2542
|
+
}
|
2543
|
+
if (isObject(a) && isString(a.id)) {
|
2544
|
+
const columns = isStringArray(c) ? c : void 0;
|
2545
|
+
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
2546
|
+
}
|
2547
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
2548
|
+
});
|
2549
|
+
}
|
2550
|
+
async delete(a, b) {
|
2551
|
+
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
2552
|
+
if (Array.isArray(a)) {
|
2553
|
+
if (a.length === 0)
|
2554
|
+
return [];
|
2555
|
+
const ids = a.map((o) => {
|
2556
|
+
if (isString(o))
|
2557
|
+
return o;
|
2558
|
+
if (isString(o.id))
|
2559
|
+
return o.id;
|
2560
|
+
throw new Error("Invalid arguments for delete method");
|
2561
|
+
});
|
2562
|
+
const columns = isStringArray(b) ? b : ["*"];
|
2563
|
+
const result = await this.read(a, columns);
|
2564
|
+
await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
|
2565
|
+
return result;
|
2566
|
+
}
|
2567
|
+
if (isString(a)) {
|
2568
|
+
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
2569
|
+
}
|
2570
|
+
if (isObject(a) && isString(a.id)) {
|
2571
|
+
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a.id, b);
|
2572
|
+
}
|
2573
|
+
throw new Error("Invalid arguments for delete method");
|
2574
|
+
});
|
2575
|
+
}
|
2576
|
+
async deleteOrThrow(a, b) {
|
2577
|
+
return __privateGet$4(this, _trace).call(this, "deleteOrThrow", async () => {
|
2578
|
+
const result = await this.delete(a, b);
|
2579
|
+
if (Array.isArray(result)) {
|
2580
|
+
const missingIds = compact(
|
2581
|
+
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
2582
|
+
);
|
2583
|
+
if (missingIds.length > 0) {
|
2584
|
+
throw new Error(`Could not find records with ids: ${missingIds.join(", ")}`);
|
2585
|
+
}
|
2586
|
+
return result;
|
2587
|
+
} else if (result === null) {
|
2588
|
+
const id = extractId(a) ?? "unknown";
|
2589
|
+
throw new Error(`Record with id ${id} not found`);
|
2590
|
+
}
|
2591
|
+
return result;
|
2592
|
+
});
|
1474
2593
|
}
|
1475
2594
|
async search(query, options = {}) {
|
1476
|
-
|
1477
|
-
|
1478
|
-
|
1479
|
-
|
1480
|
-
|
1481
|
-
|
1482
|
-
|
1483
|
-
|
1484
|
-
|
1485
|
-
|
1486
|
-
|
1487
|
-
|
2595
|
+
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
2596
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2597
|
+
const { records } = await searchTable({
|
2598
|
+
pathParams: {
|
2599
|
+
workspace: "{workspaceId}",
|
2600
|
+
dbBranchName: "{dbBranch}",
|
2601
|
+
region: "{region}",
|
2602
|
+
tableName: __privateGet$4(this, _table)
|
2603
|
+
},
|
2604
|
+
body: {
|
2605
|
+
query,
|
2606
|
+
fuzziness: options.fuzziness,
|
2607
|
+
prefix: options.prefix,
|
2608
|
+
highlight: options.highlight,
|
2609
|
+
filter: options.filter,
|
2610
|
+
boosters: options.boosters,
|
2611
|
+
page: options.page,
|
2612
|
+
target: options.target
|
2613
|
+
},
|
2614
|
+
...fetchProps
|
2615
|
+
});
|
2616
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2617
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2618
|
+
});
|
2619
|
+
}
|
2620
|
+
async vectorSearch(column, query, options) {
|
2621
|
+
return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
|
2622
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2623
|
+
const { records } = await vectorSearchTable({
|
2624
|
+
pathParams: {
|
2625
|
+
workspace: "{workspaceId}",
|
2626
|
+
dbBranchName: "{dbBranch}",
|
2627
|
+
region: "{region}",
|
2628
|
+
tableName: __privateGet$4(this, _table)
|
2629
|
+
},
|
2630
|
+
body: {
|
2631
|
+
column,
|
2632
|
+
queryVector: query,
|
2633
|
+
similarityFunction: options?.similarityFunction,
|
2634
|
+
size: options?.size,
|
2635
|
+
filter: options?.filter
|
2636
|
+
},
|
2637
|
+
...fetchProps
|
2638
|
+
});
|
2639
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2640
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
2641
|
+
});
|
2642
|
+
}
|
2643
|
+
async aggregate(aggs, filter) {
|
2644
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2645
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2646
|
+
const result = await aggregateTable({
|
2647
|
+
pathParams: {
|
2648
|
+
workspace: "{workspaceId}",
|
2649
|
+
dbBranchName: "{dbBranch}",
|
2650
|
+
region: "{region}",
|
2651
|
+
tableName: __privateGet$4(this, _table)
|
2652
|
+
},
|
2653
|
+
body: { aggs, filter },
|
2654
|
+
...fetchProps
|
2655
|
+
});
|
2656
|
+
return result;
|
1488
2657
|
});
|
1489
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1490
|
-
return records.map((item) => initObject(this.db, schemaTables, __privateGet$4(this, _table), item));
|
1491
2658
|
}
|
1492
2659
|
async query(query) {
|
1493
|
-
|
1494
|
-
|
1495
|
-
|
1496
|
-
|
1497
|
-
|
1498
|
-
|
1499
|
-
|
1500
|
-
|
1501
|
-
|
1502
|
-
|
1503
|
-
|
1504
|
-
|
1505
|
-
|
1506
|
-
|
1507
|
-
|
2660
|
+
return __privateGet$4(this, _trace).call(this, "query", async () => {
|
2661
|
+
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
2662
|
+
if (cacheQuery)
|
2663
|
+
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
2664
|
+
const data = query.getQueryOptions();
|
2665
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2666
|
+
const { meta, records: objects } = await queryTable({
|
2667
|
+
pathParams: {
|
2668
|
+
workspace: "{workspaceId}",
|
2669
|
+
dbBranchName: "{dbBranch}",
|
2670
|
+
region: "{region}",
|
2671
|
+
tableName: __privateGet$4(this, _table)
|
2672
|
+
},
|
2673
|
+
body: {
|
2674
|
+
filter: cleanFilter(data.filter),
|
2675
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2676
|
+
page: data.pagination,
|
2677
|
+
columns: data.columns ?? ["*"],
|
2678
|
+
consistency: data.consistency
|
2679
|
+
},
|
2680
|
+
fetchOptions: data.fetchOptions,
|
2681
|
+
...fetchProps
|
2682
|
+
});
|
2683
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2684
|
+
const records = objects.map(
|
2685
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
2686
|
+
);
|
2687
|
+
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
2688
|
+
return new Page(query, meta, records);
|
2689
|
+
});
|
2690
|
+
}
|
2691
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
2692
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2693
|
+
const data = query.getQueryOptions();
|
2694
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2695
|
+
const result = await summarizeTable({
|
2696
|
+
pathParams: {
|
2697
|
+
workspace: "{workspaceId}",
|
2698
|
+
dbBranchName: "{dbBranch}",
|
2699
|
+
region: "{region}",
|
2700
|
+
tableName: __privateGet$4(this, _table)
|
2701
|
+
},
|
2702
|
+
body: {
|
2703
|
+
filter: cleanFilter(data.filter),
|
2704
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
2705
|
+
columns: data.columns,
|
2706
|
+
consistency: data.consistency,
|
2707
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
2708
|
+
summaries,
|
2709
|
+
summariesFilter
|
2710
|
+
},
|
2711
|
+
...fetchProps
|
2712
|
+
});
|
2713
|
+
return result;
|
1508
2714
|
});
|
1509
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1510
|
-
const records = objects.map((record) => initObject(this.db, schemaTables, __privateGet$4(this, _table), record));
|
1511
|
-
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1512
|
-
return new Page(query, meta, records);
|
1513
2715
|
}
|
1514
2716
|
}
|
1515
2717
|
_table = new WeakMap();
|
1516
2718
|
_getFetchProps = new WeakMap();
|
2719
|
+
_db = new WeakMap();
|
1517
2720
|
_cache = new WeakMap();
|
1518
2721
|
_schemaTables$2 = new WeakMap();
|
2722
|
+
_trace = new WeakMap();
|
1519
2723
|
_insertRecordWithoutId = new WeakSet();
|
1520
2724
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
1521
2725
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
@@ -1524,6 +2728,7 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1524
2728
|
pathParams: {
|
1525
2729
|
workspace: "{workspaceId}",
|
1526
2730
|
dbBranchName: "{dbBranch}",
|
2731
|
+
region: "{region}",
|
1527
2732
|
tableName: __privateGet$4(this, _table)
|
1528
2733
|
},
|
1529
2734
|
queryParams: { columns },
|
@@ -1531,74 +2736,173 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
1531
2736
|
...fetchProps
|
1532
2737
|
});
|
1533
2738
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1534
|
-
return initObject(this
|
2739
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1535
2740
|
};
|
1536
2741
|
_insertRecordWithId = new WeakSet();
|
1537
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
2742
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
1538
2743
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1539
2744
|
const record = transformObjectLinks(object);
|
1540
2745
|
const response = await insertRecordWithID({
|
1541
2746
|
pathParams: {
|
1542
2747
|
workspace: "{workspaceId}",
|
1543
2748
|
dbBranchName: "{dbBranch}",
|
2749
|
+
region: "{region}",
|
1544
2750
|
tableName: __privateGet$4(this, _table),
|
1545
2751
|
recordId
|
1546
2752
|
},
|
1547
2753
|
body: record,
|
1548
|
-
queryParams: { createOnly
|
2754
|
+
queryParams: { createOnly, columns, ifVersion },
|
1549
2755
|
...fetchProps
|
1550
2756
|
});
|
1551
2757
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1552
|
-
return initObject(this
|
2758
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1553
2759
|
};
|
1554
|
-
|
1555
|
-
|
2760
|
+
_insertRecords = new WeakSet();
|
2761
|
+
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
1556
2762
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1557
|
-
const
|
1558
|
-
|
1559
|
-
|
1560
|
-
|
1561
|
-
|
1562
|
-
|
1563
|
-
|
1564
|
-
|
1565
|
-
|
2763
|
+
const chunkedOperations = chunk(
|
2764
|
+
objects.map((object) => ({
|
2765
|
+
insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
|
2766
|
+
})),
|
2767
|
+
BULK_OPERATION_MAX_SIZE
|
2768
|
+
);
|
2769
|
+
const ids = [];
|
2770
|
+
for (const operations of chunkedOperations) {
|
2771
|
+
const { results } = await branchTransaction({
|
2772
|
+
pathParams: {
|
2773
|
+
workspace: "{workspaceId}",
|
2774
|
+
dbBranchName: "{dbBranch}",
|
2775
|
+
region: "{region}"
|
2776
|
+
},
|
2777
|
+
body: { operations },
|
2778
|
+
...fetchProps
|
2779
|
+
});
|
2780
|
+
for (const result of results) {
|
2781
|
+
if (result.operation === "insert") {
|
2782
|
+
ids.push(result.id);
|
2783
|
+
} else {
|
2784
|
+
ids.push(null);
|
2785
|
+
}
|
2786
|
+
}
|
1566
2787
|
}
|
1567
|
-
|
1568
|
-
return response.records?.map((item) => initObject(this.db, schemaTables, __privateGet$4(this, _table), item));
|
2788
|
+
return ids;
|
1569
2789
|
};
|
1570
2790
|
_updateRecordWithID = new WeakSet();
|
1571
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2791
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1572
2792
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1573
|
-
const record = transformObjectLinks(object);
|
1574
|
-
|
1575
|
-
|
1576
|
-
|
1577
|
-
|
1578
|
-
|
1579
|
-
|
1580
|
-
|
1581
|
-
|
2793
|
+
const { id: _id, ...record } = transformObjectLinks(object);
|
2794
|
+
try {
|
2795
|
+
const response = await updateRecordWithID({
|
2796
|
+
pathParams: {
|
2797
|
+
workspace: "{workspaceId}",
|
2798
|
+
dbBranchName: "{dbBranch}",
|
2799
|
+
region: "{region}",
|
2800
|
+
tableName: __privateGet$4(this, _table),
|
2801
|
+
recordId
|
2802
|
+
},
|
2803
|
+
queryParams: { columns, ifVersion },
|
2804
|
+
body: record,
|
2805
|
+
...fetchProps
|
2806
|
+
});
|
2807
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2808
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2809
|
+
} catch (e) {
|
2810
|
+
if (isObject(e) && e.status === 404) {
|
2811
|
+
return null;
|
2812
|
+
}
|
2813
|
+
throw e;
|
2814
|
+
}
|
2815
|
+
};
|
2816
|
+
_updateRecords = new WeakSet();
|
2817
|
+
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
2818
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2819
|
+
const chunkedOperations = chunk(
|
2820
|
+
objects.map(({ id, ...object }) => ({
|
2821
|
+
update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
|
2822
|
+
})),
|
2823
|
+
BULK_OPERATION_MAX_SIZE
|
2824
|
+
);
|
2825
|
+
const ids = [];
|
2826
|
+
for (const operations of chunkedOperations) {
|
2827
|
+
const { results } = await branchTransaction({
|
2828
|
+
pathParams: {
|
2829
|
+
workspace: "{workspaceId}",
|
2830
|
+
dbBranchName: "{dbBranch}",
|
2831
|
+
region: "{region}"
|
2832
|
+
},
|
2833
|
+
body: { operations },
|
2834
|
+
...fetchProps
|
2835
|
+
});
|
2836
|
+
for (const result of results) {
|
2837
|
+
if (result.operation === "update") {
|
2838
|
+
ids.push(result.id);
|
2839
|
+
} else {
|
2840
|
+
ids.push(null);
|
2841
|
+
}
|
2842
|
+
}
|
2843
|
+
}
|
2844
|
+
return ids;
|
1582
2845
|
};
|
1583
2846
|
_upsertRecordWithID = new WeakSet();
|
1584
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
2847
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
1585
2848
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1586
2849
|
const response = await upsertRecordWithID({
|
1587
|
-
pathParams: {
|
1588
|
-
|
2850
|
+
pathParams: {
|
2851
|
+
workspace: "{workspaceId}",
|
2852
|
+
dbBranchName: "{dbBranch}",
|
2853
|
+
region: "{region}",
|
2854
|
+
tableName: __privateGet$4(this, _table),
|
2855
|
+
recordId
|
2856
|
+
},
|
2857
|
+
queryParams: { columns, ifVersion },
|
1589
2858
|
body: object,
|
1590
2859
|
...fetchProps
|
1591
2860
|
});
|
1592
2861
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1593
|
-
return initObject(this
|
2862
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1594
2863
|
};
|
1595
2864
|
_deleteRecord = new WeakSet();
|
1596
|
-
deleteRecord_fn = async function(recordId) {
|
2865
|
+
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1597
2866
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1598
|
-
|
1599
|
-
|
1600
|
-
|
1601
|
-
|
2867
|
+
try {
|
2868
|
+
const response = await deleteRecord({
|
2869
|
+
pathParams: {
|
2870
|
+
workspace: "{workspaceId}",
|
2871
|
+
dbBranchName: "{dbBranch}",
|
2872
|
+
region: "{region}",
|
2873
|
+
tableName: __privateGet$4(this, _table),
|
2874
|
+
recordId
|
2875
|
+
},
|
2876
|
+
queryParams: { columns },
|
2877
|
+
...fetchProps
|
2878
|
+
});
|
2879
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2880
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2881
|
+
} catch (e) {
|
2882
|
+
if (isObject(e) && e.status === 404) {
|
2883
|
+
return null;
|
2884
|
+
}
|
2885
|
+
throw e;
|
2886
|
+
}
|
2887
|
+
};
|
2888
|
+
_deleteRecords = new WeakSet();
|
2889
|
+
deleteRecords_fn = async function(recordIds) {
|
2890
|
+
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2891
|
+
const chunkedOperations = chunk(
|
2892
|
+
recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
2893
|
+
BULK_OPERATION_MAX_SIZE
|
2894
|
+
);
|
2895
|
+
for (const operations of chunkedOperations) {
|
2896
|
+
await branchTransaction({
|
2897
|
+
pathParams: {
|
2898
|
+
workspace: "{workspaceId}",
|
2899
|
+
dbBranchName: "{dbBranch}",
|
2900
|
+
region: "{region}"
|
2901
|
+
},
|
2902
|
+
body: { operations },
|
2903
|
+
...fetchProps
|
2904
|
+
});
|
2905
|
+
}
|
1602
2906
|
};
|
1603
2907
|
_setCacheQuery = new WeakSet();
|
1604
2908
|
setCacheQuery_fn = async function(query, meta, records) {
|
@@ -1622,7 +2926,7 @@ getSchemaTables_fn$1 = async function() {
|
|
1622
2926
|
return __privateGet$4(this, _schemaTables$2);
|
1623
2927
|
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1624
2928
|
const { schema } = await getBranchDetails({
|
1625
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2929
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1626
2930
|
...fetchProps
|
1627
2931
|
});
|
1628
2932
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
@@ -1635,22 +2939,24 @@ const transformObjectLinks = (object) => {
|
|
1635
2939
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
1636
2940
|
}, {});
|
1637
2941
|
};
|
1638
|
-
const initObject = (db, schemaTables, table, object) => {
|
1639
|
-
const
|
2942
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
2943
|
+
const data = {};
|
1640
2944
|
const { xata, ...rest } = object ?? {};
|
1641
|
-
Object.assign(
|
2945
|
+
Object.assign(data, rest);
|
1642
2946
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
1643
2947
|
if (!columns)
|
1644
2948
|
console.error(`Table ${table} not found in schema`);
|
1645
2949
|
for (const column of columns ?? []) {
|
1646
|
-
|
2950
|
+
if (!isValidColumn(selectedColumns, column))
|
2951
|
+
continue;
|
2952
|
+
const value = data[column.name];
|
1647
2953
|
switch (column.type) {
|
1648
2954
|
case "datetime": {
|
1649
|
-
const date = value !== void 0 ? new Date(value) :
|
1650
|
-
if (date && isNaN(date.getTime())) {
|
2955
|
+
const date = value !== void 0 ? new Date(value) : null;
|
2956
|
+
if (date !== null && isNaN(date.getTime())) {
|
1651
2957
|
console.error(`Failed to parse date ${value} for field ${column.name}`);
|
1652
|
-
} else
|
1653
|
-
|
2958
|
+
} else {
|
2959
|
+
data[column.name] = date;
|
1654
2960
|
}
|
1655
2961
|
break;
|
1656
2962
|
}
|
@@ -1659,32 +2965,85 @@ const initObject = (db, schemaTables, table, object) => {
|
|
1659
2965
|
if (!linkTable) {
|
1660
2966
|
console.error(`Failed to parse link for field ${column.name}`);
|
1661
2967
|
} else if (isObject(value)) {
|
1662
|
-
|
2968
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
2969
|
+
if (item === column.name) {
|
2970
|
+
return [...acc, "*"];
|
2971
|
+
}
|
2972
|
+
if (item.startsWith(`${column.name}.`)) {
|
2973
|
+
const [, ...path] = item.split(".");
|
2974
|
+
return [...acc, path.join(".")];
|
2975
|
+
}
|
2976
|
+
return acc;
|
2977
|
+
}, []);
|
2978
|
+
data[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2979
|
+
} else {
|
2980
|
+
data[column.name] = null;
|
1663
2981
|
}
|
1664
2982
|
break;
|
1665
2983
|
}
|
2984
|
+
default:
|
2985
|
+
data[column.name] = value ?? null;
|
2986
|
+
if (column.notNull === true && value === null) {
|
2987
|
+
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2988
|
+
}
|
2989
|
+
break;
|
1666
2990
|
}
|
1667
2991
|
}
|
1668
|
-
|
1669
|
-
|
2992
|
+
const record = { ...data };
|
2993
|
+
record.read = function(columns2) {
|
2994
|
+
return db[table].read(record["id"], columns2);
|
2995
|
+
};
|
2996
|
+
record.update = function(data2, b, c) {
|
2997
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
2998
|
+
const ifVersion = parseIfVersion(b, c);
|
2999
|
+
return db[table].update(record["id"], data2, columns2, { ifVersion });
|
1670
3000
|
};
|
1671
|
-
|
1672
|
-
|
3001
|
+
record.replace = function(data2, b, c) {
|
3002
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
3003
|
+
const ifVersion = parseIfVersion(b, c);
|
3004
|
+
return db[table].createOrReplace(record["id"], data2, columns2, { ifVersion });
|
1673
3005
|
};
|
1674
|
-
|
1675
|
-
return db[table].delete(
|
3006
|
+
record.delete = function() {
|
3007
|
+
return db[table].delete(record["id"]);
|
1676
3008
|
};
|
1677
|
-
|
3009
|
+
record.getMetadata = function() {
|
1678
3010
|
return xata;
|
1679
3011
|
};
|
1680
|
-
|
1681
|
-
|
3012
|
+
record.toSerializable = function() {
|
3013
|
+
return JSON.parse(JSON.stringify(transformObjectLinks(data)));
|
3014
|
+
};
|
3015
|
+
record.toString = function() {
|
3016
|
+
return JSON.stringify(transformObjectLinks(data));
|
3017
|
+
};
|
3018
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
|
3019
|
+
Object.defineProperty(record, prop, { enumerable: false });
|
1682
3020
|
}
|
1683
|
-
Object.freeze(
|
1684
|
-
return
|
3021
|
+
Object.freeze(record);
|
3022
|
+
return record;
|
1685
3023
|
};
|
1686
|
-
function
|
1687
|
-
|
3024
|
+
function extractId(value) {
|
3025
|
+
if (isString(value))
|
3026
|
+
return value;
|
3027
|
+
if (isObject(value) && isString(value.id))
|
3028
|
+
return value.id;
|
3029
|
+
return void 0;
|
3030
|
+
}
|
3031
|
+
function isValidColumn(columns, column) {
|
3032
|
+
if (columns.includes("*"))
|
3033
|
+
return true;
|
3034
|
+
if (column.type === "link") {
|
3035
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
3036
|
+
return linkColumns.length > 0;
|
3037
|
+
}
|
3038
|
+
return columns.includes(column.name);
|
3039
|
+
}
|
3040
|
+
function parseIfVersion(...args) {
|
3041
|
+
for (const arg of args) {
|
3042
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
3043
|
+
return arg.ifVersion;
|
3044
|
+
}
|
3045
|
+
}
|
3046
|
+
return void 0;
|
1688
3047
|
}
|
1689
3048
|
|
1690
3049
|
var __accessCheck$3 = (obj, member, msg) => {
|
@@ -1736,18 +3095,25 @@ class SimpleCache {
|
|
1736
3095
|
}
|
1737
3096
|
_map = new WeakMap();
|
1738
3097
|
|
1739
|
-
const
|
1740
|
-
const
|
1741
|
-
const
|
1742
|
-
const
|
1743
|
-
const
|
1744
|
-
const
|
3098
|
+
const greaterThan = (value) => ({ $gt: value });
|
3099
|
+
const gt = greaterThan;
|
3100
|
+
const greaterThanEquals = (value) => ({ $ge: value });
|
3101
|
+
const greaterEquals = greaterThanEquals;
|
3102
|
+
const gte = greaterThanEquals;
|
3103
|
+
const ge = greaterThanEquals;
|
3104
|
+
const lessThan = (value) => ({ $lt: value });
|
3105
|
+
const lt = lessThan;
|
3106
|
+
const lessThanEquals = (value) => ({ $le: value });
|
3107
|
+
const lessEquals = lessThanEquals;
|
3108
|
+
const lte = lessThanEquals;
|
3109
|
+
const le = lessThanEquals;
|
1745
3110
|
const exists = (column) => ({ $exists: column });
|
1746
3111
|
const notExists = (column) => ({ $notExists: column });
|
1747
3112
|
const startsWith = (value) => ({ $startsWith: value });
|
1748
3113
|
const endsWith = (value) => ({ $endsWith: value });
|
1749
3114
|
const pattern = (value) => ({ $pattern: value });
|
1750
3115
|
const is = (value) => ({ $is: value });
|
3116
|
+
const equals = is;
|
1751
3117
|
const isNot = (value) => ({ $isNot: value });
|
1752
3118
|
const contains = (value) => ({ $contains: value });
|
1753
3119
|
const includes = (value) => ({ $includes: value });
|
@@ -1782,16 +3148,19 @@ class SchemaPlugin extends XataPlugin {
|
|
1782
3148
|
__privateSet$2(this, _schemaTables$1, schemaTables);
|
1783
3149
|
}
|
1784
3150
|
build(pluginOptions) {
|
1785
|
-
const db = new Proxy(
|
1786
|
-
|
1787
|
-
|
1788
|
-
|
1789
|
-
|
1790
|
-
|
3151
|
+
const db = new Proxy(
|
3152
|
+
{},
|
3153
|
+
{
|
3154
|
+
get: (_target, table) => {
|
3155
|
+
if (!isString(table))
|
3156
|
+
throw new Error("Invalid table name");
|
3157
|
+
if (__privateGet$2(this, _tables)[table] === void 0) {
|
3158
|
+
__privateGet$2(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
3159
|
+
}
|
3160
|
+
return __privateGet$2(this, _tables)[table];
|
1791
3161
|
}
|
1792
|
-
return __privateGet$2(this, _tables)[table];
|
1793
3162
|
}
|
1794
|
-
|
3163
|
+
);
|
1795
3164
|
const tableNames = __privateGet$2(this, _schemaTables$1)?.map(({ name }) => name) ?? [];
|
1796
3165
|
for (const table of tableNames) {
|
1797
3166
|
db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: __privateGet$2(this, _schemaTables$1) });
|
@@ -1841,7 +3210,7 @@ class SearchPlugin extends XataPlugin {
|
|
1841
3210
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, getFetchProps);
|
1842
3211
|
return records.map((record) => {
|
1843
3212
|
const { table = "orphan" } = record.xata;
|
1844
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
3213
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
1845
3214
|
});
|
1846
3215
|
},
|
1847
3216
|
byTable: async (query, options = {}) => {
|
@@ -1850,7 +3219,7 @@ class SearchPlugin extends XataPlugin {
|
|
1850
3219
|
return records.reduce((acc, record) => {
|
1851
3220
|
const { table = "orphan" } = record.xata;
|
1852
3221
|
const items = acc[table] ?? [];
|
1853
|
-
const item = initObject(this.db, schemaTables, table, record);
|
3222
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
1854
3223
|
return { ...acc, [table]: [...items, item] };
|
1855
3224
|
}, {});
|
1856
3225
|
}
|
@@ -1861,10 +3230,10 @@ _schemaTables = new WeakMap();
|
|
1861
3230
|
_search = new WeakSet();
|
1862
3231
|
search_fn = async function(query, options, getFetchProps) {
|
1863
3232
|
const fetchProps = await getFetchProps();
|
1864
|
-
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
3233
|
+
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
1865
3234
|
const { records } = await searchBranch({
|
1866
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
1867
|
-
body: { tables, query, fuzziness, prefix, highlight },
|
3235
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3236
|
+
body: { tables, query, fuzziness, prefix, highlight, page },
|
1868
3237
|
...fetchProps
|
1869
3238
|
});
|
1870
3239
|
return records;
|
@@ -1875,25 +3244,37 @@ getSchemaTables_fn = async function(getFetchProps) {
|
|
1875
3244
|
return __privateGet$1(this, _schemaTables);
|
1876
3245
|
const fetchProps = await getFetchProps();
|
1877
3246
|
const { schema } = await getBranchDetails({
|
1878
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
3247
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
1879
3248
|
...fetchProps
|
1880
3249
|
});
|
1881
3250
|
__privateSet$1(this, _schemaTables, schema.tables);
|
1882
3251
|
return schema.tables;
|
1883
3252
|
};
|
1884
3253
|
|
3254
|
+
class TransactionPlugin extends XataPlugin {
|
3255
|
+
build({ getFetchProps }) {
|
3256
|
+
return {
|
3257
|
+
run: async (operations) => {
|
3258
|
+
const fetchProps = await getFetchProps();
|
3259
|
+
const response = await branchTransaction({
|
3260
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3261
|
+
body: { operations },
|
3262
|
+
...fetchProps
|
3263
|
+
});
|
3264
|
+
return response;
|
3265
|
+
}
|
3266
|
+
};
|
3267
|
+
}
|
3268
|
+
}
|
3269
|
+
|
1885
3270
|
const isBranchStrategyBuilder = (strategy) => {
|
1886
3271
|
return typeof strategy === "function";
|
1887
3272
|
};
|
1888
3273
|
|
1889
3274
|
async function getCurrentBranchName(options) {
|
1890
3275
|
const { branch, envBranch } = getEnvironment();
|
1891
|
-
if (branch)
|
1892
|
-
|
1893
|
-
if (details)
|
1894
|
-
return branch;
|
1895
|
-
console.warn(`Branch ${branch} not found in Xata. Ignoring...`);
|
1896
|
-
}
|
3276
|
+
if (branch)
|
3277
|
+
return branch;
|
1897
3278
|
const gitBranch = envBranch || await getGitBranch();
|
1898
3279
|
return resolveXataBranch(gitBranch, options);
|
1899
3280
|
}
|
@@ -1905,19 +3286,29 @@ async function resolveXataBranch(gitBranch, options) {
|
|
1905
3286
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1906
3287
|
const apiKey = options?.apiKey || getAPIKey();
|
1907
3288
|
if (!databaseURL)
|
1908
|
-
throw new Error(
|
3289
|
+
throw new Error(
|
3290
|
+
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
3291
|
+
);
|
1909
3292
|
if (!apiKey)
|
1910
|
-
throw new Error(
|
3293
|
+
throw new Error(
|
3294
|
+
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
3295
|
+
);
|
1911
3296
|
const [protocol, , host, , dbName] = databaseURL.split("/");
|
1912
|
-
const
|
3297
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3298
|
+
if (!urlParts)
|
3299
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3300
|
+
const { workspace, region } = urlParts;
|
1913
3301
|
const { fallbackBranch } = getEnvironment();
|
1914
3302
|
const { branch } = await resolveBranch({
|
1915
3303
|
apiKey,
|
1916
3304
|
apiUrl: databaseURL,
|
1917
3305
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1918
3306
|
workspacesApiUrl: `${protocol}//${host}`,
|
1919
|
-
pathParams: { dbName, workspace },
|
1920
|
-
queryParams: { gitBranch, fallbackBranch }
|
3307
|
+
pathParams: { dbName, workspace, region },
|
3308
|
+
queryParams: { gitBranch, fallbackBranch },
|
3309
|
+
trace: defaultTrace,
|
3310
|
+
clientName: options?.clientName,
|
3311
|
+
xataAgentExtra: options?.xataAgentExtra
|
1921
3312
|
});
|
1922
3313
|
return branch;
|
1923
3314
|
}
|
@@ -1925,19 +3316,26 @@ async function getDatabaseBranch(branch, options) {
|
|
1925
3316
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
1926
3317
|
const apiKey = options?.apiKey || getAPIKey();
|
1927
3318
|
if (!databaseURL)
|
1928
|
-
throw new Error(
|
3319
|
+
throw new Error(
|
3320
|
+
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
3321
|
+
);
|
1929
3322
|
if (!apiKey)
|
1930
|
-
throw new Error(
|
3323
|
+
throw new Error(
|
3324
|
+
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
3325
|
+
);
|
1931
3326
|
const [protocol, , host, , database] = databaseURL.split("/");
|
1932
|
-
const
|
1933
|
-
|
3327
|
+
const urlParts = parseWorkspacesUrlParts(host);
|
3328
|
+
if (!urlParts)
|
3329
|
+
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3330
|
+
const { workspace, region } = urlParts;
|
1934
3331
|
try {
|
1935
3332
|
return await getBranchDetails({
|
1936
3333
|
apiKey,
|
1937
3334
|
apiUrl: databaseURL,
|
1938
3335
|
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
1939
3336
|
workspacesApiUrl: `${protocol}//${host}`,
|
1940
|
-
pathParams: { dbBranchName
|
3337
|
+
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
3338
|
+
trace: defaultTrace
|
1941
3339
|
});
|
1942
3340
|
} catch (err) {
|
1943
3341
|
if (isObject(err) && err.status === 404)
|
@@ -1977,22 +3375,27 @@ var __privateMethod = (obj, member, method) => {
|
|
1977
3375
|
return method;
|
1978
3376
|
};
|
1979
3377
|
const buildClient = (plugins) => {
|
1980
|
-
var _branch, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
|
3378
|
+
var _branch, _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _evaluateBranch, evaluateBranch_fn, _a;
|
1981
3379
|
return _a = class {
|
1982
3380
|
constructor(options = {}, schemaTables) {
|
1983
3381
|
__privateAdd(this, _parseOptions);
|
1984
3382
|
__privateAdd(this, _getFetchProps);
|
1985
3383
|
__privateAdd(this, _evaluateBranch);
|
1986
3384
|
__privateAdd(this, _branch, void 0);
|
3385
|
+
__privateAdd(this, _options, void 0);
|
1987
3386
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
3387
|
+
__privateSet(this, _options, safeOptions);
|
1988
3388
|
const pluginOptions = {
|
1989
3389
|
getFetchProps: () => __privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
|
1990
|
-
cache: safeOptions.cache
|
3390
|
+
cache: safeOptions.cache,
|
3391
|
+
trace: safeOptions.trace
|
1991
3392
|
};
|
1992
3393
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
1993
3394
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
3395
|
+
const transactions = new TransactionPlugin().build(pluginOptions);
|
1994
3396
|
this.db = db;
|
1995
3397
|
this.search = search;
|
3398
|
+
this.transactions = transactions;
|
1996
3399
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
1997
3400
|
if (namespace === void 0)
|
1998
3401
|
continue;
|
@@ -2006,21 +3409,60 @@ const buildClient = (plugins) => {
|
|
2006
3409
|
}
|
2007
3410
|
}
|
2008
3411
|
}
|
2009
|
-
|
3412
|
+
async getConfig() {
|
3413
|
+
const databaseURL = __privateGet(this, _options).databaseURL;
|
3414
|
+
const branch = await __privateGet(this, _options).branch();
|
3415
|
+
return { databaseURL, branch };
|
3416
|
+
}
|
3417
|
+
}, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
3418
|
+
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
3419
|
+
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
3420
|
+
if (isBrowser && !enableBrowser) {
|
3421
|
+
throw new Error(
|
3422
|
+
"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."
|
3423
|
+
);
|
3424
|
+
}
|
2010
3425
|
const fetch = getFetchImplementation(options?.fetch);
|
2011
3426
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2012
3427
|
const apiKey = options?.apiKey || getAPIKey();
|
2013
3428
|
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
2014
|
-
const
|
2015
|
-
|
2016
|
-
|
3429
|
+
const trace = options?.trace ?? defaultTrace;
|
3430
|
+
const clientName = options?.clientName;
|
3431
|
+
const xataAgentExtra = options?.xataAgentExtra;
|
3432
|
+
const branch = async () => options?.branch !== void 0 ? await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, options.branch) : await getCurrentBranchName({
|
3433
|
+
apiKey,
|
3434
|
+
databaseURL,
|
3435
|
+
fetchImpl: options?.fetch,
|
3436
|
+
clientName,
|
3437
|
+
xataAgentExtra
|
3438
|
+
});
|
3439
|
+
if (!apiKey) {
|
3440
|
+
throw new Error("Option apiKey is required");
|
3441
|
+
}
|
3442
|
+
if (!databaseURL) {
|
3443
|
+
throw new Error("Option databaseURL is required");
|
2017
3444
|
}
|
2018
|
-
return {
|
3445
|
+
return {
|
3446
|
+
fetch,
|
3447
|
+
databaseURL,
|
3448
|
+
apiKey,
|
3449
|
+
branch,
|
3450
|
+
cache,
|
3451
|
+
trace,
|
3452
|
+
clientID: generateUUID(),
|
3453
|
+
enableBrowser,
|
3454
|
+
clientName,
|
3455
|
+
xataAgentExtra
|
3456
|
+
};
|
2019
3457
|
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({
|
2020
3458
|
fetch,
|
2021
3459
|
apiKey,
|
2022
3460
|
databaseURL,
|
2023
|
-
branch
|
3461
|
+
branch,
|
3462
|
+
trace,
|
3463
|
+
clientID,
|
3464
|
+
clientName,
|
3465
|
+
xataAgentExtra
|
2024
3466
|
}) {
|
2025
3467
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
2026
3468
|
if (!branchValue)
|
@@ -2031,9 +3473,13 @@ const buildClient = (plugins) => {
|
|
2031
3473
|
apiUrl: "",
|
2032
3474
|
workspacesApiUrl: (path, params) => {
|
2033
3475
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2034
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
3476
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2035
3477
|
return databaseURL + newPath;
|
2036
|
-
}
|
3478
|
+
},
|
3479
|
+
trace,
|
3480
|
+
clientID,
|
3481
|
+
clientName,
|
3482
|
+
xataAgentExtra
|
2037
3483
|
};
|
2038
3484
|
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
2039
3485
|
if (__privateGet(this, _branch))
|
@@ -2056,6 +3502,88 @@ const buildClient = (plugins) => {
|
|
2056
3502
|
class BaseClient extends buildClient() {
|
2057
3503
|
}
|
2058
3504
|
|
3505
|
+
const META = "__";
|
3506
|
+
const VALUE = "___";
|
3507
|
+
class Serializer {
|
3508
|
+
constructor() {
|
3509
|
+
this.classes = {};
|
3510
|
+
}
|
3511
|
+
add(clazz) {
|
3512
|
+
this.classes[clazz.name] = clazz;
|
3513
|
+
}
|
3514
|
+
toJSON(data) {
|
3515
|
+
function visit(obj) {
|
3516
|
+
if (Array.isArray(obj))
|
3517
|
+
return obj.map(visit);
|
3518
|
+
const type = typeof obj;
|
3519
|
+
if (type === "undefined")
|
3520
|
+
return { [META]: "undefined" };
|
3521
|
+
if (type === "bigint")
|
3522
|
+
return { [META]: "bigint", [VALUE]: obj.toString() };
|
3523
|
+
if (obj === null || type !== "object")
|
3524
|
+
return obj;
|
3525
|
+
const constructor = obj.constructor;
|
3526
|
+
const o = { [META]: constructor.name };
|
3527
|
+
for (const [key, value] of Object.entries(obj)) {
|
3528
|
+
o[key] = visit(value);
|
3529
|
+
}
|
3530
|
+
if (constructor === Date)
|
3531
|
+
o[VALUE] = obj.toISOString();
|
3532
|
+
if (constructor === Map)
|
3533
|
+
o[VALUE] = Object.fromEntries(obj);
|
3534
|
+
if (constructor === Set)
|
3535
|
+
o[VALUE] = [...obj];
|
3536
|
+
return o;
|
3537
|
+
}
|
3538
|
+
return JSON.stringify(visit(data));
|
3539
|
+
}
|
3540
|
+
fromJSON(json) {
|
3541
|
+
return JSON.parse(json, (key, value) => {
|
3542
|
+
if (value && typeof value === "object" && !Array.isArray(value)) {
|
3543
|
+
const { [META]: clazz, [VALUE]: val, ...rest } = value;
|
3544
|
+
const constructor = this.classes[clazz];
|
3545
|
+
if (constructor) {
|
3546
|
+
return Object.assign(Object.create(constructor.prototype), rest);
|
3547
|
+
}
|
3548
|
+
if (clazz === "Date")
|
3549
|
+
return new Date(val);
|
3550
|
+
if (clazz === "Set")
|
3551
|
+
return new Set(val);
|
3552
|
+
if (clazz === "Map")
|
3553
|
+
return new Map(Object.entries(val));
|
3554
|
+
if (clazz === "bigint")
|
3555
|
+
return BigInt(val);
|
3556
|
+
if (clazz === "undefined")
|
3557
|
+
return void 0;
|
3558
|
+
return rest;
|
3559
|
+
}
|
3560
|
+
return value;
|
3561
|
+
});
|
3562
|
+
}
|
3563
|
+
}
|
3564
|
+
const defaultSerializer = new Serializer();
|
3565
|
+
const serialize = (data) => {
|
3566
|
+
return defaultSerializer.toJSON(data);
|
3567
|
+
};
|
3568
|
+
const deserialize = (json) => {
|
3569
|
+
return defaultSerializer.fromJSON(json);
|
3570
|
+
};
|
3571
|
+
|
3572
|
+
function buildWorkerRunner(config) {
|
3573
|
+
return function xataWorker(name, worker) {
|
3574
|
+
return async (...args) => {
|
3575
|
+
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
3576
|
+
const result = await fetch(url, {
|
3577
|
+
method: "POST",
|
3578
|
+
headers: { "Content-Type": "application/json" },
|
3579
|
+
body: serialize({ args })
|
3580
|
+
});
|
3581
|
+
const text = await result.text();
|
3582
|
+
return deserialize(text);
|
3583
|
+
};
|
3584
|
+
};
|
3585
|
+
}
|
3586
|
+
|
2059
3587
|
class XataError extends Error {
|
2060
3588
|
constructor(message, status) {
|
2061
3589
|
super(message);
|
@@ -2064,6 +3592,7 @@ class XataError extends Error {
|
|
2064
3592
|
}
|
2065
3593
|
|
2066
3594
|
exports.BaseClient = BaseClient;
|
3595
|
+
exports.FetcherError = FetcherError;
|
2067
3596
|
exports.Operations = operationsByTag;
|
2068
3597
|
exports.PAGINATION_DEFAULT_OFFSET = PAGINATION_DEFAULT_OFFSET;
|
2069
3598
|
exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
|
@@ -2076,6 +3605,7 @@ exports.Repository = Repository;
|
|
2076
3605
|
exports.RestRepository = RestRepository;
|
2077
3606
|
exports.SchemaPlugin = SchemaPlugin;
|
2078
3607
|
exports.SearchPlugin = SearchPlugin;
|
3608
|
+
exports.Serializer = Serializer;
|
2079
3609
|
exports.SimpleCache = SimpleCache;
|
2080
3610
|
exports.XataApiClient = XataApiClient;
|
2081
3611
|
exports.XataApiPlugin = XataApiPlugin;
|
@@ -2084,24 +3614,35 @@ exports.XataPlugin = XataPlugin;
|
|
2084
3614
|
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
2085
3615
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
2086
3616
|
exports.addTableColumn = addTableColumn;
|
3617
|
+
exports.aggregateTable = aggregateTable;
|
3618
|
+
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
3619
|
+
exports.branchTransaction = branchTransaction;
|
2087
3620
|
exports.buildClient = buildClient;
|
3621
|
+
exports.buildWorkerRunner = buildWorkerRunner;
|
2088
3622
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
2089
3623
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
3624
|
+
exports.compareBranchSchemas = compareBranchSchemas;
|
3625
|
+
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
3626
|
+
exports.compareMigrationRequest = compareMigrationRequest;
|
2090
3627
|
exports.contains = contains;
|
2091
3628
|
exports.createBranch = createBranch;
|
2092
3629
|
exports.createDatabase = createDatabase;
|
3630
|
+
exports.createMigrationRequest = createMigrationRequest;
|
2093
3631
|
exports.createTable = createTable;
|
2094
3632
|
exports.createUserAPIKey = createUserAPIKey;
|
2095
3633
|
exports.createWorkspace = createWorkspace;
|
2096
3634
|
exports.deleteBranch = deleteBranch;
|
2097
3635
|
exports.deleteColumn = deleteColumn;
|
2098
3636
|
exports.deleteDatabase = deleteDatabase;
|
3637
|
+
exports.deleteDatabaseGithubSettings = deleteDatabaseGithubSettings;
|
2099
3638
|
exports.deleteRecord = deleteRecord;
|
2100
3639
|
exports.deleteTable = deleteTable;
|
2101
3640
|
exports.deleteUser = deleteUser;
|
2102
3641
|
exports.deleteUserAPIKey = deleteUserAPIKey;
|
2103
3642
|
exports.deleteWorkspace = deleteWorkspace;
|
3643
|
+
exports.deserialize = deserialize;
|
2104
3644
|
exports.endsWith = endsWith;
|
3645
|
+
exports.equals = equals;
|
2105
3646
|
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
2106
3647
|
exports.exists = exists;
|
2107
3648
|
exports.ge = ge;
|
@@ -2111,13 +3652,19 @@ exports.getBranchList = getBranchList;
|
|
2111
3652
|
exports.getBranchMetadata = getBranchMetadata;
|
2112
3653
|
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
2113
3654
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
3655
|
+
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
2114
3656
|
exports.getBranchStats = getBranchStats;
|
2115
3657
|
exports.getColumn = getColumn;
|
2116
3658
|
exports.getCurrentBranchDetails = getCurrentBranchDetails;
|
2117
3659
|
exports.getCurrentBranchName = getCurrentBranchName;
|
3660
|
+
exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
|
2118
3661
|
exports.getDatabaseList = getDatabaseList;
|
3662
|
+
exports.getDatabaseMetadata = getDatabaseMetadata;
|
2119
3663
|
exports.getDatabaseURL = getDatabaseURL;
|
2120
3664
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
3665
|
+
exports.getHostUrl = getHostUrl;
|
3666
|
+
exports.getMigrationRequest = getMigrationRequest;
|
3667
|
+
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
2121
3668
|
exports.getRecord = getRecord;
|
2122
3669
|
exports.getTableColumns = getTableColumns;
|
2123
3670
|
exports.getTableSchema = getTableSchema;
|
@@ -2126,6 +3673,9 @@ exports.getUserAPIKeys = getUserAPIKeys;
|
|
2126
3673
|
exports.getWorkspace = getWorkspace;
|
2127
3674
|
exports.getWorkspaceMembersList = getWorkspaceMembersList;
|
2128
3675
|
exports.getWorkspacesList = getWorkspacesList;
|
3676
|
+
exports.greaterEquals = greaterEquals;
|
3677
|
+
exports.greaterThan = greaterThan;
|
3678
|
+
exports.greaterThanEquals = greaterThanEquals;
|
2129
3679
|
exports.gt = gt;
|
2130
3680
|
exports.gte = gte;
|
2131
3681
|
exports.includes = includes;
|
@@ -2137,15 +3687,27 @@ exports.insertRecordWithID = insertRecordWithID;
|
|
2137
3687
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
2138
3688
|
exports.is = is;
|
2139
3689
|
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
3690
|
+
exports.isHostProviderAlias = isHostProviderAlias;
|
3691
|
+
exports.isHostProviderBuilder = isHostProviderBuilder;
|
2140
3692
|
exports.isIdentifiable = isIdentifiable;
|
2141
3693
|
exports.isNot = isNot;
|
2142
3694
|
exports.isXataRecord = isXataRecord;
|
2143
3695
|
exports.le = le;
|
3696
|
+
exports.lessEquals = lessEquals;
|
3697
|
+
exports.lessThan = lessThan;
|
3698
|
+
exports.lessThanEquals = lessThanEquals;
|
3699
|
+
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
3700
|
+
exports.listRegions = listRegions;
|
2144
3701
|
exports.lt = lt;
|
2145
3702
|
exports.lte = lte;
|
3703
|
+
exports.mergeMigrationRequest = mergeMigrationRequest;
|
2146
3704
|
exports.notExists = notExists;
|
2147
3705
|
exports.operationsByTag = operationsByTag;
|
3706
|
+
exports.parseProviderString = parseProviderString;
|
3707
|
+
exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
|
2148
3708
|
exports.pattern = pattern;
|
3709
|
+
exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
|
3710
|
+
exports.queryMigrationRequests = queryMigrationRequests;
|
2149
3711
|
exports.queryTable = queryTable;
|
2150
3712
|
exports.removeGitBranchesEntry = removeGitBranchesEntry;
|
2151
3713
|
exports.removeWorkspaceMember = removeWorkspaceMember;
|
@@ -2153,10 +3715,16 @@ exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
|
2153
3715
|
exports.resolveBranch = resolveBranch;
|
2154
3716
|
exports.searchBranch = searchBranch;
|
2155
3717
|
exports.searchTable = searchTable;
|
3718
|
+
exports.serialize = serialize;
|
2156
3719
|
exports.setTableSchema = setTableSchema;
|
2157
3720
|
exports.startsWith = startsWith;
|
3721
|
+
exports.summarizeTable = summarizeTable;
|
2158
3722
|
exports.updateBranchMetadata = updateBranchMetadata;
|
3723
|
+
exports.updateBranchSchema = updateBranchSchema;
|
2159
3724
|
exports.updateColumn = updateColumn;
|
3725
|
+
exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
|
3726
|
+
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
3727
|
+
exports.updateMigrationRequest = updateMigrationRequest;
|
2160
3728
|
exports.updateRecordWithID = updateRecordWithID;
|
2161
3729
|
exports.updateTable = updateTable;
|
2162
3730
|
exports.updateUser = updateUser;
|
@@ -2164,4 +3732,5 @@ exports.updateWorkspace = updateWorkspace;
|
|
2164
3732
|
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
|
2165
3733
|
exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
|
2166
3734
|
exports.upsertRecordWithID = upsertRecordWithID;
|
3735
|
+
exports.vectorSearchTable = vectorSearchTable;
|
2167
3736
|
//# sourceMappingURL=index.cjs.map
|