@xata.io/client 0.0.0-beta.c9e08d0 → 0.0.0-beta.ca9389a
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 +87 -0
- package/dist/api/client.d.ts +95 -0
- package/dist/api/client.js +251 -0
- package/dist/api/components.d.ts +1437 -0
- package/dist/api/components.js +998 -0
- package/dist/api/fetcher.d.ts +40 -0
- package/dist/api/fetcher.js +79 -0
- package/dist/api/index.d.ts +7 -0
- package/dist/api/index.js +21 -0
- package/dist/api/parameters.d.ts +16 -0
- package/dist/api/parameters.js +2 -0
- package/dist/api/providers.d.ts +8 -0
- package/dist/api/providers.js +30 -0
- package/dist/api/responses.d.ts +50 -0
- package/dist/api/responses.js +2 -0
- package/dist/api/schemas.d.ts +311 -0
- package/dist/api/schemas.js +2 -0
- package/dist/client.d.ts +39 -0
- package/dist/client.js +124 -0
- package/dist/index.d.ts +5 -182
- package/dist/index.js +19 -499
- package/dist/namespace.d.ts +7 -0
- package/dist/namespace.js +6 -0
- package/dist/schema/filters.d.ts +96 -0
- package/dist/schema/filters.js +2 -0
- package/dist/schema/filters.spec.d.ts +1 -0
- package/dist/schema/filters.spec.js +177 -0
- package/dist/schema/index.d.ts +21 -0
- package/dist/schema/index.js +49 -0
- package/dist/schema/operators.d.ts +74 -0
- package/dist/schema/operators.js +93 -0
- package/dist/schema/pagination.d.ts +83 -0
- package/dist/schema/pagination.js +93 -0
- package/dist/schema/query.d.ts +118 -0
- package/dist/schema/query.js +242 -0
- package/dist/schema/record.d.ts +66 -0
- package/dist/schema/record.js +13 -0
- package/dist/schema/repository.d.ts +134 -0
- package/dist/schema/repository.js +284 -0
- package/dist/schema/selection.d.ts +25 -0
- package/dist/schema/selection.js +2 -0
- package/dist/schema/selection.spec.d.ts +1 -0
- package/dist/schema/selection.spec.js +204 -0
- package/dist/schema/sorting.d.ts +17 -0
- package/dist/schema/sorting.js +28 -0
- package/dist/schema/sorting.spec.d.ts +1 -0
- package/dist/schema/sorting.spec.js +11 -0
- package/dist/search/index.d.ts +20 -0
- package/dist/search/index.js +30 -0
- package/dist/util/branches.d.ts +5 -0
- package/dist/util/branches.js +7 -0
- package/dist/util/config.d.ts +11 -0
- package/dist/util/config.js +121 -0
- package/dist/util/environment.d.ts +5 -0
- package/dist/util/environment.js +68 -0
- package/dist/util/fetch.d.ts +2 -0
- package/dist/util/fetch.js +13 -0
- package/dist/util/lang.d.ts +5 -0
- package/dist/util/lang.js +22 -0
- package/dist/util/types.d.ts +25 -0
- package/dist/util/types.js +2 -0
- package/package.json +5 -2
- package/tsconfig.json +21 -0
- package/dist/util/errors.d.ts +0 -3
- package/dist/util/errors.js +0 -9
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,87 @@
|
|
1
|
+
# @xata.io/client
|
2
|
+
|
3
|
+
## 0.8.0
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- bde908e: Refactor client builder
|
8
|
+
- ea3eef8: Make records returned by the API readonly
|
9
|
+
|
10
|
+
## 0.7.2
|
11
|
+
|
12
|
+
### Patch Changes
|
13
|
+
|
14
|
+
- 4803b6f: Memoize ApiClient namespaces
|
15
|
+
- 1f268d7: Add search in XataClient
|
16
|
+
- d58c3d9: Hide private helper utilities
|
17
|
+
- f3b731b: Expose branch resolution API
|
18
|
+
|
19
|
+
## 0.7.1
|
20
|
+
|
21
|
+
### Patch Changes
|
22
|
+
|
23
|
+
- 01aef78: Fix bundle for browsers
|
24
|
+
- 56be1fd: Allow sending updates with link object
|
25
|
+
- fc51771: Add includes operator helper methods
|
26
|
+
|
27
|
+
## 0.7.0
|
28
|
+
|
29
|
+
### Minor Changes
|
30
|
+
|
31
|
+
- 6ce5512: Add bulk operations for all methods
|
32
|
+
- 2a1fa4f: Introduced automatic branch resolution mechanism
|
33
|
+
|
34
|
+
### Patch Changes
|
35
|
+
|
36
|
+
- d033f3a: Improve column selection output type with non-nullable columns
|
37
|
+
- b1e92db: Include stack trace with errors
|
38
|
+
- deed570: Improve sorting with multiple properties
|
39
|
+
- 80b5417: Improve filtering types
|
40
|
+
|
41
|
+
## 0.6.0
|
42
|
+
|
43
|
+
### Minor Changes
|
44
|
+
|
45
|
+
- 084f5df: Add type inference for columns
|
46
|
+
- bb73c89: Unify create and insert in a single method overload
|
47
|
+
|
48
|
+
### Patch Changes
|
49
|
+
|
50
|
+
- 716c487: Forward nullable types on links
|
51
|
+
- bb66bb2: Fix error handling with createMany
|
52
|
+
- 084f5df: Fix circular dependencies on selectable column
|
53
|
+
|
54
|
+
## 0.5.1
|
55
|
+
|
56
|
+
### Patch Changes
|
57
|
+
|
58
|
+
- 12729ab: Make API client fetch implementation optional
|
59
|
+
|
60
|
+
## 0.5.0
|
61
|
+
|
62
|
+
### Patch Changes
|
63
|
+
|
64
|
+
- 14ec7d1: Fix in Selectable type
|
65
|
+
|
66
|
+
## 0.4.0
|
67
|
+
|
68
|
+
### Patch Changes
|
69
|
+
|
70
|
+
- b951331: Add support for new float column
|
71
|
+
- d470610: Add new getAll() method
|
72
|
+
- eaf92a8: Expose pagination constants (size and offset limits)
|
73
|
+
- 57fde77: Reduce subrequests for createMany
|
74
|
+
- eaf92a8: Implement schema-less client
|
75
|
+
- 97a3caa: Make createBranch from optional with empty branch
|
76
|
+
|
77
|
+
## 0.3.0
|
78
|
+
|
79
|
+
### Minor Changes
|
80
|
+
|
81
|
+
- 1c0a454: Add API Client and internally use it
|
82
|
+
|
83
|
+
### Patch Changes
|
84
|
+
|
85
|
+
- 122321c: Fix client in CF workers and Deno
|
86
|
+
- a2671b5: Allow cancel or resend workspace invites
|
87
|
+
- e73d470: Split insert and create
|
@@ -0,0 +1,95 @@
|
|
1
|
+
import type * as Types from './components';
|
2
|
+
import type { FetcherExtraProps, FetchImpl } from './fetcher';
|
3
|
+
import { HostProvider } from './providers';
|
4
|
+
import type * as Responses from './responses';
|
5
|
+
import type * as Schemas from './schemas';
|
6
|
+
export interface XataApiClientOptions {
|
7
|
+
fetch?: FetchImpl;
|
8
|
+
apiKey?: string;
|
9
|
+
host?: HostProvider;
|
10
|
+
}
|
11
|
+
export declare class XataApiClient {
|
12
|
+
#private;
|
13
|
+
constructor(options: XataApiClientOptions);
|
14
|
+
get user(): UserApi;
|
15
|
+
get workspaces(): WorkspaceApi;
|
16
|
+
get databases(): DatabaseApi;
|
17
|
+
get branches(): BranchApi;
|
18
|
+
get tables(): TableApi;
|
19
|
+
get records(): RecordsApi;
|
20
|
+
}
|
21
|
+
declare class UserApi {
|
22
|
+
private extraProps;
|
23
|
+
constructor(extraProps: FetcherExtraProps);
|
24
|
+
getUser(): Promise<Schemas.UserWithID>;
|
25
|
+
updateUser(user: Schemas.User): Promise<Schemas.UserWithID>;
|
26
|
+
deleteUser(): Promise<void>;
|
27
|
+
getUserAPIKeys(): Promise<Types.GetUserAPIKeysResponse>;
|
28
|
+
createUserAPIKey(keyName: Schemas.APIKeyName): Promise<Types.CreateUserAPIKeyResponse>;
|
29
|
+
deleteUserAPIKey(keyName: Schemas.APIKeyName): Promise<void>;
|
30
|
+
}
|
31
|
+
declare class WorkspaceApi {
|
32
|
+
private extraProps;
|
33
|
+
constructor(extraProps: FetcherExtraProps);
|
34
|
+
createWorkspace(workspaceMeta: Schemas.WorkspaceMeta): Promise<Schemas.Workspace>;
|
35
|
+
getWorkspacesList(): Promise<Types.GetWorkspacesListResponse>;
|
36
|
+
getWorkspace(workspaceId: Schemas.WorkspaceID): Promise<Schemas.Workspace>;
|
37
|
+
updateWorkspace(workspaceId: Schemas.WorkspaceID, workspaceMeta: Schemas.WorkspaceMeta): Promise<Schemas.Workspace>;
|
38
|
+
deleteWorkspace(workspaceId: Schemas.WorkspaceID): Promise<void>;
|
39
|
+
getWorkspaceMembersList(workspaceId: Schemas.WorkspaceID): Promise<Schemas.WorkspaceMembers>;
|
40
|
+
updateWorkspaceMemberRole(workspaceId: Schemas.WorkspaceID, userId: Schemas.UserID, role: Schemas.Role): Promise<void>;
|
41
|
+
removeWorkspaceMember(workspaceId: Schemas.WorkspaceID, userId: Schemas.UserID): Promise<void>;
|
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>;
|
45
|
+
acceptWorkspaceMemberInvite(workspaceId: Schemas.WorkspaceID, inviteKey: Schemas.InviteKey): Promise<void>;
|
46
|
+
}
|
47
|
+
declare class DatabaseApi {
|
48
|
+
private extraProps;
|
49
|
+
constructor(extraProps: FetcherExtraProps);
|
50
|
+
getDatabaseList(workspace: Schemas.WorkspaceID): Promise<Schemas.ListDatabasesResponse>;
|
51
|
+
createDatabase(workspace: Schemas.WorkspaceID, dbName: Schemas.DBName, options?: Types.CreateDatabaseRequestBody): Promise<Types.CreateDatabaseResponse>;
|
52
|
+
deleteDatabase(workspace: Schemas.WorkspaceID, dbName: Schemas.DBName): Promise<void>;
|
53
|
+
}
|
54
|
+
declare class BranchApi {
|
55
|
+
private extraProps;
|
56
|
+
constructor(extraProps: FetcherExtraProps);
|
57
|
+
getBranchList(workspace: Schemas.WorkspaceID, dbName: Schemas.DBName): Promise<Schemas.ListBranchesResponse>;
|
58
|
+
getBranchDetails(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName): Promise<Schemas.DBBranch>;
|
59
|
+
createBranch(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, from?: string, options?: Types.CreateBranchRequestBody): Promise<void>;
|
60
|
+
deleteBranch(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName): Promise<void>;
|
61
|
+
updateBranchMetadata(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, metadata?: Schemas.BranchMetadata): Promise<void>;
|
62
|
+
getBranchMetadata(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName): Promise<Schemas.BranchMetadata>;
|
63
|
+
getBranchMigrationHistory(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, options?: Types.GetBranchMigrationHistoryRequestBody): Promise<Types.GetBranchMigrationHistoryResponse>;
|
64
|
+
executeBranchMigrationPlan(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, migrationPlan: Types.ExecuteBranchMigrationPlanRequestBody): Promise<void>;
|
65
|
+
getBranchMigrationPlan(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, schema: Schemas.Schema): Promise<Responses.BranchMigrationPlan>;
|
66
|
+
getBranchStats(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName): Promise<Types.GetBranchStatsResponse>;
|
67
|
+
}
|
68
|
+
declare class TableApi {
|
69
|
+
private extraProps;
|
70
|
+
constructor(extraProps: FetcherExtraProps);
|
71
|
+
createTable(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName): Promise<void>;
|
72
|
+
deleteTable(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName): Promise<void>;
|
73
|
+
updateTable(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, options: Types.UpdateTableRequestBody): Promise<void>;
|
74
|
+
getTableSchema(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName): Promise<Types.GetTableSchemaResponse>;
|
75
|
+
setTableSchema(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, options: Types.SetTableSchemaRequestBody): Promise<void>;
|
76
|
+
getTableColumns(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName): Promise<Types.GetTableColumnsResponse>;
|
77
|
+
addTableColumn(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, column: Schemas.Column): Promise<Responses.MigrationIdResponse>;
|
78
|
+
getColumn(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, columnName: Schemas.ColumnName): Promise<Schemas.Column>;
|
79
|
+
deleteColumn(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, columnName: Schemas.ColumnName): Promise<Responses.MigrationIdResponse>;
|
80
|
+
updateColumn(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, columnName: Schemas.ColumnName, options: Types.UpdateColumnRequestBody): Promise<Responses.MigrationIdResponse>;
|
81
|
+
}
|
82
|
+
declare class RecordsApi {
|
83
|
+
private extraProps;
|
84
|
+
constructor(extraProps: FetcherExtraProps);
|
85
|
+
insertRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, record: Record<string, any>): Promise<Types.InsertRecordResponse>;
|
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>;
|
89
|
+
deleteRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID): Promise<void>;
|
90
|
+
getRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, options?: Types.GetRecordRequestBody): Promise<Schemas.XataRecord>;
|
91
|
+
bulkInsertTableRecords(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, records: Record<string, any>[]): Promise<Types.BulkInsertTableRecordsResponse>;
|
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>;
|
94
|
+
}
|
95
|
+
export {};
|
@@ -0,0 +1,251 @@
|
|
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, _XataApiClient_namespaces;
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
15
|
+
exports.XataApiClient = void 0;
|
16
|
+
const config_1 = require("../util/config");
|
17
|
+
const fetch_1 = require("../util/fetch");
|
18
|
+
const components_1 = require("./components");
|
19
|
+
const providers_1 = require("./providers");
|
20
|
+
class XataApiClient {
|
21
|
+
constructor(options) {
|
22
|
+
var _a, _b;
|
23
|
+
_XataApiClient_extraProps.set(this, void 0);
|
24
|
+
_XataApiClient_namespaces.set(this, {});
|
25
|
+
const provider = (_a = options.host) !== null && _a !== void 0 ? _a : 'production';
|
26
|
+
const apiKey = (_b = options === null || options === void 0 ? void 0 : options.apiKey) !== null && _b !== void 0 ? _b : (0, config_1.getAPIKey)();
|
27
|
+
if (!apiKey) {
|
28
|
+
throw new Error('Could not resolve a valid apiKey');
|
29
|
+
}
|
30
|
+
__classPrivateFieldSet(this, _XataApiClient_extraProps, {
|
31
|
+
apiUrl: (0, providers_1.getHostUrl)(provider, 'main'),
|
32
|
+
workspacesApiUrl: (0, providers_1.getHostUrl)(provider, 'workspaces'),
|
33
|
+
fetchImpl: (0, fetch_1.getFetchImplementation)(options.fetch),
|
34
|
+
apiKey
|
35
|
+
}, "f");
|
36
|
+
}
|
37
|
+
get user() {
|
38
|
+
if (!__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").user)
|
39
|
+
__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").user = new UserApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
40
|
+
return __classPrivateFieldGet(this, _XataApiClient_namespaces, "f").user;
|
41
|
+
}
|
42
|
+
get workspaces() {
|
43
|
+
if (!__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").workspaces)
|
44
|
+
__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").workspaces = new WorkspaceApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
45
|
+
return __classPrivateFieldGet(this, _XataApiClient_namespaces, "f").workspaces;
|
46
|
+
}
|
47
|
+
get databases() {
|
48
|
+
if (!__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").databases)
|
49
|
+
__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").databases = new DatabaseApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
50
|
+
return __classPrivateFieldGet(this, _XataApiClient_namespaces, "f").databases;
|
51
|
+
}
|
52
|
+
get branches() {
|
53
|
+
if (!__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").branches)
|
54
|
+
__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").branches = new BranchApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
55
|
+
return __classPrivateFieldGet(this, _XataApiClient_namespaces, "f").branches;
|
56
|
+
}
|
57
|
+
get tables() {
|
58
|
+
if (!__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").tables)
|
59
|
+
__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").tables = new TableApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
60
|
+
return __classPrivateFieldGet(this, _XataApiClient_namespaces, "f").tables;
|
61
|
+
}
|
62
|
+
get records() {
|
63
|
+
if (!__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").records)
|
64
|
+
__classPrivateFieldGet(this, _XataApiClient_namespaces, "f").records = new RecordsApi(__classPrivateFieldGet(this, _XataApiClient_extraProps, "f"));
|
65
|
+
return __classPrivateFieldGet(this, _XataApiClient_namespaces, "f").records;
|
66
|
+
}
|
67
|
+
}
|
68
|
+
exports.XataApiClient = XataApiClient;
|
69
|
+
_XataApiClient_extraProps = new WeakMap(), _XataApiClient_namespaces = new WeakMap();
|
70
|
+
class UserApi {
|
71
|
+
constructor(extraProps) {
|
72
|
+
this.extraProps = extraProps;
|
73
|
+
}
|
74
|
+
getUser() {
|
75
|
+
return components_1.operationsByTag.users.getUser(Object.assign({}, this.extraProps));
|
76
|
+
}
|
77
|
+
updateUser(user) {
|
78
|
+
return components_1.operationsByTag.users.updateUser(Object.assign({ body: user }, this.extraProps));
|
79
|
+
}
|
80
|
+
deleteUser() {
|
81
|
+
return components_1.operationsByTag.users.deleteUser(Object.assign({}, this.extraProps));
|
82
|
+
}
|
83
|
+
getUserAPIKeys() {
|
84
|
+
return components_1.operationsByTag.users.getUserAPIKeys(Object.assign({}, this.extraProps));
|
85
|
+
}
|
86
|
+
createUserAPIKey(keyName) {
|
87
|
+
return components_1.operationsByTag.users.createUserAPIKey(Object.assign({ pathParams: { keyName } }, this.extraProps));
|
88
|
+
}
|
89
|
+
deleteUserAPIKey(keyName) {
|
90
|
+
return components_1.operationsByTag.users.deleteUserAPIKey(Object.assign({ pathParams: { keyName } }, this.extraProps));
|
91
|
+
}
|
92
|
+
}
|
93
|
+
class WorkspaceApi {
|
94
|
+
constructor(extraProps) {
|
95
|
+
this.extraProps = extraProps;
|
96
|
+
}
|
97
|
+
createWorkspace(workspaceMeta) {
|
98
|
+
return components_1.operationsByTag.workspaces.createWorkspace(Object.assign({ body: workspaceMeta }, this.extraProps));
|
99
|
+
}
|
100
|
+
getWorkspacesList() {
|
101
|
+
return components_1.operationsByTag.workspaces.getWorkspacesList(Object.assign({}, this.extraProps));
|
102
|
+
}
|
103
|
+
getWorkspace(workspaceId) {
|
104
|
+
return components_1.operationsByTag.workspaces.getWorkspace(Object.assign({ pathParams: { workspaceId } }, this.extraProps));
|
105
|
+
}
|
106
|
+
updateWorkspace(workspaceId, workspaceMeta) {
|
107
|
+
return components_1.operationsByTag.workspaces.updateWorkspace(Object.assign({ pathParams: { workspaceId }, body: workspaceMeta }, this.extraProps));
|
108
|
+
}
|
109
|
+
deleteWorkspace(workspaceId) {
|
110
|
+
return components_1.operationsByTag.workspaces.deleteWorkspace(Object.assign({ pathParams: { workspaceId } }, this.extraProps));
|
111
|
+
}
|
112
|
+
getWorkspaceMembersList(workspaceId) {
|
113
|
+
return components_1.operationsByTag.workspaces.getWorkspaceMembersList(Object.assign({ pathParams: { workspaceId } }, this.extraProps));
|
114
|
+
}
|
115
|
+
updateWorkspaceMemberRole(workspaceId, userId, role) {
|
116
|
+
return components_1.operationsByTag.workspaces.updateWorkspaceMemberRole(Object.assign({ pathParams: { workspaceId, userId }, body: { role } }, this.extraProps));
|
117
|
+
}
|
118
|
+
removeWorkspaceMember(workspaceId, userId) {
|
119
|
+
return components_1.operationsByTag.workspaces.removeWorkspaceMember(Object.assign({ pathParams: { workspaceId, userId } }, this.extraProps));
|
120
|
+
}
|
121
|
+
inviteWorkspaceMember(workspaceId, email, role) {
|
122
|
+
return components_1.operationsByTag.workspaces.inviteWorkspaceMember(Object.assign({ pathParams: { workspaceId }, body: { email, role } }, this.extraProps));
|
123
|
+
}
|
124
|
+
cancelWorkspaceMemberInvite(workspaceId, inviteId) {
|
125
|
+
return components_1.operationsByTag.workspaces.cancelWorkspaceMemberInvite(Object.assign({ pathParams: { workspaceId, inviteId } }, this.extraProps));
|
126
|
+
}
|
127
|
+
resendWorkspaceMemberInvite(workspaceId, inviteId) {
|
128
|
+
return components_1.operationsByTag.workspaces.resendWorkspaceMemberInvite(Object.assign({ pathParams: { workspaceId, inviteId } }, this.extraProps));
|
129
|
+
}
|
130
|
+
acceptWorkspaceMemberInvite(workspaceId, inviteKey) {
|
131
|
+
return components_1.operationsByTag.workspaces.acceptWorkspaceMemberInvite(Object.assign({ pathParams: { workspaceId, inviteKey } }, this.extraProps));
|
132
|
+
}
|
133
|
+
}
|
134
|
+
class DatabaseApi {
|
135
|
+
constructor(extraProps) {
|
136
|
+
this.extraProps = extraProps;
|
137
|
+
}
|
138
|
+
getDatabaseList(workspace) {
|
139
|
+
return components_1.operationsByTag.database.getDatabaseList(Object.assign({ pathParams: { workspace } }, this.extraProps));
|
140
|
+
}
|
141
|
+
createDatabase(workspace, dbName, options = {}) {
|
142
|
+
return components_1.operationsByTag.database.createDatabase(Object.assign({ pathParams: { workspace, dbName }, body: options }, this.extraProps));
|
143
|
+
}
|
144
|
+
deleteDatabase(workspace, dbName) {
|
145
|
+
return components_1.operationsByTag.database.deleteDatabase(Object.assign({ pathParams: { workspace, dbName } }, this.extraProps));
|
146
|
+
}
|
147
|
+
}
|
148
|
+
class BranchApi {
|
149
|
+
constructor(extraProps) {
|
150
|
+
this.extraProps = extraProps;
|
151
|
+
}
|
152
|
+
getBranchList(workspace, dbName) {
|
153
|
+
return components_1.operationsByTag.branch.getBranchList(Object.assign({ pathParams: { workspace, dbName } }, this.extraProps));
|
154
|
+
}
|
155
|
+
getBranchDetails(workspace, database, branch) {
|
156
|
+
return components_1.operationsByTag.branch.getBranchDetails(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` } }, this.extraProps));
|
157
|
+
}
|
158
|
+
createBranch(workspace, database, branch, from = '', options = {}) {
|
159
|
+
return components_1.operationsByTag.branch.createBranch(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, queryParams: { from }, body: options }, this.extraProps));
|
160
|
+
}
|
161
|
+
deleteBranch(workspace, database, branch) {
|
162
|
+
return components_1.operationsByTag.branch.deleteBranch(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` } }, this.extraProps));
|
163
|
+
}
|
164
|
+
updateBranchMetadata(workspace, database, branch, metadata = {}) {
|
165
|
+
return components_1.operationsByTag.branch.updateBranchMetadata(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, body: metadata }, this.extraProps));
|
166
|
+
}
|
167
|
+
getBranchMetadata(workspace, database, branch) {
|
168
|
+
return components_1.operationsByTag.branch.getBranchMetadata(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` } }, this.extraProps));
|
169
|
+
}
|
170
|
+
getBranchMigrationHistory(workspace, database, branch, options = {}) {
|
171
|
+
return components_1.operationsByTag.branch.getBranchMigrationHistory(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, body: options }, this.extraProps));
|
172
|
+
}
|
173
|
+
executeBranchMigrationPlan(workspace, database, branch, migrationPlan) {
|
174
|
+
return components_1.operationsByTag.branch.executeBranchMigrationPlan(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, body: migrationPlan }, this.extraProps));
|
175
|
+
}
|
176
|
+
getBranchMigrationPlan(workspace, database, branch, schema) {
|
177
|
+
return components_1.operationsByTag.branch.getBranchMigrationPlan(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, body: schema }, this.extraProps));
|
178
|
+
}
|
179
|
+
getBranchStats(workspace, database, branch) {
|
180
|
+
return components_1.operationsByTag.branch.getBranchStats(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` } }, this.extraProps));
|
181
|
+
}
|
182
|
+
}
|
183
|
+
class TableApi {
|
184
|
+
constructor(extraProps) {
|
185
|
+
this.extraProps = extraProps;
|
186
|
+
}
|
187
|
+
createTable(workspace, database, branch, tableName) {
|
188
|
+
return components_1.operationsByTag.table.createTable(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName } }, this.extraProps));
|
189
|
+
}
|
190
|
+
deleteTable(workspace, database, branch, tableName) {
|
191
|
+
return components_1.operationsByTag.table.deleteTable(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName } }, this.extraProps));
|
192
|
+
}
|
193
|
+
updateTable(workspace, database, branch, tableName, options) {
|
194
|
+
return components_1.operationsByTag.table.updateTable(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName }, body: options }, this.extraProps));
|
195
|
+
}
|
196
|
+
getTableSchema(workspace, database, branch, tableName) {
|
197
|
+
return components_1.operationsByTag.table.getTableSchema(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName } }, this.extraProps));
|
198
|
+
}
|
199
|
+
setTableSchema(workspace, database, branch, tableName, options) {
|
200
|
+
return components_1.operationsByTag.table.setTableSchema(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName }, body: options }, this.extraProps));
|
201
|
+
}
|
202
|
+
getTableColumns(workspace, database, branch, tableName) {
|
203
|
+
return components_1.operationsByTag.table.getTableColumns(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName } }, this.extraProps));
|
204
|
+
}
|
205
|
+
addTableColumn(workspace, database, branch, tableName, column) {
|
206
|
+
return components_1.operationsByTag.table.addTableColumn(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName }, body: column }, this.extraProps));
|
207
|
+
}
|
208
|
+
getColumn(workspace, database, branch, tableName, columnName) {
|
209
|
+
return components_1.operationsByTag.table.getColumn(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName } }, this.extraProps));
|
210
|
+
}
|
211
|
+
deleteColumn(workspace, database, branch, tableName, columnName) {
|
212
|
+
return components_1.operationsByTag.table.deleteColumn(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName } }, this.extraProps));
|
213
|
+
}
|
214
|
+
updateColumn(workspace, database, branch, tableName, columnName, options) {
|
215
|
+
return components_1.operationsByTag.table.updateColumn(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, columnName }, body: options }, this.extraProps));
|
216
|
+
}
|
217
|
+
}
|
218
|
+
class RecordsApi {
|
219
|
+
constructor(extraProps) {
|
220
|
+
this.extraProps = extraProps;
|
221
|
+
}
|
222
|
+
insertRecord(workspace, database, branch, tableName, record) {
|
223
|
+
return components_1.operationsByTag.records.insertRecord(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName }, body: record }, this.extraProps));
|
224
|
+
}
|
225
|
+
insertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
226
|
+
return components_1.operationsByTag.records.insertRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps));
|
227
|
+
}
|
228
|
+
updateRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
229
|
+
return components_1.operationsByTag.records.updateRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps));
|
230
|
+
}
|
231
|
+
upsertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) {
|
232
|
+
return components_1.operationsByTag.records.upsertRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps));
|
233
|
+
}
|
234
|
+
deleteRecord(workspace, database, branch, tableName, recordId) {
|
235
|
+
return components_1.operationsByTag.records.deleteRecord(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId } }, this.extraProps));
|
236
|
+
}
|
237
|
+
getRecord(workspace, database, branch, tableName, recordId,
|
238
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
239
|
+
options = {}) {
|
240
|
+
return components_1.operationsByTag.records.getRecord(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId } }, this.extraProps));
|
241
|
+
}
|
242
|
+
bulkInsertTableRecords(workspace, database, branch, tableName, records) {
|
243
|
+
return components_1.operationsByTag.records.bulkInsertTableRecords(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName }, body: { records } }, this.extraProps));
|
244
|
+
}
|
245
|
+
queryTable(workspace, database, branch, tableName, query) {
|
246
|
+
return components_1.operationsByTag.records.queryTable(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName }, body: query }, this.extraProps));
|
247
|
+
}
|
248
|
+
searchBranch(workspace, database, branch, query) {
|
249
|
+
return components_1.operationsByTag.records.searchBranch(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, body: query }, this.extraProps));
|
250
|
+
}
|
251
|
+
}
|