@xata.io/client 0.0.0-alpha.vfdc5c07 → 0.0.0-alpha.vfdd8c9fa700ee4d676771b5b8b8052b7734cb8c4
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 +4 -4
- package/CHANGELOG.md +50 -2
- package/dist/index.cjs +433 -1658
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2892 -3314
- package/dist/index.mjs +429 -1658
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -242,26 +242,26 @@ function getPreviewBranch() {
|
|
242
242
|
}
|
243
243
|
}
|
244
244
|
|
245
|
-
var __accessCheck$
|
245
|
+
var __accessCheck$7 = (obj, member, msg) => {
|
246
246
|
if (!member.has(obj))
|
247
247
|
throw TypeError("Cannot " + msg);
|
248
248
|
};
|
249
|
-
var __privateGet$
|
250
|
-
__accessCheck$
|
249
|
+
var __privateGet$7 = (obj, member, getter) => {
|
250
|
+
__accessCheck$7(obj, member, "read from private field");
|
251
251
|
return getter ? getter.call(obj) : member.get(obj);
|
252
252
|
};
|
253
|
-
var __privateAdd$
|
253
|
+
var __privateAdd$7 = (obj, member, value) => {
|
254
254
|
if (member.has(obj))
|
255
255
|
throw TypeError("Cannot add the same private member more than once");
|
256
256
|
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
257
257
|
};
|
258
|
-
var __privateSet$
|
259
|
-
__accessCheck$
|
258
|
+
var __privateSet$7 = (obj, member, value, setter) => {
|
259
|
+
__accessCheck$7(obj, member, "write to private field");
|
260
260
|
setter ? setter.call(obj, value) : member.set(obj, value);
|
261
261
|
return value;
|
262
262
|
};
|
263
263
|
var __privateMethod$4 = (obj, member, method) => {
|
264
|
-
__accessCheck$
|
264
|
+
__accessCheck$7(obj, member, "access private method");
|
265
265
|
return method;
|
266
266
|
};
|
267
267
|
var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
|
@@ -277,23 +277,23 @@ function getFetchImplementation(userFetch) {
|
|
277
277
|
}
|
278
278
|
class ApiRequestPool {
|
279
279
|
constructor(concurrency = 10) {
|
280
|
-
__privateAdd$
|
281
|
-
__privateAdd$
|
282
|
-
__privateAdd$
|
283
|
-
__privateAdd$
|
284
|
-
__privateSet$
|
285
|
-
__privateSet$
|
280
|
+
__privateAdd$7(this, _enqueue);
|
281
|
+
__privateAdd$7(this, _fetch, void 0);
|
282
|
+
__privateAdd$7(this, _queue, void 0);
|
283
|
+
__privateAdd$7(this, _concurrency, void 0);
|
284
|
+
__privateSet$7(this, _queue, []);
|
285
|
+
__privateSet$7(this, _concurrency, concurrency);
|
286
286
|
this.running = 0;
|
287
287
|
this.started = 0;
|
288
288
|
}
|
289
289
|
setFetch(fetch2) {
|
290
|
-
__privateSet$
|
290
|
+
__privateSet$7(this, _fetch, fetch2);
|
291
291
|
}
|
292
292
|
getFetch() {
|
293
|
-
if (!__privateGet$
|
293
|
+
if (!__privateGet$7(this, _fetch)) {
|
294
294
|
throw new Error("Fetch not set");
|
295
295
|
}
|
296
|
-
return __privateGet$
|
296
|
+
return __privateGet$7(this, _fetch);
|
297
297
|
}
|
298
298
|
request(url, options) {
|
299
299
|
const start = /* @__PURE__ */ new Date();
|
@@ -325,19 +325,19 @@ _queue = new WeakMap();
|
|
325
325
|
_concurrency = new WeakMap();
|
326
326
|
_enqueue = new WeakSet();
|
327
327
|
enqueue_fn = function(task) {
|
328
|
-
const promise = new Promise((resolve) => __privateGet$
|
328
|
+
const promise = new Promise((resolve) => __privateGet$7(this, _queue).push(resolve)).finally(() => {
|
329
329
|
this.started--;
|
330
330
|
this.running++;
|
331
331
|
}).then(() => task()).finally(() => {
|
332
332
|
this.running--;
|
333
|
-
const next = __privateGet$
|
333
|
+
const next = __privateGet$7(this, _queue).shift();
|
334
334
|
if (next !== void 0) {
|
335
335
|
this.started++;
|
336
336
|
next();
|
337
337
|
}
|
338
338
|
});
|
339
|
-
if (this.running + this.started < __privateGet$
|
340
|
-
const next = __privateGet$
|
339
|
+
if (this.running + this.started < __privateGet$7(this, _concurrency)) {
|
340
|
+
const next = __privateGet$7(this, _queue).shift();
|
341
341
|
if (next !== void 0) {
|
342
342
|
this.started++;
|
343
343
|
next();
|
@@ -526,7 +526,7 @@ function defaultOnOpen(response) {
|
|
526
526
|
}
|
527
527
|
}
|
528
528
|
|
529
|
-
const VERSION = "0.
|
529
|
+
const VERSION = "0.28.3";
|
530
530
|
|
531
531
|
class ErrorWithCause extends Error {
|
532
532
|
constructor(message, options) {
|
@@ -569,6 +569,67 @@ function getMessage(data) {
|
|
569
569
|
}
|
570
570
|
}
|
571
571
|
|
572
|
+
function getHostUrl(provider, type) {
|
573
|
+
if (isHostProviderAlias(provider)) {
|
574
|
+
return providers[provider][type];
|
575
|
+
} else if (isHostProviderBuilder(provider)) {
|
576
|
+
return provider[type];
|
577
|
+
}
|
578
|
+
throw new Error("Invalid API provider");
|
579
|
+
}
|
580
|
+
const providers = {
|
581
|
+
production: {
|
582
|
+
main: "https://api.xata.io",
|
583
|
+
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
584
|
+
},
|
585
|
+
staging: {
|
586
|
+
main: "https://api.staging-xata.dev",
|
587
|
+
workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
|
588
|
+
},
|
589
|
+
dev: {
|
590
|
+
main: "https://api.dev-xata.dev",
|
591
|
+
workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
|
592
|
+
},
|
593
|
+
local: {
|
594
|
+
main: "http://localhost:6001",
|
595
|
+
workspaces: "http://{workspaceId}.{region}.localhost:6001"
|
596
|
+
}
|
597
|
+
};
|
598
|
+
function isHostProviderAlias(alias) {
|
599
|
+
return isString(alias) && Object.keys(providers).includes(alias);
|
600
|
+
}
|
601
|
+
function isHostProviderBuilder(builder) {
|
602
|
+
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
603
|
+
}
|
604
|
+
function parseProviderString(provider = "production") {
|
605
|
+
if (isHostProviderAlias(provider)) {
|
606
|
+
return provider;
|
607
|
+
}
|
608
|
+
const [main, workspaces] = provider.split(",");
|
609
|
+
if (!main || !workspaces)
|
610
|
+
return null;
|
611
|
+
return { main, workspaces };
|
612
|
+
}
|
613
|
+
function buildProviderString(provider) {
|
614
|
+
if (isHostProviderAlias(provider))
|
615
|
+
return provider;
|
616
|
+
return `${provider.main},${provider.workspaces}`;
|
617
|
+
}
|
618
|
+
function parseWorkspacesUrlParts(url) {
|
619
|
+
if (!isString(url))
|
620
|
+
return null;
|
621
|
+
const matches = {
|
622
|
+
production: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/),
|
623
|
+
staging: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/),
|
624
|
+
dev: url.match(/(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/),
|
625
|
+
local: url.match(/(?:https?:\/\/)?([^.]+)(?:\.([^.]+))\.localhost:(\d+)/)
|
626
|
+
};
|
627
|
+
const [host, match] = Object.entries(matches).find(([, match2]) => match2 !== null) ?? [];
|
628
|
+
if (!isHostProviderAlias(host) || !match)
|
629
|
+
return null;
|
630
|
+
return { workspace: match[1], region: match[2], host };
|
631
|
+
}
|
632
|
+
|
572
633
|
const pool = new ApiRequestPool();
|
573
634
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
574
635
|
const cleanQueryParams = Object.entries(queryParams).reduce((acc, [key, value]) => {
|
@@ -584,6 +645,7 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
584
645
|
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
585
646
|
};
|
586
647
|
function buildBaseUrl({
|
648
|
+
method,
|
587
649
|
endpoint,
|
588
650
|
path,
|
589
651
|
workspacesApiUrl,
|
@@ -591,7 +653,24 @@ function buildBaseUrl({
|
|
591
653
|
pathParams = {}
|
592
654
|
}) {
|
593
655
|
if (endpoint === "dataPlane") {
|
594
|
-
|
656
|
+
let url = isString(workspacesApiUrl) ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
657
|
+
if (method.toUpperCase() === "PUT" && [
|
658
|
+
"/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file",
|
659
|
+
"/db/{dbBranchName}/tables/{tableName}/data/{recordId}/column/{columnName}/file/{fileId}"
|
660
|
+
].includes(path)) {
|
661
|
+
const { host } = parseWorkspacesUrlParts(url) ?? {};
|
662
|
+
switch (host) {
|
663
|
+
case "production":
|
664
|
+
url = url.replace("xata.sh", "upload.xata.sh");
|
665
|
+
break;
|
666
|
+
case "staging":
|
667
|
+
url = url.replace("staging-xata.dev", "upload.staging-xata.dev");
|
668
|
+
break;
|
669
|
+
case "dev":
|
670
|
+
url = url.replace("dev-xata.dev", "upload.dev-xata.dev");
|
671
|
+
break;
|
672
|
+
}
|
673
|
+
}
|
595
674
|
const urlWithWorkspace = isString(pathParams.workspace) ? url.replace("{workspaceId}", String(pathParams.workspace)) : url;
|
596
675
|
return isString(pathParams.region) ? urlWithWorkspace.replace("{region}", String(pathParams.region)) : urlWithWorkspace;
|
597
676
|
}
|
@@ -640,9 +719,9 @@ async function fetch$1({
|
|
640
719
|
return await trace(
|
641
720
|
`${method.toUpperCase()} ${path}`,
|
642
721
|
async ({ setAttributes }) => {
|
643
|
-
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
722
|
+
const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
644
723
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
645
|
-
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
724
|
+
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\.[^.]+\./, "http://") : fullUrl;
|
646
725
|
setAttributes({
|
647
726
|
[TraceAttributes.HTTP_URL]: url,
|
648
727
|
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
@@ -723,7 +802,7 @@ function fetchSSERequest({
|
|
723
802
|
clientName,
|
724
803
|
xataAgentExtra
|
725
804
|
}) {
|
726
|
-
const baseUrl = buildBaseUrl({ endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
805
|
+
const baseUrl = buildBaseUrl({ method, endpoint, path, workspacesApiUrl, pathParams, apiUrl });
|
727
806
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
728
807
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
729
808
|
void fetchEventSource(url, {
|
@@ -766,6 +845,20 @@ function parseUrl(url) {
|
|
766
845
|
|
767
846
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
768
847
|
|
848
|
+
const applyMigration = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/apply", method: "post", ...variables, signal });
|
849
|
+
const pgRollStatus = (variables, signal) => dataPlaneFetch({
|
850
|
+
url: "/db/{dbBranchName}/pgroll/status",
|
851
|
+
method: "get",
|
852
|
+
...variables,
|
853
|
+
signal
|
854
|
+
});
|
855
|
+
const pgRollJobStatus = (variables, signal) => dataPlaneFetch({
|
856
|
+
url: "/db/{dbBranchName}/pgroll/jobs/{jobId}",
|
857
|
+
method: "get",
|
858
|
+
...variables,
|
859
|
+
signal
|
860
|
+
});
|
861
|
+
const pgRollMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/pgroll/migrations", method: "get", ...variables, signal });
|
769
862
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
770
863
|
url: "/dbs/{dbName}",
|
771
864
|
method: "get",
|
@@ -972,6 +1065,12 @@ const fileAccess = (variables, signal) => dataPlaneFetch({
|
|
972
1065
|
...variables,
|
973
1066
|
signal
|
974
1067
|
});
|
1068
|
+
const fileUpload = (variables, signal) => dataPlaneFetch({
|
1069
|
+
url: "/file/{fileId}",
|
1070
|
+
method: "put",
|
1071
|
+
...variables,
|
1072
|
+
signal
|
1073
|
+
});
|
975
1074
|
const sqlQuery = (variables, signal) => dataPlaneFetch({
|
976
1075
|
url: "/db/{dbBranchName}/sql",
|
977
1076
|
method: "post",
|
@@ -980,6 +1079,10 @@ const sqlQuery = (variables, signal) => dataPlaneFetch({
|
|
980
1079
|
});
|
981
1080
|
const operationsByTag$2 = {
|
982
1081
|
branch: {
|
1082
|
+
applyMigration,
|
1083
|
+
pgRollStatus,
|
1084
|
+
pgRollJobStatus,
|
1085
|
+
pgRollMigrationHistory,
|
983
1086
|
getBranchList,
|
984
1087
|
getBranchDetails,
|
985
1088
|
createBranch,
|
@@ -1017,1602 +1120,272 @@ const operationsByTag$2 = {
|
|
1017
1120
|
mergeMigrationRequest
|
1018
1121
|
},
|
1019
1122
|
table: {
|
1020
|
-
createTable,
|
1021
|
-
deleteTable,
|
1022
|
-
updateTable,
|
1023
|
-
getTableSchema,
|
1024
|
-
setTableSchema,
|
1025
|
-
getTableColumns,
|
1026
|
-
addTableColumn,
|
1027
|
-
getColumn,
|
1028
|
-
updateColumn,
|
1029
|
-
deleteColumn
|
1030
|
-
},
|
1031
|
-
records: {
|
1032
|
-
branchTransaction,
|
1033
|
-
insertRecord,
|
1034
|
-
getRecord,
|
1035
|
-
insertRecordWithID,
|
1036
|
-
updateRecordWithID,
|
1037
|
-
upsertRecordWithID,
|
1038
|
-
deleteRecord,
|
1039
|
-
bulkInsertTableRecords
|
1040
|
-
},
|
1041
|
-
files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess },
|
1042
|
-
searchAndFilter: {
|
1043
|
-
queryTable,
|
1044
|
-
searchBranch,
|
1045
|
-
searchTable,
|
1046
|
-
vectorSearchTable,
|
1047
|
-
askTable,
|
1048
|
-
askTableSession,
|
1049
|
-
summarizeTable,
|
1050
|
-
aggregateTable
|
1051
|
-
},
|
1052
|
-
sql: { sqlQuery }
|
1053
|
-
};
|
1054
|
-
|
1055
|
-
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
1056
|
-
|
1057
|
-
const getAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "get", ...variables, signal });
|
1058
|
-
const grantAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "post", ...variables, signal });
|
1059
|
-
const getUser = (variables, signal) => controlPlaneFetch({
|
1060
|
-
url: "/user",
|
1061
|
-
method: "get",
|
1062
|
-
...variables,
|
1063
|
-
signal
|
1064
|
-
});
|
1065
|
-
const updateUser = (variables, signal) => controlPlaneFetch({
|
1066
|
-
url: "/user",
|
1067
|
-
method: "put",
|
1068
|
-
...variables,
|
1069
|
-
signal
|
1070
|
-
});
|
1071
|
-
const deleteUser = (variables, signal) => controlPlaneFetch({
|
1072
|
-
url: "/user",
|
1073
|
-
method: "delete",
|
1074
|
-
...variables,
|
1075
|
-
signal
|
1076
|
-
});
|
1077
|
-
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
1078
|
-
url: "/user/keys",
|
1079
|
-
method: "get",
|
1080
|
-
...variables,
|
1081
|
-
signal
|
1082
|
-
});
|
1083
|
-
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
1084
|
-
url: "/user/keys/{keyName}",
|
1085
|
-
method: "post",
|
1086
|
-
...variables,
|
1087
|
-
signal
|
1088
|
-
});
|
1089
|
-
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
1090
|
-
url: "/user/keys/{keyName}",
|
1091
|
-
method: "delete",
|
1092
|
-
...variables,
|
1093
|
-
signal
|
1094
|
-
});
|
1095
|
-
const getUserOAuthClients = (variables, signal) => controlPlaneFetch({
|
1096
|
-
url: "/user/oauth/clients",
|
1097
|
-
method: "get",
|
1098
|
-
...variables,
|
1099
|
-
signal
|
1100
|
-
});
|
1101
|
-
const deleteUserOAuthClient = (variables, signal) => controlPlaneFetch({
|
1102
|
-
url: "/user/oauth/clients/{clientId}",
|
1103
|
-
method: "delete",
|
1104
|
-
...variables,
|
1105
|
-
signal
|
1106
|
-
});
|
1107
|
-
const getUserOAuthAccessTokens = (variables, signal) => controlPlaneFetch({
|
1108
|
-
url: "/user/oauth/tokens",
|
1109
|
-
method: "get",
|
1110
|
-
...variables,
|
1111
|
-
signal
|
1112
|
-
});
|
1113
|
-
const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
1114
|
-
url: "/user/oauth/tokens/{token}",
|
1115
|
-
method: "delete",
|
1116
|
-
...variables,
|
1117
|
-
signal
|
1118
|
-
});
|
1119
|
-
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({ url: "/user/oauth/tokens/{token}", method: "patch", ...variables, signal });
|
1120
|
-
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
1121
|
-
url: "/workspaces",
|
1122
|
-
method: "get",
|
1123
|
-
...variables,
|
1124
|
-
signal
|
1125
|
-
});
|
1126
|
-
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
1127
|
-
url: "/workspaces",
|
1128
|
-
method: "post",
|
1129
|
-
...variables,
|
1130
|
-
signal
|
1131
|
-
});
|
1132
|
-
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
1133
|
-
url: "/workspaces/{workspaceId}",
|
1134
|
-
method: "get",
|
1135
|
-
...variables,
|
1136
|
-
signal
|
1137
|
-
});
|
1138
|
-
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
1139
|
-
url: "/workspaces/{workspaceId}",
|
1140
|
-
method: "put",
|
1141
|
-
...variables,
|
1142
|
-
signal
|
1143
|
-
});
|
1144
|
-
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
1145
|
-
url: "/workspaces/{workspaceId}",
|
1146
|
-
method: "delete",
|
1147
|
-
...variables,
|
1148
|
-
signal
|
1149
|
-
});
|
1150
|
-
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
1151
|
-
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
1152
|
-
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
1153
|
-
url: "/workspaces/{workspaceId}/members/{userId}",
|
1154
|
-
method: "delete",
|
1155
|
-
...variables,
|
1156
|
-
signal
|
1157
|
-
});
|
1158
|
-
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
1159
|
-
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
1160
|
-
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
1161
|
-
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
1162
|
-
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
1163
|
-
const listClusters = (variables, signal) => controlPlaneFetch({
|
1164
|
-
|
1165
|
-
|
1166
|
-
|
1167
|
-
|
1168
|
-
|
1169
|
-
|
1170
|
-
|
1171
|
-
|
1172
|
-
|
1173
|
-
|
1174
|
-
|
1175
|
-
|
1176
|
-
|
1177
|
-
|
1178
|
-
|
1179
|
-
|
1180
|
-
|
1181
|
-
|
1182
|
-
|
1183
|
-
|
1184
|
-
|
1185
|
-
|
1186
|
-
|
1187
|
-
|
1188
|
-
|
1189
|
-
});
|
1190
|
-
const
|
1191
|
-
const
|
1192
|
-
|
1193
|
-
|
1194
|
-
|
1195
|
-
|
1196
|
-
|
1197
|
-
|
1198
|
-
|
1199
|
-
|
1200
|
-
|
1201
|
-
|
1202
|
-
|
1203
|
-
|
1204
|
-
|
1205
|
-
|
1206
|
-
|
1207
|
-
|
1208
|
-
|
1209
|
-
|
1210
|
-
|
1211
|
-
|
1212
|
-
|
1213
|
-
|
1214
|
-
|
1215
|
-
|
1216
|
-
|
1217
|
-
|
1218
|
-
|
1219
|
-
|
1220
|
-
|
1221
|
-
|
1222
|
-
|
1223
|
-
|
1224
|
-
|
1225
|
-
|
1226
|
-
|
1227
|
-
|
1228
|
-
|
1229
|
-
|
1230
|
-
|
1231
|
-
|
1232
|
-
|
1233
|
-
|
1234
|
-
|
1235
|
-
|
1236
|
-
|
1237
|
-
|
1238
|
-
renameDatabase,
|
1239
|
-
getDatabaseGithubSettings,
|
1240
|
-
updateDatabaseGithubSettings,
|
1241
|
-
deleteDatabaseGithubSettings,
|
1242
|
-
listRegions
|
1243
|
-
}
|
1244
|
-
};
|
1245
|
-
|
1246
|
-
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
1247
|
-
|
1248
|
-
function getHostUrl(provider, type) {
|
1249
|
-
if (isHostProviderAlias(provider)) {
|
1250
|
-
return providers[provider][type];
|
1251
|
-
} else if (isHostProviderBuilder(provider)) {
|
1252
|
-
return provider[type];
|
1253
|
-
}
|
1254
|
-
throw new Error("Invalid API provider");
|
1255
|
-
}
|
1256
|
-
const providers = {
|
1257
|
-
production: {
|
1258
|
-
main: "https://api.xata.io",
|
1259
|
-
workspaces: "https://{workspaceId}.{region}.xata.sh"
|
1260
|
-
},
|
1261
|
-
staging: {
|
1262
|
-
main: "https://api.staging-xata.dev",
|
1263
|
-
workspaces: "https://{workspaceId}.{region}.staging-xata.dev"
|
1264
|
-
},
|
1265
|
-
dev: {
|
1266
|
-
main: "https://api.dev-xata.dev",
|
1267
|
-
workspaces: "https://{workspaceId}.{region}.dev-xata.dev"
|
1268
|
-
}
|
1269
|
-
};
|
1270
|
-
function isHostProviderAlias(alias) {
|
1271
|
-
return isString(alias) && Object.keys(providers).includes(alias);
|
1272
|
-
}
|
1273
|
-
function isHostProviderBuilder(builder) {
|
1274
|
-
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
1275
|
-
}
|
1276
|
-
function parseProviderString(provider = "production") {
|
1277
|
-
if (isHostProviderAlias(provider)) {
|
1278
|
-
return provider;
|
1279
|
-
}
|
1280
|
-
const [main, workspaces] = provider.split(",");
|
1281
|
-
if (!main || !workspaces)
|
1282
|
-
return null;
|
1283
|
-
return { main, workspaces };
|
1284
|
-
}
|
1285
|
-
function buildProviderString(provider) {
|
1286
|
-
if (isHostProviderAlias(provider))
|
1287
|
-
return provider;
|
1288
|
-
return `${provider.main},${provider.workspaces}`;
|
1289
|
-
}
|
1290
|
-
function parseWorkspacesUrlParts(url) {
|
1291
|
-
if (!isString(url))
|
1292
|
-
return null;
|
1293
|
-
const regex = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.sh.*/;
|
1294
|
-
const regexDev = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.dev-xata\.dev.*/;
|
1295
|
-
const regexStaging = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.staging-xata\.dev.*/;
|
1296
|
-
const regexProdTesting = /(?:https:\/\/)?([^.]+)(?:\.([^.]+))\.xata\.tech.*/;
|
1297
|
-
const match = url.match(regex) || url.match(regexDev) || url.match(regexStaging) || url.match(regexProdTesting);
|
1298
|
-
if (!match)
|
1299
|
-
return null;
|
1300
|
-
return { workspace: match[1], region: match[2] };
|
1301
|
-
}
|
1302
|
-
|
1303
|
-
var __accessCheck$7 = (obj, member, msg) => {
|
1304
|
-
if (!member.has(obj))
|
1305
|
-
throw TypeError("Cannot " + msg);
|
1306
|
-
};
|
1307
|
-
var __privateGet$7 = (obj, member, getter) => {
|
1308
|
-
__accessCheck$7(obj, member, "read from private field");
|
1309
|
-
return getter ? getter.call(obj) : member.get(obj);
|
1310
|
-
};
|
1311
|
-
var __privateAdd$7 = (obj, member, value) => {
|
1312
|
-
if (member.has(obj))
|
1313
|
-
throw TypeError("Cannot add the same private member more than once");
|
1314
|
-
member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
1315
|
-
};
|
1316
|
-
var __privateSet$7 = (obj, member, value, setter) => {
|
1317
|
-
__accessCheck$7(obj, member, "write to private field");
|
1318
|
-
setter ? setter.call(obj, value) : member.set(obj, value);
|
1319
|
-
return value;
|
1320
|
-
};
|
1321
|
-
var _extraProps, _namespaces;
|
1322
|
-
class XataApiClient {
|
1323
|
-
constructor(options = {}) {
|
1324
|
-
__privateAdd$7(this, _extraProps, void 0);
|
1325
|
-
__privateAdd$7(this, _namespaces, {});
|
1326
|
-
const provider = options.host ?? "production";
|
1327
|
-
const apiKey = options.apiKey ?? getAPIKey();
|
1328
|
-
const trace = options.trace ?? defaultTrace;
|
1329
|
-
const clientID = generateUUID();
|
1330
|
-
if (!apiKey) {
|
1331
|
-
throw new Error("Could not resolve a valid apiKey");
|
1332
|
-
}
|
1333
|
-
__privateSet$7(this, _extraProps, {
|
1334
|
-
apiUrl: getHostUrl(provider, "main"),
|
1335
|
-
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
1336
|
-
fetch: getFetchImplementation(options.fetch),
|
1337
|
-
apiKey,
|
1338
|
-
trace,
|
1339
|
-
clientName: options.clientName,
|
1340
|
-
xataAgentExtra: options.xataAgentExtra,
|
1341
|
-
clientID
|
1342
|
-
});
|
1343
|
-
}
|
1344
|
-
get user() {
|
1345
|
-
if (!__privateGet$7(this, _namespaces).user)
|
1346
|
-
__privateGet$7(this, _namespaces).user = new UserApi(__privateGet$7(this, _extraProps));
|
1347
|
-
return __privateGet$7(this, _namespaces).user;
|
1348
|
-
}
|
1349
|
-
get authentication() {
|
1350
|
-
if (!__privateGet$7(this, _namespaces).authentication)
|
1351
|
-
__privateGet$7(this, _namespaces).authentication = new AuthenticationApi(__privateGet$7(this, _extraProps));
|
1352
|
-
return __privateGet$7(this, _namespaces).authentication;
|
1353
|
-
}
|
1354
|
-
get workspaces() {
|
1355
|
-
if (!__privateGet$7(this, _namespaces).workspaces)
|
1356
|
-
__privateGet$7(this, _namespaces).workspaces = new WorkspaceApi(__privateGet$7(this, _extraProps));
|
1357
|
-
return __privateGet$7(this, _namespaces).workspaces;
|
1358
|
-
}
|
1359
|
-
get invites() {
|
1360
|
-
if (!__privateGet$7(this, _namespaces).invites)
|
1361
|
-
__privateGet$7(this, _namespaces).invites = new InvitesApi(__privateGet$7(this, _extraProps));
|
1362
|
-
return __privateGet$7(this, _namespaces).invites;
|
1363
|
-
}
|
1364
|
-
get database() {
|
1365
|
-
if (!__privateGet$7(this, _namespaces).database)
|
1366
|
-
__privateGet$7(this, _namespaces).database = new DatabaseApi(__privateGet$7(this, _extraProps));
|
1367
|
-
return __privateGet$7(this, _namespaces).database;
|
1368
|
-
}
|
1369
|
-
get branches() {
|
1370
|
-
if (!__privateGet$7(this, _namespaces).branches)
|
1371
|
-
__privateGet$7(this, _namespaces).branches = new BranchApi(__privateGet$7(this, _extraProps));
|
1372
|
-
return __privateGet$7(this, _namespaces).branches;
|
1373
|
-
}
|
1374
|
-
get migrations() {
|
1375
|
-
if (!__privateGet$7(this, _namespaces).migrations)
|
1376
|
-
__privateGet$7(this, _namespaces).migrations = new MigrationsApi(__privateGet$7(this, _extraProps));
|
1377
|
-
return __privateGet$7(this, _namespaces).migrations;
|
1378
|
-
}
|
1379
|
-
get migrationRequests() {
|
1380
|
-
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
1381
|
-
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
1382
|
-
return __privateGet$7(this, _namespaces).migrationRequests;
|
1383
|
-
}
|
1384
|
-
get tables() {
|
1385
|
-
if (!__privateGet$7(this, _namespaces).tables)
|
1386
|
-
__privateGet$7(this, _namespaces).tables = new TableApi(__privateGet$7(this, _extraProps));
|
1387
|
-
return __privateGet$7(this, _namespaces).tables;
|
1388
|
-
}
|
1389
|
-
get records() {
|
1390
|
-
if (!__privateGet$7(this, _namespaces).records)
|
1391
|
-
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
1392
|
-
return __privateGet$7(this, _namespaces).records;
|
1393
|
-
}
|
1394
|
-
get files() {
|
1395
|
-
if (!__privateGet$7(this, _namespaces).files)
|
1396
|
-
__privateGet$7(this, _namespaces).files = new FilesApi(__privateGet$7(this, _extraProps));
|
1397
|
-
return __privateGet$7(this, _namespaces).files;
|
1398
|
-
}
|
1399
|
-
get searchAndFilter() {
|
1400
|
-
if (!__privateGet$7(this, _namespaces).searchAndFilter)
|
1401
|
-
__privateGet$7(this, _namespaces).searchAndFilter = new SearchAndFilterApi(__privateGet$7(this, _extraProps));
|
1402
|
-
return __privateGet$7(this, _namespaces).searchAndFilter;
|
1403
|
-
}
|
1404
|
-
}
|
1405
|
-
_extraProps = new WeakMap();
|
1406
|
-
_namespaces = new WeakMap();
|
1407
|
-
class UserApi {
|
1408
|
-
constructor(extraProps) {
|
1409
|
-
this.extraProps = extraProps;
|
1410
|
-
}
|
1411
|
-
getUser() {
|
1412
|
-
return operationsByTag.users.getUser({ ...this.extraProps });
|
1413
|
-
}
|
1414
|
-
updateUser({ user }) {
|
1415
|
-
return operationsByTag.users.updateUser({ body: user, ...this.extraProps });
|
1416
|
-
}
|
1417
|
-
deleteUser() {
|
1418
|
-
return operationsByTag.users.deleteUser({ ...this.extraProps });
|
1419
|
-
}
|
1420
|
-
}
|
1421
|
-
class AuthenticationApi {
|
1422
|
-
constructor(extraProps) {
|
1423
|
-
this.extraProps = extraProps;
|
1424
|
-
}
|
1425
|
-
getUserAPIKeys() {
|
1426
|
-
return operationsByTag.authentication.getUserAPIKeys({ ...this.extraProps });
|
1427
|
-
}
|
1428
|
-
createUserAPIKey({ name }) {
|
1429
|
-
return operationsByTag.authentication.createUserAPIKey({
|
1430
|
-
pathParams: { keyName: name },
|
1431
|
-
...this.extraProps
|
1432
|
-
});
|
1433
|
-
}
|
1434
|
-
deleteUserAPIKey({ name }) {
|
1435
|
-
return operationsByTag.authentication.deleteUserAPIKey({
|
1436
|
-
pathParams: { keyName: name },
|
1437
|
-
...this.extraProps
|
1438
|
-
});
|
1439
|
-
}
|
1440
|
-
}
|
1441
|
-
class WorkspaceApi {
|
1442
|
-
constructor(extraProps) {
|
1443
|
-
this.extraProps = extraProps;
|
1444
|
-
}
|
1445
|
-
getWorkspacesList() {
|
1446
|
-
return operationsByTag.workspaces.getWorkspacesList({ ...this.extraProps });
|
1447
|
-
}
|
1448
|
-
createWorkspace({ data }) {
|
1449
|
-
return operationsByTag.workspaces.createWorkspace({
|
1450
|
-
body: data,
|
1451
|
-
...this.extraProps
|
1452
|
-
});
|
1453
|
-
}
|
1454
|
-
getWorkspace({ workspace }) {
|
1455
|
-
return operationsByTag.workspaces.getWorkspace({
|
1456
|
-
pathParams: { workspaceId: workspace },
|
1457
|
-
...this.extraProps
|
1458
|
-
});
|
1459
|
-
}
|
1460
|
-
updateWorkspace({
|
1461
|
-
workspace,
|
1462
|
-
update
|
1463
|
-
}) {
|
1464
|
-
return operationsByTag.workspaces.updateWorkspace({
|
1465
|
-
pathParams: { workspaceId: workspace },
|
1466
|
-
body: update,
|
1467
|
-
...this.extraProps
|
1468
|
-
});
|
1469
|
-
}
|
1470
|
-
deleteWorkspace({ workspace }) {
|
1471
|
-
return operationsByTag.workspaces.deleteWorkspace({
|
1472
|
-
pathParams: { workspaceId: workspace },
|
1473
|
-
...this.extraProps
|
1474
|
-
});
|
1475
|
-
}
|
1476
|
-
getWorkspaceMembersList({ workspace }) {
|
1477
|
-
return operationsByTag.workspaces.getWorkspaceMembersList({
|
1478
|
-
pathParams: { workspaceId: workspace },
|
1479
|
-
...this.extraProps
|
1480
|
-
});
|
1481
|
-
}
|
1482
|
-
updateWorkspaceMemberRole({
|
1483
|
-
workspace,
|
1484
|
-
user,
|
1485
|
-
role
|
1486
|
-
}) {
|
1487
|
-
return operationsByTag.workspaces.updateWorkspaceMemberRole({
|
1488
|
-
pathParams: { workspaceId: workspace, userId: user },
|
1489
|
-
body: { role },
|
1490
|
-
...this.extraProps
|
1491
|
-
});
|
1492
|
-
}
|
1493
|
-
removeWorkspaceMember({
|
1494
|
-
workspace,
|
1495
|
-
user
|
1496
|
-
}) {
|
1497
|
-
return operationsByTag.workspaces.removeWorkspaceMember({
|
1498
|
-
pathParams: { workspaceId: workspace, userId: user },
|
1499
|
-
...this.extraProps
|
1500
|
-
});
|
1501
|
-
}
|
1502
|
-
}
|
1503
|
-
class InvitesApi {
|
1504
|
-
constructor(extraProps) {
|
1505
|
-
this.extraProps = extraProps;
|
1506
|
-
}
|
1507
|
-
inviteWorkspaceMember({
|
1508
|
-
workspace,
|
1509
|
-
email,
|
1510
|
-
role
|
1511
|
-
}) {
|
1512
|
-
return operationsByTag.invites.inviteWorkspaceMember({
|
1513
|
-
pathParams: { workspaceId: workspace },
|
1514
|
-
body: { email, role },
|
1515
|
-
...this.extraProps
|
1516
|
-
});
|
1517
|
-
}
|
1518
|
-
updateWorkspaceMemberInvite({
|
1519
|
-
workspace,
|
1520
|
-
invite,
|
1521
|
-
role
|
1522
|
-
}) {
|
1523
|
-
return operationsByTag.invites.updateWorkspaceMemberInvite({
|
1524
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
1525
|
-
body: { role },
|
1526
|
-
...this.extraProps
|
1527
|
-
});
|
1528
|
-
}
|
1529
|
-
cancelWorkspaceMemberInvite({
|
1530
|
-
workspace,
|
1531
|
-
invite
|
1532
|
-
}) {
|
1533
|
-
return operationsByTag.invites.cancelWorkspaceMemberInvite({
|
1534
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
1535
|
-
...this.extraProps
|
1536
|
-
});
|
1537
|
-
}
|
1538
|
-
acceptWorkspaceMemberInvite({
|
1539
|
-
workspace,
|
1540
|
-
key
|
1541
|
-
}) {
|
1542
|
-
return operationsByTag.invites.acceptWorkspaceMemberInvite({
|
1543
|
-
pathParams: { workspaceId: workspace, inviteKey: key },
|
1544
|
-
...this.extraProps
|
1545
|
-
});
|
1546
|
-
}
|
1547
|
-
resendWorkspaceMemberInvite({
|
1548
|
-
workspace,
|
1549
|
-
invite
|
1550
|
-
}) {
|
1551
|
-
return operationsByTag.invites.resendWorkspaceMemberInvite({
|
1552
|
-
pathParams: { workspaceId: workspace, inviteId: invite },
|
1553
|
-
...this.extraProps
|
1554
|
-
});
|
1555
|
-
}
|
1556
|
-
}
|
1557
|
-
class BranchApi {
|
1558
|
-
constructor(extraProps) {
|
1559
|
-
this.extraProps = extraProps;
|
1560
|
-
}
|
1561
|
-
getBranchList({
|
1562
|
-
workspace,
|
1563
|
-
region,
|
1564
|
-
database
|
1565
|
-
}) {
|
1566
|
-
return operationsByTag.branch.getBranchList({
|
1567
|
-
pathParams: { workspace, region, dbName: database },
|
1568
|
-
...this.extraProps
|
1569
|
-
});
|
1570
|
-
}
|
1571
|
-
getBranchDetails({
|
1572
|
-
workspace,
|
1573
|
-
region,
|
1574
|
-
database,
|
1575
|
-
branch
|
1576
|
-
}) {
|
1577
|
-
return operationsByTag.branch.getBranchDetails({
|
1578
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1579
|
-
...this.extraProps
|
1580
|
-
});
|
1581
|
-
}
|
1582
|
-
createBranch({
|
1583
|
-
workspace,
|
1584
|
-
region,
|
1585
|
-
database,
|
1586
|
-
branch,
|
1587
|
-
from,
|
1588
|
-
metadata
|
1589
|
-
}) {
|
1590
|
-
return operationsByTag.branch.createBranch({
|
1591
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1592
|
-
body: { from, metadata },
|
1593
|
-
...this.extraProps
|
1594
|
-
});
|
1595
|
-
}
|
1596
|
-
deleteBranch({
|
1597
|
-
workspace,
|
1598
|
-
region,
|
1599
|
-
database,
|
1600
|
-
branch
|
1601
|
-
}) {
|
1602
|
-
return operationsByTag.branch.deleteBranch({
|
1603
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1604
|
-
...this.extraProps
|
1605
|
-
});
|
1606
|
-
}
|
1607
|
-
copyBranch({
|
1608
|
-
workspace,
|
1609
|
-
region,
|
1610
|
-
database,
|
1611
|
-
branch,
|
1612
|
-
destinationBranch,
|
1613
|
-
limit
|
1614
|
-
}) {
|
1615
|
-
return operationsByTag.branch.copyBranch({
|
1616
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1617
|
-
body: { destinationBranch, limit },
|
1618
|
-
...this.extraProps
|
1619
|
-
});
|
1620
|
-
}
|
1621
|
-
updateBranchMetadata({
|
1622
|
-
workspace,
|
1623
|
-
region,
|
1624
|
-
database,
|
1625
|
-
branch,
|
1626
|
-
metadata
|
1627
|
-
}) {
|
1628
|
-
return operationsByTag.branch.updateBranchMetadata({
|
1629
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1630
|
-
body: metadata,
|
1631
|
-
...this.extraProps
|
1632
|
-
});
|
1633
|
-
}
|
1634
|
-
getBranchMetadata({
|
1635
|
-
workspace,
|
1636
|
-
region,
|
1637
|
-
database,
|
1638
|
-
branch
|
1639
|
-
}) {
|
1640
|
-
return operationsByTag.branch.getBranchMetadata({
|
1641
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1642
|
-
...this.extraProps
|
1643
|
-
});
|
1644
|
-
}
|
1645
|
-
getBranchStats({
|
1646
|
-
workspace,
|
1647
|
-
region,
|
1648
|
-
database,
|
1649
|
-
branch
|
1650
|
-
}) {
|
1651
|
-
return operationsByTag.branch.getBranchStats({
|
1652
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1653
|
-
...this.extraProps
|
1654
|
-
});
|
1655
|
-
}
|
1656
|
-
getGitBranchesMapping({
|
1657
|
-
workspace,
|
1658
|
-
region,
|
1659
|
-
database
|
1660
|
-
}) {
|
1661
|
-
return operationsByTag.branch.getGitBranchesMapping({
|
1662
|
-
pathParams: { workspace, region, dbName: database },
|
1663
|
-
...this.extraProps
|
1664
|
-
});
|
1665
|
-
}
|
1666
|
-
addGitBranchesEntry({
|
1667
|
-
workspace,
|
1668
|
-
region,
|
1669
|
-
database,
|
1670
|
-
gitBranch,
|
1671
|
-
xataBranch
|
1672
|
-
}) {
|
1673
|
-
return operationsByTag.branch.addGitBranchesEntry({
|
1674
|
-
pathParams: { workspace, region, dbName: database },
|
1675
|
-
body: { gitBranch, xataBranch },
|
1676
|
-
...this.extraProps
|
1677
|
-
});
|
1678
|
-
}
|
1679
|
-
removeGitBranchesEntry({
|
1680
|
-
workspace,
|
1681
|
-
region,
|
1682
|
-
database,
|
1683
|
-
gitBranch
|
1684
|
-
}) {
|
1685
|
-
return operationsByTag.branch.removeGitBranchesEntry({
|
1686
|
-
pathParams: { workspace, region, dbName: database },
|
1687
|
-
queryParams: { gitBranch },
|
1688
|
-
...this.extraProps
|
1689
|
-
});
|
1690
|
-
}
|
1691
|
-
resolveBranch({
|
1692
|
-
workspace,
|
1693
|
-
region,
|
1694
|
-
database,
|
1695
|
-
gitBranch,
|
1696
|
-
fallbackBranch
|
1697
|
-
}) {
|
1698
|
-
return operationsByTag.branch.resolveBranch({
|
1699
|
-
pathParams: { workspace, region, dbName: database },
|
1700
|
-
queryParams: { gitBranch, fallbackBranch },
|
1701
|
-
...this.extraProps
|
1702
|
-
});
|
1703
|
-
}
|
1704
|
-
}
|
1705
|
-
class TableApi {
|
1706
|
-
constructor(extraProps) {
|
1707
|
-
this.extraProps = extraProps;
|
1708
|
-
}
|
1709
|
-
createTable({
|
1710
|
-
workspace,
|
1711
|
-
region,
|
1712
|
-
database,
|
1713
|
-
branch,
|
1714
|
-
table
|
1715
|
-
}) {
|
1716
|
-
return operationsByTag.table.createTable({
|
1717
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1718
|
-
...this.extraProps
|
1719
|
-
});
|
1720
|
-
}
|
1721
|
-
deleteTable({
|
1722
|
-
workspace,
|
1723
|
-
region,
|
1724
|
-
database,
|
1725
|
-
branch,
|
1726
|
-
table
|
1727
|
-
}) {
|
1728
|
-
return operationsByTag.table.deleteTable({
|
1729
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1730
|
-
...this.extraProps
|
1731
|
-
});
|
1732
|
-
}
|
1733
|
-
updateTable({
|
1734
|
-
workspace,
|
1735
|
-
region,
|
1736
|
-
database,
|
1737
|
-
branch,
|
1738
|
-
table,
|
1739
|
-
update
|
1740
|
-
}) {
|
1741
|
-
return operationsByTag.table.updateTable({
|
1742
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1743
|
-
body: update,
|
1744
|
-
...this.extraProps
|
1745
|
-
});
|
1746
|
-
}
|
1747
|
-
getTableSchema({
|
1748
|
-
workspace,
|
1749
|
-
region,
|
1750
|
-
database,
|
1751
|
-
branch,
|
1752
|
-
table
|
1753
|
-
}) {
|
1754
|
-
return operationsByTag.table.getTableSchema({
|
1755
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1756
|
-
...this.extraProps
|
1757
|
-
});
|
1758
|
-
}
|
1759
|
-
setTableSchema({
|
1760
|
-
workspace,
|
1761
|
-
region,
|
1762
|
-
database,
|
1763
|
-
branch,
|
1764
|
-
table,
|
1765
|
-
schema
|
1766
|
-
}) {
|
1767
|
-
return operationsByTag.table.setTableSchema({
|
1768
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1769
|
-
body: schema,
|
1770
|
-
...this.extraProps
|
1771
|
-
});
|
1772
|
-
}
|
1773
|
-
getTableColumns({
|
1774
|
-
workspace,
|
1775
|
-
region,
|
1776
|
-
database,
|
1777
|
-
branch,
|
1778
|
-
table
|
1779
|
-
}) {
|
1780
|
-
return operationsByTag.table.getTableColumns({
|
1781
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1782
|
-
...this.extraProps
|
1783
|
-
});
|
1784
|
-
}
|
1785
|
-
addTableColumn({
|
1786
|
-
workspace,
|
1787
|
-
region,
|
1788
|
-
database,
|
1789
|
-
branch,
|
1790
|
-
table,
|
1791
|
-
column
|
1792
|
-
}) {
|
1793
|
-
return operationsByTag.table.addTableColumn({
|
1794
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1795
|
-
body: column,
|
1796
|
-
...this.extraProps
|
1797
|
-
});
|
1798
|
-
}
|
1799
|
-
getColumn({
|
1800
|
-
workspace,
|
1801
|
-
region,
|
1802
|
-
database,
|
1803
|
-
branch,
|
1804
|
-
table,
|
1805
|
-
column
|
1806
|
-
}) {
|
1807
|
-
return operationsByTag.table.getColumn({
|
1808
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1809
|
-
...this.extraProps
|
1810
|
-
});
|
1811
|
-
}
|
1812
|
-
updateColumn({
|
1813
|
-
workspace,
|
1814
|
-
region,
|
1815
|
-
database,
|
1816
|
-
branch,
|
1817
|
-
table,
|
1818
|
-
column,
|
1819
|
-
update
|
1820
|
-
}) {
|
1821
|
-
return operationsByTag.table.updateColumn({
|
1822
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1823
|
-
body: update,
|
1824
|
-
...this.extraProps
|
1825
|
-
});
|
1826
|
-
}
|
1827
|
-
deleteColumn({
|
1828
|
-
workspace,
|
1829
|
-
region,
|
1830
|
-
database,
|
1831
|
-
branch,
|
1832
|
-
table,
|
1833
|
-
column
|
1834
|
-
}) {
|
1835
|
-
return operationsByTag.table.deleteColumn({
|
1836
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, columnName: column },
|
1837
|
-
...this.extraProps
|
1838
|
-
});
|
1839
|
-
}
|
1840
|
-
}
|
1841
|
-
class RecordsApi {
|
1842
|
-
constructor(extraProps) {
|
1843
|
-
this.extraProps = extraProps;
|
1844
|
-
}
|
1845
|
-
insertRecord({
|
1846
|
-
workspace,
|
1847
|
-
region,
|
1848
|
-
database,
|
1849
|
-
branch,
|
1850
|
-
table,
|
1851
|
-
record,
|
1852
|
-
columns
|
1853
|
-
}) {
|
1854
|
-
return operationsByTag.records.insertRecord({
|
1855
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1856
|
-
queryParams: { columns },
|
1857
|
-
body: record,
|
1858
|
-
...this.extraProps
|
1859
|
-
});
|
1860
|
-
}
|
1861
|
-
getRecord({
|
1862
|
-
workspace,
|
1863
|
-
region,
|
1864
|
-
database,
|
1865
|
-
branch,
|
1866
|
-
table,
|
1867
|
-
id,
|
1868
|
-
columns
|
1869
|
-
}) {
|
1870
|
-
return operationsByTag.records.getRecord({
|
1871
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1872
|
-
queryParams: { columns },
|
1873
|
-
...this.extraProps
|
1874
|
-
});
|
1875
|
-
}
|
1876
|
-
insertRecordWithID({
|
1877
|
-
workspace,
|
1878
|
-
region,
|
1879
|
-
database,
|
1880
|
-
branch,
|
1881
|
-
table,
|
1882
|
-
id,
|
1883
|
-
record,
|
1884
|
-
columns,
|
1885
|
-
createOnly,
|
1886
|
-
ifVersion
|
1887
|
-
}) {
|
1888
|
-
return operationsByTag.records.insertRecordWithID({
|
1889
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1890
|
-
queryParams: { columns, createOnly, ifVersion },
|
1891
|
-
body: record,
|
1892
|
-
...this.extraProps
|
1893
|
-
});
|
1894
|
-
}
|
1895
|
-
updateRecordWithID({
|
1896
|
-
workspace,
|
1897
|
-
region,
|
1898
|
-
database,
|
1899
|
-
branch,
|
1900
|
-
table,
|
1901
|
-
id,
|
1902
|
-
record,
|
1903
|
-
columns,
|
1904
|
-
ifVersion
|
1905
|
-
}) {
|
1906
|
-
return operationsByTag.records.updateRecordWithID({
|
1907
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1908
|
-
queryParams: { columns, ifVersion },
|
1909
|
-
body: record,
|
1910
|
-
...this.extraProps
|
1911
|
-
});
|
1912
|
-
}
|
1913
|
-
upsertRecordWithID({
|
1914
|
-
workspace,
|
1915
|
-
region,
|
1916
|
-
database,
|
1917
|
-
branch,
|
1918
|
-
table,
|
1919
|
-
id,
|
1920
|
-
record,
|
1921
|
-
columns,
|
1922
|
-
ifVersion
|
1923
|
-
}) {
|
1924
|
-
return operationsByTag.records.upsertRecordWithID({
|
1925
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1926
|
-
queryParams: { columns, ifVersion },
|
1927
|
-
body: record,
|
1928
|
-
...this.extraProps
|
1929
|
-
});
|
1930
|
-
}
|
1931
|
-
deleteRecord({
|
1932
|
-
workspace,
|
1933
|
-
region,
|
1934
|
-
database,
|
1935
|
-
branch,
|
1936
|
-
table,
|
1937
|
-
id,
|
1938
|
-
columns
|
1939
|
-
}) {
|
1940
|
-
return operationsByTag.records.deleteRecord({
|
1941
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, recordId: id },
|
1942
|
-
queryParams: { columns },
|
1943
|
-
...this.extraProps
|
1944
|
-
});
|
1945
|
-
}
|
1946
|
-
bulkInsertTableRecords({
|
1947
|
-
workspace,
|
1948
|
-
region,
|
1949
|
-
database,
|
1950
|
-
branch,
|
1951
|
-
table,
|
1952
|
-
records,
|
1953
|
-
columns
|
1954
|
-
}) {
|
1955
|
-
return operationsByTag.records.bulkInsertTableRecords({
|
1956
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1957
|
-
queryParams: { columns },
|
1958
|
-
body: { records },
|
1959
|
-
...this.extraProps
|
1960
|
-
});
|
1961
|
-
}
|
1962
|
-
branchTransaction({
|
1963
|
-
workspace,
|
1964
|
-
region,
|
1965
|
-
database,
|
1966
|
-
branch,
|
1967
|
-
operations
|
1968
|
-
}) {
|
1969
|
-
return operationsByTag.records.branchTransaction({
|
1970
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
1971
|
-
body: { operations },
|
1972
|
-
...this.extraProps
|
1973
|
-
});
|
1974
|
-
}
|
1975
|
-
}
|
1976
|
-
class FilesApi {
|
1977
|
-
constructor(extraProps) {
|
1978
|
-
this.extraProps = extraProps;
|
1979
|
-
}
|
1980
|
-
getFileItem({
|
1981
|
-
workspace,
|
1982
|
-
region,
|
1983
|
-
database,
|
1984
|
-
branch,
|
1985
|
-
table,
|
1986
|
-
record,
|
1987
|
-
column,
|
1988
|
-
fileId
|
1989
|
-
}) {
|
1990
|
-
return operationsByTag.files.getFileItem({
|
1991
|
-
pathParams: {
|
1992
|
-
workspace,
|
1993
|
-
region,
|
1994
|
-
dbBranchName: `${database}:${branch}`,
|
1995
|
-
tableName: table,
|
1996
|
-
recordId: record,
|
1997
|
-
columnName: column,
|
1998
|
-
fileId
|
1999
|
-
},
|
2000
|
-
...this.extraProps
|
2001
|
-
});
|
2002
|
-
}
|
2003
|
-
putFileItem({
|
2004
|
-
workspace,
|
2005
|
-
region,
|
2006
|
-
database,
|
2007
|
-
branch,
|
2008
|
-
table,
|
2009
|
-
record,
|
2010
|
-
column,
|
2011
|
-
fileId,
|
2012
|
-
file
|
2013
|
-
}) {
|
2014
|
-
return operationsByTag.files.putFileItem({
|
2015
|
-
pathParams: {
|
2016
|
-
workspace,
|
2017
|
-
region,
|
2018
|
-
dbBranchName: `${database}:${branch}`,
|
2019
|
-
tableName: table,
|
2020
|
-
recordId: record,
|
2021
|
-
columnName: column,
|
2022
|
-
fileId
|
2023
|
-
},
|
2024
|
-
// @ts-ignore
|
2025
|
-
body: file,
|
2026
|
-
...this.extraProps
|
2027
|
-
});
|
2028
|
-
}
|
2029
|
-
deleteFileItem({
|
2030
|
-
workspace,
|
2031
|
-
region,
|
2032
|
-
database,
|
2033
|
-
branch,
|
2034
|
-
table,
|
2035
|
-
record,
|
2036
|
-
column,
|
2037
|
-
fileId
|
2038
|
-
}) {
|
2039
|
-
return operationsByTag.files.deleteFileItem({
|
2040
|
-
pathParams: {
|
2041
|
-
workspace,
|
2042
|
-
region,
|
2043
|
-
dbBranchName: `${database}:${branch}`,
|
2044
|
-
tableName: table,
|
2045
|
-
recordId: record,
|
2046
|
-
columnName: column,
|
2047
|
-
fileId
|
2048
|
-
},
|
2049
|
-
...this.extraProps
|
2050
|
-
});
|
2051
|
-
}
|
2052
|
-
getFile({
|
2053
|
-
workspace,
|
2054
|
-
region,
|
2055
|
-
database,
|
2056
|
-
branch,
|
2057
|
-
table,
|
2058
|
-
record,
|
2059
|
-
column
|
2060
|
-
}) {
|
2061
|
-
return operationsByTag.files.getFile({
|
2062
|
-
pathParams: {
|
2063
|
-
workspace,
|
2064
|
-
region,
|
2065
|
-
dbBranchName: `${database}:${branch}`,
|
2066
|
-
tableName: table,
|
2067
|
-
recordId: record,
|
2068
|
-
columnName: column
|
2069
|
-
},
|
2070
|
-
...this.extraProps
|
2071
|
-
});
|
2072
|
-
}
|
2073
|
-
putFile({
|
2074
|
-
workspace,
|
2075
|
-
region,
|
2076
|
-
database,
|
2077
|
-
branch,
|
2078
|
-
table,
|
2079
|
-
record,
|
2080
|
-
column,
|
2081
|
-
file
|
2082
|
-
}) {
|
2083
|
-
return operationsByTag.files.putFile({
|
2084
|
-
pathParams: {
|
2085
|
-
workspace,
|
2086
|
-
region,
|
2087
|
-
dbBranchName: `${database}:${branch}`,
|
2088
|
-
tableName: table,
|
2089
|
-
recordId: record,
|
2090
|
-
columnName: column
|
2091
|
-
},
|
2092
|
-
body: file,
|
2093
|
-
...this.extraProps
|
2094
|
-
});
|
2095
|
-
}
|
2096
|
-
deleteFile({
|
2097
|
-
workspace,
|
2098
|
-
region,
|
2099
|
-
database,
|
2100
|
-
branch,
|
2101
|
-
table,
|
2102
|
-
record,
|
2103
|
-
column
|
2104
|
-
}) {
|
2105
|
-
return operationsByTag.files.deleteFile({
|
2106
|
-
pathParams: {
|
2107
|
-
workspace,
|
2108
|
-
region,
|
2109
|
-
dbBranchName: `${database}:${branch}`,
|
2110
|
-
tableName: table,
|
2111
|
-
recordId: record,
|
2112
|
-
columnName: column
|
2113
|
-
},
|
2114
|
-
...this.extraProps
|
2115
|
-
});
|
2116
|
-
}
|
2117
|
-
fileAccess({
|
2118
|
-
workspace,
|
2119
|
-
region,
|
2120
|
-
fileId,
|
2121
|
-
verify
|
2122
|
-
}) {
|
2123
|
-
return operationsByTag.files.fileAccess({
|
2124
|
-
pathParams: {
|
2125
|
-
workspace,
|
2126
|
-
region,
|
2127
|
-
fileId
|
2128
|
-
},
|
2129
|
-
queryParams: { verify },
|
2130
|
-
...this.extraProps
|
2131
|
-
});
|
2132
|
-
}
|
2133
|
-
}
|
2134
|
-
class SearchAndFilterApi {
|
2135
|
-
constructor(extraProps) {
|
2136
|
-
this.extraProps = extraProps;
|
2137
|
-
}
|
2138
|
-
queryTable({
|
2139
|
-
workspace,
|
2140
|
-
region,
|
2141
|
-
database,
|
2142
|
-
branch,
|
2143
|
-
table,
|
2144
|
-
filter,
|
2145
|
-
sort,
|
2146
|
-
page,
|
2147
|
-
columns,
|
2148
|
-
consistency
|
2149
|
-
}) {
|
2150
|
-
return operationsByTag.searchAndFilter.queryTable({
|
2151
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2152
|
-
body: { filter, sort, page, columns, consistency },
|
2153
|
-
...this.extraProps
|
2154
|
-
});
|
2155
|
-
}
|
2156
|
-
searchTable({
|
2157
|
-
workspace,
|
2158
|
-
region,
|
2159
|
-
database,
|
2160
|
-
branch,
|
2161
|
-
table,
|
2162
|
-
query,
|
2163
|
-
fuzziness,
|
2164
|
-
target,
|
2165
|
-
prefix,
|
2166
|
-
filter,
|
2167
|
-
highlight,
|
2168
|
-
boosters
|
2169
|
-
}) {
|
2170
|
-
return operationsByTag.searchAndFilter.searchTable({
|
2171
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2172
|
-
body: { query, fuzziness, target, prefix, filter, highlight, boosters },
|
2173
|
-
...this.extraProps
|
2174
|
-
});
|
2175
|
-
}
|
2176
|
-
searchBranch({
|
2177
|
-
workspace,
|
2178
|
-
region,
|
2179
|
-
database,
|
2180
|
-
branch,
|
2181
|
-
tables,
|
2182
|
-
query,
|
2183
|
-
fuzziness,
|
2184
|
-
prefix,
|
2185
|
-
highlight
|
2186
|
-
}) {
|
2187
|
-
return operationsByTag.searchAndFilter.searchBranch({
|
2188
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2189
|
-
body: { tables, query, fuzziness, prefix, highlight },
|
2190
|
-
...this.extraProps
|
2191
|
-
});
|
2192
|
-
}
|
2193
|
-
vectorSearchTable({
|
2194
|
-
workspace,
|
2195
|
-
region,
|
2196
|
-
database,
|
2197
|
-
branch,
|
2198
|
-
table,
|
2199
|
-
queryVector,
|
2200
|
-
column,
|
2201
|
-
similarityFunction,
|
2202
|
-
size,
|
2203
|
-
filter
|
2204
|
-
}) {
|
2205
|
-
return operationsByTag.searchAndFilter.vectorSearchTable({
|
2206
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2207
|
-
body: { queryVector, column, similarityFunction, size, filter },
|
2208
|
-
...this.extraProps
|
2209
|
-
});
|
2210
|
-
}
|
2211
|
-
askTable({
|
2212
|
-
workspace,
|
2213
|
-
region,
|
2214
|
-
database,
|
2215
|
-
branch,
|
2216
|
-
table,
|
2217
|
-
options
|
2218
|
-
}) {
|
2219
|
-
return operationsByTag.searchAndFilter.askTable({
|
2220
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2221
|
-
body: { ...options },
|
2222
|
-
...this.extraProps
|
2223
|
-
});
|
2224
|
-
}
|
2225
|
-
askTableSession({
|
2226
|
-
workspace,
|
2227
|
-
region,
|
2228
|
-
database,
|
2229
|
-
branch,
|
2230
|
-
table,
|
2231
|
-
sessionId,
|
2232
|
-
message
|
2233
|
-
}) {
|
2234
|
-
return operationsByTag.searchAndFilter.askTableSession({
|
2235
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
|
2236
|
-
body: { message },
|
2237
|
-
...this.extraProps
|
2238
|
-
});
|
2239
|
-
}
|
2240
|
-
summarizeTable({
|
2241
|
-
workspace,
|
2242
|
-
region,
|
2243
|
-
database,
|
2244
|
-
branch,
|
2245
|
-
table,
|
2246
|
-
filter,
|
2247
|
-
columns,
|
2248
|
-
summaries,
|
2249
|
-
sort,
|
2250
|
-
summariesFilter,
|
2251
|
-
page,
|
2252
|
-
consistency
|
2253
|
-
}) {
|
2254
|
-
return operationsByTag.searchAndFilter.summarizeTable({
|
2255
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2256
|
-
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
2257
|
-
...this.extraProps
|
2258
|
-
});
|
2259
|
-
}
|
2260
|
-
aggregateTable({
|
2261
|
-
workspace,
|
2262
|
-
region,
|
2263
|
-
database,
|
2264
|
-
branch,
|
2265
|
-
table,
|
2266
|
-
filter,
|
2267
|
-
aggs
|
2268
|
-
}) {
|
2269
|
-
return operationsByTag.searchAndFilter.aggregateTable({
|
2270
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
2271
|
-
body: { filter, aggs },
|
2272
|
-
...this.extraProps
|
2273
|
-
});
|
2274
|
-
}
|
2275
|
-
}
|
2276
|
-
class MigrationRequestsApi {
|
2277
|
-
constructor(extraProps) {
|
2278
|
-
this.extraProps = extraProps;
|
2279
|
-
}
|
2280
|
-
queryMigrationRequests({
|
2281
|
-
workspace,
|
2282
|
-
region,
|
2283
|
-
database,
|
2284
|
-
filter,
|
2285
|
-
sort,
|
2286
|
-
page,
|
2287
|
-
columns
|
2288
|
-
}) {
|
2289
|
-
return operationsByTag.migrationRequests.queryMigrationRequests({
|
2290
|
-
pathParams: { workspace, region, dbName: database },
|
2291
|
-
body: { filter, sort, page, columns },
|
2292
|
-
...this.extraProps
|
2293
|
-
});
|
2294
|
-
}
|
2295
|
-
createMigrationRequest({
|
2296
|
-
workspace,
|
2297
|
-
region,
|
2298
|
-
database,
|
2299
|
-
migration
|
2300
|
-
}) {
|
2301
|
-
return operationsByTag.migrationRequests.createMigrationRequest({
|
2302
|
-
pathParams: { workspace, region, dbName: database },
|
2303
|
-
body: migration,
|
2304
|
-
...this.extraProps
|
2305
|
-
});
|
2306
|
-
}
|
2307
|
-
getMigrationRequest({
|
2308
|
-
workspace,
|
2309
|
-
region,
|
2310
|
-
database,
|
2311
|
-
migrationRequest
|
2312
|
-
}) {
|
2313
|
-
return operationsByTag.migrationRequests.getMigrationRequest({
|
2314
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2315
|
-
...this.extraProps
|
2316
|
-
});
|
2317
|
-
}
|
2318
|
-
updateMigrationRequest({
|
2319
|
-
workspace,
|
2320
|
-
region,
|
2321
|
-
database,
|
2322
|
-
migrationRequest,
|
2323
|
-
update
|
2324
|
-
}) {
|
2325
|
-
return operationsByTag.migrationRequests.updateMigrationRequest({
|
2326
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2327
|
-
body: update,
|
2328
|
-
...this.extraProps
|
2329
|
-
});
|
2330
|
-
}
|
2331
|
-
listMigrationRequestsCommits({
|
2332
|
-
workspace,
|
2333
|
-
region,
|
2334
|
-
database,
|
2335
|
-
migrationRequest,
|
2336
|
-
page
|
2337
|
-
}) {
|
2338
|
-
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
2339
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2340
|
-
body: { page },
|
2341
|
-
...this.extraProps
|
2342
|
-
});
|
2343
|
-
}
|
2344
|
-
compareMigrationRequest({
|
2345
|
-
workspace,
|
2346
|
-
region,
|
2347
|
-
database,
|
2348
|
-
migrationRequest
|
2349
|
-
}) {
|
2350
|
-
return operationsByTag.migrationRequests.compareMigrationRequest({
|
2351
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2352
|
-
...this.extraProps
|
2353
|
-
});
|
2354
|
-
}
|
2355
|
-
getMigrationRequestIsMerged({
|
2356
|
-
workspace,
|
2357
|
-
region,
|
2358
|
-
database,
|
2359
|
-
migrationRequest
|
2360
|
-
}) {
|
2361
|
-
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
2362
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2363
|
-
...this.extraProps
|
2364
|
-
});
|
2365
|
-
}
|
2366
|
-
mergeMigrationRequest({
|
2367
|
-
workspace,
|
2368
|
-
region,
|
2369
|
-
database,
|
2370
|
-
migrationRequest
|
2371
|
-
}) {
|
2372
|
-
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
2373
|
-
pathParams: { workspace, region, dbName: database, mrNumber: migrationRequest },
|
2374
|
-
...this.extraProps
|
2375
|
-
});
|
2376
|
-
}
|
2377
|
-
}
|
2378
|
-
class MigrationsApi {
|
2379
|
-
constructor(extraProps) {
|
2380
|
-
this.extraProps = extraProps;
|
2381
|
-
}
|
2382
|
-
getBranchMigrationHistory({
|
2383
|
-
workspace,
|
2384
|
-
region,
|
2385
|
-
database,
|
2386
|
-
branch,
|
2387
|
-
limit,
|
2388
|
-
startFrom
|
2389
|
-
}) {
|
2390
|
-
return operationsByTag.migrations.getBranchMigrationHistory({
|
2391
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2392
|
-
body: { limit, startFrom },
|
2393
|
-
...this.extraProps
|
2394
|
-
});
|
2395
|
-
}
|
2396
|
-
getBranchMigrationPlan({
|
2397
|
-
workspace,
|
2398
|
-
region,
|
2399
|
-
database,
|
2400
|
-
branch,
|
2401
|
-
schema
|
2402
|
-
}) {
|
2403
|
-
return operationsByTag.migrations.getBranchMigrationPlan({
|
2404
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2405
|
-
body: schema,
|
2406
|
-
...this.extraProps
|
2407
|
-
});
|
2408
|
-
}
|
2409
|
-
executeBranchMigrationPlan({
|
2410
|
-
workspace,
|
2411
|
-
region,
|
2412
|
-
database,
|
2413
|
-
branch,
|
2414
|
-
plan
|
2415
|
-
}) {
|
2416
|
-
return operationsByTag.migrations.executeBranchMigrationPlan({
|
2417
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2418
|
-
body: plan,
|
2419
|
-
...this.extraProps
|
2420
|
-
});
|
2421
|
-
}
|
2422
|
-
getBranchSchemaHistory({
|
2423
|
-
workspace,
|
2424
|
-
region,
|
2425
|
-
database,
|
2426
|
-
branch,
|
2427
|
-
page
|
2428
|
-
}) {
|
2429
|
-
return operationsByTag.migrations.getBranchSchemaHistory({
|
2430
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2431
|
-
body: { page },
|
2432
|
-
...this.extraProps
|
2433
|
-
});
|
2434
|
-
}
|
2435
|
-
compareBranchWithUserSchema({
|
2436
|
-
workspace,
|
2437
|
-
region,
|
2438
|
-
database,
|
2439
|
-
branch,
|
2440
|
-
schema,
|
2441
|
-
schemaOperations,
|
2442
|
-
branchOperations
|
2443
|
-
}) {
|
2444
|
-
return operationsByTag.migrations.compareBranchWithUserSchema({
|
2445
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2446
|
-
body: { schema, schemaOperations, branchOperations },
|
2447
|
-
...this.extraProps
|
2448
|
-
});
|
2449
|
-
}
|
2450
|
-
compareBranchSchemas({
|
2451
|
-
workspace,
|
2452
|
-
region,
|
2453
|
-
database,
|
2454
|
-
branch,
|
2455
|
-
compare,
|
2456
|
-
sourceBranchOperations,
|
2457
|
-
targetBranchOperations
|
2458
|
-
}) {
|
2459
|
-
return operationsByTag.migrations.compareBranchSchemas({
|
2460
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, branchName: compare },
|
2461
|
-
body: { sourceBranchOperations, targetBranchOperations },
|
2462
|
-
...this.extraProps
|
2463
|
-
});
|
2464
|
-
}
|
2465
|
-
updateBranchSchema({
|
2466
|
-
workspace,
|
2467
|
-
region,
|
2468
|
-
database,
|
2469
|
-
branch,
|
2470
|
-
migration
|
2471
|
-
}) {
|
2472
|
-
return operationsByTag.migrations.updateBranchSchema({
|
2473
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2474
|
-
body: migration,
|
2475
|
-
...this.extraProps
|
2476
|
-
});
|
2477
|
-
}
|
2478
|
-
previewBranchSchemaEdit({
|
2479
|
-
workspace,
|
2480
|
-
region,
|
2481
|
-
database,
|
2482
|
-
branch,
|
2483
|
-
data
|
2484
|
-
}) {
|
2485
|
-
return operationsByTag.migrations.previewBranchSchemaEdit({
|
2486
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2487
|
-
body: data,
|
2488
|
-
...this.extraProps
|
2489
|
-
});
|
2490
|
-
}
|
2491
|
-
applyBranchSchemaEdit({
|
2492
|
-
workspace,
|
2493
|
-
region,
|
2494
|
-
database,
|
2495
|
-
branch,
|
2496
|
-
edits
|
2497
|
-
}) {
|
2498
|
-
return operationsByTag.migrations.applyBranchSchemaEdit({
|
2499
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2500
|
-
body: { edits },
|
2501
|
-
...this.extraProps
|
2502
|
-
});
|
2503
|
-
}
|
2504
|
-
pushBranchMigrations({
|
2505
|
-
workspace,
|
2506
|
-
region,
|
2507
|
-
database,
|
2508
|
-
branch,
|
2509
|
-
migrations
|
2510
|
-
}) {
|
2511
|
-
return operationsByTag.migrations.pushBranchMigrations({
|
2512
|
-
pathParams: { workspace, region, dbBranchName: `${database}:${branch}` },
|
2513
|
-
body: { migrations },
|
2514
|
-
...this.extraProps
|
2515
|
-
});
|
2516
|
-
}
|
2517
|
-
}
|
2518
|
-
class DatabaseApi {
|
2519
|
-
constructor(extraProps) {
|
2520
|
-
this.extraProps = extraProps;
|
2521
|
-
}
|
2522
|
-
getDatabaseList({ workspace }) {
|
2523
|
-
return operationsByTag.databases.getDatabaseList({
|
2524
|
-
pathParams: { workspaceId: workspace },
|
2525
|
-
...this.extraProps
|
2526
|
-
});
|
2527
|
-
}
|
2528
|
-
createDatabase({
|
2529
|
-
workspace,
|
2530
|
-
database,
|
2531
|
-
data,
|
2532
|
-
headers
|
2533
|
-
}) {
|
2534
|
-
return operationsByTag.databases.createDatabase({
|
2535
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2536
|
-
body: data,
|
2537
|
-
headers,
|
2538
|
-
...this.extraProps
|
2539
|
-
});
|
2540
|
-
}
|
2541
|
-
deleteDatabase({
|
2542
|
-
workspace,
|
2543
|
-
database
|
2544
|
-
}) {
|
2545
|
-
return operationsByTag.databases.deleteDatabase({
|
2546
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2547
|
-
...this.extraProps
|
2548
|
-
});
|
2549
|
-
}
|
2550
|
-
getDatabaseMetadata({
|
2551
|
-
workspace,
|
2552
|
-
database
|
2553
|
-
}) {
|
2554
|
-
return operationsByTag.databases.getDatabaseMetadata({
|
2555
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2556
|
-
...this.extraProps
|
2557
|
-
});
|
2558
|
-
}
|
2559
|
-
updateDatabaseMetadata({
|
2560
|
-
workspace,
|
2561
|
-
database,
|
2562
|
-
metadata
|
2563
|
-
}) {
|
2564
|
-
return operationsByTag.databases.updateDatabaseMetadata({
|
2565
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2566
|
-
body: metadata,
|
2567
|
-
...this.extraProps
|
2568
|
-
});
|
2569
|
-
}
|
2570
|
-
renameDatabase({
|
2571
|
-
workspace,
|
2572
|
-
database,
|
2573
|
-
newName
|
2574
|
-
}) {
|
2575
|
-
return operationsByTag.databases.renameDatabase({
|
2576
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2577
|
-
body: { newName },
|
2578
|
-
...this.extraProps
|
2579
|
-
});
|
2580
|
-
}
|
2581
|
-
getDatabaseGithubSettings({
|
2582
|
-
workspace,
|
2583
|
-
database
|
2584
|
-
}) {
|
2585
|
-
return operationsByTag.databases.getDatabaseGithubSettings({
|
2586
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2587
|
-
...this.extraProps
|
2588
|
-
});
|
2589
|
-
}
|
2590
|
-
updateDatabaseGithubSettings({
|
2591
|
-
workspace,
|
2592
|
-
database,
|
2593
|
-
settings
|
2594
|
-
}) {
|
2595
|
-
return operationsByTag.databases.updateDatabaseGithubSettings({
|
2596
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2597
|
-
body: settings,
|
2598
|
-
...this.extraProps
|
2599
|
-
});
|
2600
|
-
}
|
2601
|
-
deleteDatabaseGithubSettings({
|
2602
|
-
workspace,
|
2603
|
-
database
|
2604
|
-
}) {
|
2605
|
-
return operationsByTag.databases.deleteDatabaseGithubSettings({
|
2606
|
-
pathParams: { workspaceId: workspace, dbName: database },
|
2607
|
-
...this.extraProps
|
2608
|
-
});
|
1123
|
+
createTable,
|
1124
|
+
deleteTable,
|
1125
|
+
updateTable,
|
1126
|
+
getTableSchema,
|
1127
|
+
setTableSchema,
|
1128
|
+
getTableColumns,
|
1129
|
+
addTableColumn,
|
1130
|
+
getColumn,
|
1131
|
+
updateColumn,
|
1132
|
+
deleteColumn
|
1133
|
+
},
|
1134
|
+
records: {
|
1135
|
+
branchTransaction,
|
1136
|
+
insertRecord,
|
1137
|
+
getRecord,
|
1138
|
+
insertRecordWithID,
|
1139
|
+
updateRecordWithID,
|
1140
|
+
upsertRecordWithID,
|
1141
|
+
deleteRecord,
|
1142
|
+
bulkInsertTableRecords
|
1143
|
+
},
|
1144
|
+
files: { getFileItem, putFileItem, deleteFileItem, getFile, putFile, deleteFile, fileAccess, fileUpload },
|
1145
|
+
searchAndFilter: {
|
1146
|
+
queryTable,
|
1147
|
+
searchBranch,
|
1148
|
+
searchTable,
|
1149
|
+
vectorSearchTable,
|
1150
|
+
askTable,
|
1151
|
+
askTableSession,
|
1152
|
+
summarizeTable,
|
1153
|
+
aggregateTable
|
1154
|
+
},
|
1155
|
+
sql: { sqlQuery }
|
1156
|
+
};
|
1157
|
+
|
1158
|
+
const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
|
1159
|
+
|
1160
|
+
const getAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "get", ...variables, signal });
|
1161
|
+
const grantAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "post", ...variables, signal });
|
1162
|
+
const getUser = (variables, signal) => controlPlaneFetch({
|
1163
|
+
url: "/user",
|
1164
|
+
method: "get",
|
1165
|
+
...variables,
|
1166
|
+
signal
|
1167
|
+
});
|
1168
|
+
const updateUser = (variables, signal) => controlPlaneFetch({
|
1169
|
+
url: "/user",
|
1170
|
+
method: "put",
|
1171
|
+
...variables,
|
1172
|
+
signal
|
1173
|
+
});
|
1174
|
+
const deleteUser = (variables, signal) => controlPlaneFetch({
|
1175
|
+
url: "/user",
|
1176
|
+
method: "delete",
|
1177
|
+
...variables,
|
1178
|
+
signal
|
1179
|
+
});
|
1180
|
+
const getUserAPIKeys = (variables, signal) => controlPlaneFetch({
|
1181
|
+
url: "/user/keys",
|
1182
|
+
method: "get",
|
1183
|
+
...variables,
|
1184
|
+
signal
|
1185
|
+
});
|
1186
|
+
const createUserAPIKey = (variables, signal) => controlPlaneFetch({
|
1187
|
+
url: "/user/keys/{keyName}",
|
1188
|
+
method: "post",
|
1189
|
+
...variables,
|
1190
|
+
signal
|
1191
|
+
});
|
1192
|
+
const deleteUserAPIKey = (variables, signal) => controlPlaneFetch({
|
1193
|
+
url: "/user/keys/{keyName}",
|
1194
|
+
method: "delete",
|
1195
|
+
...variables,
|
1196
|
+
signal
|
1197
|
+
});
|
1198
|
+
const getUserOAuthClients = (variables, signal) => controlPlaneFetch({
|
1199
|
+
url: "/user/oauth/clients",
|
1200
|
+
method: "get",
|
1201
|
+
...variables,
|
1202
|
+
signal
|
1203
|
+
});
|
1204
|
+
const deleteUserOAuthClient = (variables, signal) => controlPlaneFetch({
|
1205
|
+
url: "/user/oauth/clients/{clientId}",
|
1206
|
+
method: "delete",
|
1207
|
+
...variables,
|
1208
|
+
signal
|
1209
|
+
});
|
1210
|
+
const getUserOAuthAccessTokens = (variables, signal) => controlPlaneFetch({
|
1211
|
+
url: "/user/oauth/tokens",
|
1212
|
+
method: "get",
|
1213
|
+
...variables,
|
1214
|
+
signal
|
1215
|
+
});
|
1216
|
+
const deleteOAuthAccessToken = (variables, signal) => controlPlaneFetch({
|
1217
|
+
url: "/user/oauth/tokens/{token}",
|
1218
|
+
method: "delete",
|
1219
|
+
...variables,
|
1220
|
+
signal
|
1221
|
+
});
|
1222
|
+
const updateOAuthAccessToken = (variables, signal) => controlPlaneFetch({ url: "/user/oauth/tokens/{token}", method: "patch", ...variables, signal });
|
1223
|
+
const getWorkspacesList = (variables, signal) => controlPlaneFetch({
|
1224
|
+
url: "/workspaces",
|
1225
|
+
method: "get",
|
1226
|
+
...variables,
|
1227
|
+
signal
|
1228
|
+
});
|
1229
|
+
const createWorkspace = (variables, signal) => controlPlaneFetch({
|
1230
|
+
url: "/workspaces",
|
1231
|
+
method: "post",
|
1232
|
+
...variables,
|
1233
|
+
signal
|
1234
|
+
});
|
1235
|
+
const getWorkspace = (variables, signal) => controlPlaneFetch({
|
1236
|
+
url: "/workspaces/{workspaceId}",
|
1237
|
+
method: "get",
|
1238
|
+
...variables,
|
1239
|
+
signal
|
1240
|
+
});
|
1241
|
+
const updateWorkspace = (variables, signal) => controlPlaneFetch({
|
1242
|
+
url: "/workspaces/{workspaceId}",
|
1243
|
+
method: "put",
|
1244
|
+
...variables,
|
1245
|
+
signal
|
1246
|
+
});
|
1247
|
+
const deleteWorkspace = (variables, signal) => controlPlaneFetch({
|
1248
|
+
url: "/workspaces/{workspaceId}",
|
1249
|
+
method: "delete",
|
1250
|
+
...variables,
|
1251
|
+
signal
|
1252
|
+
});
|
1253
|
+
const getWorkspaceMembersList = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members", method: "get", ...variables, signal });
|
1254
|
+
const updateWorkspaceMemberRole = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/members/{userId}", method: "put", ...variables, signal });
|
1255
|
+
const removeWorkspaceMember = (variables, signal) => controlPlaneFetch({
|
1256
|
+
url: "/workspaces/{workspaceId}/members/{userId}",
|
1257
|
+
method: "delete",
|
1258
|
+
...variables,
|
1259
|
+
signal
|
1260
|
+
});
|
1261
|
+
const inviteWorkspaceMember = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites", method: "post", ...variables, signal });
|
1262
|
+
const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "patch", ...variables, signal });
|
1263
|
+
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
1264
|
+
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
1265
|
+
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
1266
|
+
const listClusters = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "get", ...variables, signal });
|
1267
|
+
const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
|
1268
|
+
const getCluster = (variables, signal) => controlPlaneFetch({
|
1269
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
1270
|
+
method: "get",
|
1271
|
+
...variables,
|
1272
|
+
signal
|
1273
|
+
});
|
1274
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters/{clusterId}", method: "patch", ...variables, signal });
|
1275
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
1276
|
+
url: "/workspaces/{workspaceId}/dbs",
|
1277
|
+
method: "get",
|
1278
|
+
...variables,
|
1279
|
+
signal
|
1280
|
+
});
|
1281
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
1282
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
1283
|
+
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
1284
|
+
method: "delete",
|
1285
|
+
...variables,
|
1286
|
+
signal
|
1287
|
+
});
|
1288
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
1289
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
1290
|
+
const renameDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/rename", method: "post", ...variables, signal });
|
1291
|
+
const getDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "get", ...variables, signal });
|
1292
|
+
const updateDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "put", ...variables, signal });
|
1293
|
+
const deleteDatabaseGithubSettings = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}/github", method: "delete", ...variables, signal });
|
1294
|
+
const listRegions = (variables, signal) => controlPlaneFetch({
|
1295
|
+
url: "/workspaces/{workspaceId}/regions",
|
1296
|
+
method: "get",
|
1297
|
+
...variables,
|
1298
|
+
signal
|
1299
|
+
});
|
1300
|
+
const operationsByTag$1 = {
|
1301
|
+
oAuth: {
|
1302
|
+
getAuthorizationCode,
|
1303
|
+
grantAuthorizationCode,
|
1304
|
+
getUserOAuthClients,
|
1305
|
+
deleteUserOAuthClient,
|
1306
|
+
getUserOAuthAccessTokens,
|
1307
|
+
deleteOAuthAccessToken,
|
1308
|
+
updateOAuthAccessToken
|
1309
|
+
},
|
1310
|
+
users: { getUser, updateUser, deleteUser },
|
1311
|
+
authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
|
1312
|
+
workspaces: {
|
1313
|
+
getWorkspacesList,
|
1314
|
+
createWorkspace,
|
1315
|
+
getWorkspace,
|
1316
|
+
updateWorkspace,
|
1317
|
+
deleteWorkspace,
|
1318
|
+
getWorkspaceMembersList,
|
1319
|
+
updateWorkspaceMemberRole,
|
1320
|
+
removeWorkspaceMember
|
1321
|
+
},
|
1322
|
+
invites: {
|
1323
|
+
inviteWorkspaceMember,
|
1324
|
+
updateWorkspaceMemberInvite,
|
1325
|
+
cancelWorkspaceMemberInvite,
|
1326
|
+
acceptWorkspaceMemberInvite,
|
1327
|
+
resendWorkspaceMemberInvite
|
1328
|
+
},
|
1329
|
+
xbcontrolOther: { listClusters, createCluster, getCluster, updateCluster },
|
1330
|
+
databases: {
|
1331
|
+
getDatabaseList,
|
1332
|
+
createDatabase,
|
1333
|
+
deleteDatabase,
|
1334
|
+
getDatabaseMetadata,
|
1335
|
+
updateDatabaseMetadata,
|
1336
|
+
renameDatabase,
|
1337
|
+
getDatabaseGithubSettings,
|
1338
|
+
updateDatabaseGithubSettings,
|
1339
|
+
deleteDatabaseGithubSettings,
|
1340
|
+
listRegions
|
2609
1341
|
}
|
2610
|
-
|
2611
|
-
|
2612
|
-
|
2613
|
-
|
1342
|
+
};
|
1343
|
+
|
1344
|
+
const operationsByTag = deepMerge(operationsByTag$2, operationsByTag$1);
|
1345
|
+
|
1346
|
+
const buildApiClient = () => class {
|
1347
|
+
constructor(options = {}) {
|
1348
|
+
const provider = options.host ?? "production";
|
1349
|
+
const apiKey = options.apiKey ?? getAPIKey();
|
1350
|
+
const trace = options.trace ?? defaultTrace;
|
1351
|
+
const clientID = generateUUID();
|
1352
|
+
if (!apiKey) {
|
1353
|
+
throw new Error("Could not resolve a valid apiKey");
|
1354
|
+
}
|
1355
|
+
const extraProps = {
|
1356
|
+
apiUrl: getHostUrl(provider, "main"),
|
1357
|
+
workspacesApiUrl: getHostUrl(provider, "workspaces"),
|
1358
|
+
fetch: getFetchImplementation(options.fetch),
|
1359
|
+
apiKey,
|
1360
|
+
trace,
|
1361
|
+
clientName: options.clientName,
|
1362
|
+
xataAgentExtra: options.xataAgentExtra,
|
1363
|
+
clientID
|
1364
|
+
};
|
1365
|
+
return new Proxy(this, {
|
1366
|
+
get: (_target, namespace) => {
|
1367
|
+
if (operationsByTag[namespace] === void 0) {
|
1368
|
+
return void 0;
|
1369
|
+
}
|
1370
|
+
return new Proxy(
|
1371
|
+
{},
|
1372
|
+
{
|
1373
|
+
get: (_target2, operation) => {
|
1374
|
+
if (operationsByTag[namespace][operation] === void 0) {
|
1375
|
+
return void 0;
|
1376
|
+
}
|
1377
|
+
const method = operationsByTag[namespace][operation];
|
1378
|
+
return async (params) => {
|
1379
|
+
return await method({ ...params, ...extraProps });
|
1380
|
+
};
|
1381
|
+
}
|
1382
|
+
}
|
1383
|
+
);
|
1384
|
+
}
|
2614
1385
|
});
|
2615
1386
|
}
|
1387
|
+
};
|
1388
|
+
class XataApiClient extends buildApiClient() {
|
2616
1389
|
}
|
2617
1390
|
|
2618
1391
|
class XataApiPlugin {
|
@@ -2655,16 +1428,18 @@ function transformImage(url, ...transformations) {
|
|
2655
1428
|
class XataFile {
|
2656
1429
|
constructor(file) {
|
2657
1430
|
this.id = file.id;
|
2658
|
-
this.name = file.name
|
2659
|
-
this.mediaType = file.mediaType
|
1431
|
+
this.name = file.name;
|
1432
|
+
this.mediaType = file.mediaType;
|
2660
1433
|
this.base64Content = file.base64Content;
|
2661
|
-
this.enablePublicUrl = file.enablePublicUrl
|
2662
|
-
this.signedUrlTimeout = file.signedUrlTimeout
|
2663
|
-
this.
|
2664
|
-
this.
|
2665
|
-
this.
|
1434
|
+
this.enablePublicUrl = file.enablePublicUrl;
|
1435
|
+
this.signedUrlTimeout = file.signedUrlTimeout;
|
1436
|
+
this.uploadUrlTimeout = file.uploadUrlTimeout;
|
1437
|
+
this.size = file.size;
|
1438
|
+
this.version = file.version;
|
1439
|
+
this.url = file.url;
|
2666
1440
|
this.signedUrl = file.signedUrl;
|
2667
|
-
this.
|
1441
|
+
this.uploadUrl = file.uploadUrl;
|
1442
|
+
this.attributes = file.attributes;
|
2668
1443
|
}
|
2669
1444
|
static fromBuffer(buffer, options = {}) {
|
2670
1445
|
const base64Content = buffer.toString("base64");
|
@@ -2754,7 +1529,7 @@ class XataFile {
|
|
2754
1529
|
const parseInputFileEntry = async (entry) => {
|
2755
1530
|
if (!isDefined(entry))
|
2756
1531
|
return null;
|
2757
|
-
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
|
1532
|
+
const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout, uploadUrlTimeout } = await entry;
|
2758
1533
|
return compactObject({
|
2759
1534
|
id,
|
2760
1535
|
// Name cannot be an empty string in our API
|
@@ -2762,7 +1537,8 @@ const parseInputFileEntry = async (entry) => {
|
|
2762
1537
|
mediaType,
|
2763
1538
|
base64Content,
|
2764
1539
|
enablePublicUrl,
|
2765
|
-
signedUrlTimeout
|
1540
|
+
signedUrlTimeout,
|
1541
|
+
uploadUrlTimeout
|
2766
1542
|
});
|
2767
1543
|
};
|
2768
1544
|
|
@@ -3633,7 +2409,7 @@ class RestRepository extends Query {
|
|
3633
2409
|
}
|
3634
2410
|
async search(query, options = {}) {
|
3635
2411
|
return __privateGet$4(this, _trace).call(this, "search", async () => {
|
3636
|
-
const { records } = await searchTable({
|
2412
|
+
const { records, totalCount } = await searchTable({
|
3637
2413
|
pathParams: {
|
3638
2414
|
workspace: "{workspaceId}",
|
3639
2415
|
dbBranchName: "{dbBranch}",
|
@@ -3653,12 +2429,15 @@ class RestRepository extends Query {
|
|
3653
2429
|
...__privateGet$4(this, _getFetchProps).call(this)
|
3654
2430
|
});
|
3655
2431
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
3656
|
-
return
|
2432
|
+
return {
|
2433
|
+
records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
|
2434
|
+
totalCount
|
2435
|
+
};
|
3657
2436
|
});
|
3658
2437
|
}
|
3659
2438
|
async vectorSearch(column, query, options) {
|
3660
2439
|
return __privateGet$4(this, _trace).call(this, "vectorSearch", async () => {
|
3661
|
-
const { records } = await vectorSearchTable({
|
2440
|
+
const { records, totalCount } = await vectorSearchTable({
|
3662
2441
|
pathParams: {
|
3663
2442
|
workspace: "{workspaceId}",
|
3664
2443
|
dbBranchName: "{dbBranch}",
|
@@ -3675,7 +2454,10 @@ class RestRepository extends Query {
|
|
3675
2454
|
...__privateGet$4(this, _getFetchProps).call(this)
|
3676
2455
|
});
|
3677
2456
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
3678
|
-
return
|
2457
|
+
return {
|
2458
|
+
records: records.map((item) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), item, ["*"])),
|
2459
|
+
totalCount
|
2460
|
+
};
|
3679
2461
|
});
|
3680
2462
|
}
|
3681
2463
|
async aggregate(aggs, filter) {
|
@@ -4355,7 +3137,7 @@ function getContentType(file) {
|
|
4355
3137
|
if (typeof file === "string") {
|
4356
3138
|
return "text/plain";
|
4357
3139
|
}
|
4358
|
-
if ("mediaType" in file) {
|
3140
|
+
if ("mediaType" in file && file.mediaType !== void 0) {
|
4359
3141
|
return file.mediaType;
|
4360
3142
|
}
|
4361
3143
|
if (isBlob(file)) {
|
@@ -4403,22 +3185,26 @@ class SearchPlugin extends XataPlugin {
|
|
4403
3185
|
build(pluginOptions) {
|
4404
3186
|
return {
|
4405
3187
|
all: async (query, options = {}) => {
|
4406
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
3188
|
+
const { records, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
4407
3189
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
|
4408
|
-
return
|
4409
|
-
|
4410
|
-
|
4411
|
-
|
3190
|
+
return {
|
3191
|
+
totalCount,
|
3192
|
+
records: records.map((record) => {
|
3193
|
+
const { table = "orphan" } = record.xata;
|
3194
|
+
return { table, record: initObject(this.db, schemaTables, table, record, ["*"]) };
|
3195
|
+
})
|
3196
|
+
};
|
4412
3197
|
},
|
4413
3198
|
byTable: async (query, options = {}) => {
|
4414
|
-
const records = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
3199
|
+
const { records: rawRecords, totalCount } = await __privateMethod$1(this, _search, search_fn).call(this, query, options, pluginOptions);
|
4415
3200
|
const schemaTables = await __privateMethod$1(this, _getSchemaTables, getSchemaTables_fn).call(this, pluginOptions);
|
4416
|
-
|
3201
|
+
const records = rawRecords.reduce((acc, record) => {
|
4417
3202
|
const { table = "orphan" } = record.xata;
|
4418
3203
|
const items = acc[table] ?? [];
|
4419
3204
|
const item = initObject(this.db, schemaTables, table, record, ["*"]);
|
4420
3205
|
return { ...acc, [table]: [...items, item] };
|
4421
3206
|
}, {});
|
3207
|
+
return { totalCount, records };
|
4422
3208
|
}
|
4423
3209
|
};
|
4424
3210
|
}
|
@@ -4427,13 +3213,13 @@ _schemaTables = new WeakMap();
|
|
4427
3213
|
_search = new WeakSet();
|
4428
3214
|
search_fn = async function(query, options, pluginOptions) {
|
4429
3215
|
const { tables, fuzziness, highlight, prefix, page } = options ?? {};
|
4430
|
-
const { records } = await searchBranch({
|
3216
|
+
const { records, totalCount } = await searchBranch({
|
4431
3217
|
pathParams: { workspace: "{workspaceId}", dbBranchName: "{dbBranch}", region: "{region}" },
|
4432
3218
|
// @ts-ignore https://github.com/xataio/client-ts/issues/313
|
4433
3219
|
body: { tables, query, fuzziness, prefix, highlight, page },
|
4434
3220
|
...pluginOptions
|
4435
3221
|
});
|
4436
|
-
return records;
|
3222
|
+
return { records, totalCount };
|
4437
3223
|
};
|
4438
3224
|
_getSchemaTables = new WeakSet();
|
4439
3225
|
getSchemaTables_fn = async function(pluginOptions) {
|
@@ -4743,21 +3529,6 @@ const deserialize = (json) => {
|
|
4743
3529
|
return defaultSerializer.fromJSON(json);
|
4744
3530
|
};
|
4745
3531
|
|
4746
|
-
function buildWorkerRunner(config) {
|
4747
|
-
return function xataWorker(name, worker) {
|
4748
|
-
return async (...args) => {
|
4749
|
-
const url = process.env.NODE_ENV === "development" ? `http://localhost:64749/${name}` : `https://dispatcher.xata.workers.dev/${config.workspace}/${config.worker}/${name}`;
|
4750
|
-
const result = await fetch(url, {
|
4751
|
-
method: "POST",
|
4752
|
-
headers: { "Content-Type": "application/json" },
|
4753
|
-
body: serialize({ args })
|
4754
|
-
});
|
4755
|
-
const text = await result.text();
|
4756
|
-
return deserialize(text);
|
4757
|
-
};
|
4758
|
-
};
|
4759
|
-
}
|
4760
|
-
|
4761
3532
|
class XataError extends Error {
|
4762
3533
|
constructor(message, status) {
|
4763
3534
|
super(message);
|
@@ -4765,5 +3536,5 @@ class XataError extends Error {
|
|
4765
3536
|
}
|
4766
3537
|
}
|
4767
3538
|
|
4768
|
-
export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString,
|
3539
|
+
export { BaseClient, FetcherError, FilesPlugin, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, RecordColumnTypes, Repository, RestRepository, SQLPlugin, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, TransactionPlugin, XataApiClient, XataApiPlugin, XataError, XataFile, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, aggregateTable, applyBranchSchemaEdit, applyMigration, askTable, askTableSession, branchTransaction, buildClient, buildPreviewBranchName, buildProviderString, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, copyBranch, createBranch, createCluster, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteDatabaseGithubSettings, deleteFile, deleteFileItem, deleteOAuthAccessToken, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteUserOAuthClient, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, fileAccess, fileUpload, ge, getAPIKey, getAuthorizationCode, getBranch, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getCluster, getColumn, getDatabaseGithubSettings, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getFile, getFileItem, getGitBranchesMapping, getHostUrl, getMigrationRequest, getMigrationRequestIsMerged, getPreviewBranch, getRecord, getSchema, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getUserOAuthAccessTokens, getUserOAuthClients, getWorkspace, getWorkspaceMembersList, getWorkspacesList, grantAuthorizationCode, greaterEquals, greaterThan, greaterThanEquals, gt, gte, iContains, iPattern, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isHostProviderAlias, isHostProviderBuilder, isIdentifiable, isNot, isValidExpandedColumn, isValidSelectableColumns, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listClusters, listMigrationRequestsCommits, listRegions, lt, lte, mergeMigrationRequest, notExists, operationsByTag, parseProviderString, parseWorkspacesUrlParts, pattern, pgRollJobStatus, pgRollMigrationHistory, pgRollStatus, previewBranchSchemaEdit, pushBranchMigrations, putFile, putFileItem, queryMigrationRequests, queryTable, removeGitBranchesEntry, removeWorkspaceMember, renameDatabase, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, sqlQuery, startsWith, summarizeTable, transformImage, updateBranchMetadata, updateBranchSchema, updateCluster, updateColumn, updateDatabaseGithubSettings, updateDatabaseMetadata, updateMigrationRequest, updateOAuthAccessToken, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID, vectorSearchTable };
|
4769
3540
|
//# sourceMappingURL=index.mjs.map
|