@xata.io/client 0.5.0 → 0.5.1
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 +6 -0
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +4 -3
- package/dist/api/components.d.ts +27 -31
- package/dist/api/components.js +27 -31
- package/dist/schema/repository.js +4 -1
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
package/dist/api/client.d.ts
CHANGED
package/dist/api/client.js
CHANGED
@@ -17,14 +17,15 @@ const components_1 = require("./components");
|
|
17
17
|
const providers_1 = require("./providers");
|
18
18
|
class XataApiClient {
|
19
19
|
constructor(options) {
|
20
|
-
var _a;
|
20
|
+
var _a, _b;
|
21
21
|
_XataApiClient_extraProps.set(this, void 0);
|
22
|
-
const
|
22
|
+
const globalFetch = typeof fetch !== 'undefined' ? fetch : undefined;
|
23
|
+
const fetchImpl = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalFetch;
|
23
24
|
if (!fetchImpl) {
|
24
25
|
/** @todo add a link after docs exist */
|
25
26
|
throw new Error(`The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`);
|
26
27
|
}
|
27
|
-
const provider = (
|
28
|
+
const provider = (_b = options.host) !== null && _b !== void 0 ? _b : 'production';
|
28
29
|
__classPrivateFieldSet(this, _XataApiClient_extraProps, {
|
29
30
|
apiUrl: (0, providers_1.getHostUrl)(provider, 'main'),
|
30
31
|
workspacesApiUrl: (0, providers_1.getHostUrl)(provider, 'workspaces'),
|
package/dist/api/components.d.ts
CHANGED
@@ -875,7 +875,7 @@ export declare type QueryTableVariables = {
|
|
875
875
|
* `$none`, etc.
|
876
876
|
*
|
877
877
|
* All operators start with an `$` to differentiate them from column names
|
878
|
-
* (which are not allowed to start with an
|
878
|
+
* (which are not allowed to start with an dollar sign).
|
879
879
|
*
|
880
880
|
* #### Exact matching and control operators
|
881
881
|
*
|
@@ -943,27 +943,17 @@ export declare type QueryTableVariables = {
|
|
943
943
|
* }
|
944
944
|
* ```
|
945
945
|
*
|
946
|
-
* If you want to OR together multiple values, you can use an array of values:
|
946
|
+
* If you want to OR together multiple values, you can use the `$any` operator with an array of values:
|
947
947
|
*
|
948
948
|
* ```json
|
949
949
|
* {
|
950
950
|
* "filter": {
|
951
|
-
* "settings.plan": ["free", "paid"]
|
951
|
+
* "settings.plan": {"$any": ["free", "paid"]}
|
952
952
|
* },
|
953
953
|
* }
|
954
954
|
* ```
|
955
955
|
*
|
956
|
-
*
|
957
|
-
*
|
958
|
-
* ```json
|
959
|
-
* {
|
960
|
-
* "filter": {
|
961
|
-
* "settings.plan": { "$is": ["free", "paid"]}
|
962
|
-
* },
|
963
|
-
* }
|
964
|
-
* ```
|
965
|
-
*
|
966
|
-
* Specifying multiple columns, ANDs them together:
|
956
|
+
* If you specify multiple columns in the same filter, they are logically AND'ed together:
|
967
957
|
*
|
968
958
|
* ```json
|
969
959
|
* {
|
@@ -974,6 +964,8 @@ export declare type QueryTableVariables = {
|
|
974
964
|
* }
|
975
965
|
* ```
|
976
966
|
*
|
967
|
+
* The above matches if both conditions are met.
|
968
|
+
*
|
977
969
|
* To be more explicit about it, you can use `$all` or `$any`:
|
978
970
|
*
|
979
971
|
* ```json
|
@@ -981,13 +973,13 @@ export declare type QueryTableVariables = {
|
|
981
973
|
* "filter": {
|
982
974
|
* "$any": {
|
983
975
|
* "settings.dark": true,
|
984
|
-
* "settings.plan": "free"
|
976
|
+
* "settings.plan": "free"
|
985
977
|
* }
|
986
978
|
* },
|
987
979
|
* }
|
988
980
|
* ```
|
989
981
|
*
|
990
|
-
* `$all` and `$any` can also receive an array of objects, which allows for repeating
|
982
|
+
* The `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:
|
991
983
|
*
|
992
984
|
* ```json
|
993
985
|
* {
|
@@ -1030,7 +1022,7 @@ export declare type QueryTableVariables = {
|
|
1030
1022
|
* }
|
1031
1023
|
* ```
|
1032
1024
|
*
|
1033
|
-
*
|
1025
|
+
* Or you can use the inverse operator `$notExists`:
|
1034
1026
|
*
|
1035
1027
|
* ```json
|
1036
1028
|
* {
|
@@ -1083,7 +1075,7 @@ export declare type QueryTableVariables = {
|
|
1083
1075
|
* }
|
1084
1076
|
* ```
|
1085
1077
|
*
|
1086
|
-
* #### Numeric
|
1078
|
+
* #### Numeric ranges
|
1087
1079
|
*
|
1088
1080
|
* ```json
|
1089
1081
|
* {
|
@@ -1098,18 +1090,6 @@ export declare type QueryTableVariables = {
|
|
1098
1090
|
*
|
1099
1091
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
1100
1092
|
*
|
1101
|
-
* Date ranges would support the same operators, with the date as string in RFC 3339:
|
1102
|
-
*
|
1103
|
-
* ```json
|
1104
|
-
* {
|
1105
|
-
* "filter": {
|
1106
|
-
* "<column_name>": {
|
1107
|
-
* "$gt": "2019-10-12T07:20:50.52Z",
|
1108
|
-
* "$lt": "2021-10-12T07:20:50.52Z"
|
1109
|
-
* }
|
1110
|
-
* }
|
1111
|
-
* }
|
1112
|
-
* ```
|
1113
1093
|
*
|
1114
1094
|
* #### Negations
|
1115
1095
|
*
|
@@ -1162,7 +1142,7 @@ export declare type QueryTableVariables = {
|
|
1162
1142
|
* }
|
1163
1143
|
* ```
|
1164
1144
|
*
|
1165
|
-
* In addition,
|
1145
|
+
* In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
|
1166
1146
|
*
|
1167
1147
|
* ```json
|
1168
1148
|
* {
|
@@ -1213,6 +1193,22 @@ export declare type QueryTableVariables = {
|
|
1213
1193
|
* predicate. The `$includes` operator is a synonym for the `$includesAny`
|
1214
1194
|
* operator.
|
1215
1195
|
*
|
1196
|
+
* Here is an example of using the `$includesAll` operator:
|
1197
|
+
*
|
1198
|
+
* ```json
|
1199
|
+
* {
|
1200
|
+
* "filter": {
|
1201
|
+
* "settings.labels": {
|
1202
|
+
* "$includesAll": [
|
1203
|
+
* {"$contains": "label"},
|
1204
|
+
* ]
|
1205
|
+
* }
|
1206
|
+
* }
|
1207
|
+
* }
|
1208
|
+
* ```
|
1209
|
+
*
|
1210
|
+
* The above matches if all label values contain the string "labels".
|
1211
|
+
*
|
1216
1212
|
* ### Sorting
|
1217
1213
|
*
|
1218
1214
|
* Sorting by one element:
|
package/dist/api/components.js
CHANGED
@@ -458,7 +458,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
458
458
|
* `$none`, etc.
|
459
459
|
*
|
460
460
|
* All operators start with an `$` to differentiate them from column names
|
461
|
-
* (which are not allowed to start with an
|
461
|
+
* (which are not allowed to start with an dollar sign).
|
462
462
|
*
|
463
463
|
* #### Exact matching and control operators
|
464
464
|
*
|
@@ -526,27 +526,17 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
526
526
|
* }
|
527
527
|
* ```
|
528
528
|
*
|
529
|
-
* If you want to OR together multiple values, you can use an array of values:
|
529
|
+
* If you want to OR together multiple values, you can use the `$any` operator with an array of values:
|
530
530
|
*
|
531
531
|
* ```json
|
532
532
|
* {
|
533
533
|
* "filter": {
|
534
|
-
* "settings.plan": ["free", "paid"]
|
534
|
+
* "settings.plan": {"$any": ["free", "paid"]}
|
535
535
|
* },
|
536
536
|
* }
|
537
537
|
* ```
|
538
538
|
*
|
539
|
-
*
|
540
|
-
*
|
541
|
-
* ```json
|
542
|
-
* {
|
543
|
-
* "filter": {
|
544
|
-
* "settings.plan": { "$is": ["free", "paid"]}
|
545
|
-
* },
|
546
|
-
* }
|
547
|
-
* ```
|
548
|
-
*
|
549
|
-
* Specifying multiple columns, ANDs them together:
|
539
|
+
* If you specify multiple columns in the same filter, they are logically AND'ed together:
|
550
540
|
*
|
551
541
|
* ```json
|
552
542
|
* {
|
@@ -557,6 +547,8 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
557
547
|
* }
|
558
548
|
* ```
|
559
549
|
*
|
550
|
+
* The above matches if both conditions are met.
|
551
|
+
*
|
560
552
|
* To be more explicit about it, you can use `$all` or `$any`:
|
561
553
|
*
|
562
554
|
* ```json
|
@@ -564,13 +556,13 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
564
556
|
* "filter": {
|
565
557
|
* "$any": {
|
566
558
|
* "settings.dark": true,
|
567
|
-
* "settings.plan": "free"
|
559
|
+
* "settings.plan": "free"
|
568
560
|
* }
|
569
561
|
* },
|
570
562
|
* }
|
571
563
|
* ```
|
572
564
|
*
|
573
|
-
* `$all` and `$any` can also receive an array of objects, which allows for repeating
|
565
|
+
* The `$all` and `$any` operators can also receive an array of objects, which allows for repeating column names:
|
574
566
|
*
|
575
567
|
* ```json
|
576
568
|
* {
|
@@ -613,7 +605,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
613
605
|
* }
|
614
606
|
* ```
|
615
607
|
*
|
616
|
-
*
|
608
|
+
* Or you can use the inverse operator `$notExists`:
|
617
609
|
*
|
618
610
|
* ```json
|
619
611
|
* {
|
@@ -666,7 +658,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
666
658
|
* }
|
667
659
|
* ```
|
668
660
|
*
|
669
|
-
* #### Numeric
|
661
|
+
* #### Numeric ranges
|
670
662
|
*
|
671
663
|
* ```json
|
672
664
|
* {
|
@@ -681,18 +673,6 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
681
673
|
*
|
682
674
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
683
675
|
*
|
684
|
-
* Date ranges would support the same operators, with the date as string in RFC 3339:
|
685
|
-
*
|
686
|
-
* ```json
|
687
|
-
* {
|
688
|
-
* "filter": {
|
689
|
-
* "<column_name>": {
|
690
|
-
* "$gt": "2019-10-12T07:20:50.52Z",
|
691
|
-
* "$lt": "2021-10-12T07:20:50.52Z"
|
692
|
-
* }
|
693
|
-
* }
|
694
|
-
* }
|
695
|
-
* ```
|
696
676
|
*
|
697
677
|
* #### Negations
|
698
678
|
*
|
@@ -745,7 +725,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
745
725
|
* }
|
746
726
|
* ```
|
747
727
|
*
|
748
|
-
* In addition,
|
728
|
+
* In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
|
749
729
|
*
|
750
730
|
* ```json
|
751
731
|
* {
|
@@ -796,6 +776,22 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
796
776
|
* predicate. The `$includes` operator is a synonym for the `$includesAny`
|
797
777
|
* operator.
|
798
778
|
*
|
779
|
+
* Here is an example of using the `$includesAll` operator:
|
780
|
+
*
|
781
|
+
* ```json
|
782
|
+
* {
|
783
|
+
* "filter": {
|
784
|
+
* "settings.labels": {
|
785
|
+
* "$includesAll": [
|
786
|
+
* {"$contains": "label"},
|
787
|
+
* ]
|
788
|
+
* }
|
789
|
+
* }
|
790
|
+
* }
|
791
|
+
* ```
|
792
|
+
*
|
793
|
+
* The above matches if all label values contain the string "labels".
|
794
|
+
*
|
799
795
|
* ### Sorting
|
800
796
|
*
|
801
797
|
* Sorting by one element:
|
@@ -41,6 +41,7 @@ class Repository extends query_1.Query {
|
|
41
41
|
exports.Repository = Repository;
|
42
42
|
class RestRepository extends Repository {
|
43
43
|
constructor(client, table) {
|
44
|
+
var _a;
|
44
45
|
super(null, table, {});
|
45
46
|
_RestRepository_instances.add(this);
|
46
47
|
_RestRepository_client.set(this, void 0);
|
@@ -49,8 +50,10 @@ class RestRepository extends Repository {
|
|
49
50
|
__classPrivateFieldSet(this, _RestRepository_client, client, "f");
|
50
51
|
__classPrivateFieldSet(this, _RestRepository_table, table, "f");
|
51
52
|
// TODO: Remove when integrating with API client
|
52
|
-
const
|
53
|
+
const globalFetch = typeof fetch !== 'undefined' ? fetch : undefined;
|
54
|
+
const fetchImpl = (_a = __classPrivateFieldGet(this, _RestRepository_client, "f").options.fetch) !== null && _a !== void 0 ? _a : globalFetch;
|
53
55
|
if (!fetchImpl) {
|
56
|
+
/** @todo add a link after docs exist */
|
54
57
|
throw new Error(`The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`);
|
55
58
|
}
|
56
59
|
__classPrivateFieldSet(this, _RestRepository_fetch, fetchImpl, "f");
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@xata.io/client",
|
3
|
-
"version": "0.5.
|
3
|
+
"version": "0.5.1",
|
4
4
|
"description": "Xata.io SDK for TypeScript and JavaScript",
|
5
5
|
"main": "./dist/index.js",
|
6
6
|
"types": "./dist/index.d.ts",
|
@@ -20,5 +20,5 @@
|
|
20
20
|
"url": "https://github.com/xataio/client-ts/issues"
|
21
21
|
},
|
22
22
|
"homepage": "https://github.com/xataio/client-ts/blob/main/client/README.md",
|
23
|
-
"gitHead": "
|
23
|
+
"gitHead": "09892c40a01ece59c802844310aac17aba7a281c"
|
24
24
|
}
|