@xata.io/client 0.19.0 → 0.20.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/CHANGELOG.md +22 -0
- package/README.md +2 -2
- package/Usage.md +5 -5
- package/dist/index.cjs +102 -71
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +365 -167
- package/dist/index.mjs +97 -67
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- /package/{rollup.config.js → rollup.config.mjs} +0 -0
package/CHANGELOG.md
CHANGED
@@ -1,5 +1,27 @@
|
|
1
1
|
# @xata.io/client
|
2
2
|
|
3
|
+
## 0.20.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- [#737](https://github.com/xataio/client-ts/pull/737) [`6cbeaa0`](https://github.com/xataio/client-ts/commit/6cbeaa00050b5aa99ab7c98052a906487263e026) Thanks [@SferaDev](https://github.com/SferaDev)! - Rename first to start and last to end in pagination
|
8
|
+
|
9
|
+
### Patch Changes
|
10
|
+
|
11
|
+
- [#732](https://github.com/xataio/client-ts/pull/732) [`a5a9aa5`](https://github.com/xataio/client-ts/commit/a5a9aa59987faa1d3d701d7431b8a96031e01ac7) Thanks [@SferaDev](https://github.com/SferaDev)! - [Experimental] Allow passing fetch options in some queries
|
12
|
+
|
13
|
+
- [#735](https://github.com/xataio/client-ts/pull/735) [`c64b2eb`](https://github.com/xataio/client-ts/commit/c64b2eb9add70e75d419d418ab9608caac0dbfa1) Thanks [@SferaDev](https://github.com/SferaDev)! - Add support for default values
|
14
|
+
|
15
|
+
- [#730](https://github.com/xataio/client-ts/pull/730) [`485b217`](https://github.com/xataio/client-ts/commit/485b217079c4b2091d697e68622c48eddd130ceb) Thanks [@SferaDev](https://github.com/SferaDev)! - Add more summarize functions
|
16
|
+
|
17
|
+
- [#730](https://github.com/xataio/client-ts/pull/730) [`4d7499c`](https://github.com/xataio/client-ts/commit/4d7499ccbb135691350334fd8022f7a5da41c5f2) Thanks [@SferaDev](https://github.com/SferaDev)! - Add a check for browser execution
|
18
|
+
|
19
|
+
## 0.19.1
|
20
|
+
|
21
|
+
### Patch Changes
|
22
|
+
|
23
|
+
- [#723](https://github.com/xataio/client-ts/pull/723) [`ad5feeb`](https://github.com/xataio/client-ts/commit/ad5feebad5983f724ea4067b884bfae428447470) Thanks [@SferaDev](https://github.com/SferaDev)! - Fix replace operation not hidden
|
24
|
+
|
3
25
|
## 0.19.0
|
4
26
|
|
5
27
|
### Minor Changes
|
package/README.md
CHANGED
@@ -187,8 +187,8 @@ page.hasNextPage(); // Boolean
|
|
187
187
|
|
188
188
|
const nextPage = await page.nextPage(); // Page object
|
189
189
|
const previousPage = await page.previousPage(); // Page object
|
190
|
-
const
|
191
|
-
const
|
190
|
+
const startPage = await page.startPage(); // Page object
|
191
|
+
const endPage = await page.endPage(); // Page object
|
192
192
|
```
|
193
193
|
|
194
194
|
If you want to use an iterator, both the Repository and the Query classes implement an `AsyncIterable`. Alternatively you can use `getIterator()` and customize the batch size of the iterator:
|
package/Usage.md
CHANGED
@@ -329,8 +329,8 @@ It contains:
|
|
329
329
|
- `hasNextPage`: Function that returns a boolean indicating if there is a next page.
|
330
330
|
- `nextPage`: Async function that can be used to get the next page.
|
331
331
|
- `previousPage`: Async function that can be used to get the previous page.
|
332
|
-
- `
|
333
|
-
- `
|
332
|
+
- `startPage`: Async function that can be used to get the start page.
|
333
|
+
- `endPage`: Async function that can be used to get the end page.
|
334
334
|
- `meta`: Information about the current page and its cursor.
|
335
335
|
|
336
336
|
```ts
|
@@ -344,14 +344,14 @@ page2.records; // Array of `XataRecord` objects.
|
|
344
344
|
const page1 = await page2.previousPage();
|
345
345
|
page1.records; // Array of `XataRecord` objects.
|
346
346
|
|
347
|
-
const
|
348
|
-
|
347
|
+
const startPage = await page1.startPage();
|
348
|
+
startPage.records; // Array of `XataRecord` objects.
|
349
349
|
```
|
350
350
|
|
351
351
|
The `Repository` class implements the `Query` interface, so you can use it to paginate the records in the table too.
|
352
352
|
|
353
353
|
```ts
|
354
|
-
const page = await xata.db.users.
|
354
|
+
const page = await xata.db.users.startPage();
|
355
355
|
page.records; // Array of `XataRecord` objects.
|
356
356
|
```
|
357
357
|
|
package/dist/index.cjs
CHANGED
@@ -116,6 +116,25 @@ function getEnvironment() {
|
|
116
116
|
fallbackBranch: getGlobalFallbackBranch()
|
117
117
|
};
|
118
118
|
}
|
119
|
+
function getEnableBrowserVariable() {
|
120
|
+
try {
|
121
|
+
if (isObject(process) && isObject(process.env) && process.env.XATA_ENABLE_BROWSER !== void 0) {
|
122
|
+
return process.env.XATA_ENABLE_BROWSER === "true";
|
123
|
+
}
|
124
|
+
} catch (err) {
|
125
|
+
}
|
126
|
+
try {
|
127
|
+
if (isObject(Deno) && isObject(Deno.env) && Deno.env.get("XATA_ENABLE_BROWSER") !== void 0) {
|
128
|
+
return Deno.env.get("XATA_ENABLE_BROWSER") === "true";
|
129
|
+
}
|
130
|
+
} catch (err) {
|
131
|
+
}
|
132
|
+
try {
|
133
|
+
return XATA_ENABLE_BROWSER === true || XATA_ENABLE_BROWSER === "true";
|
134
|
+
} catch (err) {
|
135
|
+
return void 0;
|
136
|
+
}
|
137
|
+
}
|
119
138
|
function getGlobalApiKey() {
|
120
139
|
try {
|
121
140
|
return XATA_API_KEY;
|
@@ -186,7 +205,7 @@ function getFetchImplementation(userFetch) {
|
|
186
205
|
return fetchImpl;
|
187
206
|
}
|
188
207
|
|
189
|
-
const VERSION = "0.
|
208
|
+
const VERSION = "0.20.0";
|
190
209
|
|
191
210
|
class ErrorWithCause extends Error {
|
192
211
|
constructor(message, options) {
|
@@ -276,7 +295,8 @@ async function fetch$1({
|
|
276
295
|
trace,
|
277
296
|
signal,
|
278
297
|
clientID,
|
279
|
-
sessionID
|
298
|
+
sessionID,
|
299
|
+
fetchOptions = {}
|
280
300
|
}) {
|
281
301
|
return trace(
|
282
302
|
`${method.toUpperCase()} ${path}`,
|
@@ -289,6 +309,7 @@ async function fetch$1({
|
|
289
309
|
[TraceAttributes.HTTP_TARGET]: resolveUrl(path, queryParams, pathParams)
|
290
310
|
});
|
291
311
|
const response = await fetchImpl(url, {
|
312
|
+
...fetchOptions,
|
292
313
|
method: method.toUpperCase(),
|
293
314
|
body: body ? JSON.stringify(body) : void 0,
|
294
315
|
headers: {
|
@@ -338,32 +359,17 @@ function parseUrl(url) {
|
|
338
359
|
|
339
360
|
const dataPlaneFetch = async (options) => fetch$1({ ...options, endpoint: "dataPlane" });
|
340
361
|
|
341
|
-
const
|
342
|
-
url: "/dbs",
|
343
|
-
method: "get",
|
344
|
-
...variables,
|
345
|
-
signal
|
346
|
-
});
|
362
|
+
const dEPRECATEDgetDatabaseList = (variables, signal) => dataPlaneFetch({ url: "/dbs", method: "get", ...variables, signal });
|
347
363
|
const getBranchList = (variables, signal) => dataPlaneFetch({
|
348
364
|
url: "/dbs/{dbName}",
|
349
365
|
method: "get",
|
350
366
|
...variables,
|
351
367
|
signal
|
352
368
|
});
|
353
|
-
const
|
354
|
-
const
|
355
|
-
|
356
|
-
|
357
|
-
...variables,
|
358
|
-
signal
|
359
|
-
});
|
360
|
-
const getDatabaseMetadata = (variables, signal) => dataPlaneFetch({
|
361
|
-
url: "/dbs/{dbName}/metadata",
|
362
|
-
method: "get",
|
363
|
-
...variables,
|
364
|
-
signal
|
365
|
-
});
|
366
|
-
const updateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
369
|
+
const dEPRECATEDcreateDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "put", ...variables, signal });
|
370
|
+
const dEPRECATEDdeleteDatabase = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}", method: "delete", ...variables, signal });
|
371
|
+
const dEPRECATEDgetDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "get", ...variables, signal });
|
372
|
+
const dEPRECATEDupdateDatabaseMetadata = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/metadata", method: "patch", ...variables, signal });
|
367
373
|
const getBranchDetails = (variables, signal) => dataPlaneFetch({
|
368
374
|
url: "/db/{dbBranchName}",
|
369
375
|
method: "get",
|
@@ -402,6 +408,7 @@ const resolveBranch = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName
|
|
402
408
|
const getBranchMigrationHistory = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations", method: "get", ...variables, signal });
|
403
409
|
const getBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/plan", method: "post", ...variables, signal });
|
404
410
|
const executeBranchMigrationPlan = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/migrations/execute", method: "post", ...variables, signal });
|
411
|
+
const branchTransaction = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/transaction", method: "post", ...variables, signal });
|
405
412
|
const queryMigrationRequests = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations/query", method: "post", ...variables, signal });
|
406
413
|
const createMigrationRequest = (variables, signal) => dataPlaneFetch({ url: "/dbs/{dbName}/migrations", method: "post", ...variables, signal });
|
407
414
|
const getMigrationRequest = (variables, signal) => dataPlaneFetch({
|
@@ -501,7 +508,13 @@ const searchTable = (variables, signal) => dataPlaneFetch({
|
|
501
508
|
const summarizeTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/summarize", method: "post", ...variables, signal });
|
502
509
|
const aggregateTable = (variables, signal) => dataPlaneFetch({ url: "/db/{dbBranchName}/tables/{tableName}/aggregate", method: "post", ...variables, signal });
|
503
510
|
const operationsByTag$2 = {
|
504
|
-
database: {
|
511
|
+
database: {
|
512
|
+
dEPRECATEDgetDatabaseList,
|
513
|
+
dEPRECATEDcreateDatabase,
|
514
|
+
dEPRECATEDdeleteDatabase,
|
515
|
+
dEPRECATEDgetDatabaseMetadata,
|
516
|
+
dEPRECATEDupdateDatabaseMetadata
|
517
|
+
},
|
505
518
|
branch: {
|
506
519
|
getBranchList,
|
507
520
|
getBranchDetails,
|
@@ -526,6 +539,16 @@ const operationsByTag$2 = {
|
|
526
539
|
previewBranchSchemaEdit,
|
527
540
|
applyBranchSchemaEdit
|
528
541
|
},
|
542
|
+
records: {
|
543
|
+
branchTransaction,
|
544
|
+
insertRecord,
|
545
|
+
getRecord,
|
546
|
+
insertRecordWithID,
|
547
|
+
updateRecordWithID,
|
548
|
+
upsertRecordWithID,
|
549
|
+
deleteRecord,
|
550
|
+
bulkInsertTableRecords
|
551
|
+
},
|
529
552
|
migrationRequests: {
|
530
553
|
queryMigrationRequests,
|
531
554
|
createMigrationRequest,
|
@@ -548,15 +571,6 @@ const operationsByTag$2 = {
|
|
548
571
|
updateColumn,
|
549
572
|
deleteColumn
|
550
573
|
},
|
551
|
-
records: {
|
552
|
-
insertRecord,
|
553
|
-
getRecord,
|
554
|
-
insertRecordWithID,
|
555
|
-
updateRecordWithID,
|
556
|
-
upsertRecordWithID,
|
557
|
-
deleteRecord,
|
558
|
-
bulkInsertTableRecords
|
559
|
-
},
|
560
574
|
searchAndFilter: { queryTable, searchBranch, searchTable, summarizeTable, aggregateTable }
|
561
575
|
};
|
562
576
|
|
@@ -641,16 +655,21 @@ const updateWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ u
|
|
641
655
|
const cancelWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}", method: "delete", ...variables, signal });
|
642
656
|
const acceptWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteKey}/accept", method: "post", ...variables, signal });
|
643
657
|
const resendWorkspaceMemberInvite = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/invites/{inviteId}/resend", method: "post", ...variables, signal });
|
644
|
-
const
|
645
|
-
|
646
|
-
|
658
|
+
const getDatabaseList = (variables, signal) => controlPlaneFetch({
|
659
|
+
url: "/workspaces/{workspaceId}/dbs",
|
660
|
+
method: "get",
|
661
|
+
...variables,
|
662
|
+
signal
|
663
|
+
});
|
664
|
+
const createDatabase = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "put", ...variables, signal });
|
665
|
+
const deleteDatabase = (variables, signal) => controlPlaneFetch({
|
647
666
|
url: "/workspaces/{workspaceId}/dbs/{dbName}",
|
648
667
|
method: "delete",
|
649
668
|
...variables,
|
650
669
|
signal
|
651
670
|
});
|
652
|
-
const
|
653
|
-
const
|
671
|
+
const getDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "get", ...variables, signal });
|
672
|
+
const updateDatabaseMetadata = (variables, signal) => controlPlaneFetch({ url: "/workspaces/{workspaceId}/dbs/{dbName}", method: "patch", ...variables, signal });
|
654
673
|
const listRegions = (variables, signal) => controlPlaneFetch({
|
655
674
|
url: "/workspaces/{workspaceId}/regions",
|
656
675
|
method: "get",
|
@@ -678,11 +697,11 @@ const operationsByTag$1 = {
|
|
678
697
|
resendWorkspaceMemberInvite
|
679
698
|
},
|
680
699
|
databases: {
|
681
|
-
|
682
|
-
|
683
|
-
|
684
|
-
|
685
|
-
|
700
|
+
getDatabaseList,
|
701
|
+
createDatabase,
|
702
|
+
deleteDatabase,
|
703
|
+
getDatabaseMetadata,
|
704
|
+
updateDatabaseMetadata,
|
686
705
|
listRegions
|
687
706
|
}
|
688
707
|
};
|
@@ -1383,11 +1402,12 @@ class SearchAndFilterApi {
|
|
1383
1402
|
filter,
|
1384
1403
|
sort,
|
1385
1404
|
page,
|
1386
|
-
columns
|
1405
|
+
columns,
|
1406
|
+
consistency
|
1387
1407
|
}) {
|
1388
1408
|
return operationsByTag.searchAndFilter.queryTable({
|
1389
1409
|
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1390
|
-
body: { filter, sort, page, columns },
|
1410
|
+
body: { filter, sort, page, columns, consistency },
|
1391
1411
|
...this.extraProps
|
1392
1412
|
});
|
1393
1413
|
}
|
@@ -1439,11 +1459,12 @@ class SearchAndFilterApi {
|
|
1439
1459
|
summaries,
|
1440
1460
|
sort,
|
1441
1461
|
summariesFilter,
|
1442
|
-
page
|
1462
|
+
page,
|
1463
|
+
consistency
|
1443
1464
|
}) {
|
1444
1465
|
return operationsByTag.searchAndFilter.summarizeTable({
|
1445
1466
|
pathParams: { workspace, region, dbBranchName: `${database}:${branch}`, tableName: table },
|
1446
|
-
body: { filter, columns, summaries, sort, summariesFilter, page },
|
1467
|
+
body: { filter, columns, summaries, sort, summariesFilter, page, consistency },
|
1447
1468
|
...this.extraProps
|
1448
1469
|
});
|
1449
1470
|
}
|
@@ -1694,7 +1715,7 @@ class DatabaseApi {
|
|
1694
1715
|
this.extraProps = extraProps;
|
1695
1716
|
}
|
1696
1717
|
getDatabaseList({ workspace }) {
|
1697
|
-
return operationsByTag.databases.
|
1718
|
+
return operationsByTag.databases.getDatabaseList({
|
1698
1719
|
pathParams: { workspaceId: workspace },
|
1699
1720
|
...this.extraProps
|
1700
1721
|
});
|
@@ -1704,7 +1725,7 @@ class DatabaseApi {
|
|
1704
1725
|
database,
|
1705
1726
|
data
|
1706
1727
|
}) {
|
1707
|
-
return operationsByTag.databases.
|
1728
|
+
return operationsByTag.databases.createDatabase({
|
1708
1729
|
pathParams: { workspaceId: workspace, dbName: database },
|
1709
1730
|
body: data,
|
1710
1731
|
...this.extraProps
|
@@ -1714,7 +1735,7 @@ class DatabaseApi {
|
|
1714
1735
|
workspace,
|
1715
1736
|
database
|
1716
1737
|
}) {
|
1717
|
-
return operationsByTag.databases.
|
1738
|
+
return operationsByTag.databases.deleteDatabase({
|
1718
1739
|
pathParams: { workspaceId: workspace, dbName: database },
|
1719
1740
|
...this.extraProps
|
1720
1741
|
});
|
@@ -1723,7 +1744,7 @@ class DatabaseApi {
|
|
1723
1744
|
workspace,
|
1724
1745
|
database
|
1725
1746
|
}) {
|
1726
|
-
return operationsByTag.databases.
|
1747
|
+
return operationsByTag.databases.getDatabaseMetadata({
|
1727
1748
|
pathParams: { workspaceId: workspace, dbName: database },
|
1728
1749
|
...this.extraProps
|
1729
1750
|
});
|
@@ -1733,7 +1754,7 @@ class DatabaseApi {
|
|
1733
1754
|
database,
|
1734
1755
|
metadata
|
1735
1756
|
}) {
|
1736
|
-
return operationsByTag.databases.
|
1757
|
+
return operationsByTag.databases.updateDatabaseMetadata({
|
1737
1758
|
pathParams: { workspaceId: workspace, dbName: database },
|
1738
1759
|
body: metadata,
|
1739
1760
|
...this.extraProps
|
@@ -1803,11 +1824,11 @@ class Page {
|
|
1803
1824
|
async previousPage(size, offset) {
|
1804
1825
|
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, before: this.meta.page.cursor } });
|
1805
1826
|
}
|
1806
|
-
async
|
1807
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1827
|
+
async startPage(size, offset) {
|
1828
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, start: this.meta.page.cursor } });
|
1808
1829
|
}
|
1809
|
-
async
|
1810
|
-
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset,
|
1830
|
+
async endPage(size, offset) {
|
1831
|
+
return __privateGet$6(this, _query).getPaginated({ pagination: { size, offset, end: this.meta.page.cursor } });
|
1811
1832
|
}
|
1812
1833
|
hasNextPage() {
|
1813
1834
|
return this.meta.page.more;
|
@@ -1819,7 +1840,7 @@ const PAGINATION_DEFAULT_SIZE = 20;
|
|
1819
1840
|
const PAGINATION_MAX_OFFSET = 800;
|
1820
1841
|
const PAGINATION_DEFAULT_OFFSET = 0;
|
1821
1842
|
function isCursorPaginationOptions(options) {
|
1822
|
-
return isDefined(options) && (isDefined(options.
|
1843
|
+
return isDefined(options) && (isDefined(options.start) || isDefined(options.end) || isDefined(options.after) || isDefined(options.before));
|
1823
1844
|
}
|
1824
1845
|
const _RecordArray = class extends Array {
|
1825
1846
|
constructor(...args) {
|
@@ -1851,12 +1872,12 @@ const _RecordArray = class extends Array {
|
|
1851
1872
|
const newPage = await __privateGet$6(this, _page).previousPage(size, offset);
|
1852
1873
|
return new _RecordArray(newPage);
|
1853
1874
|
}
|
1854
|
-
async
|
1855
|
-
const newPage = await __privateGet$6(this, _page).
|
1875
|
+
async startPage(size, offset) {
|
1876
|
+
const newPage = await __privateGet$6(this, _page).startPage(size, offset);
|
1856
1877
|
return new _RecordArray(newPage);
|
1857
1878
|
}
|
1858
|
-
async
|
1859
|
-
const newPage = await __privateGet$6(this, _page).
|
1879
|
+
async endPage(size, offset) {
|
1880
|
+
const newPage = await __privateGet$6(this, _page).endPage(size, offset);
|
1860
1881
|
return new _RecordArray(newPage);
|
1861
1882
|
}
|
1862
1883
|
hasNextPage() {
|
@@ -1913,6 +1934,7 @@ const _Query = class {
|
|
1913
1934
|
__privateGet$5(this, _data).columns = data.columns ?? parent?.columns;
|
1914
1935
|
__privateGet$5(this, _data).pagination = data.pagination ?? parent?.pagination;
|
1915
1936
|
__privateGet$5(this, _data).cache = data.cache ?? parent?.cache;
|
1937
|
+
__privateGet$5(this, _data).fetchOptions = data.fetchOptions ?? parent?.fetchOptions;
|
1916
1938
|
this.any = this.any.bind(this);
|
1917
1939
|
this.all = this.all.bind(this);
|
1918
1940
|
this.not = this.not.bind(this);
|
@@ -2040,15 +2062,15 @@ const _Query = class {
|
|
2040
2062
|
return new _Query(__privateGet$5(this, _repository), __privateGet$5(this, _table$1), { cache: ttl }, __privateGet$5(this, _data));
|
2041
2063
|
}
|
2042
2064
|
nextPage(size, offset) {
|
2043
|
-
return this.
|
2065
|
+
return this.startPage(size, offset);
|
2044
2066
|
}
|
2045
2067
|
previousPage(size, offset) {
|
2046
|
-
return this.
|
2068
|
+
return this.startPage(size, offset);
|
2047
2069
|
}
|
2048
|
-
|
2070
|
+
startPage(size, offset) {
|
2049
2071
|
return this.getPaginated({ pagination: { size, offset } });
|
2050
2072
|
}
|
2051
|
-
|
2073
|
+
endPage(size, offset) {
|
2052
2074
|
return this.getPaginated({ pagination: { size, offset, before: "end" } });
|
2053
2075
|
}
|
2054
2076
|
hasNextPage() {
|
@@ -2444,6 +2466,7 @@ class RestRepository extends Query {
|
|
2444
2466
|
page: data.pagination,
|
2445
2467
|
columns: data.columns ?? ["*"]
|
2446
2468
|
},
|
2469
|
+
fetchOptions: data.fetchOptions,
|
2447
2470
|
...fetchProps
|
2448
2471
|
});
|
2449
2472
|
const schemaTables = await __privateMethod$2(this, _getSchemaTables$1, getSchemaTables_fn$1).call(this);
|
@@ -2715,7 +2738,7 @@ const initObject = (db, schemaTables, table, object, selectedColumns) => {
|
|
2715
2738
|
result.getMetadata = function() {
|
2716
2739
|
return xata;
|
2717
2740
|
};
|
2718
|
-
for (const prop of ["read", "update", "delete", "getMetadata"]) {
|
2741
|
+
for (const prop of ["read", "update", "replace", "delete", "getMetadata"]) {
|
2719
2742
|
Object.defineProperty(result, prop, { enumerable: false });
|
2720
2743
|
}
|
2721
2744
|
Object.freeze(result);
|
@@ -3102,6 +3125,13 @@ const buildClient = (plugins) => {
|
|
3102
3125
|
return { databaseURL, branch };
|
3103
3126
|
}
|
3104
3127
|
}, _branch = new WeakMap(), _options = new WeakMap(), _parseOptions = new WeakSet(), parseOptions_fn = function(options) {
|
3128
|
+
const enableBrowser = options?.enableBrowser ?? getEnableBrowserVariable() ?? false;
|
3129
|
+
const isBrowser = typeof window !== "undefined";
|
3130
|
+
if (isBrowser && !enableBrowser) {
|
3131
|
+
throw new Error(
|
3132
|
+
"You are trying to use Xata from the browser, which is potentially a non-secure environment. If you understand the security concerns, such as leaking your credentials, pass `enableBrowser: true` to the client options to remove this error."
|
3133
|
+
);
|
3134
|
+
}
|
3105
3135
|
const fetch = getFetchImplementation(options?.fetch);
|
3106
3136
|
const databaseURL = options?.databaseURL || getDatabaseURL();
|
3107
3137
|
const apiKey = options?.apiKey || getAPIKey();
|
@@ -3114,7 +3144,7 @@ const buildClient = (plugins) => {
|
|
3114
3144
|
if (!databaseURL) {
|
3115
3145
|
throw new Error("Option databaseURL is required");
|
3116
3146
|
}
|
3117
|
-
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID() };
|
3147
|
+
return { fetch, databaseURL, apiKey, branch, cache, trace, clientID: generateUUID(), enableBrowser };
|
3118
3148
|
}, _getFetchProps = new WeakSet(), getFetchProps_fn = async function({ fetch, apiKey, databaseURL, branch, trace, clientID }) {
|
3119
3149
|
const branchValue = await __privateMethod(this, _evaluateBranch, evaluateBranch_fn).call(this, branch);
|
3120
3150
|
if (!branchValue)
|
@@ -3265,14 +3295,10 @@ exports.addGitBranchesEntry = addGitBranchesEntry;
|
|
3265
3295
|
exports.addTableColumn = addTableColumn;
|
3266
3296
|
exports.aggregateTable = aggregateTable;
|
3267
3297
|
exports.applyBranchSchemaEdit = applyBranchSchemaEdit;
|
3298
|
+
exports.branchTransaction = branchTransaction;
|
3268
3299
|
exports.buildClient = buildClient;
|
3269
3300
|
exports.buildWorkerRunner = buildWorkerRunner;
|
3270
3301
|
exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
3271
|
-
exports.cPCreateDatabase = cPCreateDatabase;
|
3272
|
-
exports.cPDeleteDatabase = cPDeleteDatabase;
|
3273
|
-
exports.cPGetCPDatabaseMetadata = cPGetCPDatabaseMetadata;
|
3274
|
-
exports.cPGetDatabaseList = cPGetDatabaseList;
|
3275
|
-
exports.cPUpdateCPDatabaseMetadata = cPUpdateCPDatabaseMetadata;
|
3276
3302
|
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
3277
3303
|
exports.compareBranchSchemas = compareBranchSchemas;
|
3278
3304
|
exports.compareBranchWithUserSchema = compareBranchWithUserSchema;
|
@@ -3284,6 +3310,11 @@ exports.createMigrationRequest = createMigrationRequest;
|
|
3284
3310
|
exports.createTable = createTable;
|
3285
3311
|
exports.createUserAPIKey = createUserAPIKey;
|
3286
3312
|
exports.createWorkspace = createWorkspace;
|
3313
|
+
exports.dEPRECATEDcreateDatabase = dEPRECATEDcreateDatabase;
|
3314
|
+
exports.dEPRECATEDdeleteDatabase = dEPRECATEDdeleteDatabase;
|
3315
|
+
exports.dEPRECATEDgetDatabaseList = dEPRECATEDgetDatabaseList;
|
3316
|
+
exports.dEPRECATEDgetDatabaseMetadata = dEPRECATEDgetDatabaseMetadata;
|
3317
|
+
exports.dEPRECATEDupdateDatabaseMetadata = dEPRECATEDupdateDatabaseMetadata;
|
3287
3318
|
exports.deleteBranch = deleteBranch;
|
3288
3319
|
exports.deleteColumn = deleteColumn;
|
3289
3320
|
exports.deleteDatabase = deleteDatabase;
|