@xata.io/client 0.26.6 → 0.26.8
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 +18 -0
- package/dist/index.cjs +121 -197
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +328 -10
- package/dist/index.mjs +115 -198
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
|
2
|
-
> @xata.io/client@0.26.
|
2
|
+
> @xata.io/client@0.26.8 build /home/runner/work/client-ts/client-ts/packages/client
|
3
3
|
> rimraf dist && rollup -c
|
4
4
|
|
5
5
|
[36m
|
6
6
|
[1msrc/index.ts[22m → [1mdist/index.cjs[22m...[39m
|
7
|
-
[32mcreated [1mdist/index.cjs[22m in [1m1.
|
7
|
+
[32mcreated [1mdist/index.cjs[22m in [1m1.4s[22m[39m
|
8
8
|
[36m
|
9
9
|
[1msrc/index.ts[22m → [1mdist/index.mjs[22m...[39m
|
10
|
-
[32mcreated [1mdist/index.mjs[22m in [
|
10
|
+
[32mcreated [1mdist/index.mjs[22m in [1m1s[22m[39m
|
11
11
|
[36m
|
12
12
|
[1msrc/index.ts[22m → [1mdist/index.d.ts[22m...[39m
|
13
|
-
[32mcreated [1mdist/index.d.ts[22m in [
|
13
|
+
[32mcreated [1mdist/index.d.ts[22m in [1m11s[22m[39m
|
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,23 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.26.8
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#1222](https://github.com/xataio/client-ts/pull/1222) [`fa2883b0`](https://github.com/xataio/client-ts/commit/fa2883b0639e48d68097401bf515c8cb95df5b4b) Thanks [@SferaDev](https://github.com/SferaDev)! - Increase recursion for circular references to 3
|
8
|
+
|
9
|
+
- [#1216](https://github.com/xataio/client-ts/pull/1216) [`c04faece`](https://github.com/xataio/client-ts/commit/c04faece8830699d978e03c89f29e383e479e824) Thanks [@SferaDev](https://github.com/SferaDev)! - Support binary upload of XataFile
|
10
|
+
|
11
|
+
- [#1217](https://github.com/xataio/client-ts/pull/1217) [`cb45cc9f`](https://github.com/xataio/client-ts/commit/cb45cc9f6829e1b555762e656cc1b0b2e977aaf9) Thanks [@eemmiillyy](https://github.com/eemmiillyy)! - JSON responses for JSON fields in summarize API
|
12
|
+
|
13
|
+
## 0.26.7
|
14
|
+
|
15
|
+
### Patch Changes
|
16
|
+
|
17
|
+
- [#1205](https://github.com/xataio/client-ts/pull/1205) [`0e1c50de`](https://github.com/xataio/client-ts/commit/0e1c50de5850db2dfbbdfff9d66eda3bf1322836) Thanks [@eemmiillyy](https://github.com/eemmiillyy)! - Add optional mediaType override to binary file API
|
18
|
+
|
19
|
+
- [#1203](https://github.com/xataio/client-ts/pull/1203) [`d093d363`](https://github.com/xataio/client-ts/commit/d093d363a51fc23c8513d51600bb3b31bbc45334) Thanks [@SferaDev](https://github.com/SferaDev)! - [Attachments] Fix column selection
|
20
|
+
|
3
21
|
## 0.26.6
|
4
22
|
|
5
23
|
### Patch Changes
|
package/dist/index.cjs
CHANGED
@@ -244,12 +244,6 @@ function getPreviewBranch() {
|
|
244
244
|
}
|
245
245
|
}
|
246
246
|
|
247
|
-
var __defProp$8 = Object.defineProperty;
|
248
|
-
var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
249
|
-
var __publicField$8 = (obj, key, value) => {
|
250
|
-
__defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
|
251
|
-
return value;
|
252
|
-
};
|
253
247
|
var __accessCheck$8 = (obj, member, msg) => {
|
254
248
|
if (!member.has(obj))
|
255
249
|
throw TypeError("Cannot " + msg);
|
@@ -289,8 +283,6 @@ class ApiRequestPool {
|
|
289
283
|
__privateAdd$8(this, _fetch, void 0);
|
290
284
|
__privateAdd$8(this, _queue, void 0);
|
291
285
|
__privateAdd$8(this, _concurrency, void 0);
|
292
|
-
__publicField$8(this, "running");
|
293
|
-
__publicField$8(this, "started");
|
294
286
|
__privateSet$8(this, _queue, []);
|
295
287
|
__privateSet$8(this, _concurrency, concurrency);
|
296
288
|
this.running = 0;
|
@@ -536,26 +528,16 @@ function defaultOnOpen(response) {
|
|
536
528
|
}
|
537
529
|
}
|
538
530
|
|
539
|
-
const VERSION = "0.26.
|
531
|
+
const VERSION = "0.26.8";
|
540
532
|
|
541
|
-
var __defProp$7 = Object.defineProperty;
|
542
|
-
var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
543
|
-
var __publicField$7 = (obj, key, value) => {
|
544
|
-
__defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
|
545
|
-
return value;
|
546
|
-
};
|
547
533
|
class ErrorWithCause extends Error {
|
548
534
|
constructor(message, options) {
|
549
535
|
super(message, options);
|
550
|
-
__publicField$7(this, "cause");
|
551
536
|
}
|
552
537
|
}
|
553
538
|
class FetcherError extends ErrorWithCause {
|
554
539
|
constructor(status, data, requestId) {
|
555
540
|
super(getMessage(data));
|
556
|
-
__publicField$7(this, "status");
|
557
|
-
__publicField$7(this, "requestId");
|
558
|
-
__publicField$7(this, "errors");
|
559
541
|
this.status = status;
|
560
542
|
this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
|
561
543
|
this.requestId = requestId;
|
@@ -805,6 +787,12 @@ const deleteBranch = (variables, signal) => dataPlaneFetch({
|
|
805
787
|
...variables,
|
806
788
|
signal
|
807
789
|
});
|
790
|
+
const getSchema = (variables, signal) => dataPlaneFetch({
|
791
|
+
url: "/db/{dbBranchName}/schema",
|
792
|
+
method: "get",
|
793
|
+
...variables,
|
794
|
+
signal
|
795
|
+
});
|
808
796
|
const copyBranch = (variables, signal) => dataPlaneFetch({
|
809
797
|
url: "/db/{dbBranchName}/copy",
|
810
798
|
method: "post",
|
@@ -1008,6 +996,7 @@ const operationsByTag$2 = {
|
|
1008
996
|
resolveBranch
|
1009
997
|
},
|
1010
998
|
migrations: {
|
999
|
+
getSchema,
|
1011
1000
|
getBranchMigrationHistory,
|
1012
1001
|
getBranchMigrationPlan,
|
1013
1002
|
executeBranchMigrationPlan,
|
@@ -1173,6 +1162,20 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
|
|
1173
1162
|
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
1174
1163
|
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
1175
1164
|
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
1165
|
+
const listClusters = (variables, signal) => controlPlaneFetch({
|
1166
|
+
url: "/workspaces/{workspaceId}/clusters",
|
1167
|
+
method: "get",
|
1168
|
+
...variables,
|
1169
|
+
signal
|
1170
|
+
});
|
1171
|
+
const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
|
1172
|
+
const getCluster = (variables, signal) => controlPlaneFetch({
|
1173
|
+
url: "/workspaces/{workspaceId}/clusters/{clusterId}",
|
1174
|
+
method: "get",
|
1175
|
+
...variables,
|
1176
|
+
signal
|
1177
|
+
});
|
1178
|
+
const updateCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters/{clusterId}", method: "patch", ...variables, signal });
|
1176
1179
|
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
1177
1180
|
url: "/workspaces/{workspaceId}/dbs",
|
1178
1181
|
method: "get",
|
@@ -1227,6 +1230,7 @@ const operationsByTag$1 = {
|
|
1227
1230
|
acceptWorkspaceMemberInvite,
|
1228
1231
|
resendWorkspaceMemberInvite
|
1229
1232
|
},
|
1233
|
+
xbcontrolOther: { listClusters, createCluster, getCluster, updateCluster },
|
1230
1234
|
databases: {
|
1231
1235
|
getDatabaseList,
|
1232
1236
|
createDatabase,
|
@@ -2622,75 +2626,6 @@ class XataApiPlugin {
|
|
2622
2626
|
class XataPlugin {
|
2623
2627
|
}
|
2624
2628
|
|
2625
|
-
class FilesPlugin extends XataPlugin {
|
2626
|
-
build(pluginOptions) {
|
2627
|
-
return {
|
2628
|
-
download: async (location) => {
|
2629
|
-
const { table, record, column, fileId = "" } = location ?? {};
|
2630
|
-
return await getFileItem({
|
2631
|
-
pathParams: {
|
2632
|
-
workspace: "{workspaceId}",
|
2633
|
-
dbBranchName: "{dbBranch}",
|
2634
|
-
region: "{region}",
|
2635
|
-
tableName: table ?? "",
|
2636
|
-
recordId: record ?? "",
|
2637
|
-
columnName: column ?? "",
|
2638
|
-
fileId
|
2639
|
-
},
|
2640
|
-
...pluginOptions,
|
2641
|
-
rawResponse: true
|
2642
|
-
});
|
2643
|
-
},
|
2644
|
-
upload: async (location, file) => {
|
2645
|
-
const { table, record, column, fileId = "" } = location ?? {};
|
2646
|
-
const contentType = getContentType(file);
|
2647
|
-
return await putFileItem({
|
2648
|
-
...pluginOptions,
|
2649
|
-
pathParams: {
|
2650
|
-
workspace: "{workspaceId}",
|
2651
|
-
dbBranchName: "{dbBranch}",
|
2652
|
-
region: "{region}",
|
2653
|
-
tableName: table ?? "",
|
2654
|
-
recordId: record ?? "",
|
2655
|
-
columnName: column ?? "",
|
2656
|
-
fileId
|
2657
|
-
},
|
2658
|
-
body: file,
|
2659
|
-
headers: { "Content-Type": contentType }
|
2660
|
-
});
|
2661
|
-
},
|
2662
|
-
delete: async (location) => {
|
2663
|
-
const { table, record, column, fileId = "" } = location ?? {};
|
2664
|
-
return await deleteFileItem({
|
2665
|
-
pathParams: {
|
2666
|
-
workspace: "{workspaceId}",
|
2667
|
-
dbBranchName: "{dbBranch}",
|
2668
|
-
region: "{region}",
|
2669
|
-
tableName: table ?? "",
|
2670
|
-
recordId: record ?? "",
|
2671
|
-
columnName: column ?? "",
|
2672
|
-
fileId
|
2673
|
-
},
|
2674
|
-
...pluginOptions
|
2675
|
-
});
|
2676
|
-
}
|
2677
|
-
};
|
2678
|
-
}
|
2679
|
-
}
|
2680
|
-
function getContentType(file) {
|
2681
|
-
if (typeof file === "string") {
|
2682
|
-
return "text/plain";
|
2683
|
-
}
|
2684
|
-
if (isBlob(file)) {
|
2685
|
-
return file.type;
|
2686
|
-
}
|
2687
|
-
try {
|
2688
|
-
return file.type;
|
2689
|
-
} catch (e) {
|
2690
|
-
}
|
2691
|
-
return "application/octet-stream";
|
2692
|
-
}
|
2693
|
-
|
2694
2629
|
function buildTransformString(transformations) {
|
2695
2630
|
return transformations.flatMap(
|
2696
2631
|
(t) => Object.entries(t).map(([key, value]) => {
|
@@ -2719,58 +2654,8 @@ function transformImage(url, ...transformations) {
|
|
2719
2654
|
return `https://${hostname}${transform}${path}${search}`;
|
2720
2655
|
}
|
2721
2656
|
|
2722
|
-
var __defProp$6 = Object.defineProperty;
|
2723
|
-
var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2724
|
-
var __publicField$6 = (obj, key, value) => {
|
2725
|
-
__defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
|
2726
|
-
return value;
|
2727
|
-
};
|
2728
2657
|
class XataFile {
|
2729
2658
|
constructor(file) {
|
2730
|
-
/**
|
2731
|
-
* Identifier of the file.
|
2732
|
-
*/
|
2733
|
-
__publicField$6(this, "id");
|
2734
|
-
/**
|
2735
|
-
* Name of the file.
|
2736
|
-
*/
|
2737
|
-
__publicField$6(this, "name");
|
2738
|
-
/**
|
2739
|
-
* Media type of the file.
|
2740
|
-
*/
|
2741
|
-
__publicField$6(this, "mediaType");
|
2742
|
-
/**
|
2743
|
-
* Base64 encoded content of the file.
|
2744
|
-
*/
|
2745
|
-
__publicField$6(this, "base64Content");
|
2746
|
-
/**
|
2747
|
-
* Whether to enable public url for the file.
|
2748
|
-
*/
|
2749
|
-
__publicField$6(this, "enablePublicUrl");
|
2750
|
-
/**
|
2751
|
-
* Timeout for the signed url.
|
2752
|
-
*/
|
2753
|
-
__publicField$6(this, "signedUrlTimeout");
|
2754
|
-
/**
|
2755
|
-
* Size of the file.
|
2756
|
-
*/
|
2757
|
-
__publicField$6(this, "size");
|
2758
|
-
/**
|
2759
|
-
* Version of the file.
|
2760
|
-
*/
|
2761
|
-
__publicField$6(this, "version");
|
2762
|
-
/**
|
2763
|
-
* Url of the file.
|
2764
|
-
*/
|
2765
|
-
__publicField$6(this, "url");
|
2766
|
-
/**
|
2767
|
-
* Signed url of the file.
|
2768
|
-
*/
|
2769
|
-
__publicField$6(this, "signedUrl");
|
2770
|
-
/**
|
2771
|
-
* Attributes of the file.
|
2772
|
-
*/
|
2773
|
-
__publicField$6(this, "attributes");
|
2774
2659
|
this.id = file.id;
|
2775
2660
|
this.name = file.name || "";
|
2776
2661
|
this.mediaType = file.mediaType || "application/octet-stream";
|
@@ -2929,12 +2814,6 @@ function parseJson(value) {
|
|
2929
2814
|
}
|
2930
2815
|
}
|
2931
2816
|
|
2932
|
-
var __defProp$5 = Object.defineProperty;
|
2933
|
-
var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
2934
|
-
var __publicField$5 = (obj, key, value) => {
|
2935
|
-
__defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
|
2936
|
-
return value;
|
2937
|
-
};
|
2938
2817
|
var __accessCheck$6 = (obj, member, msg) => {
|
2939
2818
|
if (!member.has(obj))
|
2940
2819
|
throw TypeError("Cannot " + msg);
|
@@ -2957,14 +2836,6 @@ var _query, _page;
|
|
2957
2836
|
class Page {
|
2958
2837
|
constructor(query, meta, records = []) {
|
2959
2838
|
__privateAdd$6(this, _query, void 0);
|
2960
|
-
/**
|
2961
|
-
* Page metadata, required to retrieve additional records.
|
2962
|
-
*/
|
2963
|
-
__publicField$5(this, "meta");
|
2964
|
-
/**
|
2965
|
-
* The set of results for this page.
|
2966
|
-
*/
|
2967
|
-
__publicField$5(this, "records");
|
2968
2839
|
__privateSet$6(this, _query, query);
|
2969
2840
|
this.meta = meta;
|
2970
2841
|
this.records = new RecordArray(this, records);
|
@@ -3014,9 +2885,9 @@ class Page {
|
|
3014
2885
|
}
|
3015
2886
|
}
|
3016
2887
|
_query = new WeakMap();
|
3017
|
-
const PAGINATION_MAX_SIZE =
|
2888
|
+
const PAGINATION_MAX_SIZE = 1e3;
|
3018
2889
|
const PAGINATION_DEFAULT_SIZE = 20;
|
3019
|
-
const PAGINATION_MAX_OFFSET =
|
2890
|
+
const PAGINATION_MAX_OFFSET = 49e3;
|
3020
2891
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
3021
2892
|
function isCursorPaginationOptions(options) {
|
3022
2893
|
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
@@ -3095,12 +2966,6 @@ const _RecordArray = class _RecordArray extends Array {
|
|
3095
2966
|
_page = new WeakMap();
|
3096
2967
|
let RecordArray = _RecordArray;
|
3097
2968
|
|
3098
|
-
var __defProp$4 = Object.defineProperty;
|
3099
|
-
var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
3100
|
-
var __publicField$4 = (obj, key, value) => {
|
3101
|
-
__defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
|
3102
|
-
return value;
|
3103
|
-
};
|
3104
2969
|
var __accessCheck$5 = (obj, member, msg) => {
|
3105
2970
|
if (!member.has(obj))
|
3106
2971
|
throw TypeError("Cannot " + msg);
|
@@ -3131,8 +2996,8 @@ const _Query = class _Query {
|
|
3131
2996
|
__privateAdd$5(this, _repository, void 0);
|
3132
2997
|
__privateAdd$5(this, _data, { filter: {} });
|
3133
2998
|
// Implements pagination
|
3134
|
-
|
3135
|
-
|
2999
|
+
this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
|
3000
|
+
this.records = new RecordArray(this, []);
|
3136
3001
|
__privateSet$5(this, _table$1, table);
|
3137
3002
|
if (repository) {
|
3138
3003
|
__privateSet$5(this, _repository, repository);
|
@@ -3888,7 +3753,13 @@ class RestRepository extends Query {
|
|
3888
3753
|
},
|
3889
3754
|
...__privateGet$4(this, _getFetchProps).call(this)
|
3890
3755
|
});
|
3891
|
-
|
3756
|
+
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
3757
|
+
return {
|
3758
|
+
...result,
|
3759
|
+
summaries: result.summaries.map(
|
3760
|
+
(summary) => initObject(__privateGet$4(this, _db), schemaTables, __privateGet$4(this, _table), summary, data.columns ?? [])
|
3761
|
+
)
|
3762
|
+
};
|
3892
3763
|
});
|
3893
3764
|
}
|
3894
3765
|
ask(question, options) {
|
@@ -4259,7 +4130,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
4259
4130
|
record.delete = function() {
|
4260
4131
|
return db[table].delete(record["id"]);
|
4261
4132
|
};
|
4262
|
-
|
4133
|
+
if (metadata !== void 0) {
|
4134
|
+
record.xata = Object.freeze(metadata);
|
4135
|
+
}
|
4263
4136
|
record.getMetadata = function() {
|
4264
4137
|
return record.xata;
|
4265
4138
|
};
|
@@ -4296,12 +4169,6 @@ function parseIfVersion(...args) {
|
|
4296
4169
|
return void 0;
|
4297
4170
|
}
|
4298
4171
|
|
4299
|
-
var __defProp$3 = Object.defineProperty;
|
4300
|
-
var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4301
|
-
var __publicField$3 = (obj, key, value) => {
|
4302
|
-
__defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4303
|
-
return value;
|
4304
|
-
};
|
4305
4172
|
var __accessCheck$3 = (obj, member, msg) => {
|
4306
4173
|
if (!member.has(obj))
|
4307
4174
|
throw TypeError("Cannot " + msg);
|
@@ -4324,8 +4191,6 @@ var _map;
|
|
4324
4191
|
class SimpleCache {
|
4325
4192
|
constructor(options = {}) {
|
4326
4193
|
__privateAdd$3(this, _map, void 0);
|
4327
|
-
__publicField$3(this, "capacity");
|
4328
|
-
__publicField$3(this, "defaultQueryTTL");
|
4329
4194
|
__privateSet$3(this, _map, /* @__PURE__ */ new Map());
|
4330
4195
|
this.capacity = options.max ?? 500;
|
4331
4196
|
this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
|
@@ -4370,10 +4235,12 @@ const notExists = (column) => ({ $notExists: column });
|
|
4370
4235
|
const startsWith = (value) => ({ $startsWith: value });
|
4371
4236
|
const endsWith = (value) => ({ $endsWith: value });
|
4372
4237
|
const pattern = (value) => ({ $pattern: value });
|
4238
|
+
const iPattern = (value) => ({ $iPattern: value });
|
4373
4239
|
const is = (value) => ({ $is: value });
|
4374
4240
|
const equals = is;
|
4375
4241
|
const isNot = (value) => ({ $isNot: value });
|
4376
4242
|
const contains = (value) => ({ $contains: value });
|
4243
|
+
const iContains = (value) => ({ $iContains: value });
|
4377
4244
|
const includes = (value) => ({ $includes: value });
|
4378
4245
|
const includesAll = (value) => ({ $includesAll: value });
|
4379
4246
|
const includesNone = (value) => ({ $includesNone: value });
|
@@ -4429,6 +4296,80 @@ class SchemaPlugin extends XataPlugin {
|
|
4429
4296
|
_tables = new WeakMap();
|
4430
4297
|
_schemaTables$1 = new WeakMap();
|
4431
4298
|
|
4299
|
+
class FilesPlugin extends XataPlugin {
|
4300
|
+
build(pluginOptions) {
|
4301
|
+
return {
|
4302
|
+
download: async (location) => {
|
4303
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
4304
|
+
return await getFileItem({
|
4305
|
+
pathParams: {
|
4306
|
+
workspace: "{workspaceId}",
|
4307
|
+
dbBranchName: "{dbBranch}",
|
4308
|
+
region: "{region}",
|
4309
|
+
tableName: table ?? "",
|
4310
|
+
recordId: record ?? "",
|
4311
|
+
columnName: column ?? "",
|
4312
|
+
fileId
|
4313
|
+
},
|
4314
|
+
...pluginOptions,
|
4315
|
+
rawResponse: true
|
4316
|
+
});
|
4317
|
+
},
|
4318
|
+
upload: async (location, file, options) => {
|
4319
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
4320
|
+
const resolvedFile = await file;
|
4321
|
+
const contentType = options?.mediaType || getContentType(resolvedFile);
|
4322
|
+
const body = resolvedFile instanceof XataFile ? resolvedFile.toBlob() : resolvedFile;
|
4323
|
+
return await putFileItem({
|
4324
|
+
...pluginOptions,
|
4325
|
+
pathParams: {
|
4326
|
+
workspace: "{workspaceId}",
|
4327
|
+
dbBranchName: "{dbBranch}",
|
4328
|
+
region: "{region}",
|
4329
|
+
tableName: table ?? "",
|
4330
|
+
recordId: record ?? "",
|
4331
|
+
columnName: column ?? "",
|
4332
|
+
fileId
|
4333
|
+
},
|
4334
|
+
body,
|
4335
|
+
headers: { "Content-Type": contentType }
|
4336
|
+
});
|
4337
|
+
},
|
4338
|
+
delete: async (location) => {
|
4339
|
+
const { table, record, column, fileId = "" } = location ?? {};
|
4340
|
+
return await deleteFileItem({
|
4341
|
+
pathParams: {
|
4342
|
+
workspace: "{workspaceId}",
|
4343
|
+
dbBranchName: "{dbBranch}",
|
4344
|
+
region: "{region}",
|
4345
|
+
tableName: table ?? "",
|
4346
|
+
recordId: record ?? "",
|
4347
|
+
columnName: column ?? "",
|
4348
|
+
fileId
|
4349
|
+
},
|
4350
|
+
...pluginOptions
|
4351
|
+
});
|
4352
|
+
}
|
4353
|
+
};
|
4354
|
+
}
|
4355
|
+
}
|
4356
|
+
function getContentType(file) {
|
4357
|
+
if (typeof file === "string") {
|
4358
|
+
return "text/plain";
|
4359
|
+
}
|
4360
|
+
if ("mediaType" in file) {
|
4361
|
+
return file.mediaType;
|
4362
|
+
}
|
4363
|
+
if (isBlob(file)) {
|
4364
|
+
return file.type;
|
4365
|
+
}
|
4366
|
+
try {
|
4367
|
+
return file.type;
|
4368
|
+
} catch (e) {
|
4369
|
+
}
|
4370
|
+
return "application/octet-stream";
|
4371
|
+
}
|
4372
|
+
|
4432
4373
|
var __accessCheck$1 = (obj, member, msg) => {
|
4433
4374
|
if (!member.has(obj))
|
4434
4375
|
throw TypeError("Cannot " + msg);
|
@@ -4595,12 +4536,6 @@ class TransactionPlugin extends XataPlugin {
|
|
4595
4536
|
}
|
4596
4537
|
}
|
4597
4538
|
|
4598
|
-
var __defProp$2 = Object.defineProperty;
|
4599
|
-
var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4600
|
-
var __publicField$2 = (obj, key, value) => {
|
4601
|
-
__defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4602
|
-
return value;
|
4603
|
-
};
|
4604
4539
|
var __accessCheck = (obj, member, msg) => {
|
4605
4540
|
if (!member.has(obj))
|
4606
4541
|
throw TypeError("Cannot " + msg);
|
@@ -4630,11 +4565,6 @@ const buildClient = (plugins) => {
|
|
4630
4565
|
__privateAdd(this, _parseOptions);
|
4631
4566
|
__privateAdd(this, _getFetchProps);
|
4632
4567
|
__privateAdd(this, _options, void 0);
|
4633
|
-
__publicField$2(this, "db");
|
4634
|
-
__publicField$2(this, "search");
|
4635
|
-
__publicField$2(this, "transactions");
|
4636
|
-
__publicField$2(this, "sql");
|
4637
|
-
__publicField$2(this, "files");
|
4638
4568
|
const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
|
4639
4569
|
__privateSet(this, _options, safeOptions);
|
4640
4570
|
const pluginOptions = {
|
@@ -4748,17 +4678,11 @@ const buildClient = (plugins) => {
|
|
4748
4678
|
class BaseClient extends buildClient() {
|
4749
4679
|
}
|
4750
4680
|
|
4751
|
-
var __defProp$1 = Object.defineProperty;
|
4752
|
-
var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4753
|
-
var __publicField$1 = (obj, key, value) => {
|
4754
|
-
__defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4755
|
-
return value;
|
4756
|
-
};
|
4757
4681
|
const META = "__";
|
4758
4682
|
const VALUE = "___";
|
4759
4683
|
class Serializer {
|
4760
4684
|
constructor() {
|
4761
|
-
|
4685
|
+
this.classes = {};
|
4762
4686
|
}
|
4763
4687
|
add(clazz) {
|
4764
4688
|
this.classes[clazz.name] = clazz;
|
@@ -4836,16 +4760,9 @@ function buildWorkerRunner(config) {
|
|
4836
4760
|
};
|
4837
4761
|
}
|
4838
4762
|
|
4839
|
-
var __defProp = Object.defineProperty;
|
4840
|
-
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
4841
|
-
var __publicField = (obj, key, value) => {
|
4842
|
-
__defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
|
4843
|
-
return value;
|
4844
|
-
};
|
4845
4763
|
class XataError extends Error {
|
4846
4764
|
constructor(message, status) {
|
4847
4765
|
super(message);
|
4848
|
-
__publicField(this, "status");
|
4849
4766
|
this.status = status;
|
4850
4767
|
}
|
4851
4768
|
}
|
@@ -4894,6 +4811,7 @@ exports.compareMigrationRequest = compareMigrationRequest;
|
|
4894
4811
|
exports.contains = contains;
|
4895
4812
|
exports.copyBranch = copyBranch;
|
4896
4813
|
exports.createBranch = createBranch;
|
4814
|
+
exports.createCluster = createCluster;
|
4897
4815
|
exports.createDatabase = createDatabase;
|
4898
4816
|
exports.createMigrationRequest = createMigrationRequest;
|
4899
4817
|
exports.createTable = createTable;
|
@@ -4929,6 +4847,7 @@ exports.getBranchMigrationHistory = getBranchMigrationHistory;
|
|
4929
4847
|
exports.getBranchMigrationPlan = getBranchMigrationPlan;
|
4930
4848
|
exports.getBranchSchemaHistory = getBranchSchemaHistory;
|
4931
4849
|
exports.getBranchStats = getBranchStats;
|
4850
|
+
exports.getCluster = getCluster;
|
4932
4851
|
exports.getColumn = getColumn;
|
4933
4852
|
exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
|
4934
4853
|
exports.getDatabaseList = getDatabaseList;
|
@@ -4942,6 +4861,7 @@ exports.getMigrationRequest = getMigrationRequest;
|
|
4942
4861
|
exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
|
4943
4862
|
exports.getPreviewBranch = getPreviewBranch;
|
4944
4863
|
exports.getRecord = getRecord;
|
4864
|
+
exports.getSchema = getSchema;
|
4945
4865
|
exports.getTableColumns = getTableColumns;
|
4946
4866
|
exports.getTableSchema = getTableSchema;
|
4947
4867
|
exports.getUser = getUser;
|
@@ -4957,6 +4877,8 @@ exports.greaterThan = greaterThan;
|
|
4957
4877
|
exports.greaterThanEquals = greaterThanEquals;
|
4958
4878
|
exports.gt = gt;
|
4959
4879
|
exports.gte = gte;
|
4880
|
+
exports.iContains = iContains;
|
4881
|
+
exports.iPattern = iPattern;
|
4960
4882
|
exports.includes = includes;
|
4961
4883
|
exports.includesAll = includesAll;
|
4962
4884
|
exports.includesAny = includesAny;
|
@@ -4977,6 +4899,7 @@ exports.le = le;
|
|
4977
4899
|
exports.lessEquals = lessEquals;
|
4978
4900
|
exports.lessThan = lessThan;
|
4979
4901
|
exports.lessThanEquals = lessThanEquals;
|
4902
|
+
exports.listClusters = listClusters;
|
4980
4903
|
exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
|
4981
4904
|
exports.listRegions = listRegions;
|
4982
4905
|
exports.lt = lt;
|
@@ -5008,6 +4931,7 @@ exports.summarizeTable = summarizeTable;
|
|
5008
4931
|
exports.transformImage = transformImage;
|
5009
4932
|
exports.updateBranchMetadata = updateBranchMetadata;
|
5010
4933
|
exports.updateBranchSchema = updateBranchSchema;
|
4934
|
+
exports.updateCluster = updateCluster;
|
5011
4935
|
exports.updateColumn = updateColumn;
|
5012
4936
|
exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
|
5013
4937
|
exports.updateDatabaseMetadata = updateDatabaseMetadata;
|