@xata.io/client 0.26.5 → 0.26.7

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.
@@ -1,4 +1,4 @@
1
1
 
2
- > @xata.io/client@0.26.5 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.26.7 add-version /home/runner/work/client-ts/client-ts/packages/client
3
3
  > node ../../scripts/add-version-file.mjs
4
4
 
@@ -1,13 +1,13 @@
1
1
 
2
- > @xata.io/client@0.26.5 build /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.26.7 build /home/runner/work/client-ts/client-ts/packages/client
3
3
  > rimraf dist && rollup -c
4
4
 
5
5
  
6
6
  src/index.ts → dist/index.cjs...
7
- created dist/index.cjs in 1s
7
+ created dist/index.cjs in 1.1s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 797ms
10
+ created dist/index.mjs in 735ms
11
11
  
12
12
  src/index.ts → dist/index.d.ts...
13
- created dist/index.d.ts in 8s
13
+ created dist/index.d.ts in 8.4s
package/CHANGELOG.md CHANGED
@@ -1,5 +1,21 @@
1
1
  # @xata.io/client
2
2
 
3
+ ## 0.26.7
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ - [#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
10
+
11
+ ## 0.26.6
12
+
13
+ ### Patch Changes
14
+
15
+ - [#1180](https://github.com/xataio/client-ts/pull/1180) [`3330c9cf`](https://github.com/xataio/client-ts/commit/3330c9cf8d8db18b8e355a576e4afd589b6152bf) Thanks [@SferaDev](https://github.com/SferaDev)! - Support expanded links in `toSerialized`
16
+
17
+ - [#1191](https://github.com/xataio/client-ts/pull/1191) [`a738816d`](https://github.com/xataio/client-ts/commit/a738816d355f4415b0622bb5a23b4154f9855177) Thanks [@SferaDev](https://github.com/SferaDev)! - Add support for `percentiles` aggregation
18
+
3
19
  ## 0.26.5
4
20
 
5
21
  ### 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.5";
531
+ const VERSION = "0.26.7";
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;
@@ -1173,6 +1155,20 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
1173
1155
  const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
1174
1156
  const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
1175
1157
  const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
1158
+ const listClusters = (variables, signal) => controlPlaneFetch({
1159
+ url: "/workspaces/{workspaceId}/clusters",
1160
+ method: "get",
1161
+ ...variables,
1162
+ signal
1163
+ });
1164
+ const createCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters", method: "post", ...variables, signal });
1165
+ const getCluster = (variables, signal) => controlPlaneFetch({
1166
+ url: "/workspaces/{workspaceId}/clusters/{clusterId}",
1167
+ method: "get",
1168
+ ...variables,
1169
+ signal
1170
+ });
1171
+ const updateCluster = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/clusters/{clusterId}", method: "patch", ...variables, signal });
1176
1172
  const getDatabaseList = (variables, signal) => controlPlaneFetch({
1177
1173
  url: "/workspaces/{workspaceId}/dbs",
1178
1174
  method: "get",
@@ -1227,6 +1223,7 @@ const operationsByTag$1 = {
1227
1223
  acceptWorkspaceMemberInvite,
1228
1224
  resendWorkspaceMemberInvite
1229
1225
  },
1226
+ xbcontrolOther: { listClusters, createCluster, getCluster, updateCluster },
1230
1227
  databases: {
1231
1228
  getDatabaseList,
1232
1229
  createDatabase,
@@ -2641,9 +2638,9 @@ class FilesPlugin extends XataPlugin {
2641
2638
  rawResponse: true
2642
2639
  });
2643
2640
  },
2644
- upload: async (location, file) => {
2641
+ upload: async (location, file, options) => {
2645
2642
  const { table, record, column, fileId = "" } = location ?? {};
2646
- const contentType = getContentType(file);
2643
+ const contentType = options?.mediaType || getContentType(file);
2647
2644
  return await putFileItem({
2648
2645
  ...pluginOptions,
2649
2646
  pathParams: {
@@ -2719,58 +2716,8 @@ function transformImage(url, ...transformations) {
2719
2716
  return `https://${hostname}${transform}${path}${search}`;
2720
2717
  }
2721
2718
 
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
2719
  class XataFile {
2729
2720
  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
2721
  this.id = file.id;
2775
2722
  this.name = file.name || "";
2776
2723
  this.mediaType = file.mediaType || "application/octet-stream";
@@ -2929,12 +2876,6 @@ function parseJson(value) {
2929
2876
  }
2930
2877
  }
2931
2878
 
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
2879
  var __accessCheck$6 = (obj, member, msg) => {
2939
2880
  if (!member.has(obj))
2940
2881
  throw TypeError("Cannot " + msg);
@@ -2957,14 +2898,6 @@ var _query, _page;
2957
2898
  class Page {
2958
2899
  constructor(query, meta, records = []) {
2959
2900
  __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
2901
  __privateSet$6(this, _query, query);
2969
2902
  this.meta = meta;
2970
2903
  this.records = new RecordArray(this, records);
@@ -3014,9 +2947,9 @@ class Page {
3014
2947
  }
3015
2948
  }
3016
2949
  _query = new WeakMap();
3017
- const PAGINATION_MAX_SIZE = 200;
2950
+ const PAGINATION_MAX_SIZE = 1e3;
3018
2951
  const PAGINATION_DEFAULT_SIZE = 20;
3019
- const PAGINATION_MAX_OFFSET = 800;
2952
+ const PAGINATION_MAX_OFFSET = 49e3;
3020
2953
  const PAGINATION_DEFAULT_OFFSET = 0;
3021
2954
  function isCursorPaginationOptions(options) {
3022
2955
  return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
@@ -3095,12 +3028,6 @@ const _RecordArray = class _RecordArray extends Array {
3095
3028
  _page = new WeakMap();
3096
3029
  let RecordArray = _RecordArray;
3097
3030
 
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
3031
  var __accessCheck$5 = (obj, member, msg) => {
3105
3032
  if (!member.has(obj))
3106
3033
  throw TypeError("Cannot " + msg);
@@ -3131,8 +3058,8 @@ const _Query = class _Query {
3131
3058
  __privateAdd$5(this, _repository, void 0);
3132
3059
  __privateAdd$5(this, _data, { filter: {} });
3133
3060
  // Implements pagination
3134
- __publicField$4(this, "meta", { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } });
3135
- __publicField$4(this, "records", new RecordArray(this, []));
3061
+ this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
3062
+ this.records = new RecordArray(this, []);
3136
3063
  __privateSet$5(this, _table$1, table);
3137
3064
  if (repository) {
3138
3065
  __privateSet$5(this, _repository, repository);
@@ -4176,13 +4103,6 @@ transformObjectToApi_fn = async function(object) {
4176
4103
  }
4177
4104
  return result;
4178
4105
  };
4179
- const removeLinksFromObject = (object) => {
4180
- return Object.entries(object).reduce((acc, [key, value]) => {
4181
- if (key === "xata")
4182
- return acc;
4183
- return { ...acc, [key]: isIdentifiable(value) ? value.id : value };
4184
- }, {});
4185
- };
4186
4106
  const initObject = (db, schemaTables, table, object, selectedColumns) => {
4187
4107
  const data = {};
4188
4108
  const { xata, ...rest } = object ?? {};
@@ -4249,7 +4169,6 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4249
4169
  }
4250
4170
  }
4251
4171
  const record = { ...data };
4252
- const serializable = { xata, ...removeLinksFromObject(data) };
4253
4172
  const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
4254
4173
  record.read = function(columns2) {
4255
4174
  return db[table].read(record["id"], columns2);
@@ -4272,10 +4191,10 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4272
4191
  return record.xata;
4273
4192
  };
4274
4193
  record.toSerializable = function() {
4275
- return JSON.parse(JSON.stringify(serializable));
4194
+ return JSON.parse(JSON.stringify(record));
4276
4195
  };
4277
4196
  record.toString = function() {
4278
- return JSON.stringify(serializable);
4197
+ return JSON.stringify(record);
4279
4198
  };
4280
4199
  for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
4281
4200
  Object.defineProperty(record, prop, { enumerable: false });
@@ -4304,12 +4223,6 @@ function parseIfVersion(...args) {
4304
4223
  return void 0;
4305
4224
  }
4306
4225
 
4307
- var __defProp$3 = Object.defineProperty;
4308
- var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4309
- var __publicField$3 = (obj, key, value) => {
4310
- __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
4311
- return value;
4312
- };
4313
4226
  var __accessCheck$3 = (obj, member, msg) => {
4314
4227
  if (!member.has(obj))
4315
4228
  throw TypeError("Cannot " + msg);
@@ -4332,8 +4245,6 @@ var _map;
4332
4245
  class SimpleCache {
4333
4246
  constructor(options = {}) {
4334
4247
  __privateAdd$3(this, _map, void 0);
4335
- __publicField$3(this, "capacity");
4336
- __publicField$3(this, "defaultQueryTTL");
4337
4248
  __privateSet$3(this, _map, /* @__PURE__ */ new Map());
4338
4249
  this.capacity = options.max ?? 500;
4339
4250
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
@@ -4378,10 +4289,12 @@ const notExists = (column) => ({ $notExists: column });
4378
4289
  const startsWith = (value) => ({ $startsWith: value });
4379
4290
  const endsWith = (value) => ({ $endsWith: value });
4380
4291
  const pattern = (value) => ({ $pattern: value });
4292
+ const iPattern = (value) => ({ $iPattern: value });
4381
4293
  const is = (value) => ({ $is: value });
4382
4294
  const equals = is;
4383
4295
  const isNot = (value) => ({ $isNot: value });
4384
4296
  const contains = (value) => ({ $contains: value });
4297
+ const iContains = (value) => ({ $iContains: value });
4385
4298
  const includes = (value) => ({ $includes: value });
4386
4299
  const includesAll = (value) => ({ $includesAll: value });
4387
4300
  const includesNone = (value) => ({ $includesNone: value });
@@ -4603,12 +4516,6 @@ class TransactionPlugin extends XataPlugin {
4603
4516
  }
4604
4517
  }
4605
4518
 
4606
- var __defProp$2 = Object.defineProperty;
4607
- var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4608
- var __publicField$2 = (obj, key, value) => {
4609
- __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
4610
- return value;
4611
- };
4612
4519
  var __accessCheck = (obj, member, msg) => {
4613
4520
  if (!member.has(obj))
4614
4521
  throw TypeError("Cannot " + msg);
@@ -4638,11 +4545,6 @@ const buildClient = (plugins) => {
4638
4545
  __privateAdd(this, _parseOptions);
4639
4546
  __privateAdd(this, _getFetchProps);
4640
4547
  __privateAdd(this, _options, void 0);
4641
- __publicField$2(this, "db");
4642
- __publicField$2(this, "search");
4643
- __publicField$2(this, "transactions");
4644
- __publicField$2(this, "sql");
4645
- __publicField$2(this, "files");
4646
4548
  const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
4647
4549
  __privateSet(this, _options, safeOptions);
4648
4550
  const pluginOptions = {
@@ -4756,17 +4658,11 @@ const buildClient = (plugins) => {
4756
4658
  class BaseClient extends buildClient() {
4757
4659
  }
4758
4660
 
4759
- var __defProp$1 = Object.defineProperty;
4760
- var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4761
- var __publicField$1 = (obj, key, value) => {
4762
- __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
4763
- return value;
4764
- };
4765
4661
  const META = "__";
4766
4662
  const VALUE = "___";
4767
4663
  class Serializer {
4768
4664
  constructor() {
4769
- __publicField$1(this, "classes", {});
4665
+ this.classes = {};
4770
4666
  }
4771
4667
  add(clazz) {
4772
4668
  this.classes[clazz.name] = clazz;
@@ -4844,16 +4740,9 @@ function buildWorkerRunner(config) {
4844
4740
  };
4845
4741
  }
4846
4742
 
4847
- var __defProp = Object.defineProperty;
4848
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4849
- var __publicField = (obj, key, value) => {
4850
- __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4851
- return value;
4852
- };
4853
4743
  class XataError extends Error {
4854
4744
  constructor(message, status) {
4855
4745
  super(message);
4856
- __publicField(this, "status");
4857
4746
  this.status = status;
4858
4747
  }
4859
4748
  }
@@ -4902,6 +4791,7 @@ exports.compareMigrationRequest = compareMigrationRequest;
4902
4791
  exports.contains = contains;
4903
4792
  exports.copyBranch = copyBranch;
4904
4793
  exports.createBranch = createBranch;
4794
+ exports.createCluster = createCluster;
4905
4795
  exports.createDatabase = createDatabase;
4906
4796
  exports.createMigrationRequest = createMigrationRequest;
4907
4797
  exports.createTable = createTable;
@@ -4937,6 +4827,7 @@ exports.getBranchMigrationHistory = getBranchMigrationHistory;
4937
4827
  exports.getBranchMigrationPlan = getBranchMigrationPlan;
4938
4828
  exports.getBranchSchemaHistory = getBranchSchemaHistory;
4939
4829
  exports.getBranchStats = getBranchStats;
4830
+ exports.getCluster = getCluster;
4940
4831
  exports.getColumn = getColumn;
4941
4832
  exports.getDatabaseGithubSettings = getDatabaseGithubSettings;
4942
4833
  exports.getDatabaseList = getDatabaseList;
@@ -4965,6 +4856,8 @@ exports.greaterThan = greaterThan;
4965
4856
  exports.greaterThanEquals = greaterThanEquals;
4966
4857
  exports.gt = gt;
4967
4858
  exports.gte = gte;
4859
+ exports.iContains = iContains;
4860
+ exports.iPattern = iPattern;
4968
4861
  exports.includes = includes;
4969
4862
  exports.includesAll = includesAll;
4970
4863
  exports.includesAny = includesAny;
@@ -4985,6 +4878,7 @@ exports.le = le;
4985
4878
  exports.lessEquals = lessEquals;
4986
4879
  exports.lessThan = lessThan;
4987
4880
  exports.lessThanEquals = lessThanEquals;
4881
+ exports.listClusters = listClusters;
4988
4882
  exports.listMigrationRequestsCommits = listMigrationRequestsCommits;
4989
4883
  exports.listRegions = listRegions;
4990
4884
  exports.lt = lt;
@@ -5016,6 +4910,7 @@ exports.summarizeTable = summarizeTable;
5016
4910
  exports.transformImage = transformImage;
5017
4911
  exports.updateBranchMetadata = updateBranchMetadata;
5018
4912
  exports.updateBranchSchema = updateBranchSchema;
4913
+ exports.updateCluster = updateCluster;
5019
4914
  exports.updateColumn = updateColumn;
5020
4915
  exports.updateDatabaseGithubSettings = updateDatabaseGithubSettings;
5021
4916
  exports.updateDatabaseMetadata = updateDatabaseMetadata;