@xata.io/client 0.0.0-alpha.vf2894b5 → 0.0.0-alpha.vf2d4ede35f0fb2771332d1b20637a8546868103b
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 +1 -1
- package/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +99 -1
- package/dist/index.cjs +588 -459
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3481 -2715
- package/dist/index.mjs +574 -459
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
@@ -248,7 +248,7 @@ var __accessCheck$8 = (obj, member, msg) => {
|
|
248
248
|
if (!member.has(obj))
|
249
249
|
throw TypeError("Cannot " + msg);
|
250
250
|
};
|
251
|
-
var __privateGet$
|
251
|
+
var __privateGet$7 = (obj, member, getter) => {
|
252
252
|
__accessCheck$8(obj, member, "read from private field");
|
253
253
|
return getter ? getter.call(obj) : member.get(obj);
|
254
254
|
};
|
@@ -257,7 +257,7 @@ var __privateAdd$8 = (obj, member, value) => {
|
|
257
257
|
throw TypeError("Cannot add the same private member more than once");
|
258
258
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
259
259
|
};
|
260
|
-
var __privateSet$
|
260
|
+
var __privateSet$6 = (obj, member, value, setter) => {
|
261
261
|
__accessCheck$8(obj, member, "write to private field");
|
262
262
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
263
263
|
return value;
|
@@ -283,19 +283,19 @@ class ApiRequestPool {
|
|
283
283
|
__privateAdd$8(this, _fetch, void 0);
|
284
284
|
__privateAdd$8(this, _queue, void 0);
|
285
285
|
__privateAdd$8(this, _concurrency, void 0);
|
286
|
-
__privateSet$
|
287
|
-
__privateSet$
|
286
|
+
__privateSet$6(this, _queue, []);
|
287
|
+
__privateSet$6(this, _concurrency, concurrency);
|
288
288
|
this.running = 0;
|
289
289
|
this.started = 0;
|
290
290
|
}
|
291
291
|
setFetch(fetch2) {
|
292
|
-
__privateSet$
|
292
|
+
__privateSet$6(this, _fetch, fetch2);
|
293
293
|
}
|
294
294
|
getFetch() {
|
295
|
-
if (!__privateGet$
|
295
|
+
if (!__privateGet$7(this, _fetch)) {
|
296
296
|
throw new Error("Fetch not set");
|
297
297
|
}
|
298
|
-
return __privateGet$
|
298
|
+
return __privateGet$7(this, _fetch);
|
299
299
|
}
|
300
300
|
request(url, options) {
|
301
301
|
const start = /* @__PURE__ */ new Date();
|
@@ -327,19 +327,19 @@ _queue = new WeakMap();
|
|
327
327
|
_concurrency = new WeakMap();
|
328
328
|
_enqueue = new WeakSet();
|
329
329
|
enqueue_fn = function(task) {
|
330
|
-
const promise = new Promise((resolve) => __privateGet$
|
330
|
+
const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
|
331
331
|
this.started--;
|
332
332
|
this.running++;
|
333
333
|
}).then(() => task()).finally(() => {
|
334
334
|
this.running--;
|
335
|
-
const next = __privateGet$
|
335
|
+
const next = __privateGet$7(this, _queue).shift();
|
336
336
|
if (next !== void 0) {
|
337
337
|
this.started++;
|
338
338
|
next();
|
339
339
|
}
|
340
340
|
});
|
341
|
-
if (this.running + this.started < __privateGet$
|
342
|
-
const next = __privateGet$
|
341
|
+
if (this.running + this.started < __privateGet$7(this, _concurrency)) {
|
342
|
+
const next = __privateGet$7(this, _queue).shift();
|
343
343
|
if (next !== void 0) {
|
344
344
|
this.started++;
|
345
345
|
next();
|
@@ -528,7 +528,7 @@ function defaultOnOpen(response) {
|
|
528
528
|
}
|
529
529
|
}
|
530
530
|
|
531
|
-
const VERSION = "0.
|
531
|
+
const VERSION = "0.29.2";
|
532
532
|
|
533
533
|
class ErrorWithCause extends Error {
|
534
534
|
constructor(message, options) {
|
@@ -571,6 +571,67 @@ function getMessage(data) {
|
|
571
571
|
}
|
572
572
|
}
|
573
573
|
|
574
|
+
function getHostUrl(provider, type) {
|
575
|
+
if (isHostProviderAlias(provider)) {
|
576
|
+
return providers[provider][type];
|
577
|
+
} else if (isHostProviderBuilder(provider)) {
|
578
|
+
return provider[type];
|
579
|
+
}
|
580
|
+
throw new Error("Invalid API provider");
|
581
|
+
}
|
582
|
+
const providers = {
|
583
|
+
production: {
|
584
|
+
main: "https://api.xata.io",
|
585
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
586
|
+
},
|
587
|
+
staging: {
|
588
|
+
main: "https://api.staging-xata.dev",
|
589
|
+
workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
|
590
|
+
},
|
591
|
+
dev: {
|
592
|
+
main: "https://api.dev-xata.dev",
|
593
|
+
workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
|
594
|
+
},
|
595
|
+
local: {
|
596
|
+
main: "http://localhost:6001",
|
597
|
+
workspaces: "http://{workspaceId}.{region}.localhost:6001"
|
598
|
+
}
|
599
|
+
};
|
600
|
+
function isHostProviderAlias(alias) {
|
601
|
+
return isString(alias) && Object.keys(providers).includes(alias);
|
602
|
+
}
|
603
|
+
function isHostProviderBuilder(builder) {
|
604
|
+
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
605
|
+
}
|
606
|
+
function parseProviderString(provider = "production") {
|
607
|
+
if (isHostProviderAlias(provider)) {
|
608
|
+
return provider;
|
609
|
+
}
|
610
|
+
const [main, workspaces] = provider.split(",");
|
611
|
+
if (!main || !workspaces)
|
612
|
+
return null;
|
613
|
+
return { main, workspaces };
|
614
|
+
}
|
615
|
+
function buildProviderString(provider) {
|
616
|
+
if (isHostProviderAlias(provider))
|
617
|
+
return provider;
|
618
|
+
return `${provider.main},${provider.workspaces}`;
|
619
|
+
}
|
620
|
+
function parseWorkspacesUrlParts(url) {
|
621
|
+
if (!isString(url))
|
622
|
+
return null;
|
623
|
+
const matches = {
|
624
|
+
production: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/),
|
625
|
+
staging: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/),
|
626
|
+
dev: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/),
|
627
|
+
local: url.match(/(?:https?:\/\/)?([^.]+)(?:\.([^.]+))\.localhost:(\d+)/)
|
628
|
+
};
|
629
|
+
const [host, match] = Object.entries(matches).find(([, match2]) => match2 !== null) ?? [];
|
630
|
+
if (!isHostProviderAlias(host) || !match)
|
631
|
+
return null;
|
632
|
+
return { workspace: match[1], region: match[2], host };
|
633
|
+
}
|
634
|
+
|
574
635
|
const pool = new ApiRequestPool();
|
575
636
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
576
637
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
@@ -586,6 +647,7 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
586
647
|
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
587
648
|
};
|
588
649
|
function buildBaseUrl({
|
650
|
+
method,
|
589
651
|
endpoint,
|
590
652
|
path,
|
591
653
|
workspacesApiUrl,
|
@@ -593,7 +655,24 @@ function buildBaseUrl({
|
|
593
655
|
pathParams = {}
|
594
656
|
}) {
|
595
657
|
if (endpoint === "dataPlane") {
|
596
|
-
|
658
|
+
let url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
659
|
+
if (method.toUpperCase() === "PUT" && [
|
660
|
+
"/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
661
|
+
"/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}"
|
662
|
+
].includes(path)) {
|
663
|
+
const { host } = parseWorkspacesUrlParts(url) ?? {};
|
664
|
+
switch (host) {
|
665
|
+
case "production":
|
666
|
+
url = url.replace("xata.sh", "upload.xata.sh");
|
667
|
+
break;
|
668
|
+
case "staging":
|
669
|
+
url = url.replace("staging-xata.dev", "upload.staging-xata.dev");
|
670
|
+
break;
|
671
|
+
case "dev":
|
672
|
+
url = url.replace("dev-xata.dev", "upload.dev-xata.dev");
|
673
|
+
break;
|
674
|
+
}
|
675
|
+
}
|
597
676
|
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
598
677
|
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
599
678
|
}
|
@@ -642,9 +721,9 @@ async function fetch$1({
|
|
642
721
|
return await trace(
|
643
722
|
`${method.toUpperCase()} ${path}`,
|
644
723
|
async ({ setAttributes }) => {
|
645
|
-
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
724
|
+
const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
646
725
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
647
|
-
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
726
|
+
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\.[^.]+\./, "http://") : fullUrl;
|
648
727
|
setAttributes({
|
649
728
|
[TraceAttributes.HTTP_URL]: url,
|
650
729
|
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
@@ -725,7 +804,7 @@ function fetchSSERequest({
|
|
725
804
|
clientName,
|
726
805
|
xataAgentExtra
|
727
806
|
}) {
|
728
|
-
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
807
|
+
const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
729
808
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
730
809
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
731
810
|
void fetchEventSource(url, {
|
@@ -768,12 +847,29 @@ function parseUrl(url) {
|
|
768
847
|
|
769
848
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
770
849
|
|
850
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/apply", method: "post", ...variables, signal });
|
851
|
+
const adaptTable = (variables, signal) => dataPlaneFetch({
|
852
|
+
url: "/db/{dbBranchName}/migrations/adapt/{tableName}",
|
853
|
+
method: "post",
|
854
|
+
...variables,
|
855
|
+
signal
|
856
|
+
});
|
857
|
+
const getBranchMigrationJobStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/status", method: "get", ...variables, signal });
|
858
|
+
const getMigrationJobStatus = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/jobs/{jobId}", method: "get", ...variables, signal });
|
859
|
+
const getMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/history", method: "get", ...variables, signal });
|
771
860
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
772
861
|
url: "/dbs/{dbName}",
|
773
862
|
method: "get",
|
774
863
|
...variables,
|
775
864
|
signal
|
776
865
|
});
|
866
|
+
const getDatabaseSettings = (variables, signal) => dataPlaneFetch({
|
867
|
+
url: "/dbs/{dbName}/settings",
|
868
|
+
method: "get",
|
869
|
+
...variables,
|
870
|
+
signal
|
871
|
+
});
|
872
|
+
const updateDatabaseSettings = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/settings", method: "patch", ...variables, signal });
|
777
873
|
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
778
874
|
url: "/db/{dbBranchName}",
|
779
875
|
method: "get",
|
@@ -787,6 +883,12 @@ const deleteBranch = (variables, signal) => dataPlaneFetch({
|
|
787
883
|
...variables,
|
788
884
|
signal
|
789
885
|
});
|
886
|
+
const getSchema = (variables, signal) => dataPlaneFetch({
|
887
|
+
url: "/db/{dbBranchName}/schema",
|
888
|
+
method: "get",
|
889
|
+
...variables,
|
890
|
+
signal
|
891
|
+
});
|
790
892
|
const copyBranch = (variables, signal) => dataPlaneFetch({
|
791
893
|
url: "/db/{dbBranchName}/copy",
|
792
894
|
method: "post",
|
@@ -968,6 +1070,12 @@ const fileAccess = (variables, signal) => dataPlaneFetch({
|
|
968
1070
|
...variables,
|
969
1071
|
signal
|
970
1072
|
});
|
1073
|
+
const fileUpload = (variables, signal) => dataPlaneFetch({
|
1074
|
+
url: "/file/{fileId}",
|
1075
|
+
method: "put",
|
1076
|
+
...variables,
|
1077
|
+
signal
|
1078
|
+
});
|
971
1079
|
const sqlQuery = (variables, signal) => dataPlaneFetch({
|
972
1080
|
url: "/db/{dbBranchName}/sql",
|
973
1081
|
method: "post",
|
@@ -975,6 +1083,24 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
|
|
975
1083
|
signal
|
976
1084
|
});
|
977
1085
|
const operationsByTag$2 = {
|
1086
|
+
migrations: {
|
1087
|
+
applyMigration,
|
1088
|
+
adaptTable,
|
1089
|
+
getBranchMigrationJobStatus,
|
1090
|
+
getMigrationJobStatus,
|
1091
|
+
getMigrationHistory,
|
1092
|
+
getSchema,
|
1093
|
+
getBranchMigrationHistory,
|
1094
|
+
getBranchMigrationPlan,
|
1095
|
+
executeBranchMigrationPlan,
|
1096
|
+
getBranchSchemaHistory,
|
1097
|
+
compareBranchWithUserSchema,
|
1098
|
+
compareBranchSchemas,
|
1099
|
+
updateBranchSchema,
|
1100
|
+
previewBranchSchemaEdit,
|
1101
|
+
applyBranchSchemaEdit,
|
1102
|
+
pushBranchMigrations
|
1103
|
+
},
|
978
1104
|
branch: {
|
979
1105
|
getBranchList,
|
980
1106
|
getBranchDetails,
|
@@ -989,18 +1115,7 @@ const operationsByTag$2 = {
|
|
989
1115
|
removeGitBranchesEntry,
|
990
1116
|
resolveBranch
|
991
1117
|
},
|
992
|
-
|
993
|
-
getBranchMigrationHistory,
|
994
|
-
getBranchMigrationPlan,
|
995
|
-
executeBranchMigrationPlan,
|
996
|
-
getBranchSchemaHistory,
|
997
|
-
compareBranchWithUserSchema,
|
998
|
-
compareBranchSchemas,
|
999
|
-
updateBranchSchema,
|
1000
|
-
previewBranchSchemaEdit,
|
1001
|
-
applyBranchSchemaEdit,
|
1002
|
-
pushBranchMigrations
|
1003
|
-
},
|
1118
|
+
database: { getDatabaseSettings, updateDatabaseSettings },
|
1004
1119
|
migrationRequests: {
|
1005
1120
|
queryMigrationRequests,
|
1006
1121
|
createMigrationRequest,
|
@@ -1033,7 +1148,7 @@ const operationsByTag$2 = {
|
|
1033
1148
|
deleteRecord,
|
1034
1149
|
bulkInsertTableRecords
|
1035
1150
|
},
|
1036
|
-
files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess },
|
1151
|
+
files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess, fileUpload },
|
1037
1152
|
searchAndFilter: {
|
1038
1153
|
queryTable,
|
1039
1154
|
searchBranch,
|
@@ -1142,6 +1257,8 @@ const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
|
1142
1257
|
...variables,
|
1143
1258
|
signal
|
1144
1259
|
});
|
1260
|
+
const getWorkspaceSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/settings", method: "get", ...variables, signal });
|
1261
|
+
const updateWorkspaceSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/settings", method: "patch", ...variables, signal });
|
1145
1262
|
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
1146
1263
|
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
1147
1264
|
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
@@ -1155,12 +1272,7 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
|
|
1155
1272
|
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
1156
1273
|
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
1157
1274
|
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
1158
|
-
const listClusters = (variables, signal) => controlPlaneFetch({
|
1159
|
-
url: "/workspaces/{workspaceId}/clusters",
|
1160
|
-
method: "get",
|
1161
|
-
...variables,
|
1162
|
-
signal
|
1163
|
-
});
|
1275
|
+
const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
|
1164
1276
|
const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
|
1165
1277
|
const getCluster = (variables, signal) => controlPlaneFetch({
|
1166
1278
|
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
@@ -1212,6 +1324,8 @@ const operationsByTag$1 = {
|
|
1212
1324
|
getWorkspace,
|
1213
1325
|
updateWorkspace,
|
1214
1326
|
deleteWorkspace,
|
1327
|
+
getWorkspaceSettings,
|
1328
|
+
updateWorkspaceSettings,
|
1215
1329
|
getWorkspaceMembersList,
|
1216
1330
|
updateWorkspaceMemberRole,
|
1217
1331
|
removeWorkspaceMember
|
@@ -1240,66 +1354,11 @@ const operationsByTag$1 = {
|
|
1240
1354
|
|
1241
1355
|
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
1242
1356
|
|
1243
|
-
function getHostUrl(provider, type) {
|
1244
|
-
if (isHostProviderAlias(provider)) {
|
1245
|
-
return providers[provider][type];
|
1246
|
-
} else if (isHostProviderBuilder(provider)) {
|
1247
|
-
return provider[type];
|
1248
|
-
}
|
1249
|
-
throw new Error("Invalid API provider");
|
1250
|
-
}
|
1251
|
-
const providers = {
|
1252
|
-
production: {
|
1253
|
-
main: "https://api.xata.io",
|
1254
|
-
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
1255
|
-
},
|
1256
|
-
staging: {
|
1257
|
-
main: "https://api.staging-xata.dev",
|
1258
|
-
workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
|
1259
|
-
},
|
1260
|
-
dev: {
|
1261
|
-
main: "https://api.dev-xata.dev",
|
1262
|
-
workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
|
1263
|
-
}
|
1264
|
-
};
|
1265
|
-
function isHostProviderAlias(alias) {
|
1266
|
-
return isString(alias) && Object.keys(providers).includes(alias);
|
1267
|
-
}
|
1268
|
-
function isHostProviderBuilder(builder) {
|
1269
|
-
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
1270
|
-
}
|
1271
|
-
function parseProviderString(provider = "production") {
|
1272
|
-
if (isHostProviderAlias(provider)) {
|
1273
|
-
return provider;
|
1274
|
-
}
|
1275
|
-
const [main, workspaces] = provider.split(",");
|
1276
|
-
if (!main || !workspaces)
|
1277
|
-
return null;
|
1278
|
-
return { main, workspaces };
|
1279
|
-
}
|
1280
|
-
function buildProviderString(provider) {
|
1281
|
-
if (isHostProviderAlias(provider))
|
1282
|
-
return provider;
|
1283
|
-
return `${provider.main},${provider.workspaces}`;
|
1284
|
-
}
|
1285
|
-
function parseWorkspacesUrlParts(url) {
|
1286
|
-
if (!isString(url))
|
1287
|
-
return null;
|
1288
|
-
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
|
1289
|
-
const regexDev = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/;
|
1290
|
-
const regexStaging = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/;
|
1291
|
-
const regexProdTesting = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.tech.*/;
|
1292
|
-
const match = url.match(regex) || url.match(regexDev) || url.match(regexStaging) || url.match(regexProdTesting);
|
1293
|
-
if (!match)
|
1294
|
-
return null;
|
1295
|
-
return { workspace: match[1], region: match[2] };
|
1296
|
-
}
|
1297
|
-
|
1298
1357
|
var __accessCheck$7 = (obj, member, msg) => {
|
1299
1358
|
if (!member.has(obj))
|
1300
1359
|
throw TypeError("Cannot " + msg);
|
1301
1360
|
};
|
1302
|
-
var __privateGet$
|
1361
|
+
var __privateGet$6 = (obj, member, getter) => {
|
1303
1362
|
__accessCheck$7(obj, member, "read from private field");
|
1304
1363
|
return getter ? getter.call(obj) : member.get(obj);
|
1305
1364
|
};
|
@@ -1308,7 +1367,7 @@ var __privateAdd$7 = (obj, member, value) => {
|
|
1308
1367
|
throw TypeError("Cannot add the same private member more than once");
|
1309
1368
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
1310
1369
|
};
|
1311
|
-
var __privateSet$
|
1370
|
+
var __privateSet$5 = (obj, member, value, setter) => {
|
1312
1371
|
__accessCheck$7(obj, member, "write to private field");
|
1313
1372
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
1314
1373
|
return value;
|
@@ -1325,7 +1384,7 @@ class XataApiClient {
|
|
1325
1384
|
if (!apiKey) {
|
1326
1385
|
throw new Error("Could not resolve a valid apiKey");
|
1327
1386
|
}
|
1328
|
-
__privateSet$
|
1387
|
+
__privateSet$5(this, _extraProps, {
|
1329
1388
|
apiUrl: getHostUrl(provider, "main"),
|
1330
1389
|
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
1331
1390
|
fetch: getFetchImplementation(options.fetch),
|
@@ -1337,64 +1396,64 @@ class XataApiClient {
|
|
1337
1396
|
});
|
1338
1397
|
}
|
1339
1398
|
get user() {
|
1340
|
-
if (!__privateGet$
|
1341
|
-
__privateGet$
|
1342
|
-
return __privateGet$
|
1399
|
+
if (!__privateGet$6(this, _namespaces).user)
|
1400
|
+
__privateGet$6(this, _namespaces).user = new UserApi(__privateGet$6(this, _extraProps));
|
1401
|
+
return __privateGet$6(this, _namespaces).user;
|
1343
1402
|
}
|
1344
1403
|
get authentication() {
|
1345
|
-
if (!__privateGet$
|
1346
|
-
__privateGet$
|
1347
|
-
return __privateGet$
|
1404
|
+
if (!__privateGet$6(this, _namespaces).authentication)
|
1405
|
+
__privateGet$6(this, _namespaces).authentication = new AuthenticationApi(__privateGet$6(this, _extraProps));
|
1406
|
+
return __privateGet$6(this, _namespaces).authentication;
|
1348
1407
|
}
|
1349
1408
|
get workspaces() {
|
1350
|
-
if (!__privateGet$
|
1351
|
-
__privateGet$
|
1352
|
-
return __privateGet$
|
1409
|
+
if (!__privateGet$6(this, _namespaces).workspaces)
|
1410
|
+
__privateGet$6(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$6(this, _extraProps));
|
1411
|
+
return __privateGet$6(this, _namespaces).workspaces;
|
1353
1412
|
}
|
1354
1413
|
get invites() {
|
1355
|
-
if (!__privateGet$
|
1356
|
-
__privateGet$
|
1357
|
-
return __privateGet$
|
1414
|
+
if (!__privateGet$6(this, _namespaces).invites)
|
1415
|
+
__privateGet$6(this, _namespaces).invites = new InvitesApi(__privateGet$6(this, _extraProps));
|
1416
|
+
return __privateGet$6(this, _namespaces).invites;
|
1358
1417
|
}
|
1359
1418
|
get database() {
|
1360
|
-
if (!__privateGet$
|
1361
|
-
__privateGet$
|
1362
|
-
return __privateGet$
|
1419
|
+
if (!__privateGet$6(this, _namespaces).database)
|
1420
|
+
__privateGet$6(this, _namespaces).database = new DatabaseApi(__privateGet$6(this, _extraProps));
|
1421
|
+
return __privateGet$6(this, _namespaces).database;
|
1363
1422
|
}
|
1364
1423
|
get branches() {
|
1365
|
-
if (!__privateGet$
|
1366
|
-
__privateGet$
|
1367
|
-
return __privateGet$
|
1424
|
+
if (!__privateGet$6(this, _namespaces).branches)
|
1425
|
+
__privateGet$6(this, _namespaces).branches = new BranchApi(__privateGet$6(this, _extraProps));
|
1426
|
+
return __privateGet$6(this, _namespaces).branches;
|
1368
1427
|
}
|
1369
1428
|
get migrations() {
|
1370
|
-
if (!__privateGet$
|
1371
|
-
__privateGet$
|
1372
|
-
return __privateGet$
|
1429
|
+
if (!__privateGet$6(this, _namespaces).migrations)
|
1430
|
+
__privateGet$6(this, _namespaces).migrations = new MigrationsApi(__privateGet$6(this, _extraProps));
|
1431
|
+
return __privateGet$6(this, _namespaces).migrations;
|
1373
1432
|
}
|
1374
1433
|
get migrationRequests() {
|
1375
|
-
if (!__privateGet$
|
1376
|
-
__privateGet$
|
1377
|
-
return __privateGet$
|
1434
|
+
if (!__privateGet$6(this, _namespaces).migrationRequests)
|
1435
|
+
__privateGet$6(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$6(this, _extraProps));
|
1436
|
+
return __privateGet$6(this, _namespaces).migrationRequests;
|
1378
1437
|
}
|
1379
1438
|
get tables() {
|
1380
|
-
if (!__privateGet$
|
1381
|
-
__privateGet$
|
1382
|
-
return __privateGet$
|
1439
|
+
if (!__privateGet$6(this, _namespaces).tables)
|
1440
|
+
__privateGet$6(this, _namespaces).tables = new TableApi(__privateGet$6(this, _extraProps));
|
1441
|
+
return __privateGet$6(this, _namespaces).tables;
|
1383
1442
|
}
|
1384
1443
|
get records() {
|
1385
|
-
if (!__privateGet$
|
1386
|
-
__privateGet$
|
1387
|
-
return __privateGet$
|
1444
|
+
if (!__privateGet$6(this, _namespaces).records)
|
1445
|
+
__privateGet$6(this, _namespaces).records = new RecordsApi(__privateGet$6(this, _extraProps));
|
1446
|
+
return __privateGet$6(this, _namespaces).records;
|
1388
1447
|
}
|
1389
1448
|
get files() {
|
1390
|
-
if (!__privateGet$
|
1391
|
-
__privateGet$
|
1392
|
-
return __privateGet$
|
1449
|
+
if (!__privateGet$6(this, _namespaces).files)
|
1450
|
+
__privateGet$6(this, _namespaces).files = new FilesApi(__privateGet$6(this, _extraProps));
|
1451
|
+
return __privateGet$6(this, _namespaces).files;
|
1393
1452
|
}
|
1394
1453
|
get searchAndFilter() {
|
1395
|
-
if (!__privateGet$
|
1396
|
-
__privateGet$
|
1397
|
-
return __privateGet$
|
1454
|
+
if (!__privateGet$6(this, _namespaces).searchAndFilter)
|
1455
|
+
__privateGet$6(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$6(this, _extraProps));
|
1456
|
+
return __privateGet$6(this, _namespaces).searchAndFilter;
|
1398
1457
|
}
|
1399
1458
|
}
|
1400
1459
|
_extraProps = new WeakMap();
|
@@ -1696,6 +1755,30 @@ class BranchApi {
|
|
1696
1755
|
...this.extraProps
|
1697
1756
|
});
|
1698
1757
|
}
|
1758
|
+
pgRollMigrationHistory({
|
1759
|
+
workspace,
|
1760
|
+
region,
|
1761
|
+
database,
|
1762
|
+
branch
|
1763
|
+
}) {
|
1764
|
+
return operationsByTag.migrations.getMigrationHistory({
|
1765
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1766
|
+
...this.extraProps
|
1767
|
+
});
|
1768
|
+
}
|
1769
|
+
applyMigration({
|
1770
|
+
workspace,
|
1771
|
+
region,
|
1772
|
+
database,
|
1773
|
+
branch,
|
1774
|
+
migration
|
1775
|
+
}) {
|
1776
|
+
return operationsByTag.migrations.applyMigration({
|
1777
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1778
|
+
body: migration,
|
1779
|
+
...this.extraProps
|
1780
|
+
});
|
1781
|
+
}
|
1699
1782
|
}
|
1700
1783
|
class TableApi {
|
1701
1784
|
constructor(extraProps) {
|
@@ -2509,6 +2592,17 @@ class MigrationsApi {
|
|
2509
2592
|
...this.extraProps
|
2510
2593
|
});
|
2511
2594
|
}
|
2595
|
+
getSchema({
|
2596
|
+
workspace,
|
2597
|
+
region,
|
2598
|
+
database,
|
2599
|
+
branch
|
2600
|
+
}) {
|
2601
|
+
return operationsByTag.migrations.getSchema({
|
2602
|
+
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2603
|
+
...this.extraProps
|
2604
|
+
});
|
2605
|
+
}
|
2512
2606
|
}
|
2513
2607
|
class DatabaseApi {
|
2514
2608
|
constructor(extraProps) {
|
@@ -2619,75 +2713,6 @@ class XataApiPlugin {
|
|
2619
2713
|
class XataPlugin {
|
2620
2714
|
}
|
2621
2715
|
|
2622
|
-
class FilesPlugin extends XataPlugin {
|
2623
|
-
build(pluginOptions) {
|
2624
|
-
return {
|
2625
|
-
download: async (location) => {
|
2626
|
-
const { table, record, column, fileId = "" } = location ?? {};
|
2627
|
-
return await getFileItem({
|
2628
|
-
pathParams: {
|
2629
|
-
workspace: "{workspaceId}",
|
2630
|
-
dbBranchName: "{dbBranch}",
|
2631
|
-
region: "{region}",
|
2632
|
-
tableName: table ?? "",
|
2633
|
-
recordId: record ?? "",
|
2634
|
-
columnName: column ?? "",
|
2635
|
-
fileId
|
2636
|
-
},
|
2637
|
-
...pluginOptions,
|
2638
|
-
rawResponse: true
|
2639
|
-
});
|
2640
|
-
},
|
2641
|
-
upload: async (location, file) => {
|
2642
|
-
const { table, record, column, fileId = "" } = location ?? {};
|
2643
|
-
const contentType = getContentType(file);
|
2644
|
-
return await putFileItem({
|
2645
|
-
...pluginOptions,
|
2646
|
-
pathParams: {
|
2647
|
-
workspace: "{workspaceId}",
|
2648
|
-
dbBranchName: "{dbBranch}",
|
2649
|
-
region: "{region}",
|
2650
|
-
tableName: table ?? "",
|
2651
|
-
recordId: record ?? "",
|
2652
|
-
columnName: column ?? "",
|
2653
|
-
fileId
|
2654
|
-
},
|
2655
|
-
body: file,
|
2656
|
-
headers: { "Content-Type": contentType }
|
2657
|
-
});
|
2658
|
-
},
|
2659
|
-
delete: async (location) => {
|
2660
|
-
const { table, record, column, fileId = "" } = location ?? {};
|
2661
|
-
return await deleteFileItem({
|
2662
|
-
pathParams: {
|
2663
|
-
workspace: "{workspaceId}",
|
2664
|
-
dbBranchName: "{dbBranch}",
|
2665
|
-
region: "{region}",
|
2666
|
-
tableName: table ?? "",
|
2667
|
-
recordId: record ?? "",
|
2668
|
-
columnName: column ?? "",
|
2669
|
-
fileId
|
2670
|
-
},
|
2671
|
-
...pluginOptions
|
2672
|
-
});
|
2673
|
-
}
|
2674
|
-
};
|
2675
|
-
}
|
2676
|
-
}
|
2677
|
-
function getContentType(file) {
|
2678
|
-
if (typeof file === "string") {
|
2679
|
-
return "text/plain";
|
2680
|
-
}
|
2681
|
-
if (isBlob(file)) {
|
2682
|
-
return file.type;
|
2683
|
-
}
|
2684
|
-
try {
|
2685
|
-
return file.type;
|
2686
|
-
} catch (e) {
|
2687
|
-
}
|
2688
|
-
return "application/octet-stream";
|
2689
|
-
}
|
2690
|
-
|
2691
2716
|
function buildTransformString(transformations) {
|
2692
2717
|
return transformations.flatMap(
|
2693
2718
|
(t) => Object.entries(t).map(([key, value]) => {
|
@@ -2719,16 +2744,18 @@ function transformImage(url, ...transformations) {
|
|
2719
2744
|
class XataFile {
|
2720
2745
|
constructor(file) {
|
2721
2746
|
this.id = file.id;
|
2722
|
-
this.name = file.name
|
2723
|
-
this.mediaType = file.mediaType
|
2747
|
+
this.name = file.name;
|
2748
|
+
this.mediaType = file.mediaType;
|
2724
2749
|
this.base64Content = file.base64Content;
|
2725
|
-
this.enablePublicUrl = file.enablePublicUrl
|
2726
|
-
this.signedUrlTimeout = file.signedUrlTimeout
|
2727
|
-
this.
|
2728
|
-
this.
|
2729
|
-
this.
|
2750
|
+
this.enablePublicUrl = file.enablePublicUrl;
|
2751
|
+
this.signedUrlTimeout = file.signedUrlTimeout;
|
2752
|
+
this.uploadUrlTimeout = file.uploadUrlTimeout;
|
2753
|
+
this.size = file.size;
|
2754
|
+
this.version = file.version;
|
2755
|
+
this.url = file.url;
|
2730
2756
|
this.signedUrl = file.signedUrl;
|
2731
|
-
this.
|
2757
|
+
this.uploadUrl = file.uploadUrl;
|
2758
|
+
this.attributes = file.attributes;
|
2732
2759
|
}
|
2733
2760
|
static fromBuffer(buffer, options = {}) {
|
2734
2761
|
const base64Content = buffer.toString("base64");
|
@@ -2818,7 +2845,7 @@ class XataFile {
|
|
2818
2845
|
const parseInputFileEntry = async (entry) => {
|
2819
2846
|
if (!isDefined(entry))
|
2820
2847
|
return null;
|
2821
|
-
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
|
2848
|
+
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
|
2822
2849
|
return compactObject({
|
2823
2850
|
id,
|
2824
2851
|
// Name cannot be an empty string in our API
|
@@ -2826,7 +2853,8 @@ const parseInputFileEntry = async (entry) => {
|
|
2826
2853
|
mediaType,
|
2827
2854
|
base64Content,
|
2828
2855
|
enablePublicUrl,
|
2829
|
-
signedUrlTimeout
|
2856
|
+
signedUrlTimeout,
|
2857
|
+
uploadUrlTimeout
|
2830
2858
|
});
|
2831
2859
|
};
|
2832
2860
|
|
@@ -2880,7 +2908,7 @@ var __accessCheck$6 = (obj, member, msg) => {
|
|
2880
2908
|
if (!member.has(obj))
|
2881
2909
|
throw TypeError("Cannot " + msg);
|
2882
2910
|
};
|
2883
|
-
var __privateGet$
|
2911
|
+
var __privateGet$5 = (obj, member, getter) => {
|
2884
2912
|
__accessCheck$6(obj, member, "read from private field");
|
2885
2913
|
return getter ? getter.call(obj) : member.get(obj);
|
2886
2914
|
};
|
@@ -2889,7 +2917,7 @@ var __privateAdd$6 = (obj, member, value) => {
|
|
2889
2917
|
throw TypeError("Cannot add the same private member more than once");
|
2890
2918
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
2891
2919
|
};
|
2892
|
-
var __privateSet$
|
2920
|
+
var __privateSet$4 = (obj, member, value, setter) => {
|
2893
2921
|
__accessCheck$6(obj, member, "write to private field");
|
2894
2922
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
2895
2923
|
return value;
|
@@ -2898,9 +2926,9 @@ var _query, _page;
|
|
2898
2926
|
class Page {
|
2899
2927
|
constructor(query, meta, records = []) {
|
2900
2928
|
__privateAdd$6(this, _query, void 0);
|
2901
|
-
__privateSet$
|
2929
|
+
__privateSet$4(this, _query, query);
|
2902
2930
|
this.meta = meta;
|
2903
|
-
this.records = new
|
2931
|
+
this.records = new PageRecordArray(this, records);
|
2904
2932
|
}
|
2905
2933
|
/**
|
2906
2934
|
* Retrieves the next page of results.
|
@@ -2909,7 +2937,7 @@ class Page {
|
|
2909
2937
|
* @returns The next page or results.
|
2910
2938
|
*/
|
2911
2939
|
async nextPage(size, offset) {
|
2912
|
-
return __privateGet$
|
2940
|
+
return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, after: this.meta.page.cursor } });
|
2913
2941
|
}
|
2914
2942
|
/**
|
2915
2943
|
* Retrieves the previous page of results.
|
@@ -2918,7 +2946,7 @@ class Page {
|
|
2918
2946
|
* @returns The previous page or results.
|
2919
2947
|
*/
|
2920
2948
|
async previousPage(size, offset) {
|
2921
|
-
return __privateGet$
|
2949
|
+
return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
2922
2950
|
}
|
2923
2951
|
/**
|
2924
2952
|
* Retrieves the start page of results.
|
@@ -2927,7 +2955,7 @@ class Page {
|
|
2927
2955
|
* @returns The start page or results.
|
2928
2956
|
*/
|
2929
2957
|
async startPage(size, offset) {
|
2930
|
-
return __privateGet$
|
2958
|
+
return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
2931
2959
|
}
|
2932
2960
|
/**
|
2933
2961
|
* Retrieves the end page of results.
|
@@ -2936,7 +2964,7 @@ class Page {
|
|
2936
2964
|
* @returns The end page or results.
|
2937
2965
|
*/
|
2938
2966
|
async endPage(size, offset) {
|
2939
|
-
return __privateGet$
|
2967
|
+
return __privateGet$5(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
2940
2968
|
}
|
2941
2969
|
/**
|
2942
2970
|
* Shortcut method to check if there will be additional results if the next page of results is retrieved.
|
@@ -2954,11 +2982,38 @@ const PAGINATION_DEFAULT_OFFSET = 0;
|
|
2954
2982
|
function isCursorPaginationOptions(options) {
|
2955
2983
|
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
2956
2984
|
}
|
2957
|
-
|
2985
|
+
class RecordArray extends Array {
|
2986
|
+
constructor(...args) {
|
2987
|
+
super(...RecordArray.parseConstructorParams(...args));
|
2988
|
+
}
|
2989
|
+
static parseConstructorParams(...args) {
|
2990
|
+
if (args.length === 1 && typeof args[0] === "number") {
|
2991
|
+
return new Array(args[0]);
|
2992
|
+
}
|
2993
|
+
if (args.length <= 1 && Array.isArray(args[0] ?? [])) {
|
2994
|
+
const result = args[0] ?? [];
|
2995
|
+
return new Array(...result);
|
2996
|
+
}
|
2997
|
+
return new Array(...args);
|
2998
|
+
}
|
2999
|
+
toArray() {
|
3000
|
+
return new Array(...this);
|
3001
|
+
}
|
3002
|
+
toSerializable() {
|
3003
|
+
return JSON.parse(this.toString());
|
3004
|
+
}
|
3005
|
+
toString() {
|
3006
|
+
return JSON.stringify(this.toArray());
|
3007
|
+
}
|
3008
|
+
map(callbackfn, thisArg) {
|
3009
|
+
return this.toArray().map(callbackfn, thisArg);
|
3010
|
+
}
|
3011
|
+
}
|
3012
|
+
const _PageRecordArray = class _PageRecordArray extends Array {
|
2958
3013
|
constructor(...args) {
|
2959
|
-
super(...
|
3014
|
+
super(..._PageRecordArray.parseConstructorParams(...args));
|
2960
3015
|
__privateAdd$6(this, _page, void 0);
|
2961
|
-
__privateSet$
|
3016
|
+
__privateSet$4(this, _page, isObject(args[0]?.meta) ? args[0] : { meta: { page: { cursor: "", more: false } }, records: [] });
|
2962
3017
|
}
|
2963
3018
|
static parseConstructorParams(...args) {
|
2964
3019
|
if (args.length === 1 && typeof args[0] === "number") {
|
@@ -2988,8 +3043,8 @@ const _RecordArray = class _RecordArray extends Array {
|
|
2988
3043
|
* @returns A new array of objects
|
2989
3044
|
*/
|
2990
3045
|
async nextPage(size, offset) {
|
2991
|
-
const newPage = await __privateGet$
|
2992
|
-
return new
|
3046
|
+
const newPage = await __privateGet$5(this, _page).nextPage(size, offset);
|
3047
|
+
return new _PageRecordArray(newPage);
|
2993
3048
|
}
|
2994
3049
|
/**
|
2995
3050
|
* Retrieve previous page of records
|
@@ -2997,8 +3052,8 @@ const _RecordArray = class _RecordArray extends Array {
|
|
2997
3052
|
* @returns A new array of objects
|
2998
3053
|
*/
|
2999
3054
|
async previousPage(size, offset) {
|
3000
|
-
const newPage = await __privateGet$
|
3001
|
-
return new
|
3055
|
+
const newPage = await __privateGet$5(this, _page).previousPage(size, offset);
|
3056
|
+
return new _PageRecordArray(newPage);
|
3002
3057
|
}
|
3003
3058
|
/**
|
3004
3059
|
* Retrieve start page of records
|
@@ -3006,8 +3061,8 @@ const _RecordArray = class _RecordArray extends Array {
|
|
3006
3061
|
* @returns A new array of objects
|
3007
3062
|
*/
|
3008
3063
|
async startPage(size, offset) {
|
3009
|
-
const newPage = await __privateGet$
|
3010
|
-
return new
|
3064
|
+
const newPage = await __privateGet$5(this, _page).startPage(size, offset);
|
3065
|
+
return new _PageRecordArray(newPage);
|
3011
3066
|
}
|
3012
3067
|
/**
|
3013
3068
|
* Retrieve end page of records
|
@@ -3015,24 +3070,24 @@ const _RecordArray = class _RecordArray extends Array {
|
|
3015
3070
|
* @returns A new array of objects
|
3016
3071
|
*/
|
3017
3072
|
async endPage(size, offset) {
|
3018
|
-
const newPage = await __privateGet$
|
3019
|
-
return new
|
3073
|
+
const newPage = await __privateGet$5(this, _page).endPage(size, offset);
|
3074
|
+
return new _PageRecordArray(newPage);
|
3020
3075
|
}
|
3021
3076
|
/**
|
3022
3077
|
* @returns Boolean indicating if there is a next page
|
3023
3078
|
*/
|
3024
3079
|
hasNextPage() {
|
3025
|
-
return __privateGet$
|
3080
|
+
return __privateGet$5(this, _page).meta.page.more;
|
3026
3081
|
}
|
3027
3082
|
};
|
3028
3083
|
_page = new WeakMap();
|
3029
|
-
let
|
3084
|
+
let PageRecordArray = _PageRecordArray;
|
3030
3085
|
|
3031
3086
|
var __accessCheck$5 = (obj, member, msg) => {
|
3032
3087
|
if (!member.has(obj))
|
3033
3088
|
throw TypeError("Cannot " + msg);
|
3034
3089
|
};
|
3035
|
-
var __privateGet$
|
3090
|
+
var __privateGet$4 = (obj, member, getter) => {
|
3036
3091
|
__accessCheck$5(obj, member, "read from private field");
|
3037
3092
|
return getter ? getter.call(obj) : member.get(obj);
|
3038
3093
|
};
|
@@ -3041,7 +3096,7 @@ var __privateAdd$5 = (obj, member, value) => {
|
|
3041
3096
|
throw TypeError("Cannot add the same private member more than once");
|
3042
3097
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3043
3098
|
};
|
3044
|
-
var __privateSet$
|
3099
|
+
var __privateSet$3 = (obj, member, value, setter) => {
|
3045
3100
|
__accessCheck$5(obj, member, "write to private field");
|
3046
3101
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
3047
3102
|
return value;
|
@@ -3059,25 +3114,25 @@ const _Query = class _Query {
|
|
3059
3114
|
__privateAdd$5(this, _data, { filter: {} });
|
3060
3115
|
// Implements pagination
|
3061
3116
|
this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
|
3062
|
-
this.records = new
|
3063
|
-
__privateSet$
|
3117
|
+
this.records = new PageRecordArray(this, []);
|
3118
|
+
__privateSet$3(this, _table$1, table);
|
3064
3119
|
if (repository) {
|
3065
|
-
__privateSet$
|
3120
|
+
__privateSet$3(this, _repository, repository);
|
3066
3121
|
} else {
|
3067
|
-
__privateSet$
|
3122
|
+
__privateSet$3(this, _repository, this);
|
3068
3123
|
}
|
3069
3124
|
const parent = cleanParent(data, rawParent);
|
3070
|
-
__privateGet$
|
3071
|
-
__privateGet$
|
3072
|
-
__privateGet$
|
3073
|
-
__privateGet$
|
3074
|
-
__privateGet$
|
3075
|
-
__privateGet$
|
3076
|
-
__privateGet$
|
3077
|
-
__privateGet$
|
3078
|
-
__privateGet$
|
3079
|
-
__privateGet$
|
3080
|
-
__privateGet$
|
3125
|
+
__privateGet$4(this, _data).filter = data.filter ?? parent?.filter ?? {};
|
3126
|
+
__privateGet$4(this, _data).filter.$any = data.filter?.$any ?? parent?.filter?.$any;
|
3127
|
+
__privateGet$4(this, _data).filter.$all = data.filter?.$all ?? parent?.filter?.$all;
|
3128
|
+
__privateGet$4(this, _data).filter.$not = data.filter?.$not ?? parent?.filter?.$not;
|
3129
|
+
__privateGet$4(this, _data).filter.$none = data.filter?.$none ?? parent?.filter?.$none;
|
3130
|
+
__privateGet$4(this, _data).sort = data.sort ?? parent?.sort;
|
3131
|
+
__privateGet$4(this, _data).columns = data.columns ?? parent?.columns;
|
3132
|
+
__privateGet$4(this, _data).consistency = data.consistency ?? parent?.consistency;
|
3133
|
+
__privateGet$4(this, _data).pagination = data.pagination ?? parent?.pagination;
|
3134
|
+
__privateGet$4(this, _data).cache = data.cache ?? parent?.cache;
|
3135
|
+
__privateGet$4(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
3081
3136
|
this.any = this.any.bind(this);
|
3082
3137
|
this.all = this.all.bind(this);
|
3083
3138
|
this.not = this.not.bind(this);
|
@@ -3088,10 +3143,10 @@ const _Query = class _Query {
|
|
3088
3143
|
Object.defineProperty(this, "repository", { enumerable: false });
|
3089
3144
|
}
|
3090
3145
|
getQueryOptions() {
|
3091
|
-
return __privateGet$
|
3146
|
+
return __privateGet$4(this, _data);
|
3092
3147
|
}
|
3093
3148
|
key() {
|
3094
|
-
const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$
|
3149
|
+
const { columns = [], filter = {}, sort = [], pagination = {} } = __privateGet$4(this, _data);
|
3095
3150
|
const key = JSON.stringify({ columns, filter, sort, pagination });
|
3096
3151
|
return toBase64(key);
|
3097
3152
|
}
|
@@ -3102,7 +3157,7 @@ const _Query = class _Query {
|
|
3102
3157
|
*/
|
3103
3158
|
any(...queries) {
|
3104
3159
|
const $any = queries.map((query) => query.getQueryOptions().filter ?? {});
|
3105
|
-
return new _Query(__privateGet$
|
3160
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $any } }, __privateGet$4(this, _data));
|
3106
3161
|
}
|
3107
3162
|
/**
|
3108
3163
|
* Builds a new query object representing a logical AND between the given subqueries.
|
@@ -3111,7 +3166,7 @@ const _Query = class _Query {
|
|
3111
3166
|
*/
|
3112
3167
|
all(...queries) {
|
3113
3168
|
const $all = queries.map((query) => query.getQueryOptions().filter ?? {});
|
3114
|
-
return new _Query(__privateGet$
|
3169
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
|
3115
3170
|
}
|
3116
3171
|
/**
|
3117
3172
|
* Builds a new query object representing a logical OR negating each subquery. In pseudo-code: !q1 OR !q2
|
@@ -3120,7 +3175,7 @@ const _Query = class _Query {
|
|
3120
3175
|
*/
|
3121
3176
|
not(...queries) {
|
3122
3177
|
const $not = queries.map((query) => query.getQueryOptions().filter ?? {});
|
3123
|
-
return new _Query(__privateGet$
|
3178
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $not } }, __privateGet$4(this, _data));
|
3124
3179
|
}
|
3125
3180
|
/**
|
3126
3181
|
* Builds a new query object representing a logical AND negating each subquery. In pseudo-code: !q1 AND !q2
|
@@ -3129,25 +3184,25 @@ const _Query = class _Query {
|
|
3129
3184
|
*/
|
3130
3185
|
none(...queries) {
|
3131
3186
|
const $none = queries.map((query) => query.getQueryOptions().filter ?? {});
|
3132
|
-
return new _Query(__privateGet$
|
3187
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $none } }, __privateGet$4(this, _data));
|
3133
3188
|
}
|
3134
3189
|
filter(a, b) {
|
3135
3190
|
if (arguments.length === 1) {
|
3136
3191
|
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({
|
3137
3192
|
[column]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, column, constraint)
|
3138
3193
|
}));
|
3139
|
-
const $all = compact([__privateGet$
|
3140
|
-
return new _Query(__privateGet$
|
3194
|
+
const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
|
3195
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
|
3141
3196
|
} else {
|
3142
3197
|
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: __privateMethod$3(this, _cleanFilterConstraint, cleanFilterConstraint_fn).call(this, a, b) }] : void 0;
|
3143
|
-
const $all = compact([__privateGet$
|
3144
|
-
return new _Query(__privateGet$
|
3198
|
+
const $all = compact([__privateGet$4(this, _data).filter?.$all].flat().concat(constraints));
|
3199
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { filter: { $all } }, __privateGet$4(this, _data));
|
3145
3200
|
}
|
3146
3201
|
}
|
3147
3202
|
sort(column, direction = "asc") {
|
3148
|
-
const originalSort = [__privateGet$
|
3203
|
+
const originalSort = [__privateGet$4(this, _data).sort ?? []].flat();
|
3149
3204
|
const sort = [...originalSort, { column, direction }];
|
3150
|
-
return new _Query(__privateGet$
|
3205
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { sort }, __privateGet$4(this, _data));
|
3151
3206
|
}
|
3152
3207
|
/**
|
3153
3208
|
* Builds a new query specifying the set of columns to be returned in the query response.
|
@@ -3156,15 +3211,15 @@ const _Query = class _Query {
|
|
3156
3211
|
*/
|
3157
3212
|
select(columns) {
|
3158
3213
|
return new _Query(
|
3159
|
-
__privateGet$
|
3160
|
-
__privateGet$
|
3214
|
+
__privateGet$4(this, _repository),
|
3215
|
+
__privateGet$4(this, _table$1),
|
3161
3216
|
{ columns },
|
3162
|
-
__privateGet$
|
3217
|
+
__privateGet$4(this, _data)
|
3163
3218
|
);
|
3164
3219
|
}
|
3165
3220
|
getPaginated(options = {}) {
|
3166
|
-
const query = new _Query(__privateGet$
|
3167
|
-
return __privateGet$
|
3221
|
+
const query = new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), options, __privateGet$4(this, _data));
|
3222
|
+
return __privateGet$4(this, _repository).query(query);
|
3168
3223
|
}
|
3169
3224
|
/**
|
3170
3225
|
* Get results in an iterator
|
@@ -3201,7 +3256,7 @@ const _Query = class _Query {
|
|
3201
3256
|
if (page.hasNextPage() && options.pagination?.size === void 0) {
|
3202
3257
|
console.trace("Calling getMany does not return all results. Paginate to get all results or call getAll.");
|
3203
3258
|
}
|
3204
|
-
const array = new
|
3259
|
+
const array = new PageRecordArray(page, results.slice(0, size));
|
3205
3260
|
return array;
|
3206
3261
|
}
|
3207
3262
|
async getAll(options = {}) {
|
@@ -3210,7 +3265,7 @@ const _Query = class _Query {
|
|
3210
3265
|
for await (const page of this.getIterator({ ...rest, batchSize })) {
|
3211
3266
|
results.push(...page);
|
3212
3267
|
}
|
3213
|
-
return results;
|
3268
|
+
return new RecordArray(results);
|
3214
3269
|
}
|
3215
3270
|
async getFirst(options = {}) {
|
3216
3271
|
const records = await this.getMany({ ...options, pagination: { size: 1 } });
|
@@ -3225,12 +3280,12 @@ const _Query = class _Query {
|
|
3225
3280
|
async summarize(params = {}) {
|
3226
3281
|
const { summaries, summariesFilter, ...options } = params;
|
3227
3282
|
const query = new _Query(
|
3228
|
-
__privateGet$
|
3229
|
-
__privateGet$
|
3283
|
+
__privateGet$4(this, _repository),
|
3284
|
+
__privateGet$4(this, _table$1),
|
3230
3285
|
options,
|
3231
|
-
__privateGet$
|
3286
|
+
__privateGet$4(this, _data)
|
3232
3287
|
);
|
3233
|
-
return __privateGet$
|
3288
|
+
return __privateGet$4(this, _repository).summarizeTable(query, summaries, summariesFilter);
|
3234
3289
|
}
|
3235
3290
|
/**
|
3236
3291
|
* Builds a new query object adding a cache TTL in milliseconds.
|
@@ -3238,7 +3293,7 @@ const _Query = class _Query {
|
|
3238
3293
|
* @returns A new Query object.
|
3239
3294
|
*/
|
3240
3295
|
cache(ttl) {
|
3241
|
-
return new _Query(__privateGet$
|
3296
|
+
return new _Query(__privateGet$4(this, _repository), __privateGet$4(this, _table$1), { cache: ttl }, __privateGet$4(this, _data));
|
3242
3297
|
}
|
3243
3298
|
/**
|
3244
3299
|
* Retrieve next page of records
|
@@ -3284,7 +3339,7 @@ _repository = new WeakMap();
|
|
3284
3339
|
_data = new WeakMap();
|
3285
3340
|
_cleanFilterConstraint = new WeakSet();
|
3286
3341
|
cleanFilterConstraint_fn = function(column, value) {
|
3287
|
-
const columnType = __privateGet$
|
3342
|
+
const columnType = __privateGet$4(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
3288
3343
|
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
3289
3344
|
return { $includes: value };
|
3290
3345
|
}
|
@@ -3310,7 +3365,6 @@ const RecordColumnTypes = [
|
|
3310
3365
|
"email",
|
3311
3366
|
"multiple",
|
3312
3367
|
"link",
|
3313
|
-
"object",
|
3314
3368
|
"datetime",
|
3315
3369
|
"vector",
|
3316
3370
|
"file[]",
|
@@ -3375,7 +3429,7 @@ var __accessCheck$4 = (obj, member, msg) => {
|
|
3375
3429
|
if (!member.has(obj))
|
3376
3430
|
throw TypeError("Cannot " + msg);
|
3377
3431
|
};
|
3378
|
-
var __privateGet$
|
3432
|
+
var __privateGet$3 = (obj, member, getter) => {
|
3379
3433
|
__accessCheck$4(obj, member, "read from private field");
|
3380
3434
|
return getter ? getter.call(obj) : member.get(obj);
|
3381
3435
|
};
|
@@ -3384,7 +3438,7 @@ var __privateAdd$4 = (obj, member, value) => {
|
|
3384
3438
|
throw TypeError("Cannot add the same private member more than once");
|
3385
3439
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
3386
3440
|
};
|
3387
|
-
var __privateSet$
|
3441
|
+
var __privateSet$2 = (obj, member, value, setter) => {
|
3388
3442
|
__accessCheck$4(obj, member, "write to private field");
|
3389
3443
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
3390
3444
|
return value;
|
@@ -3393,7 +3447,7 @@ var __privateMethod$2 = (obj, member, method) => {
|
|
3393
3447
|
__accessCheck$4(obj, member, "access private method");
|
3394
3448
|
return method;
|
3395
3449
|
};
|
3396
|
-
var _table, _getFetchProps, _db, _cache, _schemaTables
|
3450
|
+
var _table, _getFetchProps, _db, _cache, _schemaTables, _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, getSchemaTables_fn, _transformObjectToApi, transformObjectToApi_fn;
|
3397
3451
|
const BULK_OPERATION_MAX_SIZE = 1e3;
|
3398
3452
|
class Repository extends Query {
|
3399
3453
|
}
|
@@ -3414,31 +3468,31 @@ class RestRepository extends Query {
|
|
3414
3468
|
__privateAdd$4(this, _deleteRecords);
|
3415
3469
|
__privateAdd$4(this, _setCacheQuery);
|
3416
3470
|
__privateAdd$4(this, _getCacheQuery);
|
3417
|
-
__privateAdd$4(this, _getSchemaTables
|
3471
|
+
__privateAdd$4(this, _getSchemaTables);
|
3418
3472
|
__privateAdd$4(this, _transformObjectToApi);
|
3419
3473
|
__privateAdd$4(this, _table, void 0);
|
3420
3474
|
__privateAdd$4(this, _getFetchProps, void 0);
|
3421
3475
|
__privateAdd$4(this, _db, void 0);
|
3422
3476
|
__privateAdd$4(this, _cache, void 0);
|
3423
|
-
__privateAdd$4(this, _schemaTables
|
3477
|
+
__privateAdd$4(this, _schemaTables, void 0);
|
3424
3478
|
__privateAdd$4(this, _trace, void 0);
|
3425
|
-
__privateSet$
|
3426
|
-
__privateSet$
|
3427
|
-
__privateSet$
|
3428
|
-
__privateSet$
|
3429
|
-
__privateSet$
|
3479
|
+
__privateSet$2(this, _table, options.table);
|
3480
|
+
__privateSet$2(this, _db, options.db);
|
3481
|
+
__privateSet$2(this, _cache, options.pluginOptions.cache);
|
3482
|
+
__privateSet$2(this, _schemaTables, options.schemaTables);
|
3483
|
+
__privateSet$2(this, _getFetchProps, () => ({ ...options.pluginOptions, sessionID: generateUUID() }));
|
3430
3484
|
const trace = options.pluginOptions.trace ?? defaultTrace;
|
3431
|
-
__privateSet$
|
3485
|
+
__privateSet$2(this, _trace, async (name, fn, options2 = {}) => {
|
3432
3486
|
return trace(name, fn, {
|
3433
3487
|
...options2,
|
3434
|
-
[TraceAttributes.TABLE]: __privateGet$
|
3488
|
+
[TraceAttributes.TABLE]: __privateGet$3(this, _table),
|
3435
3489
|
[TraceAttributes.KIND]: "sdk-operation",
|
3436
3490
|
[TraceAttributes.VERSION]: VERSION
|
3437
3491
|
});
|
3438
3492
|
});
|
3439
3493
|
}
|
3440
3494
|
async create(a, b, c, d) {
|
3441
|
-
return __privateGet$
|
3495
|
+
return __privateGet$3(this, _trace).call(this, "create", async () => {
|
3442
3496
|
const ifVersion = parseIfVersion(b, c, d);
|
3443
3497
|
if (Array.isArray(a)) {
|
3444
3498
|
if (a.length === 0)
|
@@ -3468,7 +3522,7 @@ class RestRepository extends Query {
|
|
3468
3522
|
});
|
3469
3523
|
}
|
3470
3524
|
async read(a, b) {
|
3471
|
-
return __privateGet$
|
3525
|
+
return __privateGet$3(this, _trace).call(this, "read", async () => {
|
3472
3526
|
const columns = isValidSelectableColumns(b) ? b : ["*"];
|
3473
3527
|
if (Array.isArray(a)) {
|
3474
3528
|
if (a.length === 0)
|
@@ -3489,17 +3543,17 @@ class RestRepository extends Query {
|
|
3489
3543
|
workspace: "{workspaceId}",
|
3490
3544
|
dbBranchName: "{dbBranch}",
|
3491
3545
|
region: "{region}",
|
3492
|
-
tableName: __privateGet$
|
3546
|
+
tableName: __privateGet$3(this, _table),
|
3493
3547
|
recordId: id
|
3494
3548
|
},
|
3495
3549
|
queryParams: { columns },
|
3496
|
-
...__privateGet$
|
3550
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3497
3551
|
});
|
3498
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3552
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
3499
3553
|
return initObject(
|
3500
|
-
__privateGet$
|
3554
|
+
__privateGet$3(this, _db),
|
3501
3555
|
schemaTables,
|
3502
|
-
__privateGet$
|
3556
|
+
__privateGet$3(this, _table),
|
3503
3557
|
response,
|
3504
3558
|
columns
|
3505
3559
|
);
|
@@ -3514,7 +3568,7 @@ class RestRepository extends Query {
|
|
3514
3568
|
});
|
3515
3569
|
}
|
3516
3570
|
async readOrThrow(a, b) {
|
3517
|
-
return __privateGet$
|
3571
|
+
return __privateGet$3(this, _trace).call(this, "readOrThrow", async () => {
|
3518
3572
|
const result = await this.read(a, b);
|
3519
3573
|
if (Array.isArray(result)) {
|
3520
3574
|
const missingIds = compact(
|
@@ -3533,7 +3587,7 @@ class RestRepository extends Query {
|
|
3533
3587
|
});
|
3534
3588
|
}
|
3535
3589
|
async update(a, b, c, d) {
|
3536
|
-
return __privateGet$
|
3590
|
+
return __privateGet$3(this, _trace).call(this, "update", async () => {
|
3537
3591
|
const ifVersion = parseIfVersion(b, c, d);
|
3538
3592
|
if (Array.isArray(a)) {
|
3539
3593
|
if (a.length === 0)
|
@@ -3566,7 +3620,7 @@ class RestRepository extends Query {
|
|
3566
3620
|
});
|
3567
3621
|
}
|
3568
3622
|
async updateOrThrow(a, b, c, d) {
|
3569
|
-
return __privateGet$
|
3623
|
+
return __privateGet$3(this, _trace).call(this, "updateOrThrow", async () => {
|
3570
3624
|
const result = await this.update(a, b, c, d);
|
3571
3625
|
if (Array.isArray(result)) {
|
3572
3626
|
const missingIds = compact(
|
@@ -3585,7 +3639,7 @@ class RestRepository extends Query {
|
|
3585
3639
|
});
|
3586
3640
|
}
|
3587
3641
|
async createOrUpdate(a, b, c, d) {
|
3588
|
-
return __privateGet$
|
3642
|
+
return __privateGet$3(this, _trace).call(this, "createOrUpdate", async () => {
|
3589
3643
|
const ifVersion = parseIfVersion(b, c, d);
|
3590
3644
|
if (Array.isArray(a)) {
|
3591
3645
|
if (a.length === 0)
|
@@ -3620,7 +3674,7 @@ class RestRepository extends Query {
|
|
3620
3674
|
});
|
3621
3675
|
}
|
3622
3676
|
async createOrReplace(a, b, c, d) {
|
3623
|
-
return __privateGet$
|
3677
|
+
return __privateGet$3(this, _trace).call(this, "createOrReplace", async () => {
|
3624
3678
|
const ifVersion = parseIfVersion(b, c, d);
|
3625
3679
|
if (Array.isArray(a)) {
|
3626
3680
|
if (a.length === 0)
|
@@ -3652,7 +3706,7 @@ class RestRepository extends Query {
|
|
3652
3706
|
});
|
3653
3707
|
}
|
3654
3708
|
async delete(a, b) {
|
3655
|
-
return __privateGet$
|
3709
|
+
return __privateGet$3(this, _trace).call(this, "delete", async () => {
|
3656
3710
|
if (Array.isArray(a)) {
|
3657
3711
|
if (a.length === 0)
|
3658
3712
|
return [];
|
@@ -3678,7 +3732,7 @@ class RestRepository extends Query {
|
|
3678
3732
|
});
|
3679
3733
|
}
|
3680
3734
|
async deleteOrThrow(a, b) {
|
3681
|
-
return __privateGet$
|
3735
|
+
return __privateGet$3(this, _trace).call(this, "deleteOrThrow", async () => {
|
3682
3736
|
const result = await this.delete(a, b);
|
3683
3737
|
if (Array.isArray(result)) {
|
3684
3738
|
const missingIds = compact(
|
@@ -3696,13 +3750,13 @@ class RestRepository extends Query {
|
|
3696
3750
|
});
|
3697
3751
|
}
|
3698
3752
|
async search(query, options = {}) {
|
3699
|
-
return __privateGet$
|
3700
|
-
const { records } = await searchTable({
|
3753
|
+
return __privateGet$3(this, _trace).call(this, "search", async () => {
|
3754
|
+
const { records, totalCount } = await searchTable({
|
3701
3755
|
pathParams: {
|
3702
3756
|
workspace: "{workspaceId}",
|
3703
3757
|
dbBranchName: "{dbBranch}",
|
3704
3758
|
region: "{region}",
|
3705
|
-
tableName: __privateGet$
|
3759
|
+
tableName: __privateGet$3(this, _table)
|
3706
3760
|
},
|
3707
3761
|
body: {
|
3708
3762
|
query,
|
@@ -3714,20 +3768,23 @@ class RestRepository extends Query {
|
|
3714
3768
|
page: options.page,
|
3715
3769
|
target: options.target
|
3716
3770
|
},
|
3717
|
-
...__privateGet$
|
3771
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3718
3772
|
});
|
3719
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3720
|
-
return
|
3773
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
3774
|
+
return {
|
3775
|
+
records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
|
3776
|
+
totalCount
|
3777
|
+
};
|
3721
3778
|
});
|
3722
3779
|
}
|
3723
3780
|
async vectorSearch(column, query, options) {
|
3724
|
-
return __privateGet$
|
3725
|
-
const { records } = await vectorSearchTable({
|
3781
|
+
return __privateGet$3(this, _trace).call(this, "vectorSearch", async () => {
|
3782
|
+
const { records, totalCount } = await vectorSearchTable({
|
3726
3783
|
pathParams: {
|
3727
3784
|
workspace: "{workspaceId}",
|
3728
3785
|
dbBranchName: "{dbBranch}",
|
3729
3786
|
region: "{region}",
|
3730
|
-
tableName: __privateGet$
|
3787
|
+
tableName: __privateGet$3(this, _table)
|
3731
3788
|
},
|
3732
3789
|
body: {
|
3733
3790
|
column,
|
@@ -3736,29 +3793,32 @@ class RestRepository extends Query {
|
|
3736
3793
|
size: options?.size,
|
3737
3794
|
filter: options?.filter
|
3738
3795
|
},
|
3739
|
-
...__privateGet$
|
3796
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3740
3797
|
});
|
3741
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3742
|
-
return
|
3798
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
3799
|
+
return {
|
3800
|
+
records: records.map((item) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), item, ["*"])),
|
3801
|
+
totalCount
|
3802
|
+
};
|
3743
3803
|
});
|
3744
3804
|
}
|
3745
3805
|
async aggregate(aggs, filter) {
|
3746
|
-
return __privateGet$
|
3806
|
+
return __privateGet$3(this, _trace).call(this, "aggregate", async () => {
|
3747
3807
|
const result = await aggregateTable({
|
3748
3808
|
pathParams: {
|
3749
3809
|
workspace: "{workspaceId}",
|
3750
3810
|
dbBranchName: "{dbBranch}",
|
3751
3811
|
region: "{region}",
|
3752
|
-
tableName: __privateGet$
|
3812
|
+
tableName: __privateGet$3(this, _table)
|
3753
3813
|
},
|
3754
3814
|
body: { aggs, filter },
|
3755
|
-
...__privateGet$
|
3815
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3756
3816
|
});
|
3757
3817
|
return result;
|
3758
3818
|
});
|
3759
3819
|
}
|
3760
3820
|
async query(query) {
|
3761
|
-
return __privateGet$
|
3821
|
+
return __privateGet$3(this, _trace).call(this, "query", async () => {
|
3762
3822
|
const cacheQuery = await __privateMethod$2(this, _getCacheQuery, getCacheQuery_fn).call(this, query);
|
3763
3823
|
if (cacheQuery)
|
3764
3824
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
@@ -3768,7 +3828,7 @@ class RestRepository extends Query {
|
|
3768
3828
|
workspace: "{workspaceId}",
|
3769
3829
|
dbBranchName: "{dbBranch}",
|
3770
3830
|
region: "{region}",
|
3771
|
-
tableName: __privateGet$
|
3831
|
+
tableName: __privateGet$3(this, _table)
|
3772
3832
|
},
|
3773
3833
|
body: {
|
3774
3834
|
filter: cleanFilter(data.filter),
|
@@ -3778,14 +3838,14 @@ class RestRepository extends Query {
|
|
3778
3838
|
consistency: data.consistency
|
3779
3839
|
},
|
3780
3840
|
fetchOptions: data.fetchOptions,
|
3781
|
-
...__privateGet$
|
3841
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3782
3842
|
});
|
3783
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3843
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
3784
3844
|
const records = objects.map(
|
3785
3845
|
(record) => initObject(
|
3786
|
-
__privateGet$
|
3846
|
+
__privateGet$3(this, _db),
|
3787
3847
|
schemaTables,
|
3788
|
-
__privateGet$
|
3848
|
+
__privateGet$3(this, _table),
|
3789
3849
|
record,
|
3790
3850
|
data.columns ?? ["*"]
|
3791
3851
|
)
|
@@ -3795,14 +3855,14 @@ class RestRepository extends Query {
|
|
3795
3855
|
});
|
3796
3856
|
}
|
3797
3857
|
async summarizeTable(query, summaries, summariesFilter) {
|
3798
|
-
return __privateGet$
|
3858
|
+
return __privateGet$3(this, _trace).call(this, "summarize", async () => {
|
3799
3859
|
const data = query.getQueryOptions();
|
3800
3860
|
const result = await summarizeTable({
|
3801
3861
|
pathParams: {
|
3802
3862
|
workspace: "{workspaceId}",
|
3803
3863
|
dbBranchName: "{dbBranch}",
|
3804
3864
|
region: "{region}",
|
3805
|
-
tableName: __privateGet$
|
3865
|
+
tableName: __privateGet$3(this, _table)
|
3806
3866
|
},
|
3807
3867
|
body: {
|
3808
3868
|
filter: cleanFilter(data.filter),
|
@@ -3813,9 +3873,15 @@ class RestRepository extends Query {
|
|
3813
3873
|
summaries,
|
3814
3874
|
summariesFilter
|
3815
3875
|
},
|
3816
|
-
...__privateGet$
|
3876
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3817
3877
|
});
|
3818
|
-
|
3878
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
3879
|
+
return {
|
3880
|
+
...result,
|
3881
|
+
summaries: result.summaries.map(
|
3882
|
+
(summary) => initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), summary, data.columns ?? [])
|
3883
|
+
)
|
3884
|
+
};
|
3819
3885
|
});
|
3820
3886
|
}
|
3821
3887
|
ask(question, options) {
|
@@ -3825,7 +3891,7 @@ class RestRepository extends Query {
|
|
3825
3891
|
workspace: "{workspaceId}",
|
3826
3892
|
dbBranchName: "{dbBranch}",
|
3827
3893
|
region: "{region}",
|
3828
|
-
tableName: __privateGet$
|
3894
|
+
tableName: __privateGet$3(this, _table),
|
3829
3895
|
sessionId: options?.sessionId
|
3830
3896
|
},
|
3831
3897
|
body: {
|
@@ -3835,7 +3901,7 @@ class RestRepository extends Query {
|
|
3835
3901
|
search: options?.searchType === "keyword" ? options?.search : void 0,
|
3836
3902
|
vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
|
3837
3903
|
},
|
3838
|
-
...__privateGet$
|
3904
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3839
3905
|
};
|
3840
3906
|
if (options?.onMessage) {
|
3841
3907
|
fetchSSERequest({
|
@@ -3856,7 +3922,7 @@ _table = new WeakMap();
|
|
3856
3922
|
_getFetchProps = new WeakMap();
|
3857
3923
|
_db = new WeakMap();
|
3858
3924
|
_cache = new WeakMap();
|
3859
|
-
_schemaTables
|
3925
|
+
_schemaTables = new WeakMap();
|
3860
3926
|
_trace = new WeakMap();
|
3861
3927
|
_insertRecordWithoutId = new WeakSet();
|
3862
3928
|
insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
@@ -3866,14 +3932,14 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
|
|
3866
3932
|
workspace: "{workspaceId}",
|
3867
3933
|
dbBranchName: "{dbBranch}",
|
3868
3934
|
region: "{region}",
|
3869
|
-
tableName: __privateGet$
|
3935
|
+
tableName: __privateGet$3(this, _table)
|
3870
3936
|
},
|
3871
3937
|
queryParams: { columns },
|
3872
3938
|
body: record,
|
3873
|
-
...__privateGet$
|
3939
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3874
3940
|
});
|
3875
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3876
|
-
return initObject(__privateGet$
|
3941
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
3942
|
+
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
3877
3943
|
};
|
3878
3944
|
_insertRecordWithId = new WeakSet();
|
3879
3945
|
insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
|
@@ -3885,21 +3951,21 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
|
|
3885
3951
|
workspace: "{workspaceId}",
|
3886
3952
|
dbBranchName: "{dbBranch}",
|
3887
3953
|
region: "{region}",
|
3888
|
-
tableName: __privateGet$
|
3954
|
+
tableName: __privateGet$3(this, _table),
|
3889
3955
|
recordId
|
3890
3956
|
},
|
3891
3957
|
body: record,
|
3892
3958
|
queryParams: { createOnly, columns, ifVersion },
|
3893
|
-
...__privateGet$
|
3959
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3894
3960
|
});
|
3895
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3896
|
-
return initObject(__privateGet$
|
3961
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
3962
|
+
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
3897
3963
|
};
|
3898
3964
|
_insertRecords = new WeakSet();
|
3899
3965
|
insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
3900
3966
|
const operations = await promiseMap(objects, async (object) => {
|
3901
3967
|
const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
3902
|
-
return { insert: { table: __privateGet$
|
3968
|
+
return { insert: { table: __privateGet$3(this, _table), record, createOnly, ifVersion } };
|
3903
3969
|
});
|
3904
3970
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
3905
3971
|
const ids = [];
|
@@ -3911,7 +3977,7 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
|
|
3911
3977
|
region: "{region}"
|
3912
3978
|
},
|
3913
3979
|
body: { operations: operations2 },
|
3914
|
-
...__privateGet$
|
3980
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3915
3981
|
});
|
3916
3982
|
for (const result of results) {
|
3917
3983
|
if (result.operation === "insert") {
|
@@ -3934,15 +4000,15 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
3934
4000
|
workspace: "{workspaceId}",
|
3935
4001
|
dbBranchName: "{dbBranch}",
|
3936
4002
|
region: "{region}",
|
3937
|
-
tableName: __privateGet$
|
4003
|
+
tableName: __privateGet$3(this, _table),
|
3938
4004
|
recordId
|
3939
4005
|
},
|
3940
4006
|
queryParams: { columns, ifVersion },
|
3941
4007
|
body: record,
|
3942
|
-
...__privateGet$
|
4008
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3943
4009
|
});
|
3944
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3945
|
-
return initObject(__privateGet$
|
4010
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
4011
|
+
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
3946
4012
|
} catch (e) {
|
3947
4013
|
if (isObject(e) && e.status === 404) {
|
3948
4014
|
return null;
|
@@ -3954,7 +4020,7 @@ _updateRecords = new WeakSet();
|
|
3954
4020
|
updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
3955
4021
|
const operations = await promiseMap(objects, async ({ id, ...object }) => {
|
3956
4022
|
const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
|
3957
|
-
return { update: { table: __privateGet$
|
4023
|
+
return { update: { table: __privateGet$3(this, _table), id, ifVersion, upsert, fields } };
|
3958
4024
|
});
|
3959
4025
|
const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
|
3960
4026
|
const ids = [];
|
@@ -3966,7 +4032,7 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
|
|
3966
4032
|
region: "{region}"
|
3967
4033
|
},
|
3968
4034
|
body: { operations: operations2 },
|
3969
|
-
...__privateGet$
|
4035
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3970
4036
|
});
|
3971
4037
|
for (const result of results) {
|
3972
4038
|
if (result.operation === "update") {
|
@@ -3987,15 +4053,15 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
|
|
3987
4053
|
workspace: "{workspaceId}",
|
3988
4054
|
dbBranchName: "{dbBranch}",
|
3989
4055
|
region: "{region}",
|
3990
|
-
tableName: __privateGet$
|
4056
|
+
tableName: __privateGet$3(this, _table),
|
3991
4057
|
recordId
|
3992
4058
|
},
|
3993
4059
|
queryParams: { columns, ifVersion },
|
3994
4060
|
body: object,
|
3995
|
-
...__privateGet$
|
4061
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
3996
4062
|
});
|
3997
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
3998
|
-
return initObject(__privateGet$
|
4063
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
4064
|
+
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
3999
4065
|
};
|
4000
4066
|
_deleteRecord = new WeakSet();
|
4001
4067
|
deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
@@ -4007,14 +4073,14 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
4007
4073
|
workspace: "{workspaceId}",
|
4008
4074
|
dbBranchName: "{dbBranch}",
|
4009
4075
|
region: "{region}",
|
4010
|
-
tableName: __privateGet$
|
4076
|
+
tableName: __privateGet$3(this, _table),
|
4011
4077
|
recordId
|
4012
4078
|
},
|
4013
4079
|
queryParams: { columns },
|
4014
|
-
...__privateGet$
|
4080
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
4015
4081
|
});
|
4016
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
4017
|
-
return initObject(__privateGet$
|
4082
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
4083
|
+
return initObject(__privateGet$3(this, _db), schemaTables, __privateGet$3(this, _table), response, columns);
|
4018
4084
|
} catch (e) {
|
4019
4085
|
if (isObject(e) && e.status === 404) {
|
4020
4086
|
return null;
|
@@ -4025,7 +4091,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
|
|
4025
4091
|
_deleteRecords = new WeakSet();
|
4026
4092
|
deleteRecords_fn = async function(recordIds) {
|
4027
4093
|
const chunkedOperations = chunk(
|
4028
|
-
compact(recordIds).map((id) => ({ delete: { table: __privateGet$
|
4094
|
+
compact(recordIds).map((id) => ({ delete: { table: __privateGet$3(this, _table), id } })),
|
4029
4095
|
BULK_OPERATION_MAX_SIZE
|
4030
4096
|
);
|
4031
4097
|
for (const operations of chunkedOperations) {
|
@@ -4036,44 +4102,44 @@ deleteRecords_fn = async function(recordIds) {
|
|
4036
4102
|
region: "{region}"
|
4037
4103
|
},
|
4038
4104
|
body: { operations },
|
4039
|
-
...__privateGet$
|
4105
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
4040
4106
|
});
|
4041
4107
|
}
|
4042
4108
|
};
|
4043
4109
|
_setCacheQuery = new WeakSet();
|
4044
4110
|
setCacheQuery_fn = async function(query, meta, records) {
|
4045
|
-
await __privateGet$
|
4111
|
+
await __privateGet$3(this, _cache)?.set(`query_${__privateGet$3(this, _table)}:${query.key()}`, { date: /* @__PURE__ */ new Date(), meta, records });
|
4046
4112
|
};
|
4047
4113
|
_getCacheQuery = new WeakSet();
|
4048
4114
|
getCacheQuery_fn = async function(query) {
|
4049
|
-
const key = `query_${__privateGet$
|
4050
|
-
const result = await __privateGet$
|
4115
|
+
const key = `query_${__privateGet$3(this, _table)}:${query.key()}`;
|
4116
|
+
const result = await __privateGet$3(this, _cache)?.get(key);
|
4051
4117
|
if (!result)
|
4052
4118
|
return null;
|
4053
|
-
const defaultTTL = __privateGet$
|
4119
|
+
const defaultTTL = __privateGet$3(this, _cache)?.defaultQueryTTL ?? -1;
|
4054
4120
|
const { cache: ttl = defaultTTL } = query.getQueryOptions();
|
4055
4121
|
if (ttl < 0)
|
4056
4122
|
return null;
|
4057
4123
|
const hasExpired = result.date.getTime() + ttl < Date.now();
|
4058
4124
|
return hasExpired ? null : result;
|
4059
4125
|
};
|
4060
|
-
_getSchemaTables
|
4061
|
-
getSchemaTables_fn
|
4062
|
-
if (__privateGet$
|
4063
|
-
return __privateGet$
|
4126
|
+
_getSchemaTables = new WeakSet();
|
4127
|
+
getSchemaTables_fn = async function() {
|
4128
|
+
if (__privateGet$3(this, _schemaTables))
|
4129
|
+
return __privateGet$3(this, _schemaTables);
|
4064
4130
|
const { schema } = await getBranchDetails({
|
4065
4131
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4066
|
-
...__privateGet$
|
4132
|
+
...__privateGet$3(this, _getFetchProps).call(this)
|
4067
4133
|
});
|
4068
|
-
__privateSet$
|
4134
|
+
__privateSet$2(this, _schemaTables, schema.tables);
|
4069
4135
|
return schema.tables;
|
4070
4136
|
};
|
4071
4137
|
_transformObjectToApi = new WeakSet();
|
4072
4138
|
transformObjectToApi_fn = async function(object) {
|
4073
|
-
const schemaTables = await __privateMethod$2(this, _getSchemaTables
|
4074
|
-
const schema = schemaTables.find((table) => table.name === __privateGet$
|
4139
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables, getSchemaTables_fn).call(this);
|
4140
|
+
const schema = schemaTables.find((table) => table.name === __privateGet$3(this, _table));
|
4075
4141
|
if (!schema)
|
4076
|
-
throw new Error(`Table ${__privateGet$
|
4142
|
+
throw new Error(`Table ${__privateGet$3(this, _table)} not found in schema`);
|
4077
4143
|
const result = {};
|
4078
4144
|
for (const [key, value] of Object.entries(object)) {
|
4079
4145
|
if (key === "xata")
|
@@ -4186,7 +4252,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4186
4252
|
record.delete = function() {
|
4187
4253
|
return db[table].delete(record["id"]);
|
4188
4254
|
};
|
4189
|
-
|
4255
|
+
if (metadata !== void 0) {
|
4256
|
+
record.xata = Object.freeze(metadata);
|
4257
|
+
}
|
4190
4258
|
record.getMetadata = function() {
|
4191
4259
|
return record.xata;
|
4192
4260
|
};
|
@@ -4227,7 +4295,7 @@ var __accessCheck$3 = (obj, member, msg) => {
|
|
4227
4295
|
if (!member.has(obj))
|
4228
4296
|
throw TypeError("Cannot " + msg);
|
4229
4297
|
};
|
4230
|
-
var __privateGet$
|
4298
|
+
var __privateGet$2 = (obj, member, getter) => {
|
4231
4299
|
__accessCheck$3(obj, member, "read from private field");
|
4232
4300
|
return getter ? getter.call(obj) : member.get(obj);
|
4233
4301
|
};
|
@@ -4236,7 +4304,7 @@ var __privateAdd$3 = (obj, member, value) => {
|
|
4236
4304
|
throw TypeError("Cannot add the same private member more than once");
|
4237
4305
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4238
4306
|
};
|
4239
|
-
var __privateSet$
|
4307
|
+
var __privateSet$1 = (obj, member, value, setter) => {
|
4240
4308
|
__accessCheck$3(obj, member, "write to private field");
|
4241
4309
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
4242
4310
|
return value;
|
@@ -4245,29 +4313,29 @@ var _map;
|
|
4245
4313
|
class SimpleCache {
|
4246
4314
|
constructor(options = {}) {
|
4247
4315
|
__privateAdd$3(this, _map, void 0);
|
4248
|
-
__privateSet$
|
4316
|
+
__privateSet$1(this, _map, /* @__PURE__ */ new Map());
|
4249
4317
|
this.capacity = options.max ?? 500;
|
4250
4318
|
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
4251
4319
|
}
|
4252
4320
|
async getAll() {
|
4253
|
-
return Object.fromEntries(__privateGet$
|
4321
|
+
return Object.fromEntries(__privateGet$2(this, _map));
|
4254
4322
|
}
|
4255
4323
|
async get(key) {
|
4256
|
-
return __privateGet$
|
4324
|
+
return __privateGet$2(this, _map).get(key) ?? null;
|
4257
4325
|
}
|
4258
4326
|
async set(key, value) {
|
4259
4327
|
await this.delete(key);
|
4260
|
-
__privateGet$
|
4261
|
-
if (__privateGet$
|
4262
|
-
const leastRecentlyUsed = __privateGet$
|
4328
|
+
__privateGet$2(this, _map).set(key, value);
|
4329
|
+
if (__privateGet$2(this, _map).size > this.capacity) {
|
4330
|
+
const leastRecentlyUsed = __privateGet$2(this, _map).keys().next().value;
|
4263
4331
|
await this.delete(leastRecentlyUsed);
|
4264
4332
|
}
|
4265
4333
|
}
|
4266
4334
|
async delete(key) {
|
4267
|
-
__privateGet$
|
4335
|
+
__privateGet$2(this, _map).delete(key);
|
4268
4336
|
}
|
4269
4337
|
async clear() {
|
4270
|
-
return __privateGet$
|
4338
|
+
return __privateGet$2(this, _map).clear();
|
4271
4339
|
}
|
4272
4340
|
}
|
4273
4341
|
_map = new WeakMap();
|
@@ -4289,10 +4357,12 @@ const notExists = (column) => ({ $notExists: column });
|
|
4289
4357
|
const startsWith = (value) => ({ $startsWith: value });
|
4290
4358
|
const endsWith = (value) => ({ $endsWith: value });
|
4291
4359
|
const pattern = (value) => ({ $pattern: value });
|
4360
|
+
const iPattern = (value) => ({ $iPattern: value });
|
4292
4361
|
const is = (value) => ({ $is: value });
|
4293
4362
|
const equals = is;
|
4294
4363
|
const isNot = (value) => ({ $isNot: value });
|
4295
4364
|
const contains = (value) => ({ $contains: value });
|
4365
|
+
const iContains = (value) => ({ $iContains: value });
|
4296
4366
|
const includes = (value) => ({ $includes: value });
|
4297
4367
|
const includesAll = (value) => ({ $includesAll: value });
|
4298
4368
|
const includesNone = (value) => ({ $includesNone: value });
|
@@ -4302,7 +4372,7 @@ var __accessCheck$2 = (obj, member, msg) => {
|
|
4302
4372
|
if (!member.has(obj))
|
4303
4373
|
throw TypeError("Cannot " + msg);
|
4304
4374
|
};
|
4305
|
-
var __privateGet$
|
4375
|
+
var __privateGet$1 = (obj, member, getter) => {
|
4306
4376
|
__accessCheck$2(obj, member, "read from private field");
|
4307
4377
|
return getter ? getter.call(obj) : member.get(obj);
|
4308
4378
|
};
|
@@ -4311,18 +4381,11 @@ var __privateAdd$2 = (obj, member, value) => {
|
|
4311
4381
|
throw TypeError("Cannot add the same private member more than once");
|
4312
4382
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4313
4383
|
};
|
4314
|
-
var
|
4315
|
-
__accessCheck$2(obj, member, "write to private field");
|
4316
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
4317
|
-
return value;
|
4318
|
-
};
|
4319
|
-
var _tables, _schemaTables$1;
|
4384
|
+
var _tables;
|
4320
4385
|
class SchemaPlugin extends XataPlugin {
|
4321
|
-
constructor(
|
4386
|
+
constructor() {
|
4322
4387
|
super();
|
4323
4388
|
__privateAdd$2(this, _tables, {});
|
4324
|
-
__privateAdd$2(this, _schemaTables$1, void 0);
|
4325
|
-
__privateSet$2(this, _schemaTables$1, schemaTables);
|
4326
4389
|
}
|
4327
4390
|
build(pluginOptions) {
|
4328
4391
|
const db = new Proxy(
|
@@ -4331,100 +4394,151 @@ class SchemaPlugin extends XataPlugin {
|
|
4331
4394
|
get: (_target, table) => {
|
4332
4395
|
if (!isString(table))
|
4333
4396
|
throw new Error("Invalid table name");
|
4334
|
-
if (__privateGet$
|
4335
|
-
__privateGet$
|
4397
|
+
if (__privateGet$1(this, _tables)[table] === void 0) {
|
4398
|
+
__privateGet$1(this, _tables)[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
|
4336
4399
|
}
|
4337
|
-
return __privateGet$
|
4400
|
+
return __privateGet$1(this, _tables)[table];
|
4338
4401
|
}
|
4339
4402
|
}
|
4340
4403
|
);
|
4341
|
-
const tableNames =
|
4404
|
+
const tableNames = pluginOptions.tables?.map(({ name }) => name) ?? [];
|
4342
4405
|
for (const table of tableNames) {
|
4343
|
-
db[table] = new RestRepository({ db, pluginOptions, table, schemaTables:
|
4406
|
+
db[table] = new RestRepository({ db, pluginOptions, table, schemaTables: pluginOptions.tables });
|
4344
4407
|
}
|
4345
4408
|
return db;
|
4346
4409
|
}
|
4347
4410
|
}
|
4348
4411
|
_tables = new WeakMap();
|
4349
|
-
|
4412
|
+
|
4413
|
+
class FilesPlugin extends XataPlugin {
|
4414
|
+
build(pluginOptions) {
|
4415
|
+
return {
|
4416
|
+
download: async (location) => {
|
4417
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
4418
|
+
return await getFileItem({
|
4419
|
+
pathParams: {
|
4420
|
+
workspace: "{workspaceId}",
|
4421
|
+
dbBranchName: "{dbBranch}",
|
4422
|
+
region: "{region}",
|
4423
|
+
tableName: table ?? "",
|
4424
|
+
recordId: record ?? "",
|
4425
|
+
columnName: column ?? "",
|
4426
|
+
fileId
|
4427
|
+
},
|
4428
|
+
...pluginOptions,
|
4429
|
+
rawResponse: true
|
4430
|
+
});
|
4431
|
+
},
|
4432
|
+
upload: async (location, file, options) => {
|
4433
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
4434
|
+
const resolvedFile = await file;
|
4435
|
+
const contentType = options?.mediaType || getContentType(resolvedFile);
|
4436
|
+
const body = resolvedFile instanceof XataFile ? resolvedFile.toBlob() : resolvedFile;
|
4437
|
+
return await putFileItem({
|
4438
|
+
...pluginOptions,
|
4439
|
+
pathParams: {
|
4440
|
+
workspace: "{workspaceId}",
|
4441
|
+
dbBranchName: "{dbBranch}",
|
4442
|
+
region: "{region}",
|
4443
|
+
tableName: table ?? "",
|
4444
|
+
recordId: record ?? "",
|
4445
|
+
columnName: column ?? "",
|
4446
|
+
fileId
|
4447
|
+
},
|
4448
|
+
body,
|
4449
|
+
headers: { "Content-Type": contentType }
|
4450
|
+
});
|
4451
|
+
},
|
4452
|
+
delete: async (location) => {
|
4453
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
4454
|
+
return await deleteFileItem({
|
4455
|
+
pathParams: {
|
4456
|
+
workspace: "{workspaceId}",
|
4457
|
+
dbBranchName: "{dbBranch}",
|
4458
|
+
region: "{region}",
|
4459
|
+
tableName: table ?? "",
|
4460
|
+
recordId: record ?? "",
|
4461
|
+
columnName: column ?? "",
|
4462
|
+
fileId
|
4463
|
+
},
|
4464
|
+
...pluginOptions
|
4465
|
+
});
|
4466
|
+
}
|
4467
|
+
};
|
4468
|
+
}
|
4469
|
+
}
|
4470
|
+
function getContentType(file) {
|
4471
|
+
if (typeof file === "string") {
|
4472
|
+
return "text/plain";
|
4473
|
+
}
|
4474
|
+
if ("mediaType" in file && file.mediaType !== void 0) {
|
4475
|
+
return file.mediaType;
|
4476
|
+
}
|
4477
|
+
if (isBlob(file)) {
|
4478
|
+
return file.type;
|
4479
|
+
}
|
4480
|
+
try {
|
4481
|
+
return file.type;
|
4482
|
+
} catch (e) {
|
4483
|
+
}
|
4484
|
+
return "application/octet-stream";
|
4485
|
+
}
|
4350
4486
|
|
4351
4487
|
var __accessCheck$1 = (obj, member, msg) => {
|
4352
4488
|
if (!member.has(obj))
|
4353
4489
|
throw TypeError("Cannot " + msg);
|
4354
4490
|
};
|
4355
|
-
var __privateGet$1 = (obj, member, getter) => {
|
4356
|
-
__accessCheck$1(obj, member, "read from private field");
|
4357
|
-
return getter ? getter.call(obj) : member.get(obj);
|
4358
|
-
};
|
4359
4491
|
var __privateAdd$1 = (obj, member, value) => {
|
4360
4492
|
if (member.has(obj))
|
4361
4493
|
throw TypeError("Cannot add the same private member more than once");
|
4362
4494
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
4363
4495
|
};
|
4364
|
-
var __privateSet$1 = (obj, member, value, setter) => {
|
4365
|
-
__accessCheck$1(obj, member, "write to private field");
|
4366
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
4367
|
-
return value;
|
4368
|
-
};
|
4369
4496
|
var __privateMethod$1 = (obj, member, method) => {
|
4370
4497
|
__accessCheck$1(obj, member, "access private method");
|
4371
4498
|
return method;
|
4372
4499
|
};
|
4373
|
-
var
|
4500
|
+
var _search, search_fn;
|
4374
4501
|
class SearchPlugin extends XataPlugin {
|
4375
|
-
constructor(db
|
4502
|
+
constructor(db) {
|
4376
4503
|
super();
|
4377
4504
|
this.db = db;
|
4378
4505
|
__privateAdd$1(this, _search);
|
4379
|
-
__privateAdd$1(this, _getSchemaTables);
|
4380
|
-
__privateAdd$1(this, _schemaTables, void 0);
|
4381
|
-
__privateSet$1(this, _schemaTables, schemaTables);
|
4382
4506
|
}
|
4383
4507
|
build(pluginOptions) {
|
4384
4508
|
return {
|
4385
4509
|
all: async (query, options = {}) => {
|
4386
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
4387
|
-
|
4388
|
-
|
4389
|
-
|
4390
|
-
|
4391
|
-
|
4510
|
+
const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
4511
|
+
return {
|
4512
|
+
totalCount,
|
4513
|
+
records: records.map((record) => {
|
4514
|
+
const { table = "orphan" } = record.xata;
|
4515
|
+
return { table, record: initObject(this.db, pluginOptions.tables, table, record, ["*"]) };
|
4516
|
+
})
|
4517
|
+
};
|
4392
4518
|
},
|
4393
4519
|
byTable: async (query, options = {}) => {
|
4394
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
4395
|
-
const
|
4396
|
-
return records.reduce((acc, record) => {
|
4520
|
+
const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
4521
|
+
const records = rawRecords.reduce((acc, record) => {
|
4397
4522
|
const { table = "orphan" } = record.xata;
|
4398
4523
|
const items = acc[table] ?? [];
|
4399
|
-
const item = initObject(this.db,
|
4524
|
+
const item = initObject(this.db, pluginOptions.tables, table, record, ["*"]);
|
4400
4525
|
return { ...acc, [table]: [...items, item] };
|
4401
4526
|
}, {});
|
4527
|
+
return { totalCount, records };
|
4402
4528
|
}
|
4403
4529
|
};
|
4404
4530
|
}
|
4405
4531
|
}
|
4406
|
-
_schemaTables = new WeakMap();
|
4407
4532
|
_search = new WeakSet();
|
4408
4533
|
search_fn = async function(query, options, pluginOptions) {
|
4409
4534
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
4410
|
-
const { records } = await searchBranch({
|
4535
|
+
const { records, totalCount } = await searchBranch({
|
4411
4536
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4412
|
-
// @ts-
|
4537
|
+
// @ts-expect-error Filter properties do not match inferred type
|
4413
4538
|
body: { tables, query, fuzziness, prefix, highlight, page },
|
4414
4539
|
...pluginOptions
|
4415
4540
|
});
|
4416
|
-
return records;
|
4417
|
-
};
|
4418
|
-
_getSchemaTables = new WeakSet();
|
4419
|
-
getSchemaTables_fn = async function(pluginOptions) {
|
4420
|
-
if (__privateGet$1(this, _schemaTables))
|
4421
|
-
return __privateGet$1(this, _schemaTables);
|
4422
|
-
const { schema } = await getBranchDetails({
|
4423
|
-
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4424
|
-
...pluginOptions
|
4425
|
-
});
|
4426
|
-
__privateSet$1(this, _schemaTables, schema.tables);
|
4427
|
-
return schema.tables;
|
4541
|
+
return { records, totalCount };
|
4428
4542
|
};
|
4429
4543
|
|
4430
4544
|
function escapeElement(elementRepresentation) {
|
@@ -4479,25 +4593,39 @@ function prepareParams(param1, param2) {
|
|
4479
4593
|
return { statement, params: param2?.map((value) => prepareValue(value)) };
|
4480
4594
|
}
|
4481
4595
|
if (isObject(param1)) {
|
4482
|
-
const { statement, params, consistency } = param1;
|
4483
|
-
return { statement, params: params?.map((value) => prepareValue(value)), consistency };
|
4596
|
+
const { statement, params, consistency, responseType } = param1;
|
4597
|
+
return { statement, params: params?.map((value) => prepareValue(value)), consistency, responseType };
|
4484
4598
|
}
|
4485
4599
|
throw new Error("Invalid query");
|
4486
4600
|
}
|
4487
4601
|
|
4488
4602
|
class SQLPlugin extends XataPlugin {
|
4489
4603
|
build(pluginOptions) {
|
4490
|
-
return async (
|
4491
|
-
|
4492
|
-
|
4604
|
+
return async (query, ...parameters) => {
|
4605
|
+
if (!isParamsObject(query) && (!isTemplateStringsArray(query) || !Array.isArray(parameters))) {
|
4606
|
+
throw new Error("Invalid usage of `xata.sql`. Please use it as a tagged template or with an object.");
|
4607
|
+
}
|
4608
|
+
const { statement, params, consistency, responseType } = prepareParams(query, parameters);
|
4609
|
+
const {
|
4610
|
+
records,
|
4611
|
+
rows,
|
4612
|
+
warning,
|
4613
|
+
columns = []
|
4614
|
+
} = await sqlQuery({
|
4493
4615
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4494
|
-
body: { statement, params, consistency },
|
4616
|
+
body: { statement, params, consistency, responseType },
|
4495
4617
|
...pluginOptions
|
4496
4618
|
});
|
4497
|
-
return { records, warning };
|
4619
|
+
return { records, rows, warning, columns };
|
4498
4620
|
};
|
4499
4621
|
}
|
4500
4622
|
}
|
4623
|
+
function isTemplateStringsArray(strings) {
|
4624
|
+
return Array.isArray(strings) && "raw" in strings && Array.isArray(strings.raw);
|
4625
|
+
}
|
4626
|
+
function isParamsObject(params) {
|
4627
|
+
return isObject(params) && "statement" in params;
|
4628
|
+
}
|
4501
4629
|
|
4502
4630
|
class TransactionPlugin extends XataPlugin {
|
4503
4631
|
build(pluginOptions) {
|
@@ -4539,7 +4667,7 @@ var __privateMethod = (obj, member, method) => {
|
|
4539
4667
|
const buildClient = (plugins) => {
|
4540
4668
|
var _options, _parseOptions, parseOptions_fn, _getFetchProps, getFetchProps_fn, _a;
|
4541
4669
|
return _a = class {
|
4542
|
-
constructor(options = {},
|
4670
|
+
constructor(options = {}, tables) {
|
4543
4671
|
__privateAdd(this, _parseOptions);
|
4544
4672
|
__privateAdd(this, _getFetchProps);
|
4545
4673
|
__privateAdd(this, _options, void 0);
|
@@ -4548,13 +4676,15 @@ const buildClient = (plugins) => {
|
|
4548
4676
|
const pluginOptions = {
|
4549
4677
|
...__privateMethod(this, _getFetchProps, getFetchProps_fn).call(this, safeOptions),
|
4550
4678
|
cache: safeOptions.cache,
|
4551
|
-
host: safeOptions.host
|
4679
|
+
host: safeOptions.host,
|
4680
|
+
tables
|
4552
4681
|
};
|
4553
|
-
const db = new SchemaPlugin(
|
4554
|
-
const search = new SearchPlugin(db
|
4682
|
+
const db = new SchemaPlugin().build(pluginOptions);
|
4683
|
+
const search = new SearchPlugin(db).build(pluginOptions);
|
4555
4684
|
const transactions = new TransactionPlugin().build(pluginOptions);
|
4556
4685
|
const sql = new SQLPlugin().build(pluginOptions);
|
4557
4686
|
const files = new FilesPlugin().build(pluginOptions);
|
4687
|
+
this.schema = { tables };
|
4558
4688
|
this.db = db;
|
4559
4689
|
this.search = search;
|
4560
4690
|
this.transactions = transactions;
|
@@ -4576,7 +4706,7 @@ const buildClient = (plugins) => {
|
|
4576
4706
|
const isBrowser = typeof window !== "undefined" && typeof Deno === "undefined";
|
4577
4707
|
if (isBrowser && !enableBrowser) {
|
4578
4708
|
throw new Error(
|
4579
|
-
"You are trying to use Xata from the browser, which is potentially a non-secure environment.
|
4709
|
+
"You are trying to use Xata from the browser, which is potentially a non-secure environment. How to fix: https://xata.io/docs/messages/api-key-browser-error"
|
4580
4710
|
);
|
4581
4711
|
}
|
4582
4712
|
const fetch = getFetchImplementation(options?.fetch);
|
@@ -4723,21 +4853,6 @@ const deserialize = (json) => {
|
|
4723
4853
|
return defaultSerializer.fromJSON(json);
|
4724
4854
|
};
|
4725
4855
|
|
4726
|
-
function buildWorkerRunner(config) {
|
4727
|
-
return function xataWorker(name, worker) {
|
4728
|
-
return async (...args) => {
|
4729
|
-
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
4730
|
-
const result = await fetch(url, {
|
4731
|
-
method: "POST",
|
4732
|
-
headers: { "Content-Type": "application/json" },
|
4733
|
-
body: serialize({ args })
|
4734
|
-
});
|
4735
|
-
const text = await result.text();
|
4736
|
-
return deserialize(text);
|
4737
|
-
};
|
4738
|
-
};
|
4739
|
-
}
|
4740
|
-
|
4741
4856
|
class XataError extends Error {
|
4742
4857
|
constructor(message, status) {
|
4743
4858
|
super(message);
|
@@ -4754,6 +4869,7 @@ exports.PAGINATION_DEFAULT_SIZE = PAGINATION_DEFAULT_SIZE;
|
|
4754
4869
|
exports.PAGINATION_MAX_OFFSET = PAGINATION_MAX_OFFSET;
|
4755
4870
|
exports.PAGINATION_MAX_SIZE = PAGINATION_MAX_SIZE;
|
4756
4871
|
exports.Page = Page;
|
4872
|
+
exports.PageRecordArray = PageRecordArray;
|
4757
4873
|
exports.Query = Query;
|
4758
4874
|
exports.RecordArray = RecordArray;
|
4759
4875
|
exports.RecordColumnTypes = RecordColumnTypes;
|
@@ -4764,23 +4880,25 @@ exports.SchemaPlugin = SchemaPlugin;
|
|
4764
4880
|
exports.SearchPlugin = SearchPlugin;
|
4765
4881
|
exports.Serializer = Serializer;
|
4766
4882
|
exports.SimpleCache = SimpleCache;
|
4883
|
+
exports.TransactionPlugin = TransactionPlugin;
|
4767
4884
|
exports.XataApiClient = XataApiClient;
|
4768
4885
|
exports.XataApiPlugin = XataApiPlugin;
|
4769
4886
|
exports.XataError = XataError;
|
4770
4887
|
exports.XataFile = XataFile;
|
4771
4888
|
exports.XataPlugin = XataPlugin;
|
4772
4889
|
exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
|
4890
|
+
exports.adaptTable = adaptTable;
|
4773
4891
|
exports.addGitBranchesEntry = addGitBranchesEntry;
|
4774
4892
|
exports.addTableColumn = addTableColumn;
|
4775
4893
|
exports.aggregateTable = aggregateTable;
|
4776
4894
|
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
4895
|
+
exports.applyMigration = applyMigration;
|
4777
4896
|
exports.askTable = askTable;
|
4778
4897
|
exports.askTableSession = askTableSession;
|
4779
4898
|
exports.branchTransaction = branchTransaction;
|
4780
4899
|
exports.buildClient = buildClient;
|
4781
4900
|
exports.buildPreviewBranchName = buildPreviewBranchName;
|
4782
4901
|
exports.buildProviderString = buildProviderString;
|
4783
|
-
exports.buildWorkerRunner = buildWorkerRunner;
|
4784
4902
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
4785
4903
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
4786
4904
|
exports.compareBranchSchemas = compareBranchSchemas;
|
@@ -4814,6 +4932,7 @@ exports.equals = equals;
|
|
4814
4932
|
exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
|
4815
4933
|
exports.exists = exists;
|
4816
4934
|
exports.fileAccess = fileAccess;
|
4935
|
+
exports.fileUpload = fileUpload;
|
4817
4936
|
exports.ge = ge;
|
4818
4937
|
exports.getAPIKey = getAPIKey;
|
4819
4938
|
exports.getAuthorizationCode = getAuthorizationCode;
|
@@ -4822,6 +4941,7 @@ exports.getBranchDetails = getBranchDetails;
|
|
4822
4941
|
exports.getBranchList = getBranchList;
|
4823
4942
|
exports.getBranchMetadata = getBranchMetadata;
|
4824
4943
|
exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
4944
|
+
exports.getBranchMigrationJobStatus = getBranchMigrationJobStatus;
|
4825
4945
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
4826
4946
|
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
4827
4947
|
exports.getBranchStats = getBranchStats;
|
@@ -4830,15 +4950,19 @@ exports.getColumn = getColumn;
|
|
4830
4950
|
exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
|
4831
4951
|
exports.getDatabaseList = getDatabaseList;
|
4832
4952
|
exports.getDatabaseMetadata = getDatabaseMetadata;
|
4953
|
+
exports.getDatabaseSettings = getDatabaseSettings;
|
4833
4954
|
exports.getDatabaseURL = getDatabaseURL;
|
4834
4955
|
exports.getFile = getFile;
|
4835
4956
|
exports.getFileItem = getFileItem;
|
4836
4957
|
exports.getGitBranchesMapping = getGitBranchesMapping;
|
4837
4958
|
exports.getHostUrl = getHostUrl;
|
4959
|
+
exports.getMigrationHistory = getMigrationHistory;
|
4960
|
+
exports.getMigrationJobStatus = getMigrationJobStatus;
|
4838
4961
|
exports.getMigrationRequest = getMigrationRequest;
|
4839
4962
|
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
4840
4963
|
exports.getPreviewBranch = getPreviewBranch;
|
4841
4964
|
exports.getRecord = getRecord;
|
4965
|
+
exports.getSchema = getSchema;
|
4842
4966
|
exports.getTableColumns = getTableColumns;
|
4843
4967
|
exports.getTableSchema = getTableSchema;
|
4844
4968
|
exports.getUser = getUser;
|
@@ -4847,6 +4971,7 @@ exports.getUserOAuthAccessTokens = getUserOAuthAccessTokens;
|
|
4847
4971
|
exports.getUserOAuthClients = getUserOAuthClients;
|
4848
4972
|
exports.getWorkspace = getWorkspace;
|
4849
4973
|
exports.getWorkspaceMembersList = getWorkspaceMembersList;
|
4974
|
+
exports.getWorkspaceSettings = getWorkspaceSettings;
|
4850
4975
|
exports.getWorkspacesList = getWorkspacesList;
|
4851
4976
|
exports.grantAuthorizationCode = grantAuthorizationCode;
|
4852
4977
|
exports.greaterEquals = greaterEquals;
|
@@ -4854,6 +4979,8 @@ exports.greaterThan = greaterThan;
|
|
4854
4979
|
exports.greaterThanEquals = greaterThanEquals;
|
4855
4980
|
exports.gt = gt;
|
4856
4981
|
exports.gte = gte;
|
4982
|
+
exports.iContains = iContains;
|
4983
|
+
exports.iPattern = iPattern;
|
4857
4984
|
exports.includes = includes;
|
4858
4985
|
exports.includesAll = includesAll;
|
4859
4986
|
exports.includesAny = includesAny;
|
@@ -4910,6 +5037,7 @@ exports.updateCluster = updateCluster;
|
|
4910
5037
|
exports.updateColumn = updateColumn;
|
4911
5038
|
exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
|
4912
5039
|
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|
5040
|
+
exports.updateDatabaseSettings = updateDatabaseSettings;
|
4913
5041
|
exports.updateMigrationRequest = updateMigrationRequest;
|
4914
5042
|
exports.updateOAuthAccessToken = updateOAuthAccessToken;
|
4915
5043
|
exports.updateRecordWithID = updateRecordWithID;
|
@@ -4918,6 +5046,7 @@ exports.updateUser = updateUser;
|
|
4918
5046
|
exports.updateWorkspace = updateWorkspace;
|
4919
5047
|
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
|
4920
5048
|
exports.updateWorkspaceMemberRole = updateWorkspaceMemberRole;
|
5049
|
+
exports.updateWorkspaceSettings = updateWorkspaceSettings;
|
4921
5050
|
exports.upsertRecordWithID = upsertRecordWithID;
|
4922
5051
|
exports.vectorSearchTable = vectorSearchTable;
|
4923
5052
|
//# sourceMappingURL=index.cjs.map
|