@xata.io/client 0.0.0-beta.bdce130 → 0.0.0-beta.c21e40a
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 +49 -0
- package/dist/api/client.d.ts +8 -3
- package/dist/api/client.js +42 -12
- package/dist/api/components.d.ts +63 -57
- package/dist/api/components.js +36 -40
- package/dist/api/fetcher.d.ts +3 -2
- package/dist/api/fetcher.js +31 -33
- package/dist/api/index.js +5 -1
- package/dist/api/providers.js +3 -2
- package/dist/api/responses.d.ts +12 -0
- package/dist/index.d.ts +0 -58
- package/dist/index.js +6 -265
- package/dist/schema/filters.d.ts +7 -5
- package/dist/schema/filters.js +2 -1
- package/dist/schema/index.d.ts +6 -0
- package/dist/schema/index.js +17 -1
- package/dist/schema/operators.d.ts +51 -0
- package/dist/schema/operators.js +51 -0
- package/dist/schema/pagination.d.ts +56 -14
- package/dist/schema/pagination.js +37 -2
- package/dist/schema/query.d.ts +108 -100
- package/dist/schema/query.js +87 -35
- package/dist/schema/record.d.ts +66 -0
- package/dist/schema/record.js +13 -0
- package/dist/schema/repository.d.ts +100 -0
- package/dist/schema/repository.js +288 -0
- package/dist/schema/selection.d.ts +24 -17
- package/dist/schema/selection.spec.d.ts +1 -0
- package/dist/schema/selection.spec.js +203 -0
- package/dist/util/lang.d.ts +4 -0
- package/dist/util/lang.js +13 -1
- package/dist/util/types.d.ts +11 -1
- package/package.json +2 -2
- package/tsconfig.json +21 -0
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,49 @@
|
|
1
|
+
# @xata.io/client
|
2
|
+
|
3
|
+
## 0.6.0
|
4
|
+
|
5
|
+
### Minor Changes
|
6
|
+
|
7
|
+
- 084f5df: Add type inference for columns
|
8
|
+
- bb73c89: Unify create and insert in a single method overload
|
9
|
+
|
10
|
+
### Patch Changes
|
11
|
+
|
12
|
+
- 716c487: Forward nullable types on links
|
13
|
+
- bb66bb2: Fix error handling with createMany
|
14
|
+
- 084f5df: Fix circular dependencies on selectable column
|
15
|
+
|
16
|
+
## 0.5.1
|
17
|
+
|
18
|
+
### Patch Changes
|
19
|
+
|
20
|
+
- 12729ab: Make API client fetch implementation optional
|
21
|
+
|
22
|
+
## 0.5.0
|
23
|
+
|
24
|
+
### Patch Changes
|
25
|
+
|
26
|
+
- 14ec7d1: Fix in Selectable type
|
27
|
+
|
28
|
+
## 0.4.0
|
29
|
+
|
30
|
+
### Patch Changes
|
31
|
+
|
32
|
+
- b951331: Add support for new float column
|
33
|
+
- d470610: Add new getAll() method
|
34
|
+
- eaf92a8: Expose pagination constants (size and offset limits)
|
35
|
+
- 57fde77: Reduce subrequests for createMany
|
36
|
+
- eaf92a8: Implement schema-less client
|
37
|
+
- 97a3caa: Make createBranch from optional with empty branch
|
38
|
+
|
39
|
+
## 0.3.0
|
40
|
+
|
41
|
+
### Minor Changes
|
42
|
+
|
43
|
+
- 1c0a454: Add API Client and internally use it
|
44
|
+
|
45
|
+
### Patch Changes
|
46
|
+
|
47
|
+
- 122321c: Fix client in CF workers and Deno
|
48
|
+
- a2671b5: Allow cancel or resend workspace invites
|
49
|
+
- e73d470: Split insert and create
|
package/dist/api/client.d.ts
CHANGED
@@ -4,12 +4,12 @@ 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
|
}
|
11
11
|
export declare class XataApiClient {
|
12
|
-
private
|
12
|
+
#private;
|
13
13
|
constructor(options: XataApiClientOptions);
|
14
14
|
get user(): UserApi;
|
15
15
|
get workspaces(): WorkspaceApi;
|
@@ -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 {
|
@@ -81,10 +83,13 @@ declare class RecordsApi {
|
|
81
83
|
private extraProps;
|
82
84
|
constructor(extraProps: FetcherExtraProps);
|
83
85
|
insertRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, record: Record<string, any>): Promise<Types.InsertRecordResponse>;
|
84
|
-
insertRecordWithID(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, record: Record<string, any>, options?: Types.InsertRecordWithIDQueryParams): Promise<
|
86
|
+
insertRecordWithID(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, record: Record<string, any>, options?: Types.InsertRecordWithIDQueryParams): Promise<Responses.RecordUpdateResponse>;
|
87
|
+
updateRecordWithID(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, record: Record<string, any>, options?: Types.UpdateRecordWithIDQueryParams): Promise<Responses.RecordUpdateResponse>;
|
88
|
+
upsertRecordWithID(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, record: Record<string, any>, options?: Types.UpsertRecordWithIDQueryParams): Promise<Responses.RecordUpdateResponse>;
|
85
89
|
deleteRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID): Promise<void>;
|
86
90
|
getRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, options?: Types.GetRecordRequestBody): Promise<Schemas.XataRecord>;
|
87
91
|
bulkInsertTableRecords(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, records: Record<string, any>[]): Promise<Types.BulkInsertTableRecordsResponse>;
|
88
92
|
queryTable(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, query: Types.QueryTableRequestBody): Promise<Responses.QueryResponse>;
|
93
|
+
searchBranch(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, query: Types.SearchBranchRequestBody): Promise<Responses.SearchResponse>;
|
89
94
|
}
|
90
95
|
export {};
|
package/dist/api/client.js
CHANGED
@@ -1,44 +1,59 @@
|
|
1
1
|
"use strict";
|
2
|
+
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
|
3
|
+
if (kind === "m") throw new TypeError("Private method is not writable");
|
4
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
|
5
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
|
6
|
+
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
|
7
|
+
};
|
8
|
+
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
9
|
+
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
10
|
+
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
11
|
+
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
12
|
+
};
|
13
|
+
var _XataApiClient_extraProps;
|
2
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
3
15
|
exports.XataApiClient = void 0;
|
4
16
|
const components_1 = require("./components");
|
5
17
|
const providers_1 = require("./providers");
|
6
18
|
class XataApiClient {
|
7
19
|
constructor(options) {
|
8
|
-
var _a;
|
9
|
-
|
20
|
+
var _a, _b;
|
21
|
+
_XataApiClient_extraProps.set(this, void 0);
|
22
|
+
const globalFetch = typeof fetch !== 'undefined' ? fetch : undefined;
|
23
|
+
const fetchImpl = (_a = options.fetch) !== null && _a !== void 0 ? _a : globalFetch;
|
10
24
|
if (!fetchImpl) {
|
11
25
|
/** @todo add a link after docs exist */
|
12
26
|
throw new Error(`The \`fetch\` option passed to the Xata client is resolving to a falsy value and may not be correctly imported.`);
|
13
27
|
}
|
14
|
-
const provider = (
|
15
|
-
this
|
28
|
+
const provider = (_b = options.host) !== null && _b !== void 0 ? _b : 'production';
|
29
|
+
__classPrivateFieldSet(this, _XataApiClient_extraProps, {
|
16
30
|
apiUrl: (0, providers_1.getHostUrl)(provider, 'main'),
|
17
31
|
workspacesApiUrl: (0, providers_1.getHostUrl)(provider, 'workspaces'),
|
18
32
|
fetchImpl,
|
19
33
|
apiKey: options.apiKey
|
20
|
-
};
|
34
|
+
}, "f");
|
21
35
|
}
|
22
36
|
get user() {
|
23
|
-
return new UserApi(this
|
37
|
+
return new UserApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
24
38
|
}
|
25
39
|
get workspaces() {
|
26
|
-
return new WorkspaceApi(this
|
40
|
+
return new WorkspaceApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
27
41
|
}
|
28
42
|
get databases() {
|
29
|
-
return new DatabaseApi(this
|
43
|
+
return new DatabaseApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
30
44
|
}
|
31
45
|
get branches() {
|
32
|
-
return new BranchApi(this
|
46
|
+
return new BranchApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
33
47
|
}
|
34
48
|
get tables() {
|
35
|
-
return new TableApi(this
|
49
|
+
return new TableApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
36
50
|
}
|
37
51
|
get records() {
|
38
|
-
return new RecordsApi(this
|
52
|
+
return new RecordsApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
39
53
|
}
|
40
54
|
}
|
41
55
|
exports.XataApiClient = XataApiClient;
|
56
|
+
_XataApiClient_extraProps = new WeakMap();
|
42
57
|
class UserApi {
|
43
58
|
constructor(extraProps) {
|
44
59
|
this.extraProps = extraProps;
|
@@ -93,6 +108,12 @@ class WorkspaceApi {
|
|
93
108
|
inviteWorkspaceMember(workspaceId, email, role) {
|
94
109
|
return components_1.operationsByTag.workspaces.inviteWorkspaceMember(Object.assign({ pathParams: { workspaceId }, body: { email, role } }, this.extraProps));
|
95
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
|
+
}
|
96
117
|
acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
|
97
118
|
return components_1.operationsByTag.workspaces.acceptWorkspaceMemberInvite(Object.assign({ pathParams: { workspaceId, inviteKey } }, this.extraProps));
|
98
119
|
}
|
@@ -121,7 +142,7 @@ class BranchApi {
|
|
121
142
|
getBranchDetails(workspace, database, branch) {
|
122
143
|
return components_1.operationsByTag.branch.getBranchDetails(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` } }, this.extraProps));
|
123
144
|
}
|
124
|
-
createBranch(workspace, database, branch, from, options = {}) {
|
145
|
+
createBranch(workspace, database, branch, from = '', options = {}) {
|
125
146
|
return components_1.operationsByTag.branch.createBranch(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, queryParams: { from }, body: options }, this.extraProps));
|
126
147
|
}
|
127
148
|
deleteBranch(workspace, database, branch) {
|
@@ -191,6 +212,12 @@ class RecordsApi {
|
|
191
212
|
insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
192
213
|
return components_1.operationsByTag.records.insertRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps));
|
193
214
|
}
|
215
|
+
updateRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
216
|
+
return components_1.operationsByTag.records.updateRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps));
|
217
|
+
}
|
218
|
+
upsertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
219
|
+
return components_1.operationsByTag.records.upsertRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps));
|
220
|
+
}
|
194
221
|
deleteRecord(workspace, database, branch, tableName, recordId) {
|
195
222
|
return components_1.operationsByTag.records.deleteRecord(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId } }, this.extraProps));
|
196
223
|
}
|
@@ -203,4 +230,7 @@ class RecordsApi {
|
|
203
230
|
queryTable(workspace, database, branch, tableName, query) {
|
204
231
|
return components_1.operationsByTag.records.queryTable(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName }, body: query }, this.extraProps));
|
205
232
|
}
|
233
|
+
searchBranch(workspace, database, branch, query) {
|
234
|
+
return components_1.operationsByTag.records.searchBranch(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, body: query }, this.extraProps));
|
235
|
+
}
|
206
236
|
}
|
package/dist/api/components.d.ts
CHANGED
@@ -161,22 +161,6 @@ 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 UpdateWorkspaceMemberInvitePathParams = {
|
165
|
-
workspaceId: Schemas.WorkspaceID;
|
166
|
-
inviteId: Schemas.InviteID;
|
167
|
-
};
|
168
|
-
export declare type UpdateWorkspaceMemberInviteRequestBody = {
|
169
|
-
role: Schemas.Role;
|
170
|
-
};
|
171
|
-
export declare type UpdateWorkspaceMemberInviteVariables = {
|
172
|
-
body: UpdateWorkspaceMemberInviteRequestBody;
|
173
|
-
pathParams: UpdateWorkspaceMemberInvitePathParams;
|
174
|
-
} & FetcherExtraProps;
|
175
|
-
/**
|
176
|
-
* This operation provides a way to update an invite.
|
177
|
-
* The role can be updated while the email cannot.
|
178
|
-
*/
|
179
|
-
export declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<Schemas.WorkspaceInvite>;
|
180
164
|
export declare type CancelWorkspaceMemberInvitePathParams = {
|
181
165
|
workspaceId: Schemas.WorkspaceID;
|
182
166
|
inviteId: Schemas.InviteID;
|
@@ -566,12 +550,6 @@ export declare type InsertRecordWithIDQueryParams = {
|
|
566
550
|
createOnly?: boolean;
|
567
551
|
ifVersion?: number;
|
568
552
|
};
|
569
|
-
export declare type InsertRecordWithIDResponse = {
|
570
|
-
id: string;
|
571
|
-
xata: {
|
572
|
-
version: number;
|
573
|
-
};
|
574
|
-
};
|
575
553
|
export declare type InsertRecordWithIDVariables = {
|
576
554
|
body?: Record<string, any>;
|
577
555
|
pathParams: InsertRecordWithIDPathParams;
|
@@ -580,7 +558,37 @@ export declare type InsertRecordWithIDVariables = {
|
|
580
558
|
/**
|
581
559
|
* By default, IDs are auto-generated when data is insterted into Xata. Sending a request to this endpoint allows us to insert a record with a pre-existing ID, bypassing the default automatic ID generation.
|
582
560
|
*/
|
583
|
-
export declare const insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<
|
561
|
+
export declare const insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
|
562
|
+
export declare type UpdateRecordWithIDPathParams = {
|
563
|
+
dbBranchName: Schemas.DBBranchName;
|
564
|
+
tableName: Schemas.TableName;
|
565
|
+
recordId: Schemas.RecordID;
|
566
|
+
workspace: string;
|
567
|
+
};
|
568
|
+
export declare type UpdateRecordWithIDQueryParams = {
|
569
|
+
ifVersion?: number;
|
570
|
+
};
|
571
|
+
export declare type UpdateRecordWithIDVariables = {
|
572
|
+
body?: Record<string, any>;
|
573
|
+
pathParams: UpdateRecordWithIDPathParams;
|
574
|
+
queryParams?: UpdateRecordWithIDQueryParams;
|
575
|
+
} & FetcherExtraProps;
|
576
|
+
export declare const updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
|
577
|
+
export declare type UpsertRecordWithIDPathParams = {
|
578
|
+
dbBranchName: Schemas.DBBranchName;
|
579
|
+
tableName: Schemas.TableName;
|
580
|
+
recordId: Schemas.RecordID;
|
581
|
+
workspace: string;
|
582
|
+
};
|
583
|
+
export declare type UpsertRecordWithIDQueryParams = {
|
584
|
+
ifVersion?: number;
|
585
|
+
};
|
586
|
+
export declare type UpsertRecordWithIDVariables = {
|
587
|
+
body?: Record<string, any>;
|
588
|
+
pathParams: UpsertRecordWithIDPathParams;
|
589
|
+
queryParams?: UpsertRecordWithIDQueryParams;
|
590
|
+
} & FetcherExtraProps;
|
591
|
+
export declare const upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
|
584
592
|
export declare type DeleteRecordPathParams = {
|
585
593
|
dbBranchName: Schemas.DBBranchName;
|
586
594
|
tableName: Schemas.TableName;
|
@@ -867,7 +875,7 @@ export declare type QueryTableVariables = {
|
|
867
875
|
* `$none`, etc.
|
868
876
|
*
|
869
877
|
* All operators start with an `$` to differentiate them from column names
|
870
|
-
* (which are not allowed to start with an
|
878
|
+
* (which are not allowed to start with an dollar sign).
|
871
879
|
*
|
872
880
|
* #### Exact matching and control operators
|
873
881
|
*
|
@@ -935,27 +943,17 @@ export declare type QueryTableVariables = {
|
|
935
943
|
* }
|
936
944
|
* ```
|
937
945
|
*
|
938
|
-
* 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:
|
939
947
|
*
|
940
948
|
* ```json
|
941
949
|
* {
|
942
950
|
* "filter": {
|
943
|
-
* "settings.plan": ["free", "paid"]
|
951
|
+
* "settings.plan": {"$any": ["free", "paid"]}
|
944
952
|
* },
|
945
953
|
* }
|
946
954
|
* ```
|
947
955
|
*
|
948
|
-
*
|
949
|
-
*
|
950
|
-
* ```json
|
951
|
-
* {
|
952
|
-
* "filter": {
|
953
|
-
* "settings.plan": { "$is": ["free", "paid"]}
|
954
|
-
* },
|
955
|
-
* }
|
956
|
-
* ```
|
957
|
-
*
|
958
|
-
* Specifying multiple columns, ANDs them together:
|
956
|
+
* If you specify multiple columns in the same filter, they are logically AND'ed together:
|
959
957
|
*
|
960
958
|
* ```json
|
961
959
|
* {
|
@@ -966,6 +964,8 @@ export declare type QueryTableVariables = {
|
|
966
964
|
* }
|
967
965
|
* ```
|
968
966
|
*
|
967
|
+
* The above matches if both conditions are met.
|
968
|
+
*
|
969
969
|
* To be more explicit about it, you can use `$all` or `$any`:
|
970
970
|
*
|
971
971
|
* ```json
|
@@ -973,13 +973,13 @@ export declare type QueryTableVariables = {
|
|
973
973
|
* "filter": {
|
974
974
|
* "$any": {
|
975
975
|
* "settings.dark": true,
|
976
|
-
* "settings.plan": "free"
|
976
|
+
* "settings.plan": "free"
|
977
977
|
* }
|
978
978
|
* },
|
979
979
|
* }
|
980
980
|
* ```
|
981
981
|
*
|
982
|
-
* `$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:
|
983
983
|
*
|
984
984
|
* ```json
|
985
985
|
* {
|
@@ -1022,7 +1022,7 @@ export declare type QueryTableVariables = {
|
|
1022
1022
|
* }
|
1023
1023
|
* ```
|
1024
1024
|
*
|
1025
|
-
*
|
1025
|
+
* Or you can use the inverse operator `$notExists`:
|
1026
1026
|
*
|
1027
1027
|
* ```json
|
1028
1028
|
* {
|
@@ -1075,7 +1075,7 @@ export declare type QueryTableVariables = {
|
|
1075
1075
|
* }
|
1076
1076
|
* ```
|
1077
1077
|
*
|
1078
|
-
* #### Numeric
|
1078
|
+
* #### Numeric ranges
|
1079
1079
|
*
|
1080
1080
|
* ```json
|
1081
1081
|
* {
|
@@ -1090,18 +1090,6 @@ export declare type QueryTableVariables = {
|
|
1090
1090
|
*
|
1091
1091
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
1092
1092
|
*
|
1093
|
-
* Date ranges would support the same operators, with the date as string in RFC 3339:
|
1094
|
-
*
|
1095
|
-
* ```json
|
1096
|
-
* {
|
1097
|
-
* "filter": {
|
1098
|
-
* "<column_name>": {
|
1099
|
-
* "$gt": "2019-10-12T07:20:50.52Z",
|
1100
|
-
* "$lt": "2021-10-12T07:20:50.52Z"
|
1101
|
-
* }
|
1102
|
-
* }
|
1103
|
-
* }
|
1104
|
-
* ```
|
1105
1093
|
*
|
1106
1094
|
* #### Negations
|
1107
1095
|
*
|
@@ -1154,7 +1142,7 @@ export declare type QueryTableVariables = {
|
|
1154
1142
|
* }
|
1155
1143
|
* ```
|
1156
1144
|
*
|
1157
|
-
* In addition,
|
1145
|
+
* In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
|
1158
1146
|
*
|
1159
1147
|
* ```json
|
1160
1148
|
* {
|
@@ -1205,6 +1193,22 @@ export declare type QueryTableVariables = {
|
|
1205
1193
|
* predicate. The `$includes` operator is a synonym for the `$includesAny`
|
1206
1194
|
* operator.
|
1207
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
|
+
*
|
1208
1212
|
* ### Sorting
|
1209
1213
|
*
|
1210
1214
|
* Sorting by one element:
|
@@ -1356,13 +1360,14 @@ export declare type SearchBranchPathParams = {
|
|
1356
1360
|
export declare type SearchBranchRequestBody = {
|
1357
1361
|
tables?: string[];
|
1358
1362
|
query: string;
|
1363
|
+
fuzziness?: number;
|
1359
1364
|
};
|
1360
1365
|
export declare type SearchBranchVariables = {
|
1361
1366
|
body: SearchBranchRequestBody;
|
1362
1367
|
pathParams: SearchBranchPathParams;
|
1363
1368
|
} & FetcherExtraProps;
|
1364
1369
|
/**
|
1365
|
-
* Run a free text search operation across the
|
1370
|
+
* Run a free text search operation across the database branch.
|
1366
1371
|
*/
|
1367
1372
|
export declare const searchBranch: (variables: SearchBranchVariables) => Promise<Responses.SearchResponse>;
|
1368
1373
|
export declare const operationsByTag: {
|
@@ -1384,7 +1389,6 @@ export declare const operationsByTag: {
|
|
1384
1389
|
updateWorkspaceMemberRole: (variables: UpdateWorkspaceMemberRoleVariables) => Promise<undefined>;
|
1385
1390
|
removeWorkspaceMember: (variables: RemoveWorkspaceMemberVariables) => Promise<undefined>;
|
1386
1391
|
inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<Schemas.WorkspaceInvite>;
|
1387
|
-
updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<Schemas.WorkspaceInvite>;
|
1388
1392
|
cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>;
|
1389
1393
|
resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>;
|
1390
1394
|
acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>;
|
@@ -1420,7 +1424,9 @@ export declare const operationsByTag: {
|
|
1420
1424
|
};
|
1421
1425
|
records: {
|
1422
1426
|
insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>;
|
1423
|
-
insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<
|
1427
|
+
insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
|
1428
|
+
updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
|
1429
|
+
upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>;
|
1424
1430
|
deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>;
|
1425
1431
|
getRecord: (variables: GetRecordVariables) => Promise<Schemas.XataRecord>;
|
1426
1432
|
bulkInsertTableRecords: (variables: BulkInsertTableRecordsVariables) => Promise<BulkInsertTableRecordsResponse>;
|
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,12 +83,6 @@ 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;
|
85
|
-
/**
|
86
|
-
* This operation provides a way to update an invite.
|
87
|
-
* The role can be updated while the email cannot.
|
88
|
-
*/
|
89
|
-
const updateWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}', method: 'patch' }, variables));
|
90
|
-
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite;
|
91
86
|
/**
|
92
87
|
* This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted.
|
93
88
|
*/
|
@@ -222,6 +217,10 @@ exports.insertRecord = insertRecord;
|
|
222
217
|
*/
|
223
218
|
const insertRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'put' }, variables));
|
224
219
|
exports.insertRecordWithID = insertRecordWithID;
|
220
|
+
const updateRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'patch' }, variables));
|
221
|
+
exports.updateRecordWithID = updateRecordWithID;
|
222
|
+
const upsertRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'post' }, variables));
|
223
|
+
exports.upsertRecordWithID = upsertRecordWithID;
|
225
224
|
const deleteRecord = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'delete' }, variables));
|
226
225
|
exports.deleteRecord = deleteRecord;
|
227
226
|
/**
|
@@ -459,7 +458,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
459
458
|
* `$none`, etc.
|
460
459
|
*
|
461
460
|
* All operators start with an `$` to differentiate them from column names
|
462
|
-
* (which are not allowed to start with an
|
461
|
+
* (which are not allowed to start with an dollar sign).
|
463
462
|
*
|
464
463
|
* #### Exact matching and control operators
|
465
464
|
*
|
@@ -527,27 +526,17 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
527
526
|
* }
|
528
527
|
* ```
|
529
528
|
*
|
530
|
-
* If you want to OR together multiple values, you can use an array of values:
|
531
|
-
*
|
532
|
-
* ```json
|
533
|
-
* {
|
534
|
-
* "filter": {
|
535
|
-
* "settings.plan": ["free", "paid"]
|
536
|
-
* },
|
537
|
-
* }
|
538
|
-
* ```
|
539
|
-
*
|
540
|
-
* Same query with `$is` operator:
|
529
|
+
* If you want to OR together multiple values, you can use the `$any` operator with an array of values:
|
541
530
|
*
|
542
531
|
* ```json
|
543
532
|
* {
|
544
533
|
* "filter": {
|
545
|
-
* "settings.plan": {
|
534
|
+
* "settings.plan": {"$any": ["free", "paid"]}
|
546
535
|
* },
|
547
536
|
* }
|
548
537
|
* ```
|
549
538
|
*
|
550
|
-
*
|
539
|
+
* If you specify multiple columns in the same filter, they are logically AND'ed together:
|
551
540
|
*
|
552
541
|
* ```json
|
553
542
|
* {
|
@@ -558,6 +547,8 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
558
547
|
* }
|
559
548
|
* ```
|
560
549
|
*
|
550
|
+
* The above matches if both conditions are met.
|
551
|
+
*
|
561
552
|
* To be more explicit about it, you can use `$all` or `$any`:
|
562
553
|
*
|
563
554
|
* ```json
|
@@ -565,13 +556,13 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
565
556
|
* "filter": {
|
566
557
|
* "$any": {
|
567
558
|
* "settings.dark": true,
|
568
|
-
* "settings.plan": "free"
|
559
|
+
* "settings.plan": "free"
|
569
560
|
* }
|
570
561
|
* },
|
571
562
|
* }
|
572
563
|
* ```
|
573
564
|
*
|
574
|
-
* `$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:
|
575
566
|
*
|
576
567
|
* ```json
|
577
568
|
* {
|
@@ -614,7 +605,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
614
605
|
* }
|
615
606
|
* ```
|
616
607
|
*
|
617
|
-
*
|
608
|
+
* Or you can use the inverse operator `$notExists`:
|
618
609
|
*
|
619
610
|
* ```json
|
620
611
|
* {
|
@@ -667,7 +658,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
667
658
|
* }
|
668
659
|
* ```
|
669
660
|
*
|
670
|
-
* #### Numeric
|
661
|
+
* #### Numeric ranges
|
671
662
|
*
|
672
663
|
* ```json
|
673
664
|
* {
|
@@ -682,18 +673,6 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
682
673
|
*
|
683
674
|
* The supported operators are `$gt`, `$lt`, `$ge`, `$le`.
|
684
675
|
*
|
685
|
-
* Date ranges would support the same operators, with the date as string in RFC 3339:
|
686
|
-
*
|
687
|
-
* ```json
|
688
|
-
* {
|
689
|
-
* "filter": {
|
690
|
-
* "<column_name>": {
|
691
|
-
* "$gt": "2019-10-12T07:20:50.52Z",
|
692
|
-
* "$lt": "2021-10-12T07:20:50.52Z"
|
693
|
-
* }
|
694
|
-
* }
|
695
|
-
* }
|
696
|
-
* ```
|
697
676
|
*
|
698
677
|
* #### Negations
|
699
678
|
*
|
@@ -746,7 +725,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
746
725
|
* }
|
747
726
|
* ```
|
748
727
|
*
|
749
|
-
* In addition,
|
728
|
+
* In addition, you can use operators like `$isNot` or `$notExists` to simplify expressions:
|
750
729
|
*
|
751
730
|
* ```json
|
752
731
|
* {
|
@@ -797,6 +776,22 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
797
776
|
* predicate. The `$includes` operator is a synonym for the `$includesAny`
|
798
777
|
* operator.
|
799
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
|
+
*
|
800
795
|
* ### Sorting
|
801
796
|
*
|
802
797
|
* Sorting by one element:
|
@@ -943,7 +938,7 @@ exports.bulkInsertTableRecords = bulkInsertTableRecords;
|
|
943
938
|
const queryTable = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/query', method: 'post' }, variables));
|
944
939
|
exports.queryTable = queryTable;
|
945
940
|
/**
|
946
|
-
* Run a free text search operation across the
|
941
|
+
* Run a free text search operation across the database branch.
|
947
942
|
*/
|
948
943
|
const searchBranch = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/search', method: 'post' }, variables));
|
949
944
|
exports.searchBranch = searchBranch;
|
@@ -959,7 +954,6 @@ exports.operationsByTag = {
|
|
959
954
|
updateWorkspaceMemberRole: exports.updateWorkspaceMemberRole,
|
960
955
|
removeWorkspaceMember: exports.removeWorkspaceMember,
|
961
956
|
inviteWorkspaceMember: exports.inviteWorkspaceMember,
|
962
|
-
updateWorkspaceMemberInvite: exports.updateWorkspaceMemberInvite,
|
963
957
|
cancelWorkspaceMemberInvite: exports.cancelWorkspaceMemberInvite,
|
964
958
|
resendWorkspaceMemberInvite: exports.resendWorkspaceMemberInvite,
|
965
959
|
acceptWorkspaceMemberInvite: exports.acceptWorkspaceMemberInvite
|
@@ -992,6 +986,8 @@ exports.operationsByTag = {
|
|
992
986
|
records: {
|
993
987
|
insertRecord: exports.insertRecord,
|
994
988
|
insertRecordWithID: exports.insertRecordWithID,
|
989
|
+
updateRecordWithID: exports.updateRecordWithID,
|
990
|
+
upsertRecordWithID: exports.upsertRecordWithID,
|
995
991
|
deleteRecord: exports.deleteRecord,
|
996
992
|
getRecord: exports.getRecord,
|
997
993
|
bulkInsertTableRecords: exports.bulkInsertTableRecords,
|
package/dist/api/fetcher.d.ts
CHANGED
@@ -7,9 +7,10 @@ export declare type FetchImpl = (url: string, init?: {
|
|
7
7
|
status: number;
|
8
8
|
json(): Promise<any>;
|
9
9
|
}>;
|
10
|
+
export declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
|
10
11
|
export declare type FetcherExtraProps = {
|
11
12
|
apiUrl: string;
|
12
|
-
workspacesApiUrl: string;
|
13
|
+
workspacesApiUrl: string | WorkspaceApiUrlBuilder;
|
13
14
|
fetchImpl: FetchImpl;
|
14
15
|
apiKey: string;
|
15
16
|
};
|
@@ -21,4 +22,4 @@ export declare type FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> =
|
|
21
22
|
queryParams?: TQueryParams;
|
22
23
|
pathParams?: TPathParams;
|
23
24
|
};
|
24
|
-
export declare function fetch<TData, TBody extends Record<string, unknown> | undefined, THeaders extends Record<string, unknown>, TQueryParams extends Record<string, unknown>, TPathParams extends Record<string, string>>({ url, method, body, headers, pathParams, queryParams, fetchImpl, apiKey, apiUrl, workspacesApiUrl }: FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> & FetcherExtraProps): Promise<TData>;
|
25
|
+
export declare function fetch<TData, TBody extends Record<string, unknown> | undefined, THeaders extends Record<string, unknown>, TQueryParams extends Record<string, unknown>, TPathParams extends Record<string, string>>({ url: path, method, body, headers, pathParams, queryParams, fetchImpl, apiKey, apiUrl, workspacesApiUrl }: FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> & FetcherExtraProps): Promise<TData>;
|