@xata.io/client 0.0.0-alpha.vfd68d20 → 0.0.0-alpha.vfda8f2e

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.d.ts CHANGED
@@ -36,12 +36,13 @@ declare type XataPluginOptions = {
36
36
  trace?: TraceFunction;
37
37
  };
38
38
 
39
- declare type FetchImpl = (url: string, init?: {
39
+ declare type RequestInit = {
40
40
  body?: string;
41
41
  headers?: Record<string, string>;
42
42
  method?: string;
43
43
  signal?: any;
44
- }) => Promise<{
44
+ };
45
+ declare type Response = {
45
46
  ok: boolean;
46
47
  status: number;
47
48
  url: string;
@@ -49,7 +50,9 @@ declare type FetchImpl = (url: string, init?: {
49
50
  headers?: {
50
51
  get(name: string): string | null;
51
52
  };
52
- }>;
53
+ };
54
+ declare type FetchImpl = (url: string, init?: RequestInit) => Promise<Response>;
55
+
53
56
  declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Partial<Record<string, string | number>>) => string;
54
57
  declare type FetcherExtraProps = {
55
58
  endpoint: 'controlPlane' | 'dataPlane';
@@ -1686,18 +1689,16 @@ declare type AggResponse$1 = (number | null) | {
1686
1689
  * A transaction operation
1687
1690
  */
1688
1691
  declare type TransactionOperation = {
1689
- insert: TransactionInsert;
1692
+ insert: TransactionInsertOp;
1690
1693
  } | {
1691
- update: TransactionUpdate;
1694
+ update: TransactionUpdateOp;
1692
1695
  } | {
1693
- ['delete']: TransactionDelete;
1696
+ ['delete']: TransactionDeleteOp;
1694
1697
  };
1695
1698
  /**
1696
1699
  * Insert operation
1697
- *
1698
- * @x-go-type TxOperation
1699
1700
  */
1700
- declare type TransactionInsert = {
1701
+ declare type TransactionInsertOp = {
1701
1702
  /**
1702
1703
  * The table name
1703
1704
  */
@@ -1726,10 +1727,8 @@ declare type TransactionInsert = {
1726
1727
  };
1727
1728
  /**
1728
1729
  * Update operation
1729
- *
1730
- * @x-go-type TxOperation
1731
1730
  */
1732
- declare type TransactionUpdate = {
1731
+ declare type TransactionUpdateOp = {
1733
1732
  /**
1734
1733
  * The table name
1735
1734
  */
@@ -1752,10 +1751,8 @@ declare type TransactionUpdate = {
1752
1751
  };
1753
1752
  /**
1754
1753
  * A delete operation. The transaction will continue if no record matches the ID.
1755
- *
1756
- * @x-go-type TxOperation
1757
1754
  */
1758
- declare type TransactionDelete = {
1755
+ declare type TransactionDeleteOp = {
1759
1756
  /**
1760
1757
  * The table name
1761
1758
  */
@@ -1766,6 +1763,10 @@ declare type TransactionDelete = {
1766
1763
  * A result from an insert operation.
1767
1764
  */
1768
1765
  declare type TransactionResultInsert = {
1766
+ /**
1767
+ * The type of operation who's result is being returned.
1768
+ */
1769
+ operation: 'insert';
1769
1770
  /**
1770
1771
  * The number of affected rows
1771
1772
  */
@@ -1777,7 +1778,11 @@ declare type TransactionResultInsert = {
1777
1778
  */
1778
1779
  declare type TransactionResultUpdate = {
1779
1780
  /**
1780
- * The number of affected rows
1781
+ * The type of operation who's result is being returned.
1782
+ */
1783
+ operation: 'update';
1784
+ /**
1785
+ * The number of updated rows
1781
1786
  */
1782
1787
  rows: number;
1783
1788
  id: RecordID;
@@ -1787,12 +1792,18 @@ declare type TransactionResultUpdate = {
1787
1792
  */
1788
1793
  declare type TransactionResultDelete = {
1789
1794
  /**
1790
- * The number of affected rows
1795
+ * The type of operation who's result is being returned.
1796
+ */
1797
+ operation: 'delete';
1798
+ /**
1799
+ * The number of deleted rows
1791
1800
  */
1792
1801
  rows: number;
1793
1802
  };
1794
1803
  /**
1795
1804
  * An error message from a failing transaction operation
1805
+ *
1806
+ * @x-go-type xata.ErrTxOp
1796
1807
  */
1797
1808
  declare type TransactionError = {
1798
1809
  /**
@@ -1881,18 +1892,18 @@ declare type SearchResponse = {
1881
1892
  warning?: string;
1882
1893
  };
1883
1894
  /**
1884
- * @x-go-type TxResponse
1895
+ * @x-go-type TxSuccess
1885
1896
  */
1886
- declare type TransactionSucceeded = {
1897
+ declare type TransactionSuccess = {
1887
1898
  /**
1888
1899
  * An ordered array of results from the submitted operations that were executed
1889
1900
  */
1890
1901
  results: (TransactionResultInsert | TransactionResultUpdate | TransactionResultDelete)[];
1891
1902
  };
1892
1903
  /**
1893
- * @x-go-type TxResponse
1904
+ * @x-go-type TxFailure
1894
1905
  */
1895
- declare type TransactionFailed = {
1906
+ declare type TransactionFailure = {
1896
1907
  /**
1897
1908
  * An array of errors from the submitted operations.
1898
1909
  */
@@ -2569,7 +2580,7 @@ declare type BranchTransactionPathParams = {
2569
2580
  };
2570
2581
  declare type BranchTransactionError = ErrorWrapper<{
2571
2582
  status: 400;
2572
- payload: TransactionFailed;
2583
+ payload: TransactionFailure;
2573
2584
  } | {
2574
2585
  status: 401;
2575
2586
  payload: AuthError;
@@ -2584,7 +2595,7 @@ declare type BranchTransactionVariables = {
2584
2595
  body: BranchTransactionRequestBody;
2585
2596
  pathParams: BranchTransactionPathParams;
2586
2597
  } & DataPlaneFetcherExtraProps;
2587
- declare const branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal) => Promise<TransactionSucceeded>;
2598
+ declare const branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal) => Promise<TransactionSuccess>;
2588
2599
  declare type QueryMigrationRequestsPathParams = {
2589
2600
  /**
2590
2601
  * The Database Name
@@ -4268,20 +4279,25 @@ declare type QueryTableVariables = {
4268
4279
  *
4269
4280
  * #### Working with arrays
4270
4281
  *
4271
- * To test that an array contains a value, use `$includes`.
4282
+ * To test that an array contains a value, use `$includesAny`.
4272
4283
  *
4273
4284
  * ```json
4274
4285
  * {
4275
4286
  * "filter": {
4276
4287
  * "<array_name>": {
4277
- * "$includes": "value"
4288
+ * "$includesAny": "value"
4278
4289
  * }
4279
4290
  * }
4280
4291
  * }
4281
4292
  * ```
4282
4293
  *
4283
- * The `$includes` operator accepts a custom predicate that will check if any
4284
- * array values matches the predicate. For example a complex predicate can include
4294
+ * ##### `includesAny`
4295
+ *
4296
+ * The `$includesAny` operator accepts a custom predicate that will check if
4297
+ * any value in the array column matches the predicate. The `$includes` operator is a
4298
+ * synonym for the `$includesAny` operator.
4299
+ *
4300
+ * For example a complex predicate can include
4285
4301
  * the `$all` , `$contains` and `$endsWith` operators:
4286
4302
  *
4287
4303
  * ```json
@@ -4299,11 +4315,26 @@ declare type QueryTableVariables = {
4299
4315
  * }
4300
4316
  * ```
4301
4317
  *
4302
- * The `$includes` all operator succeeds if any column in the array matches the
4303
- * predicate. The `$includesAll` operator succeeds if all array items match the
4304
- * predicate. The `$includesNone` operator succeeds if no array item matches the
4305
- * predicate. The `$includes` operator is a synonym for the `$includesAny`
4306
- * operator.
4318
+ * ##### `includesNone`
4319
+ *
4320
+ * The `$includesNone` operator succeeds if no array item matches the
4321
+ * predicate.
4322
+ *
4323
+ * ```json
4324
+ * {
4325
+ * "filter": {
4326
+ * "settings.labels": {
4327
+ * "$includesNone": [{ "$contains": "label" }]
4328
+ * }
4329
+ * }
4330
+ * }
4331
+ * ```
4332
+ * The above matches if none of the array values contain the string "label".
4333
+ *
4334
+ * ##### `includesAll`
4335
+ *
4336
+ * The `$includesAll` operator succeeds if all array items match the
4337
+ * predicate.
4307
4338
  *
4308
4339
  * Here is an example of using the `$includesAll` operator:
4309
4340
  *
@@ -4317,7 +4348,7 @@ declare type QueryTableVariables = {
4317
4348
  * }
4318
4349
  * ```
4319
4350
  *
4320
- * The above matches if all label values contain the string "labels".
4351
+ * The above matches if all array values contain the string "label".
4321
4352
  *
4322
4353
  * ### Sorting
4323
4354
  *
@@ -4733,7 +4764,7 @@ declare const operationsByTag: {
4733
4764
  resolveBranch: (variables: ResolveBranchVariables, signal?: AbortSignal | undefined) => Promise<ResolveBranchResponse>;
4734
4765
  };
4735
4766
  records: {
4736
- branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal | undefined) => Promise<TransactionSucceeded>;
4767
+ branchTransaction: (variables: BranchTransactionVariables, signal?: AbortSignal | undefined) => Promise<TransactionSuccess>;
4737
4768
  insertRecord: (variables: InsertRecordVariables, signal?: AbortSignal | undefined) => Promise<RecordUpdateResponse>;
4738
4769
  getRecord: (variables: GetRecordVariables, signal?: AbortSignal | undefined) => Promise<XataRecord$1>;
4739
4770
  insertRecordWithID: (variables: InsertRecordWithIDVariables, signal?: AbortSignal | undefined) => Promise<RecordUpdateResponse>;
@@ -4855,8 +4886,8 @@ type responses_SchemaUpdateResponse = SchemaUpdateResponse;
4855
4886
  type responses_SummarizeResponse = SummarizeResponse;
4856
4887
  type responses_AggResponse = AggResponse;
4857
4888
  type responses_SearchResponse = SearchResponse;
4858
- type responses_TransactionSucceeded = TransactionSucceeded;
4859
- type responses_TransactionFailed = TransactionFailed;
4889
+ type responses_TransactionSuccess = TransactionSuccess;
4890
+ type responses_TransactionFailure = TransactionFailure;
4860
4891
  declare namespace responses {
4861
4892
  export {
4862
4893
  responses_AuthError as AuthError,
@@ -4873,8 +4904,8 @@ declare namespace responses {
4873
4904
  responses_SummarizeResponse as SummarizeResponse,
4874
4905
  responses_AggResponse as AggResponse,
4875
4906
  responses_SearchResponse as SearchResponse,
4876
- responses_TransactionSucceeded as TransactionSucceeded,
4877
- responses_TransactionFailed as TransactionFailed,
4907
+ responses_TransactionSuccess as TransactionSuccess,
4908
+ responses_TransactionFailure as TransactionFailure,
4878
4909
  };
4879
4910
  }
4880
4911
 
@@ -4953,9 +4984,9 @@ type schemas_RecordID = RecordID;
4953
4984
  type schemas_TableRename = TableRename;
4954
4985
  type schemas_RecordsMetadata = RecordsMetadata;
4955
4986
  type schemas_TransactionOperation = TransactionOperation;
4956
- type schemas_TransactionInsert = TransactionInsert;
4957
- type schemas_TransactionUpdate = TransactionUpdate;
4958
- type schemas_TransactionDelete = TransactionDelete;
4987
+ type schemas_TransactionInsertOp = TransactionInsertOp;
4988
+ type schemas_TransactionUpdateOp = TransactionUpdateOp;
4989
+ type schemas_TransactionDeleteOp = TransactionDeleteOp;
4959
4990
  type schemas_TransactionResultInsert = TransactionResultInsert;
4960
4991
  type schemas_TransactionResultUpdate = TransactionResultUpdate;
4961
4992
  type schemas_TransactionResultDelete = TransactionResultDelete;
@@ -5058,9 +5089,9 @@ declare namespace schemas {
5058
5089
  schemas_RecordsMetadata as RecordsMetadata,
5059
5090
  AggResponse$1 as AggResponse,
5060
5091
  schemas_TransactionOperation as TransactionOperation,
5061
- schemas_TransactionInsert as TransactionInsert,
5062
- schemas_TransactionUpdate as TransactionUpdate,
5063
- schemas_TransactionDelete as TransactionDelete,
5092
+ schemas_TransactionInsertOp as TransactionInsertOp,
5093
+ schemas_TransactionUpdateOp as TransactionUpdateOp,
5094
+ schemas_TransactionDeleteOp as TransactionDeleteOp,
5064
5095
  schemas_TransactionResultInsert as TransactionResultInsert,
5065
5096
  schemas_TransactionResultUpdate as TransactionResultUpdate,
5066
5097
  schemas_TransactionResultDelete as TransactionResultDelete,
@@ -5411,6 +5442,13 @@ declare class RecordsApi {
5411
5442
  records: Record<string, any>[];
5412
5443
  columns?: ColumnsProjection;
5413
5444
  }): Promise<BulkInsertResponse>;
5445
+ branchTransaction({ workspace, region, database, branch, operations }: {
5446
+ workspace: WorkspaceID;
5447
+ region: string;
5448
+ database: DBName;
5449
+ branch: BranchName;
5450
+ operations: TransactionOperation[];
5451
+ }): Promise<TransactionSuccess>;
5414
5452
  }
5415
5453
  declare class SearchAndFilterApi {
5416
5454
  private extraProps;