@xata.io/client 0.17.0 → 0.17.1
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/CHANGELOG.md +16 -0
- package/README.md +25 -25
- package/dist/index.cjs +233 -42
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +558 -12
- package/dist/index.mjs +220 -43
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
@@ -2,13 +2,11 @@ const defaultTrace = async (_name, fn, _options) => {
|
|
2
2
|
return await fn({
|
3
3
|
setAttributes: () => {
|
4
4
|
return;
|
5
|
-
},
|
6
|
-
onError: () => {
|
7
|
-
return;
|
8
5
|
}
|
9
6
|
});
|
10
7
|
};
|
11
8
|
const TraceAttributes = {
|
9
|
+
KIND: "xata.trace.kind",
|
12
10
|
VERSION: "xata.sdk.version",
|
13
11
|
TABLE: "xata.table",
|
14
12
|
HTTP_REQUEST_ID: "http.request_id",
|
@@ -152,7 +150,7 @@ function getFetchImplementation(userFetch) {
|
|
152
150
|
return fetchImpl;
|
153
151
|
}
|
154
152
|
|
155
|
-
const VERSION = "0.17.
|
153
|
+
const VERSION = "0.17.1";
|
156
154
|
|
157
155
|
class ErrorWithCause extends Error {
|
158
156
|
constructor(message, options) {
|
@@ -203,7 +201,10 @@ const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
|
203
201
|
}, {});
|
204
202
|
const query = new URLSearchParams(cleanQueryParams).toString();
|
205
203
|
const queryString = query.length > 0 ? `?${query}` : "";
|
206
|
-
|
204
|
+
const cleanPathParams = Object.entries(pathParams).reduce((acc, [key, value]) => {
|
205
|
+
return { ...acc, [key]: encodeURIComponent(String(value ?? "")).replace("%3A", ":") };
|
206
|
+
}, {});
|
207
|
+
return url.replace(/\{\w*\}/g, (key) => cleanPathParams[key.slice(1, -1)]) + queryString;
|
207
208
|
};
|
208
209
|
function buildBaseUrl({
|
209
210
|
path,
|
@@ -211,10 +212,10 @@ function buildBaseUrl({
|
|
211
212
|
apiUrl,
|
212
213
|
pathParams
|
213
214
|
}) {
|
214
|
-
if (
|
215
|
+
if (pathParams?.workspace === void 0)
|
215
216
|
return `${apiUrl}${path}`;
|
216
217
|
const url = typeof workspacesApiUrl === "string" ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
217
|
-
return url.replace("{workspaceId}", pathParams.workspace);
|
218
|
+
return url.replace("{workspaceId}", String(pathParams.workspace));
|
218
219
|
}
|
219
220
|
function hostHeader(url) {
|
220
221
|
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
@@ -236,7 +237,7 @@ async function fetch$1({
|
|
236
237
|
}) {
|
237
238
|
return trace(
|
238
239
|
`${method.toUpperCase()} ${path}`,
|
239
|
-
async ({ setAttributes
|
240
|
+
async ({ setAttributes }) => {
|
240
241
|
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
241
242
|
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
242
243
|
const url = fullUrl.includes("localhost") ? fullUrl.replace(/^[^.]+\./, "http://") : fullUrl;
|
@@ -261,6 +262,7 @@ async function fetch$1({
|
|
261
262
|
const { host, protocol } = parseUrl(response.url);
|
262
263
|
const requestId = response.headers?.get("x-request-id") ?? void 0;
|
263
264
|
setAttributes({
|
265
|
+
[TraceAttributes.KIND]: "http",
|
264
266
|
[TraceAttributes.HTTP_REQUEST_ID]: requestId,
|
265
267
|
[TraceAttributes.HTTP_STATUS_CODE]: response.status,
|
266
268
|
[TraceAttributes.HTTP_HOST]: host,
|
@@ -273,9 +275,7 @@ async function fetch$1({
|
|
273
275
|
}
|
274
276
|
throw new FetcherError(response.status, jsonResponse, requestId);
|
275
277
|
} catch (error) {
|
276
|
-
|
277
|
-
onError(fetcherError.message);
|
278
|
-
throw fetcherError;
|
278
|
+
throw new FetcherError(response.status, error, requestId);
|
279
279
|
}
|
280
280
|
},
|
281
281
|
{ [TraceAttributes.HTTP_METHOD]: method.toUpperCase(), [TraceAttributes.HTTP_ROUTE]: path }
|
@@ -394,6 +394,22 @@ const resolveBranch = (variables) => fetch$1({
|
|
394
394
|
method: "get",
|
395
395
|
...variables
|
396
396
|
});
|
397
|
+
const listMigrationRequests = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/list", method: "post", ...variables });
|
398
|
+
const createMigrationRequest = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations", method: "post", ...variables });
|
399
|
+
const getMigrationRequest = (variables) => fetch$1({
|
400
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}",
|
401
|
+
method: "get",
|
402
|
+
...variables
|
403
|
+
});
|
404
|
+
const updateMigrationRequest = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}", method: "patch", ...variables });
|
405
|
+
const listMigrationRequestsCommits = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/commits", method: "post", ...variables });
|
406
|
+
const compareMigrationRequest = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/compare", method: "post", ...variables });
|
407
|
+
const getMigrationRequestIsMerged = (variables) => fetch$1({ url: "/dbs/{dbName}/migrations/{mrNumber}/merge", method: "get", ...variables });
|
408
|
+
const mergeMigrationRequest = (variables) => fetch$1({
|
409
|
+
url: "/dbs/{dbName}/migrations/{mrNumber}/merge",
|
410
|
+
method: "post",
|
411
|
+
...variables
|
412
|
+
});
|
397
413
|
const getBranchDetails = (variables) => fetch$1({
|
398
414
|
url: "/db/{dbBranchName}",
|
399
415
|
method: "get",
|
@@ -418,6 +434,16 @@ const getBranchMetadata = (variables) => fetch$1({
|
|
418
434
|
const getBranchMigrationHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables });
|
419
435
|
const executeBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables });
|
420
436
|
const getBranchMigrationPlan = (variables) => fetch$1({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables });
|
437
|
+
const compareBranchWithUserSchema = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare", method: "post", ...variables });
|
438
|
+
const compareBranchSchemas = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/compare/{branchName}", method: "post", ...variables });
|
439
|
+
const updateBranchSchema = (variables) => fetch$1({
|
440
|
+
url: "/db/{dbBranchName}/schema/update",
|
441
|
+
method: "post",
|
442
|
+
...variables
|
443
|
+
});
|
444
|
+
const previewBranchSchemaEdit = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/preview", method: "post", ...variables });
|
445
|
+
const applyBranchSchemaEdit = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/apply", method: "post", ...variables });
|
446
|
+
const getBranchSchemaHistory = (variables) => fetch$1({ url: "/db/{dbBranchName}/schema/history", method: "post", ...variables });
|
421
447
|
const getBranchStats = (variables) => fetch$1({
|
422
448
|
url: "/db/{dbBranchName}/stats",
|
423
449
|
method: "get",
|
@@ -537,10 +563,28 @@ const operationsByTag = {
|
|
537
563
|
deleteBranch,
|
538
564
|
updateBranchMetadata,
|
539
565
|
getBranchMetadata,
|
566
|
+
getBranchStats
|
567
|
+
},
|
568
|
+
migrationRequests: {
|
569
|
+
listMigrationRequests,
|
570
|
+
createMigrationRequest,
|
571
|
+
getMigrationRequest,
|
572
|
+
updateMigrationRequest,
|
573
|
+
listMigrationRequestsCommits,
|
574
|
+
compareMigrationRequest,
|
575
|
+
getMigrationRequestIsMerged,
|
576
|
+
mergeMigrationRequest
|
577
|
+
},
|
578
|
+
branchSchema: {
|
540
579
|
getBranchMigrationHistory,
|
541
580
|
executeBranchMigrationPlan,
|
542
581
|
getBranchMigrationPlan,
|
543
|
-
|
582
|
+
compareBranchWithUserSchema,
|
583
|
+
compareBranchSchemas,
|
584
|
+
updateBranchSchema,
|
585
|
+
previewBranchSchemaEdit,
|
586
|
+
applyBranchSchemaEdit,
|
587
|
+
getBranchSchemaHistory
|
544
588
|
},
|
545
589
|
table: {
|
546
590
|
createTable,
|
@@ -569,9 +613,9 @@ const operationsByTag = {
|
|
569
613
|
};
|
570
614
|
|
571
615
|
function getHostUrl(provider, type) {
|
572
|
-
if (
|
616
|
+
if (isHostProviderAlias(provider)) {
|
573
617
|
return providers[provider][type];
|
574
|
-
} else if (
|
618
|
+
} else if (isHostProviderBuilder(provider)) {
|
575
619
|
return provider[type];
|
576
620
|
}
|
577
621
|
throw new Error("Invalid API provider");
|
@@ -586,10 +630,10 @@ const providers = {
|
|
586
630
|
workspaces: "https://{workspaceId}.staging.xatabase.co"
|
587
631
|
}
|
588
632
|
};
|
589
|
-
function
|
633
|
+
function isHostProviderAlias(alias) {
|
590
634
|
return isString(alias) && Object.keys(providers).includes(alias);
|
591
635
|
}
|
592
|
-
function
|
636
|
+
function isHostProviderBuilder(builder) {
|
593
637
|
return isObject(builder) && isString(builder.main) && isString(builder.workspaces);
|
594
638
|
}
|
595
639
|
|
@@ -660,6 +704,16 @@ class XataApiClient {
|
|
660
704
|
__privateGet$7(this, _namespaces).records = new RecordsApi(__privateGet$7(this, _extraProps));
|
661
705
|
return __privateGet$7(this, _namespaces).records;
|
662
706
|
}
|
707
|
+
get migrationRequests() {
|
708
|
+
if (!__privateGet$7(this, _namespaces).migrationRequests)
|
709
|
+
__privateGet$7(this, _namespaces).migrationRequests = new MigrationRequestsApi(__privateGet$7(this, _extraProps));
|
710
|
+
return __privateGet$7(this, _namespaces).migrationRequests;
|
711
|
+
}
|
712
|
+
get branchSchema() {
|
713
|
+
if (!__privateGet$7(this, _namespaces).branchSchema)
|
714
|
+
__privateGet$7(this, _namespaces).branchSchema = new BranchSchemaApi(__privateGet$7(this, _extraProps));
|
715
|
+
return __privateGet$7(this, _namespaces).branchSchema;
|
716
|
+
}
|
663
717
|
}
|
664
718
|
_extraProps = new WeakMap();
|
665
719
|
_namespaces = new WeakMap();
|
@@ -876,27 +930,6 @@ class BranchApi {
|
|
876
930
|
...this.extraProps
|
877
931
|
});
|
878
932
|
}
|
879
|
-
getBranchMigrationHistory(workspace, database, branch, options = {}) {
|
880
|
-
return operationsByTag.branch.getBranchMigrationHistory({
|
881
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
882
|
-
body: options,
|
883
|
-
...this.extraProps
|
884
|
-
});
|
885
|
-
}
|
886
|
-
executeBranchMigrationPlan(workspace, database, branch, migrationPlan) {
|
887
|
-
return operationsByTag.branch.executeBranchMigrationPlan({
|
888
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
889
|
-
body: migrationPlan,
|
890
|
-
...this.extraProps
|
891
|
-
});
|
892
|
-
}
|
893
|
-
getBranchMigrationPlan(workspace, database, branch, schema) {
|
894
|
-
return operationsByTag.branch.getBranchMigrationPlan({
|
895
|
-
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
896
|
-
body: schema,
|
897
|
-
...this.extraProps
|
898
|
-
});
|
899
|
-
}
|
900
933
|
getBranchStats(workspace, database, branch) {
|
901
934
|
return operationsByTag.branch.getBranchStats({
|
902
935
|
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
@@ -1053,6 +1086,131 @@ class RecordsApi {
|
|
1053
1086
|
});
|
1054
1087
|
}
|
1055
1088
|
}
|
1089
|
+
class MigrationRequestsApi {
|
1090
|
+
constructor(extraProps) {
|
1091
|
+
this.extraProps = extraProps;
|
1092
|
+
}
|
1093
|
+
listMigrationRequests(workspace, database, options = {}) {
|
1094
|
+
return operationsByTag.migrationRequests.listMigrationRequests({
|
1095
|
+
pathParams: { workspace, dbName: database },
|
1096
|
+
body: options,
|
1097
|
+
...this.extraProps
|
1098
|
+
});
|
1099
|
+
}
|
1100
|
+
createMigrationRequest(workspace, database, options) {
|
1101
|
+
return operationsByTag.migrationRequests.createMigrationRequest({
|
1102
|
+
pathParams: { workspace, dbName: database },
|
1103
|
+
body: options,
|
1104
|
+
...this.extraProps
|
1105
|
+
});
|
1106
|
+
}
|
1107
|
+
getMigrationRequest(workspace, database, migrationRequest) {
|
1108
|
+
return operationsByTag.migrationRequests.getMigrationRequest({
|
1109
|
+
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1110
|
+
...this.extraProps
|
1111
|
+
});
|
1112
|
+
}
|
1113
|
+
updateMigrationRequest(workspace, database, migrationRequest, options) {
|
1114
|
+
return operationsByTag.migrationRequests.updateMigrationRequest({
|
1115
|
+
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1116
|
+
body: options,
|
1117
|
+
...this.extraProps
|
1118
|
+
});
|
1119
|
+
}
|
1120
|
+
listMigrationRequestsCommits(workspace, database, migrationRequest, options = {}) {
|
1121
|
+
return operationsByTag.migrationRequests.listMigrationRequestsCommits({
|
1122
|
+
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1123
|
+
body: options,
|
1124
|
+
...this.extraProps
|
1125
|
+
});
|
1126
|
+
}
|
1127
|
+
compareMigrationRequest(workspace, database, migrationRequest) {
|
1128
|
+
return operationsByTag.migrationRequests.compareMigrationRequest({
|
1129
|
+
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1130
|
+
...this.extraProps
|
1131
|
+
});
|
1132
|
+
}
|
1133
|
+
getMigrationRequestIsMerged(workspace, database, migrationRequest) {
|
1134
|
+
return operationsByTag.migrationRequests.getMigrationRequestIsMerged({
|
1135
|
+
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1136
|
+
...this.extraProps
|
1137
|
+
});
|
1138
|
+
}
|
1139
|
+
mergeMigrationRequest(workspace, database, migrationRequest) {
|
1140
|
+
return operationsByTag.migrationRequests.mergeMigrationRequest({
|
1141
|
+
pathParams: { workspace, dbName: database, mrNumber: migrationRequest },
|
1142
|
+
...this.extraProps
|
1143
|
+
});
|
1144
|
+
}
|
1145
|
+
}
|
1146
|
+
class BranchSchemaApi {
|
1147
|
+
constructor(extraProps) {
|
1148
|
+
this.extraProps = extraProps;
|
1149
|
+
}
|
1150
|
+
getBranchMigrationHistory(workspace, database, branch, options = {}) {
|
1151
|
+
return operationsByTag.branchSchema.getBranchMigrationHistory({
|
1152
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1153
|
+
body: options,
|
1154
|
+
...this.extraProps
|
1155
|
+
});
|
1156
|
+
}
|
1157
|
+
executeBranchMigrationPlan(workspace, database, branch, migrationPlan) {
|
1158
|
+
return operationsByTag.branchSchema.executeBranchMigrationPlan({
|
1159
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1160
|
+
body: migrationPlan,
|
1161
|
+
...this.extraProps
|
1162
|
+
});
|
1163
|
+
}
|
1164
|
+
getBranchMigrationPlan(workspace, database, branch, schema) {
|
1165
|
+
return operationsByTag.branchSchema.getBranchMigrationPlan({
|
1166
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1167
|
+
body: schema,
|
1168
|
+
...this.extraProps
|
1169
|
+
});
|
1170
|
+
}
|
1171
|
+
compareBranchWithUserSchema(workspace, database, branch, schema) {
|
1172
|
+
return operationsByTag.branchSchema.compareBranchWithUserSchema({
|
1173
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1174
|
+
body: { schema },
|
1175
|
+
...this.extraProps
|
1176
|
+
});
|
1177
|
+
}
|
1178
|
+
compareBranchSchemas(workspace, database, branch, branchName, schema) {
|
1179
|
+
return operationsByTag.branchSchema.compareBranchSchemas({
|
1180
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}`, branchName },
|
1181
|
+
body: { schema },
|
1182
|
+
...this.extraProps
|
1183
|
+
});
|
1184
|
+
}
|
1185
|
+
updateBranchSchema(workspace, database, branch, migration) {
|
1186
|
+
return operationsByTag.branchSchema.updateBranchSchema({
|
1187
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1188
|
+
body: migration,
|
1189
|
+
...this.extraProps
|
1190
|
+
});
|
1191
|
+
}
|
1192
|
+
previewBranchSchemaEdit(workspace, database, branch, migration) {
|
1193
|
+
return operationsByTag.branchSchema.previewBranchSchemaEdit({
|
1194
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1195
|
+
body: migration,
|
1196
|
+
...this.extraProps
|
1197
|
+
});
|
1198
|
+
}
|
1199
|
+
applyBranchSchemaEdit(workspace, database, branch, edits) {
|
1200
|
+
return operationsByTag.branchSchema.applyBranchSchemaEdit({
|
1201
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1202
|
+
body: { edits },
|
1203
|
+
...this.extraProps
|
1204
|
+
});
|
1205
|
+
}
|
1206
|
+
getBranchSchemaHistory(workspace, database, branch, options = {}) {
|
1207
|
+
return operationsByTag.branchSchema.getBranchSchemaHistory({
|
1208
|
+
pathParams: { workspace, dbBranchName: `${database}:${branch}` },
|
1209
|
+
body: options,
|
1210
|
+
...this.extraProps
|
1211
|
+
});
|
1212
|
+
}
|
1213
|
+
}
|
1056
1214
|
|
1057
1215
|
class XataApiPlugin {
|
1058
1216
|
async build(options) {
|
@@ -1236,14 +1394,22 @@ const _Query = class {
|
|
1236
1394
|
}
|
1237
1395
|
filter(a, b) {
|
1238
1396
|
if (arguments.length === 1) {
|
1239
|
-
const constraints = Object.entries(a).map(([column, constraint]) => ({ [column]: constraint }));
|
1397
|
+
const constraints = Object.entries(a ?? {}).map(([column, constraint]) => ({ [column]: constraint }));
|
1240
1398
|
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1241
1399
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1242
1400
|
} else {
|
1243
|
-
const
|
1401
|
+
const constraints = isDefined(a) && isDefined(b) ? [{ [a]: this.defaultFilter(a, b) }] : void 0;
|
1402
|
+
const $all = compact([__privateGet$5(this, _data).filter?.$all].flat().concat(constraints));
|
1244
1403
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { filter: { $all } }, __privateGet$5(this, _data));
|
1245
1404
|
}
|
1246
1405
|
}
|
1406
|
+
defaultFilter(column, value) {
|
1407
|
+
const columnType = __privateGet$5(this, _table$1).schema?.columns.find(({ name }) => name === column)?.type;
|
1408
|
+
if (columnType === "multiple" && (isString(value) || isStringArray(value))) {
|
1409
|
+
return { $includes: value };
|
1410
|
+
}
|
1411
|
+
return value;
|
1412
|
+
}
|
1247
1413
|
sort(column, direction = "asc") {
|
1248
1414
|
const originalSort = [__privateGet$5(this, _data).sort ?? []].flat();
|
1249
1415
|
const sort = [...originalSort, { column, direction }];
|
@@ -1385,7 +1551,11 @@ class Repository extends Query {
|
|
1385
1551
|
}
|
1386
1552
|
class RestRepository extends Query {
|
1387
1553
|
constructor(options) {
|
1388
|
-
super(
|
1554
|
+
super(
|
1555
|
+
null,
|
1556
|
+
{ name: options.table, schema: options.schemaTables?.find((table) => table.name === options.table) },
|
1557
|
+
{}
|
1558
|
+
);
|
1389
1559
|
__privateAdd$4(this, _insertRecordWithoutId);
|
1390
1560
|
__privateAdd$4(this, _insertRecordWithId);
|
1391
1561
|
__privateAdd$4(this, _bulkInsertTableRecords);
|
@@ -1411,6 +1581,7 @@ class RestRepository extends Query {
|
|
1411
1581
|
return trace(name, fn, {
|
1412
1582
|
...options2,
|
1413
1583
|
[TraceAttributes.TABLE]: __privateGet$4(this, _table),
|
1584
|
+
[TraceAttributes.KIND]: "sdk-operation",
|
1414
1585
|
[TraceAttributes.VERSION]: VERSION
|
1415
1586
|
});
|
1416
1587
|
});
|
@@ -1571,7 +1742,7 @@ class RestRepository extends Query {
|
|
1571
1742
|
return new Page(query, cacheQuery.meta, cacheQuery.records);
|
1572
1743
|
const data = query.getQueryOptions();
|
1573
1744
|
const body = {
|
1574
|
-
filter:
|
1745
|
+
filter: cleanFilter(data.filter),
|
1575
1746
|
sort: data.sort !== void 0 ? buildSortFilter(data.sort) : void 0,
|
1576
1747
|
page: data.pagination,
|
1577
1748
|
columns: data.columns
|
@@ -1789,6 +1960,12 @@ function extractId(value) {
|
|
1789
1960
|
return value.id;
|
1790
1961
|
return void 0;
|
1791
1962
|
}
|
1963
|
+
function cleanFilter(filter) {
|
1964
|
+
if (!filter)
|
1965
|
+
return void 0;
|
1966
|
+
const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
|
1967
|
+
return values.length > 0 ? filter : void 0;
|
1968
|
+
}
|
1792
1969
|
|
1793
1970
|
var __accessCheck$3 = (obj, member, msg) => {
|
1794
1971
|
if (!member.has(obj))
|
@@ -2161,7 +2338,7 @@ const buildClient = (plugins) => {
|
|
2161
2338
|
apiUrl: "",
|
2162
2339
|
workspacesApiUrl: (path, params) => {
|
2163
2340
|
const hasBranch = params.dbBranchName ?? params.branch;
|
2164
|
-
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch ? `:${branchValue}` : "");
|
2341
|
+
const newPath = path.replace(/^\/db\/[^/]+/, hasBranch !== void 0 ? `:${branchValue}` : "");
|
2165
2342
|
return databaseURL + newPath;
|
2166
2343
|
},
|
2167
2344
|
trace
|
@@ -2276,5 +2453,5 @@ class XataError extends Error {
|
|
2276
2453
|
}
|
2277
2454
|
}
|
2278
2455
|
|
2279
|
-
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, contains, createBranch, createDatabase, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, lt, lte, notExists, operationsByTag, pattern, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateColumn, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
2456
|
+
export { BaseClient, operationsByTag as Operations, PAGINATION_DEFAULT_OFFSET, PAGINATION_DEFAULT_SIZE, PAGINATION_MAX_OFFSET, PAGINATION_MAX_SIZE, Page, Query, RecordArray, Repository, RestRepository, SchemaPlugin, SearchPlugin, Serializer, SimpleCache, XataApiClient, XataApiPlugin, XataError, XataPlugin, acceptWorkspaceMemberInvite, addGitBranchesEntry, addTableColumn, applyBranchSchemaEdit, buildClient, buildWorkerRunner, bulkInsertTableRecords, cancelWorkspaceMemberInvite, compareBranchSchemas, compareBranchWithUserSchema, compareMigrationRequest, contains, createBranch, createDatabase, createMigrationRequest, createTable, createUserAPIKey, createWorkspace, deleteBranch, deleteColumn, deleteDatabase, deleteRecord, deleteTable, deleteUser, deleteUserAPIKey, deleteWorkspace, deserialize, endsWith, equals, executeBranchMigrationPlan, exists, ge, getAPIKey, getBranchDetails, getBranchList, getBranchMetadata, getBranchMigrationHistory, getBranchMigrationPlan, getBranchSchemaHistory, getBranchStats, getColumn, getCurrentBranchDetails, getCurrentBranchName, getDatabaseList, getDatabaseMetadata, getDatabaseURL, getGitBranchesMapping, getMigrationRequest, getMigrationRequestIsMerged, getRecord, getTableColumns, getTableSchema, getUser, getUserAPIKeys, getWorkspace, getWorkspaceMembersList, getWorkspacesList, greaterEquals, greaterThan, greaterThanEquals, gt, gte, includes, includesAll, includesAny, includesNone, insertRecord, insertRecordWithID, inviteWorkspaceMember, is, isCursorPaginationOptions, isIdentifiable, isNot, isXataRecord, le, lessEquals, lessThan, lessThanEquals, listMigrationRequests, listMigrationRequestsCommits, lt, lte, mergeMigrationRequest, notExists, operationsByTag, pattern, previewBranchSchemaEdit, queryTable, removeGitBranchesEntry, removeWorkspaceMember, resendWorkspaceMemberInvite, resolveBranch, searchBranch, searchTable, serialize, setTableSchema, startsWith, updateBranchMetadata, updateBranchSchema, updateColumn, updateMigrationRequest, updateRecordWithID, updateTable, updateUser, updateWorkspace, updateWorkspaceMemberInvite, updateWorkspaceMemberRole, upsertRecordWithID };
|
2280
2457
|
//# sourceMappingURL=index.mjs.map
|