@xata.io/client 0.0.0-beta.518ec9b → 0.0.0-beta.5f52401
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/.eslintrc.cjs +13 -0
- package/CHANGELOG.md +36 -0
- package/dist/api/client.d.ts +3 -1
- package/dist/api/client.js +11 -4
- package/dist/api/components.d.ts +51 -31
- package/dist/api/components.js +41 -32
- package/dist/api/fetcher.js +4 -1
- package/dist/api/parameters.d.ts +1 -0
- package/dist/api/providers.js +3 -2
- package/dist/api/schemas.d.ts +1 -1
- package/dist/schema/filters.js +2 -1
- package/dist/schema/index.d.ts +4 -3
- package/dist/schema/index.js +5 -4
- package/dist/schema/operators.d.ts +51 -0
- package/dist/schema/operators.js +51 -0
- package/dist/schema/pagination.d.ts +44 -2
- package/dist/schema/pagination.js +37 -1
- package/dist/schema/query.d.ts +92 -14
- package/dist/schema/query.js +74 -0
- package/dist/schema/record.d.ts +35 -1
- package/dist/schema/repository.d.ts +71 -23
- package/dist/schema/repository.js +72 -30
- package/dist/schema/selection.d.ts +3 -5
- package/dist/util/lang.d.ts +2 -0
- package/dist/util/lang.js +9 -1
- package/package.json +2 -2
package/.eslintrc.cjs
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
module.exports = {
|
2
|
+
ignorePatterns: ["dist"],
|
3
|
+
parserOptions: {
|
4
|
+
ecmaVersion: 2020,
|
5
|
+
sourceType: 'module',
|
6
|
+
project: 'client/tsconfig.json'
|
7
|
+
},
|
8
|
+
rules: {
|
9
|
+
'@typescript-eslint/no-explicit-any': 'off',
|
10
|
+
'@typescript-eslint/ban-types': 'off',
|
11
|
+
'@typescript-eslint/no-floating-promises': 'error',
|
12
|
+
}
|
13
|
+
};
|
package/CHANGELOG.md
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# @xata.io/client
|
2
|
+
|
3
|
+
## 0.5.1
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- 12729ab: Make API client fetch implementation optional
|
8
|
+
|
9
|
+
## 0.5.0
|
10
|
+
|
11
|
+
### Patch Changes
|
12
|
+
|
13
|
+
- 14ec7d1: Fix in Selectable type
|
14
|
+
|
15
|
+
## 0.4.0
|
16
|
+
|
17
|
+
### Patch Changes
|
18
|
+
|
19
|
+
- b951331: Add support for new float column
|
20
|
+
- d470610: Add new getAll() method
|
21
|
+
- eaf92a8: Expose pagination constants (size and offset limits)
|
22
|
+
- 57fde77: Reduce subrequests for createMany
|
23
|
+
- eaf92a8: Implement schema-less client
|
24
|
+
- 97a3caa: Make createBranch from optional with empty branch
|
25
|
+
|
26
|
+
## 0.3.0
|
27
|
+
|
28
|
+
### Minor Changes
|
29
|
+
|
30
|
+
- 1c0a454: Add API Client and internally use it
|
31
|
+
|
32
|
+
### Patch Changes
|
33
|
+
|
34
|
+
- 122321c: Fix client in CF workers and Deno
|
35
|
+
- a2671b5: Allow cancel or resend workspace invites
|
36
|
+
- e73d470: Split insert and create
|
package/dist/api/client.d.ts
CHANGED
@@ -4,7 +4,7 @@ import { HostProvider } from './providers';
|
|
4
4
|
import type * as Responses from './responses';
|
5
5
|
import type * as Schemas from './schemas';
|
6
6
|
export interface XataApiClientOptions {
|
7
|
-
fetch
|
7
|
+
fetch?: FetchImpl;
|
8
8
|
apiKey: string;
|
9
9
|
host?: HostProvider;
|
10
10
|
}
|
@@ -40,6 +40,8 @@ declare class WorkspaceApi {
|
|
40
40
|
updateWorkspaceMemberRole(workspaceId: Schemas.WorkspaceID, userId: Schemas.UserID, role: Schemas.Role): Promise<void>;
|
41
41
|
removeWorkspaceMember(workspaceId: Schemas.WorkspaceID, userId: Schemas.UserID): Promise<void>;
|
42
42
|
inviteWorkspaceMember(workspaceId: Schemas.WorkspaceID, email: string, role: Schemas.Role): Promise<Schemas.WorkspaceInvite>;
|
43
|
+
cancelWorkspaceMemberInvite(workspaceId: Schemas.WorkspaceID, inviteId: Schemas.InviteID): Promise<void>;
|
44
|
+
resendWorkspaceMemberInvite(workspaceId: Schemas.WorkspaceID, inviteId: Schemas.InviteID): Promise<void>;
|
43
45
|
acceptWorkspaceMemberInvite(workspaceId: Schemas.WorkspaceID, inviteKey: Schemas.InviteKey): Promise<void>;
|
44
46
|
}
|
45
47
|
declare class DatabaseApi {
|
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'),
|
@@ -107,6 +108,12 @@ class WorkspaceApi {
|
|
107
108
|
inviteWorkspaceMember(workspaceId, email, role) {
|
108
109
|
return components_1.operationsByTag.workspaces.inviteWorkspaceMember(Object.assign({ pathParams: { workspaceId }, body: { email, role } }, this.extraProps));
|
109
110
|
}
|
111
|
+
cancelWorkspaceMemberInvite(workspaceId, inviteId) {
|
112
|
+
return components_1.operationsByTag.workspaces.cancelWorkspaceMemberInvite(Object.assign({ pathParams: { workspaceId, inviteId } }, this.extraProps));
|
113
|
+
}
|
114
|
+
resendWorkspaceMemberInvite(workspaceId, inviteId) {
|
115
|
+
return components_1.operationsByTag.workspaces.resendWorkspaceMemberInvite(Object.assign({ pathParams: { workspaceId, inviteId } }, this.extraProps));
|
116
|
+
}
|
110
117
|
acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
|
111
118
|
return components_1.operationsByTag.workspaces.acceptWorkspaceMemberInvite(Object.assign({ pathParams: { workspaceId, inviteKey } }, this.extraProps));
|
112
119
|
}
|
@@ -135,7 +142,7 @@ class BranchApi {
|
|
135
142
|
getBranchDetails(workspace, database, branch) {
|
136
143
|
return components_1.operationsByTag.branch.getBranchDetails(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` } }, this.extraProps));
|
137
144
|
}
|
138
|
-
createBranch(workspace, database, branch, from, options = {}) {
|
145
|
+
createBranch(workspace, database, branch, from = '', options = {}) {
|
139
146
|
return components_1.operationsByTag.branch.createBranch(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, queryParams: { from }, body: options }, this.extraProps));
|
140
147
|
}
|
141
148
|
deleteBranch(workspace, database, branch) {
|
package/dist/api/components.d.ts
CHANGED
@@ -161,6 +161,28 @@ export declare type InviteWorkspaceMemberVariables = {
|
|
161
161
|
* Invite some user to join the workspace with the given role
|
162
162
|
*/
|
163
163
|
export declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<Schemas.WorkspaceInvite>;
|
164
|
+
export declare type CancelWorkspaceMemberInvitePathParams = {
|
165
|
+
workspaceId: Schemas.WorkspaceID;
|
166
|
+
inviteId: Schemas.InviteID;
|
167
|
+
};
|
168
|
+
export declare type CancelWorkspaceMemberInviteVariables = {
|
169
|
+
pathParams: CancelWorkspaceMemberInvitePathParams;
|
170
|
+
} & FetcherExtraProps;
|
171
|
+
/**
|
172
|
+
* This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.
|
173
|
+
*/
|
174
|
+
export declare const cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
|
175
|
+
export declare type ResendWorkspaceMemberInvitePathParams = {
|
176
|
+
workspaceId: Schemas.WorkspaceID;
|
177
|
+
inviteId: Schemas.InviteID;
|
178
|
+
};
|
179
|
+
export declare type ResendWorkspaceMemberInviteVariables = {
|
180
|
+
pathParams: ResendWorkspaceMemberInvitePathParams;
|
181
|
+
} & FetcherExtraProps;
|
182
|
+
/**
|
183
|
+
* This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted.
|
184
|
+
*/
|
185
|
+
export declare const resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
|
164
186
|
export declare type AcceptWorkspaceMemberInvitePathParams = {
|
165
187
|
workspaceId: Schemas.WorkspaceID;
|
166
188
|
inviteKey: Schemas.InviteKey;
|
@@ -853,7 +875,7 @@ export declare type QueryTableVariables = {
|
|
853
875
|
* `$none`, etc.
|
854
876
|
*
|
855
877
|
* All operators start with an `$` to differentiate them from column names
|
856
|
-
* (which are not allowed to start with an
|
878
|
+
* (which are not allowed to start with an dollar sign).
|
857
879
|
*
|
858
880
|
* #### Exact matching and control operators
|
859
881
|
*
|
@@ -921,27 +943,17 @@ export declare type QueryTableVariables = {
|
|
921
943
|
* }
|
922
944
|
* ```
|
923
945
|
*
|
924
|
-
* 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:
|
925
947
|
*
|
926
948
|
* ```json
|
927
949
|
* {
|
928
950
|
* "filter": {
|
929
|
-
* "settings.plan": ["free", "paid"]
|
951
|
+
* "settings.plan": {"$any": ["free", "paid"]}
|
930
952
|
* },
|
931
953
|
* }
|
932
954
|
* ```
|
933
955
|
*
|
934
|
-
*
|
935
|
-
*
|
936
|
-
* ```json
|
937
|
-
* {
|
938
|
-
* "filter": {
|
939
|
-
* "settings.plan": { "$is": ["free", "paid"]}
|
940
|
-
* },
|
941
|
-
* }
|
942
|
-
* ```
|
943
|
-
*
|
944
|
-
* Specifying multiple columns, ANDs them together:
|
956
|
+
* If you specify multiple columns in the same filter, they are logically AND'ed together:
|
945
957
|
*
|
946
958
|
* ```json
|
947
959
|
* {
|
@@ -952,6 +964,8 @@ export declare type QueryTableVariables = {
|
|
952
964
|
* }
|
953
965
|
* ```
|
954
966
|
*
|
967
|
+
* The above matches if both conditions are met.
|
968
|
+
*
|
955
969
|
* To be more explicit about it, you can use `$all` or `$any`:
|
956
970
|
*
|
957
971
|
* ```json
|
@@ -959,13 +973,13 @@ export declare type QueryTableVariables = {
|
|
959
973
|
* "filter": {
|
960
974
|
* "$any": {
|
961
975
|
* "settings.dark": true,
|
962
|
-
* "settings.plan": "free"
|
976
|
+
* "settings.plan": "free"
|
963
977
|
* }
|
964
978
|
* },
|
965
979
|
* }
|
966
980
|
* ```
|
967
981
|
*
|
968
|
-
* `$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:
|
969
983
|
*
|
970
984
|
* ```json
|
971
985
|
* {
|
@@ -1008,7 +1022,7 @@ export declare type QueryTableVariables = {
|
|
1008
1022
|
* }
|
1009
1023
|
* ```
|
1010
1024
|
*
|
1011
|
-
*
|
1025
|
+
* Or you can use the inverse operator `$notExists`:
|
1012
1026
|
*
|
1013
1027
|
* ```json
|
1014
1028
|
* {
|
@@ -1061,7 +1075,7 @@ export declare type QueryTableVariables = {
|
|
1061
1075
|
* }
|
1062
1076
|
* ```
|
1063
1077
|
*
|
1064
|
-
* #### Numeric
|
1078
|
+
* #### Numeric ranges
|
1065
1079
|
*
|
1066
1080
|
* ```json
|
1067
1081
|
* {
|
@@ -1076,18 +1090,6 @@ export declare type QueryTableVariables = {
|
|
1076
1090
|
*
|
1077
1091
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
1078
1092
|
*
|
1079
|
-
* Date ranges would support the same operators, with the date as string in RFC 3339:
|
1080
|
-
*
|
1081
|
-
* ```json
|
1082
|
-
* {
|
1083
|
-
* "filter": {
|
1084
|
-
* "<column_name>": {
|
1085
|
-
* "$gt": "2019-10-12T07:20:50.52Z",
|
1086
|
-
* "$lt": "2021-10-12T07:20:50.52Z"
|
1087
|
-
* }
|
1088
|
-
* }
|
1089
|
-
* }
|
1090
|
-
* ```
|
1091
1093
|
*
|
1092
1094
|
* #### Negations
|
1093
1095
|
*
|
@@ -1140,7 +1142,7 @@ export declare type QueryTableVariables = {
|
|
1140
1142
|
* }
|
1141
1143
|
* ```
|
1142
1144
|
*
|
1143
|
-
* In addition,
|
1145
|
+
* In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
|
1144
1146
|
*
|
1145
1147
|
* ```json
|
1146
1148
|
* {
|
@@ -1191,6 +1193,22 @@ export declare type QueryTableVariables = {
|
|
1191
1193
|
* predicate. The `$includes` operator is a synonym for the `$includesAny`
|
1192
1194
|
* operator.
|
1193
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
|
+
*
|
1194
1212
|
* ### Sorting
|
1195
1213
|
*
|
1196
1214
|
* Sorting by one element:
|
@@ -1371,6 +1389,8 @@ export declare const operationsByTag: {
|
|
1371
1389
|
updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
|
1372
1390
|
removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
|
1373
1391
|
inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<Schemas.WorkspaceInvite>;
|
1392
|
+
cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
|
1393
|
+
resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
|
1374
1394
|
acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
|
1375
1395
|
};
|
1376
1396
|
database: {
|
package/dist/api/components.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.
|
3
|
+
exports.searchBranch = exports.queryTable = exports.bulkInsertTableRecords = exports.getRecord = exports.deleteRecord = exports.upsertRecordWithID = exports.updateRecordWithID = exports.insertRecordWithID = exports.insertRecord = exports.updateColumn = exports.deleteColumn = exports.getColumn = exports.addTableColumn = exports.getTableColumns = exports.setTableSchema = exports.getTableSchema = exports.updateTable = exports.deleteTable = exports.createTable = exports.getBranchStats = exports.getBranchMigrationPlan = exports.executeBranchMigrationPlan = exports.getBranchMigrationHistory = exports.getBranchMetadata = exports.updateBranchMetadata = exports.deleteBranch = exports.createBranch = exports.getBranchDetails = exports.deleteDatabase = exports.createDatabase = exports.getBranchList = exports.getDatabaseList = exports.acceptWorkspaceMemberInvite = exports.resendWorkspaceMemberInvite = exports.cancelWorkspaceMemberInvite = exports.inviteWorkspaceMember = exports.removeWorkspaceMember = exports.updateWorkspaceMemberRole = exports.getWorkspaceMembersList = exports.deleteWorkspace = exports.updateWorkspace = exports.getWorkspace = exports.getWorkspacesList = exports.createWorkspace = exports.deleteUserAPIKey = exports.createUserAPIKey = exports.getUserAPIKeys = exports.deleteUser = exports.updateUser = exports.getUser = void 0;
|
4
|
+
exports.operationsByTag = void 0;
|
4
5
|
/**
|
5
6
|
* Generated by @openapi-codegen
|
6
7
|
*
|
@@ -82,6 +83,16 @@ exports.removeWorkspaceMember = removeWorkspaceMember;
|
|
82
83
|
*/
|
83
84
|
const inviteWorkspaceMember = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites', method: 'post' }, variables));
|
84
85
|
exports.inviteWorkspaceMember = inviteWorkspaceMember;
|
86
|
+
/**
|
87
|
+
* This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.
|
88
|
+
*/
|
89
|
+
const cancelWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}', method: 'delete' }, variables));
|
90
|
+
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite;
|
91
|
+
/**
|
92
|
+
* This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted.
|
93
|
+
*/
|
94
|
+
const resendWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}/resend', method: 'post' }, variables));
|
95
|
+
exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite;
|
85
96
|
/**
|
86
97
|
* Accept the invitation to join a workspace. If the operation succeeds the user will be a member of the workspace
|
87
98
|
*/
|
@@ -447,7 +458,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
447
458
|
* `$none`, etc.
|
448
459
|
*
|
449
460
|
* All operators start with an `$` to differentiate them from column names
|
450
|
-
* (which are not allowed to start with an
|
461
|
+
* (which are not allowed to start with an dollar sign).
|
451
462
|
*
|
452
463
|
* #### Exact matching and control operators
|
453
464
|
*
|
@@ -515,27 +526,17 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
515
526
|
* }
|
516
527
|
* ```
|
517
528
|
*
|
518
|
-
* 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:
|
519
530
|
*
|
520
531
|
* ```json
|
521
532
|
* {
|
522
533
|
* "filter": {
|
523
|
-
* "settings.plan": ["free", "paid"]
|
534
|
+
* "settings.plan": {"$any": ["free", "paid"]}
|
524
535
|
* },
|
525
536
|
* }
|
526
537
|
* ```
|
527
538
|
*
|
528
|
-
*
|
529
|
-
*
|
530
|
-
* ```json
|
531
|
-
* {
|
532
|
-
* "filter": {
|
533
|
-
* "settings.plan": { "$is": ["free", "paid"]}
|
534
|
-
* },
|
535
|
-
* }
|
536
|
-
* ```
|
537
|
-
*
|
538
|
-
* Specifying multiple columns, ANDs them together:
|
539
|
+
* If you specify multiple columns in the same filter, they are logically AND'ed together:
|
539
540
|
*
|
540
541
|
* ```json
|
541
542
|
* {
|
@@ -546,6 +547,8 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
546
547
|
* }
|
547
548
|
* ```
|
548
549
|
*
|
550
|
+
* The above matches if both conditions are met.
|
551
|
+
*
|
549
552
|
* To be more explicit about it, you can use `$all` or `$any`:
|
550
553
|
*
|
551
554
|
* ```json
|
@@ -553,13 +556,13 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
553
556
|
* "filter": {
|
554
557
|
* "$any": {
|
555
558
|
* "settings.dark": true,
|
556
|
-
* "settings.plan": "free"
|
559
|
+
* "settings.plan": "free"
|
557
560
|
* }
|
558
561
|
* },
|
559
562
|
* }
|
560
563
|
* ```
|
561
564
|
*
|
562
|
-
* `$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:
|
563
566
|
*
|
564
567
|
* ```json
|
565
568
|
* {
|
@@ -602,7 +605,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
602
605
|
* }
|
603
606
|
* ```
|
604
607
|
*
|
605
|
-
*
|
608
|
+
* Or you can use the inverse operator `$notExists`:
|
606
609
|
*
|
607
610
|
* ```json
|
608
611
|
* {
|
@@ -655,7 +658,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
655
658
|
* }
|
656
659
|
* ```
|
657
660
|
*
|
658
|
-
* #### Numeric
|
661
|
+
* #### Numeric ranges
|
659
662
|
*
|
660
663
|
* ```json
|
661
664
|
* {
|
@@ -670,18 +673,6 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
670
673
|
*
|
671
674
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
672
675
|
*
|
673
|
-
* Date ranges would support the same operators, with the date as string in RFC 3339:
|
674
|
-
*
|
675
|
-
* ```json
|
676
|
-
* {
|
677
|
-
* "filter": {
|
678
|
-
* "<column_name>": {
|
679
|
-
* "$gt": "2019-10-12T07:20:50.52Z",
|
680
|
-
* "$lt": "2021-10-12T07:20:50.52Z"
|
681
|
-
* }
|
682
|
-
* }
|
683
|
-
* }
|
684
|
-
* ```
|
685
676
|
*
|
686
677
|
* #### Negations
|
687
678
|
*
|
@@ -734,7 +725,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
734
725
|
* }
|
735
726
|
* ```
|
736
727
|
*
|
737
|
-
* In addition,
|
728
|
+
* In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
|
738
729
|
*
|
739
730
|
* ```json
|
740
731
|
* {
|
@@ -785,6 +776,22 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
785
776
|
* predicate. The `$includes` operator is a synonym for the `$includesAny`
|
786
777
|
* operator.
|
787
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
|
+
*
|
788
795
|
* ### Sorting
|
789
796
|
*
|
790
797
|
* Sorting by one element:
|
@@ -947,6 +954,8 @@ exports.operationsByTag = {
|
|
947
954
|
updateWorkspaceMemberRole: exports.updateWorkspaceMemberRole,
|
948
955
|
removeWorkspaceMember: exports.removeWorkspaceMember,
|
949
956
|
inviteWorkspaceMember: exports.inviteWorkspaceMember,
|
957
|
+
cancelWorkspaceMemberInvite: exports.cancelWorkspaceMemberInvite,
|
958
|
+
resendWorkspaceMemberInvite: exports.resendWorkspaceMemberInvite,
|
950
959
|
acceptWorkspaceMemberInvite: exports.acceptWorkspaceMemberInvite
|
951
960
|
},
|
952
961
|
database: { getDatabaseList: exports.getDatabaseList, createDatabase: exports.createDatabase, deleteDatabase: exports.deleteDatabase },
|
package/dist/api/fetcher.js
CHANGED
@@ -10,6 +10,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
10
10
|
};
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
12
|
exports.fetch = void 0;
|
13
|
+
/* eslint-disable @typescript-eslint/no-throw-literal */
|
14
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
15
|
+
const lang_1 = require("../util/lang");
|
13
16
|
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
14
17
|
const query = new URLSearchParams(queryParams).toString();
|
15
18
|
const queryString = query.length > 0 ? `?${query}` : '';
|
@@ -65,7 +68,7 @@ function fetch({ url: path, method, body, headers, pathParams, queryParams, fetc
|
|
65
68
|
};
|
66
69
|
throw withStatus(error, response.status);
|
67
70
|
}
|
68
|
-
else if (
|
71
|
+
else if ((0, lang_1.isObject)(e) && (0, lang_1.isString)(e.message)) {
|
69
72
|
throw withStatus(e, response.status);
|
70
73
|
}
|
71
74
|
else {
|
package/dist/api/parameters.d.ts
CHANGED
@@ -5,6 +5,7 @@
|
|
5
5
|
*/
|
6
6
|
import type * as Schemas from './schemas';
|
7
7
|
export declare type APIKeyNameParam = Schemas.APIKeyName;
|
8
|
+
export declare type InviteIDParam = Schemas.InviteID;
|
8
9
|
export declare type InviteKeyParam = Schemas.InviteKey;
|
9
10
|
export declare type UserIDParam = Schemas.UserID;
|
10
11
|
export declare type WorkspaceIDParam = Schemas.WorkspaceID;
|
package/dist/api/providers.js
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.getHostUrl = void 0;
|
4
|
+
const lang_1 = require("../util/lang");
|
4
5
|
function getHostUrl(provider, type) {
|
5
6
|
if (isValidAlias(provider)) {
|
6
7
|
return providers[provider][type];
|
@@ -22,8 +23,8 @@ const providers = {
|
|
22
23
|
}
|
23
24
|
};
|
24
25
|
function isValidAlias(alias) {
|
25
|
-
return
|
26
|
+
return (0, lang_1.isString)(alias) && Object.keys(providers).includes(alias);
|
26
27
|
}
|
27
28
|
function isValidBuilder(builder) {
|
28
|
-
return
|
29
|
+
return (0, lang_1.isObject)(builder) && (0, lang_1.isString)(builder.main) && (0, lang_1.isString)(builder.workspaces);
|
29
30
|
}
|
package/dist/api/schemas.d.ts
CHANGED
@@ -130,7 +130,7 @@ export declare type Table = {
|
|
130
130
|
*/
|
131
131
|
export declare type Column = {
|
132
132
|
name: string;
|
133
|
-
type: 'bool' | 'int' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
|
133
|
+
type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
|
134
134
|
link?: {
|
135
135
|
table: string;
|
136
136
|
};
|
package/dist/schema/filters.js
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
"use strict";
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
3
|
exports.buildSortFilter = exports.isSortFilterObject = void 0;
|
4
|
+
const lang_1 = require("../util/lang");
|
4
5
|
function isSortFilterObject(filter) {
|
5
|
-
return
|
6
|
+
return (0, lang_1.isObject)(filter) && filter.column !== undefined;
|
6
7
|
}
|
7
8
|
exports.isSortFilterObject = isSortFilterObject;
|
8
9
|
function buildSortFilter(filter) {
|
package/dist/schema/index.d.ts
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
export * from './operators';
|
2
|
-
export
|
3
|
-
export { Repository, RestRepository, RestRespositoryFactory, BaseClient } from './repository';
|
4
|
-
export type { XataClientOptions } from './repository';
|
2
|
+
export * from './pagination';
|
5
3
|
export { Query } from './query';
|
4
|
+
export type { Identifiable, XataRecord } from './record';
|
5
|
+
export { BaseClient, Repository, RestRepository, RestRespositoryFactory } from './repository';
|
6
|
+
export type { XataClientOptions } from './repository';
|
package/dist/schema/index.js
CHANGED
@@ -14,12 +14,13 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
15
|
};
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17
|
-
exports.
|
17
|
+
exports.RestRespositoryFactory = exports.RestRepository = exports.Repository = exports.BaseClient = exports.Query = void 0;
|
18
18
|
__exportStar(require("./operators"), exports);
|
19
|
+
__exportStar(require("./pagination"), exports);
|
20
|
+
var query_1 = require("./query");
|
21
|
+
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return query_1.Query; } });
|
19
22
|
var repository_1 = require("./repository");
|
23
|
+
Object.defineProperty(exports, "BaseClient", { enumerable: true, get: function () { return repository_1.BaseClient; } });
|
20
24
|
Object.defineProperty(exports, "Repository", { enumerable: true, get: function () { return repository_1.Repository; } });
|
21
25
|
Object.defineProperty(exports, "RestRepository", { enumerable: true, get: function () { return repository_1.RestRepository; } });
|
22
26
|
Object.defineProperty(exports, "RestRespositoryFactory", { enumerable: true, get: function () { return repository_1.RestRespositoryFactory; } });
|
23
|
-
Object.defineProperty(exports, "BaseClient", { enumerable: true, get: function () { return repository_1.BaseClient; } });
|
24
|
-
var query_1 = require("./query");
|
25
|
-
Object.defineProperty(exports, "Query", { enumerable: true, get: function () { return query_1.Query; } });
|
@@ -1,21 +1,72 @@
|
|
1
1
|
import { Constraint } from './filters';
|
2
2
|
declare type ComparableType = number | Date;
|
3
|
+
/**
|
4
|
+
* Operator to restrict results to only values that are greater than the given value.
|
5
|
+
*/
|
3
6
|
export declare const gt: <T extends ComparableType>(value: T) => Constraint<T>;
|
7
|
+
/**
|
8
|
+
* Operator to restrict results to only values that are greater than or equal to the given value.
|
9
|
+
*/
|
4
10
|
export declare const ge: <T extends ComparableType>(value: T) => Constraint<T>;
|
11
|
+
/**
|
12
|
+
* Operator to restrict results to only values that are greater than or equal to the given value.
|
13
|
+
*/
|
5
14
|
export declare const gte: <T extends ComparableType>(value: T) => Constraint<T>;
|
15
|
+
/**
|
16
|
+
* Operator to restrict results to only values that are lower than the given value.
|
17
|
+
*/
|
6
18
|
export declare const lt: <T extends ComparableType>(value: T) => Constraint<T>;
|
19
|
+
/**
|
20
|
+
* Operator to restrict results to only values that are lower than or equal to the given value.
|
21
|
+
*/
|
7
22
|
export declare const lte: <T extends ComparableType>(value: T) => Constraint<T>;
|
23
|
+
/**
|
24
|
+
* Operator to restrict results to only values that are lower than or equal to the given value.
|
25
|
+
*/
|
8
26
|
export declare const le: <T extends ComparableType>(value: T) => Constraint<T>;
|
27
|
+
/**
|
28
|
+
* Operator to restrict results to only values that are not null.
|
29
|
+
*/
|
9
30
|
export declare const exists: (column: string) => Constraint<string>;
|
31
|
+
/**
|
32
|
+
* Operator to restrict results to only values that are null.
|
33
|
+
*/
|
10
34
|
export declare const notExists: (column: string) => Constraint<string>;
|
35
|
+
/**
|
36
|
+
* Operator to restrict results to only values that start with the given prefix.
|
37
|
+
*/
|
11
38
|
export declare const startsWith: (value: string) => Constraint<string>;
|
39
|
+
/**
|
40
|
+
* Operator to restrict results to only values that end with the given suffix.
|
41
|
+
*/
|
12
42
|
export declare const endsWith: (value: string) => Constraint<string>;
|
43
|
+
/**
|
44
|
+
* Operator to restrict results to only values that match the given pattern.
|
45
|
+
*/
|
13
46
|
export declare const pattern: (value: string) => Constraint<string>;
|
47
|
+
/**
|
48
|
+
* Operator to restrict results to only values that are equal to the given value.
|
49
|
+
*/
|
14
50
|
export declare const is: <T>(value: T) => Constraint<T>;
|
51
|
+
/**
|
52
|
+
* Operator to restrict results to only values that are not equal to the given value.
|
53
|
+
*/
|
15
54
|
export declare const isNot: <T>(value: T) => Constraint<T>;
|
55
|
+
/**
|
56
|
+
* Operator to restrict results to only values that contain the given value.
|
57
|
+
*/
|
16
58
|
export declare const contains: <T>(value: T) => Constraint<T>;
|
59
|
+
/**
|
60
|
+
* Operator to restrict results to only arrays that include the given value.
|
61
|
+
*/
|
17
62
|
export declare const includes: (value: string) => Constraint<string>;
|
63
|
+
/**
|
64
|
+
* Operator to restrict results to only arrays that include a value matching the given substring.
|
65
|
+
*/
|
18
66
|
export declare const includesSubstring: (value: string) => Constraint<string>;
|
67
|
+
/**
|
68
|
+
* Operator to restrict results to only arrays that include a value matching the given pattern.
|
69
|
+
*/
|
19
70
|
export declare const includesPattern: (value: string) => Constraint<string>;
|
20
71
|
export declare const includesAll: (value: string) => Constraint<string>;
|
21
72
|
export {};
|