@xata.io/client 0.26.7 → 0.26.9

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.7 add-version /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.26.9 add-version /home/runner/work/client-ts/client-ts/packages/client
3
3
  > node ../../scripts/add-version-file.mjs
4
4
 
@@ -1,5 +1,5 @@
1
1
 
2
- > @xata.io/client@0.26.7 build /home/runner/work/client-ts/client-ts/packages/client
2
+ > @xata.io/client@0.26.9 build /home/runner/work/client-ts/client-ts/packages/client
3
3
  > rimraf dist && rollup -c
4
4
 
5
5
  
@@ -7,7 +7,7 @@
7
7
  created dist/index.cjs in 1.1s
8
8
  
9
9
  src/index.ts → dist/index.mjs...
10
- created dist/index.mjs in 735ms
10
+ created dist/index.mjs in 721ms
11
11
  
12
12
  src/index.ts → dist/index.d.ts...
13
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.9
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1224](https://github.com/xataio/client-ts/pull/1224) [`302798e8`](https://github.com/xataio/client-ts/commit/302798e8d210c89f420a5c927e0f836a27dbaed9) Thanks [@SferaDev](https://github.com/SferaDev)! - Export transaction types
8
+
9
+ ## 0.26.8
10
+
11
+ ### Patch Changes
12
+
13
+ - [#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
14
+
15
+ - [#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
16
+
17
+ - [#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
18
+
3
19
  ## 0.26.7
4
20
 
5
21
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -528,7 +528,7 @@ function defaultOnOpen(response) {
528
528
  }
529
529
  }
530
530
 
531
- const VERSION = "0.26.7";
531
+ const VERSION = "0.26.9";
532
532
 
533
533
  class ErrorWithCause extends Error {
534
534
  constructor(message, options) {
@@ -787,6 +787,12 @@ const deleteBranch = (variables, signal) => dataPlaneFetch({
787
787
  ...variables,
788
788
  signal
789
789
  });
790
+ const getSchema = (variables, signal) => dataPlaneFetch({
791
+ url: "/db/{dbBranchName}/schema",
792
+ method: "get",
793
+ ...variables,
794
+ signal
795
+ });
790
796
  const copyBranch = (variables, signal) => dataPlaneFetch({
791
797
  url: "/db/{dbBranchName}/copy",
792
798
  method: "post",
@@ -990,6 +996,7 @@ const operationsByTag$2 = {
990
996
  resolveBranch
991
997
  },
992
998
  migrations: {
999
+ getSchema,
993
1000
  getBranchMigrationHistory,
994
1001
  getBranchMigrationPlan,
995
1002
  executeBranchMigrationPlan,
@@ -2619,75 +2626,6 @@ class XataApiPlugin {
2619
2626
  class XataPlugin {
2620
2627
  }
2621
2628
 
2622
- class FilesPlugin extends XataPlugin {
2623
- build(pluginOptions) {
2624
- return {
2625
- download: async (location) => {
2626
- const { table, record, column, fileId = "" } = location ?? {};
2627
- return await getFileItem({
2628
- pathParams: {
2629
- workspace: "{workspaceId}",
2630
- dbBranchName: "{dbBranch}",
2631
- region: "{region}",
2632
- tableName: table ?? "",
2633
- recordId: record ?? "",
2634
- columnName: column ?? "",
2635
- fileId
2636
- },
2637
- ...pluginOptions,
2638
- rawResponse: true
2639
- });
2640
- },
2641
- upload: async (location, file, options) => {
2642
- const { table, record, column, fileId = "" } = location ?? {};
2643
- const contentType = options?.mediaType || getContentType(file);
2644
- return await putFileItem({
2645
- ...pluginOptions,
2646
- pathParams: {
2647
- workspace: "{workspaceId}",
2648
- dbBranchName: "{dbBranch}",
2649
- region: "{region}",
2650
- tableName: table ?? "",
2651
- recordId: record ?? "",
2652
- columnName: column ?? "",
2653
- fileId
2654
- },
2655
- body: file,
2656
- headers: { "Content-Type": contentType }
2657
- });
2658
- },
2659
- delete: async (location) => {
2660
- const { table, record, column, fileId = "" } = location ?? {};
2661
- return await deleteFileItem({
2662
- pathParams: {
2663
- workspace: "{workspaceId}",
2664
- dbBranchName: "{dbBranch}",
2665
- region: "{region}",
2666
- tableName: table ?? "",
2667
- recordId: record ?? "",
2668
- columnName: column ?? "",
2669
- fileId
2670
- },
2671
- ...pluginOptions
2672
- });
2673
- }
2674
- };
2675
- }
2676
- }
2677
- function getContentType(file) {
2678
- if (typeof file === "string") {
2679
- return "text/plain";
2680
- }
2681
- if (isBlob(file)) {
2682
- return file.type;
2683
- }
2684
- try {
2685
- return file.type;
2686
- } catch (e) {
2687
- }
2688
- return "application/octet-stream";
2689
- }
2690
-
2691
2629
  function buildTransformString(transformations) {
2692
2630
  return transformations.flatMap(
2693
2631
  (t) => Object.entries(t).map(([key, value]) => {
@@ -3815,7 +3753,13 @@ class RestRepository extends Query {
3815
3753
  },
3816
3754
  ...__privateGet$4(this, _getFetchProps).call(this)
3817
3755
  });
3818
- return result;
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
+ };
3819
3763
  });
3820
3764
  }
3821
3765
  ask(question, options) {
@@ -4186,7 +4130,9 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
4186
4130
  record.delete = function() {
4187
4131
  return db[table].delete(record["id"]);
4188
4132
  };
4189
- record.xata = Object.freeze(metadata);
4133
+ if (metadata !== void 0) {
4134
+ record.xata = Object.freeze(metadata);
4135
+ }
4190
4136
  record.getMetadata = function() {
4191
4137
  return record.xata;
4192
4138
  };
@@ -4350,6 +4296,80 @@ class SchemaPlugin extends XataPlugin {
4350
4296
  _tables = new WeakMap();
4351
4297
  _schemaTables$1 = new WeakMap();
4352
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
+
4353
4373
  var __accessCheck$1 = (obj, member, msg) => {
4354
4374
  if (!member.has(obj))
4355
4375
  throw TypeError("Cannot " + msg);
@@ -4766,6 +4786,7 @@ exports.SchemaPlugin = SchemaPlugin;
4766
4786
  exports.SearchPlugin = SearchPlugin;
4767
4787
  exports.Serializer = Serializer;
4768
4788
  exports.SimpleCache = SimpleCache;
4789
+ exports.TransactionPlugin = TransactionPlugin;
4769
4790
  exports.XataApiClient = XataApiClient;
4770
4791
  exports.XataApiPlugin = XataApiPlugin;
4771
4792
  exports.XataError = XataError;
@@ -4841,6 +4862,7 @@ exports.getMigrationRequest = getMigrationRequest;
4841
4862
  exports.getMigrationRequestIsMerged = getMigrationRequestIsMerged;
4842
4863
  exports.getPreviewBranch = getPreviewBranch;
4843
4864
  exports.getRecord = getRecord;
4865
+ exports.getSchema = getSchema;
4844
4866
  exports.getTableColumns = getTableColumns;
4845
4867
  exports.getTableSchema = getTableSchema;
4846
4868
  exports.getUser = getUser;