@xata.io/client 0.0.0-alpha.vfe9bed6 → 0.0.0-alpha.vfed34c9
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/.turbo/turbo-add-version.log +4 -0
- package/.turbo/turbo-build.log +18 -0
- package/CHANGELOG.md +286 -0
- package/README.md +3 -269
- package/dist/index.cjs +2523 -872
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +5387 -2199
- package/dist/index.mjs +2494 -850
- package/dist/index.mjs.map +1 -1
- package/package.json +13 -11
- package/.eslintrc.cjs +0 -12
- package/Usage.md +0 -451
- package/rollup.config.js +0 -29
- package/tsconfig.json +0 -23
package/dist/index.cjs
CHANGED
@@ -1,27 +1,8 @@
|
|
1
1
|
'use strict';
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
function _interopNamespace(e) {
|
6
|
-
if (e && e.__esModule) return e;
|
7
|
-
var n = Object.create(null);
|
8
|
-
if (e) {
|
9
|
-
Object.keys(e).forEach(function (k) {
|
10
|
-
if (k !== 'default') {
|
11
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
12
|
-
Object.defineProperty(n, k, d.get ? d : {
|
13
|
-
enumerable: true,
|
14
|
-
get: function () { return e[k]; }
|
15
|
-
});
|
16
|
-
}
|
17
|
-
});
|
18
|
-
}
|
19
|
-
n["default"] = e;
|
20
|
-
return Object.freeze(n);
|
21
|
-
}
|
22
|
-
|
23
|
-
const defaultTrace = async (_name, fn, _options) => {
|
3
|
+
const defaultTrace = async (name, fn, _options) => {
|
24
4
|
return await fn({
|
5
|
+
name,
|
25
6
|
setAttributes: () => {
|
26
7
|
return;
|
27
8
|
}
|
@@ -60,6 +41,21 @@ function isString(value) {
|
|
60
41
|
function isStringArray(value) {
|
61
42
|
return isDefined(value) && Array.isArray(value) && value.every(isString);
|
62
43
|
}
|
44
|
+
function isNumber(value) {
|
45
|
+
return isDefined(value) && typeof value === "number";
|
46
|
+
}
|
47
|
+
function parseNumber(value) {
|
48
|
+
if (isNumber(value)) {
|
49
|
+
return value;
|
50
|
+
}
|
51
|
+
if (isString(value)) {
|
52
|
+
const parsed = Number(value);
|
53
|
+
if (!Number.isNaN(parsed)) {
|
54
|
+
return parsed;
|
55
|
+
}
|
56
|
+
}
|
57
|
+
return void 0;
|
58
|
+
}
|
63
59
|
function toBase64(value) {
|
64
60
|
try {
|
65
61
|
return btoa(value);
|
@@ -68,16 +64,39 @@ function toBase64(value) {
|
|
68
64
|
return buf.from(value).toString("base64");
|
69
65
|
}
|
70
66
|
}
|
67
|
+
function deepMerge(a, b) {
|
68
|
+
const result = { ...a };
|
69
|
+
for (const [key, value] of Object.entries(b)) {
|
70
|
+
if (isObject(value) && isObject(result[key])) {
|
71
|
+
result[key] = deepMerge(result[key], value);
|
72
|
+
} else {
|
73
|
+
result[key] = value;
|
74
|
+
}
|
75
|
+
}
|
76
|
+
return result;
|
77
|
+
}
|
78
|
+
function chunk(array, chunkSize) {
|
79
|
+
const result = [];
|
80
|
+
for (let i = 0; i < array.length; i += chunkSize) {
|
81
|
+
result.push(array.slice(i, i + chunkSize));
|
82
|
+
}
|
83
|
+
return result;
|
84
|
+
}
|
85
|
+
async function timeout(ms) {
|
86
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
87
|
+
}
|
71
88
|
|
72
89
|
function getEnvironment() {
|
73
90
|
try {
|
74
|
-
if (
|
91
|
+
if (isDefined(process) && isDefined(process.env)) {
|
75
92
|
return {
|
76
93
|
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
77
94
|
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
78
95
|
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
79
|
-
|
80
|
-
|
96
|
+
deployPreview: process.env.XATA_PREVIEW,
|
97
|
+
deployPreviewBranch: process.env.XATA_PREVIEW_BRANCH,
|
98
|
+
vercelGitCommitRef: process.env.VERCEL_GIT_COMMIT_REF,
|
99
|
+
vercelGitRepoOwner: process.env.VERCEL_GIT_REPO_OWNER
|
81
100
|
};
|
82
101
|
}
|
83
102
|
} catch (err) {
|
@@ -88,8 +107,10 @@ function getEnvironment() {
|
|
88
107
|
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
89
108
|
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
90
109
|
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
91
|
-
|
92
|
-
|
110
|
+
deployPreview: Deno.env.get("XATA_PREVIEW"),
|
111
|
+
deployPreviewBranch: Deno.env.get("XATA_PREVIEW_BRANCH"),
|
112
|
+
vercelGitCommitRef: Deno.env.get("VERCEL_GIT_COMMIT_REF"),
|
113
|
+
vercelGitRepoOwner: Deno.env.get("VERCEL_GIT_REPO_OWNER")
|
93
114
|
};
|
94
115
|
}
|
95
116
|
} catch (err) {
|
@@ -98,10 +119,31 @@ function getEnvironment() {
|
|
98
119
|
apiKey: getGlobalApiKey(),
|
99
120
|
databaseURL: getGlobalDatabaseURL(),
|
100
121
|
branch: getGlobalBranch(),
|
101
|
-
|
102
|
-
|
122
|
+
deployPreview: void 0,
|
123
|
+
deployPreviewBranch: void 0,
|
124
|
+
vercelGitCommitRef: void 0,
|
125
|
+
vercelGitRepoOwner: void 0
|
103
126
|
};
|
104
127
|
}
|
128
|
+
function getEnableBrowserVariable() {
|
129
|
+
try {
|
130
|
+
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
131
|
+
return process.env.XATA_ENABLE_BROWSER === "true";
|
132
|
+
}
|
133
|
+
} catch (err) {
|
134
|
+
}
|
135
|
+
try {
|
136
|
+
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
137
|
+
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
138
|
+
}
|
139
|
+
} catch (err) {
|
140
|
+
}
|
141
|
+
try {
|
142
|
+
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
143
|
+
} catch (err) {
|
144
|
+
return void 0;
|
145
|
+
}
|
146
|
+
}
|
105
147
|
function getGlobalApiKey() {
|
106
148
|
try {
|
107
149
|
return XATA_API_KEY;
|
@@ -123,44 +165,76 @@ function getGlobalBranch() {
|
|
123
165
|
return void 0;
|
124
166
|
}
|
125
167
|
}
|
126
|
-
function
|
168
|
+
function getDatabaseURL() {
|
127
169
|
try {
|
128
|
-
|
170
|
+
const { databaseURL } = getEnvironment();
|
171
|
+
return databaseURL;
|
129
172
|
} catch (err) {
|
130
173
|
return void 0;
|
131
174
|
}
|
132
175
|
}
|
133
|
-
|
134
|
-
const cmd = ["git", "branch", "--show-current"];
|
135
|
-
const fullCmd = cmd.join(" ");
|
136
|
-
const nodeModule = ["child", "process"].join("_");
|
137
|
-
const execOptions = { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] };
|
176
|
+
function getAPIKey() {
|
138
177
|
try {
|
139
|
-
|
140
|
-
|
141
|
-
}
|
142
|
-
const { execSync } = await (function (t) { return Promise.resolve().then(function () { return /*#__PURE__*/_interopNamespace(require(t)); }); })(nodeModule);
|
143
|
-
return execSync(fullCmd, execOptions).toString().trim();
|
178
|
+
const { apiKey } = getEnvironment();
|
179
|
+
return apiKey;
|
144
180
|
} catch (err) {
|
181
|
+
return void 0;
|
145
182
|
}
|
183
|
+
}
|
184
|
+
function getBranch() {
|
146
185
|
try {
|
147
|
-
|
148
|
-
|
149
|
-
return new TextDecoder().decode(await process2.output()).trim();
|
150
|
-
}
|
186
|
+
const { branch } = getEnvironment();
|
187
|
+
return branch ?? "main";
|
151
188
|
} catch (err) {
|
189
|
+
return void 0;
|
152
190
|
}
|
153
191
|
}
|
154
|
-
|
155
|
-
|
192
|
+
function buildPreviewBranchName({ org, branch }) {
|
193
|
+
return `preview-${org}-${branch}`;
|
194
|
+
}
|
195
|
+
function getPreviewBranch() {
|
156
196
|
try {
|
157
|
-
const {
|
158
|
-
|
197
|
+
const { deployPreview, deployPreviewBranch, vercelGitCommitRef, vercelGitRepoOwner } = getEnvironment();
|
198
|
+
if (deployPreviewBranch)
|
199
|
+
return deployPreviewBranch;
|
200
|
+
switch (deployPreview) {
|
201
|
+
case "vercel": {
|
202
|
+
if (!vercelGitCommitRef || !vercelGitRepoOwner) {
|
203
|
+
console.warn("XATA_PREVIEW=vercel but VERCEL_GIT_COMMIT_REF or VERCEL_GIT_REPO_OWNER is not valid");
|
204
|
+
return void 0;
|
205
|
+
}
|
206
|
+
return buildPreviewBranchName({ org: vercelGitRepoOwner, branch: vercelGitCommitRef });
|
207
|
+
}
|
208
|
+
}
|
209
|
+
return void 0;
|
159
210
|
} catch (err) {
|
160
211
|
return void 0;
|
161
212
|
}
|
162
213
|
}
|
163
214
|
|
215
|
+
var __accessCheck$8 = (obj, member, msg) => {
|
216
|
+
if (!member.has(obj))
|
217
|
+
throw TypeError("Cannot " + msg);
|
218
|
+
};
|
219
|
+
var __privateGet$8 = (obj, member, getter) => {
|
220
|
+
__accessCheck$8(obj, member, "read from private field");
|
221
|
+
return getter ? getter.call(obj) : member.get(obj);
|
222
|
+
};
|
223
|
+
var __privateAdd$8 = (obj, member, value) => {
|
224
|
+
if (member.has(obj))
|
225
|
+
throw TypeError("Cannot add the same private member more than once");
|
226
|
+
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
227
|
+
};
|
228
|
+
var __privateSet$8 = (obj, member, value, setter) => {
|
229
|
+
__accessCheck$8(obj, member, "write to private field");
|
230
|
+
setter ? setter.call(obj, value) : member.set(obj, value);
|
231
|
+
return value;
|
232
|
+
};
|
233
|
+
var __privateMethod$4 = (obj, member, method) => {
|
234
|
+
__accessCheck$8(obj, member, "access private method");
|
235
|
+
return method;
|
236
|
+
};
|
237
|
+
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
164
238
|
function getFetchImplementation(userFetch) {
|
165
239
|
const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
|
166
240
|
const fetchImpl = userFetch ?? globalFetch;
|
@@ -171,8 +245,254 @@ function getFetchImplementation(userFetch) {
|
|
171
245
|
}
|
172
246
|
return fetchImpl;
|
173
247
|
}
|
248
|
+
class ApiRequestPool {
|
249
|
+
constructor(concurrency = 10) {
|
250
|
+
__privateAdd$8(this, _enqueue);
|
251
|
+
__privateAdd$8(this, _fetch, void 0);
|
252
|
+
__privateAdd$8(this, _queue, void 0);
|
253
|
+
__privateAdd$8(this, _concurrency, void 0);
|
254
|
+
__privateSet$8(this, _queue, []);
|
255
|
+
__privateSet$8(this, _concurrency, concurrency);
|
256
|
+
this.running = 0;
|
257
|
+
this.started = 0;
|
258
|
+
}
|
259
|
+
setFetch(fetch2) {
|
260
|
+
__privateSet$8(this, _fetch, fetch2);
|
261
|
+
}
|
262
|
+
getFetch() {
|
263
|
+
if (!__privateGet$8(this, _fetch)) {
|
264
|
+
throw new Error("Fetch not set");
|
265
|
+
}
|
266
|
+
return __privateGet$8(this, _fetch);
|
267
|
+
}
|
268
|
+
request(url, options) {
|
269
|
+
const start = /* @__PURE__ */ new Date();
|
270
|
+
const fetch2 = this.getFetch();
|
271
|
+
const runRequest = async (stalled = false) => {
|
272
|
+
const response = await fetch2(url, options);
|
273
|
+
if (response.status === 429) {
|
274
|
+
const rateLimitReset = parseNumber(response.headers?.get("x-ratelimit-reset")) ?? 1;
|
275
|
+
await timeout(rateLimitReset * 1e3);
|
276
|
+
return await runRequest(true);
|
277
|
+
}
|
278
|
+
if (stalled) {
|
279
|
+
const stalledTime = (/* @__PURE__ */ new Date()).getTime() - start.getTime();
|
280
|
+
console.warn(`A request to Xata hit your workspace limits, was retried and stalled for ${stalledTime}ms`);
|
281
|
+
}
|
282
|
+
return response;
|
283
|
+
};
|
284
|
+
return __privateMethod$4(this, _enqueue, enqueue_fn).call(this, async () => {
|
285
|
+
return await runRequest();
|
286
|
+
});
|
287
|
+
}
|
288
|
+
}
|
289
|
+
_fetch = new WeakMap();
|
290
|
+
_queue = new WeakMap();
|
291
|
+
_concurrency = new WeakMap();
|
292
|
+
_enqueue = new WeakSet();
|
293
|
+
enqueue_fn = function(task) {
|
294
|
+
const promise = new Promise((resolve) => __privateGet$8(this, _queue).push(resolve)).finally(() => {
|
295
|
+
this.started--;
|
296
|
+
this.running++;
|
297
|
+
}).then(() => task()).finally(() => {
|
298
|
+
this.running--;
|
299
|
+
const next = __privateGet$8(this, _queue).shift();
|
300
|
+
if (next !== void 0) {
|
301
|
+
this.started++;
|
302
|
+
next();
|
303
|
+
}
|
304
|
+
});
|
305
|
+
if (this.running + this.started < __privateGet$8(this, _concurrency)) {
|
306
|
+
const next = __privateGet$8(this, _queue).shift();
|
307
|
+
if (next !== void 0) {
|
308
|
+
this.started++;
|
309
|
+
next();
|
310
|
+
}
|
311
|
+
}
|
312
|
+
return promise;
|
313
|
+
};
|
314
|
+
|
315
|
+
function generateUUID() {
|
316
|
+
return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, function(c) {
|
317
|
+
const r = Math.random() * 16 | 0, v = c == "x" ? r : r & 3 | 8;
|
318
|
+
return v.toString(16);
|
319
|
+
});
|
320
|
+
}
|
321
|
+
|
322
|
+
async function getBytes(stream, onChunk) {
|
323
|
+
const reader = stream.getReader();
|
324
|
+
let result;
|
325
|
+
while (!(result = await reader.read()).done) {
|
326
|
+
onChunk(result.value);
|
327
|
+
}
|
328
|
+
}
|
329
|
+
function getLines(onLine) {
|
330
|
+
let buffer;
|
331
|
+
let position;
|
332
|
+
let fieldLength;
|
333
|
+
let discardTrailingNewline = false;
|
334
|
+
return function onChunk(arr) {
|
335
|
+
if (buffer === void 0) {
|
336
|
+
buffer = arr;
|
337
|
+
position = 0;
|
338
|
+
fieldLength = -1;
|
339
|
+
} else {
|
340
|
+
buffer = concat(buffer, arr);
|
341
|
+
}
|
342
|
+
const bufLength = buffer.length;
|
343
|
+
let lineStart = 0;
|
344
|
+
while (position < bufLength) {
|
345
|
+
if (discardTrailingNewline) {
|
346
|
+
if (buffer[position] === 10 /* NewLine */) {
|
347
|
+
lineStart = ++position;
|
348
|
+
}
|
349
|
+
discardTrailingNewline = false;
|
350
|
+
}
|
351
|
+
let lineEnd = -1;
|
352
|
+
for (; position < bufLength && lineEnd === -1; ++position) {
|
353
|
+
switch (buffer[position]) {
|
354
|
+
case 58 /* Colon */:
|
355
|
+
if (fieldLength === -1) {
|
356
|
+
fieldLength = position - lineStart;
|
357
|
+
}
|
358
|
+
break;
|
359
|
+
case 13 /* CarriageReturn */:
|
360
|
+
discardTrailingNewline = true;
|
361
|
+
case 10 /* NewLine */:
|
362
|
+
lineEnd = position;
|
363
|
+
break;
|
364
|
+
}
|
365
|
+
}
|
366
|
+
if (lineEnd === -1) {
|
367
|
+
break;
|
368
|
+
}
|
369
|
+
onLine(buffer.subarray(lineStart, lineEnd), fieldLength);
|
370
|
+
lineStart = position;
|
371
|
+
fieldLength = -1;
|
372
|
+
}
|
373
|
+
if (lineStart === bufLength) {
|
374
|
+
buffer = void 0;
|
375
|
+
} else if (lineStart !== 0) {
|
376
|
+
buffer = buffer.subarray(lineStart);
|
377
|
+
position -= lineStart;
|
378
|
+
}
|
379
|
+
};
|
380
|
+
}
|
381
|
+
function getMessages(onId, onRetry, onMessage) {
|
382
|
+
let message = newMessage();
|
383
|
+
const decoder = new TextDecoder();
|
384
|
+
return function onLine(line, fieldLength) {
|
385
|
+
if (line.length === 0) {
|
386
|
+
onMessage?.(message);
|
387
|
+
message = newMessage();
|
388
|
+
} else if (fieldLength > 0) {
|
389
|
+
const field = decoder.decode(line.subarray(0, fieldLength));
|
390
|
+
const valueOffset = fieldLength + (line[fieldLength + 1] === 32 /* Space */ ? 2 : 1);
|
391
|
+
const value = decoder.decode(line.subarray(valueOffset));
|
392
|
+
switch (field) {
|
393
|
+
case "data":
|
394
|
+
message.data = message.data ? message.data + "\n" + value : value;
|
395
|
+
break;
|
396
|
+
case "event":
|
397
|
+
message.event = value;
|
398
|
+
break;
|
399
|
+
case "id":
|
400
|
+
onId(message.id = value);
|
401
|
+
break;
|
402
|
+
case "retry":
|
403
|
+
const retry = parseInt(value, 10);
|
404
|
+
if (!isNaN(retry)) {
|
405
|
+
onRetry(message.retry = retry);
|
406
|
+
}
|
407
|
+
break;
|
408
|
+
}
|
409
|
+
}
|
410
|
+
};
|
411
|
+
}
|
412
|
+
function concat(a, b) {
|
413
|
+
const res = new Uint8Array(a.length + b.length);
|
414
|
+
res.set(a);
|
415
|
+
res.set(b, a.length);
|
416
|
+
return res;
|
417
|
+
}
|
418
|
+
function newMessage() {
|
419
|
+
return {
|
420
|
+
data: "",
|
421
|
+
event: "",
|
422
|
+
id: "",
|
423
|
+
retry: void 0
|
424
|
+
};
|
425
|
+
}
|
426
|
+
const EventStreamContentType = "text/event-stream";
|
427
|
+
const LastEventId = "last-event-id";
|
428
|
+
function fetchEventSource(input, {
|
429
|
+
signal: inputSignal,
|
430
|
+
headers: inputHeaders,
|
431
|
+
onopen: inputOnOpen,
|
432
|
+
onmessage,
|
433
|
+
onclose,
|
434
|
+
onerror,
|
435
|
+
fetch: inputFetch,
|
436
|
+
...rest
|
437
|
+
}) {
|
438
|
+
return new Promise((resolve, reject) => {
|
439
|
+
const headers = { ...inputHeaders };
|
440
|
+
if (!headers.accept) {
|
441
|
+
headers.accept = EventStreamContentType;
|
442
|
+
}
|
443
|
+
let curRequestController;
|
444
|
+
function dispose() {
|
445
|
+
curRequestController.abort();
|
446
|
+
}
|
447
|
+
inputSignal?.addEventListener("abort", () => {
|
448
|
+
dispose();
|
449
|
+
resolve();
|
450
|
+
});
|
451
|
+
const fetchImpl = inputFetch ?? fetch;
|
452
|
+
const onopen = inputOnOpen ?? defaultOnOpen;
|
453
|
+
async function create() {
|
454
|
+
curRequestController = new AbortController();
|
455
|
+
try {
|
456
|
+
const response = await fetchImpl(input, {
|
457
|
+
...rest,
|
458
|
+
headers,
|
459
|
+
signal: curRequestController.signal
|
460
|
+
});
|
461
|
+
await onopen(response);
|
462
|
+
await getBytes(
|
463
|
+
response.body,
|
464
|
+
getLines(
|
465
|
+
getMessages(
|
466
|
+
(id) => {
|
467
|
+
if (id) {
|
468
|
+
headers[LastEventId] = id;
|
469
|
+
} else {
|
470
|
+
delete headers[LastEventId];
|
471
|
+
}
|
472
|
+
},
|
473
|
+
(_retry) => {
|
474
|
+
},
|
475
|
+
onmessage
|
476
|
+
)
|
477
|
+
)
|
478
|
+
);
|
479
|
+
onclose?.();
|
480
|
+
dispose();
|
481
|
+
resolve();
|
482
|
+
} catch (err) {
|
483
|
+
}
|
484
|
+
}
|
485
|
+
create();
|
486
|
+
});
|
487
|
+
}
|
488
|
+
function defaultOnOpen(response) {
|
489
|
+
const contentType = response.headers?.get("content-type");
|
490
|
+
if (!contentType?.startsWith(EventStreamContentType)) {
|
491
|
+
throw new Error(`Expected content-type to be ${EventStreamContentType}, Actual: ${contentType}`);
|
492
|
+
}
|
493
|
+
}
|
174
494
|
|
175
|
-
const VERSION = "0.
|
495
|
+
const VERSION = "0.24.3";
|
176
496
|
|
177
497
|
class ErrorWithCause extends Error {
|
178
498
|
constructor(message, options) {
|
@@ -183,7 +503,7 @@ class FetcherError extends ErrorWithCause {
|
|
183
503
|
constructor(status, data, requestId) {
|
184
504
|
super(getMessage(data));
|
185
505
|
this.status = status;
|
186
|
-
this.errors = isBulkError(data) ? data.errors :
|
506
|
+
this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
|
187
507
|
this.requestId = requestId;
|
188
508
|
if (data instanceof Error) {
|
189
509
|
this.stack = data.stack;
|
@@ -215,6 +535,7 @@ function getMessage(data) {
|
|
215
535
|
}
|
216
536
|
}
|
217
537
|
|
538
|
+
const pool = new ApiRequestPool();
|
218
539
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
219
540
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
220
541
|
if (value === void 0 || value === null)
|
@@ -229,58 +550,79 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
229
550
|
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
230
551
|
};
|
231
552
|
function buildBaseUrl({
|
553
|
+
endpoint,
|
232
554
|
path,
|
233
555
|
workspacesApiUrl,
|
234
556
|
apiUrl,
|
235
|
-
pathParams
|
557
|
+
pathParams = {}
|
236
558
|
}) {
|
237
|
-
if (
|
238
|
-
|
239
|
-
|
240
|
-
|
559
|
+
if (endpoint === "dataPlane") {
|
560
|
+
const url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
561
|
+
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
562
|
+
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
563
|
+
}
|
564
|
+
return `${apiUrl}${path}`;
|
241
565
|
}
|
242
566
|
function hostHeader(url) {
|
243
567
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
244
568
|
const { groups } = pattern.exec(url) ?? {};
|
245
569
|
return groups?.host ? { Host: groups.host } : {};
|
246
570
|
}
|
571
|
+
const defaultClientID = generateUUID();
|
247
572
|
async function fetch$1({
|
248
573
|
url: path,
|
249
574
|
method,
|
250
575
|
body,
|
251
|
-
headers,
|
576
|
+
headers: customHeaders,
|
252
577
|
pathParams,
|
253
578
|
queryParams,
|
254
|
-
|
579
|
+
fetch: fetch2,
|
255
580
|
apiKey,
|
581
|
+
endpoint,
|
256
582
|
apiUrl,
|
257
583
|
workspacesApiUrl,
|
258
|
-
trace
|
584
|
+
trace,
|
585
|
+
signal,
|
586
|
+
clientID,
|
587
|
+
sessionID,
|
588
|
+
clientName,
|
589
|
+
xataAgentExtra,
|
590
|
+
fetchOptions = {}
|
259
591
|
}) {
|
260
|
-
|
592
|
+
pool.setFetch(fetch2);
|
593
|
+
return await trace(
|
261
594
|
`${method.toUpperCase()} ${path}`,
|
262
595
|
async ({ setAttributes }) => {
|
263
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
596
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
264
597
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
265
598
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
266
599
|
setAttributes({
|
267
600
|
[TraceAttributes.HTTP_URL]: url,
|
268
601
|
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
269
602
|
});
|
270
|
-
const
|
603
|
+
const xataAgent = compact([
|
604
|
+
["client", "TS_SDK"],
|
605
|
+
["version", VERSION],
|
606
|
+
isDefined(clientName) ? ["service", clientName] : void 0,
|
607
|
+
...Object.entries(xataAgentExtra ?? {})
|
608
|
+
]).map(([key, value]) => `${key}=${value}`).join("; ");
|
609
|
+
const headers = {
|
610
|
+
"Accept-Encoding": "identity",
|
611
|
+
"Content-Type": "application/json",
|
612
|
+
"X-Xata-Client-ID": clientID ?? defaultClientID,
|
613
|
+
"X-Xata-Session-ID": sessionID ?? generateUUID(),
|
614
|
+
"X-Xata-Agent": xataAgent,
|
615
|
+
...customHeaders,
|
616
|
+
...hostHeader(fullUrl),
|
617
|
+
Authorization: `Bearer ${apiKey}`
|
618
|
+
};
|
619
|
+
const response = await pool.request(url, {
|
620
|
+
...fetchOptions,
|
271
621
|
method: method.toUpperCase(),
|
272
622
|
body: body ? JSON.stringify(body) : void 0,
|
273
|
-
headers
|
274
|
-
|
275
|
-
"User-Agent": `Xata client-ts/${VERSION}`,
|
276
|
-
...headers,
|
277
|
-
...hostHeader(fullUrl),
|
278
|
-
Authorization: `Bearer ${apiKey}`
|
279
|
-
}
|
623
|
+
headers,
|
624
|
+
signal
|
280
625
|
});
|
281
|
-
if (response.status === 204) {
|
282
|
-
return {};
|
283
|
-
}
|
284
626
|
const { host, protocol } = parseUrl(response.url);
|
285
627
|
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
286
628
|
setAttributes({
|
@@ -290,6 +632,15 @@ async function fetch$1({
|
|
290
632
|
[TraceAttributes.HTTP_HOST]: host,
|
291
633
|
[TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
|
292
634
|
});
|
635
|
+
const message = response.headers?.get("x-xata-message");
|
636
|
+
if (message)
|
637
|
+
console.warn(message);
|
638
|
+
if (response.status === 204) {
|
639
|
+
return {};
|
640
|
+
}
|
641
|
+
if (response.status === 429) {
|
642
|
+
throw new FetcherError(response.status, "Rate limit exceeded", requestId);
|
643
|
+
}
|
293
644
|
try {
|
294
645
|
const jsonResponse = await response.json();
|
295
646
|
if (response.ok) {
|
@@ -303,6 +654,59 @@ async function fetch$1({
|
|
303
654
|
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
304
655
|
);
|
305
656
|
}
|
657
|
+
function fetchSSERequest({
|
658
|
+
url: path,
|
659
|
+
method,
|
660
|
+
body,
|
661
|
+
headers: customHeaders,
|
662
|
+
pathParams,
|
663
|
+
queryParams,
|
664
|
+
fetch: fetch2,
|
665
|
+
apiKey,
|
666
|
+
endpoint,
|
667
|
+
apiUrl,
|
668
|
+
workspacesApiUrl,
|
669
|
+
onMessage,
|
670
|
+
onError,
|
671
|
+
onClose,
|
672
|
+
signal,
|
673
|
+
clientID,
|
674
|
+
sessionID,
|
675
|
+
clientName,
|
676
|
+
xataAgentExtra
|
677
|
+
}) {
|
678
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
679
|
+
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
680
|
+
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
681
|
+
void fetchEventSource(url, {
|
682
|
+
method,
|
683
|
+
body: JSON.stringify(body),
|
684
|
+
fetch: fetch2,
|
685
|
+
signal,
|
686
|
+
headers: {
|
687
|
+
"X-Xata-Client-ID": clientID ?? defaultClientID,
|
688
|
+
"X-Xata-Session-ID": sessionID ?? generateUUID(),
|
689
|
+
"X-Xata-Agent": compact([
|
690
|
+
["client", "TS_SDK"],
|
691
|
+
["version", VERSION],
|
692
|
+
isDefined(clientName) ? ["service", clientName] : void 0,
|
693
|
+
...Object.entries(xataAgentExtra ?? {})
|
694
|
+
]).map(([key, value]) => `${key}=${value}`).join("; "),
|
695
|
+
...customHeaders,
|
696
|
+
Authorization: `Bearer ${apiKey}`,
|
697
|
+
"Content-Type": "application/json"
|
698
|
+
},
|
699
|
+
onmessage(ev) {
|
700
|
+
onMessage?.(JSON.parse(ev.data));
|
701
|
+
},
|
702
|
+
onerror(ev) {
|
703
|
+
onError?.(JSON.parse(ev.data));
|
704
|
+
},
|
705
|
+
onclose() {
|
706
|
+
onClose?.();
|
707
|
+
}
|
708
|
+
});
|
709
|
+
}
|
306
710
|
function parseUrl(url) {
|
307
711
|
try {
|
308
712
|
const { host, protocol } = new URL(url);
|
@@ -312,290 +716,242 @@ function parseUrl(url) {
|
|
312
716
|
}
|
313
717
|
}
|
314
718
|
|
315
|
-
const
|
316
|
-
|
317
|
-
const
|
318
|
-
|
319
|
-
url: "/user/keys",
|
320
|
-
method: "get",
|
321
|
-
...variables
|
322
|
-
});
|
323
|
-
const createUserAPIKey = (variables) => fetch$1({
|
324
|
-
url: "/user/keys/{keyName}",
|
325
|
-
method: "post",
|
326
|
-
...variables
|
327
|
-
});
|
328
|
-
const deleteUserAPIKey = (variables) => fetch$1({
|
329
|
-
url: "/user/keys/{keyName}",
|
330
|
-
method: "delete",
|
331
|
-
...variables
|
332
|
-
});
|
333
|
-
const createWorkspace = (variables) => fetch$1({
|
334
|
-
url: "/workspaces",
|
335
|
-
method: "post",
|
336
|
-
...variables
|
337
|
-
});
|
338
|
-
const getWorkspacesList = (variables) => fetch$1({
|
339
|
-
url: "/workspaces",
|
340
|
-
method: "get",
|
341
|
-
...variables
|
342
|
-
});
|
343
|
-
const getWorkspace = (variables) => fetch$1({
|
344
|
-
url: "/workspaces/{workspaceId}",
|
719
|
+
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
720
|
+
|
721
|
+
const getBranchList = (variables, signal) => dataPlaneFetch({
|
722
|
+
url: "/dbs/{dbName}",
|
345
723
|
method: "get",
|
346
|
-
...variables
|
347
|
-
|
348
|
-
const updateWorkspace = (variables) => fetch$1({
|
349
|
-
url: "/workspaces/{workspaceId}",
|
350
|
-
method: "put",
|
351
|
-
...variables
|
724
|
+
...variables,
|
725
|
+
signal
|
352
726
|
});
|
353
|
-
const
|
354
|
-
url: "/
|
355
|
-
method: "delete",
|
356
|
-
...variables
|
357
|
-
});
|
358
|
-
const getWorkspaceMembersList = (variables) => fetch$1({
|
359
|
-
url: "/workspaces/{workspaceId}/members",
|
727
|
+
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
728
|
+
url: "/db/{dbBranchName}",
|
360
729
|
method: "get",
|
361
|
-
...variables
|
730
|
+
...variables,
|
731
|
+
signal
|
362
732
|
});
|
363
|
-
const
|
364
|
-
const
|
365
|
-
url: "/
|
366
|
-
method: "delete",
|
367
|
-
...variables
|
368
|
-
});
|
369
|
-
const inviteWorkspaceMember = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables });
|
370
|
-
const updateWorkspaceMemberInvite = (variables) => fetch$1({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables });
|
371
|
-
const cancelWorkspaceMemberInvite = (variables) => fetch$1({
|
372
|
-
url: "/workspaces/{workspaceId}/invites/{inviteId}",
|
733
|
+
const createBranch = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}", method: "put", ...variables, signal });
|
734
|
+
const deleteBranch = (variables, signal) => dataPlaneFetch({
|
735
|
+
url: "/db/{dbBranchName}",
|
373
736
|
method: "delete",
|
374
|
-
...variables
|
737
|
+
...variables,
|
738
|
+
signal
|
375
739
|
});
|
376
|
-
const
|
377
|
-
url: "/
|
740
|
+
const copyBranch = (variables, signal) => dataPlaneFetch({
|
741
|
+
url: "/db/{dbBranchName}/copy",
|
378
742
|
method: "post",
|
379
|
-
...variables
|
380
|
-
|
381
|
-
const acceptWorkspaceMemberInvite = (variables) => fetch$1({
|
382
|
-
url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept",
|
383
|
-
method: "post",
|
384
|
-
...variables
|
385
|
-
});
|
386
|
-
const getDatabaseList = (variables) => fetch$1({
|
387
|
-
url: "/dbs",
|
388
|
-
method: "get",
|
389
|
-
...variables
|
743
|
+
...variables,
|
744
|
+
signal
|
390
745
|
});
|
391
|
-
const
|
392
|
-
url: "/
|
393
|
-
method: "get",
|
394
|
-
...variables
|
395
|
-
});
|
396
|
-
const createDatabase = (variables) => fetch$1({
|
397
|
-
url: "/dbs/{dbName}",
|
746
|
+
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
747
|
+
url: "/db/{dbBranchName}/metadata",
|
398
748
|
method: "put",
|
399
|
-
...variables
|
749
|
+
...variables,
|
750
|
+
signal
|
400
751
|
});
|
401
|
-
const
|
402
|
-
url: "/
|
403
|
-
method: "delete",
|
404
|
-
...variables
|
405
|
-
});
|
406
|
-
const getDatabaseMetadata = (variables) => fetch$1({
|
407
|
-
url: "/dbs/{dbName}/metadata",
|
752
|
+
const getBranchMetadata = (variables, signal) => dataPlaneFetch({
|
753
|
+
url: "/db/{dbBranchName}/metadata",
|
408
754
|
method: "get",
|
409
|
-
...variables
|
755
|
+
...variables,
|
756
|
+
signal
|
410
757
|
});
|
411
|
-
const
|
412
|
-
|
413
|
-
const addGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables });
|
414
|
-
const removeGitBranchesEntry = (variables) => fetch$1({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables });
|
415
|
-
const resolveBranch = (variables) => fetch$1({
|
416
|
-
url: "/dbs/{dbName}/resolveBranch",
|
758
|
+
const getBranchStats = (variables, signal) => dataPlaneFetch({
|
759
|
+
url: "/db/{dbBranchName}/stats",
|
417
760
|
method: "get",
|
418
|
-
...variables
|
761
|
+
...variables,
|
762
|
+
signal
|
419
763
|
});
|
420
|
-
const
|
421
|
-
const
|
422
|
-
const
|
764
|
+
const getGitBranchesMapping = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "get", ...variables, signal });
|
765
|
+
const addGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "post", ...variables, signal });
|
766
|
+
const removeGitBranchesEntry = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/gitBranches", method: "delete", ...variables, signal });
|
767
|
+
const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/resolveBranch", method: "get", ...variables, signal });
|
768
|
+
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
769
|
+
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
770
|
+
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
771
|
+
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
772
|
+
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
773
|
+
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
423
774
|
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
424
775
|
method: "get",
|
425
|
-
...variables
|
776
|
+
...variables,
|
777
|
+
signal
|
426
778
|
});
|
427
|
-
const updateMigrationRequest = (variables) =>
|
428
|
-
const listMigrationRequestsCommits = (variables) =>
|
429
|
-
const compareMigrationRequest = (variables) =>
|
430
|
-
const getMigrationRequestIsMerged = (variables) =>
|
431
|
-
const mergeMigrationRequest = (variables) =>
|
779
|
+
const updateMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables, signal });
|
780
|
+
const listMigrationRequestsCommits = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables, signal });
|
781
|
+
const compareMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables, signal });
|
782
|
+
const getMigrationRequestIsMerged = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables, signal });
|
783
|
+
const mergeMigrationRequest = (variables, signal) => dataPlaneFetch({
|
432
784
|
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
433
785
|
method: "post",
|
434
|
-
...variables
|
435
|
-
|
436
|
-
const getBranchDetails = (variables) => fetch$1({
|
437
|
-
url: "/db/{dbBranchName}",
|
438
|
-
method: "get",
|
439
|
-
...variables
|
440
|
-
});
|
441
|
-
const createBranch = (variables) => fetch$1({ url: "/db/{dbBranchName}", method: "put", ...variables });
|
442
|
-
const deleteBranch = (variables) => fetch$1({
|
443
|
-
url: "/db/{dbBranchName}",
|
444
|
-
method: "delete",
|
445
|
-
...variables
|
446
|
-
});
|
447
|
-
const updateBranchMetadata = (variables) => fetch$1({
|
448
|
-
url: "/db/{dbBranchName}/metadata",
|
449
|
-
method: "put",
|
450
|
-
...variables
|
786
|
+
...variables,
|
787
|
+
signal
|
451
788
|
});
|
452
|
-
const
|
453
|
-
|
454
|
-
|
455
|
-
|
456
|
-
});
|
457
|
-
const
|
458
|
-
const
|
459
|
-
const
|
460
|
-
const compareBranchWithUserSchema = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables });
|
461
|
-
const compareBranchSchemas = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables });
|
462
|
-
const updateBranchSchema = (variables) => fetch$1({
|
463
|
-
url: "/db/{dbBranchName}/schema/update",
|
464
|
-
method: "post",
|
465
|
-
...variables
|
466
|
-
});
|
467
|
-
const previewBranchSchemaEdit = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables });
|
468
|
-
const applyBranchSchemaEdit = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables });
|
469
|
-
const getBranchSchemaHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables });
|
470
|
-
const getBranchStats = (variables) => fetch$1({
|
471
|
-
url: "/db/{dbBranchName}/stats",
|
472
|
-
method: "get",
|
473
|
-
...variables
|
474
|
-
});
|
475
|
-
const createTable = (variables) => fetch$1({
|
789
|
+
const getBranchSchemaHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables, signal });
|
790
|
+
const compareBranchWithUserSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables, signal });
|
791
|
+
const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables, signal });
|
792
|
+
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
793
|
+
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
794
|
+
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
795
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/push", method: "post", ...variables, signal });
|
796
|
+
const createTable = (variables, signal) => dataPlaneFetch({
|
476
797
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
477
798
|
method: "put",
|
478
|
-
...variables
|
799
|
+
...variables,
|
800
|
+
signal
|
479
801
|
});
|
480
|
-
const deleteTable = (variables) =>
|
802
|
+
const deleteTable = (variables, signal) => dataPlaneFetch({
|
481
803
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
482
804
|
method: "delete",
|
483
|
-
...variables
|
805
|
+
...variables,
|
806
|
+
signal
|
484
807
|
});
|
485
|
-
const updateTable = (variables) =>
|
486
|
-
|
487
|
-
method: "patch",
|
488
|
-
...variables
|
489
|
-
});
|
490
|
-
const getTableSchema = (variables) => fetch$1({
|
808
|
+
const updateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}", method: "patch", ...variables, signal });
|
809
|
+
const getTableSchema = (variables, signal) => dataPlaneFetch({
|
491
810
|
url: "/db/{dbBranchName}/tables/{tableName}/schema",
|
492
811
|
method: "get",
|
493
|
-
...variables
|
812
|
+
...variables,
|
813
|
+
signal
|
494
814
|
});
|
495
|
-
const setTableSchema = (variables) =>
|
496
|
-
|
497
|
-
method: "put",
|
498
|
-
...variables
|
499
|
-
});
|
500
|
-
const getTableColumns = (variables) => fetch$1({
|
815
|
+
const setTableSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/schema", method: "put", ...variables, signal });
|
816
|
+
const getTableColumns = (variables, signal) => dataPlaneFetch({
|
501
817
|
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
502
818
|
method: "get",
|
503
|
-
...variables
|
504
|
-
|
505
|
-
const addTableColumn = (variables) => fetch$1({
|
506
|
-
url: "/db/{dbBranchName}/tables/{tableName}/columns",
|
507
|
-
method: "post",
|
508
|
-
...variables
|
819
|
+
...variables,
|
820
|
+
signal
|
509
821
|
});
|
510
|
-
const
|
822
|
+
const addTableColumn = (variables, signal) => dataPlaneFetch(
|
823
|
+
{ url: "/db/{dbBranchName}/tables/{tableName}/columns", method: "post", ...variables, signal }
|
824
|
+
);
|
825
|
+
const getColumn = (variables, signal) => dataPlaneFetch({
|
511
826
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
512
827
|
method: "get",
|
513
|
-
...variables
|
828
|
+
...variables,
|
829
|
+
signal
|
514
830
|
});
|
515
|
-
const
|
831
|
+
const updateColumn = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}", method: "patch", ...variables, signal });
|
832
|
+
const deleteColumn = (variables, signal) => dataPlaneFetch({
|
516
833
|
url: "/db/{dbBranchName}/tables/{tableName}/columns/{columnName}",
|
517
834
|
method: "delete",
|
518
|
-
...variables
|
835
|
+
...variables,
|
836
|
+
signal
|
519
837
|
});
|
520
|
-
const
|
521
|
-
|
522
|
-
|
523
|
-
|
838
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
839
|
+
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
840
|
+
const getFileItem = (variables, signal) => dataPlaneFetch({
|
841
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
842
|
+
method: "get",
|
843
|
+
...variables,
|
844
|
+
signal
|
524
845
|
});
|
525
|
-
const
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
846
|
+
const putFileItem = (variables, signal) => dataPlaneFetch({
|
847
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
848
|
+
method: "put",
|
849
|
+
...variables,
|
850
|
+
signal
|
851
|
+
});
|
852
|
+
const deleteFileItem = (variables, signal) => dataPlaneFetch({
|
853
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
854
|
+
method: "delete",
|
855
|
+
...variables,
|
856
|
+
signal
|
857
|
+
});
|
858
|
+
const getFile = (variables, signal) => dataPlaneFetch({
|
859
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
860
|
+
method: "get",
|
861
|
+
...variables,
|
862
|
+
signal
|
863
|
+
});
|
864
|
+
const putFile = (variables, signal) => dataPlaneFetch({
|
865
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
866
|
+
method: "put",
|
867
|
+
...variables,
|
868
|
+
signal
|
869
|
+
});
|
870
|
+
const deleteFile = (variables, signal) => dataPlaneFetch({
|
871
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
531
872
|
method: "delete",
|
532
|
-
...variables
|
873
|
+
...variables,
|
874
|
+
signal
|
533
875
|
});
|
534
|
-
const getRecord = (variables) =>
|
876
|
+
const getRecord = (variables, signal) => dataPlaneFetch({
|
535
877
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
536
878
|
method: "get",
|
537
|
-
...variables
|
879
|
+
...variables,
|
880
|
+
signal
|
538
881
|
});
|
539
|
-
const
|
540
|
-
const
|
882
|
+
const insertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "put", ...variables, signal });
|
883
|
+
const updateRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "patch", ...variables, signal });
|
884
|
+
const upsertRecordWithID = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "post", ...variables, signal });
|
885
|
+
const deleteRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}", method: "delete", ...variables, signal });
|
886
|
+
const bulkInsertTableRecords = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/bulk", method: "post", ...variables, signal });
|
887
|
+
const queryTable = (variables, signal) => dataPlaneFetch({
|
541
888
|
url: "/db/{dbBranchName}/tables/{tableName}/query",
|
542
889
|
method: "post",
|
543
|
-
...variables
|
890
|
+
...variables,
|
891
|
+
signal
|
544
892
|
});
|
545
|
-
const
|
893
|
+
const searchBranch = (variables, signal) => dataPlaneFetch({
|
894
|
+
url: "/db/{dbBranchName}/search",
|
895
|
+
method: "post",
|
896
|
+
...variables,
|
897
|
+
signal
|
898
|
+
});
|
899
|
+
const searchTable = (variables, signal) => dataPlaneFetch({
|
546
900
|
url: "/db/{dbBranchName}/tables/{tableName}/search",
|
547
901
|
method: "post",
|
548
|
-
...variables
|
902
|
+
...variables,
|
903
|
+
signal
|
549
904
|
});
|
550
|
-
const
|
551
|
-
url: "/db/{dbBranchName}/
|
905
|
+
const sqlQuery = (variables, signal) => dataPlaneFetch({
|
906
|
+
url: "/db/{dbBranchName}/sql",
|
552
907
|
method: "post",
|
553
|
-
...variables
|
908
|
+
...variables,
|
909
|
+
signal
|
554
910
|
});
|
555
|
-
const
|
556
|
-
|
911
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch", method: "post", ...variables, signal });
|
912
|
+
const askTable = (variables, signal) => dataPlaneFetch({
|
913
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
557
914
|
method: "post",
|
558
|
-
...variables
|
915
|
+
...variables,
|
916
|
+
signal
|
559
917
|
});
|
560
|
-
const
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
|
568
|
-
|
569
|
-
updateWorkspaceMemberRole,
|
570
|
-
removeWorkspaceMember,
|
571
|
-
inviteWorkspaceMember,
|
572
|
-
updateWorkspaceMemberInvite,
|
573
|
-
cancelWorkspaceMemberInvite,
|
574
|
-
resendWorkspaceMemberInvite,
|
575
|
-
acceptWorkspaceMemberInvite
|
576
|
-
},
|
577
|
-
database: {
|
578
|
-
getDatabaseList,
|
579
|
-
createDatabase,
|
580
|
-
deleteDatabase,
|
581
|
-
getDatabaseMetadata,
|
582
|
-
updateDatabaseMetadata,
|
583
|
-
getGitBranchesMapping,
|
584
|
-
addGitBranchesEntry,
|
585
|
-
removeGitBranchesEntry,
|
586
|
-
resolveBranch
|
587
|
-
},
|
918
|
+
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
919
|
+
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
920
|
+
const fileAccess = (variables, signal) => dataPlaneFetch({
|
921
|
+
url: "/file/{fileId}",
|
922
|
+
method: "get",
|
923
|
+
...variables,
|
924
|
+
signal
|
925
|
+
});
|
926
|
+
const operationsByTag$2 = {
|
588
927
|
branch: {
|
589
928
|
getBranchList,
|
590
929
|
getBranchDetails,
|
591
930
|
createBranch,
|
592
931
|
deleteBranch,
|
932
|
+
copyBranch,
|
593
933
|
updateBranchMetadata,
|
594
934
|
getBranchMetadata,
|
595
|
-
getBranchStats
|
935
|
+
getBranchStats,
|
936
|
+
getGitBranchesMapping,
|
937
|
+
addGitBranchesEntry,
|
938
|
+
removeGitBranchesEntry,
|
939
|
+
resolveBranch
|
940
|
+
},
|
941
|
+
migrations: {
|
942
|
+
getBranchMigrationHistory,
|
943
|
+
getBranchMigrationPlan,
|
944
|
+
executeBranchMigrationPlan,
|
945
|
+
getBranchSchemaHistory,
|
946
|
+
compareBranchWithUserSchema,
|
947
|
+
compareBranchSchemas,
|
948
|
+
updateBranchSchema,
|
949
|
+
previewBranchSchemaEdit,
|
950
|
+
applyBranchSchemaEdit,
|
951
|
+
pushBranchMigrations
|
596
952
|
},
|
597
953
|
migrationRequests: {
|
598
|
-
|
954
|
+
queryMigrationRequests,
|
599
955
|
createMigrationRequest,
|
600
956
|
getMigrationRequest,
|
601
957
|
updateMigrationRequest,
|
@@ -604,17 +960,6 @@ const operationsByTag = {
|
|
604
960
|
getMigrationRequestIsMerged,
|
605
961
|
mergeMigrationRequest
|
606
962
|
},
|
607
|
-
branchSchema: {
|
608
|
-
getBranchMigrationHistory,
|
609
|
-
executeBranchMigrationPlan,
|
610
|
-
getBranchMigrationPlan,
|
611
|
-
compareBranchWithUserSchema,
|
612
|
-
compareBranchSchemas,
|
613
|
-
updateBranchSchema,
|
614
|
-
previewBranchSchemaEdit,
|
615
|
-
applyBranchSchemaEdit,
|
616
|
-
getBranchSchemaHistory
|
617
|
-
},
|
618
963
|
table: {
|
619
964
|
createTable,
|
620
965
|
deleteTable,
|
@@ -624,24 +969,174 @@ const operationsByTag = {
|
|
624
969
|
getTableColumns,
|
625
970
|
addTableColumn,
|
626
971
|
getColumn,
|
627
|
-
|
628
|
-
|
972
|
+
updateColumn,
|
973
|
+
deleteColumn
|
629
974
|
},
|
630
975
|
records: {
|
976
|
+
branchTransaction,
|
631
977
|
insertRecord,
|
978
|
+
getRecord,
|
632
979
|
insertRecordWithID,
|
633
980
|
updateRecordWithID,
|
634
981
|
upsertRecordWithID,
|
635
982
|
deleteRecord,
|
636
|
-
|
637
|
-
|
983
|
+
bulkInsertTableRecords
|
984
|
+
},
|
985
|
+
files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess },
|
986
|
+
searchAndFilter: {
|
638
987
|
queryTable,
|
639
|
-
searchTable,
|
640
988
|
searchBranch,
|
641
|
-
|
989
|
+
searchTable,
|
990
|
+
sqlQuery,
|
991
|
+
vectorSearchTable,
|
992
|
+
askTable,
|
993
|
+
summarizeTable,
|
994
|
+
aggregateTable
|
642
995
|
}
|
643
996
|
};
|
644
997
|
|
998
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
999
|
+
|
1000
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
1001
|
+
url: "/user",
|
1002
|
+
method: "get",
|
1003
|
+
...variables,
|
1004
|
+
signal
|
1005
|
+
});
|
1006
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
1007
|
+
url: "/user",
|
1008
|
+
method: "put",
|
1009
|
+
...variables,
|
1010
|
+
signal
|
1011
|
+
});
|
1012
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
1013
|
+
url: "/user",
|
1014
|
+
method: "delete",
|
1015
|
+
...variables,
|
1016
|
+
signal
|
1017
|
+
});
|
1018
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
1019
|
+
url: "/user/keys",
|
1020
|
+
method: "get",
|
1021
|
+
...variables,
|
1022
|
+
signal
|
1023
|
+
});
|
1024
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
1025
|
+
url: "/user/keys/{keyName}",
|
1026
|
+
method: "post",
|
1027
|
+
...variables,
|
1028
|
+
signal
|
1029
|
+
});
|
1030
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
1031
|
+
url: "/user/keys/{keyName}",
|
1032
|
+
method: "delete",
|
1033
|
+
...variables,
|
1034
|
+
signal
|
1035
|
+
});
|
1036
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
1037
|
+
url: "/workspaces",
|
1038
|
+
method: "get",
|
1039
|
+
...variables,
|
1040
|
+
signal
|
1041
|
+
});
|
1042
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
1043
|
+
url: "/workspaces",
|
1044
|
+
method: "post",
|
1045
|
+
...variables,
|
1046
|
+
signal
|
1047
|
+
});
|
1048
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
1049
|
+
url: "/workspaces/{workspaceId}",
|
1050
|
+
method: "get",
|
1051
|
+
...variables,
|
1052
|
+
signal
|
1053
|
+
});
|
1054
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
1055
|
+
url: "/workspaces/{workspaceId}",
|
1056
|
+
method: "put",
|
1057
|
+
...variables,
|
1058
|
+
signal
|
1059
|
+
});
|
1060
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
1061
|
+
url: "/workspaces/{workspaceId}",
|
1062
|
+
method: "delete",
|
1063
|
+
...variables,
|
1064
|
+
signal
|
1065
|
+
});
|
1066
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
1067
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
1068
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
1069
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
1070
|
+
method: "delete",
|
1071
|
+
...variables,
|
1072
|
+
signal
|
1073
|
+
});
|
1074
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
1075
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
1076
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
1077
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
1078
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
1079
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
1080
|
+
url: "/workspaces/{workspaceId}/dbs",
|
1081
|
+
method: "get",
|
1082
|
+
...variables,
|
1083
|
+
signal
|
1084
|
+
});
|
1085
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
1086
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
1087
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
1088
|
+
method: "delete",
|
1089
|
+
...variables,
|
1090
|
+
signal
|
1091
|
+
});
|
1092
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
1093
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
1094
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/rename", method: "post", ...variables, signal });
|
1095
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "get", ...variables, signal });
|
1096
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "put", ...variables, signal });
|
1097
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "delete", ...variables, signal });
|
1098
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
1099
|
+
url: "/workspaces/{workspaceId}/regions",
|
1100
|
+
method: "get",
|
1101
|
+
...variables,
|
1102
|
+
signal
|
1103
|
+
});
|
1104
|
+
const operationsByTag$1 = {
|
1105
|
+
users: { getUser, updateUser, deleteUser },
|
1106
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
1107
|
+
workspaces: {
|
1108
|
+
getWorkspacesList,
|
1109
|
+
createWorkspace,
|
1110
|
+
getWorkspace,
|
1111
|
+
updateWorkspace,
|
1112
|
+
deleteWorkspace,
|
1113
|
+
getWorkspaceMembersList,
|
1114
|
+
updateWorkspaceMemberRole,
|
1115
|
+
removeWorkspaceMember
|
1116
|
+
},
|
1117
|
+
invites: {
|
1118
|
+
inviteWorkspaceMember,
|
1119
|
+
updateWorkspaceMemberInvite,
|
1120
|
+
cancelWorkspaceMemberInvite,
|
1121
|
+
acceptWorkspaceMemberInvite,
|
1122
|
+
resendWorkspaceMemberInvite
|
1123
|
+
},
|
1124
|
+
databases: {
|
1125
|
+
getDatabaseList,
|
1126
|
+
createDatabase,
|
1127
|
+
deleteDatabase,
|
1128
|
+
getDatabaseMetadata,
|
1129
|
+
updateDatabaseMetadata,
|
1130
|
+
renameDatabase,
|
1131
|
+
getDatabaseGithubSettings,
|
1132
|
+
updateDatabaseGithubSettings,
|
1133
|
+
deleteDatabaseGithubSettings,
|
1134
|
+
listRegions
|
1135
|
+
}
|
1136
|
+
};
|
1137
|
+
|
1138
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
1139
|
+
|
645
1140
|
function getHostUrl(provider, type) {
|
646
1141
|
if (isHostProviderAlias(provider)) {
|
647
1142
|
return providers[provider][type];
|
@@ -653,11 +1148,15 @@ function getHostUrl(provider, type) {
|
|
653
1148
|
const providers = {
|
654
1149
|
production: {
|
655
1150
|
main: "https://api.xata.io",
|
656
|
-
workspaces: "https://{workspaceId}.xata.sh"
|
1151
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
657
1152
|
},
|
658
1153
|
staging: {
|
659
|
-
main: "https://staging.
|
660
|
-
workspaces: "https://{workspaceId}.staging.
|
1154
|
+
main: "https://api.staging-xata.dev",
|
1155
|
+
workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
|
1156
|
+
},
|
1157
|
+
dev: {
|
1158
|
+
main: "https://api.dev-xata.dev",
|
1159
|
+
workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
|
661
1160
|
}
|
662
1161
|
};
|
663
1162
|
function isHostProviderAlias(alias) {
|
@@ -666,6 +1165,32 @@ function isHostProviderAlias(alias) {
|
|
666
1165
|
function isHostProviderBuilder(builder) {
|
667
1166
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
668
1167
|
}
|
1168
|
+
function parseProviderString(provider = "production") {
|
1169
|
+
if (isHostProviderAlias(provider)) {
|
1170
|
+
return provider;
|
1171
|
+
}
|
1172
|
+
const [main, workspaces] = provider.split(",");
|
1173
|
+
if (!main || !workspaces)
|
1174
|
+
return null;
|
1175
|
+
return { main, workspaces };
|
1176
|
+
}
|
1177
|
+
function buildProviderString(provider) {
|
1178
|
+
if (isHostProviderAlias(provider))
|
1179
|
+
return provider;
|
1180
|
+
return `${provider.main},${provider.workspaces}`;
|
1181
|
+
}
|
1182
|
+
function parseWorkspacesUrlParts(url) {
|
1183
|
+
if (!isString(url))
|
1184
|
+
return null;
|
1185
|
+
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
|
1186
|
+
const regexDev = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/;
|
1187
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/;
|
1188
|
+
const regexProdTesting = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.tech.*/;
|
1189
|
+
const match = url.match(regex) || url.match(regexDev) || url.match(regexStaging) || url.match(regexProdTesting);
|
1190
|
+
if (!match)
|
1191
|
+
return null;
|
1192
|
+
return { workspace: match[1], region: match[2] };
|
1193
|
+
}
|
669
1194
|
|
670
1195
|
var __accessCheck$7 = (obj, member, msg) => {
|
671
1196
|
if (!member.has(obj))
|
@@ -693,15 +1218,19 @@ class XataApiClient {
|
|
693
1218
|
const provider = options.host ?? "production";
|
694
1219
|
const apiKey = options.apiKey ?? getAPIKey();
|
695
1220
|
const trace = options.trace ?? defaultTrace;
|
1221
|
+
const clientID = generateUUID();
|
696
1222
|
if (!apiKey) {
|
697
1223
|
throw new Error("Could not resolve a valid apiKey");
|
698
1224
|
}
|
699
1225
|
__privateSet$7(this, _extraProps, {
|
700
1226
|
apiUrl: getHostUrl(provider, "main"),
|
701
1227
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
702
|
-
|
1228
|
+
fetch: getFetchImplementation(options.fetch),
|
703
1229
|
apiKey,
|
704
|
-
trace
|
1230
|
+
trace,
|
1231
|
+
clientName: options.clientName,
|
1232
|
+
xataAgentExtra: options.xataAgentExtra,
|
1233
|
+
clientID
|
705
1234
|
});
|
706
1235
|
}
|
707
1236
|
get user() {
|
@@ -709,21 +1238,41 @@ class XataApiClient {
|
|
709
1238
|
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
710
1239
|
return __privateGet$7(this, _namespaces).user;
|
711
1240
|
}
|
1241
|
+
get authentication() {
|
1242
|
+
if (!__privateGet$7(this, _namespaces).authentication)
|
1243
|
+
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
1244
|
+
return __privateGet$7(this, _namespaces).authentication;
|
1245
|
+
}
|
712
1246
|
get workspaces() {
|
713
1247
|
if (!__privateGet$7(this, _namespaces).workspaces)
|
714
1248
|
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
715
1249
|
return __privateGet$7(this, _namespaces).workspaces;
|
716
1250
|
}
|
717
|
-
get
|
718
|
-
if (!__privateGet$7(this, _namespaces).
|
719
|
-
__privateGet$7(this, _namespaces).
|
720
|
-
return __privateGet$7(this, _namespaces).
|
1251
|
+
get invites() {
|
1252
|
+
if (!__privateGet$7(this, _namespaces).invites)
|
1253
|
+
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
1254
|
+
return __privateGet$7(this, _namespaces).invites;
|
1255
|
+
}
|
1256
|
+
get database() {
|
1257
|
+
if (!__privateGet$7(this, _namespaces).database)
|
1258
|
+
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
1259
|
+
return __privateGet$7(this, _namespaces).database;
|
721
1260
|
}
|
722
1261
|
get branches() {
|
723
1262
|
if (!__privateGet$7(this, _namespaces).branches)
|
724
1263
|
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
725
1264
|
return __privateGet$7(this, _namespaces).branches;
|
726
1265
|
}
|
1266
|
+
get migrations() {
|
1267
|
+
if (!__privateGet$7(this, _namespaces).migrations)
|
1268
|
+
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
1269
|
+
return __privateGet$7(this, _namespaces).migrations;
|
1270
|
+
}
|
1271
|
+
get migrationRequests() {
|
1272
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
1273
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
1274
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
1275
|
+
}
|
727
1276
|
get tables() {
|
728
1277
|
if (!__privateGet$7(this, _namespaces).tables)
|
729
1278
|
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
@@ -734,15 +1283,15 @@ class XataApiClient {
|
|
734
1283
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
735
1284
|
return __privateGet$7(this, _namespaces).records;
|
736
1285
|
}
|
737
|
-
get
|
738
|
-
if (!__privateGet$7(this, _namespaces).
|
739
|
-
__privateGet$7(this, _namespaces).
|
740
|
-
return __privateGet$7(this, _namespaces).
|
1286
|
+
get files() {
|
1287
|
+
if (!__privateGet$7(this, _namespaces).files)
|
1288
|
+
__privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
|
1289
|
+
return __privateGet$7(this, _namespaces).files;
|
741
1290
|
}
|
742
|
-
get
|
743
|
-
if (!__privateGet$7(this, _namespaces).
|
744
|
-
__privateGet$7(this, _namespaces).
|
745
|
-
return __privateGet$7(this, _namespaces).
|
1291
|
+
get searchAndFilter() {
|
1292
|
+
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
1293
|
+
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
1294
|
+
return __privateGet$7(this, _namespaces).searchAndFilter;
|
746
1295
|
}
|
747
1296
|
}
|
748
1297
|
_extraProps = new WeakMap();
|
@@ -754,24 +1303,29 @@ class UserApi {
|
|
754
1303
|
getUser() {
|
755
1304
|
return operationsByTag.users.getUser({ ...this.extraProps });
|
756
1305
|
}
|
757
|
-
updateUser(user) {
|
1306
|
+
updateUser({ user }) {
|
758
1307
|
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
759
1308
|
}
|
760
1309
|
deleteUser() {
|
761
1310
|
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
762
1311
|
}
|
1312
|
+
}
|
1313
|
+
class AuthenticationApi {
|
1314
|
+
constructor(extraProps) {
|
1315
|
+
this.extraProps = extraProps;
|
1316
|
+
}
|
763
1317
|
getUserAPIKeys() {
|
764
|
-
return operationsByTag.
|
1318
|
+
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
765
1319
|
}
|
766
|
-
createUserAPIKey(
|
767
|
-
return operationsByTag.
|
768
|
-
pathParams: { keyName },
|
1320
|
+
createUserAPIKey({ name }) {
|
1321
|
+
return operationsByTag.authentication.createUserAPIKey({
|
1322
|
+
pathParams: { keyName: name },
|
769
1323
|
...this.extraProps
|
770
1324
|
});
|
771
1325
|
}
|
772
|
-
deleteUserAPIKey(
|
773
|
-
return operationsByTag.
|
774
|
-
pathParams: { keyName },
|
1326
|
+
deleteUserAPIKey({ name }) {
|
1327
|
+
return operationsByTag.authentication.deleteUserAPIKey({
|
1328
|
+
pathParams: { keyName: name },
|
775
1329
|
...this.extraProps
|
776
1330
|
});
|
777
1331
|
}
|
@@ -780,492 +1334,1178 @@ class WorkspaceApi {
|
|
780
1334
|
constructor(extraProps) {
|
781
1335
|
this.extraProps = extraProps;
|
782
1336
|
}
|
783
|
-
|
1337
|
+
getWorkspacesList() {
|
1338
|
+
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
1339
|
+
}
|
1340
|
+
createWorkspace({ data }) {
|
784
1341
|
return operationsByTag.workspaces.createWorkspace({
|
785
|
-
body:
|
1342
|
+
body: data,
|
786
1343
|
...this.extraProps
|
787
1344
|
});
|
788
1345
|
}
|
789
|
-
|
790
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
791
|
-
}
|
792
|
-
getWorkspace(workspaceId) {
|
1346
|
+
getWorkspace({ workspace }) {
|
793
1347
|
return operationsByTag.workspaces.getWorkspace({
|
794
|
-
pathParams: { workspaceId },
|
1348
|
+
pathParams: { workspaceId: workspace },
|
795
1349
|
...this.extraProps
|
796
1350
|
});
|
797
1351
|
}
|
798
|
-
updateWorkspace(
|
1352
|
+
updateWorkspace({
|
1353
|
+
workspace,
|
1354
|
+
update
|
1355
|
+
}) {
|
799
1356
|
return operationsByTag.workspaces.updateWorkspace({
|
800
|
-
pathParams: { workspaceId },
|
801
|
-
body:
|
1357
|
+
pathParams: { workspaceId: workspace },
|
1358
|
+
body: update,
|
802
1359
|
...this.extraProps
|
803
1360
|
});
|
804
1361
|
}
|
805
|
-
deleteWorkspace(
|
1362
|
+
deleteWorkspace({ workspace }) {
|
806
1363
|
return operationsByTag.workspaces.deleteWorkspace({
|
807
|
-
pathParams: { workspaceId },
|
1364
|
+
pathParams: { workspaceId: workspace },
|
808
1365
|
...this.extraProps
|
809
1366
|
});
|
810
1367
|
}
|
811
|
-
getWorkspaceMembersList(
|
1368
|
+
getWorkspaceMembersList({ workspace }) {
|
812
1369
|
return operationsByTag.workspaces.getWorkspaceMembersList({
|
813
|
-
pathParams: { workspaceId },
|
1370
|
+
pathParams: { workspaceId: workspace },
|
814
1371
|
...this.extraProps
|
815
1372
|
});
|
816
1373
|
}
|
817
|
-
updateWorkspaceMemberRole(
|
1374
|
+
updateWorkspaceMemberRole({
|
1375
|
+
workspace,
|
1376
|
+
user,
|
1377
|
+
role
|
1378
|
+
}) {
|
818
1379
|
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
819
|
-
pathParams: { workspaceId, userId },
|
1380
|
+
pathParams: { workspaceId: workspace, userId: user },
|
820
1381
|
body: { role },
|
821
1382
|
...this.extraProps
|
822
1383
|
});
|
823
1384
|
}
|
824
|
-
removeWorkspaceMember(
|
1385
|
+
removeWorkspaceMember({
|
1386
|
+
workspace,
|
1387
|
+
user
|
1388
|
+
}) {
|
825
1389
|
return operationsByTag.workspaces.removeWorkspaceMember({
|
826
|
-
pathParams: { workspaceId, userId },
|
1390
|
+
pathParams: { workspaceId: workspace, userId: user },
|
827
1391
|
...this.extraProps
|
828
1392
|
});
|
829
1393
|
}
|
830
|
-
|
831
|
-
|
832
|
-
|
1394
|
+
}
|
1395
|
+
class InvitesApi {
|
1396
|
+
constructor(extraProps) {
|
1397
|
+
this.extraProps = extraProps;
|
1398
|
+
}
|
1399
|
+
inviteWorkspaceMember({
|
1400
|
+
workspace,
|
1401
|
+
email,
|
1402
|
+
role
|
1403
|
+
}) {
|
1404
|
+
return operationsByTag.invites.inviteWorkspaceMember({
|
1405
|
+
pathParams: { workspaceId: workspace },
|
833
1406
|
body: { email, role },
|
834
1407
|
...this.extraProps
|
835
1408
|
});
|
836
1409
|
}
|
837
|
-
updateWorkspaceMemberInvite(
|
838
|
-
|
839
|
-
|
1410
|
+
updateWorkspaceMemberInvite({
|
1411
|
+
workspace,
|
1412
|
+
invite,
|
1413
|
+
role
|
1414
|
+
}) {
|
1415
|
+
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
1416
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
840
1417
|
body: { role },
|
841
1418
|
...this.extraProps
|
842
1419
|
});
|
843
1420
|
}
|
844
|
-
cancelWorkspaceMemberInvite(
|
845
|
-
|
846
|
-
|
1421
|
+
cancelWorkspaceMemberInvite({
|
1422
|
+
workspace,
|
1423
|
+
invite
|
1424
|
+
}) {
|
1425
|
+
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
1426
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
847
1427
|
...this.extraProps
|
848
1428
|
});
|
849
1429
|
}
|
850
|
-
|
851
|
-
|
852
|
-
|
1430
|
+
acceptWorkspaceMemberInvite({
|
1431
|
+
workspace,
|
1432
|
+
key
|
1433
|
+
}) {
|
1434
|
+
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
1435
|
+
pathParams: { workspaceId: workspace, inviteKey: key },
|
853
1436
|
...this.extraProps
|
854
1437
|
});
|
855
1438
|
}
|
856
|
-
|
857
|
-
|
858
|
-
|
1439
|
+
resendWorkspaceMemberInvite({
|
1440
|
+
workspace,
|
1441
|
+
invite
|
1442
|
+
}) {
|
1443
|
+
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
1444
|
+
pathParams: { workspaceId: workspace, inviteId: invite },
|
859
1445
|
...this.extraProps
|
860
1446
|
});
|
861
1447
|
}
|
862
1448
|
}
|
863
|
-
class
|
1449
|
+
class BranchApi {
|
864
1450
|
constructor(extraProps) {
|
865
1451
|
this.extraProps = extraProps;
|
866
1452
|
}
|
867
|
-
|
868
|
-
|
869
|
-
|
1453
|
+
getBranchList({
|
1454
|
+
workspace,
|
1455
|
+
region,
|
1456
|
+
database
|
1457
|
+
}) {
|
1458
|
+
return operationsByTag.branch.getBranchList({
|
1459
|
+
pathParams: { workspace, region, dbName: database },
|
1460
|
+
...this.extraProps
|
1461
|
+
});
|
1462
|
+
}
|
1463
|
+
getBranchDetails({
|
1464
|
+
workspace,
|
1465
|
+
region,
|
1466
|
+
database,
|
1467
|
+
branch
|
1468
|
+
}) {
|
1469
|
+
return operationsByTag.branch.getBranchDetails({
|
1470
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1471
|
+
...this.extraProps
|
1472
|
+
});
|
1473
|
+
}
|
1474
|
+
createBranch({
|
1475
|
+
workspace,
|
1476
|
+
region,
|
1477
|
+
database,
|
1478
|
+
branch,
|
1479
|
+
from,
|
1480
|
+
metadata
|
1481
|
+
}) {
|
1482
|
+
return operationsByTag.branch.createBranch({
|
1483
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1484
|
+
body: { from, metadata },
|
1485
|
+
...this.extraProps
|
1486
|
+
});
|
1487
|
+
}
|
1488
|
+
deleteBranch({
|
1489
|
+
workspace,
|
1490
|
+
region,
|
1491
|
+
database,
|
1492
|
+
branch
|
1493
|
+
}) {
|
1494
|
+
return operationsByTag.branch.deleteBranch({
|
1495
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
870
1496
|
...this.extraProps
|
871
1497
|
});
|
872
1498
|
}
|
873
|
-
|
874
|
-
|
875
|
-
|
876
|
-
|
1499
|
+
copyBranch({
|
1500
|
+
workspace,
|
1501
|
+
region,
|
1502
|
+
database,
|
1503
|
+
branch,
|
1504
|
+
destinationBranch,
|
1505
|
+
limit
|
1506
|
+
}) {
|
1507
|
+
return operationsByTag.branch.copyBranch({
|
1508
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1509
|
+
body: { destinationBranch, limit },
|
877
1510
|
...this.extraProps
|
878
1511
|
});
|
879
1512
|
}
|
880
|
-
|
881
|
-
|
882
|
-
|
1513
|
+
updateBranchMetadata({
|
1514
|
+
workspace,
|
1515
|
+
region,
|
1516
|
+
database,
|
1517
|
+
branch,
|
1518
|
+
metadata
|
1519
|
+
}) {
|
1520
|
+
return operationsByTag.branch.updateBranchMetadata({
|
1521
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1522
|
+
body: metadata,
|
883
1523
|
...this.extraProps
|
884
1524
|
});
|
885
1525
|
}
|
886
|
-
|
887
|
-
|
888
|
-
|
1526
|
+
getBranchMetadata({
|
1527
|
+
workspace,
|
1528
|
+
region,
|
1529
|
+
database,
|
1530
|
+
branch
|
1531
|
+
}) {
|
1532
|
+
return operationsByTag.branch.getBranchMetadata({
|
1533
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
889
1534
|
...this.extraProps
|
890
1535
|
});
|
891
1536
|
}
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
1537
|
+
getBranchStats({
|
1538
|
+
workspace,
|
1539
|
+
region,
|
1540
|
+
database,
|
1541
|
+
branch
|
1542
|
+
}) {
|
1543
|
+
return operationsByTag.branch.getBranchStats({
|
1544
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
896
1545
|
...this.extraProps
|
897
1546
|
});
|
898
1547
|
}
|
899
|
-
getGitBranchesMapping(
|
900
|
-
|
901
|
-
|
1548
|
+
getGitBranchesMapping({
|
1549
|
+
workspace,
|
1550
|
+
region,
|
1551
|
+
database
|
1552
|
+
}) {
|
1553
|
+
return operationsByTag.branch.getGitBranchesMapping({
|
1554
|
+
pathParams: { workspace, region, dbName: database },
|
902
1555
|
...this.extraProps
|
903
1556
|
});
|
904
1557
|
}
|
905
|
-
addGitBranchesEntry(
|
906
|
-
|
907
|
-
|
908
|
-
|
1558
|
+
addGitBranchesEntry({
|
1559
|
+
workspace,
|
1560
|
+
region,
|
1561
|
+
database,
|
1562
|
+
gitBranch,
|
1563
|
+
xataBranch
|
1564
|
+
}) {
|
1565
|
+
return operationsByTag.branch.addGitBranchesEntry({
|
1566
|
+
pathParams: { workspace, region, dbName: database },
|
1567
|
+
body: { gitBranch, xataBranch },
|
909
1568
|
...this.extraProps
|
910
1569
|
});
|
911
1570
|
}
|
912
|
-
removeGitBranchesEntry(
|
913
|
-
|
914
|
-
|
1571
|
+
removeGitBranchesEntry({
|
1572
|
+
workspace,
|
1573
|
+
region,
|
1574
|
+
database,
|
1575
|
+
gitBranch
|
1576
|
+
}) {
|
1577
|
+
return operationsByTag.branch.removeGitBranchesEntry({
|
1578
|
+
pathParams: { workspace, region, dbName: database },
|
915
1579
|
queryParams: { gitBranch },
|
916
1580
|
...this.extraProps
|
917
1581
|
});
|
918
1582
|
}
|
919
|
-
resolveBranch(
|
920
|
-
|
921
|
-
|
1583
|
+
resolveBranch({
|
1584
|
+
workspace,
|
1585
|
+
region,
|
1586
|
+
database,
|
1587
|
+
gitBranch,
|
1588
|
+
fallbackBranch
|
1589
|
+
}) {
|
1590
|
+
return operationsByTag.branch.resolveBranch({
|
1591
|
+
pathParams: { workspace, region, dbName: database },
|
922
1592
|
queryParams: { gitBranch, fallbackBranch },
|
923
1593
|
...this.extraProps
|
924
1594
|
});
|
925
1595
|
}
|
926
1596
|
}
|
927
|
-
class
|
1597
|
+
class TableApi {
|
928
1598
|
constructor(extraProps) {
|
929
1599
|
this.extraProps = extraProps;
|
930
1600
|
}
|
931
|
-
|
932
|
-
|
933
|
-
|
1601
|
+
createTable({
|
1602
|
+
workspace,
|
1603
|
+
region,
|
1604
|
+
database,
|
1605
|
+
branch,
|
1606
|
+
table
|
1607
|
+
}) {
|
1608
|
+
return operationsByTag.table.createTable({
|
1609
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
934
1610
|
...this.extraProps
|
935
1611
|
});
|
936
1612
|
}
|
937
|
-
|
938
|
-
|
939
|
-
|
1613
|
+
deleteTable({
|
1614
|
+
workspace,
|
1615
|
+
region,
|
1616
|
+
database,
|
1617
|
+
branch,
|
1618
|
+
table
|
1619
|
+
}) {
|
1620
|
+
return operationsByTag.table.deleteTable({
|
1621
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
940
1622
|
...this.extraProps
|
941
1623
|
});
|
942
1624
|
}
|
943
|
-
|
944
|
-
|
945
|
-
|
946
|
-
|
947
|
-
|
1625
|
+
updateTable({
|
1626
|
+
workspace,
|
1627
|
+
region,
|
1628
|
+
database,
|
1629
|
+
branch,
|
1630
|
+
table,
|
1631
|
+
update
|
1632
|
+
}) {
|
1633
|
+
return operationsByTag.table.updateTable({
|
1634
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1635
|
+
body: update,
|
948
1636
|
...this.extraProps
|
949
1637
|
});
|
950
1638
|
}
|
951
|
-
|
952
|
-
|
953
|
-
|
1639
|
+
getTableSchema({
|
1640
|
+
workspace,
|
1641
|
+
region,
|
1642
|
+
database,
|
1643
|
+
branch,
|
1644
|
+
table
|
1645
|
+
}) {
|
1646
|
+
return operationsByTag.table.getTableSchema({
|
1647
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
954
1648
|
...this.extraProps
|
955
1649
|
});
|
956
1650
|
}
|
957
|
-
|
958
|
-
|
959
|
-
|
960
|
-
|
1651
|
+
setTableSchema({
|
1652
|
+
workspace,
|
1653
|
+
region,
|
1654
|
+
database,
|
1655
|
+
branch,
|
1656
|
+
table,
|
1657
|
+
schema
|
1658
|
+
}) {
|
1659
|
+
return operationsByTag.table.setTableSchema({
|
1660
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1661
|
+
body: schema,
|
961
1662
|
...this.extraProps
|
962
1663
|
});
|
963
1664
|
}
|
964
|
-
|
965
|
-
|
966
|
-
|
1665
|
+
getTableColumns({
|
1666
|
+
workspace,
|
1667
|
+
region,
|
1668
|
+
database,
|
1669
|
+
branch,
|
1670
|
+
table
|
1671
|
+
}) {
|
1672
|
+
return operationsByTag.table.getTableColumns({
|
1673
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
967
1674
|
...this.extraProps
|
968
1675
|
});
|
969
1676
|
}
|
970
|
-
|
971
|
-
|
972
|
-
|
1677
|
+
addTableColumn({
|
1678
|
+
workspace,
|
1679
|
+
region,
|
1680
|
+
database,
|
1681
|
+
branch,
|
1682
|
+
table,
|
1683
|
+
column
|
1684
|
+
}) {
|
1685
|
+
return operationsByTag.table.addTableColumn({
|
1686
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1687
|
+
body: column,
|
1688
|
+
...this.extraProps
|
1689
|
+
});
|
1690
|
+
}
|
1691
|
+
getColumn({
|
1692
|
+
workspace,
|
1693
|
+
region,
|
1694
|
+
database,
|
1695
|
+
branch,
|
1696
|
+
table,
|
1697
|
+
column
|
1698
|
+
}) {
|
1699
|
+
return operationsByTag.table.getColumn({
|
1700
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1701
|
+
...this.extraProps
|
1702
|
+
});
|
1703
|
+
}
|
1704
|
+
updateColumn({
|
1705
|
+
workspace,
|
1706
|
+
region,
|
1707
|
+
database,
|
1708
|
+
branch,
|
1709
|
+
table,
|
1710
|
+
column,
|
1711
|
+
update
|
1712
|
+
}) {
|
1713
|
+
return operationsByTag.table.updateColumn({
|
1714
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1715
|
+
body: update,
|
1716
|
+
...this.extraProps
|
1717
|
+
});
|
1718
|
+
}
|
1719
|
+
deleteColumn({
|
1720
|
+
workspace,
|
1721
|
+
region,
|
1722
|
+
database,
|
1723
|
+
branch,
|
1724
|
+
table,
|
1725
|
+
column
|
1726
|
+
}) {
|
1727
|
+
return operationsByTag.table.deleteColumn({
|
1728
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
973
1729
|
...this.extraProps
|
974
1730
|
});
|
975
1731
|
}
|
976
1732
|
}
|
977
|
-
class
|
1733
|
+
class RecordsApi {
|
978
1734
|
constructor(extraProps) {
|
979
1735
|
this.extraProps = extraProps;
|
980
1736
|
}
|
981
|
-
|
982
|
-
|
983
|
-
|
1737
|
+
insertRecord({
|
1738
|
+
workspace,
|
1739
|
+
region,
|
1740
|
+
database,
|
1741
|
+
branch,
|
1742
|
+
table,
|
1743
|
+
record,
|
1744
|
+
columns
|
1745
|
+
}) {
|
1746
|
+
return operationsByTag.records.insertRecord({
|
1747
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1748
|
+
queryParams: { columns },
|
1749
|
+
body: record,
|
984
1750
|
...this.extraProps
|
985
1751
|
});
|
986
1752
|
}
|
987
|
-
|
988
|
-
|
989
|
-
|
1753
|
+
getRecord({
|
1754
|
+
workspace,
|
1755
|
+
region,
|
1756
|
+
database,
|
1757
|
+
branch,
|
1758
|
+
table,
|
1759
|
+
id,
|
1760
|
+
columns
|
1761
|
+
}) {
|
1762
|
+
return operationsByTag.records.getRecord({
|
1763
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1764
|
+
queryParams: { columns },
|
990
1765
|
...this.extraProps
|
991
1766
|
});
|
992
1767
|
}
|
993
|
-
|
994
|
-
|
995
|
-
|
996
|
-
|
1768
|
+
insertRecordWithID({
|
1769
|
+
workspace,
|
1770
|
+
region,
|
1771
|
+
database,
|
1772
|
+
branch,
|
1773
|
+
table,
|
1774
|
+
id,
|
1775
|
+
record,
|
1776
|
+
columns,
|
1777
|
+
createOnly,
|
1778
|
+
ifVersion
|
1779
|
+
}) {
|
1780
|
+
return operationsByTag.records.insertRecordWithID({
|
1781
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1782
|
+
queryParams: { columns, createOnly, ifVersion },
|
1783
|
+
body: record,
|
1784
|
+
...this.extraProps
|
1785
|
+
});
|
1786
|
+
}
|
1787
|
+
updateRecordWithID({
|
1788
|
+
workspace,
|
1789
|
+
region,
|
1790
|
+
database,
|
1791
|
+
branch,
|
1792
|
+
table,
|
1793
|
+
id,
|
1794
|
+
record,
|
1795
|
+
columns,
|
1796
|
+
ifVersion
|
1797
|
+
}) {
|
1798
|
+
return operationsByTag.records.updateRecordWithID({
|
1799
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1800
|
+
queryParams: { columns, ifVersion },
|
1801
|
+
body: record,
|
1802
|
+
...this.extraProps
|
1803
|
+
});
|
1804
|
+
}
|
1805
|
+
upsertRecordWithID({
|
1806
|
+
workspace,
|
1807
|
+
region,
|
1808
|
+
database,
|
1809
|
+
branch,
|
1810
|
+
table,
|
1811
|
+
id,
|
1812
|
+
record,
|
1813
|
+
columns,
|
1814
|
+
ifVersion
|
1815
|
+
}) {
|
1816
|
+
return operationsByTag.records.upsertRecordWithID({
|
1817
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1818
|
+
queryParams: { columns, ifVersion },
|
1819
|
+
body: record,
|
1820
|
+
...this.extraProps
|
1821
|
+
});
|
1822
|
+
}
|
1823
|
+
deleteRecord({
|
1824
|
+
workspace,
|
1825
|
+
region,
|
1826
|
+
database,
|
1827
|
+
branch,
|
1828
|
+
table,
|
1829
|
+
id,
|
1830
|
+
columns
|
1831
|
+
}) {
|
1832
|
+
return operationsByTag.records.deleteRecord({
|
1833
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1834
|
+
queryParams: { columns },
|
1835
|
+
...this.extraProps
|
1836
|
+
});
|
1837
|
+
}
|
1838
|
+
bulkInsertTableRecords({
|
1839
|
+
workspace,
|
1840
|
+
region,
|
1841
|
+
database,
|
1842
|
+
branch,
|
1843
|
+
table,
|
1844
|
+
records,
|
1845
|
+
columns
|
1846
|
+
}) {
|
1847
|
+
return operationsByTag.records.bulkInsertTableRecords({
|
1848
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1849
|
+
queryParams: { columns },
|
1850
|
+
body: { records },
|
1851
|
+
...this.extraProps
|
1852
|
+
});
|
1853
|
+
}
|
1854
|
+
branchTransaction({
|
1855
|
+
workspace,
|
1856
|
+
region,
|
1857
|
+
database,
|
1858
|
+
branch,
|
1859
|
+
operations
|
1860
|
+
}) {
|
1861
|
+
return operationsByTag.records.branchTransaction({
|
1862
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1863
|
+
body: { operations },
|
1864
|
+
...this.extraProps
|
1865
|
+
});
|
1866
|
+
}
|
1867
|
+
}
|
1868
|
+
class FilesApi {
|
1869
|
+
constructor(extraProps) {
|
1870
|
+
this.extraProps = extraProps;
|
1871
|
+
}
|
1872
|
+
getFileItem({
|
1873
|
+
workspace,
|
1874
|
+
region,
|
1875
|
+
database,
|
1876
|
+
branch,
|
1877
|
+
table,
|
1878
|
+
record,
|
1879
|
+
column,
|
1880
|
+
fileId
|
1881
|
+
}) {
|
1882
|
+
return operationsByTag.files.getFileItem({
|
1883
|
+
pathParams: {
|
1884
|
+
workspace,
|
1885
|
+
region,
|
1886
|
+
dbBranchName: `${database}:${branch}`,
|
1887
|
+
tableName: table,
|
1888
|
+
recordId: record,
|
1889
|
+
columnName: column,
|
1890
|
+
fileId
|
1891
|
+
},
|
1892
|
+
...this.extraProps
|
1893
|
+
});
|
1894
|
+
}
|
1895
|
+
putFileItem({
|
1896
|
+
workspace,
|
1897
|
+
region,
|
1898
|
+
database,
|
1899
|
+
branch,
|
1900
|
+
table,
|
1901
|
+
record,
|
1902
|
+
column,
|
1903
|
+
fileId,
|
1904
|
+
file
|
1905
|
+
}) {
|
1906
|
+
return operationsByTag.files.putFileItem({
|
1907
|
+
pathParams: {
|
1908
|
+
workspace,
|
1909
|
+
region,
|
1910
|
+
dbBranchName: `${database}:${branch}`,
|
1911
|
+
tableName: table,
|
1912
|
+
recordId: record,
|
1913
|
+
columnName: column,
|
1914
|
+
fileId
|
1915
|
+
},
|
1916
|
+
// @ts-ignore
|
1917
|
+
body: file,
|
1918
|
+
...this.extraProps
|
1919
|
+
});
|
1920
|
+
}
|
1921
|
+
deleteFileItem({
|
1922
|
+
workspace,
|
1923
|
+
region,
|
1924
|
+
database,
|
1925
|
+
branch,
|
1926
|
+
table,
|
1927
|
+
record,
|
1928
|
+
column,
|
1929
|
+
fileId
|
1930
|
+
}) {
|
1931
|
+
return operationsByTag.files.deleteFileItem({
|
1932
|
+
pathParams: {
|
1933
|
+
workspace,
|
1934
|
+
region,
|
1935
|
+
dbBranchName: `${database}:${branch}`,
|
1936
|
+
tableName: table,
|
1937
|
+
recordId: record,
|
1938
|
+
columnName: column,
|
1939
|
+
fileId
|
1940
|
+
},
|
1941
|
+
...this.extraProps
|
1942
|
+
});
|
1943
|
+
}
|
1944
|
+
getFile({
|
1945
|
+
workspace,
|
1946
|
+
region,
|
1947
|
+
database,
|
1948
|
+
branch,
|
1949
|
+
table,
|
1950
|
+
record,
|
1951
|
+
column
|
1952
|
+
}) {
|
1953
|
+
return operationsByTag.files.getFile({
|
1954
|
+
pathParams: {
|
1955
|
+
workspace,
|
1956
|
+
region,
|
1957
|
+
dbBranchName: `${database}:${branch}`,
|
1958
|
+
tableName: table,
|
1959
|
+
recordId: record,
|
1960
|
+
columnName: column
|
1961
|
+
},
|
997
1962
|
...this.extraProps
|
998
1963
|
});
|
999
1964
|
}
|
1000
|
-
|
1001
|
-
|
1002
|
-
|
1965
|
+
putFile({
|
1966
|
+
workspace,
|
1967
|
+
region,
|
1968
|
+
database,
|
1969
|
+
branch,
|
1970
|
+
table,
|
1971
|
+
record,
|
1972
|
+
column,
|
1973
|
+
file
|
1974
|
+
}) {
|
1975
|
+
return operationsByTag.files.putFile({
|
1976
|
+
pathParams: {
|
1977
|
+
workspace,
|
1978
|
+
region,
|
1979
|
+
dbBranchName: `${database}:${branch}`,
|
1980
|
+
tableName: table,
|
1981
|
+
recordId: record,
|
1982
|
+
columnName: column
|
1983
|
+
},
|
1984
|
+
body: file,
|
1985
|
+
...this.extraProps
|
1986
|
+
});
|
1987
|
+
}
|
1988
|
+
deleteFile({
|
1989
|
+
workspace,
|
1990
|
+
region,
|
1991
|
+
database,
|
1992
|
+
branch,
|
1993
|
+
table,
|
1994
|
+
record,
|
1995
|
+
column
|
1996
|
+
}) {
|
1997
|
+
return operationsByTag.files.deleteFile({
|
1998
|
+
pathParams: {
|
1999
|
+
workspace,
|
2000
|
+
region,
|
2001
|
+
dbBranchName: `${database}:${branch}`,
|
2002
|
+
tableName: table,
|
2003
|
+
recordId: record,
|
2004
|
+
columnName: column
|
2005
|
+
},
|
2006
|
+
...this.extraProps
|
2007
|
+
});
|
2008
|
+
}
|
2009
|
+
fileAccess({
|
2010
|
+
workspace,
|
2011
|
+
region,
|
2012
|
+
fileId,
|
2013
|
+
verify
|
2014
|
+
}) {
|
2015
|
+
return operationsByTag.files.fileAccess({
|
2016
|
+
pathParams: {
|
2017
|
+
workspace,
|
2018
|
+
region,
|
2019
|
+
fileId
|
2020
|
+
},
|
2021
|
+
queryParams: { verify },
|
2022
|
+
...this.extraProps
|
2023
|
+
});
|
2024
|
+
}
|
2025
|
+
}
|
2026
|
+
class SearchAndFilterApi {
|
2027
|
+
constructor(extraProps) {
|
2028
|
+
this.extraProps = extraProps;
|
2029
|
+
}
|
2030
|
+
queryTable({
|
2031
|
+
workspace,
|
2032
|
+
region,
|
2033
|
+
database,
|
2034
|
+
branch,
|
2035
|
+
table,
|
2036
|
+
filter,
|
2037
|
+
sort,
|
2038
|
+
page,
|
2039
|
+
columns,
|
2040
|
+
consistency
|
2041
|
+
}) {
|
2042
|
+
return operationsByTag.searchAndFilter.queryTable({
|
2043
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2044
|
+
body: { filter, sort, page, columns, consistency },
|
1003
2045
|
...this.extraProps
|
1004
2046
|
});
|
1005
2047
|
}
|
1006
|
-
|
1007
|
-
|
1008
|
-
|
1009
|
-
|
2048
|
+
searchTable({
|
2049
|
+
workspace,
|
2050
|
+
region,
|
2051
|
+
database,
|
2052
|
+
branch,
|
2053
|
+
table,
|
2054
|
+
query,
|
2055
|
+
fuzziness,
|
2056
|
+
target,
|
2057
|
+
prefix,
|
2058
|
+
filter,
|
2059
|
+
highlight,
|
2060
|
+
boosters
|
2061
|
+
}) {
|
2062
|
+
return operationsByTag.searchAndFilter.searchTable({
|
2063
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2064
|
+
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
1010
2065
|
...this.extraProps
|
1011
2066
|
});
|
1012
2067
|
}
|
1013
|
-
|
1014
|
-
|
1015
|
-
|
2068
|
+
searchBranch({
|
2069
|
+
workspace,
|
2070
|
+
region,
|
2071
|
+
database,
|
2072
|
+
branch,
|
2073
|
+
tables,
|
2074
|
+
query,
|
2075
|
+
fuzziness,
|
2076
|
+
prefix,
|
2077
|
+
highlight
|
2078
|
+
}) {
|
2079
|
+
return operationsByTag.searchAndFilter.searchBranch({
|
2080
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2081
|
+
body: { tables, query, fuzziness, prefix, highlight },
|
1016
2082
|
...this.extraProps
|
1017
2083
|
});
|
1018
2084
|
}
|
1019
|
-
|
1020
|
-
|
1021
|
-
|
1022
|
-
|
2085
|
+
vectorSearchTable({
|
2086
|
+
workspace,
|
2087
|
+
region,
|
2088
|
+
database,
|
2089
|
+
branch,
|
2090
|
+
table,
|
2091
|
+
queryVector,
|
2092
|
+
column,
|
2093
|
+
similarityFunction,
|
2094
|
+
size,
|
2095
|
+
filter
|
2096
|
+
}) {
|
2097
|
+
return operationsByTag.searchAndFilter.vectorSearchTable({
|
2098
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2099
|
+
body: { queryVector, column, similarityFunction, size, filter },
|
1023
2100
|
...this.extraProps
|
1024
2101
|
});
|
1025
2102
|
}
|
1026
|
-
|
1027
|
-
|
1028
|
-
|
2103
|
+
askTable({
|
2104
|
+
workspace,
|
2105
|
+
region,
|
2106
|
+
database,
|
2107
|
+
branch,
|
2108
|
+
table,
|
2109
|
+
options
|
2110
|
+
}) {
|
2111
|
+
return operationsByTag.searchAndFilter.askTable({
|
2112
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2113
|
+
body: { ...options },
|
1029
2114
|
...this.extraProps
|
1030
2115
|
});
|
1031
2116
|
}
|
1032
|
-
|
1033
|
-
|
1034
|
-
|
2117
|
+
summarizeTable({
|
2118
|
+
workspace,
|
2119
|
+
region,
|
2120
|
+
database,
|
2121
|
+
branch,
|
2122
|
+
table,
|
2123
|
+
filter,
|
2124
|
+
columns,
|
2125
|
+
summaries,
|
2126
|
+
sort,
|
2127
|
+
summariesFilter,
|
2128
|
+
page,
|
2129
|
+
consistency
|
2130
|
+
}) {
|
2131
|
+
return operationsByTag.searchAndFilter.summarizeTable({
|
2132
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2133
|
+
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
1035
2134
|
...this.extraProps
|
1036
2135
|
});
|
1037
2136
|
}
|
1038
|
-
|
1039
|
-
|
1040
|
-
|
1041
|
-
|
2137
|
+
aggregateTable({
|
2138
|
+
workspace,
|
2139
|
+
region,
|
2140
|
+
database,
|
2141
|
+
branch,
|
2142
|
+
table,
|
2143
|
+
filter,
|
2144
|
+
aggs
|
2145
|
+
}) {
|
2146
|
+
return operationsByTag.searchAndFilter.aggregateTable({
|
2147
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2148
|
+
body: { filter, aggs },
|
1042
2149
|
...this.extraProps
|
1043
2150
|
});
|
1044
2151
|
}
|
1045
2152
|
}
|
1046
|
-
class
|
2153
|
+
class MigrationRequestsApi {
|
1047
2154
|
constructor(extraProps) {
|
1048
2155
|
this.extraProps = extraProps;
|
1049
2156
|
}
|
1050
|
-
|
1051
|
-
|
1052
|
-
|
1053
|
-
|
1054
|
-
|
2157
|
+
queryMigrationRequests({
|
2158
|
+
workspace,
|
2159
|
+
region,
|
2160
|
+
database,
|
2161
|
+
filter,
|
2162
|
+
sort,
|
2163
|
+
page,
|
2164
|
+
columns
|
2165
|
+
}) {
|
2166
|
+
return operationsByTag.migrationRequests.queryMigrationRequests({
|
2167
|
+
pathParams: { workspace, region, dbName: database },
|
2168
|
+
body: { filter, sort, page, columns },
|
1055
2169
|
...this.extraProps
|
1056
2170
|
});
|
1057
2171
|
}
|
1058
|
-
|
1059
|
-
|
1060
|
-
|
1061
|
-
|
1062
|
-
|
2172
|
+
createMigrationRequest({
|
2173
|
+
workspace,
|
2174
|
+
region,
|
2175
|
+
database,
|
2176
|
+
migration
|
2177
|
+
}) {
|
2178
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
2179
|
+
pathParams: { workspace, region, dbName: database },
|
2180
|
+
body: migration,
|
1063
2181
|
...this.extraProps
|
1064
2182
|
});
|
1065
2183
|
}
|
1066
|
-
|
1067
|
-
|
1068
|
-
|
1069
|
-
|
1070
|
-
|
2184
|
+
getMigrationRequest({
|
2185
|
+
workspace,
|
2186
|
+
region,
|
2187
|
+
database,
|
2188
|
+
migrationRequest
|
2189
|
+
}) {
|
2190
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
2191
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1071
2192
|
...this.extraProps
|
1072
2193
|
});
|
1073
2194
|
}
|
1074
|
-
|
1075
|
-
|
1076
|
-
|
1077
|
-
|
1078
|
-
|
2195
|
+
updateMigrationRequest({
|
2196
|
+
workspace,
|
2197
|
+
region,
|
2198
|
+
database,
|
2199
|
+
migrationRequest,
|
2200
|
+
update
|
2201
|
+
}) {
|
2202
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
2203
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2204
|
+
body: update,
|
1079
2205
|
...this.extraProps
|
1080
2206
|
});
|
1081
2207
|
}
|
1082
|
-
|
1083
|
-
|
1084
|
-
|
1085
|
-
|
2208
|
+
listMigrationRequestsCommits({
|
2209
|
+
workspace,
|
2210
|
+
region,
|
2211
|
+
database,
|
2212
|
+
migrationRequest,
|
2213
|
+
page
|
2214
|
+
}) {
|
2215
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
2216
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2217
|
+
body: { page },
|
1086
2218
|
...this.extraProps
|
1087
2219
|
});
|
1088
2220
|
}
|
1089
|
-
|
1090
|
-
|
1091
|
-
|
1092
|
-
|
2221
|
+
compareMigrationRequest({
|
2222
|
+
workspace,
|
2223
|
+
region,
|
2224
|
+
database,
|
2225
|
+
migrationRequest
|
2226
|
+
}) {
|
2227
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
2228
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1093
2229
|
...this.extraProps
|
1094
2230
|
});
|
1095
2231
|
}
|
1096
|
-
|
1097
|
-
|
1098
|
-
|
1099
|
-
|
1100
|
-
|
2232
|
+
getMigrationRequestIsMerged({
|
2233
|
+
workspace,
|
2234
|
+
region,
|
2235
|
+
database,
|
2236
|
+
migrationRequest
|
2237
|
+
}) {
|
2238
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
2239
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1101
2240
|
...this.extraProps
|
1102
2241
|
});
|
1103
2242
|
}
|
1104
|
-
|
1105
|
-
|
1106
|
-
|
1107
|
-
|
2243
|
+
mergeMigrationRequest({
|
2244
|
+
workspace,
|
2245
|
+
region,
|
2246
|
+
database,
|
2247
|
+
migrationRequest
|
2248
|
+
}) {
|
2249
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
2250
|
+
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
1108
2251
|
...this.extraProps
|
1109
2252
|
});
|
1110
2253
|
}
|
1111
|
-
|
1112
|
-
|
1113
|
-
|
1114
|
-
|
1115
|
-
...this.extraProps
|
1116
|
-
});
|
2254
|
+
}
|
2255
|
+
class MigrationsApi {
|
2256
|
+
constructor(extraProps) {
|
2257
|
+
this.extraProps = extraProps;
|
1117
2258
|
}
|
1118
|
-
|
1119
|
-
|
1120
|
-
|
1121
|
-
|
2259
|
+
getBranchMigrationHistory({
|
2260
|
+
workspace,
|
2261
|
+
region,
|
2262
|
+
database,
|
2263
|
+
branch,
|
2264
|
+
limit,
|
2265
|
+
startFrom
|
2266
|
+
}) {
|
2267
|
+
return operationsByTag.migrations.getBranchMigrationHistory({
|
2268
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2269
|
+
body: { limit, startFrom },
|
1122
2270
|
...this.extraProps
|
1123
2271
|
});
|
1124
2272
|
}
|
1125
|
-
|
1126
|
-
|
1127
|
-
|
1128
|
-
|
2273
|
+
getBranchMigrationPlan({
|
2274
|
+
workspace,
|
2275
|
+
region,
|
2276
|
+
database,
|
2277
|
+
branch,
|
2278
|
+
schema
|
2279
|
+
}) {
|
2280
|
+
return operationsByTag.migrations.getBranchMigrationPlan({
|
2281
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2282
|
+
body: schema,
|
1129
2283
|
...this.extraProps
|
1130
2284
|
});
|
1131
2285
|
}
|
1132
|
-
|
1133
|
-
|
1134
|
-
|
1135
|
-
|
1136
|
-
|
1137
|
-
|
1138
|
-
|
1139
|
-
|
1140
|
-
|
2286
|
+
executeBranchMigrationPlan({
|
2287
|
+
workspace,
|
2288
|
+
region,
|
2289
|
+
database,
|
2290
|
+
branch,
|
2291
|
+
plan
|
2292
|
+
}) {
|
2293
|
+
return operationsByTag.migrations.executeBranchMigrationPlan({
|
2294
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2295
|
+
body: plan,
|
1141
2296
|
...this.extraProps
|
1142
2297
|
});
|
1143
2298
|
}
|
1144
|
-
|
1145
|
-
|
1146
|
-
|
1147
|
-
|
2299
|
+
getBranchSchemaHistory({
|
2300
|
+
workspace,
|
2301
|
+
region,
|
2302
|
+
database,
|
2303
|
+
branch,
|
2304
|
+
page
|
2305
|
+
}) {
|
2306
|
+
return operationsByTag.migrations.getBranchSchemaHistory({
|
2307
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2308
|
+
body: { page },
|
1148
2309
|
...this.extraProps
|
1149
2310
|
});
|
1150
2311
|
}
|
1151
|
-
|
1152
|
-
|
1153
|
-
|
2312
|
+
compareBranchWithUserSchema({
|
2313
|
+
workspace,
|
2314
|
+
region,
|
2315
|
+
database,
|
2316
|
+
branch,
|
2317
|
+
schema,
|
2318
|
+
schemaOperations,
|
2319
|
+
branchOperations
|
2320
|
+
}) {
|
2321
|
+
return operationsByTag.migrations.compareBranchWithUserSchema({
|
2322
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2323
|
+
body: { schema, schemaOperations, branchOperations },
|
1154
2324
|
...this.extraProps
|
1155
2325
|
});
|
1156
2326
|
}
|
1157
|
-
|
1158
|
-
|
1159
|
-
|
1160
|
-
|
2327
|
+
compareBranchSchemas({
|
2328
|
+
workspace,
|
2329
|
+
region,
|
2330
|
+
database,
|
2331
|
+
branch,
|
2332
|
+
compare,
|
2333
|
+
sourceBranchOperations,
|
2334
|
+
targetBranchOperations
|
2335
|
+
}) {
|
2336
|
+
return operationsByTag.migrations.compareBranchSchemas({
|
2337
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
2338
|
+
body: { sourceBranchOperations, targetBranchOperations },
|
1161
2339
|
...this.extraProps
|
1162
2340
|
});
|
1163
2341
|
}
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
2342
|
+
updateBranchSchema({
|
2343
|
+
workspace,
|
2344
|
+
region,
|
2345
|
+
database,
|
2346
|
+
branch,
|
2347
|
+
migration
|
2348
|
+
}) {
|
2349
|
+
return operationsByTag.migrations.updateBranchSchema({
|
2350
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2351
|
+
body: migration,
|
1168
2352
|
...this.extraProps
|
1169
2353
|
});
|
1170
2354
|
}
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
2355
|
+
previewBranchSchemaEdit({
|
2356
|
+
workspace,
|
2357
|
+
region,
|
2358
|
+
database,
|
2359
|
+
branch,
|
2360
|
+
data
|
2361
|
+
}) {
|
2362
|
+
return operationsByTag.migrations.previewBranchSchemaEdit({
|
2363
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2364
|
+
body: data,
|
1174
2365
|
...this.extraProps
|
1175
2366
|
});
|
1176
2367
|
}
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
2368
|
+
applyBranchSchemaEdit({
|
2369
|
+
workspace,
|
2370
|
+
region,
|
2371
|
+
database,
|
2372
|
+
branch,
|
2373
|
+
edits
|
2374
|
+
}) {
|
2375
|
+
return operationsByTag.migrations.applyBranchSchemaEdit({
|
2376
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2377
|
+
body: { edits },
|
1180
2378
|
...this.extraProps
|
1181
2379
|
});
|
1182
2380
|
}
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
2381
|
+
pushBranchMigrations({
|
2382
|
+
workspace,
|
2383
|
+
region,
|
2384
|
+
database,
|
2385
|
+
branch,
|
2386
|
+
migrations
|
2387
|
+
}) {
|
2388
|
+
return operationsByTag.migrations.pushBranchMigrations({
|
2389
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2390
|
+
body: { migrations },
|
1186
2391
|
...this.extraProps
|
1187
2392
|
});
|
1188
2393
|
}
|
1189
2394
|
}
|
1190
|
-
class
|
2395
|
+
class DatabaseApi {
|
1191
2396
|
constructor(extraProps) {
|
1192
2397
|
this.extraProps = extraProps;
|
1193
2398
|
}
|
1194
|
-
|
1195
|
-
return operationsByTag.
|
1196
|
-
pathParams: {
|
1197
|
-
body: options,
|
2399
|
+
getDatabaseList({ workspace }) {
|
2400
|
+
return operationsByTag.databases.getDatabaseList({
|
2401
|
+
pathParams: { workspaceId: workspace },
|
1198
2402
|
...this.extraProps
|
1199
2403
|
});
|
1200
2404
|
}
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
2405
|
+
createDatabase({
|
2406
|
+
workspace,
|
2407
|
+
database,
|
2408
|
+
data
|
2409
|
+
}) {
|
2410
|
+
return operationsByTag.databases.createDatabase({
|
2411
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2412
|
+
body: data,
|
1205
2413
|
...this.extraProps
|
1206
2414
|
});
|
1207
2415
|
}
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
2416
|
+
deleteDatabase({
|
2417
|
+
workspace,
|
2418
|
+
database
|
2419
|
+
}) {
|
2420
|
+
return operationsByTag.databases.deleteDatabase({
|
2421
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1212
2422
|
...this.extraProps
|
1213
2423
|
});
|
1214
2424
|
}
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
2425
|
+
getDatabaseMetadata({
|
2426
|
+
workspace,
|
2427
|
+
database
|
2428
|
+
}) {
|
2429
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
2430
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1219
2431
|
...this.extraProps
|
1220
2432
|
});
|
1221
2433
|
}
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
2434
|
+
updateDatabaseMetadata({
|
2435
|
+
workspace,
|
2436
|
+
database,
|
2437
|
+
metadata
|
2438
|
+
}) {
|
2439
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
2440
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2441
|
+
body: metadata,
|
1226
2442
|
...this.extraProps
|
1227
2443
|
});
|
1228
2444
|
}
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
2445
|
+
renameDatabase({
|
2446
|
+
workspace,
|
2447
|
+
database,
|
2448
|
+
newName
|
2449
|
+
}) {
|
2450
|
+
return operationsByTag.databases.renameDatabase({
|
2451
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2452
|
+
body: { newName },
|
1233
2453
|
...this.extraProps
|
1234
2454
|
});
|
1235
2455
|
}
|
1236
|
-
|
1237
|
-
|
1238
|
-
|
1239
|
-
|
2456
|
+
getDatabaseGithubSettings({
|
2457
|
+
workspace,
|
2458
|
+
database
|
2459
|
+
}) {
|
2460
|
+
return operationsByTag.databases.getDatabaseGithubSettings({
|
2461
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1240
2462
|
...this.extraProps
|
1241
2463
|
});
|
1242
2464
|
}
|
1243
|
-
|
1244
|
-
|
1245
|
-
|
1246
|
-
|
2465
|
+
updateDatabaseGithubSettings({
|
2466
|
+
workspace,
|
2467
|
+
database,
|
2468
|
+
settings
|
2469
|
+
}) {
|
2470
|
+
return operationsByTag.databases.updateDatabaseGithubSettings({
|
2471
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2472
|
+
body: settings,
|
2473
|
+
...this.extraProps
|
2474
|
+
});
|
2475
|
+
}
|
2476
|
+
deleteDatabaseGithubSettings({
|
2477
|
+
workspace,
|
2478
|
+
database
|
2479
|
+
}) {
|
2480
|
+
return operationsByTag.databases.deleteDatabaseGithubSettings({
|
2481
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
1247
2482
|
...this.extraProps
|
1248
2483
|
});
|
1249
2484
|
}
|
1250
|
-
|
1251
|
-
return operationsByTag.
|
1252
|
-
pathParams: {
|
1253
|
-
body: options,
|
2485
|
+
listRegions({ workspace }) {
|
2486
|
+
return operationsByTag.databases.listRegions({
|
2487
|
+
pathParams: { workspaceId: workspace },
|
1254
2488
|
...this.extraProps
|
1255
2489
|
});
|
1256
2490
|
}
|
1257
2491
|
}
|
1258
2492
|
|
1259
2493
|
class XataApiPlugin {
|
1260
|
-
|
1261
|
-
|
1262
|
-
return new XataApiClient({ fetch: fetchImpl, apiKey });
|
2494
|
+
build(options) {
|
2495
|
+
return new XataApiClient(options);
|
1263
2496
|
}
|
1264
2497
|
}
|
1265
2498
|
|
1266
2499
|
class XataPlugin {
|
1267
2500
|
}
|
1268
2501
|
|
2502
|
+
function cleanFilter(filter) {
|
2503
|
+
if (!filter)
|
2504
|
+
return void 0;
|
2505
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
2506
|
+
return values.length > 0 ? filter : void 0;
|
2507
|
+
}
|
2508
|
+
|
1269
2509
|
var __accessCheck$6 = (obj, member, msg) => {
|
1270
2510
|
if (!member.has(obj))
|
1271
2511
|
throw TypeError("Cannot " + msg);
|
@@ -1292,18 +2532,46 @@ class Page {
|
|
1292
2532
|
this.meta = meta;
|
1293
2533
|
this.records = new RecordArray(this, records);
|
1294
2534
|
}
|
2535
|
+
/**
|
2536
|
+
* Retrieves the next page of results.
|
2537
|
+
* @param size Maximum number of results to be retrieved.
|
2538
|
+
* @param offset Number of results to skip when retrieving the results.
|
2539
|
+
* @returns The next page or results.
|
2540
|
+
*/
|
1295
2541
|
async nextPage(size, offset) {
|
1296
2542
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
|
1297
2543
|
}
|
2544
|
+
/**
|
2545
|
+
* Retrieves the previous page of results.
|
2546
|
+
* @param size Maximum number of results to be retrieved.
|
2547
|
+
* @param offset Number of results to skip when retrieving the results.
|
2548
|
+
* @returns The previous page or results.
|
2549
|
+
*/
|
1298
2550
|
async previousPage(size, offset) {
|
1299
2551
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1300
2552
|
}
|
1301
|
-
|
1302
|
-
|
1303
|
-
|
1304
|
-
|
1305
|
-
|
1306
|
-
|
2553
|
+
/**
|
2554
|
+
* Retrieves the start page of results.
|
2555
|
+
* @param size Maximum number of results to be retrieved.
|
2556
|
+
* @param offset Number of results to skip when retrieving the results.
|
2557
|
+
* @returns The start page or results.
|
2558
|
+
*/
|
2559
|
+
async startPage(size, offset) {
|
2560
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
2561
|
+
}
|
2562
|
+
/**
|
2563
|
+
* Retrieves the end page of results.
|
2564
|
+
* @param size Maximum number of results to be retrieved.
|
2565
|
+
* @param offset Number of results to skip when retrieving the results.
|
2566
|
+
* @returns The end page or results.
|
2567
|
+
*/
|
2568
|
+
async endPage(size, offset) {
|
2569
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
2570
|
+
}
|
2571
|
+
/**
|
2572
|
+
* Shortcut method to check if there will be additional results if the next page of results is retrieved.
|
2573
|
+
* @returns Whether or not there will be additional results in the next page of results.
|
2574
|
+
*/
|
1307
2575
|
hasNextPage() {
|
1308
2576
|
return this.meta.page.more;
|
1309
2577
|
}
|
@@ -1314,7 +2582,7 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1314
2582
|
const PAGINATION_MAX_OFFSET = 800;
|
1315
2583
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1316
2584
|
function isCursorPaginationOptions(options) {
|
1317
|
-
return isDefined(options) && (isDefined(options.
|
2585
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1318
2586
|
}
|
1319
2587
|
const _RecordArray = class extends Array {
|
1320
2588
|
constructor(...args) {
|
@@ -1335,25 +2603,54 @@ const _RecordArray = class extends Array {
|
|
1335
2603
|
toArray() {
|
1336
2604
|
return new Array(...this);
|
1337
2605
|
}
|
2606
|
+
toSerializable() {
|
2607
|
+
return JSON.parse(this.toString());
|
2608
|
+
}
|
2609
|
+
toString() {
|
2610
|
+
return JSON.stringify(this.toArray());
|
2611
|
+
}
|
1338
2612
|
map(callbackfn, thisArg) {
|
1339
2613
|
return this.toArray().map(callbackfn, thisArg);
|
1340
2614
|
}
|
2615
|
+
/**
|
2616
|
+
* Retrieve next page of records
|
2617
|
+
*
|
2618
|
+
* @returns A new array of objects
|
2619
|
+
*/
|
1341
2620
|
async nextPage(size, offset) {
|
1342
2621
|
const newPage = await __privateGet$6(this, _page).nextPage(size, offset);
|
1343
2622
|
return new _RecordArray(newPage);
|
1344
2623
|
}
|
2624
|
+
/**
|
2625
|
+
* Retrieve previous page of records
|
2626
|
+
*
|
2627
|
+
* @returns A new array of objects
|
2628
|
+
*/
|
1345
2629
|
async previousPage(size, offset) {
|
1346
2630
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1347
2631
|
return new _RecordArray(newPage);
|
1348
2632
|
}
|
1349
|
-
|
1350
|
-
|
2633
|
+
/**
|
2634
|
+
* Retrieve start page of records
|
2635
|
+
*
|
2636
|
+
* @returns A new array of objects
|
2637
|
+
*/
|
2638
|
+
async startPage(size, offset) {
|
2639
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1351
2640
|
return new _RecordArray(newPage);
|
1352
2641
|
}
|
1353
|
-
|
1354
|
-
|
2642
|
+
/**
|
2643
|
+
* Retrieve end page of records
|
2644
|
+
*
|
2645
|
+
* @returns A new array of objects
|
2646
|
+
*/
|
2647
|
+
async endPage(size, offset) {
|
2648
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1355
2649
|
return new _RecordArray(newPage);
|
1356
2650
|
}
|
2651
|
+
/**
|
2652
|
+
* @returns Boolean indicating if there is a next page
|
2653
|
+
*/
|
1357
2654
|
hasNextPage() {
|
1358
2655
|
return __privateGet$6(this, _page).meta.page.more;
|
1359
2656
|
}
|
@@ -1390,7 +2687,8 @@ const _Query = class {
|
|
1390
2687
|
__privateAdd$5(this, _table$1, void 0);
|
1391
2688
|
__privateAdd$5(this, _repository, void 0);
|
1392
2689
|
__privateAdd$5(this, _data, { filter: {} });
|
1393
|
-
|
2690
|
+
// Implements pagination
|
2691
|
+
this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
|
1394
2692
|
this.records = new RecordArray(this, []);
|
1395
2693
|
__privateSet$5(this, _table$1, table);
|
1396
2694
|
if (repository) {
|
@@ -1405,9 +2703,11 @@ const _Query = class {
|
|
1405
2703
|
__privateGet$5(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
1406
2704
|
__privateGet$5(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
1407
2705
|
__privateGet$5(this, _data).sort = data.sort ?? parent?.sort;
|
1408
|
-
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns
|
2706
|
+
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
2707
|
+
__privateGet$5(this, _data).consistency = data.consistency ?? parent?.consistency;
|
1409
2708
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1410
2709
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
2710
|
+
__privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
1411
2711
|
this.any = this.any.bind(this);
|
1412
2712
|
this.all = this.all.bind(this);
|
1413
2713
|
this.not = this.not.bind(this);
|
@@ -1425,18 +2725,38 @@ const _Query = class {
|
|
1425
2725
|
const key = JSON.stringify({ columns, filter, sort, pagination });
|
1426
2726
|
return toBase64(key);
|
1427
2727
|
}
|
2728
|
+
/**
|
2729
|
+
* Builds a new query object representing a logical OR between the given subqueries.
|
2730
|
+
* @param queries An array of subqueries.
|
2731
|
+
* @returns A new Query object.
|
2732
|
+
*/
|
1428
2733
|
any(...queries) {
|
1429
2734
|
const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
|
1430
2735
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $any } }, __privateGet$5(this, _data));
|
1431
2736
|
}
|
2737
|
+
/**
|
2738
|
+
* Builds a new query object representing a logical AND between the given subqueries.
|
2739
|
+
* @param queries An array of subqueries.
|
2740
|
+
* @returns A new Query object.
|
2741
|
+
*/
|
1432
2742
|
all(...queries) {
|
1433
2743
|
const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
|
1434
2744
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1435
2745
|
}
|
2746
|
+
/**
|
2747
|
+
* Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
|
2748
|
+
* @param queries An array of subqueries.
|
2749
|
+
* @returns A new Query object.
|
2750
|
+
*/
|
1436
2751
|
not(...queries) {
|
1437
2752
|
const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
|
1438
2753
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $not } }, __privateGet$5(this, _data));
|
1439
2754
|
}
|
2755
|
+
/**
|
2756
|
+
* Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
|
2757
|
+
* @param queries An array of subqueries.
|
2758
|
+
* @returns A new Query object.
|
2759
|
+
*/
|
1440
2760
|
none(...queries) {
|
1441
2761
|
const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
|
1442
2762
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $none } }, __privateGet$5(this, _data));
|
@@ -1459,6 +2779,11 @@ const _Query = class {
|
|
1459
2779
|
const sort = [...originalSort, { column, direction }];
|
1460
2780
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { sort }, __privateGet$5(this, _data));
|
1461
2781
|
}
|
2782
|
+
/**
|
2783
|
+
* Builds a new query specifying the set of columns to be returned in the query response.
|
2784
|
+
* @param columns Array of column names to be returned by the query.
|
2785
|
+
* @returns A new Query object.
|
2786
|
+
*/
|
1462
2787
|
select(columns) {
|
1463
2788
|
return new _Query(
|
1464
2789
|
__privateGet$5(this, _repository),
|
@@ -1471,6 +2796,12 @@ const _Query = class {
|
|
1471
2796
|
const query = new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), options, __privateGet$5(this, _data));
|
1472
2797
|
return __privateGet$5(this, _repository).query(query);
|
1473
2798
|
}
|
2799
|
+
/**
|
2800
|
+
* Get results in an iterator
|
2801
|
+
*
|
2802
|
+
* @async
|
2803
|
+
* @returns Async interable of results
|
2804
|
+
*/
|
1474
2805
|
async *[Symbol.asyncIterator]() {
|
1475
2806
|
for await (const [record] of this.getIterator({ batchSize: 1 })) {
|
1476
2807
|
yield record;
|
@@ -1521,21 +2852,59 @@ const _Query = class {
|
|
1521
2852
|
throw new Error("No results found.");
|
1522
2853
|
return records[0];
|
1523
2854
|
}
|
2855
|
+
async summarize(params = {}) {
|
2856
|
+
const { summaries, summariesFilter, ...options } = params;
|
2857
|
+
const query = new _Query(
|
2858
|
+
__privateGet$5(this, _repository),
|
2859
|
+
__privateGet$5(this, _table$1),
|
2860
|
+
options,
|
2861
|
+
__privateGet$5(this, _data)
|
2862
|
+
);
|
2863
|
+
return __privateGet$5(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
2864
|
+
}
|
2865
|
+
/**
|
2866
|
+
* Builds a new query object adding a cache TTL in milliseconds.
|
2867
|
+
* @param ttl The cache TTL in milliseconds.
|
2868
|
+
* @returns A new Query object.
|
2869
|
+
*/
|
1524
2870
|
cache(ttl) {
|
1525
2871
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
1526
2872
|
}
|
2873
|
+
/**
|
2874
|
+
* Retrieve next page of records
|
2875
|
+
*
|
2876
|
+
* @returns A new page object.
|
2877
|
+
*/
|
1527
2878
|
nextPage(size, offset) {
|
1528
|
-
return this.
|
2879
|
+
return this.startPage(size, offset);
|
1529
2880
|
}
|
2881
|
+
/**
|
2882
|
+
* Retrieve previous page of records
|
2883
|
+
*
|
2884
|
+
* @returns A new page object
|
2885
|
+
*/
|
1530
2886
|
previousPage(size, offset) {
|
1531
|
-
return this.
|
1532
|
-
}
|
1533
|
-
|
2887
|
+
return this.startPage(size, offset);
|
2888
|
+
}
|
2889
|
+
/**
|
2890
|
+
* Retrieve start page of records
|
2891
|
+
*
|
2892
|
+
* @returns A new page object
|
2893
|
+
*/
|
2894
|
+
startPage(size, offset) {
|
1534
2895
|
return this.getPaginated({ pagination: { size, offset } });
|
1535
2896
|
}
|
1536
|
-
|
2897
|
+
/**
|
2898
|
+
* Retrieve last page of records
|
2899
|
+
*
|
2900
|
+
* @returns A new page object
|
2901
|
+
*/
|
2902
|
+
endPage(size, offset) {
|
1537
2903
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
1538
2904
|
}
|
2905
|
+
/**
|
2906
|
+
* @returns Boolean indicating if there is a next page
|
2907
|
+
*/
|
1539
2908
|
hasNextPage() {
|
1540
2909
|
return this.meta.page.more;
|
1541
2910
|
}
|
@@ -1557,7 +2926,7 @@ cleanFilterConstraint_fn = function(column, value) {
|
|
1557
2926
|
};
|
1558
2927
|
function cleanParent(data, parent) {
|
1559
2928
|
if (isCursorPaginationOptions(data.pagination)) {
|
1560
|
-
return { ...parent,
|
2929
|
+
return { ...parent, sort: void 0, filter: void 0 };
|
1561
2930
|
}
|
1562
2931
|
return parent;
|
1563
2932
|
}
|
@@ -1575,7 +2944,11 @@ function isSortFilterString(value) {
|
|
1575
2944
|
return isString(value);
|
1576
2945
|
}
|
1577
2946
|
function isSortFilterBase(filter) {
|
1578
|
-
return isObject(filter) && Object.
|
2947
|
+
return isObject(filter) && Object.entries(filter).every(([key, value]) => {
|
2948
|
+
if (key === "*")
|
2949
|
+
return value === "random";
|
2950
|
+
return value === "asc" || value === "desc";
|
2951
|
+
});
|
1579
2952
|
}
|
1580
2953
|
function isSortFilterObject(filter) {
|
1581
2954
|
return isObject(filter) && !isSortFilterBase(filter) && filter.column !== void 0;
|
@@ -1616,7 +2989,8 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
1616
2989
|
__accessCheck$4(obj, member, "access private method");
|
1617
2990
|
return method;
|
1618
2991
|
};
|
1619
|
-
var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn,
|
2992
|
+
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;
|
2993
|
+
const BULK_OPERATION_MAX_SIZE = 1e3;
|
1620
2994
|
class Repository extends Query {
|
1621
2995
|
}
|
1622
2996
|
class RestRepository extends Query {
|
@@ -1628,10 +3002,12 @@ class RestRepository extends Query {
|
|
1628
3002
|
);
|
1629
3003
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1630
3004
|
__privateAdd$4(this, _insertRecordWithId);
|
1631
|
-
__privateAdd$4(this,
|
3005
|
+
__privateAdd$4(this, _insertRecords);
|
1632
3006
|
__privateAdd$4(this, _updateRecordWithID);
|
3007
|
+
__privateAdd$4(this, _updateRecords);
|
1633
3008
|
__privateAdd$4(this, _upsertRecordWithID);
|
1634
3009
|
__privateAdd$4(this, _deleteRecord);
|
3010
|
+
__privateAdd$4(this, _deleteRecords);
|
1635
3011
|
__privateAdd$4(this, _setCacheQuery);
|
1636
3012
|
__privateAdd$4(this, _getCacheQuery);
|
1637
3013
|
__privateAdd$4(this, _getSchemaTables$1);
|
@@ -1642,10 +3018,10 @@ class RestRepository extends Query {
|
|
1642
3018
|
__privateAdd$4(this, _schemaTables$2, void 0);
|
1643
3019
|
__privateAdd$4(this, _trace, void 0);
|
1644
3020
|
__privateSet$4(this, _table, options.table);
|
1645
|
-
__privateSet$4(this, _getFetchProps, options.pluginOptions.getFetchProps);
|
1646
3021
|
__privateSet$4(this, _db, options.db);
|
1647
3022
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
1648
3023
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
3024
|
+
__privateSet$4(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
|
1649
3025
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
1650
3026
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
1651
3027
|
return trace(name, fn, {
|
@@ -1656,25 +3032,28 @@ class RestRepository extends Query {
|
|
1656
3032
|
});
|
1657
3033
|
});
|
1658
3034
|
}
|
1659
|
-
async create(a, b, c) {
|
3035
|
+
async create(a, b, c, d) {
|
1660
3036
|
return __privateGet$4(this, _trace).call(this, "create", async () => {
|
3037
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1661
3038
|
if (Array.isArray(a)) {
|
1662
3039
|
if (a.length === 0)
|
1663
3040
|
return [];
|
1664
|
-
const
|
1665
|
-
|
3041
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: true });
|
3042
|
+
const columns = isStringArray(b) ? b : ["*"];
|
3043
|
+
const result = await this.read(ids, columns);
|
3044
|
+
return result;
|
1666
3045
|
}
|
1667
3046
|
if (isString(a) && isObject(b)) {
|
1668
3047
|
if (a === "")
|
1669
3048
|
throw new Error("The id can't be empty");
|
1670
3049
|
const columns = isStringArray(c) ? c : void 0;
|
1671
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns);
|
3050
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: true, ifVersion });
|
1672
3051
|
}
|
1673
3052
|
if (isObject(a) && isString(a.id)) {
|
1674
3053
|
if (a.id === "")
|
1675
3054
|
throw new Error("The id can't be empty");
|
1676
3055
|
const columns = isStringArray(b) ? b : void 0;
|
1677
|
-
return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
3056
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: true, ifVersion });
|
1678
3057
|
}
|
1679
3058
|
if (isObject(a)) {
|
1680
3059
|
const columns = isStringArray(b) ? b : void 0;
|
@@ -1699,20 +3078,20 @@ class RestRepository extends Query {
|
|
1699
3078
|
}
|
1700
3079
|
const id = extractId(a);
|
1701
3080
|
if (id) {
|
1702
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1703
3081
|
try {
|
1704
3082
|
const response = await getRecord({
|
1705
3083
|
pathParams: {
|
1706
3084
|
workspace: "{workspaceId}",
|
1707
3085
|
dbBranchName: "{dbBranch}",
|
3086
|
+
region: "{region}",
|
1708
3087
|
tableName: __privateGet$4(this, _table),
|
1709
3088
|
recordId: id
|
1710
3089
|
},
|
1711
3090
|
queryParams: { columns },
|
1712
|
-
...
|
3091
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1713
3092
|
});
|
1714
3093
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1715
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
3094
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1716
3095
|
} catch (e) {
|
1717
3096
|
if (isObject(e) && e.status === 404) {
|
1718
3097
|
return null;
|
@@ -1742,31 +3121,42 @@ class RestRepository extends Query {
|
|
1742
3121
|
return result;
|
1743
3122
|
});
|
1744
3123
|
}
|
1745
|
-
async update(a, b, c) {
|
3124
|
+
async update(a, b, c, d) {
|
1746
3125
|
return __privateGet$4(this, _trace).call(this, "update", async () => {
|
3126
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1747
3127
|
if (Array.isArray(a)) {
|
1748
3128
|
if (a.length === 0)
|
1749
3129
|
return [];
|
1750
|
-
|
1751
|
-
|
1752
|
-
|
3130
|
+
const existing = await this.read(a, ["id"]);
|
3131
|
+
const updates = a.filter((_item, index) => existing[index] !== null);
|
3132
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, updates, {
|
3133
|
+
ifVersion,
|
3134
|
+
upsert: false
|
3135
|
+
});
|
1753
3136
|
const columns = isStringArray(b) ? b : ["*"];
|
1754
|
-
|
1755
|
-
|
1756
|
-
if (isString(a) && isObject(b)) {
|
1757
|
-
const columns = isStringArray(c) ? c : void 0;
|
1758
|
-
return __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns);
|
3137
|
+
const result = await this.read(a, columns);
|
3138
|
+
return result;
|
1759
3139
|
}
|
1760
|
-
|
1761
|
-
|
1762
|
-
|
3140
|
+
try {
|
3141
|
+
if (isString(a) && isObject(b)) {
|
3142
|
+
const columns = isStringArray(c) ? c : void 0;
|
3143
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
3144
|
+
}
|
3145
|
+
if (isObject(a) && isString(a.id)) {
|
3146
|
+
const columns = isStringArray(b) ? b : void 0;
|
3147
|
+
return await __privateMethod$2(this, _updateRecordWithID, updateRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
3148
|
+
}
|
3149
|
+
} catch (error) {
|
3150
|
+
if (error.status === 422)
|
3151
|
+
return null;
|
3152
|
+
throw error;
|
1763
3153
|
}
|
1764
3154
|
throw new Error("Invalid arguments for update method");
|
1765
3155
|
});
|
1766
3156
|
}
|
1767
|
-
async updateOrThrow(a, b, c) {
|
3157
|
+
async updateOrThrow(a, b, c, d) {
|
1768
3158
|
return __privateGet$4(this, _trace).call(this, "updateOrThrow", async () => {
|
1769
|
-
const result = await this.update(a, b, c);
|
3159
|
+
const result = await this.update(a, b, c, d);
|
1770
3160
|
if (Array.isArray(result)) {
|
1771
3161
|
const missingIds = compact(
|
1772
3162
|
a.filter((_item, index) => result[index] === null).map((item) => extractId(item))
|
@@ -1783,37 +3173,89 @@ class RestRepository extends Query {
|
|
1783
3173
|
return result;
|
1784
3174
|
});
|
1785
3175
|
}
|
1786
|
-
async createOrUpdate(a, b, c) {
|
3176
|
+
async createOrUpdate(a, b, c, d) {
|
1787
3177
|
return __privateGet$4(this, _trace).call(this, "createOrUpdate", async () => {
|
3178
|
+
const ifVersion = parseIfVersion(b, c, d);
|
1788
3179
|
if (Array.isArray(a)) {
|
1789
3180
|
if (a.length === 0)
|
1790
3181
|
return [];
|
1791
|
-
|
1792
|
-
|
1793
|
-
|
3182
|
+
await __privateMethod$2(this, _updateRecords, updateRecords_fn).call(this, a, {
|
3183
|
+
ifVersion,
|
3184
|
+
upsert: true
|
3185
|
+
});
|
1794
3186
|
const columns = isStringArray(b) ? b : ["*"];
|
1795
|
-
|
3187
|
+
const result = await this.read(a, columns);
|
3188
|
+
return result;
|
1796
3189
|
}
|
1797
3190
|
if (isString(a) && isObject(b)) {
|
3191
|
+
if (a === "")
|
3192
|
+
throw new Error("The id can't be empty");
|
1798
3193
|
const columns = isStringArray(c) ? c : void 0;
|
1799
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns);
|
3194
|
+
return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
|
1800
3195
|
}
|
1801
3196
|
if (isObject(a) && isString(a.id)) {
|
3197
|
+
if (a.id === "")
|
3198
|
+
throw new Error("The id can't be empty");
|
1802
3199
|
const columns = isStringArray(c) ? c : void 0;
|
1803
|
-
return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns);
|
3200
|
+
return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
|
3201
|
+
}
|
3202
|
+
if (!isDefined(a) && isObject(b)) {
|
3203
|
+
return await this.create(b, c);
|
3204
|
+
}
|
3205
|
+
if (isObject(a) && !isDefined(a.id)) {
|
3206
|
+
return await this.create(a, b);
|
1804
3207
|
}
|
1805
3208
|
throw new Error("Invalid arguments for createOrUpdate method");
|
1806
3209
|
});
|
1807
3210
|
}
|
3211
|
+
async createOrReplace(a, b, c, d) {
|
3212
|
+
return __privateGet$4(this, _trace).call(this, "createOrReplace", async () => {
|
3213
|
+
const ifVersion = parseIfVersion(b, c, d);
|
3214
|
+
if (Array.isArray(a)) {
|
3215
|
+
if (a.length === 0)
|
3216
|
+
return [];
|
3217
|
+
const ids = await __privateMethod$2(this, _insertRecords, insertRecords_fn).call(this, a, { ifVersion, createOnly: false });
|
3218
|
+
const columns = isStringArray(b) ? b : ["*"];
|
3219
|
+
const result = await this.read(ids, columns);
|
3220
|
+
return result;
|
3221
|
+
}
|
3222
|
+
if (isString(a) && isObject(b)) {
|
3223
|
+
if (a === "")
|
3224
|
+
throw new Error("The id can't be empty");
|
3225
|
+
const columns = isStringArray(c) ? c : void 0;
|
3226
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
|
3227
|
+
}
|
3228
|
+
if (isObject(a) && isString(a.id)) {
|
3229
|
+
if (a.id === "")
|
3230
|
+
throw new Error("The id can't be empty");
|
3231
|
+
const columns = isStringArray(c) ? c : void 0;
|
3232
|
+
return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
|
3233
|
+
}
|
3234
|
+
if (!isDefined(a) && isObject(b)) {
|
3235
|
+
return await this.create(b, c);
|
3236
|
+
}
|
3237
|
+
if (isObject(a) && !isDefined(a.id)) {
|
3238
|
+
return await this.create(a, b);
|
3239
|
+
}
|
3240
|
+
throw new Error("Invalid arguments for createOrReplace method");
|
3241
|
+
});
|
3242
|
+
}
|
1808
3243
|
async delete(a, b) {
|
1809
3244
|
return __privateGet$4(this, _trace).call(this, "delete", async () => {
|
1810
3245
|
if (Array.isArray(a)) {
|
1811
3246
|
if (a.length === 0)
|
1812
3247
|
return [];
|
1813
|
-
|
1814
|
-
|
1815
|
-
|
1816
|
-
|
3248
|
+
const ids = a.map((o) => {
|
3249
|
+
if (isString(o))
|
3250
|
+
return o;
|
3251
|
+
if (isString(o.id))
|
3252
|
+
return o.id;
|
3253
|
+
throw new Error("Invalid arguments for delete method");
|
3254
|
+
});
|
3255
|
+
const columns = isStringArray(b) ? b : ["*"];
|
3256
|
+
const result = await this.read(a, columns);
|
3257
|
+
await __privateMethod$2(this, _deleteRecords, deleteRecords_fn).call(this, ids);
|
3258
|
+
return result;
|
1817
3259
|
}
|
1818
3260
|
if (isString(a)) {
|
1819
3261
|
return __privateMethod$2(this, _deleteRecord, deleteRecord_fn).call(this, a, b);
|
@@ -1844,21 +3286,64 @@ class RestRepository extends Query {
|
|
1844
3286
|
}
|
1845
3287
|
async search(query, options = {}) {
|
1846
3288
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
1847
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1848
3289
|
const { records } = await searchTable({
|
1849
|
-
pathParams: {
|
3290
|
+
pathParams: {
|
3291
|
+
workspace: "{workspaceId}",
|
3292
|
+
dbBranchName: "{dbBranch}",
|
3293
|
+
region: "{region}",
|
3294
|
+
tableName: __privateGet$4(this, _table)
|
3295
|
+
},
|
1850
3296
|
body: {
|
1851
3297
|
query,
|
1852
3298
|
fuzziness: options.fuzziness,
|
1853
3299
|
prefix: options.prefix,
|
1854
3300
|
highlight: options.highlight,
|
1855
3301
|
filter: options.filter,
|
1856
|
-
boosters: options.boosters
|
3302
|
+
boosters: options.boosters,
|
3303
|
+
page: options.page,
|
3304
|
+
target: options.target
|
1857
3305
|
},
|
1858
|
-
...
|
3306
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1859
3307
|
});
|
1860
3308
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1861
|
-
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
3309
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
3310
|
+
});
|
3311
|
+
}
|
3312
|
+
async vectorSearch(column, query, options) {
|
3313
|
+
return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
|
3314
|
+
const { records } = await vectorSearchTable({
|
3315
|
+
pathParams: {
|
3316
|
+
workspace: "{workspaceId}",
|
3317
|
+
dbBranchName: "{dbBranch}",
|
3318
|
+
region: "{region}",
|
3319
|
+
tableName: __privateGet$4(this, _table)
|
3320
|
+
},
|
3321
|
+
body: {
|
3322
|
+
column,
|
3323
|
+
queryVector: query,
|
3324
|
+
similarityFunction: options?.similarityFunction,
|
3325
|
+
size: options?.size,
|
3326
|
+
filter: options?.filter
|
3327
|
+
},
|
3328
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3329
|
+
});
|
3330
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
3331
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
3332
|
+
});
|
3333
|
+
}
|
3334
|
+
async aggregate(aggs, filter) {
|
3335
|
+
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
3336
|
+
const result = await aggregateTable({
|
3337
|
+
pathParams: {
|
3338
|
+
workspace: "{workspaceId}",
|
3339
|
+
dbBranchName: "{dbBranch}",
|
3340
|
+
region: "{region}",
|
3341
|
+
tableName: __privateGet$4(this, _table)
|
3342
|
+
},
|
3343
|
+
body: { aggs, filter },
|
3344
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3345
|
+
});
|
3346
|
+
return result;
|
1862
3347
|
});
|
1863
3348
|
}
|
1864
3349
|
async query(query) {
|
@@ -1867,24 +3352,83 @@ class RestRepository extends Query {
|
|
1867
3352
|
if (cacheQuery)
|
1868
3353
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1869
3354
|
const data = query.getQueryOptions();
|
1870
|
-
const body = {
|
1871
|
-
filter: cleanFilter(data.filter),
|
1872
|
-
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1873
|
-
page: data.pagination,
|
1874
|
-
columns: data.columns
|
1875
|
-
};
|
1876
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1877
3355
|
const { meta, records: objects } = await queryTable({
|
1878
|
-
pathParams: {
|
1879
|
-
|
1880
|
-
|
3356
|
+
pathParams: {
|
3357
|
+
workspace: "{workspaceId}",
|
3358
|
+
dbBranchName: "{dbBranch}",
|
3359
|
+
region: "{region}",
|
3360
|
+
tableName: __privateGet$4(this, _table)
|
3361
|
+
},
|
3362
|
+
body: {
|
3363
|
+
filter: cleanFilter(data.filter),
|
3364
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
3365
|
+
page: data.pagination,
|
3366
|
+
columns: data.columns ?? ["*"],
|
3367
|
+
consistency: data.consistency
|
3368
|
+
},
|
3369
|
+
fetchOptions: data.fetchOptions,
|
3370
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1881
3371
|
});
|
1882
3372
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1883
|
-
const records = objects.map(
|
3373
|
+
const records = objects.map(
|
3374
|
+
(record) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), record, data.columns ?? ["*"])
|
3375
|
+
);
|
1884
3376
|
await __privateMethod$2(this, _setCacheQuery, setCacheQuery_fn).call(this, query, meta, records);
|
1885
3377
|
return new Page(query, meta, records);
|
1886
3378
|
});
|
1887
3379
|
}
|
3380
|
+
async summarizeTable(query, summaries, summariesFilter) {
|
3381
|
+
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
3382
|
+
const data = query.getQueryOptions();
|
3383
|
+
const result = await summarizeTable({
|
3384
|
+
pathParams: {
|
3385
|
+
workspace: "{workspaceId}",
|
3386
|
+
dbBranchName: "{dbBranch}",
|
3387
|
+
region: "{region}",
|
3388
|
+
tableName: __privateGet$4(this, _table)
|
3389
|
+
},
|
3390
|
+
body: {
|
3391
|
+
filter: cleanFilter(data.filter),
|
3392
|
+
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
3393
|
+
columns: data.columns,
|
3394
|
+
consistency: data.consistency,
|
3395
|
+
page: data.pagination?.size !== void 0 ? { size: data.pagination?.size } : void 0,
|
3396
|
+
summaries,
|
3397
|
+
summariesFilter
|
3398
|
+
},
|
3399
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3400
|
+
});
|
3401
|
+
return result;
|
3402
|
+
});
|
3403
|
+
}
|
3404
|
+
ask(question, options) {
|
3405
|
+
const params = {
|
3406
|
+
pathParams: {
|
3407
|
+
workspace: "{workspaceId}",
|
3408
|
+
dbBranchName: "{dbBranch}",
|
3409
|
+
region: "{region}",
|
3410
|
+
tableName: __privateGet$4(this, _table)
|
3411
|
+
},
|
3412
|
+
body: {
|
3413
|
+
question,
|
3414
|
+
...options
|
3415
|
+
},
|
3416
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3417
|
+
};
|
3418
|
+
if (options?.onMessage) {
|
3419
|
+
fetchSSERequest({
|
3420
|
+
endpoint: "dataPlane",
|
3421
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
3422
|
+
method: "POST",
|
3423
|
+
onMessage: (message) => {
|
3424
|
+
options.onMessage?.({ answer: message.text, records: message.records });
|
3425
|
+
},
|
3426
|
+
...params
|
3427
|
+
});
|
3428
|
+
} else {
|
3429
|
+
return askTable(params);
|
3430
|
+
}
|
3431
|
+
}
|
1888
3432
|
}
|
1889
3433
|
_table = new WeakMap();
|
1890
3434
|
_getFetchProps = new WeakMap();
|
@@ -1894,68 +3438,90 @@ _schemaTables$2 = new WeakMap();
|
|
1894
3438
|
_trace = new WeakMap();
|
1895
3439
|
_insertRecordWithoutId = new WeakSet();
|
1896
3440
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
1897
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
1898
3441
|
const record = transformObjectLinks(object);
|
1899
3442
|
const response = await insertRecord({
|
1900
3443
|
pathParams: {
|
1901
3444
|
workspace: "{workspaceId}",
|
1902
3445
|
dbBranchName: "{dbBranch}",
|
3446
|
+
region: "{region}",
|
1903
3447
|
tableName: __privateGet$4(this, _table)
|
1904
3448
|
},
|
1905
3449
|
queryParams: { columns },
|
1906
3450
|
body: record,
|
1907
|
-
...
|
3451
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1908
3452
|
});
|
1909
3453
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1910
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
3454
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1911
3455
|
};
|
1912
3456
|
_insertRecordWithId = new WeakSet();
|
1913
|
-
insertRecordWithId_fn = async function(recordId, object, columns = ["*"]) {
|
1914
|
-
|
3457
|
+
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
3458
|
+
if (!recordId)
|
3459
|
+
return null;
|
1915
3460
|
const record = transformObjectLinks(object);
|
1916
3461
|
const response = await insertRecordWithID({
|
1917
3462
|
pathParams: {
|
1918
3463
|
workspace: "{workspaceId}",
|
1919
3464
|
dbBranchName: "{dbBranch}",
|
3465
|
+
region: "{region}",
|
1920
3466
|
tableName: __privateGet$4(this, _table),
|
1921
3467
|
recordId
|
1922
3468
|
},
|
1923
3469
|
body: record,
|
1924
|
-
queryParams: { createOnly
|
1925
|
-
...
|
3470
|
+
queryParams: { createOnly, columns, ifVersion },
|
3471
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1926
3472
|
});
|
1927
3473
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1928
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
1929
|
-
};
|
1930
|
-
|
1931
|
-
|
1932
|
-
const
|
1933
|
-
|
1934
|
-
|
1935
|
-
|
1936
|
-
|
1937
|
-
|
1938
|
-
|
1939
|
-
|
1940
|
-
|
1941
|
-
|
3474
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
3475
|
+
};
|
3476
|
+
_insertRecords = new WeakSet();
|
3477
|
+
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
3478
|
+
const chunkedOperations = chunk(
|
3479
|
+
objects.map((object) => ({
|
3480
|
+
insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
|
3481
|
+
})),
|
3482
|
+
BULK_OPERATION_MAX_SIZE
|
3483
|
+
);
|
3484
|
+
const ids = [];
|
3485
|
+
for (const operations of chunkedOperations) {
|
3486
|
+
const { results } = await branchTransaction({
|
3487
|
+
pathParams: {
|
3488
|
+
workspace: "{workspaceId}",
|
3489
|
+
dbBranchName: "{dbBranch}",
|
3490
|
+
region: "{region}"
|
3491
|
+
},
|
3492
|
+
body: { operations },
|
3493
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3494
|
+
});
|
3495
|
+
for (const result of results) {
|
3496
|
+
if (result.operation === "insert") {
|
3497
|
+
ids.push(result.id);
|
3498
|
+
} else {
|
3499
|
+
ids.push(null);
|
3500
|
+
}
|
3501
|
+
}
|
1942
3502
|
}
|
1943
|
-
|
1944
|
-
return response.records?.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item));
|
3503
|
+
return ids;
|
1945
3504
|
};
|
1946
3505
|
_updateRecordWithID = new WeakSet();
|
1947
|
-
updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
1948
|
-
|
1949
|
-
|
3506
|
+
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
3507
|
+
if (!recordId)
|
3508
|
+
return null;
|
3509
|
+
const { id: _id, ...record } = transformObjectLinks(object);
|
1950
3510
|
try {
|
1951
3511
|
const response = await updateRecordWithID({
|
1952
|
-
pathParams: {
|
1953
|
-
|
3512
|
+
pathParams: {
|
3513
|
+
workspace: "{workspaceId}",
|
3514
|
+
dbBranchName: "{dbBranch}",
|
3515
|
+
region: "{region}",
|
3516
|
+
tableName: __privateGet$4(this, _table),
|
3517
|
+
recordId
|
3518
|
+
},
|
3519
|
+
queryParams: { columns, ifVersion },
|
1954
3520
|
body: record,
|
1955
|
-
...
|
3521
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1956
3522
|
});
|
1957
3523
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1958
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
3524
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1959
3525
|
} catch (e) {
|
1960
3526
|
if (isObject(e) && e.status === 404) {
|
1961
3527
|
return null;
|
@@ -1963,29 +3529,72 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
|
1963
3529
|
throw e;
|
1964
3530
|
}
|
1965
3531
|
};
|
3532
|
+
_updateRecords = new WeakSet();
|
3533
|
+
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
3534
|
+
const chunkedOperations = chunk(
|
3535
|
+
objects.map(({ id, ...object }) => ({
|
3536
|
+
update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
|
3537
|
+
})),
|
3538
|
+
BULK_OPERATION_MAX_SIZE
|
3539
|
+
);
|
3540
|
+
const ids = [];
|
3541
|
+
for (const operations of chunkedOperations) {
|
3542
|
+
const { results } = await branchTransaction({
|
3543
|
+
pathParams: {
|
3544
|
+
workspace: "{workspaceId}",
|
3545
|
+
dbBranchName: "{dbBranch}",
|
3546
|
+
region: "{region}"
|
3547
|
+
},
|
3548
|
+
body: { operations },
|
3549
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3550
|
+
});
|
3551
|
+
for (const result of results) {
|
3552
|
+
if (result.operation === "update") {
|
3553
|
+
ids.push(result.id);
|
3554
|
+
} else {
|
3555
|
+
ids.push(null);
|
3556
|
+
}
|
3557
|
+
}
|
3558
|
+
}
|
3559
|
+
return ids;
|
3560
|
+
};
|
1966
3561
|
_upsertRecordWithID = new WeakSet();
|
1967
|
-
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"]) {
|
1968
|
-
|
3562
|
+
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
3563
|
+
if (!recordId)
|
3564
|
+
return null;
|
1969
3565
|
const response = await upsertRecordWithID({
|
1970
|
-
pathParams: {
|
1971
|
-
|
3566
|
+
pathParams: {
|
3567
|
+
workspace: "{workspaceId}",
|
3568
|
+
dbBranchName: "{dbBranch}",
|
3569
|
+
region: "{region}",
|
3570
|
+
tableName: __privateGet$4(this, _table),
|
3571
|
+
recordId
|
3572
|
+
},
|
3573
|
+
queryParams: { columns, ifVersion },
|
1972
3574
|
body: object,
|
1973
|
-
...
|
3575
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1974
3576
|
});
|
1975
3577
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1976
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
3578
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1977
3579
|
};
|
1978
3580
|
_deleteRecord = new WeakSet();
|
1979
3581
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
1980
|
-
|
3582
|
+
if (!recordId)
|
3583
|
+
return null;
|
1981
3584
|
try {
|
1982
3585
|
const response = await deleteRecord({
|
1983
|
-
pathParams: {
|
3586
|
+
pathParams: {
|
3587
|
+
workspace: "{workspaceId}",
|
3588
|
+
dbBranchName: "{dbBranch}",
|
3589
|
+
region: "{region}",
|
3590
|
+
tableName: __privateGet$4(this, _table),
|
3591
|
+
recordId
|
3592
|
+
},
|
1984
3593
|
queryParams: { columns },
|
1985
|
-
...
|
3594
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
1986
3595
|
});
|
1987
3596
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
1988
|
-
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response);
|
3597
|
+
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
1989
3598
|
} catch (e) {
|
1990
3599
|
if (isObject(e) && e.status === 404) {
|
1991
3600
|
return null;
|
@@ -1993,17 +3602,36 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
1993
3602
|
throw e;
|
1994
3603
|
}
|
1995
3604
|
};
|
3605
|
+
_deleteRecords = new WeakSet();
|
3606
|
+
deleteRecords_fn = async function(recordIds) {
|
3607
|
+
const chunkedOperations = chunk(
|
3608
|
+
compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
3609
|
+
BULK_OPERATION_MAX_SIZE
|
3610
|
+
);
|
3611
|
+
for (const operations of chunkedOperations) {
|
3612
|
+
await branchTransaction({
|
3613
|
+
pathParams: {
|
3614
|
+
workspace: "{workspaceId}",
|
3615
|
+
dbBranchName: "{dbBranch}",
|
3616
|
+
region: "{region}"
|
3617
|
+
},
|
3618
|
+
body: { operations },
|
3619
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3620
|
+
});
|
3621
|
+
}
|
3622
|
+
};
|
1996
3623
|
_setCacheQuery = new WeakSet();
|
1997
3624
|
setCacheQuery_fn = async function(query, meta, records) {
|
1998
|
-
await __privateGet$4(this, _cache)
|
3625
|
+
await __privateGet$4(this, _cache)?.set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
|
1999
3626
|
};
|
2000
3627
|
_getCacheQuery = new WeakSet();
|
2001
3628
|
getCacheQuery_fn = async function(query) {
|
2002
3629
|
const key = `query_${__privateGet$4(this, _table)}:${query.key()}`;
|
2003
|
-
const result = await __privateGet$4(this, _cache)
|
3630
|
+
const result = await __privateGet$4(this, _cache)?.get(key);
|
2004
3631
|
if (!result)
|
2005
3632
|
return null;
|
2006
|
-
const
|
3633
|
+
const defaultTTL = __privateGet$4(this, _cache)?.defaultQueryTTL ?? -1;
|
3634
|
+
const { cache: ttl = defaultTTL } = query.getQueryOptions();
|
2007
3635
|
if (ttl < 0)
|
2008
3636
|
return null;
|
2009
3637
|
const hasExpired = result.date.getTime() + ttl < Date.now();
|
@@ -2013,10 +3641,9 @@ _getSchemaTables$1 = new WeakSet();
|
|
2013
3641
|
getSchemaTables_fn$1 = async function() {
|
2014
3642
|
if (__privateGet$4(this, _schemaTables$2))
|
2015
3643
|
return __privateGet$4(this, _schemaTables$2);
|
2016
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2017
3644
|
const { schema } = await getBranchDetails({
|
2018
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2019
|
-
...
|
3645
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3646
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2020
3647
|
});
|
2021
3648
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
2022
3649
|
return schema.tables;
|
@@ -2028,22 +3655,24 @@ const transformObjectLinks = (object) => {
|
|
2028
3655
|
return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
|
2029
3656
|
}, {});
|
2030
3657
|
};
|
2031
|
-
const initObject = (db, schemaTables, table, object) => {
|
2032
|
-
const
|
3658
|
+
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
3659
|
+
const data = {};
|
2033
3660
|
const { xata, ...rest } = object ?? {};
|
2034
|
-
Object.assign(
|
3661
|
+
Object.assign(data, rest);
|
2035
3662
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
2036
3663
|
if (!columns)
|
2037
3664
|
console.error(`Table ${table} not found in schema`);
|
2038
3665
|
for (const column of columns ?? []) {
|
2039
|
-
|
3666
|
+
if (!isValidColumn(selectedColumns, column))
|
3667
|
+
continue;
|
3668
|
+
const value = data[column.name];
|
2040
3669
|
switch (column.type) {
|
2041
3670
|
case "datetime": {
|
2042
|
-
const date = value !== void 0 ? new Date(value) :
|
2043
|
-
if (date && isNaN(date.getTime())) {
|
3671
|
+
const date = value !== void 0 ? new Date(value) : null;
|
3672
|
+
if (date !== null && isNaN(date.getTime())) {
|
2044
3673
|
console.error(`Failed to parse date ${value} for field ${column.name}`);
|
2045
|
-
} else
|
2046
|
-
|
3674
|
+
} else {
|
3675
|
+
data[column.name] = date;
|
2047
3676
|
}
|
2048
3677
|
break;
|
2049
3678
|
}
|
@@ -2052,41 +3681,65 @@ const initObject = (db, schemaTables, table, object) => {
|
|
2052
3681
|
if (!linkTable) {
|
2053
3682
|
console.error(`Failed to parse link for field ${column.name}`);
|
2054
3683
|
} else if (isObject(value)) {
|
2055
|
-
|
3684
|
+
const selectedLinkColumns = selectedColumns.reduce((acc, item) => {
|
3685
|
+
if (item === column.name) {
|
3686
|
+
return [...acc, "*"];
|
3687
|
+
}
|
3688
|
+
if (item.startsWith(`${column.name}.`)) {
|
3689
|
+
const [, ...path] = item.split(".");
|
3690
|
+
return [...acc, path.join(".")];
|
3691
|
+
}
|
3692
|
+
return acc;
|
3693
|
+
}, []);
|
3694
|
+
data[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2056
3695
|
} else {
|
2057
|
-
|
3696
|
+
data[column.name] = null;
|
2058
3697
|
}
|
2059
3698
|
break;
|
2060
3699
|
}
|
2061
3700
|
default:
|
2062
|
-
|
3701
|
+
data[column.name] = value ?? null;
|
2063
3702
|
if (column.notNull === true && value === null) {
|
2064
3703
|
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2065
3704
|
}
|
2066
3705
|
break;
|
2067
3706
|
}
|
2068
3707
|
}
|
2069
|
-
|
2070
|
-
|
3708
|
+
const record = { ...data };
|
3709
|
+
const serializable = { xata, ...transformObjectLinks(data) };
|
3710
|
+
const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
|
3711
|
+
record.read = function(columns2) {
|
3712
|
+
return db[table].read(record["id"], columns2);
|
3713
|
+
};
|
3714
|
+
record.update = function(data2, b, c) {
|
3715
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
3716
|
+
const ifVersion = parseIfVersion(b, c);
|
3717
|
+
return db[table].update(record["id"], data2, columns2, { ifVersion });
|
3718
|
+
};
|
3719
|
+
record.replace = function(data2, b, c) {
|
3720
|
+
const columns2 = isStringArray(b) ? b : ["*"];
|
3721
|
+
const ifVersion = parseIfVersion(b, c);
|
3722
|
+
return db[table].createOrReplace(record["id"], data2, columns2, { ifVersion });
|
2071
3723
|
};
|
2072
|
-
|
2073
|
-
return db[table].
|
3724
|
+
record.delete = function() {
|
3725
|
+
return db[table].delete(record["id"]);
|
2074
3726
|
};
|
2075
|
-
|
2076
|
-
|
3727
|
+
record.xata = Object.freeze(metadata);
|
3728
|
+
record.getMetadata = function() {
|
3729
|
+
return record.xata;
|
2077
3730
|
};
|
2078
|
-
|
2079
|
-
return
|
3731
|
+
record.toSerializable = function() {
|
3732
|
+
return JSON.parse(JSON.stringify(serializable));
|
2080
3733
|
};
|
2081
|
-
|
2082
|
-
|
3734
|
+
record.toString = function() {
|
3735
|
+
return JSON.stringify(transformObjectLinks(serializable));
|
3736
|
+
};
|
3737
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
|
3738
|
+
Object.defineProperty(record, prop, { enumerable: false });
|
2083
3739
|
}
|
2084
|
-
Object.freeze(
|
2085
|
-
return
|
3740
|
+
Object.freeze(record);
|
3741
|
+
return record;
|
2086
3742
|
};
|
2087
|
-
function isResponseWithRecords(value) {
|
2088
|
-
return isObject(value) && Array.isArray(value.records);
|
2089
|
-
}
|
2090
3743
|
function extractId(value) {
|
2091
3744
|
if (isString(value))
|
2092
3745
|
return value;
|
@@ -2094,11 +3747,22 @@ function extractId(value) {
|
|
2094
3747
|
return value.id;
|
2095
3748
|
return void 0;
|
2096
3749
|
}
|
2097
|
-
function
|
2098
|
-
if (
|
2099
|
-
return
|
2100
|
-
|
2101
|
-
|
3750
|
+
function isValidColumn(columns, column) {
|
3751
|
+
if (columns.includes("*"))
|
3752
|
+
return true;
|
3753
|
+
if (column.type === "link") {
|
3754
|
+
const linkColumns = columns.filter((item) => item.startsWith(column.name));
|
3755
|
+
return linkColumns.length > 0;
|
3756
|
+
}
|
3757
|
+
return columns.includes(column.name);
|
3758
|
+
}
|
3759
|
+
function parseIfVersion(...args) {
|
3760
|
+
for (const arg of args) {
|
3761
|
+
if (isObject(arg) && isNumber(arg.ifVersion)) {
|
3762
|
+
return arg.ifVersion;
|
3763
|
+
}
|
3764
|
+
}
|
3765
|
+
return void 0;
|
2102
3766
|
}
|
2103
3767
|
|
2104
3768
|
var __accessCheck$3 = (obj, member, msg) => {
|
@@ -2258,23 +3922,23 @@ class SearchPlugin extends XataPlugin {
|
|
2258
3922
|
__privateAdd$1(this, _schemaTables, void 0);
|
2259
3923
|
__privateSet$1(this, _schemaTables, schemaTables);
|
2260
3924
|
}
|
2261
|
-
build(
|
3925
|
+
build(pluginOptions) {
|
2262
3926
|
return {
|
2263
3927
|
all: async (query, options = {}) => {
|
2264
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options,
|
2265
|
-
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this,
|
3928
|
+
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
3929
|
+
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
|
2266
3930
|
return records.map((record) => {
|
2267
3931
|
const { table = "orphan" } = record.xata;
|
2268
|
-
return { table, record: initObject(this.db, schemaTables, table, record) };
|
3932
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
2269
3933
|
});
|
2270
3934
|
},
|
2271
3935
|
byTable: async (query, options = {}) => {
|
2272
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options,
|
2273
|
-
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this,
|
3936
|
+
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
3937
|
+
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
|
2274
3938
|
return records.reduce((acc, record) => {
|
2275
3939
|
const { table = "orphan" } = record.xata;
|
2276
3940
|
const items = acc[table] ?? [];
|
2277
|
-
const item = initObject(this.db, schemaTables, table, record);
|
3941
|
+
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
2278
3942
|
return { ...acc, [table]: [...items, item] };
|
2279
3943
|
}, {});
|
2280
3944
|
}
|
@@ -2283,108 +3947,40 @@ class SearchPlugin extends XataPlugin {
|
|
2283
3947
|
}
|
2284
3948
|
_schemaTables = new WeakMap();
|
2285
3949
|
_search = new WeakSet();
|
2286
|
-
search_fn = async function(query, options,
|
2287
|
-
const
|
2288
|
-
const { tables, fuzziness, highlight, prefix } = options ?? {};
|
3950
|
+
search_fn = async function(query, options, pluginOptions) {
|
3951
|
+
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
2289
3952
|
const { records } = await searchBranch({
|
2290
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2291
|
-
|
2292
|
-
|
3953
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3954
|
+
// @ts-ignore https://github.com/xataio/client-ts/issues/313
|
3955
|
+
body: { tables, query, fuzziness, prefix, highlight, page },
|
3956
|
+
...pluginOptions
|
2293
3957
|
});
|
2294
3958
|
return records;
|
2295
3959
|
};
|
2296
3960
|
_getSchemaTables = new WeakSet();
|
2297
|
-
getSchemaTables_fn = async function(
|
3961
|
+
getSchemaTables_fn = async function(pluginOptions) {
|
2298
3962
|
if (__privateGet$1(this, _schemaTables))
|
2299
3963
|
return __privateGet$1(this, _schemaTables);
|
2300
|
-
const fetchProps = await getFetchProps();
|
2301
3964
|
const { schema } = await getBranchDetails({
|
2302
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}" },
|
2303
|
-
...
|
3965
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3966
|
+
...pluginOptions
|
2304
3967
|
});
|
2305
3968
|
__privateSet$1(this, _schemaTables, schema.tables);
|
2306
3969
|
return schema.tables;
|
2307
3970
|
};
|
2308
3971
|
|
2309
|
-
|
2310
|
-
|
2311
|
-
|
2312
|
-
|
2313
|
-
|
2314
|
-
|
2315
|
-
|
2316
|
-
|
2317
|
-
|
2318
|
-
|
2319
|
-
|
2320
|
-
|
2321
|
-
const gitBranch = envBranch || await getGitBranch();
|
2322
|
-
return resolveXataBranch(gitBranch, options);
|
2323
|
-
}
|
2324
|
-
async function getCurrentBranchDetails(options) {
|
2325
|
-
const branch = await getCurrentBranchName(options);
|
2326
|
-
return getDatabaseBranch(branch, options);
|
2327
|
-
}
|
2328
|
-
async function resolveXataBranch(gitBranch, options) {
|
2329
|
-
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2330
|
-
const apiKey = options?.apiKey || getAPIKey();
|
2331
|
-
if (!databaseURL)
|
2332
|
-
throw new Error(
|
2333
|
-
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
2334
|
-
);
|
2335
|
-
if (!apiKey)
|
2336
|
-
throw new Error(
|
2337
|
-
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2338
|
-
);
|
2339
|
-
const [protocol, , host, , dbName] = databaseURL.split("/");
|
2340
|
-
const [workspace] = host.split(".");
|
2341
|
-
const { fallbackBranch } = getEnvironment();
|
2342
|
-
const { branch } = await resolveBranch({
|
2343
|
-
apiKey,
|
2344
|
-
apiUrl: databaseURL,
|
2345
|
-
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2346
|
-
workspacesApiUrl: `${protocol}//${host}`,
|
2347
|
-
pathParams: { dbName, workspace },
|
2348
|
-
queryParams: { gitBranch, fallbackBranch },
|
2349
|
-
trace: defaultTrace
|
2350
|
-
});
|
2351
|
-
return branch;
|
2352
|
-
}
|
2353
|
-
async function getDatabaseBranch(branch, options) {
|
2354
|
-
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2355
|
-
const apiKey = options?.apiKey || getAPIKey();
|
2356
|
-
if (!databaseURL)
|
2357
|
-
throw new Error(
|
2358
|
-
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
2359
|
-
);
|
2360
|
-
if (!apiKey)
|
2361
|
-
throw new Error(
|
2362
|
-
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
2363
|
-
);
|
2364
|
-
const [protocol, , host, , database] = databaseURL.split("/");
|
2365
|
-
const [workspace] = host.split(".");
|
2366
|
-
const dbBranchName = `${database}:${branch}`;
|
2367
|
-
try {
|
2368
|
-
return await getBranchDetails({
|
2369
|
-
apiKey,
|
2370
|
-
apiUrl: databaseURL,
|
2371
|
-
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
2372
|
-
workspacesApiUrl: `${protocol}//${host}`,
|
2373
|
-
pathParams: { dbBranchName, workspace },
|
2374
|
-
trace: defaultTrace
|
2375
|
-
});
|
2376
|
-
} catch (err) {
|
2377
|
-
if (isObject(err) && err.status === 404)
|
2378
|
-
return null;
|
2379
|
-
throw err;
|
2380
|
-
}
|
2381
|
-
}
|
2382
|
-
function getDatabaseURL() {
|
2383
|
-
try {
|
2384
|
-
const { databaseURL } = getEnvironment();
|
2385
|
-
return databaseURL;
|
2386
|
-
} catch (err) {
|
2387
|
-
return void 0;
|
3972
|
+
class TransactionPlugin extends XataPlugin {
|
3973
|
+
build(pluginOptions) {
|
3974
|
+
return {
|
3975
|
+
run: async (operations) => {
|
3976
|
+
const response = await branchTransaction({
|
3977
|
+
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3978
|
+
body: { operations },
|
3979
|
+
...pluginOptions
|
3980
|
+
});
|
3981
|
+
return response;
|
3982
|
+
}
|
3983
|
+
};
|
2388
3984
|
}
|
2389
3985
|
}
|
2390
3986
|
|
@@ -2411,88 +4007,116 @@ var __privateMethod = (obj, member, method) => {
|
|
2411
4007
|
return method;
|
2412
4008
|
};
|
2413
4009
|
const buildClient = (plugins) => {
|
2414
|
-
var
|
4010
|
+
var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
|
2415
4011
|
return _a = class {
|
2416
4012
|
constructor(options = {}, schemaTables) {
|
2417
4013
|
__privateAdd(this, _parseOptions);
|
2418
4014
|
__privateAdd(this, _getFetchProps);
|
2419
|
-
__privateAdd(this, _evaluateBranch);
|
2420
|
-
__privateAdd(this, _branch, void 0);
|
2421
4015
|
__privateAdd(this, _options, void 0);
|
2422
4016
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
2423
4017
|
__privateSet(this, _options, safeOptions);
|
2424
4018
|
const pluginOptions = {
|
2425
|
-
|
4019
|
+
...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
|
2426
4020
|
cache: safeOptions.cache,
|
2427
|
-
|
4021
|
+
host: safeOptions.host
|
2428
4022
|
};
|
2429
4023
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
2430
4024
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
4025
|
+
const transactions = new TransactionPlugin().build(pluginOptions);
|
2431
4026
|
this.db = db;
|
2432
4027
|
this.search = search;
|
4028
|
+
this.transactions = transactions;
|
2433
4029
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
2434
4030
|
if (namespace === void 0)
|
2435
4031
|
continue;
|
2436
|
-
|
2437
|
-
if (result instanceof Promise) {
|
2438
|
-
void result.then((namespace2) => {
|
2439
|
-
this[key] = namespace2;
|
2440
|
-
});
|
2441
|
-
} else {
|
2442
|
-
this[key] = result;
|
2443
|
-
}
|
4032
|
+
this[key] = namespace.build(pluginOptions);
|
2444
4033
|
}
|
2445
4034
|
}
|
2446
4035
|
async getConfig() {
|
2447
4036
|
const databaseURL = __privateGet(this, _options).databaseURL;
|
2448
|
-
const branch =
|
4037
|
+
const branch = __privateGet(this, _options).branch;
|
2449
4038
|
return { databaseURL, branch };
|
2450
4039
|
}
|
2451
|
-
},
|
4040
|
+
}, _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
4041
|
+
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
4042
|
+
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
4043
|
+
if (isBrowser && !enableBrowser) {
|
4044
|
+
throw new Error(
|
4045
|
+
"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."
|
4046
|
+
);
|
4047
|
+
}
|
2452
4048
|
const fetch = getFetchImplementation(options?.fetch);
|
2453
4049
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
2454
4050
|
const apiKey = options?.apiKey || getAPIKey();
|
2455
4051
|
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
2456
4052
|
const trace = options?.trace ?? defaultTrace;
|
2457
|
-
const
|
4053
|
+
const clientName = options?.clientName;
|
4054
|
+
const host = options?.host ?? "production";
|
4055
|
+
const xataAgentExtra = options?.xataAgentExtra;
|
2458
4056
|
if (!apiKey) {
|
2459
4057
|
throw new Error("Option apiKey is required");
|
2460
4058
|
}
|
2461
4059
|
if (!databaseURL) {
|
2462
4060
|
throw new Error("Option databaseURL is required");
|
2463
4061
|
}
|
2464
|
-
|
2465
|
-
|
2466
|
-
const
|
2467
|
-
if (
|
2468
|
-
|
4062
|
+
const envBranch = getBranch();
|
4063
|
+
const previewBranch = getPreviewBranch();
|
4064
|
+
const branch = options?.branch || previewBranch || envBranch || "main";
|
4065
|
+
if (!!previewBranch && branch !== previewBranch) {
|
4066
|
+
console.warn(
|
4067
|
+
`Ignoring preview branch ${previewBranch} because branch option was passed to the client constructor with value ${branch}`
|
4068
|
+
);
|
4069
|
+
} else if (!!envBranch && branch !== envBranch) {
|
4070
|
+
console.warn(
|
4071
|
+
`Ignoring branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
4072
|
+
);
|
4073
|
+
} else if (!!previewBranch && !!envBranch && previewBranch !== envBranch) {
|
4074
|
+
console.warn(
|
4075
|
+
`Ignoring preview branch ${previewBranch} and branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
4076
|
+
);
|
4077
|
+
} else if (!previewBranch && !envBranch && options?.branch === void 0) {
|
4078
|
+
console.warn(
|
4079
|
+
`No branch was passed to the client constructor. Using default branch ${branch}. You can set the branch with the environment variable XATA_BRANCH or by passing the branch option to the client constructor.`
|
4080
|
+
);
|
4081
|
+
}
|
4082
|
+
return {
|
4083
|
+
fetch,
|
4084
|
+
databaseURL,
|
4085
|
+
apiKey,
|
4086
|
+
branch,
|
4087
|
+
cache,
|
4088
|
+
trace,
|
4089
|
+
host,
|
4090
|
+
clientID: generateUUID(),
|
4091
|
+
enableBrowser,
|
4092
|
+
clientName,
|
4093
|
+
xataAgentExtra
|
4094
|
+
};
|
4095
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = function({
|
4096
|
+
fetch,
|
4097
|
+
apiKey,
|
4098
|
+
databaseURL,
|
4099
|
+
branch,
|
4100
|
+
trace,
|
4101
|
+
clientID,
|
4102
|
+
clientName,
|
4103
|
+
xataAgentExtra
|
4104
|
+
}) {
|
2469
4105
|
return {
|
2470
|
-
|
4106
|
+
fetch,
|
2471
4107
|
apiKey,
|
2472
4108
|
apiUrl: "",
|
4109
|
+
// Instead of using workspace and dbBranch, we inject a probably CNAME'd URL
|
2473
4110
|
workspacesApiUrl: (path, params) => {
|
2474
4111
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2475
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${
|
4112
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branch}` : "");
|
2476
4113
|
return databaseURL + newPath;
|
2477
4114
|
},
|
2478
|
-
trace
|
2479
|
-
|
2480
|
-
|
2481
|
-
|
2482
|
-
return __privateGet(this, _branch);
|
2483
|
-
if (param === void 0)
|
2484
|
-
return void 0;
|
2485
|
-
const strategies = Array.isArray(param) ? [...param] : [param];
|
2486
|
-
const evaluateBranch = async (strategy) => {
|
2487
|
-
return isBranchStrategyBuilder(strategy) ? await strategy() : strategy;
|
4115
|
+
trace,
|
4116
|
+
clientID,
|
4117
|
+
clientName,
|
4118
|
+
xataAgentExtra
|
2488
4119
|
};
|
2489
|
-
for await (const strategy of strategies) {
|
2490
|
-
const branch = await evaluateBranch(strategy);
|
2491
|
-
if (branch) {
|
2492
|
-
__privateSet(this, _branch, branch);
|
2493
|
-
return branch;
|
2494
|
-
}
|
2495
|
-
}
|
2496
4120
|
}, _a;
|
2497
4121
|
};
|
2498
4122
|
class BaseClient extends buildClient() {
|
@@ -2566,7 +4190,7 @@ const deserialize = (json) => {
|
|
2566
4190
|
};
|
2567
4191
|
|
2568
4192
|
function buildWorkerRunner(config) {
|
2569
|
-
return function xataWorker(name,
|
4193
|
+
return function xataWorker(name, worker) {
|
2570
4194
|
return async (...args) => {
|
2571
4195
|
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
2572
4196
|
const result = await fetch(url, {
|
@@ -2588,6 +4212,7 @@ class XataError extends Error {
|
|
2588
4212
|
}
|
2589
4213
|
|
2590
4214
|
exports.BaseClient = BaseClient;
|
4215
|
+
exports.FetcherError = FetcherError;
|
2591
4216
|
exports.Operations = operationsByTag;
|
2592
4217
|
exports.PAGINATION_DEFAULT_OFFSET = PAGINATION_DEFAULT_OFFSET;
|
2593
4218
|
exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
|
@@ -2609,8 +4234,13 @@ exports.XataPlugin = XataPlugin;
|
|
2609
4234
|
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
2610
4235
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
2611
4236
|
exports.addTableColumn = addTableColumn;
|
4237
|
+
exports.aggregateTable = aggregateTable;
|
2612
4238
|
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
4239
|
+
exports.askTable = askTable;
|
4240
|
+
exports.branchTransaction = branchTransaction;
|
2613
4241
|
exports.buildClient = buildClient;
|
4242
|
+
exports.buildPreviewBranchName = buildPreviewBranchName;
|
4243
|
+
exports.buildProviderString = buildProviderString;
|
2614
4244
|
exports.buildWorkerRunner = buildWorkerRunner;
|
2615
4245
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
2616
4246
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
@@ -2618,6 +4248,7 @@ exports.compareBranchSchemas = compareBranchSchemas;
|
|
2618
4248
|
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
2619
4249
|
exports.compareMigrationRequest = compareMigrationRequest;
|
2620
4250
|
exports.contains = contains;
|
4251
|
+
exports.copyBranch = copyBranch;
|
2621
4252
|
exports.createBranch = createBranch;
|
2622
4253
|
exports.createDatabase = createDatabase;
|
2623
4254
|
exports.createMigrationRequest = createMigrationRequest;
|
@@ -2627,6 +4258,9 @@ exports.createWorkspace = createWorkspace;
|
|
2627
4258
|
exports.deleteBranch = deleteBranch;
|
2628
4259
|
exports.deleteColumn = deleteColumn;
|
2629
4260
|
exports.deleteDatabase = deleteDatabase;
|
4261
|
+
exports.deleteDatabaseGithubSettings = deleteDatabaseGithubSettings;
|
4262
|
+
exports.deleteFile = deleteFile;
|
4263
|
+
exports.deleteFileItem = deleteFileItem;
|
2630
4264
|
exports.deleteRecord = deleteRecord;
|
2631
4265
|
exports.deleteTable = deleteTable;
|
2632
4266
|
exports.deleteUser = deleteUser;
|
@@ -2637,8 +4271,10 @@ exports.endsWith = endsWith;
|
|
2637
4271
|
exports.equals = equals;
|
2638
4272
|
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
2639
4273
|
exports.exists = exists;
|
4274
|
+
exports.fileAccess = fileAccess;
|
2640
4275
|
exports.ge = ge;
|
2641
4276
|
exports.getAPIKey = getAPIKey;
|
4277
|
+
exports.getBranch = getBranch;
|
2642
4278
|
exports.getBranchDetails = getBranchDetails;
|
2643
4279
|
exports.getBranchList = getBranchList;
|
2644
4280
|
exports.getBranchMetadata = getBranchMetadata;
|
@@ -2647,14 +4283,17 @@ exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
|
2647
4283
|
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
2648
4284
|
exports.getBranchStats = getBranchStats;
|
2649
4285
|
exports.getColumn = getColumn;
|
2650
|
-
exports.
|
2651
|
-
exports.getCurrentBranchName = getCurrentBranchName;
|
4286
|
+
exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
|
2652
4287
|
exports.getDatabaseList = getDatabaseList;
|
2653
4288
|
exports.getDatabaseMetadata = getDatabaseMetadata;
|
2654
4289
|
exports.getDatabaseURL = getDatabaseURL;
|
4290
|
+
exports.getFile = getFile;
|
4291
|
+
exports.getFileItem = getFileItem;
|
2655
4292
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
4293
|
+
exports.getHostUrl = getHostUrl;
|
2656
4294
|
exports.getMigrationRequest = getMigrationRequest;
|
2657
4295
|
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
4296
|
+
exports.getPreviewBranch = getPreviewBranch;
|
2658
4297
|
exports.getRecord = getRecord;
|
2659
4298
|
exports.getTableColumns = getTableColumns;
|
2660
4299
|
exports.getTableSchema = getTableSchema;
|
@@ -2677,6 +4316,8 @@ exports.insertRecordWithID = insertRecordWithID;
|
|
2677
4316
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
2678
4317
|
exports.is = is;
|
2679
4318
|
exports.isCursorPaginationOptions = isCursorPaginationOptions;
|
4319
|
+
exports.isHostProviderAlias = isHostProviderAlias;
|
4320
|
+
exports.isHostProviderBuilder = isHostProviderBuilder;
|
2680
4321
|
exports.isIdentifiable = isIdentifiable;
|
2681
4322
|
exports.isNot = isNot;
|
2682
4323
|
exports.isXataRecord = isXataRecord;
|
@@ -2684,29 +4325,38 @@ exports.le = le;
|
|
2684
4325
|
exports.lessEquals = lessEquals;
|
2685
4326
|
exports.lessThan = lessThan;
|
2686
4327
|
exports.lessThanEquals = lessThanEquals;
|
2687
|
-
exports.listMigrationRequests = listMigrationRequests;
|
2688
4328
|
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
4329
|
+
exports.listRegions = listRegions;
|
2689
4330
|
exports.lt = lt;
|
2690
4331
|
exports.lte = lte;
|
2691
4332
|
exports.mergeMigrationRequest = mergeMigrationRequest;
|
2692
4333
|
exports.notExists = notExists;
|
2693
4334
|
exports.operationsByTag = operationsByTag;
|
4335
|
+
exports.parseProviderString = parseProviderString;
|
4336
|
+
exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
|
2694
4337
|
exports.pattern = pattern;
|
2695
4338
|
exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
|
4339
|
+
exports.pushBranchMigrations = pushBranchMigrations;
|
4340
|
+
exports.putFile = putFile;
|
4341
|
+
exports.putFileItem = putFileItem;
|
4342
|
+
exports.queryMigrationRequests = queryMigrationRequests;
|
2696
4343
|
exports.queryTable = queryTable;
|
2697
4344
|
exports.removeGitBranchesEntry = removeGitBranchesEntry;
|
2698
4345
|
exports.removeWorkspaceMember = removeWorkspaceMember;
|
4346
|
+
exports.renameDatabase = renameDatabase;
|
2699
4347
|
exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
2700
4348
|
exports.resolveBranch = resolveBranch;
|
2701
4349
|
exports.searchBranch = searchBranch;
|
2702
4350
|
exports.searchTable = searchTable;
|
2703
4351
|
exports.serialize = serialize;
|
2704
4352
|
exports.setTableSchema = setTableSchema;
|
4353
|
+
exports.sqlQuery = sqlQuery;
|
2705
4354
|
exports.startsWith = startsWith;
|
2706
4355
|
exports.summarizeTable = summarizeTable;
|
2707
4356
|
exports.updateBranchMetadata = updateBranchMetadata;
|
2708
4357
|
exports.updateBranchSchema = updateBranchSchema;
|
2709
4358
|
exports.updateColumn = updateColumn;
|
4359
|
+
exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
|
2710
4360
|
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
2711
4361
|
exports.updateMigrationRequest = updateMigrationRequest;
|
2712
4362
|
exports.updateRecordWithID = updateRecordWithID;
|
@@ -2716,4 +4366,5 @@ exports.updateWorkspace = updateWorkspace;
|
|
2716
4366
|
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
|
2717
4367
|
exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
|
2718
4368
|
exports.upsertRecordWithID = upsertRecordWithID;
|
4369
|
+
exports.vectorSearchTable = vectorSearchTable;
|
2719
4370
|
//# sourceMappingURL=index.cjs.map
|