@xata.io/client 0.0.0-alpha.vf6f217e → 0.0.0-alpha.vf70b95a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.cjs +3 -2
- package/.turbo/turbo-add-version.log +4 -0
- package/.turbo/turbo-build.log +13 -0
- package/CHANGELOG.md +106 -0
- package/README.md +3 -269
- package/dist/index.cjs +793 -276
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2167 -1191
- package/dist/index.mjs +775 -270
- package/dist/index.mjs.map +1 -1
- package/package.json +7 -8
- package/rollup.config.mjs +28 -13
- package/Usage.md +0 -451
package/dist/index.cjs
CHANGED
@@ -93,8 +93,10 @@ function getEnvironment() {
|
|
93
93
|
apiKey: process.env.XATA_API_KEY ?? getGlobalApiKey(),
|
94
94
|
databaseURL: process.env.XATA_DATABASE_URL ?? getGlobalDatabaseURL(),
|
95
95
|
branch: process.env.XATA_BRANCH ?? getGlobalBranch(),
|
96
|
-
|
97
|
-
|
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
|
98
100
|
};
|
99
101
|
}
|
100
102
|
} catch (err) {
|
@@ -105,8 +107,10 @@ function getEnvironment() {
|
|
105
107
|
apiKey: Deno.env.get("XATA_API_KEY") ?? getGlobalApiKey(),
|
106
108
|
databaseURL: Deno.env.get("XATA_DATABASE_URL") ?? getGlobalDatabaseURL(),
|
107
109
|
branch: Deno.env.get("XATA_BRANCH") ?? getGlobalBranch(),
|
108
|
-
|
109
|
-
|
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")
|
110
114
|
};
|
111
115
|
}
|
112
116
|
} catch (err) {
|
@@ -115,8 +119,10 @@ function getEnvironment() {
|
|
115
119
|
apiKey: getGlobalApiKey(),
|
116
120
|
databaseURL: getGlobalDatabaseURL(),
|
117
121
|
branch: getGlobalBranch(),
|
118
|
-
|
119
|
-
|
122
|
+
deployPreview: void 0,
|
123
|
+
deployPreviewBranch: void 0,
|
124
|
+
vercelGitCommitRef: void 0,
|
125
|
+
vercelGitRepoOwner: void 0
|
120
126
|
};
|
121
127
|
}
|
122
128
|
function getEnableBrowserVariable() {
|
@@ -159,39 +165,48 @@ function getGlobalBranch() {
|
|
159
165
|
return void 0;
|
160
166
|
}
|
161
167
|
}
|
162
|
-
function
|
168
|
+
function getDatabaseURL() {
|
163
169
|
try {
|
164
|
-
|
170
|
+
const { databaseURL } = getEnvironment();
|
171
|
+
return databaseURL;
|
165
172
|
} catch (err) {
|
166
173
|
return void 0;
|
167
174
|
}
|
168
175
|
}
|
169
|
-
|
170
|
-
const cmd = ["git", "branch", "--show-current"];
|
171
|
-
const fullCmd = cmd.join(" ");
|
172
|
-
const nodeModule = ["child", "process"].join("_");
|
173
|
-
const execOptions = { encoding: "utf-8", stdio: ["ignore", "pipe", "ignore"] };
|
176
|
+
function getAPIKey() {
|
174
177
|
try {
|
175
|
-
|
176
|
-
|
177
|
-
}
|
178
|
-
const { execSync } = await import(nodeModule);
|
179
|
-
return execSync(fullCmd, execOptions).toString().trim();
|
178
|
+
const { apiKey } = getEnvironment();
|
179
|
+
return apiKey;
|
180
180
|
} catch (err) {
|
181
|
+
return void 0;
|
181
182
|
}
|
183
|
+
}
|
184
|
+
function getBranch() {
|
182
185
|
try {
|
183
|
-
|
184
|
-
|
185
|
-
return new TextDecoder().decode(await process2.output()).trim();
|
186
|
-
}
|
186
|
+
const { branch } = getEnvironment();
|
187
|
+
return branch ?? "main";
|
187
188
|
} catch (err) {
|
189
|
+
return void 0;
|
188
190
|
}
|
189
191
|
}
|
190
|
-
|
191
|
-
|
192
|
+
function buildPreviewBranchName({ org, branch }) {
|
193
|
+
return `preview-${org}-${branch}`;
|
194
|
+
}
|
195
|
+
function getPreviewBranch() {
|
192
196
|
try {
|
193
|
-
const {
|
194
|
-
|
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;
|
195
210
|
} catch (err) {
|
196
211
|
return void 0;
|
197
212
|
}
|
@@ -304,7 +319,180 @@ function generateUUID() {
|
|
304
319
|
});
|
305
320
|
}
|
306
321
|
|
307
|
-
|
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
|
+
}
|
494
|
+
|
495
|
+
const VERSION = "0.23.4";
|
308
496
|
|
309
497
|
class ErrorWithCause extends Error {
|
310
498
|
constructor(message, options) {
|
@@ -388,7 +576,7 @@ async function fetch$1({
|
|
388
576
|
headers: customHeaders,
|
389
577
|
pathParams,
|
390
578
|
queryParams,
|
391
|
-
|
579
|
+
fetch: fetch2,
|
392
580
|
apiKey,
|
393
581
|
endpoint,
|
394
582
|
apiUrl,
|
@@ -398,12 +586,13 @@ async function fetch$1({
|
|
398
586
|
clientID,
|
399
587
|
sessionID,
|
400
588
|
clientName,
|
589
|
+
xataAgentExtra,
|
401
590
|
fetchOptions = {}
|
402
591
|
}) {
|
403
|
-
pool.setFetch(
|
592
|
+
pool.setFetch(fetch2);
|
404
593
|
return await trace(
|
405
594
|
`${method.toUpperCase()} ${path}`,
|
406
|
-
async ({
|
595
|
+
async ({ setAttributes }) => {
|
407
596
|
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
408
597
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
409
598
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
@@ -414,7 +603,8 @@ async function fetch$1({
|
|
414
603
|
const xataAgent = compact([
|
415
604
|
["client", "TS_SDK"],
|
416
605
|
["version", VERSION],
|
417
|
-
isDefined(clientName) ? ["service", clientName] : void 0
|
606
|
+
isDefined(clientName) ? ["service", clientName] : void 0,
|
607
|
+
...Object.entries(xataAgentExtra ?? {})
|
418
608
|
]).map(([key, value]) => `${key}=${value}`).join("; ");
|
419
609
|
const headers = {
|
420
610
|
"Accept-Encoding": "identity",
|
@@ -461,6 +651,59 @@ async function fetch$1({
|
|
461
651
|
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
462
652
|
);
|
463
653
|
}
|
654
|
+
function fetchSSERequest({
|
655
|
+
url: path,
|
656
|
+
method,
|
657
|
+
body,
|
658
|
+
headers: customHeaders,
|
659
|
+
pathParams,
|
660
|
+
queryParams,
|
661
|
+
fetch: fetch2,
|
662
|
+
apiKey,
|
663
|
+
endpoint,
|
664
|
+
apiUrl,
|
665
|
+
workspacesApiUrl,
|
666
|
+
onMessage,
|
667
|
+
onError,
|
668
|
+
onClose,
|
669
|
+
signal,
|
670
|
+
clientID,
|
671
|
+
sessionID,
|
672
|
+
clientName,
|
673
|
+
xataAgentExtra
|
674
|
+
}) {
|
675
|
+
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
676
|
+
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
677
|
+
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
678
|
+
void fetchEventSource(url, {
|
679
|
+
method,
|
680
|
+
body: JSON.stringify(body),
|
681
|
+
fetch: fetch2,
|
682
|
+
signal,
|
683
|
+
headers: {
|
684
|
+
"X-Xata-Client-ID": clientID ?? defaultClientID,
|
685
|
+
"X-Xata-Session-ID": sessionID ?? generateUUID(),
|
686
|
+
"X-Xata-Agent": compact([
|
687
|
+
["client", "TS_SDK"],
|
688
|
+
["version", VERSION],
|
689
|
+
isDefined(clientName) ? ["service", clientName] : void 0,
|
690
|
+
...Object.entries(xataAgentExtra ?? {})
|
691
|
+
]).map(([key, value]) => `${key}=${value}`).join("; "),
|
692
|
+
...customHeaders,
|
693
|
+
Authorization: `Bearer ${apiKey}`,
|
694
|
+
"Content-Type": "application/json"
|
695
|
+
},
|
696
|
+
onmessage(ev) {
|
697
|
+
onMessage?.(JSON.parse(ev.data));
|
698
|
+
},
|
699
|
+
onerror(ev) {
|
700
|
+
onError?.(JSON.parse(ev.data));
|
701
|
+
},
|
702
|
+
onclose() {
|
703
|
+
onClose?.();
|
704
|
+
}
|
705
|
+
});
|
706
|
+
}
|
464
707
|
function parseUrl(url) {
|
465
708
|
try {
|
466
709
|
const { host, protocol } = new URL(url);
|
@@ -472,17 +715,12 @@ function parseUrl(url) {
|
|
472
715
|
|
473
716
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
474
717
|
|
475
|
-
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
476
718
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
477
719
|
url: "/dbs/{dbName}",
|
478
720
|
method: "get",
|
479
721
|
...variables,
|
480
722
|
signal
|
481
723
|
});
|
482
|
-
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
483
|
-
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
484
|
-
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
485
|
-
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
486
724
|
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
487
725
|
url: "/db/{dbBranchName}",
|
488
726
|
method: "get",
|
@@ -496,6 +734,12 @@ const deleteBranch = (variables, signal) => dataPlaneFetch({
|
|
496
734
|
...variables,
|
497
735
|
signal
|
498
736
|
});
|
737
|
+
const copyBranch = (variables, signal) => dataPlaneFetch({
|
738
|
+
url: "/db/{dbBranchName}/copy",
|
739
|
+
method: "post",
|
740
|
+
...variables,
|
741
|
+
signal
|
742
|
+
});
|
499
743
|
const updateBranchMetadata = (variables, signal) => dataPlaneFetch({
|
500
744
|
url: "/db/{dbBranchName}/metadata",
|
501
745
|
method: "put",
|
@@ -521,7 +765,6 @@ const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName
|
|
521
765
|
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
522
766
|
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
523
767
|
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
524
|
-
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
525
768
|
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
526
769
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
527
770
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
@@ -546,6 +789,7 @@ const compareBranchSchemas = (variables, signal) => dataPlaneFetch({ url: "/db/{
|
|
546
789
|
const updateBranchSchema = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/update", method: "post", ...variables, signal });
|
547
790
|
const previewBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables, signal });
|
548
791
|
const applyBranchSchemaEdit = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables, signal });
|
792
|
+
const pushBranchMigrations = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/schema/push", method: "post", ...variables, signal });
|
549
793
|
const createTable = (variables, signal) => dataPlaneFetch({
|
550
794
|
url: "/db/{dbBranchName}/tables/{tableName}",
|
551
795
|
method: "put",
|
@@ -588,7 +832,38 @@ const deleteColumn = (variables, signal) => dataPlaneFetch({
|
|
588
832
|
...variables,
|
589
833
|
signal
|
590
834
|
});
|
835
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
591
836
|
const insertRecord = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/data", method: "post", ...variables, signal });
|
837
|
+
const getFileItem = (variables, signal) => dataPlaneFetch({
|
838
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
839
|
+
method: "get",
|
840
|
+
...variables,
|
841
|
+
signal
|
842
|
+
});
|
843
|
+
const putFileItem = (variables, signal) => dataPlaneFetch({
|
844
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
845
|
+
method: "put",
|
846
|
+
...variables,
|
847
|
+
signal
|
848
|
+
});
|
849
|
+
const deleteFileItem = (variables, signal) => dataPlaneFetch({
|
850
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}",
|
851
|
+
method: "delete",
|
852
|
+
...variables,
|
853
|
+
signal
|
854
|
+
});
|
855
|
+
const getFile = (variables, signal) => dataPlaneFetch({
|
856
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
857
|
+
method: "get",
|
858
|
+
...variables,
|
859
|
+
signal
|
860
|
+
});
|
861
|
+
const putFile = (variables, signal) => dataPlaneFetch({
|
862
|
+
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
863
|
+
method: "put",
|
864
|
+
...variables,
|
865
|
+
signal
|
866
|
+
});
|
592
867
|
const getRecord = (variables, signal) => dataPlaneFetch({
|
593
868
|
url: "/db/{dbBranchName}/tables/{tableName}/data/{recordId}",
|
594
869
|
method: "get",
|
@@ -618,21 +893,28 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
618
893
|
...variables,
|
619
894
|
signal
|
620
895
|
});
|
896
|
+
const sqlQuery = (variables, signal) => dataPlaneFetch({
|
897
|
+
url: "/db/{dbBranchName}/sql",
|
898
|
+
method: "post",
|
899
|
+
...variables,
|
900
|
+
signal
|
901
|
+
});
|
902
|
+
const vectorSearchTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/vectorSearch", method: "post", ...variables, signal });
|
903
|
+
const askTable = (variables, signal) => dataPlaneFetch({
|
904
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
905
|
+
method: "post",
|
906
|
+
...variables,
|
907
|
+
signal
|
908
|
+
});
|
621
909
|
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
622
910
|
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
623
911
|
const operationsByTag$2 = {
|
624
|
-
database: {
|
625
|
-
dEPRECATEDgetDatabaseList,
|
626
|
-
dEPRECATEDcreateDatabase,
|
627
|
-
dEPRECATEDdeleteDatabase,
|
628
|
-
dEPRECATEDgetDatabaseMetadata,
|
629
|
-
dEPRECATEDupdateDatabaseMetadata
|
630
|
-
},
|
631
912
|
branch: {
|
632
913
|
getBranchList,
|
633
914
|
getBranchDetails,
|
634
915
|
createBranch,
|
635
916
|
deleteBranch,
|
917
|
+
copyBranch,
|
636
918
|
updateBranchMetadata,
|
637
919
|
getBranchMetadata,
|
638
920
|
getBranchStats,
|
@@ -650,17 +932,8 @@ const operationsByTag$2 = {
|
|
650
932
|
compareBranchSchemas,
|
651
933
|
updateBranchSchema,
|
652
934
|
previewBranchSchemaEdit,
|
653
|
-
applyBranchSchemaEdit
|
654
|
-
|
655
|
-
records: {
|
656
|
-
branchTransaction,
|
657
|
-
insertRecord,
|
658
|
-
getRecord,
|
659
|
-
insertRecordWithID,
|
660
|
-
updateRecordWithID,
|
661
|
-
upsertRecordWithID,
|
662
|
-
deleteRecord,
|
663
|
-
bulkInsertTableRecords
|
935
|
+
applyBranchSchemaEdit,
|
936
|
+
pushBranchMigrations
|
664
937
|
},
|
665
938
|
migrationRequests: {
|
666
939
|
queryMigrationRequests,
|
@@ -684,7 +957,27 @@ const operationsByTag$2 = {
|
|
684
957
|
updateColumn,
|
685
958
|
deleteColumn
|
686
959
|
},
|
687
|
-
|
960
|
+
records: {
|
961
|
+
branchTransaction,
|
962
|
+
insertRecord,
|
963
|
+
getRecord,
|
964
|
+
insertRecordWithID,
|
965
|
+
updateRecordWithID,
|
966
|
+
upsertRecordWithID,
|
967
|
+
deleteRecord,
|
968
|
+
bulkInsertTableRecords
|
969
|
+
},
|
970
|
+
files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile },
|
971
|
+
searchAndFilter: {
|
972
|
+
queryTable,
|
973
|
+
searchBranch,
|
974
|
+
searchTable,
|
975
|
+
sqlQuery,
|
976
|
+
vectorSearchTable,
|
977
|
+
askTable,
|
978
|
+
summarizeTable,
|
979
|
+
aggregateTable
|
980
|
+
}
|
688
981
|
};
|
689
982
|
|
690
983
|
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
@@ -783,6 +1076,10 @@ const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
|
783
1076
|
});
|
784
1077
|
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
785
1078
|
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
1079
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/rename", method: "post", ...variables, signal });
|
1080
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "get", ...variables, signal });
|
1081
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "put", ...variables, signal });
|
1082
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "delete", ...variables, signal });
|
786
1083
|
const listRegions = (variables, signal) => controlPlaneFetch({
|
787
1084
|
url: "/workspaces/{workspaceId}/regions",
|
788
1085
|
method: "get",
|
@@ -815,6 +1112,10 @@ const operationsByTag$1 = {
|
|
815
1112
|
deleteDatabase,
|
816
1113
|
getDatabaseMetadata,
|
817
1114
|
updateDatabaseMetadata,
|
1115
|
+
renameDatabase,
|
1116
|
+
getDatabaseGithubSettings,
|
1117
|
+
updateDatabaseGithubSettings,
|
1118
|
+
deleteDatabaseGithubSettings,
|
818
1119
|
listRegions
|
819
1120
|
}
|
820
1121
|
};
|
@@ -835,8 +1136,12 @@ const providers = {
|
|
835
1136
|
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
836
1137
|
},
|
837
1138
|
staging: {
|
838
|
-
main: "https://staging.
|
839
|
-
workspaces: "https://{workspaceId}.
|
1139
|
+
main: "https://api.staging-xata.dev",
|
1140
|
+
workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
|
1141
|
+
},
|
1142
|
+
dev: {
|
1143
|
+
main: "https://api.dev-xata.dev",
|
1144
|
+
workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
|
840
1145
|
}
|
841
1146
|
};
|
842
1147
|
function isHostProviderAlias(alias) {
|
@@ -854,12 +1159,19 @@ function parseProviderString(provider = "production") {
|
|
854
1159
|
return null;
|
855
1160
|
return { main, workspaces };
|
856
1161
|
}
|
1162
|
+
function buildProviderString(provider) {
|
1163
|
+
if (isHostProviderAlias(provider))
|
1164
|
+
return provider;
|
1165
|
+
return `${provider.main},${provider.workspaces}`;
|
1166
|
+
}
|
857
1167
|
function parseWorkspacesUrlParts(url) {
|
858
1168
|
if (!isString(url))
|
859
1169
|
return null;
|
860
1170
|
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
|
861
|
-
const
|
862
|
-
const
|
1171
|
+
const regexDev = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/;
|
1172
|
+
const regexStaging = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/;
|
1173
|
+
const regexProdTesting = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.tech.*/;
|
1174
|
+
const match = url.match(regex) || url.match(regexDev) || url.match(regexStaging) || url.match(regexProdTesting);
|
863
1175
|
if (!match)
|
864
1176
|
return null;
|
865
1177
|
return { workspace: match[1], region: match[2] };
|
@@ -898,10 +1210,11 @@ class XataApiClient {
|
|
898
1210
|
__privateSet$7(this, _extraProps, {
|
899
1211
|
apiUrl: getHostUrl(provider, "main"),
|
900
1212
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
901
|
-
|
1213
|
+
fetch: getFetchImplementation(options.fetch),
|
902
1214
|
apiKey,
|
903
1215
|
trace,
|
904
1216
|
clientName: options.clientName,
|
1217
|
+
xataAgentExtra: options.xataAgentExtra,
|
905
1218
|
clientID
|
906
1219
|
});
|
907
1220
|
}
|
@@ -955,6 +1268,11 @@ class XataApiClient {
|
|
955
1268
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
956
1269
|
return __privateGet$7(this, _namespaces).records;
|
957
1270
|
}
|
1271
|
+
get files() {
|
1272
|
+
if (!__privateGet$7(this, _namespaces).files)
|
1273
|
+
__privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
|
1274
|
+
return __privateGet$7(this, _namespaces).files;
|
1275
|
+
}
|
958
1276
|
get searchAndFilter() {
|
959
1277
|
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
960
1278
|
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
@@ -1163,6 +1481,20 @@ class BranchApi {
|
|
1163
1481
|
...this.extraProps
|
1164
1482
|
});
|
1165
1483
|
}
|
1484
|
+
copyBranch({
|
1485
|
+
workspace,
|
1486
|
+
region,
|
1487
|
+
database,
|
1488
|
+
branch,
|
1489
|
+
destinationBranch,
|
1490
|
+
limit
|
1491
|
+
}) {
|
1492
|
+
return operationsByTag.branch.copyBranch({
|
1493
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1494
|
+
body: { destinationBranch, limit },
|
1495
|
+
...this.extraProps
|
1496
|
+
});
|
1497
|
+
}
|
1166
1498
|
updateBranchMetadata({
|
1167
1499
|
workspace,
|
1168
1500
|
region,
|
@@ -1518,6 +1850,126 @@ class RecordsApi {
|
|
1518
1850
|
});
|
1519
1851
|
}
|
1520
1852
|
}
|
1853
|
+
class FilesApi {
|
1854
|
+
constructor(extraProps) {
|
1855
|
+
this.extraProps = extraProps;
|
1856
|
+
}
|
1857
|
+
getFileItem({
|
1858
|
+
workspace,
|
1859
|
+
region,
|
1860
|
+
database,
|
1861
|
+
branch,
|
1862
|
+
table,
|
1863
|
+
record,
|
1864
|
+
column,
|
1865
|
+
fileId
|
1866
|
+
}) {
|
1867
|
+
return operationsByTag.files.getFileItem({
|
1868
|
+
pathParams: {
|
1869
|
+
workspace,
|
1870
|
+
region,
|
1871
|
+
dbBranchName: `${database}:${branch}`,
|
1872
|
+
tableName: table,
|
1873
|
+
recordId: record,
|
1874
|
+
columnName: column,
|
1875
|
+
fileId
|
1876
|
+
},
|
1877
|
+
...this.extraProps
|
1878
|
+
});
|
1879
|
+
}
|
1880
|
+
putFileItem({
|
1881
|
+
workspace,
|
1882
|
+
region,
|
1883
|
+
database,
|
1884
|
+
branch,
|
1885
|
+
table,
|
1886
|
+
record,
|
1887
|
+
column,
|
1888
|
+
fileId,
|
1889
|
+
file
|
1890
|
+
}) {
|
1891
|
+
return operationsByTag.files.putFileItem({
|
1892
|
+
pathParams: {
|
1893
|
+
workspace,
|
1894
|
+
region,
|
1895
|
+
dbBranchName: `${database}:${branch}`,
|
1896
|
+
tableName: table,
|
1897
|
+
recordId: record,
|
1898
|
+
columnName: column,
|
1899
|
+
fileId
|
1900
|
+
},
|
1901
|
+
body: file,
|
1902
|
+
...this.extraProps
|
1903
|
+
});
|
1904
|
+
}
|
1905
|
+
deleteFileItem({
|
1906
|
+
workspace,
|
1907
|
+
region,
|
1908
|
+
database,
|
1909
|
+
branch,
|
1910
|
+
table,
|
1911
|
+
record,
|
1912
|
+
column,
|
1913
|
+
fileId
|
1914
|
+
}) {
|
1915
|
+
return operationsByTag.files.deleteFileItem({
|
1916
|
+
pathParams: {
|
1917
|
+
workspace,
|
1918
|
+
region,
|
1919
|
+
dbBranchName: `${database}:${branch}`,
|
1920
|
+
tableName: table,
|
1921
|
+
recordId: record,
|
1922
|
+
columnName: column,
|
1923
|
+
fileId
|
1924
|
+
},
|
1925
|
+
...this.extraProps
|
1926
|
+
});
|
1927
|
+
}
|
1928
|
+
getFile({
|
1929
|
+
workspace,
|
1930
|
+
region,
|
1931
|
+
database,
|
1932
|
+
branch,
|
1933
|
+
table,
|
1934
|
+
record,
|
1935
|
+
column
|
1936
|
+
}) {
|
1937
|
+
return operationsByTag.files.getFile({
|
1938
|
+
pathParams: {
|
1939
|
+
workspace,
|
1940
|
+
region,
|
1941
|
+
dbBranchName: `${database}:${branch}`,
|
1942
|
+
tableName: table,
|
1943
|
+
recordId: record,
|
1944
|
+
columnName: column
|
1945
|
+
},
|
1946
|
+
...this.extraProps
|
1947
|
+
});
|
1948
|
+
}
|
1949
|
+
putFile({
|
1950
|
+
workspace,
|
1951
|
+
region,
|
1952
|
+
database,
|
1953
|
+
branch,
|
1954
|
+
table,
|
1955
|
+
record,
|
1956
|
+
column,
|
1957
|
+
file
|
1958
|
+
}) {
|
1959
|
+
return operationsByTag.files.putFile({
|
1960
|
+
pathParams: {
|
1961
|
+
workspace,
|
1962
|
+
region,
|
1963
|
+
dbBranchName: `${database}:${branch}`,
|
1964
|
+
tableName: table,
|
1965
|
+
recordId: record,
|
1966
|
+
columnName: column
|
1967
|
+
},
|
1968
|
+
body: file,
|
1969
|
+
...this.extraProps
|
1970
|
+
});
|
1971
|
+
}
|
1972
|
+
}
|
1521
1973
|
class SearchAndFilterApi {
|
1522
1974
|
constructor(extraProps) {
|
1523
1975
|
this.extraProps = extraProps;
|
@@ -1577,6 +2029,38 @@ class SearchAndFilterApi {
|
|
1577
2029
|
...this.extraProps
|
1578
2030
|
});
|
1579
2031
|
}
|
2032
|
+
vectorSearchTable({
|
2033
|
+
workspace,
|
2034
|
+
region,
|
2035
|
+
database,
|
2036
|
+
branch,
|
2037
|
+
table,
|
2038
|
+
queryVector,
|
2039
|
+
column,
|
2040
|
+
similarityFunction,
|
2041
|
+
size,
|
2042
|
+
filter
|
2043
|
+
}) {
|
2044
|
+
return operationsByTag.searchAndFilter.vectorSearchTable({
|
2045
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2046
|
+
body: { queryVector, column, similarityFunction, size, filter },
|
2047
|
+
...this.extraProps
|
2048
|
+
});
|
2049
|
+
}
|
2050
|
+
askTable({
|
2051
|
+
workspace,
|
2052
|
+
region,
|
2053
|
+
database,
|
2054
|
+
branch,
|
2055
|
+
table,
|
2056
|
+
options
|
2057
|
+
}) {
|
2058
|
+
return operationsByTag.searchAndFilter.askTable({
|
2059
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2060
|
+
body: { ...options },
|
2061
|
+
...this.extraProps
|
2062
|
+
});
|
2063
|
+
}
|
1580
2064
|
summarizeTable({
|
1581
2065
|
workspace,
|
1582
2066
|
region,
|
@@ -1777,11 +2261,13 @@ class MigrationsApi {
|
|
1777
2261
|
region,
|
1778
2262
|
database,
|
1779
2263
|
branch,
|
1780
|
-
schema
|
2264
|
+
schema,
|
2265
|
+
schemaOperations,
|
2266
|
+
branchOperations
|
1781
2267
|
}) {
|
1782
2268
|
return operationsByTag.migrations.compareBranchWithUserSchema({
|
1783
2269
|
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1784
|
-
body: { schema },
|
2270
|
+
body: { schema, schemaOperations, branchOperations },
|
1785
2271
|
...this.extraProps
|
1786
2272
|
});
|
1787
2273
|
}
|
@@ -1791,11 +2277,12 @@ class MigrationsApi {
|
|
1791
2277
|
database,
|
1792
2278
|
branch,
|
1793
2279
|
compare,
|
1794
|
-
|
2280
|
+
sourceBranchOperations,
|
2281
|
+
targetBranchOperations
|
1795
2282
|
}) {
|
1796
2283
|
return operationsByTag.migrations.compareBranchSchemas({
|
1797
2284
|
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
1798
|
-
body: {
|
2285
|
+
body: { sourceBranchOperations, targetBranchOperations },
|
1799
2286
|
...this.extraProps
|
1800
2287
|
});
|
1801
2288
|
}
|
@@ -1838,6 +2325,19 @@ class MigrationsApi {
|
|
1838
2325
|
...this.extraProps
|
1839
2326
|
});
|
1840
2327
|
}
|
2328
|
+
pushBranchMigrations({
|
2329
|
+
workspace,
|
2330
|
+
region,
|
2331
|
+
database,
|
2332
|
+
branch,
|
2333
|
+
migrations
|
2334
|
+
}) {
|
2335
|
+
return operationsByTag.migrations.pushBranchMigrations({
|
2336
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2337
|
+
body: { migrations },
|
2338
|
+
...this.extraProps
|
2339
|
+
});
|
2340
|
+
}
|
1841
2341
|
}
|
1842
2342
|
class DatabaseApi {
|
1843
2343
|
constructor(extraProps) {
|
@@ -1889,6 +2389,46 @@ class DatabaseApi {
|
|
1889
2389
|
...this.extraProps
|
1890
2390
|
});
|
1891
2391
|
}
|
2392
|
+
renameDatabase({
|
2393
|
+
workspace,
|
2394
|
+
database,
|
2395
|
+
newName
|
2396
|
+
}) {
|
2397
|
+
return operationsByTag.databases.renameDatabase({
|
2398
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2399
|
+
body: { newName },
|
2400
|
+
...this.extraProps
|
2401
|
+
});
|
2402
|
+
}
|
2403
|
+
getDatabaseGithubSettings({
|
2404
|
+
workspace,
|
2405
|
+
database
|
2406
|
+
}) {
|
2407
|
+
return operationsByTag.databases.getDatabaseGithubSettings({
|
2408
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2409
|
+
...this.extraProps
|
2410
|
+
});
|
2411
|
+
}
|
2412
|
+
updateDatabaseGithubSettings({
|
2413
|
+
workspace,
|
2414
|
+
database,
|
2415
|
+
settings
|
2416
|
+
}) {
|
2417
|
+
return operationsByTag.databases.updateDatabaseGithubSettings({
|
2418
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2419
|
+
body: settings,
|
2420
|
+
...this.extraProps
|
2421
|
+
});
|
2422
|
+
}
|
2423
|
+
deleteDatabaseGithubSettings({
|
2424
|
+
workspace,
|
2425
|
+
database
|
2426
|
+
}) {
|
2427
|
+
return operationsByTag.databases.deleteDatabaseGithubSettings({
|
2428
|
+
pathParams: { workspaceId: workspace, dbName: database },
|
2429
|
+
...this.extraProps
|
2430
|
+
});
|
2431
|
+
}
|
1892
2432
|
listRegions({ workspace }) {
|
1893
2433
|
return operationsByTag.databases.listRegions({
|
1894
2434
|
pathParams: { workspaceId: workspace },
|
@@ -1898,9 +2438,8 @@ class DatabaseApi {
|
|
1898
2438
|
}
|
1899
2439
|
|
1900
2440
|
class XataApiPlugin {
|
1901
|
-
|
1902
|
-
|
1903
|
-
return new XataApiClient({ fetch: fetchImpl, apiKey });
|
2441
|
+
build(options) {
|
2442
|
+
return new XataApiClient(options);
|
1904
2443
|
}
|
1905
2444
|
}
|
1906
2445
|
|
@@ -1983,6 +2522,12 @@ const _RecordArray = class extends Array {
|
|
1983
2522
|
toArray() {
|
1984
2523
|
return new Array(...this);
|
1985
2524
|
}
|
2525
|
+
toSerializable() {
|
2526
|
+
return JSON.parse(this.toString());
|
2527
|
+
}
|
2528
|
+
toString() {
|
2529
|
+
return JSON.stringify(this.toArray());
|
2530
|
+
}
|
1986
2531
|
map(callbackfn, thisArg) {
|
1987
2532
|
return this.toArray().map(callbackfn, thisArg);
|
1988
2533
|
}
|
@@ -2235,7 +2780,11 @@ function isSortFilterString(value) {
|
|
2235
2780
|
return isString(value);
|
2236
2781
|
}
|
2237
2782
|
function isSortFilterBase(filter) {
|
2238
|
-
return isObject(filter) && Object.
|
2783
|
+
return isObject(filter) && Object.entries(filter).every(([key, value]) => {
|
2784
|
+
if (key === "*")
|
2785
|
+
return value === "random";
|
2786
|
+
return value === "asc" || value === "desc";
|
2787
|
+
});
|
2239
2788
|
}
|
2240
2789
|
function isSortFilterObject(filter) {
|
2241
2790
|
return isObject(filter) && !isSortFilterBase(filter) && filter.column !== void 0;
|
@@ -2308,10 +2857,7 @@ class RestRepository extends Query {
|
|
2308
2857
|
__privateSet$4(this, _db, options.db);
|
2309
2858
|
__privateSet$4(this, _cache, options.pluginOptions.cache);
|
2310
2859
|
__privateSet$4(this, _schemaTables$2, options.schemaTables);
|
2311
|
-
__privateSet$4(this, _getFetchProps,
|
2312
|
-
const props = await options.pluginOptions.getFetchProps();
|
2313
|
-
return { ...props, sessionID: generateUUID() };
|
2314
|
-
});
|
2860
|
+
__privateSet$4(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
|
2315
2861
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
2316
2862
|
__privateSet$4(this, _trace, async (name, fn, options2 = {}) => {
|
2317
2863
|
return trace(name, fn, {
|
@@ -2368,7 +2914,6 @@ class RestRepository extends Query {
|
|
2368
2914
|
}
|
2369
2915
|
const id = extractId(a);
|
2370
2916
|
if (id) {
|
2371
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2372
2917
|
try {
|
2373
2918
|
const response = await getRecord({
|
2374
2919
|
pathParams: {
|
@@ -2379,7 +2924,7 @@ class RestRepository extends Query {
|
|
2379
2924
|
recordId: id
|
2380
2925
|
},
|
2381
2926
|
queryParams: { columns },
|
2382
|
-
...
|
2927
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2383
2928
|
});
|
2384
2929
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2385
2930
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
@@ -2557,7 +3102,6 @@ class RestRepository extends Query {
|
|
2557
3102
|
}
|
2558
3103
|
async search(query, options = {}) {
|
2559
3104
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
2560
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2561
3105
|
const { records } = await searchTable({
|
2562
3106
|
pathParams: {
|
2563
3107
|
workspace: "{workspaceId}",
|
@@ -2575,7 +3119,29 @@ class RestRepository extends Query {
|
|
2575
3119
|
page: options.page,
|
2576
3120
|
target: options.target
|
2577
3121
|
},
|
2578
|
-
...
|
3122
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3123
|
+
});
|
3124
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
3125
|
+
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
3126
|
+
});
|
3127
|
+
}
|
3128
|
+
async vectorSearch(column, query, options) {
|
3129
|
+
return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
|
3130
|
+
const { records } = await vectorSearchTable({
|
3131
|
+
pathParams: {
|
3132
|
+
workspace: "{workspaceId}",
|
3133
|
+
dbBranchName: "{dbBranch}",
|
3134
|
+
region: "{region}",
|
3135
|
+
tableName: __privateGet$4(this, _table)
|
3136
|
+
},
|
3137
|
+
body: {
|
3138
|
+
column,
|
3139
|
+
queryVector: query,
|
3140
|
+
similarityFunction: options?.similarityFunction,
|
3141
|
+
size: options?.size,
|
3142
|
+
filter: options?.filter
|
3143
|
+
},
|
3144
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2579
3145
|
});
|
2580
3146
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2581
3147
|
return records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"]));
|
@@ -2583,7 +3149,6 @@ class RestRepository extends Query {
|
|
2583
3149
|
}
|
2584
3150
|
async aggregate(aggs, filter) {
|
2585
3151
|
return __privateGet$4(this, _trace).call(this, "aggregate", async () => {
|
2586
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2587
3152
|
const result = await aggregateTable({
|
2588
3153
|
pathParams: {
|
2589
3154
|
workspace: "{workspaceId}",
|
@@ -2592,7 +3157,7 @@ class RestRepository extends Query {
|
|
2592
3157
|
tableName: __privateGet$4(this, _table)
|
2593
3158
|
},
|
2594
3159
|
body: { aggs, filter },
|
2595
|
-
...
|
3160
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2596
3161
|
});
|
2597
3162
|
return result;
|
2598
3163
|
});
|
@@ -2603,7 +3168,6 @@ class RestRepository extends Query {
|
|
2603
3168
|
if (cacheQuery)
|
2604
3169
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
2605
3170
|
const data = query.getQueryOptions();
|
2606
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2607
3171
|
const { meta, records: objects } = await queryTable({
|
2608
3172
|
pathParams: {
|
2609
3173
|
workspace: "{workspaceId}",
|
@@ -2619,7 +3183,7 @@ class RestRepository extends Query {
|
|
2619
3183
|
consistency: data.consistency
|
2620
3184
|
},
|
2621
3185
|
fetchOptions: data.fetchOptions,
|
2622
|
-
...
|
3186
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2623
3187
|
});
|
2624
3188
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2625
3189
|
const records = objects.map(
|
@@ -2632,7 +3196,6 @@ class RestRepository extends Query {
|
|
2632
3196
|
async summarizeTable(query, summaries, summariesFilter) {
|
2633
3197
|
return __privateGet$4(this, _trace).call(this, "summarize", async () => {
|
2634
3198
|
const data = query.getQueryOptions();
|
2635
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2636
3199
|
const result = await summarizeTable({
|
2637
3200
|
pathParams: {
|
2638
3201
|
workspace: "{workspaceId}",
|
@@ -2649,11 +3212,39 @@ class RestRepository extends Query {
|
|
2649
3212
|
summaries,
|
2650
3213
|
summariesFilter
|
2651
3214
|
},
|
2652
|
-
...
|
3215
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2653
3216
|
});
|
2654
3217
|
return result;
|
2655
3218
|
});
|
2656
3219
|
}
|
3220
|
+
ask(question, options) {
|
3221
|
+
const params = {
|
3222
|
+
pathParams: {
|
3223
|
+
workspace: "{workspaceId}",
|
3224
|
+
dbBranchName: "{dbBranch}",
|
3225
|
+
region: "{region}",
|
3226
|
+
tableName: __privateGet$4(this, _table)
|
3227
|
+
},
|
3228
|
+
body: {
|
3229
|
+
question,
|
3230
|
+
...options
|
3231
|
+
},
|
3232
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
3233
|
+
};
|
3234
|
+
if (options?.onMessage) {
|
3235
|
+
fetchSSERequest({
|
3236
|
+
endpoint: "dataPlane",
|
3237
|
+
url: "/db/{dbBranchName}/tables/{tableName}/ask",
|
3238
|
+
method: "POST",
|
3239
|
+
onMessage: (message) => {
|
3240
|
+
options.onMessage?.({ answer: message.text, records: message.records });
|
3241
|
+
},
|
3242
|
+
...params
|
3243
|
+
});
|
3244
|
+
} else {
|
3245
|
+
return askTable(params);
|
3246
|
+
}
|
3247
|
+
}
|
2657
3248
|
}
|
2658
3249
|
_table = new WeakMap();
|
2659
3250
|
_getFetchProps = new WeakMap();
|
@@ -2663,7 +3254,6 @@ _schemaTables$2 = new WeakMap();
|
|
2663
3254
|
_trace = new WeakMap();
|
2664
3255
|
_insertRecordWithoutId = new WeakSet();
|
2665
3256
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
2666
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2667
3257
|
const record = transformObjectLinks(object);
|
2668
3258
|
const response = await insertRecord({
|
2669
3259
|
pathParams: {
|
@@ -2674,14 +3264,13 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
2674
3264
|
},
|
2675
3265
|
queryParams: { columns },
|
2676
3266
|
body: record,
|
2677
|
-
...
|
3267
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2678
3268
|
});
|
2679
3269
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2680
3270
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2681
3271
|
};
|
2682
3272
|
_insertRecordWithId = new WeakSet();
|
2683
3273
|
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
2684
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2685
3274
|
const record = transformObjectLinks(object);
|
2686
3275
|
const response = await insertRecordWithID({
|
2687
3276
|
pathParams: {
|
@@ -2693,14 +3282,13 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
|
|
2693
3282
|
},
|
2694
3283
|
body: record,
|
2695
3284
|
queryParams: { createOnly, columns, ifVersion },
|
2696
|
-
...
|
3285
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2697
3286
|
});
|
2698
3287
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2699
3288
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2700
3289
|
};
|
2701
3290
|
_insertRecords = new WeakSet();
|
2702
3291
|
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
2703
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2704
3292
|
const chunkedOperations = chunk(
|
2705
3293
|
objects.map((object) => ({
|
2706
3294
|
insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
|
@@ -2716,7 +3304,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
2716
3304
|
region: "{region}"
|
2717
3305
|
},
|
2718
3306
|
body: { operations },
|
2719
|
-
...
|
3307
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2720
3308
|
});
|
2721
3309
|
for (const result of results) {
|
2722
3310
|
if (result.operation === "insert") {
|
@@ -2730,7 +3318,6 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
2730
3318
|
};
|
2731
3319
|
_updateRecordWithID = new WeakSet();
|
2732
3320
|
updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
2733
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2734
3321
|
const { id: _id, ...record } = transformObjectLinks(object);
|
2735
3322
|
try {
|
2736
3323
|
const response = await updateRecordWithID({
|
@@ -2743,7 +3330,7 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
2743
3330
|
},
|
2744
3331
|
queryParams: { columns, ifVersion },
|
2745
3332
|
body: record,
|
2746
|
-
...
|
3333
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2747
3334
|
});
|
2748
3335
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2749
3336
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
@@ -2756,7 +3343,6 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
2756
3343
|
};
|
2757
3344
|
_updateRecords = new WeakSet();
|
2758
3345
|
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
2759
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2760
3346
|
const chunkedOperations = chunk(
|
2761
3347
|
objects.map(({ id, ...object }) => ({
|
2762
3348
|
update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
|
@@ -2772,7 +3358,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
2772
3358
|
region: "{region}"
|
2773
3359
|
},
|
2774
3360
|
body: { operations },
|
2775
|
-
...
|
3361
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2776
3362
|
});
|
2777
3363
|
for (const result of results) {
|
2778
3364
|
if (result.operation === "update") {
|
@@ -2786,7 +3372,6 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
2786
3372
|
};
|
2787
3373
|
_upsertRecordWithID = new WeakSet();
|
2788
3374
|
upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
|
2789
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2790
3375
|
const response = await upsertRecordWithID({
|
2791
3376
|
pathParams: {
|
2792
3377
|
workspace: "{workspaceId}",
|
@@ -2797,14 +3382,13 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
2797
3382
|
},
|
2798
3383
|
queryParams: { columns, ifVersion },
|
2799
3384
|
body: object,
|
2800
|
-
...
|
3385
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2801
3386
|
});
|
2802
3387
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2803
3388
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
2804
3389
|
};
|
2805
3390
|
_deleteRecord = new WeakSet();
|
2806
3391
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
2807
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2808
3392
|
try {
|
2809
3393
|
const response = await deleteRecord({
|
2810
3394
|
pathParams: {
|
@@ -2815,7 +3399,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
2815
3399
|
recordId
|
2816
3400
|
},
|
2817
3401
|
queryParams: { columns },
|
2818
|
-
...
|
3402
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2819
3403
|
});
|
2820
3404
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
2821
3405
|
return initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), response, columns);
|
@@ -2828,7 +3412,6 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
2828
3412
|
};
|
2829
3413
|
_deleteRecords = new WeakSet();
|
2830
3414
|
deleteRecords_fn = async function(recordIds) {
|
2831
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2832
3415
|
const chunkedOperations = chunk(
|
2833
3416
|
recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
|
2834
3417
|
BULK_OPERATION_MAX_SIZE
|
@@ -2841,21 +3424,22 @@ deleteRecords_fn = async function(recordIds) {
|
|
2841
3424
|
region: "{region}"
|
2842
3425
|
},
|
2843
3426
|
body: { operations },
|
2844
|
-
...
|
3427
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2845
3428
|
});
|
2846
3429
|
}
|
2847
3430
|
};
|
2848
3431
|
_setCacheQuery = new WeakSet();
|
2849
3432
|
setCacheQuery_fn = async function(query, meta, records) {
|
2850
|
-
await __privateGet$4(this, _cache)
|
3433
|
+
await __privateGet$4(this, _cache)?.set(`query_${__privateGet$4(this, _table)}:${query.key()}`, { date: new Date(), meta, records });
|
2851
3434
|
};
|
2852
3435
|
_getCacheQuery = new WeakSet();
|
2853
3436
|
getCacheQuery_fn = async function(query) {
|
2854
3437
|
const key = `query_${__privateGet$4(this, _table)}:${query.key()}`;
|
2855
|
-
const result = await __privateGet$4(this, _cache)
|
3438
|
+
const result = await __privateGet$4(this, _cache)?.get(key);
|
2856
3439
|
if (!result)
|
2857
3440
|
return null;
|
2858
|
-
const
|
3441
|
+
const defaultTTL = __privateGet$4(this, _cache)?.defaultQueryTTL ?? -1;
|
3442
|
+
const { cache: ttl = defaultTTL } = query.getQueryOptions();
|
2859
3443
|
if (ttl < 0)
|
2860
3444
|
return null;
|
2861
3445
|
const hasExpired = result.date.getTime() + ttl < Date.now();
|
@@ -2865,10 +3449,9 @@ _getSchemaTables$1 = new WeakSet();
|
|
2865
3449
|
getSchemaTables_fn$1 = async function() {
|
2866
3450
|
if (__privateGet$4(this, _schemaTables$2))
|
2867
3451
|
return __privateGet$4(this, _schemaTables$2);
|
2868
|
-
const fetchProps = await __privateGet$4(this, _getFetchProps).call(this);
|
2869
3452
|
const { schema } = await getBranchDetails({
|
2870
3453
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
2871
|
-
...
|
3454
|
+
...__privateGet$4(this, _getFetchProps).call(this)
|
2872
3455
|
});
|
2873
3456
|
__privateSet$4(this, _schemaTables$2, schema.tables);
|
2874
3457
|
return schema.tables;
|
@@ -2881,23 +3464,23 @@ const transformObjectLinks = (object) => {
|
|
2881
3464
|
}, {});
|
2882
3465
|
};
|
2883
3466
|
const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
2884
|
-
const
|
3467
|
+
const data = {};
|
2885
3468
|
const { xata, ...rest } = object ?? {};
|
2886
|
-
Object.assign(
|
3469
|
+
Object.assign(data, rest);
|
2887
3470
|
const { columns } = schemaTables.find(({ name }) => name === table) ?? {};
|
2888
3471
|
if (!columns)
|
2889
3472
|
console.error(`Table ${table} not found in schema`);
|
2890
3473
|
for (const column of columns ?? []) {
|
2891
3474
|
if (!isValidColumn(selectedColumns, column))
|
2892
3475
|
continue;
|
2893
|
-
const value =
|
3476
|
+
const value = data[column.name];
|
2894
3477
|
switch (column.type) {
|
2895
3478
|
case "datetime": {
|
2896
3479
|
const date = value !== void 0 ? new Date(value) : null;
|
2897
3480
|
if (date !== null && isNaN(date.getTime())) {
|
2898
3481
|
console.error(`Failed to parse date ${value} for field ${column.name}`);
|
2899
3482
|
} else {
|
2900
|
-
|
3483
|
+
data[column.name] = date;
|
2901
3484
|
}
|
2902
3485
|
break;
|
2903
3486
|
}
|
@@ -2916,44 +3499,51 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
2916
3499
|
}
|
2917
3500
|
return acc;
|
2918
3501
|
}, []);
|
2919
|
-
|
3502
|
+
data[column.name] = initObject(db, schemaTables, linkTable, value, selectedLinkColumns);
|
2920
3503
|
} else {
|
2921
|
-
|
3504
|
+
data[column.name] = null;
|
2922
3505
|
}
|
2923
3506
|
break;
|
2924
3507
|
}
|
2925
3508
|
default:
|
2926
|
-
|
3509
|
+
data[column.name] = value ?? null;
|
2927
3510
|
if (column.notNull === true && value === null) {
|
2928
3511
|
console.error(`Parse error, column ${column.name} is non nullable and value resolves null`);
|
2929
3512
|
}
|
2930
3513
|
break;
|
2931
3514
|
}
|
2932
3515
|
}
|
2933
|
-
|
2934
|
-
|
3516
|
+
const record = { ...data };
|
3517
|
+
record.read = function(columns2) {
|
3518
|
+
return db[table].read(record["id"], columns2);
|
2935
3519
|
};
|
2936
|
-
|
3520
|
+
record.update = function(data2, b, c) {
|
2937
3521
|
const columns2 = isStringArray(b) ? b : ["*"];
|
2938
3522
|
const ifVersion = parseIfVersion(b, c);
|
2939
|
-
return db[table].update(
|
3523
|
+
return db[table].update(record["id"], data2, columns2, { ifVersion });
|
2940
3524
|
};
|
2941
|
-
|
3525
|
+
record.replace = function(data2, b, c) {
|
2942
3526
|
const columns2 = isStringArray(b) ? b : ["*"];
|
2943
3527
|
const ifVersion = parseIfVersion(b, c);
|
2944
|
-
return db[table].createOrReplace(
|
3528
|
+
return db[table].createOrReplace(record["id"], data2, columns2, { ifVersion });
|
2945
3529
|
};
|
2946
|
-
|
2947
|
-
return db[table].delete(
|
3530
|
+
record.delete = function() {
|
3531
|
+
return db[table].delete(record["id"]);
|
2948
3532
|
};
|
2949
|
-
|
3533
|
+
record.getMetadata = function() {
|
2950
3534
|
return xata;
|
2951
3535
|
};
|
2952
|
-
|
2953
|
-
|
3536
|
+
record.toSerializable = function() {
|
3537
|
+
return JSON.parse(JSON.stringify(transformObjectLinks(data)));
|
3538
|
+
};
|
3539
|
+
record.toString = function() {
|
3540
|
+
return JSON.stringify(transformObjectLinks(data));
|
3541
|
+
};
|
3542
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
|
3543
|
+
Object.defineProperty(record, prop, { enumerable: false });
|
2954
3544
|
}
|
2955
|
-
Object.freeze(
|
2956
|
-
return
|
3545
|
+
Object.freeze(record);
|
3546
|
+
return record;
|
2957
3547
|
};
|
2958
3548
|
function extractId(value) {
|
2959
3549
|
if (isString(value))
|
@@ -3137,19 +3727,19 @@ class SearchPlugin extends XataPlugin {
|
|
3137
3727
|
__privateAdd$1(this, _schemaTables, void 0);
|
3138
3728
|
__privateSet$1(this, _schemaTables, schemaTables);
|
3139
3729
|
}
|
3140
|
-
build(
|
3730
|
+
build(pluginOptions) {
|
3141
3731
|
return {
|
3142
3732
|
all: async (query, options = {}) => {
|
3143
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options,
|
3144
|
-
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this,
|
3733
|
+
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
3734
|
+
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
|
3145
3735
|
return records.map((record) => {
|
3146
3736
|
const { table = "orphan" } = record.xata;
|
3147
3737
|
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
3148
3738
|
});
|
3149
3739
|
},
|
3150
3740
|
byTable: async (query, options = {}) => {
|
3151
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options,
|
3152
|
-
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this,
|
3741
|
+
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
3742
|
+
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
|
3153
3743
|
return records.reduce((acc, record) => {
|
3154
3744
|
const { table = "orphan" } = record.xata;
|
3155
3745
|
const items = acc[table] ?? [];
|
@@ -3162,38 +3752,35 @@ class SearchPlugin extends XataPlugin {
|
|
3162
3752
|
}
|
3163
3753
|
_schemaTables = new WeakMap();
|
3164
3754
|
_search = new WeakSet();
|
3165
|
-
search_fn = async function(query, options,
|
3166
|
-
const fetchProps = await getFetchProps();
|
3755
|
+
search_fn = async function(query, options, pluginOptions) {
|
3167
3756
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
3168
3757
|
const { records } = await searchBranch({
|
3169
3758
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3170
3759
|
body: { tables, query, fuzziness, prefix, highlight, page },
|
3171
|
-
...
|
3760
|
+
...pluginOptions
|
3172
3761
|
});
|
3173
3762
|
return records;
|
3174
3763
|
};
|
3175
3764
|
_getSchemaTables = new WeakSet();
|
3176
|
-
getSchemaTables_fn = async function(
|
3765
|
+
getSchemaTables_fn = async function(pluginOptions) {
|
3177
3766
|
if (__privateGet$1(this, _schemaTables))
|
3178
3767
|
return __privateGet$1(this, _schemaTables);
|
3179
|
-
const fetchProps = await getFetchProps();
|
3180
3768
|
const { schema } = await getBranchDetails({
|
3181
3769
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3182
|
-
...
|
3770
|
+
...pluginOptions
|
3183
3771
|
});
|
3184
3772
|
__privateSet$1(this, _schemaTables, schema.tables);
|
3185
3773
|
return schema.tables;
|
3186
3774
|
};
|
3187
3775
|
|
3188
3776
|
class TransactionPlugin extends XataPlugin {
|
3189
|
-
build(
|
3777
|
+
build(pluginOptions) {
|
3190
3778
|
return {
|
3191
3779
|
run: async (operations) => {
|
3192
|
-
const fetchProps = await getFetchProps();
|
3193
3780
|
const response = await branchTransaction({
|
3194
3781
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
3195
3782
|
body: { operations },
|
3196
|
-
...
|
3783
|
+
...pluginOptions
|
3197
3784
|
});
|
3198
3785
|
return response;
|
3199
3786
|
}
|
@@ -3201,90 +3788,6 @@ class TransactionPlugin extends XataPlugin {
|
|
3201
3788
|
}
|
3202
3789
|
}
|
3203
3790
|
|
3204
|
-
const isBranchStrategyBuilder = (strategy) => {
|
3205
|
-
return typeof strategy === "function";
|
3206
|
-
};
|
3207
|
-
|
3208
|
-
async function getCurrentBranchName(options) {
|
3209
|
-
const { branch, envBranch } = getEnvironment();
|
3210
|
-
if (branch)
|
3211
|
-
return branch;
|
3212
|
-
const gitBranch = envBranch || await getGitBranch();
|
3213
|
-
return resolveXataBranch(gitBranch, options);
|
3214
|
-
}
|
3215
|
-
async function getCurrentBranchDetails(options) {
|
3216
|
-
const branch = await getCurrentBranchName(options);
|
3217
|
-
return getDatabaseBranch(branch, options);
|
3218
|
-
}
|
3219
|
-
async function resolveXataBranch(gitBranch, options) {
|
3220
|
-
const databaseURL = options?.databaseURL || getDatabaseURL();
|
3221
|
-
const apiKey = options?.apiKey || getAPIKey();
|
3222
|
-
if (!databaseURL)
|
3223
|
-
throw new Error(
|
3224
|
-
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
3225
|
-
);
|
3226
|
-
if (!apiKey)
|
3227
|
-
throw new Error(
|
3228
|
-
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
3229
|
-
);
|
3230
|
-
const [protocol, , host, , dbName] = databaseURL.split("/");
|
3231
|
-
const urlParts = parseWorkspacesUrlParts(host);
|
3232
|
-
if (!urlParts)
|
3233
|
-
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3234
|
-
const { workspace, region } = urlParts;
|
3235
|
-
const { fallbackBranch } = getEnvironment();
|
3236
|
-
const { branch } = await resolveBranch({
|
3237
|
-
apiKey,
|
3238
|
-
apiUrl: databaseURL,
|
3239
|
-
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
3240
|
-
workspacesApiUrl: `${protocol}//${host}`,
|
3241
|
-
pathParams: { dbName, workspace, region },
|
3242
|
-
queryParams: { gitBranch, fallbackBranch },
|
3243
|
-
trace: defaultTrace,
|
3244
|
-
clientName: options?.clientName
|
3245
|
-
});
|
3246
|
-
return branch;
|
3247
|
-
}
|
3248
|
-
async function getDatabaseBranch(branch, options) {
|
3249
|
-
const databaseURL = options?.databaseURL || getDatabaseURL();
|
3250
|
-
const apiKey = options?.apiKey || getAPIKey();
|
3251
|
-
if (!databaseURL)
|
3252
|
-
throw new Error(
|
3253
|
-
"A databaseURL was not defined. Either set the XATA_DATABASE_URL env variable or pass the argument explicitely"
|
3254
|
-
);
|
3255
|
-
if (!apiKey)
|
3256
|
-
throw new Error(
|
3257
|
-
"An API key was not defined. Either set the XATA_API_KEY env variable or pass the argument explicitely"
|
3258
|
-
);
|
3259
|
-
const [protocol, , host, , database] = databaseURL.split("/");
|
3260
|
-
const urlParts = parseWorkspacesUrlParts(host);
|
3261
|
-
if (!urlParts)
|
3262
|
-
throw new Error(`Unable to parse workspace and region: ${databaseURL}`);
|
3263
|
-
const { workspace, region } = urlParts;
|
3264
|
-
try {
|
3265
|
-
return await getBranchDetails({
|
3266
|
-
apiKey,
|
3267
|
-
apiUrl: databaseURL,
|
3268
|
-
fetchImpl: getFetchImplementation(options?.fetchImpl),
|
3269
|
-
workspacesApiUrl: `${protocol}//${host}`,
|
3270
|
-
pathParams: { dbBranchName: `${database}:${branch}`, workspace, region },
|
3271
|
-
trace: defaultTrace
|
3272
|
-
});
|
3273
|
-
} catch (err) {
|
3274
|
-
if (isObject(err) && err.status === 404)
|
3275
|
-
return null;
|
3276
|
-
throw err;
|
3277
|
-
}
|
3278
|
-
}
|
3279
|
-
function getDatabaseURL() {
|
3280
|
-
try {
|
3281
|
-
const { databaseURL } = getEnvironment();
|
3282
|
-
return databaseURL;
|
3283
|
-
} catch (err) {
|
3284
|
-
return void 0;
|
3285
|
-
}
|
3286
|
-
}
|
3287
|
-
|
3288
3791
|
var __accessCheck = (obj, member, msg) => {
|
3289
3792
|
if (!member.has(obj))
|
3290
3793
|
throw TypeError("Cannot " + msg);
|
@@ -3308,20 +3811,18 @@ var __privateMethod = (obj, member, method) => {
|
|
3308
3811
|
return method;
|
3309
3812
|
};
|
3310
3813
|
const buildClient = (plugins) => {
|
3311
|
-
var
|
3814
|
+
var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
|
3312
3815
|
return _a = class {
|
3313
3816
|
constructor(options = {}, schemaTables) {
|
3314
3817
|
__privateAdd(this, _parseOptions);
|
3315
3818
|
__privateAdd(this, _getFetchProps);
|
3316
|
-
__privateAdd(this, _evaluateBranch);
|
3317
|
-
__privateAdd(this, _branch, void 0);
|
3318
3819
|
__privateAdd(this, _options, void 0);
|
3319
3820
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
3320
3821
|
__privateSet(this, _options, safeOptions);
|
3321
3822
|
const pluginOptions = {
|
3322
|
-
|
3823
|
+
...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
|
3323
3824
|
cache: safeOptions.cache,
|
3324
|
-
|
3825
|
+
host: safeOptions.host
|
3325
3826
|
};
|
3326
3827
|
const db = new SchemaPlugin(schemaTables).build(pluginOptions);
|
3327
3828
|
const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
|
@@ -3332,24 +3833,17 @@ const buildClient = (plugins) => {
|
|
3332
3833
|
for (const [key, namespace] of Object.entries(plugins ?? {})) {
|
3333
3834
|
if (namespace === void 0)
|
3334
3835
|
continue;
|
3335
|
-
|
3336
|
-
if (result instanceof Promise) {
|
3337
|
-
void result.then((namespace2) => {
|
3338
|
-
this[key] = namespace2;
|
3339
|
-
});
|
3340
|
-
} else {
|
3341
|
-
this[key] = result;
|
3342
|
-
}
|
3836
|
+
this[key] = namespace.build(pluginOptions);
|
3343
3837
|
}
|
3344
3838
|
}
|
3345
3839
|
async getConfig() {
|
3346
3840
|
const databaseURL = __privateGet(this, _options).databaseURL;
|
3347
|
-
const branch =
|
3841
|
+
const branch = __privateGet(this, _options).branch;
|
3348
3842
|
return { databaseURL, branch };
|
3349
3843
|
}
|
3350
|
-
},
|
3844
|
+
}, _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
3351
3845
|
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
3352
|
-
const isBrowser = typeof window !== "undefined";
|
3846
|
+
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
3353
3847
|
if (isBrowser && !enableBrowser) {
|
3354
3848
|
throw new Error(
|
3355
3849
|
"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."
|
@@ -3361,60 +3855,71 @@ const buildClient = (plugins) => {
|
|
3361
3855
|
const cache = options?.cache ?? new SimpleCache({ defaultQueryTTL: 0 });
|
3362
3856
|
const trace = options?.trace ?? defaultTrace;
|
3363
3857
|
const clientName = options?.clientName;
|
3364
|
-
const
|
3365
|
-
|
3366
|
-
databaseURL,
|
3367
|
-
fetchImpl: options?.fetch,
|
3368
|
-
clientName: options?.clientName
|
3369
|
-
});
|
3858
|
+
const host = options?.host ?? "production";
|
3859
|
+
const xataAgentExtra = options?.xataAgentExtra;
|
3370
3860
|
if (!apiKey) {
|
3371
3861
|
throw new Error("Option apiKey is required");
|
3372
3862
|
}
|
3373
3863
|
if (!databaseURL) {
|
3374
3864
|
throw new Error("Option databaseURL is required");
|
3375
3865
|
}
|
3376
|
-
|
3377
|
-
|
3866
|
+
const envBranch = getBranch();
|
3867
|
+
const previewBranch = getPreviewBranch();
|
3868
|
+
const branch = options?.branch || previewBranch || envBranch || "main";
|
3869
|
+
if (!!previewBranch && branch !== previewBranch) {
|
3870
|
+
console.warn(
|
3871
|
+
`Ignoring preview branch ${previewBranch} because branch option was passed to the client constructor with value ${branch}`
|
3872
|
+
);
|
3873
|
+
} else if (!!envBranch && branch !== envBranch) {
|
3874
|
+
console.warn(
|
3875
|
+
`Ignoring branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
3876
|
+
);
|
3877
|
+
} else if (!!previewBranch && !!envBranch && previewBranch !== envBranch) {
|
3878
|
+
console.warn(
|
3879
|
+
`Ignoring preview branch ${previewBranch} and branch ${envBranch} because branch option was passed to the client constructor with value ${branch}`
|
3880
|
+
);
|
3881
|
+
} else if (!previewBranch && !envBranch && options?.branch === void 0) {
|
3882
|
+
console.warn(
|
3883
|
+
`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.`
|
3884
|
+
);
|
3885
|
+
}
|
3886
|
+
return {
|
3887
|
+
fetch,
|
3888
|
+
databaseURL,
|
3889
|
+
apiKey,
|
3890
|
+
branch,
|
3891
|
+
cache,
|
3892
|
+
trace,
|
3893
|
+
host,
|
3894
|
+
clientID: generateUUID(),
|
3895
|
+
enableBrowser,
|
3896
|
+
clientName,
|
3897
|
+
xataAgentExtra
|
3898
|
+
};
|
3899
|
+
}, _getFetchProps = new WeakSet(), getFetchProps_fn = function({
|
3378
3900
|
fetch,
|
3379
3901
|
apiKey,
|
3380
3902
|
databaseURL,
|
3381
3903
|
branch,
|
3382
3904
|
trace,
|
3383
3905
|
clientID,
|
3384
|
-
clientName
|
3906
|
+
clientName,
|
3907
|
+
xataAgentExtra
|
3385
3908
|
}) {
|
3386
|
-
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
3387
|
-
if (!branchValue)
|
3388
|
-
throw new Error("Unable to resolve branch value");
|
3389
3909
|
return {
|
3390
|
-
|
3910
|
+
fetch,
|
3391
3911
|
apiKey,
|
3392
3912
|
apiUrl: "",
|
3393
3913
|
workspacesApiUrl: (path, params) => {
|
3394
3914
|
const hasBranch = params.dbBranchName ?? params.branch;
|
3395
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${
|
3915
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branch}` : "");
|
3396
3916
|
return databaseURL + newPath;
|
3397
3917
|
},
|
3398
3918
|
trace,
|
3399
3919
|
clientID,
|
3400
|
-
clientName
|
3401
|
-
|
3402
|
-
}, _evaluateBranch = new WeakSet(), evaluateBranch_fn = async function(param) {
|
3403
|
-
if (__privateGet(this, _branch))
|
3404
|
-
return __privateGet(this, _branch);
|
3405
|
-
if (param === void 0)
|
3406
|
-
return void 0;
|
3407
|
-
const strategies = Array.isArray(param) ? [...param] : [param];
|
3408
|
-
const evaluateBranch = async (strategy) => {
|
3409
|
-
return isBranchStrategyBuilder(strategy) ? await strategy() : strategy;
|
3920
|
+
clientName,
|
3921
|
+
xataAgentExtra
|
3410
3922
|
};
|
3411
|
-
for await (const strategy of strategies) {
|
3412
|
-
const branch = await evaluateBranch(strategy);
|
3413
|
-
if (branch) {
|
3414
|
-
__privateSet(this, _branch, branch);
|
3415
|
-
return branch;
|
3416
|
-
}
|
3417
|
-
}
|
3418
3923
|
}, _a;
|
3419
3924
|
};
|
3420
3925
|
class BaseClient extends buildClient() {
|
@@ -3510,6 +4015,7 @@ class XataError extends Error {
|
|
3510
4015
|
}
|
3511
4016
|
|
3512
4017
|
exports.BaseClient = BaseClient;
|
4018
|
+
exports.FetcherError = FetcherError;
|
3513
4019
|
exports.Operations = operationsByTag;
|
3514
4020
|
exports.PAGINATION_DEFAULT_OFFSET = PAGINATION_DEFAULT_OFFSET;
|
3515
4021
|
exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
|
@@ -3533,8 +4039,11 @@ exports.addGitBranchesEntry = addGitBranchesEntry;
|
|
3533
4039
|
exports.addTableColumn = addTableColumn;
|
3534
4040
|
exports.aggregateTable = aggregateTable;
|
3535
4041
|
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
4042
|
+
exports.askTable = askTable;
|
3536
4043
|
exports.branchTransaction = branchTransaction;
|
3537
4044
|
exports.buildClient = buildClient;
|
4045
|
+
exports.buildPreviewBranchName = buildPreviewBranchName;
|
4046
|
+
exports.buildProviderString = buildProviderString;
|
3538
4047
|
exports.buildWorkerRunner = buildWorkerRunner;
|
3539
4048
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
3540
4049
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
@@ -3542,20 +4051,18 @@ exports.compareBranchSchemas = compareBranchSchemas;
|
|
3542
4051
|
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
3543
4052
|
exports.compareMigrationRequest = compareMigrationRequest;
|
3544
4053
|
exports.contains = contains;
|
4054
|
+
exports.copyBranch = copyBranch;
|
3545
4055
|
exports.createBranch = createBranch;
|
3546
4056
|
exports.createDatabase = createDatabase;
|
3547
4057
|
exports.createMigrationRequest = createMigrationRequest;
|
3548
4058
|
exports.createTable = createTable;
|
3549
4059
|
exports.createUserAPIKey = createUserAPIKey;
|
3550
4060
|
exports.createWorkspace = createWorkspace;
|
3551
|
-
exports.dEPRECATEDcreateDatabase = dEPRECATEDcreateDatabase;
|
3552
|
-
exports.dEPRECATEDdeleteDatabase = dEPRECATEDdeleteDatabase;
|
3553
|
-
exports.dEPRECATEDgetDatabaseList = dEPRECATEDgetDatabaseList;
|
3554
|
-
exports.dEPRECATEDgetDatabaseMetadata = dEPRECATEDgetDatabaseMetadata;
|
3555
|
-
exports.dEPRECATEDupdateDatabaseMetadata = dEPRECATEDupdateDatabaseMetadata;
|
3556
4061
|
exports.deleteBranch = deleteBranch;
|
3557
4062
|
exports.deleteColumn = deleteColumn;
|
3558
4063
|
exports.deleteDatabase = deleteDatabase;
|
4064
|
+
exports.deleteDatabaseGithubSettings = deleteDatabaseGithubSettings;
|
4065
|
+
exports.deleteFileItem = deleteFileItem;
|
3559
4066
|
exports.deleteRecord = deleteRecord;
|
3560
4067
|
exports.deleteTable = deleteTable;
|
3561
4068
|
exports.deleteUser = deleteUser;
|
@@ -3568,6 +4075,7 @@ exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
|
3568
4075
|
exports.exists = exists;
|
3569
4076
|
exports.ge = ge;
|
3570
4077
|
exports.getAPIKey = getAPIKey;
|
4078
|
+
exports.getBranch = getBranch;
|
3571
4079
|
exports.getBranchDetails = getBranchDetails;
|
3572
4080
|
exports.getBranchList = getBranchList;
|
3573
4081
|
exports.getBranchMetadata = getBranchMetadata;
|
@@ -3576,15 +4084,17 @@ exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
|
3576
4084
|
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
3577
4085
|
exports.getBranchStats = getBranchStats;
|
3578
4086
|
exports.getColumn = getColumn;
|
3579
|
-
exports.
|
3580
|
-
exports.getCurrentBranchName = getCurrentBranchName;
|
4087
|
+
exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
|
3581
4088
|
exports.getDatabaseList = getDatabaseList;
|
3582
4089
|
exports.getDatabaseMetadata = getDatabaseMetadata;
|
3583
4090
|
exports.getDatabaseURL = getDatabaseURL;
|
4091
|
+
exports.getFile = getFile;
|
4092
|
+
exports.getFileItem = getFileItem;
|
3584
4093
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
3585
4094
|
exports.getHostUrl = getHostUrl;
|
3586
4095
|
exports.getMigrationRequest = getMigrationRequest;
|
3587
4096
|
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
4097
|
+
exports.getPreviewBranch = getPreviewBranch;
|
3588
4098
|
exports.getRecord = getRecord;
|
3589
4099
|
exports.getTableColumns = getTableColumns;
|
3590
4100
|
exports.getTableSchema = getTableSchema;
|
@@ -3627,21 +4137,27 @@ exports.parseProviderString = parseProviderString;
|
|
3627
4137
|
exports.parseWorkspacesUrlParts = parseWorkspacesUrlParts;
|
3628
4138
|
exports.pattern = pattern;
|
3629
4139
|
exports.previewBranchSchemaEdit = previewBranchSchemaEdit;
|
4140
|
+
exports.pushBranchMigrations = pushBranchMigrations;
|
4141
|
+
exports.putFile = putFile;
|
4142
|
+
exports.putFileItem = putFileItem;
|
3630
4143
|
exports.queryMigrationRequests = queryMigrationRequests;
|
3631
4144
|
exports.queryTable = queryTable;
|
3632
4145
|
exports.removeGitBranchesEntry = removeGitBranchesEntry;
|
3633
4146
|
exports.removeWorkspaceMember = removeWorkspaceMember;
|
4147
|
+
exports.renameDatabase = renameDatabase;
|
3634
4148
|
exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
3635
4149
|
exports.resolveBranch = resolveBranch;
|
3636
4150
|
exports.searchBranch = searchBranch;
|
3637
4151
|
exports.searchTable = searchTable;
|
3638
4152
|
exports.serialize = serialize;
|
3639
4153
|
exports.setTableSchema = setTableSchema;
|
4154
|
+
exports.sqlQuery = sqlQuery;
|
3640
4155
|
exports.startsWith = startsWith;
|
3641
4156
|
exports.summarizeTable = summarizeTable;
|
3642
4157
|
exports.updateBranchMetadata = updateBranchMetadata;
|
3643
4158
|
exports.updateBranchSchema = updateBranchSchema;
|
3644
4159
|
exports.updateColumn = updateColumn;
|
4160
|
+
exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
|
3645
4161
|
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
3646
4162
|
exports.updateMigrationRequest = updateMigrationRequest;
|
3647
4163
|
exports.updateRecordWithID = updateRecordWithID;
|
@@ -3651,4 +4167,5 @@ exports.updateWorkspace = updateWorkspace;
|
|
3651
4167
|
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
|
3652
4168
|
exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
|
3653
4169
|
exports.upsertRecordWithID = upsertRecordWithID;
|
4170
|
+
exports.vectorSearchTable = vectorSearchTable;
|
3654
4171
|
//# sourceMappingURL=index.cjs.map
|