@xata.io/client 0.8.1 → 0.8.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/dist/index.cjs +1744 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +3246 -7
- package/dist/index.mjs +1649 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +9 -5
- package/rollup.config.js +29 -0
- package/tsconfig.json +5 -4
- package/dist/api/client.d.ts +0 -95
- package/dist/api/client.js +0 -251
- package/dist/api/components.d.ts +0 -1437
- package/dist/api/components.js +0 -998
- package/dist/api/fetcher.d.ts +0 -40
- package/dist/api/fetcher.js +0 -79
- package/dist/api/index.d.ts +0 -13
- package/dist/api/index.js +0 -40
- package/dist/api/parameters.d.ts +0 -16
- package/dist/api/parameters.js +0 -2
- package/dist/api/providers.d.ts +0 -8
- package/dist/api/providers.js +0 -30
- package/dist/api/responses.d.ts +0 -50
- package/dist/api/responses.js +0 -2
- package/dist/api/schemas.d.ts +0 -311
- package/dist/api/schemas.js +0 -2
- package/dist/client.d.ts +0 -27
- package/dist/client.js +0 -131
- package/dist/index.js +0 -30
- package/dist/plugins.d.ts +0 -7
- package/dist/plugins.js +0 -6
- package/dist/schema/filters.d.ts +0 -96
- package/dist/schema/filters.js +0 -2
- package/dist/schema/filters.spec.d.ts +0 -1
- package/dist/schema/filters.spec.js +0 -177
- package/dist/schema/index.d.ts +0 -23
- package/dist/schema/index.js +0 -50
- package/dist/schema/operators.d.ts +0 -74
- package/dist/schema/operators.js +0 -93
- package/dist/schema/pagination.d.ts +0 -83
- package/dist/schema/pagination.js +0 -93
- package/dist/schema/query.d.ts +0 -118
- package/dist/schema/query.js +0 -242
- package/dist/schema/record.d.ts +0 -66
- package/dist/schema/record.js +0 -13
- package/dist/schema/repository.d.ts +0 -135
- package/dist/schema/repository.js +0 -283
- package/dist/schema/selection.d.ts +0 -25
- package/dist/schema/selection.js +0 -2
- package/dist/schema/selection.spec.d.ts +0 -1
- package/dist/schema/selection.spec.js +0 -204
- package/dist/schema/sorting.d.ts +0 -22
- package/dist/schema/sorting.js +0 -35
- package/dist/schema/sorting.spec.d.ts +0 -1
- package/dist/schema/sorting.spec.js +0 -11
- package/dist/search/index.d.ts +0 -34
- package/dist/search/index.js +0 -55
- package/dist/util/branches.d.ts +0 -5
- package/dist/util/branches.js +0 -7
- package/dist/util/config.d.ts +0 -11
- package/dist/util/config.js +0 -121
- package/dist/util/environment.d.ts +0 -5
- package/dist/util/environment.js +0 -68
- package/dist/util/fetch.d.ts +0 -2
- package/dist/util/fetch.js +0 -13
- package/dist/util/lang.d.ts +0 -5
- package/dist/util/lang.js +0 -22
- package/dist/util/types.d.ts +0 -25
- package/dist/util/types.js +0 -2
package/dist/api/fetcher.d.ts
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
export declare type FetchImpl = (url: string, init?: {
|
2
|
-
body?: string;
|
3
|
-
headers?: Record<string, string>;
|
4
|
-
method?: string;
|
5
|
-
}) => Promise<{
|
6
|
-
ok: boolean;
|
7
|
-
status: number;
|
8
|
-
json(): Promise<any>;
|
9
|
-
}>;
|
10
|
-
export declare type WorkspaceApiUrlBuilder = (path: string, pathParams: Record<string, string>) => string;
|
11
|
-
export declare type FetcherExtraProps = {
|
12
|
-
apiUrl: string;
|
13
|
-
workspacesApiUrl: string | WorkspaceApiUrlBuilder;
|
14
|
-
fetchImpl: FetchImpl;
|
15
|
-
apiKey: string;
|
16
|
-
};
|
17
|
-
export declare type FetcherOptions<TBody, THeaders, TQueryParams, TPathParams> = {
|
18
|
-
url: string;
|
19
|
-
method: string;
|
20
|
-
body?: TBody;
|
21
|
-
headers?: THeaders;
|
22
|
-
queryParams?: TQueryParams;
|
23
|
-
pathParams?: TPathParams;
|
24
|
-
};
|
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>;
|
26
|
-
export declare class FetcherError extends Error {
|
27
|
-
status: number;
|
28
|
-
errors: Array<{
|
29
|
-
status: number;
|
30
|
-
message?: string;
|
31
|
-
}> | undefined;
|
32
|
-
constructor(data: {
|
33
|
-
message: string;
|
34
|
-
status: number;
|
35
|
-
errors?: Array<{
|
36
|
-
status: number;
|
37
|
-
message?: string;
|
38
|
-
}>;
|
39
|
-
}, parent?: Error);
|
40
|
-
}
|
package/dist/api/fetcher.js
DELETED
@@ -1,79 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
12
|
-
exports.FetcherError = exports.fetch = void 0;
|
13
|
-
const lang_1 = require("../util/lang");
|
14
|
-
const resolveUrl = (url, queryParams = {}, pathParams = {}) => {
|
15
|
-
const query = new URLSearchParams(queryParams).toString();
|
16
|
-
const queryString = query.length > 0 ? `?${query}` : '';
|
17
|
-
return url.replace(/\{\w*\}/g, (key) => pathParams[key.slice(1, -1)]) + queryString;
|
18
|
-
};
|
19
|
-
function buildBaseUrl({ path, workspacesApiUrl, apiUrl, pathParams }) {
|
20
|
-
if (!(pathParams === null || pathParams === void 0 ? void 0 : pathParams.workspace))
|
21
|
-
return `${apiUrl}${path}`;
|
22
|
-
const url = typeof workspacesApiUrl === 'string' ? `${workspacesApiUrl}${path}` : workspacesApiUrl(path, pathParams);
|
23
|
-
return url.replace('{workspaceId}', pathParams.workspace);
|
24
|
-
}
|
25
|
-
// The host header is needed by Node.js on localhost.
|
26
|
-
// It is ignored by fetch() in the frontend
|
27
|
-
function hostHeader(url) {
|
28
|
-
var _a;
|
29
|
-
const pattern = /.*:\/\/(?<host>[^/]+).*/;
|
30
|
-
const { groups } = (_a = pattern.exec(url)) !== null && _a !== void 0 ? _a : {};
|
31
|
-
return (groups === null || groups === void 0 ? void 0 : groups.host) ? { Host: groups.host } : {};
|
32
|
-
}
|
33
|
-
function fetch({ url: path, method, body, headers, pathParams, queryParams, fetchImpl, apiKey, apiUrl, workspacesApiUrl }) {
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
35
|
-
const baseUrl = buildBaseUrl({ path, workspacesApiUrl, pathParams, apiUrl });
|
36
|
-
const fullUrl = resolveUrl(baseUrl, queryParams, pathParams);
|
37
|
-
// Node.js on localhost won't resolve localhost subdomains unless mapped in /etc/hosts
|
38
|
-
// So, instead, we use localhost without subdomains, but will add a Host header
|
39
|
-
const url = fullUrl.includes('localhost') ? fullUrl.replace(/^[^.]+\./, 'http://') : fullUrl;
|
40
|
-
const response = yield fetchImpl(url, {
|
41
|
-
method: method.toUpperCase(),
|
42
|
-
body: body ? JSON.stringify(body) : undefined,
|
43
|
-
headers: Object.assign(Object.assign(Object.assign({ 'Content-Type': 'application/json' }, headers), hostHeader(fullUrl)), { Authorization: `Bearer ${apiKey}` })
|
44
|
-
});
|
45
|
-
// No content
|
46
|
-
if (response.status === 204) {
|
47
|
-
return {};
|
48
|
-
}
|
49
|
-
try {
|
50
|
-
const jsonResponse = yield response.json();
|
51
|
-
if (response.ok) {
|
52
|
-
return jsonResponse;
|
53
|
-
}
|
54
|
-
const { message = 'Unknown error', errors } = jsonResponse;
|
55
|
-
throw new FetcherError({ message, status: response.status, errors });
|
56
|
-
}
|
57
|
-
catch (error) {
|
58
|
-
const message = hasMessage(error) ? error.message : 'Unknown network error';
|
59
|
-
const parent = error instanceof Error ? error : undefined;
|
60
|
-
throw new FetcherError({ message, status: response.status }, parent);
|
61
|
-
}
|
62
|
-
});
|
63
|
-
}
|
64
|
-
exports.fetch = fetch;
|
65
|
-
const hasMessage = (error) => {
|
66
|
-
return (0, lang_1.isObject)(error) && (0, lang_1.isString)(error.message);
|
67
|
-
};
|
68
|
-
class FetcherError extends Error {
|
69
|
-
constructor(data, parent) {
|
70
|
-
super(data.message);
|
71
|
-
this.status = data.status;
|
72
|
-
this.errors = data.errors;
|
73
|
-
if (parent) {
|
74
|
-
this.stack = parent.stack;
|
75
|
-
this.cause = parent.cause;
|
76
|
-
}
|
77
|
-
}
|
78
|
-
}
|
79
|
-
exports.FetcherError = FetcherError;
|
package/dist/api/index.d.ts
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
import { XataPlugin, XataPluginOptions } from '../plugins';
|
2
|
-
import { XataApiClient } from './client';
|
3
|
-
import { operationsByTag } from './components';
|
4
|
-
import type * as Responses from './responses';
|
5
|
-
import type * as Schemas from './schemas';
|
6
|
-
export * from './client';
|
7
|
-
export * from './components';
|
8
|
-
export type { FetcherExtraProps, FetchImpl } from './fetcher';
|
9
|
-
export { operationsByTag as Operations };
|
10
|
-
export type { Responses, Schemas };
|
11
|
-
export declare class XataApiPlugin implements XataPlugin {
|
12
|
-
build(options: XataPluginOptions): Promise<XataApiClient>;
|
13
|
-
}
|
package/dist/api/index.js
DELETED
@@ -1,40 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
3
|
-
if (k2 === undefined) k2 = k;
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
7
|
-
}
|
8
|
-
Object.defineProperty(o, k2, desc);
|
9
|
-
}) : (function(o, m, k, k2) {
|
10
|
-
if (k2 === undefined) k2 = k;
|
11
|
-
o[k2] = m[k];
|
12
|
-
}));
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
15
|
-
};
|
16
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
17
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
18
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
19
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
20
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
21
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
22
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
23
|
-
});
|
24
|
-
};
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
26
|
-
exports.XataApiPlugin = exports.Operations = void 0;
|
27
|
-
const client_1 = require("./client");
|
28
|
-
const components_1 = require("./components");
|
29
|
-
Object.defineProperty(exports, "Operations", { enumerable: true, get: function () { return components_1.operationsByTag; } });
|
30
|
-
__exportStar(require("./client"), exports);
|
31
|
-
__exportStar(require("./components"), exports);
|
32
|
-
class XataApiPlugin {
|
33
|
-
build(options) {
|
34
|
-
return __awaiter(this, void 0, void 0, function* () {
|
35
|
-
const { fetchImpl, apiKey } = yield options.getFetchProps();
|
36
|
-
return new client_1.XataApiClient({ fetch: fetchImpl, apiKey });
|
37
|
-
});
|
38
|
-
}
|
39
|
-
}
|
40
|
-
exports.XataApiPlugin = XataApiPlugin;
|
package/dist/api/parameters.d.ts
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Generated by @openapi-codegen
|
3
|
-
*
|
4
|
-
* @version 1.0
|
5
|
-
*/
|
6
|
-
import type * as Schemas from './schemas';
|
7
|
-
export declare type APIKeyNameParam = Schemas.APIKeyName;
|
8
|
-
export declare type InviteIDParam = Schemas.InviteID;
|
9
|
-
export declare type InviteKeyParam = Schemas.InviteKey;
|
10
|
-
export declare type UserIDParam = Schemas.UserID;
|
11
|
-
export declare type WorkspaceIDParam = Schemas.WorkspaceID;
|
12
|
-
export declare type ColumnNameParam = Schemas.ColumnName;
|
13
|
-
export declare type DBBranchNameParam = Schemas.DBBranchName;
|
14
|
-
export declare type DBNameParam = Schemas.DBName;
|
15
|
-
export declare type RecordIDParam = Schemas.RecordID;
|
16
|
-
export declare type TableNameParam = Schemas.TableName;
|
package/dist/api/parameters.js
DELETED
package/dist/api/providers.d.ts
DELETED
@@ -1,8 +0,0 @@
|
|
1
|
-
declare type HostAliases = 'production' | 'staging';
|
2
|
-
declare type ProviderBuilder = {
|
3
|
-
main: string;
|
4
|
-
workspaces: string;
|
5
|
-
};
|
6
|
-
export declare type HostProvider = HostAliases | ProviderBuilder;
|
7
|
-
export declare function getHostUrl(provider: HostProvider, type: keyof ProviderBuilder): string;
|
8
|
-
export {};
|
package/dist/api/providers.js
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.getHostUrl = void 0;
|
4
|
-
const lang_1 = require("../util/lang");
|
5
|
-
function getHostUrl(provider, type) {
|
6
|
-
if (isValidAlias(provider)) {
|
7
|
-
return providers[provider][type];
|
8
|
-
}
|
9
|
-
else if (isValidBuilder(provider)) {
|
10
|
-
return provider[type];
|
11
|
-
}
|
12
|
-
throw new Error('Invalid API provider');
|
13
|
-
}
|
14
|
-
exports.getHostUrl = getHostUrl;
|
15
|
-
const providers = {
|
16
|
-
production: {
|
17
|
-
main: 'https://api.xata.io',
|
18
|
-
workspaces: 'https://{workspaceId}.xata.sh'
|
19
|
-
},
|
20
|
-
staging: {
|
21
|
-
main: 'https://staging.xatabase.co',
|
22
|
-
workspaces: 'https://{workspaceId}.staging.xatabase.co'
|
23
|
-
}
|
24
|
-
};
|
25
|
-
function isValidAlias(alias) {
|
26
|
-
return (0, lang_1.isString)(alias) && Object.keys(providers).includes(alias);
|
27
|
-
}
|
28
|
-
function isValidBuilder(builder) {
|
29
|
-
return (0, lang_1.isObject)(builder) && (0, lang_1.isString)(builder.main) && (0, lang_1.isString)(builder.workspaces);
|
30
|
-
}
|
package/dist/api/responses.d.ts
DELETED
@@ -1,50 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Generated by @openapi-codegen
|
3
|
-
*
|
4
|
-
* @version 1.0
|
5
|
-
*/
|
6
|
-
import type * as Schemas from './schemas';
|
7
|
-
export declare type SimpleError = {
|
8
|
-
id?: string;
|
9
|
-
message: string;
|
10
|
-
};
|
11
|
-
export declare type BadRequestError = {
|
12
|
-
id?: string;
|
13
|
-
message: string;
|
14
|
-
};
|
15
|
-
/**
|
16
|
-
* @example {"message":"invalid API key"}
|
17
|
-
*/
|
18
|
-
export declare type AuthError = {
|
19
|
-
id?: string;
|
20
|
-
message: string;
|
21
|
-
};
|
22
|
-
export declare type BulkError = {
|
23
|
-
errors: {
|
24
|
-
message?: string;
|
25
|
-
status?: number;
|
26
|
-
}[];
|
27
|
-
};
|
28
|
-
export declare type BranchMigrationPlan = {
|
29
|
-
version: number;
|
30
|
-
migration: Schemas.BranchMigration;
|
31
|
-
};
|
32
|
-
export declare type RecordUpdateResponse = {
|
33
|
-
id: string;
|
34
|
-
xata: {
|
35
|
-
version: number;
|
36
|
-
};
|
37
|
-
};
|
38
|
-
export declare type QueryResponse = {
|
39
|
-
records: Schemas.XataRecord[];
|
40
|
-
meta: Schemas.RecordsMetadata;
|
41
|
-
};
|
42
|
-
export declare type SearchResponse = {
|
43
|
-
records: Schemas.XataRecord[];
|
44
|
-
};
|
45
|
-
/**
|
46
|
-
* @example {"migrationID":"mig_c7m19ilcefoebpqj12p0"}
|
47
|
-
*/
|
48
|
-
export declare type MigrationIdResponse = {
|
49
|
-
migrationID: string;
|
50
|
-
};
|
package/dist/api/responses.js
DELETED
package/dist/api/schemas.d.ts
DELETED
@@ -1,311 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* Generated by @openapi-codegen
|
3
|
-
*
|
4
|
-
* @version 1.0
|
5
|
-
*/
|
6
|
-
export declare type User = {
|
7
|
-
email: string;
|
8
|
-
fullname: string;
|
9
|
-
image: string;
|
10
|
-
};
|
11
|
-
/**
|
12
|
-
* @pattern [a-zA-Z0-9_-~:]+
|
13
|
-
*/
|
14
|
-
export declare type UserID = string;
|
15
|
-
export declare type UserWithID = User & {
|
16
|
-
id: UserID;
|
17
|
-
};
|
18
|
-
/**
|
19
|
-
* @format date-time
|
20
|
-
* @x-go-type string
|
21
|
-
*/
|
22
|
-
export declare type DateTime = string;
|
23
|
-
/**
|
24
|
-
* @pattern [a-zA-Z0-9_\-~]*
|
25
|
-
*/
|
26
|
-
export declare type APIKeyName = string;
|
27
|
-
/**
|
28
|
-
* @pattern ^([a-zA-Z0-9][a-zA-Z0-9_\-~]+-)?[a-zA-Z0-9]{6}
|
29
|
-
* @x-go-type auth.WorkspaceID
|
30
|
-
*/
|
31
|
-
export declare type WorkspaceID = string;
|
32
|
-
/**
|
33
|
-
* @x-go-type auth.Role
|
34
|
-
*/
|
35
|
-
export declare type Role = 'owner' | 'maintainer';
|
36
|
-
export declare type WorkspaceMeta = {
|
37
|
-
name: string;
|
38
|
-
slug: string;
|
39
|
-
};
|
40
|
-
export declare type Workspace = WorkspaceMeta & {
|
41
|
-
id: WorkspaceID;
|
42
|
-
memberCount: number;
|
43
|
-
plan: 'free';
|
44
|
-
};
|
45
|
-
export declare type WorkspaceMember = {
|
46
|
-
userId: UserID;
|
47
|
-
fullname: string;
|
48
|
-
email: string;
|
49
|
-
role: Role;
|
50
|
-
};
|
51
|
-
/**
|
52
|
-
* @pattern [a-zA-Z0-9]+
|
53
|
-
*/
|
54
|
-
export declare type InviteID = string;
|
55
|
-
export declare type WorkspaceInvite = {
|
56
|
-
inviteId: InviteID;
|
57
|
-
email: string;
|
58
|
-
expires: string;
|
59
|
-
role: Role;
|
60
|
-
};
|
61
|
-
export declare type WorkspaceMembers = {
|
62
|
-
members: WorkspaceMember[];
|
63
|
-
invites: WorkspaceInvite[];
|
64
|
-
};
|
65
|
-
/**
|
66
|
-
* @pattern ^ik_[a-zA-Z0-9]+
|
67
|
-
*/
|
68
|
-
export declare type InviteKey = string;
|
69
|
-
export declare type ListDatabasesResponse = {
|
70
|
-
databases?: {
|
71
|
-
name: string;
|
72
|
-
displayName: string;
|
73
|
-
createdAt: DateTime;
|
74
|
-
numberOfBranches: number;
|
75
|
-
ui?: {
|
76
|
-
color?: string;
|
77
|
-
};
|
78
|
-
}[];
|
79
|
-
};
|
80
|
-
export declare type ListBranchesResponse = {
|
81
|
-
databaseName: string;
|
82
|
-
displayName: string;
|
83
|
-
branches: Branch[];
|
84
|
-
};
|
85
|
-
export declare type Branch = {
|
86
|
-
name: string;
|
87
|
-
createdAt: DateTime;
|
88
|
-
};
|
89
|
-
/**
|
90
|
-
* @example {"repository":"github.com/my/repository","branch":"feature-login","stage":"testing","labels":["epic-100"]}
|
91
|
-
* @x-go-type xata.BranchMetadata
|
92
|
-
*/
|
93
|
-
export declare type BranchMetadata = {
|
94
|
-
repository?: string;
|
95
|
-
branch?: BranchName;
|
96
|
-
stage?: string;
|
97
|
-
labels?: string[];
|
98
|
-
};
|
99
|
-
export declare type DBBranch = {
|
100
|
-
databaseName: DBName;
|
101
|
-
branchName: BranchName;
|
102
|
-
createdAt: DateTime;
|
103
|
-
id: string;
|
104
|
-
version: number;
|
105
|
-
lastMigrationID: string;
|
106
|
-
metadata?: BranchMetadata;
|
107
|
-
startedFrom?: StartedFromMetadata;
|
108
|
-
schema: Schema;
|
109
|
-
};
|
110
|
-
export declare type StartedFromMetadata = {
|
111
|
-
branchName: BranchName;
|
112
|
-
dbBranchID: string;
|
113
|
-
migrationID: string;
|
114
|
-
};
|
115
|
-
/**
|
116
|
-
* @x-go-type xata.Schema
|
117
|
-
*/
|
118
|
-
export declare type Schema = {
|
119
|
-
tables: Table[];
|
120
|
-
tablesOrder?: string[];
|
121
|
-
};
|
122
|
-
export declare type Table = {
|
123
|
-
id?: string;
|
124
|
-
name: TableName;
|
125
|
-
columns: Column[];
|
126
|
-
revLinks?: RevLink[];
|
127
|
-
};
|
128
|
-
/**
|
129
|
-
* @x-go-type xata.Column
|
130
|
-
*/
|
131
|
-
export declare type Column = {
|
132
|
-
name: string;
|
133
|
-
type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object';
|
134
|
-
link?: {
|
135
|
-
table: string;
|
136
|
-
};
|
137
|
-
columns?: Column[];
|
138
|
-
};
|
139
|
-
export declare type RevLink = {
|
140
|
-
linkID: string;
|
141
|
-
table: string;
|
142
|
-
};
|
143
|
-
/**
|
144
|
-
* @pattern [a-zA-Z0-9_\-~]+
|
145
|
-
*/
|
146
|
-
export declare type BranchName = string;
|
147
|
-
/**
|
148
|
-
* @pattern [a-zA-Z0-9_\-~]+
|
149
|
-
*/
|
150
|
-
export declare type DBName = string;
|
151
|
-
/**
|
152
|
-
* The DBBranchName matches the pattern `{db_name}:{branch_name}`.
|
153
|
-
*
|
154
|
-
* @pattern [a-zA-Z0-9_\-~]+:[a-zA-Z0-9_\-~]+
|
155
|
-
*/
|
156
|
-
export declare type DBBranchName = string;
|
157
|
-
/**
|
158
|
-
* @pattern [a-zA-Z0-9_\-~]+
|
159
|
-
*/
|
160
|
-
export declare type TableName = string;
|
161
|
-
/**
|
162
|
-
* @pattern [a-zA-Z0-9_\-~\.]+
|
163
|
-
*/
|
164
|
-
export declare type ColumnName = string;
|
165
|
-
export declare type MetricsDatapoint = {
|
166
|
-
timestamp: string;
|
167
|
-
value: number;
|
168
|
-
};
|
169
|
-
export declare type MetricsLatency = {
|
170
|
-
p50?: MetricsDatapoint[];
|
171
|
-
p90?: MetricsDatapoint[];
|
172
|
-
};
|
173
|
-
export declare type BranchMigration = {
|
174
|
-
id?: string;
|
175
|
-
parentID?: string;
|
176
|
-
status: string;
|
177
|
-
title?: string;
|
178
|
-
lastGitRevision?: string;
|
179
|
-
localChanges: boolean;
|
180
|
-
createdAt?: DateTime;
|
181
|
-
newTables?: {
|
182
|
-
[key: string]: Table;
|
183
|
-
};
|
184
|
-
removedTables?: string[];
|
185
|
-
tableMigrations?: {
|
186
|
-
[key: string]: TableMigration;
|
187
|
-
};
|
188
|
-
newTableOrder: string[];
|
189
|
-
renamedTables?: TableRename[];
|
190
|
-
};
|
191
|
-
export declare type TableMigration = {
|
192
|
-
newColumns?: {
|
193
|
-
[key: string]: Column;
|
194
|
-
};
|
195
|
-
removedColumns?: string[];
|
196
|
-
modifiedColumns?: ColumnMigration[];
|
197
|
-
newColumnOrder: string[];
|
198
|
-
};
|
199
|
-
export declare type ColumnMigration = {
|
200
|
-
old: Column;
|
201
|
-
['new']: Column;
|
202
|
-
};
|
203
|
-
export declare type SortExpression = string[] | {
|
204
|
-
[key: string]: SortOrder;
|
205
|
-
} | {
|
206
|
-
[key: string]: SortOrder;
|
207
|
-
}[];
|
208
|
-
export declare type SortOrder = 'asc' | 'desc';
|
209
|
-
/**
|
210
|
-
* @minProperties 1
|
211
|
-
*/
|
212
|
-
export declare type FilterExpression = {
|
213
|
-
$exists?: string;
|
214
|
-
$existsNot?: string;
|
215
|
-
$any?: FilterList;
|
216
|
-
$all?: FilterList;
|
217
|
-
$none?: FilterList;
|
218
|
-
$not?: FilterList;
|
219
|
-
} & {
|
220
|
-
[key: string]: FilterColumn;
|
221
|
-
};
|
222
|
-
export declare type FilterList = FilterExpression | FilterExpression[];
|
223
|
-
export declare type FilterColumn = FilterColumnIncludes | FilterPredicate | FilterList;
|
224
|
-
/**
|
225
|
-
* @maxProperties 1
|
226
|
-
* @minProperties 1
|
227
|
-
*/
|
228
|
-
export declare type FilterColumnIncludes = {
|
229
|
-
$includes?: FilterPredicate;
|
230
|
-
$includesAny?: FilterPredicate;
|
231
|
-
$includesAll?: FilterPredicate;
|
232
|
-
$includesNone?: FilterPredicate;
|
233
|
-
};
|
234
|
-
export declare type FilterPredicate = FilterValue | FilterPredicate[] | FilterPredicateOp | FilterPredicateRangeOp;
|
235
|
-
/**
|
236
|
-
* @maxProperties 1
|
237
|
-
* @minProperties 1
|
238
|
-
*/
|
239
|
-
export declare type FilterPredicateOp = {
|
240
|
-
$any?: FilterPredicate[];
|
241
|
-
$all?: FilterPredicate[];
|
242
|
-
$none?: FilterPredicate | FilterPredicate[];
|
243
|
-
$not?: FilterPredicate | FilterPredicate[];
|
244
|
-
$is?: FilterValue | FilterValue[];
|
245
|
-
$isNot?: FilterValue | FilterValue[];
|
246
|
-
$lt?: FilterRangeValue;
|
247
|
-
$le?: FilterRangeValue;
|
248
|
-
$gt?: FilterRangeValue;
|
249
|
-
$ge?: FilterRangeValue;
|
250
|
-
$contains?: string;
|
251
|
-
$startsWith?: string;
|
252
|
-
$endsWith?: string;
|
253
|
-
$pattern?: string;
|
254
|
-
};
|
255
|
-
/**
|
256
|
-
* @maxProperties 2
|
257
|
-
* @minProperties 2
|
258
|
-
*/
|
259
|
-
export declare type FilterPredicateRangeOp = {
|
260
|
-
$lt?: FilterRangeValue;
|
261
|
-
$le?: FilterRangeValue;
|
262
|
-
$gt?: FilterRangeValue;
|
263
|
-
$ge?: FilterRangeValue;
|
264
|
-
};
|
265
|
-
export declare type FilterRangeValue = number | string;
|
266
|
-
export declare type FilterValue = number | string | boolean;
|
267
|
-
/**
|
268
|
-
* Pagination settings.
|
269
|
-
*/
|
270
|
-
export declare type PageConfig = {
|
271
|
-
after?: string;
|
272
|
-
before?: string;
|
273
|
-
first?: string;
|
274
|
-
last?: string;
|
275
|
-
size?: number;
|
276
|
-
offset?: number;
|
277
|
-
};
|
278
|
-
export declare type ColumnsFilter = string[];
|
279
|
-
/**
|
280
|
-
* @pattern [a-zA-Z0-9_-~:]+
|
281
|
-
*/
|
282
|
-
export declare type RecordID = string;
|
283
|
-
/**
|
284
|
-
* @example {"newName":"newName","oldName":"oldName"}
|
285
|
-
*/
|
286
|
-
export declare type TableRename = {
|
287
|
-
newName: string;
|
288
|
-
oldName: string;
|
289
|
-
};
|
290
|
-
/**
|
291
|
-
* Records metadata
|
292
|
-
*/
|
293
|
-
export declare type RecordsMetadata = {
|
294
|
-
page: {
|
295
|
-
cursor: string;
|
296
|
-
more: boolean;
|
297
|
-
};
|
298
|
-
};
|
299
|
-
/**
|
300
|
-
* Xata Table Record
|
301
|
-
*/
|
302
|
-
export declare type XataRecord = {
|
303
|
-
id: RecordID;
|
304
|
-
xata: {
|
305
|
-
version: number;
|
306
|
-
table?: string;
|
307
|
-
warnings?: string[];
|
308
|
-
};
|
309
|
-
} & {
|
310
|
-
[key: string]: any;
|
311
|
-
};
|
package/dist/api/schemas.js
DELETED
package/dist/client.d.ts
DELETED
@@ -1,27 +0,0 @@
|
|
1
|
-
import { FetchImpl } from './api/fetcher';
|
2
|
-
import { XataPlugin } from './plugins';
|
3
|
-
import { SchemaPlugin } from './schema';
|
4
|
-
import { BaseData } from './schema/record';
|
5
|
-
import { LinkDictionary } from './schema/repository';
|
6
|
-
import { SearchPlugin } from './search';
|
7
|
-
import { BranchStrategyOption } from './util/branches';
|
8
|
-
import { StringKeys } from './util/types';
|
9
|
-
export declare type BaseClientOptions = {
|
10
|
-
fetch?: FetchImpl;
|
11
|
-
apiKey?: string;
|
12
|
-
databaseURL?: string;
|
13
|
-
branch?: BranchStrategyOption;
|
14
|
-
};
|
15
|
-
export declare const buildClient: <Plugins extends Record<string, XataPlugin> = {}>(plugins?: Plugins | undefined) => ClientConstructor<Plugins>;
|
16
|
-
export interface ClientConstructor<Plugins extends Record<string, XataPlugin>> {
|
17
|
-
new <Schemas extends Record<string, BaseData>>(options?: Partial<BaseClientOptions>, links?: LinkDictionary): Omit<{
|
18
|
-
db: Awaited<ReturnType<SchemaPlugin<Schemas>['build']>>;
|
19
|
-
search: Awaited<ReturnType<SearchPlugin<Schemas>['build']>>;
|
20
|
-
}, keyof Plugins> & {
|
21
|
-
[Key in StringKeys<NonNullable<Plugins>>]: Awaited<ReturnType<NonNullable<Plugins>[Key]['build']>>;
|
22
|
-
};
|
23
|
-
}
|
24
|
-
declare const BaseClient_base: ClientConstructor<{}>;
|
25
|
-
export declare class BaseClient extends BaseClient_base<Record<string, any>> {
|
26
|
-
}
|
27
|
-
export {};
|