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