@xata.io/client 0.24.2 → 0.25.0

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/dist/index.cjs CHANGED
@@ -29,8 +29,11 @@ function notEmpty(value) {
29
29
  function compact(arr) {
30
30
  return arr.filter(notEmpty);
31
31
  }
32
+ function compactObject(obj) {
33
+ return Object.fromEntries(Object.entries(obj).filter(([, value]) => notEmpty(value)));
34
+ }
32
35
  function isObject(value) {
33
- return Boolean(value) && typeof value === "object" && !Array.isArray(value);
36
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value) && !(value instanceof Date);
34
37
  }
35
38
  function isDefined(value) {
36
39
  return value !== null && value !== void 0;
@@ -85,6 +88,15 @@ function chunk(array, chunkSize) {
85
88
  async function timeout(ms) {
86
89
  return new Promise((resolve) => setTimeout(resolve, ms));
87
90
  }
91
+ function promiseMap(inputValues, mapper) {
92
+ const reducer = (acc$, inputValue) => acc$.then(
93
+ (acc) => mapper(inputValue).then((result) => {
94
+ acc.push(result);
95
+ return acc;
96
+ })
97
+ );
98
+ return inputValues.reduce(reducer, Promise.resolve([]));
99
+ }
88
100
 
89
101
  function getEnvironment() {
90
102
  try {
@@ -212,6 +224,12 @@ function getPreviewBranch() {
212
224
  }
213
225
  }
214
226
 
227
+ var __defProp$8 = Object.defineProperty;
228
+ var __defNormalProp$8 = (obj, key, value) => key in obj ? __defProp$8(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
229
+ var __publicField$8 = (obj, key, value) => {
230
+ __defNormalProp$8(obj, typeof key !== "symbol" ? key + "" : key, value);
231
+ return value;
232
+ };
215
233
  var __accessCheck$8 = (obj, member, msg) => {
216
234
  if (!member.has(obj))
217
235
  throw TypeError("Cannot " + msg);
@@ -235,6 +253,7 @@ var __privateMethod$4 = (obj, member, method) => {
235
253
  return method;
236
254
  };
237
255
  var _fetch, _queue, _concurrency, _enqueue, enqueue_fn;
256
+ const REQUEST_TIMEOUT = 3e4;
238
257
  function getFetchImplementation(userFetch) {
239
258
  const globalFetch = typeof fetch !== "undefined" ? fetch : void 0;
240
259
  const fetchImpl = userFetch ?? globalFetch;
@@ -251,6 +270,8 @@ class ApiRequestPool {
251
270
  __privateAdd$8(this, _fetch, void 0);
252
271
  __privateAdd$8(this, _queue, void 0);
253
272
  __privateAdd$8(this, _concurrency, void 0);
273
+ __publicField$8(this, "running");
274
+ __publicField$8(this, "started");
254
275
  __privateSet$8(this, _queue, []);
255
276
  __privateSet$8(this, _concurrency, concurrency);
256
277
  this.running = 0;
@@ -267,9 +288,12 @@ class ApiRequestPool {
267
288
  }
268
289
  request(url, options) {
269
290
  const start = /* @__PURE__ */ new Date();
270
- const fetch2 = this.getFetch();
291
+ const fetchImpl = this.getFetch();
271
292
  const runRequest = async (stalled = false) => {
272
- const response = await fetch2(url, options);
293
+ const response = await Promise.race([fetchImpl(url, options), timeout(REQUEST_TIMEOUT).then(() => null)]);
294
+ if (!response) {
295
+ throw new Error("Request timed out");
296
+ }
273
297
  if (response.status === 429) {
274
298
  const rateLimitReset = parseNumber(response.headers?.get("x-ratelimit-reset")) ?? 1;
275
299
  await timeout(rateLimitReset * 1e3);
@@ -492,16 +516,26 @@ function defaultOnOpen(response) {
492
516
  }
493
517
  }
494
518
 
495
- const VERSION = "0.24.2";
519
+ const VERSION = "0.25.0";
496
520
 
521
+ var __defProp$7 = Object.defineProperty;
522
+ var __defNormalProp$7 = (obj, key, value) => key in obj ? __defProp$7(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
523
+ var __publicField$7 = (obj, key, value) => {
524
+ __defNormalProp$7(obj, typeof key !== "symbol" ? key + "" : key, value);
525
+ return value;
526
+ };
497
527
  class ErrorWithCause extends Error {
498
528
  constructor(message, options) {
499
529
  super(message, options);
530
+ __publicField$7(this, "cause");
500
531
  }
501
532
  }
502
533
  class FetcherError extends ErrorWithCause {
503
534
  constructor(status, data, requestId) {
504
535
  super(getMessage(data));
536
+ __publicField$7(this, "status");
537
+ __publicField$7(this, "requestId");
538
+ __publicField$7(this, "errors");
505
539
  this.status = status;
506
540
  this.errors = isBulkError(data) ? data.errors : [{ message: getMessage(data), status }];
507
541
  this.requestId = requestId;
@@ -568,6 +602,15 @@ function hostHeader(url) {
568
602
  const { groups } = pattern.exec(url) ?? {};
569
603
  return groups?.host ? { Host: groups.host } : {};
570
604
  }
605
+ function parseBody(body, headers) {
606
+ if (!isDefined(body))
607
+ return void 0;
608
+ const { "Content-Type": contentType } = headers ?? {};
609
+ if (String(contentType).toLowerCase() === "application/json") {
610
+ return JSON.stringify(body);
611
+ }
612
+ return body;
613
+ }
571
614
  const defaultClientID = generateUUID();
572
615
  async function fetch$1({
573
616
  url: path,
@@ -587,7 +630,8 @@ async function fetch$1({
587
630
  sessionID,
588
631
  clientName,
589
632
  xataAgentExtra,
590
- fetchOptions = {}
633
+ fetchOptions = {},
634
+ rawResponse = false
591
635
  }) {
592
636
  pool.setFetch(fetch2);
593
637
  return await trace(
@@ -606,7 +650,7 @@ async function fetch$1({
606
650
  isDefined(clientName) ? ["service", clientName] : void 0,
607
651
  ...Object.entries(xataAgentExtra ?? {})
608
652
  ]).map(([key, value]) => `${key}=${value}`).join("; ");
609
- const headers = {
653
+ const headers = compactObject({
610
654
  "Accept-Encoding": "identity",
611
655
  "Content-Type": "application/json",
612
656
  "X-Xata-Client-ID": clientID ?? defaultClientID,
@@ -615,11 +659,11 @@ async function fetch$1({
615
659
  ...customHeaders,
616
660
  ...hostHeader(fullUrl),
617
661
  Authorization: `Bearer ${apiKey}`
618
- };
662
+ });
619
663
  const response = await pool.request(url, {
620
664
  ...fetchOptions,
621
665
  method: method.toUpperCase(),
622
- body: body ? JSON.stringify(body) : void 0,
666
+ body: parseBody(body, headers),
623
667
  headers,
624
668
  signal
625
669
  });
@@ -632,6 +676,9 @@ async function fetch$1({
632
676
  [TraceAttributes.HTTP_HOST]: host,
633
677
  [TraceAttributes.HTTP_SCHEME]: protocol?.replace(":", "")
634
678
  });
679
+ const message = response.headers?.get("x-xata-message");
680
+ if (message)
681
+ console.warn(message);
635
682
  if (response.status === 204) {
636
683
  return {};
637
684
  }
@@ -639,7 +686,7 @@ async function fetch$1({
639
686
  throw new FetcherError(response.status, "Rate limit exceeded", requestId);
640
687
  }
641
688
  try {
642
- const jsonResponse = await response.json();
689
+ const jsonResponse = rawResponse ? await response.blob() : await response.json();
643
690
  if (response.ok) {
644
691
  return jsonResponse;
645
692
  }
@@ -912,6 +959,7 @@ const askTable = (variables, signal) => dataPlaneFetch({
912
959
  ...variables,
913
960
  signal
914
961
  });
962
+ const askTableSession = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}", method: "post", ...variables, signal });
915
963
  const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
916
964
  const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
917
965
  const fileAccess = (variables, signal) => dataPlaneFetch({
@@ -987,6 +1035,7 @@ const operationsByTag$2 = {
987
1035
  sqlQuery,
988
1036
  vectorSearchTable,
989
1037
  askTable,
1038
+ askTableSession,
990
1039
  summarizeTable,
991
1040
  aggregateTable
992
1041
  }
@@ -994,6 +1043,13 @@ const operationsByTag$2 = {
994
1043
 
995
1044
  const controlPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "controlPlane" });
996
1045
 
1046
+ const grantAuthorizationCode = (variables, signal) => controlPlaneFetch({ url: "/oauth/authorize", method: "post", ...variables, signal });
1047
+ const generateAccessToken = (variables, signal) => controlPlaneFetch({
1048
+ url: "/oauth/token",
1049
+ method: "post",
1050
+ ...variables,
1051
+ signal
1052
+ });
997
1053
  const getUser = (variables, signal) => controlPlaneFetch({
998
1054
  url: "/user",
999
1055
  method: "get",
@@ -1099,6 +1155,7 @@ const listRegions = (variables, signal) => controlPlaneFetch({
1099
1155
  signal
1100
1156
  });
1101
1157
  const operationsByTag$1 = {
1158
+ authOther: { grantAuthorizationCode, generateAccessToken },
1102
1159
  users: { getUser, updateUser, deleteUser },
1103
1160
  authentication: { getUserAPIKeys, createUserAPIKey, deleteUserAPIKey },
1104
1161
  workspaces: {
@@ -2111,6 +2168,21 @@ class SearchAndFilterApi {
2111
2168
  ...this.extraProps
2112
2169
  });
2113
2170
  }
2171
+ askTableSession({
2172
+ workspace,
2173
+ region,
2174
+ database,
2175
+ branch,
2176
+ table,
2177
+ sessionId,
2178
+ message
2179
+ }) {
2180
+ return operationsByTag.searchAndFilter.askTableSession({
2181
+ pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table, sessionId },
2182
+ body: { message },
2183
+ ...this.extraProps
2184
+ });
2185
+ }
2114
2186
  summarizeTable({
2115
2187
  workspace,
2116
2188
  region,
@@ -2402,11 +2474,13 @@ class DatabaseApi {
2402
2474
  createDatabase({
2403
2475
  workspace,
2404
2476
  database,
2405
- data
2477
+ data,
2478
+ headers
2406
2479
  }) {
2407
2480
  return operationsByTag.databases.createDatabase({
2408
2481
  pathParams: { workspaceId: workspace, dbName: database },
2409
2482
  body: data,
2483
+ headers,
2410
2484
  ...this.extraProps
2411
2485
  });
2412
2486
  }
@@ -2496,13 +2570,261 @@ class XataApiPlugin {
2496
2570
  class XataPlugin {
2497
2571
  }
2498
2572
 
2573
+ class FilesPlugin extends XataPlugin {
2574
+ build(pluginOptions) {
2575
+ return {
2576
+ download: async (location) => {
2577
+ const { table, record, column, fileId = "" } = location ?? {};
2578
+ return await getFileItem({
2579
+ pathParams: {
2580
+ workspace: "{workspaceId}",
2581
+ dbBranchName: "{dbBranch}",
2582
+ region: "{region}",
2583
+ tableName: table ?? "",
2584
+ recordId: record ?? "",
2585
+ columnName: column ?? "",
2586
+ fileId
2587
+ },
2588
+ ...pluginOptions,
2589
+ rawResponse: true
2590
+ });
2591
+ },
2592
+ upload: async (location, file) => {
2593
+ const { table, record, column, fileId = "" } = location ?? {};
2594
+ return await putFileItem({
2595
+ pathParams: {
2596
+ workspace: "{workspaceId}",
2597
+ dbBranchName: "{dbBranch}",
2598
+ region: "{region}",
2599
+ tableName: table ?? "",
2600
+ recordId: record ?? "",
2601
+ columnName: column ?? "",
2602
+ fileId
2603
+ },
2604
+ body: file,
2605
+ ...pluginOptions
2606
+ });
2607
+ },
2608
+ delete: async (location) => {
2609
+ const { table, record, column, fileId = "" } = location ?? {};
2610
+ return await deleteFileItem({
2611
+ pathParams: {
2612
+ workspace: "{workspaceId}",
2613
+ dbBranchName: "{dbBranch}",
2614
+ region: "{region}",
2615
+ tableName: table ?? "",
2616
+ recordId: record ?? "",
2617
+ columnName: column ?? "",
2618
+ fileId
2619
+ },
2620
+ ...pluginOptions
2621
+ });
2622
+ }
2623
+ };
2624
+ }
2625
+ }
2626
+
2627
+ function buildTransformString(transformations) {
2628
+ return transformations.flatMap(
2629
+ (t) => Object.entries(t).map(([key, value]) => {
2630
+ if (key === "trim") {
2631
+ const { left = 0, top = 0, right = 0, bottom = 0 } = value;
2632
+ return `${key}=${[top, right, bottom, left].join(";")}`;
2633
+ }
2634
+ if (key === "gravity" && typeof value === "object") {
2635
+ const { x = 0.5, y = 0.5 } = value;
2636
+ return `${key}=${[x, y].join("x")}`;
2637
+ }
2638
+ return `${key}=${value}`;
2639
+ })
2640
+ ).join(",");
2641
+ }
2642
+ function transformImage(url, transformations) {
2643
+ if (!isDefined(url))
2644
+ return void 0;
2645
+ const transformationsString = buildTransformString(transformations);
2646
+ const { hostname, pathname, search } = new URL(url);
2647
+ return `https://${hostname}/transform/${transformationsString}${pathname}${search}`;
2648
+ }
2649
+
2650
+ var __defProp$6 = Object.defineProperty;
2651
+ var __defNormalProp$6 = (obj, key, value) => key in obj ? __defProp$6(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2652
+ var __publicField$6 = (obj, key, value) => {
2653
+ __defNormalProp$6(obj, typeof key !== "symbol" ? key + "" : key, value);
2654
+ return value;
2655
+ };
2656
+ class XataFile {
2657
+ constructor(file) {
2658
+ /**
2659
+ * Name of this file.
2660
+ */
2661
+ __publicField$6(this, "name");
2662
+ /**
2663
+ * Media type of this file.
2664
+ */
2665
+ __publicField$6(this, "mediaType");
2666
+ /**
2667
+ * Base64 encoded content of this file.
2668
+ */
2669
+ __publicField$6(this, "base64Content");
2670
+ /**
2671
+ * Whether to enable public url for this file.
2672
+ */
2673
+ __publicField$6(this, "enablePublicUrl");
2674
+ /**
2675
+ * Timeout for the signed url.
2676
+ */
2677
+ __publicField$6(this, "signedUrlTimeout");
2678
+ /**
2679
+ * Size of this file.
2680
+ */
2681
+ __publicField$6(this, "size");
2682
+ /**
2683
+ * Version of this file.
2684
+ */
2685
+ __publicField$6(this, "version");
2686
+ /**
2687
+ * Url of this file.
2688
+ */
2689
+ __publicField$6(this, "url");
2690
+ /**
2691
+ * Signed url of this file.
2692
+ */
2693
+ __publicField$6(this, "signedUrl");
2694
+ /**
2695
+ * Attributes of this file.
2696
+ */
2697
+ __publicField$6(this, "attributes");
2698
+ this.name = file.name;
2699
+ this.mediaType = file.mediaType || "application/octet-stream";
2700
+ this.base64Content = file.base64Content;
2701
+ this.enablePublicUrl = file.enablePublicUrl;
2702
+ this.signedUrlTimeout = file.signedUrlTimeout;
2703
+ this.size = file.size;
2704
+ this.version = file.version;
2705
+ this.url = file.url;
2706
+ this.signedUrl = file.signedUrl;
2707
+ this.attributes = file.attributes;
2708
+ }
2709
+ static fromBuffer(buffer, options = {}) {
2710
+ const base64Content = buffer.toString("base64");
2711
+ return new XataFile({ ...options, base64Content });
2712
+ }
2713
+ toBuffer() {
2714
+ if (!this.base64Content) {
2715
+ throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2716
+ }
2717
+ return Buffer.from(this.base64Content, "base64");
2718
+ }
2719
+ static fromArrayBuffer(arrayBuffer, options = {}) {
2720
+ const uint8Array = new Uint8Array(arrayBuffer);
2721
+ return this.fromUint8Array(uint8Array, options);
2722
+ }
2723
+ toArrayBuffer() {
2724
+ if (!this.base64Content) {
2725
+ throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2726
+ }
2727
+ const binary = atob(this.base64Content);
2728
+ return new ArrayBuffer(binary.length);
2729
+ }
2730
+ static fromUint8Array(uint8Array, options = {}) {
2731
+ let binary = "";
2732
+ for (let i = 0; i < uint8Array.byteLength; i++) {
2733
+ binary += String.fromCharCode(uint8Array[i]);
2734
+ }
2735
+ const base64Content = btoa(binary);
2736
+ return new XataFile({ ...options, base64Content });
2737
+ }
2738
+ toUint8Array() {
2739
+ if (!this.base64Content) {
2740
+ throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2741
+ }
2742
+ const binary = atob(this.base64Content);
2743
+ const uint8Array = new Uint8Array(binary.length);
2744
+ for (let i = 0; i < binary.length; i++) {
2745
+ uint8Array[i] = binary.charCodeAt(i);
2746
+ }
2747
+ return uint8Array;
2748
+ }
2749
+ static async fromBlob(file, options = {}) {
2750
+ const name = options.name ?? file.name;
2751
+ const mediaType = file.type;
2752
+ const arrayBuffer = await file.arrayBuffer();
2753
+ return this.fromArrayBuffer(arrayBuffer, { ...options, name, mediaType });
2754
+ }
2755
+ toBlob() {
2756
+ if (!this.base64Content) {
2757
+ throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2758
+ }
2759
+ const arrayBuffer = this.toArrayBuffer();
2760
+ return new Blob([arrayBuffer], { type: this.mediaType });
2761
+ }
2762
+ static fromString(string, options = {}) {
2763
+ const base64Content = btoa(string);
2764
+ return new XataFile({ ...options, base64Content });
2765
+ }
2766
+ toString() {
2767
+ if (!this.base64Content) {
2768
+ throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2769
+ }
2770
+ return atob(this.base64Content);
2771
+ }
2772
+ static fromBase64(base64Content, options = {}) {
2773
+ return new XataFile({ ...options, base64Content });
2774
+ }
2775
+ toBase64() {
2776
+ if (!this.base64Content) {
2777
+ throw new Error(`File content is not available, please select property "base64Content" when querying the file`);
2778
+ }
2779
+ return this.base64Content;
2780
+ }
2781
+ transform(...options) {
2782
+ return {
2783
+ url: transformImage(this.url, options),
2784
+ signedUrl: transformImage(this.signedUrl, options)
2785
+ };
2786
+ }
2787
+ }
2788
+ const parseInputFileEntry = async (entry) => {
2789
+ if (!isDefined(entry))
2790
+ return null;
2791
+ const { id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout } = await entry;
2792
+ return compactObject({ id, name, mediaType, base64Content, enablePublicUrl, signedUrlTimeout });
2793
+ };
2794
+
2499
2795
  function cleanFilter(filter) {
2500
- if (!filter)
2796
+ if (!isDefined(filter))
2501
2797
  return void 0;
2502
- const values = Object.values(filter).filter(Boolean).filter((value) => Array.isArray(value) ? value.length > 0 : true);
2503
- return values.length > 0 ? filter : void 0;
2798
+ if (!isObject(filter))
2799
+ return filter;
2800
+ const values = Object.fromEntries(
2801
+ Object.entries(filter).reduce((acc, [key, value]) => {
2802
+ if (!isDefined(value))
2803
+ return acc;
2804
+ if (Array.isArray(value)) {
2805
+ const clean = value.map((item) => cleanFilter(item)).filter((item) => isDefined(item));
2806
+ if (clean.length === 0)
2807
+ return acc;
2808
+ return [...acc, [key, clean]];
2809
+ }
2810
+ if (isObject(value)) {
2811
+ const clean = cleanFilter(value);
2812
+ if (!isDefined(clean))
2813
+ return acc;
2814
+ return [...acc, [key, clean]];
2815
+ }
2816
+ return [...acc, [key, value]];
2817
+ }, [])
2818
+ );
2819
+ return Object.keys(values).length > 0 ? values : void 0;
2504
2820
  }
2505
2821
 
2822
+ var __defProp$5 = Object.defineProperty;
2823
+ var __defNormalProp$5 = (obj, key, value) => key in obj ? __defProp$5(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2824
+ var __publicField$5 = (obj, key, value) => {
2825
+ __defNormalProp$5(obj, typeof key !== "symbol" ? key + "" : key, value);
2826
+ return value;
2827
+ };
2506
2828
  var __accessCheck$6 = (obj, member, msg) => {
2507
2829
  if (!member.has(obj))
2508
2830
  throw TypeError("Cannot " + msg);
@@ -2525,6 +2847,14 @@ var _query, _page;
2525
2847
  class Page {
2526
2848
  constructor(query, meta, records = []) {
2527
2849
  __privateAdd$6(this, _query, void 0);
2850
+ /**
2851
+ * Page metadata, required to retrieve additional records.
2852
+ */
2853
+ __publicField$5(this, "meta");
2854
+ /**
2855
+ * The set of results for this page.
2856
+ */
2857
+ __publicField$5(this, "records");
2528
2858
  __privateSet$6(this, _query, query);
2529
2859
  this.meta = meta;
2530
2860
  this.records = new RecordArray(this, records);
@@ -2581,7 +2911,7 @@ const PAGINATION_DEFAULT_OFFSET = 0;
2581
2911
  function isCursorPaginationOptions(options) {
2582
2912
  return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
2583
2913
  }
2584
- const _RecordArray = class extends Array {
2914
+ const _RecordArray = class _RecordArray extends Array {
2585
2915
  constructor(...args) {
2586
2916
  super(..._RecordArray.parseConstructorParams(...args));
2587
2917
  __privateAdd$6(this, _page, void 0);
@@ -2652,9 +2982,15 @@ const _RecordArray = class extends Array {
2652
2982
  return __privateGet$6(this, _page).meta.page.more;
2653
2983
  }
2654
2984
  };
2655
- let RecordArray = _RecordArray;
2656
2985
  _page = new WeakMap();
2986
+ let RecordArray = _RecordArray;
2657
2987
 
2988
+ var __defProp$4 = Object.defineProperty;
2989
+ var __defNormalProp$4 = (obj, key, value) => key in obj ? __defProp$4(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
2990
+ var __publicField$4 = (obj, key, value) => {
2991
+ __defNormalProp$4(obj, typeof key !== "symbol" ? key + "" : key, value);
2992
+ return value;
2993
+ };
2658
2994
  var __accessCheck$5 = (obj, member, msg) => {
2659
2995
  if (!member.has(obj))
2660
2996
  throw TypeError("Cannot " + msg);
@@ -2678,15 +3014,15 @@ var __privateMethod$3 = (obj, member, method) => {
2678
3014
  return method;
2679
3015
  };
2680
3016
  var _table$1, _repository, _data, _cleanFilterConstraint, cleanFilterConstraint_fn;
2681
- const _Query = class {
3017
+ const _Query = class _Query {
2682
3018
  constructor(repository, table, data, rawParent) {
2683
3019
  __privateAdd$5(this, _cleanFilterConstraint);
2684
3020
  __privateAdd$5(this, _table$1, void 0);
2685
3021
  __privateAdd$5(this, _repository, void 0);
2686
3022
  __privateAdd$5(this, _data, { filter: {} });
2687
3023
  // Implements pagination
2688
- this.meta = { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } };
2689
- this.records = new RecordArray(this, []);
3024
+ __publicField$4(this, "meta", { page: { cursor: "start", more: true, size: PAGINATION_DEFAULT_SIZE } });
3025
+ __publicField$4(this, "records", new RecordArray(this, []));
2690
3026
  __privateSet$5(this, _table$1, table);
2691
3027
  if (repository) {
2692
3028
  __privateSet$5(this, _repository, repository);
@@ -2906,7 +3242,6 @@ const _Query = class {
2906
3242
  return this.meta.page.more;
2907
3243
  }
2908
3244
  };
2909
- let Query = _Query;
2910
3245
  _table$1 = new WeakMap();
2911
3246
  _repository = new WeakMap();
2912
3247
  _data = new WeakMap();
@@ -2921,6 +3256,7 @@ cleanFilterConstraint_fn = function(column, value) {
2921
3256
  }
2922
3257
  return value;
2923
3258
  };
3259
+ let Query = _Query;
2924
3260
  function cleanParent(data, parent) {
2925
3261
  if (isCursorPaginationOptions(data.pagination)) {
2926
3262
  return { ...parent, sort: void 0, filter: void 0 };
@@ -2928,6 +3264,21 @@ function cleanParent(data, parent) {
2928
3264
  return parent;
2929
3265
  }
2930
3266
 
3267
+ const RecordColumnTypes = [
3268
+ "bool",
3269
+ "int",
3270
+ "float",
3271
+ "string",
3272
+ "text",
3273
+ "email",
3274
+ "multiple",
3275
+ "link",
3276
+ "object",
3277
+ "datetime",
3278
+ "vector",
3279
+ "file[]",
3280
+ "file"
3281
+ ];
2931
3282
  function isIdentifiable(x) {
2932
3283
  return isObject(x) && isString(x?.id);
2933
3284
  }
@@ -2986,7 +3337,7 @@ var __privateMethod$2 = (obj, member, method) => {
2986
3337
  __accessCheck$4(obj, member, "access private method");
2987
3338
  return method;
2988
3339
  };
2989
- var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1;
3340
+ var _table, _getFetchProps, _db, _cache, _schemaTables$2, _trace, _insertRecordWithoutId, insertRecordWithoutId_fn, _insertRecordWithId, insertRecordWithId_fn, _insertRecords, insertRecords_fn, _updateRecordWithID, updateRecordWithID_fn, _updateRecords, updateRecords_fn, _upsertRecordWithID, upsertRecordWithID_fn, _deleteRecord, deleteRecord_fn, _deleteRecords, deleteRecords_fn, _setCacheQuery, setCacheQuery_fn, _getCacheQuery, getCacheQuery_fn, _getSchemaTables$1, getSchemaTables_fn$1, _transformObjectToApi, transformObjectToApi_fn;
2990
3341
  const BULK_OPERATION_MAX_SIZE = 1e3;
2991
3342
  class Repository extends Query {
2992
3343
  }
@@ -3008,6 +3359,7 @@ class RestRepository extends Query {
3008
3359
  __privateAdd$4(this, _setCacheQuery);
3009
3360
  __privateAdd$4(this, _getCacheQuery);
3010
3361
  __privateAdd$4(this, _getSchemaTables$1);
3362
+ __privateAdd$4(this, _transformObjectToApi);
3011
3363
  __privateAdd$4(this, _table, void 0);
3012
3364
  __privateAdd$4(this, _getFetchProps, void 0);
3013
3365
  __privateAdd$4(this, _db, void 0);
@@ -3185,12 +3537,22 @@ class RestRepository extends Query {
3185
3537
  return result;
3186
3538
  }
3187
3539
  if (isString(a) && isObject(b)) {
3540
+ if (a === "")
3541
+ throw new Error("The id can't be empty");
3188
3542
  const columns = isStringArray(c) ? c : void 0;
3189
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3543
+ return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a, b, columns, { ifVersion });
3190
3544
  }
3191
3545
  if (isObject(a) && isString(a.id)) {
3546
+ if (a.id === "")
3547
+ throw new Error("The id can't be empty");
3192
3548
  const columns = isStringArray(c) ? c : void 0;
3193
- return __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3549
+ return await __privateMethod$2(this, _upsertRecordWithID, upsertRecordWithID_fn).call(this, a.id, { ...a, id: void 0 }, columns, { ifVersion });
3550
+ }
3551
+ if (!isDefined(a) && isObject(b)) {
3552
+ return await this.create(b, c);
3553
+ }
3554
+ if (isObject(a) && !isDefined(a.id)) {
3555
+ return await this.create(a, b);
3194
3556
  }
3195
3557
  throw new Error("Invalid arguments for createOrUpdate method");
3196
3558
  });
@@ -3207,12 +3569,22 @@ class RestRepository extends Query {
3207
3569
  return result;
3208
3570
  }
3209
3571
  if (isString(a) && isObject(b)) {
3572
+ if (a === "")
3573
+ throw new Error("The id can't be empty");
3210
3574
  const columns = isStringArray(c) ? c : void 0;
3211
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
3575
+ return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a, b, columns, { createOnly: false, ifVersion });
3212
3576
  }
3213
3577
  if (isObject(a) && isString(a.id)) {
3578
+ if (a.id === "")
3579
+ throw new Error("The id can't be empty");
3214
3580
  const columns = isStringArray(c) ? c : void 0;
3215
- return __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
3581
+ return await __privateMethod$2(this, _insertRecordWithId, insertRecordWithId_fn).call(this, a.id, { ...a, id: void 0 }, columns, { createOnly: false, ifVersion });
3582
+ }
3583
+ if (!isDefined(a) && isObject(b)) {
3584
+ return await this.create(b, c);
3585
+ }
3586
+ if (isObject(a) && !isDefined(a.id)) {
3587
+ return await this.create(a, b);
3216
3588
  }
3217
3589
  throw new Error("Invalid arguments for createOrReplace method");
3218
3590
  });
@@ -3379,23 +3751,28 @@ class RestRepository extends Query {
3379
3751
  });
3380
3752
  }
3381
3753
  ask(question, options) {
3754
+ const questionParam = options?.sessionId ? { message: question } : { question };
3382
3755
  const params = {
3383
3756
  pathParams: {
3384
3757
  workspace: "{workspaceId}",
3385
3758
  dbBranchName: "{dbBranch}",
3386
3759
  region: "{region}",
3387
- tableName: __privateGet$4(this, _table)
3760
+ tableName: __privateGet$4(this, _table),
3761
+ sessionId: options?.sessionId
3388
3762
  },
3389
3763
  body: {
3390
- question,
3391
- ...options
3764
+ ...questionParam,
3765
+ rules: options?.rules,
3766
+ searchType: options?.searchType,
3767
+ search: options?.searchType === "keyword" ? options?.search : void 0,
3768
+ vectorSearch: options?.searchType === "vector" ? options?.vectorSearch : void 0
3392
3769
  },
3393
3770
  ...__privateGet$4(this, _getFetchProps).call(this)
3394
3771
  };
3395
3772
  if (options?.onMessage) {
3396
3773
  fetchSSERequest({
3397
3774
  endpoint: "dataPlane",
3398
- url: "/db/{dbBranchName}/tables/{tableName}/ask",
3775
+ url: "/db/{dbBranchName}/tables/{tableName}/ask/{sessionId}",
3399
3776
  method: "POST",
3400
3777
  onMessage: (message) => {
3401
3778
  options.onMessage?.({ answer: message.text, records: message.records });
@@ -3403,7 +3780,7 @@ class RestRepository extends Query {
3403
3780
  ...params
3404
3781
  });
3405
3782
  } else {
3406
- return askTable(params);
3783
+ return askTableSession(params);
3407
3784
  }
3408
3785
  }
3409
3786
  }
@@ -3415,7 +3792,7 @@ _schemaTables$2 = new WeakMap();
3415
3792
  _trace = new WeakMap();
3416
3793
  _insertRecordWithoutId = new WeakSet();
3417
3794
  insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3418
- const record = transformObjectLinks(object);
3795
+ const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3419
3796
  const response = await insertRecord({
3420
3797
  pathParams: {
3421
3798
  workspace: "{workspaceId}",
@@ -3432,7 +3809,9 @@ insertRecordWithoutId_fn = async function(object, columns = ["*"]) {
3432
3809
  };
3433
3810
  _insertRecordWithId = new WeakSet();
3434
3811
  insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { createOnly, ifVersion }) {
3435
- const record = transformObjectLinks(object);
3812
+ if (!recordId)
3813
+ return null;
3814
+ const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3436
3815
  const response = await insertRecordWithID({
3437
3816
  pathParams: {
3438
3817
  workspace: "{workspaceId}",
@@ -3450,21 +3829,20 @@ insertRecordWithId_fn = async function(recordId, object, columns = ["*"], { crea
3450
3829
  };
3451
3830
  _insertRecords = new WeakSet();
3452
3831
  insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3453
- const chunkedOperations = chunk(
3454
- objects.map((object) => ({
3455
- insert: { table: __privateGet$4(this, _table), record: transformObjectLinks(object), createOnly, ifVersion }
3456
- })),
3457
- BULK_OPERATION_MAX_SIZE
3458
- );
3832
+ const operations = await promiseMap(objects, async (object) => {
3833
+ const record = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3834
+ return { insert: { table: __privateGet$4(this, _table), record, createOnly, ifVersion } };
3835
+ });
3836
+ const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3459
3837
  const ids = [];
3460
- for (const operations of chunkedOperations) {
3838
+ for (const operations2 of chunkedOperations) {
3461
3839
  const { results } = await branchTransaction({
3462
3840
  pathParams: {
3463
3841
  workspace: "{workspaceId}",
3464
3842
  dbBranchName: "{dbBranch}",
3465
3843
  region: "{region}"
3466
3844
  },
3467
- body: { operations },
3845
+ body: { operations: operations2 },
3468
3846
  ...__privateGet$4(this, _getFetchProps).call(this)
3469
3847
  });
3470
3848
  for (const result of results) {
@@ -3479,7 +3857,9 @@ insertRecords_fn = async function(objects, { createOnly, ifVersion }) {
3479
3857
  };
3480
3858
  _updateRecordWithID = new WeakSet();
3481
3859
  updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
3482
- const { id: _id, ...record } = transformObjectLinks(object);
3860
+ if (!recordId)
3861
+ return null;
3862
+ const { id: _id, ...record } = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3483
3863
  try {
3484
3864
  const response = await updateRecordWithID({
3485
3865
  pathParams: {
@@ -3504,21 +3884,20 @@ updateRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3504
3884
  };
3505
3885
  _updateRecords = new WeakSet();
3506
3886
  updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3507
- const chunkedOperations = chunk(
3508
- objects.map(({ id, ...object }) => ({
3509
- update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields: transformObjectLinks(object) }
3510
- })),
3511
- BULK_OPERATION_MAX_SIZE
3512
- );
3887
+ const operations = await promiseMap(objects, async ({ id, ...object }) => {
3888
+ const fields = await __privateMethod$2(this, _transformObjectToApi, transformObjectToApi_fn).call(this, object);
3889
+ return { update: { table: __privateGet$4(this, _table), id, ifVersion, upsert, fields } };
3890
+ });
3891
+ const chunkedOperations = chunk(operations, BULK_OPERATION_MAX_SIZE);
3513
3892
  const ids = [];
3514
- for (const operations of chunkedOperations) {
3893
+ for (const operations2 of chunkedOperations) {
3515
3894
  const { results } = await branchTransaction({
3516
3895
  pathParams: {
3517
3896
  workspace: "{workspaceId}",
3518
3897
  dbBranchName: "{dbBranch}",
3519
3898
  region: "{region}"
3520
3899
  },
3521
- body: { operations },
3900
+ body: { operations: operations2 },
3522
3901
  ...__privateGet$4(this, _getFetchProps).call(this)
3523
3902
  });
3524
3903
  for (const result of results) {
@@ -3533,6 +3912,8 @@ updateRecords_fn = async function(objects, { ifVersion, upsert }) {
3533
3912
  };
3534
3913
  _upsertRecordWithID = new WeakSet();
3535
3914
  upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVersion }) {
3915
+ if (!recordId)
3916
+ return null;
3536
3917
  const response = await upsertRecordWithID({
3537
3918
  pathParams: {
3538
3919
  workspace: "{workspaceId}",
@@ -3550,6 +3931,8 @@ upsertRecordWithID_fn = async function(recordId, object, columns = ["*"], { ifVe
3550
3931
  };
3551
3932
  _deleteRecord = new WeakSet();
3552
3933
  deleteRecord_fn = async function(recordId, columns = ["*"]) {
3934
+ if (!recordId)
3935
+ return null;
3553
3936
  try {
3554
3937
  const response = await deleteRecord({
3555
3938
  pathParams: {
@@ -3574,7 +3957,7 @@ deleteRecord_fn = async function(recordId, columns = ["*"]) {
3574
3957
  _deleteRecords = new WeakSet();
3575
3958
  deleteRecords_fn = async function(recordIds) {
3576
3959
  const chunkedOperations = chunk(
3577
- recordIds.map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
3960
+ compact(recordIds).map((id) => ({ delete: { table: __privateGet$4(this, _table), id } })),
3578
3961
  BULK_OPERATION_MAX_SIZE
3579
3962
  );
3580
3963
  for (const operations of chunkedOperations) {
@@ -3617,7 +4000,39 @@ getSchemaTables_fn$1 = async function() {
3617
4000
  __privateSet$4(this, _schemaTables$2, schema.tables);
3618
4001
  return schema.tables;
3619
4002
  };
3620
- const transformObjectLinks = (object) => {
4003
+ _transformObjectToApi = new WeakSet();
4004
+ transformObjectToApi_fn = async function(object) {
4005
+ const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
4006
+ const schema = schemaTables.find((table) => table.name === __privateGet$4(this, _table));
4007
+ if (!schema)
4008
+ throw new Error(`Table ${__privateGet$4(this, _table)} not found in schema`);
4009
+ const result = {};
4010
+ for (const [key, value] of Object.entries(object)) {
4011
+ if (key === "xata")
4012
+ continue;
4013
+ const type = schema.columns.find((column) => column.name === key)?.type;
4014
+ switch (type) {
4015
+ case "link": {
4016
+ result[key] = isIdentifiable(value) ? value.id : value;
4017
+ break;
4018
+ }
4019
+ case "datetime": {
4020
+ result[key] = value instanceof Date ? value.toISOString() : value;
4021
+ break;
4022
+ }
4023
+ case `file`:
4024
+ result[key] = await parseInputFileEntry(value);
4025
+ break;
4026
+ case "file[]":
4027
+ result[key] = await promiseMap(value, (item) => parseInputFileEntry(item));
4028
+ break;
4029
+ default:
4030
+ result[key] = value;
4031
+ }
4032
+ }
4033
+ return result;
4034
+ };
4035
+ const removeLinksFromObject = (object) => {
3621
4036
  return Object.entries(object).reduce((acc, [key, value]) => {
3622
4037
  if (key === "xata")
3623
4038
  return acc;
@@ -3666,6 +4081,12 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
3666
4081
  }
3667
4082
  break;
3668
4083
  }
4084
+ case "file":
4085
+ data[column.name] = isDefined(value) ? new XataFile(value) : null;
4086
+ break;
4087
+ case "file[]":
4088
+ data[column.name] = value?.map((item) => new XataFile(item)) ?? null;
4089
+ break;
3669
4090
  default:
3670
4091
  data[column.name] = value ?? null;
3671
4092
  if (column.notNull === true && value === null) {
@@ -3675,7 +4096,7 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
3675
4096
  }
3676
4097
  }
3677
4098
  const record = { ...data };
3678
- const serializable = { xata, ...transformObjectLinks(data) };
4099
+ const serializable = { xata, ...removeLinksFromObject(data) };
3679
4100
  const metadata = xata !== void 0 ? { ...xata, createdAt: new Date(xata.createdAt), updatedAt: new Date(xata.updatedAt) } : void 0;
3680
4101
  record.read = function(columns2) {
3681
4102
  return db[table].read(record["id"], columns2);
@@ -3701,7 +4122,7 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
3701
4122
  return JSON.parse(JSON.stringify(serializable));
3702
4123
  };
3703
4124
  record.toString = function() {
3704
- return JSON.stringify(transformObjectLinks(serializable));
4125
+ return JSON.stringify(serializable);
3705
4126
  };
3706
4127
  for (const prop of ["read", "update", "replace", "delete", "getMetadata", "toSerializable", "toString"]) {
3707
4128
  Object.defineProperty(record, prop, { enumerable: false });
@@ -3719,11 +4140,7 @@ function extractId(value) {
3719
4140
  function isValidColumn(columns, column) {
3720
4141
  if (columns.includes("*"))
3721
4142
  return true;
3722
- if (column.type === "link") {
3723
- const linkColumns = columns.filter((item) => item.startsWith(column.name));
3724
- return linkColumns.length > 0;
3725
- }
3726
- return columns.includes(column.name);
4143
+ return columns.filter((item) => item.startsWith(column.name)).length > 0;
3727
4144
  }
3728
4145
  function parseIfVersion(...args) {
3729
4146
  for (const arg of args) {
@@ -3734,6 +4151,12 @@ function parseIfVersion(...args) {
3734
4151
  return void 0;
3735
4152
  }
3736
4153
 
4154
+ var __defProp$3 = Object.defineProperty;
4155
+ var __defNormalProp$3 = (obj, key, value) => key in obj ? __defProp$3(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4156
+ var __publicField$3 = (obj, key, value) => {
4157
+ __defNormalProp$3(obj, typeof key !== "symbol" ? key + "" : key, value);
4158
+ return value;
4159
+ };
3737
4160
  var __accessCheck$3 = (obj, member, msg) => {
3738
4161
  if (!member.has(obj))
3739
4162
  throw TypeError("Cannot " + msg);
@@ -3756,6 +4179,8 @@ var _map;
3756
4179
  class SimpleCache {
3757
4180
  constructor(options = {}) {
3758
4181
  __privateAdd$3(this, _map, void 0);
4182
+ __publicField$3(this, "capacity");
4183
+ __publicField$3(this, "defaultQueryTTL");
3759
4184
  __privateSet$3(this, _map, /* @__PURE__ */ new Map());
3760
4185
  this.capacity = options.max ?? 500;
3761
4186
  this.defaultQueryTTL = options.defaultQueryTTL ?? 60 * 1e3;
@@ -3953,6 +4378,12 @@ class TransactionPlugin extends XataPlugin {
3953
4378
  }
3954
4379
  }
3955
4380
 
4381
+ var __defProp$2 = Object.defineProperty;
4382
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4383
+ var __publicField$2 = (obj, key, value) => {
4384
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
4385
+ return value;
4386
+ };
3956
4387
  var __accessCheck = (obj, member, msg) => {
3957
4388
  if (!member.has(obj))
3958
4389
  throw TypeError("Cannot " + msg);
@@ -3982,6 +4413,10 @@ const buildClient = (plugins) => {
3982
4413
  __privateAdd(this, _parseOptions);
3983
4414
  __privateAdd(this, _getFetchProps);
3984
4415
  __privateAdd(this, _options, void 0);
4416
+ __publicField$2(this, "db");
4417
+ __publicField$2(this, "search");
4418
+ __publicField$2(this, "transactions");
4419
+ __publicField$2(this, "files");
3985
4420
  const safeOptions = __privateMethod(this, _parseOptions, parseOptions_fn).call(this, options);
3986
4421
  __privateSet(this, _options, safeOptions);
3987
4422
  const pluginOptions = {
@@ -3992,9 +4427,11 @@ const buildClient = (plugins) => {
3992
4427
  const db = new SchemaPlugin(schemaTables).build(pluginOptions);
3993
4428
  const search = new SearchPlugin(db, schemaTables).build(pluginOptions);
3994
4429
  const transactions = new TransactionPlugin().build(pluginOptions);
4430
+ const files = new FilesPlugin().build(pluginOptions);
3995
4431
  this.db = db;
3996
4432
  this.search = search;
3997
4433
  this.transactions = transactions;
4434
+ this.files = files;
3998
4435
  for (const [key, namespace] of Object.entries(plugins ?? {})) {
3999
4436
  if (namespace === void 0)
4000
4437
  continue;
@@ -4091,11 +4528,17 @@ const buildClient = (plugins) => {
4091
4528
  class BaseClient extends buildClient() {
4092
4529
  }
4093
4530
 
4531
+ var __defProp$1 = Object.defineProperty;
4532
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4533
+ var __publicField$1 = (obj, key, value) => {
4534
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
4535
+ return value;
4536
+ };
4094
4537
  const META = "__";
4095
4538
  const VALUE = "___";
4096
4539
  class Serializer {
4097
4540
  constructor() {
4098
- this.classes = {};
4541
+ __publicField$1(this, "classes", {});
4099
4542
  }
4100
4543
  add(clazz) {
4101
4544
  this.classes[clazz.name] = clazz;
@@ -4173,9 +4616,16 @@ function buildWorkerRunner(config) {
4173
4616
  };
4174
4617
  }
4175
4618
 
4619
+ var __defProp = Object.defineProperty;
4620
+ var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4621
+ var __publicField = (obj, key, value) => {
4622
+ __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4623
+ return value;
4624
+ };
4176
4625
  class XataError extends Error {
4177
4626
  constructor(message, status) {
4178
4627
  super(message);
4628
+ __publicField(this, "status");
4179
4629
  this.status = status;
4180
4630
  }
4181
4631
  }
@@ -4190,6 +4640,7 @@ exports.PAGINATION_MAX_SIZE = PAGINATION_MAX_SIZE;
4190
4640
  exports.Page = Page;
4191
4641
  exports.Query = Query;
4192
4642
  exports.RecordArray = RecordArray;
4643
+ exports.RecordColumnTypes = RecordColumnTypes;
4193
4644
  exports.Repository = Repository;
4194
4645
  exports.RestRepository = RestRepository;
4195
4646
  exports.SchemaPlugin = SchemaPlugin;
@@ -4199,6 +4650,7 @@ exports.SimpleCache = SimpleCache;
4199
4650
  exports.XataApiClient = XataApiClient;
4200
4651
  exports.XataApiPlugin = XataApiPlugin;
4201
4652
  exports.XataError = XataError;
4653
+ exports.XataFile = XataFile;
4202
4654
  exports.XataPlugin = XataPlugin;
4203
4655
  exports.acceptWorkspaceMemberInvite = acceptWorkspaceMemberInvite;
4204
4656
  exports.addGitBranchesEntry = addGitBranchesEntry;
@@ -4206,6 +4658,7 @@ exports.addTableColumn = addTableColumn;
4206
4658
  exports.aggregateTable = aggregateTable;
4207
4659
  exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
4208
4660
  exports.askTable = askTable;
4661
+ exports.askTableSession = askTableSession;
4209
4662
  exports.branchTransaction = branchTransaction;
4210
4663
  exports.buildClient = buildClient;
4211
4664
  exports.buildPreviewBranchName = buildPreviewBranchName;
@@ -4242,6 +4695,7 @@ exports.executeBranchMigrationPlan = executeBranchMigrationPlan;
4242
4695
  exports.exists = exists;
4243
4696
  exports.fileAccess = fileAccess;
4244
4697
  exports.ge = ge;
4698
+ exports.generateAccessToken = generateAccessToken;
4245
4699
  exports.getAPIKey = getAPIKey;
4246
4700
  exports.getBranch = getBranch;
4247
4701
  exports.getBranchDetails = getBranchDetails;
@@ -4271,6 +4725,7 @@ exports.getUserAPIKeys = getUserAPIKeys;
4271
4725
  exports.getWorkspace = getWorkspace;
4272
4726
  exports.getWorkspaceMembersList = getWorkspaceMembersList;
4273
4727
  exports.getWorkspacesList = getWorkspacesList;
4728
+ exports.grantAuthorizationCode = grantAuthorizationCode;
4274
4729
  exports.greaterEquals = greaterEquals;
4275
4730
  exports.greaterThan = greaterThan;
4276
4731
  exports.greaterThanEquals = greaterThanEquals;