@xata.io/client 0.0.0-alpha.ve276c32 → 0.0.0-alpha.vea30e82
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 +1 -1
- package/dist/api/client.d.ts +1 -1
- package/dist/api/client.js +1 -1
- package/dist/api/index.d.ts +5 -0
- package/dist/api/index.js +20 -1
- package/dist/client.d.ts +12 -24
- package/dist/client.js +14 -7
- package/dist/index.d.ts +1 -0
- package/dist/index.js +1 -0
- package/dist/plugins.d.ts +7 -0
- package/dist/plugins.js +6 -0
- package/dist/schema/index.d.ts +7 -5
- package/dist/schema/index.js +8 -7
- package/dist/schema/repository.d.ts +4 -3
- package/dist/schema/repository.js +4 -5
- package/dist/search/index.d.ts +3 -3
- package/dist/search/index.js +9 -9
- package/package.json +2 -2
- package/dist/namespace.d.ts +0 -7
- package/dist/namespace.js +0 -6
package/.eslintrc.cjs
CHANGED
package/dist/api/client.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export interface XataApiClientOptions {
|
|
|
10
10
|
}
|
|
11
11
|
export declare class XataApiClient {
|
|
12
12
|
#private;
|
|
13
|
-
constructor(options
|
|
13
|
+
constructor(options?: XataApiClientOptions);
|
|
14
14
|
get user(): UserApi;
|
|
15
15
|
get workspaces(): WorkspaceApi;
|
|
16
16
|
get databases(): DatabaseApi;
|
package/dist/api/client.js
CHANGED
|
@@ -18,7 +18,7 @@ const fetch_1 = require("../util/fetch");
|
|
|
18
18
|
const components_1 = require("./components");
|
|
19
19
|
const providers_1 = require("./providers");
|
|
20
20
|
class XataApiClient {
|
|
21
|
-
constructor(options) {
|
|
21
|
+
constructor(options = {}) {
|
|
22
22
|
var _a, _b;
|
|
23
23
|
_XataApiClient_extraProps.set(this, void 0);
|
|
24
24
|
_XataApiClient_namespaces.set(this, {});
|
package/dist/api/index.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import { XataPlugin, XataPluginOptions } from '../plugins';
|
|
2
|
+
import { XataApiClient } from './client';
|
|
1
3
|
import { operationsByTag } from './components';
|
|
2
4
|
import type * as Responses from './responses';
|
|
3
5
|
import type * as Schemas from './schemas';
|
|
@@ -5,3 +7,6 @@ export * from './client';
|
|
|
5
7
|
export * from './components';
|
|
6
8
|
export { operationsByTag as Operations };
|
|
7
9
|
export type { Responses, Schemas };
|
|
10
|
+
export declare class XataApiPlugin implements XataPlugin {
|
|
11
|
+
build(options: XataPluginOptions): Promise<XataApiClient>;
|
|
12
|
+
}
|
package/dist/api/index.js
CHANGED
|
@@ -13,9 +13,28 @@ var __createBinding = (this && this.__createBinding) || (Object.create ? (functi
|
|
|
13
13
|
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
|
+
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
|
+
};
|
|
16
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.Operations = void 0;
|
|
26
|
+
exports.XataApiPlugin = exports.Operations = void 0;
|
|
27
|
+
const client_1 = require("./client");
|
|
18
28
|
const components_1 = require("./components");
|
|
19
29
|
Object.defineProperty(exports, "Operations", { enumerable: true, get: function () { return components_1.operationsByTag; } });
|
|
20
30
|
__exportStar(require("./client"), exports);
|
|
21
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/client.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { FetchImpl } from './api/fetcher';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { XataPlugin } from './plugins';
|
|
3
|
+
import { SchemaPlugin } from './schema';
|
|
4
4
|
import { BaseData } from './schema/record';
|
|
5
5
|
import { LinkDictionary } from './schema/repository';
|
|
6
|
-
import {
|
|
6
|
+
import { SearchPlugin } from './search';
|
|
7
7
|
import { BranchStrategyOption } from './util/branches';
|
|
8
8
|
import { StringKeys } from './util/types';
|
|
9
9
|
export declare type BaseClientOptions = {
|
|
@@ -12,28 +12,16 @@ export declare type BaseClientOptions = {
|
|
|
12
12
|
databaseURL?: string;
|
|
13
13
|
branch?: BranchStrategyOption;
|
|
14
14
|
};
|
|
15
|
-
export declare const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
}>(external?: ExternalNamespaces | undefined) => WrapperConstructor<Schemas, Namespaces, ExternalNamespaces>;
|
|
23
|
-
export interface WrapperConstructor<Schemas extends Record<string, BaseData> = Record<string, any>, Namespaces extends Record<string, Namespace> = {
|
|
24
|
-
db: SchemaNamespace<Schemas>;
|
|
25
|
-
search: SearchNamespace<Schemas>;
|
|
26
|
-
}, ExternalNamespaces extends Record<string, Namespace> = Record<string, Namespace>> {
|
|
27
|
-
new (options?: Partial<BaseClientOptions>, links?: LinkDictionary): {
|
|
28
|
-
[Key in StringKeys<Namespaces>]: ReturnType<Namespaces[Key]['build']>;
|
|
29
|
-
} & {
|
|
30
|
-
[Key in StringKeys<NonNullable<ExternalNamespaces>>]: ReturnType<NonNullable<ExternalNamespaces>[Key]['build']>;
|
|
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']>>;
|
|
31
22
|
};
|
|
32
23
|
}
|
|
33
|
-
declare const BaseClient_base:
|
|
34
|
-
|
|
35
|
-
search: SearchNamespace<Record<string, any>>;
|
|
36
|
-
}, {}>;
|
|
37
|
-
export declare class BaseClient extends BaseClient_base {
|
|
24
|
+
declare const BaseClient_base: ClientConstructor<{}>;
|
|
25
|
+
export declare class BaseClient extends BaseClient_base<Record<string, any>> {
|
|
38
26
|
}
|
|
39
27
|
export {};
|
package/dist/client.js
CHANGED
|
@@ -27,27 +27,34 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
|
27
27
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
28
28
|
};
|
|
29
29
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
30
|
-
exports.BaseClient = exports.buildClient =
|
|
30
|
+
exports.BaseClient = exports.buildClient = void 0;
|
|
31
31
|
const schema_1 = require("./schema");
|
|
32
32
|
const search_1 = require("./search");
|
|
33
33
|
const branches_1 = require("./util/branches");
|
|
34
34
|
const config_1 = require("./util/config");
|
|
35
35
|
const fetch_1 = require("./util/fetch");
|
|
36
|
-
const
|
|
37
|
-
exports.buildClientWithNamespaces = buildClientWithNamespaces;
|
|
38
|
-
const buildClient = (external) => {
|
|
36
|
+
const buildClient = (plugins) => {
|
|
39
37
|
var _instances, _branch, _parseOptions, _getFetchProps, _evaluateBranch, _a;
|
|
40
38
|
return _a = class {
|
|
41
39
|
constructor(options = {}, links) {
|
|
42
40
|
_instances.add(this);
|
|
43
41
|
_branch.set(this, void 0);
|
|
44
42
|
const safeOptions = __classPrivateFieldGet(this, _instances, "m", _parseOptions).call(this, options);
|
|
45
|
-
const namespaces = Object.assign({ db: new schema_1.
|
|
43
|
+
const namespaces = Object.assign({ db: new schema_1.SchemaPlugin(links), search: new search_1.SearchPlugin() }, plugins);
|
|
46
44
|
for (const [key, namespace] of Object.entries(namespaces)) {
|
|
47
45
|
if (!namespace)
|
|
48
46
|
continue;
|
|
49
|
-
|
|
50
|
-
|
|
47
|
+
const result = namespace.build({ getFetchProps: () => __classPrivateFieldGet(this, _instances, "m", _getFetchProps).call(this, safeOptions) });
|
|
48
|
+
if (result instanceof Promise) {
|
|
49
|
+
void result.then((namespace) => {
|
|
50
|
+
// @ts-ignore
|
|
51
|
+
this[key] = namespace;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
// @ts-ignore
|
|
56
|
+
this[key] = result;
|
|
57
|
+
}
|
|
51
58
|
}
|
|
52
59
|
}
|
|
53
60
|
},
|
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -23,6 +23,7 @@ class XataError extends Error {
|
|
|
23
23
|
}
|
|
24
24
|
exports.XataError = XataError;
|
|
25
25
|
__exportStar(require("./api"), exports);
|
|
26
|
+
__exportStar(require("./plugins"), exports);
|
|
26
27
|
__exportStar(require("./client"), exports);
|
|
27
28
|
__exportStar(require("./schema"), exports);
|
|
28
29
|
__exportStar(require("./search"), exports);
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { FetcherExtraProps } from './api/fetcher';
|
|
2
|
+
export declare abstract class XataPlugin {
|
|
3
|
+
abstract build(options: XataPluginOptions): unknown | Promise<unknown>;
|
|
4
|
+
}
|
|
5
|
+
export declare type XataPluginOptions = {
|
|
6
|
+
getFetchProps: () => Promise<FetcherExtraProps>;
|
|
7
|
+
};
|
package/dist/plugins.js
ADDED
package/dist/schema/index.d.ts
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XataPlugin, XataPluginOptions } from '../plugins';
|
|
2
2
|
import { BaseData } from './record';
|
|
3
3
|
import { LinkDictionary, Repository } from './repository';
|
|
4
4
|
export * from './operators';
|
|
5
5
|
export * from './pagination';
|
|
6
6
|
export { Query } from './query';
|
|
7
7
|
export { isIdentifiable, isXataRecord } from './record';
|
|
8
|
-
export type { Identifiable, XataRecord } from './record';
|
|
8
|
+
export type { BaseData, EditableData, Identifiable, XataRecord } from './record';
|
|
9
9
|
export { Repository, RestRepository } from './repository';
|
|
10
|
+
export type { LinkDictionary } from './repository';
|
|
11
|
+
export * from './selection';
|
|
10
12
|
export declare type SchemaDefinition = {
|
|
11
13
|
table: string;
|
|
12
14
|
links?: LinkDictionary;
|
|
13
15
|
};
|
|
14
|
-
export declare type
|
|
16
|
+
export declare type SchemaPluginResult<Schemas extends Record<string, BaseData>> = {
|
|
15
17
|
[Key in keyof Schemas]: Repository<Schemas[Key]>;
|
|
16
18
|
};
|
|
17
|
-
export declare class
|
|
19
|
+
export declare class SchemaPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
|
18
20
|
private links?;
|
|
19
21
|
constructor(links?: LinkDictionary | undefined);
|
|
20
|
-
build(options:
|
|
22
|
+
build(options: XataPluginOptions): SchemaPluginResult<Schemas>;
|
|
21
23
|
}
|
package/dist/schema/index.js
CHANGED
|
@@ -14,8 +14,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
14
14
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
exports.
|
|
18
|
-
const
|
|
17
|
+
exports.SchemaPlugin = exports.RestRepository = exports.Repository = exports.isXataRecord = exports.isIdentifiable = exports.Query = void 0;
|
|
18
|
+
const plugins_1 = require("../plugins");
|
|
19
19
|
const lang_1 = require("../util/lang");
|
|
20
20
|
const repository_1 = require("./repository");
|
|
21
21
|
__exportStar(require("./operators"), exports);
|
|
@@ -28,7 +28,8 @@ Object.defineProperty(exports, "isXataRecord", { enumerable: true, get: function
|
|
|
28
28
|
var repository_2 = require("./repository");
|
|
29
29
|
Object.defineProperty(exports, "Repository", { enumerable: true, get: function () { return repository_2.Repository; } });
|
|
30
30
|
Object.defineProperty(exports, "RestRepository", { enumerable: true, get: function () { return repository_2.RestRepository; } });
|
|
31
|
-
|
|
31
|
+
__exportStar(require("./selection"), exports);
|
|
32
|
+
class SchemaPlugin extends plugins_1.XataPlugin {
|
|
32
33
|
constructor(links) {
|
|
33
34
|
super();
|
|
34
35
|
this.links = links;
|
|
@@ -36,14 +37,14 @@ class SchemaNamespace extends namespace_1.Namespace {
|
|
|
36
37
|
build(options) {
|
|
37
38
|
const { getFetchProps } = options;
|
|
38
39
|
const links = this.links;
|
|
39
|
-
const
|
|
40
|
+
const db = new Proxy({}, {
|
|
40
41
|
get: (_target, table) => {
|
|
41
42
|
if (!(0, lang_1.isString)(table))
|
|
42
43
|
throw new Error('Invalid table name');
|
|
43
|
-
return new repository_1.RestRepository({
|
|
44
|
+
return new repository_1.RestRepository({ db, getFetchProps, table, links });
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
|
-
return
|
|
47
|
+
return db;
|
|
47
48
|
}
|
|
48
49
|
}
|
|
49
|
-
exports.
|
|
50
|
+
exports.SchemaPlugin = SchemaPlugin;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SchemaPluginResult } from '.';
|
|
2
2
|
import { FetcherExtraProps } from '../api/fetcher';
|
|
3
3
|
import { Dictionary } from '../util/types';
|
|
4
4
|
import { Page } from './pagination';
|
|
@@ -107,13 +107,14 @@ export declare abstract class Repository<Data extends BaseData, Record extends X
|
|
|
107
107
|
}): Promise<SelectedPick<Record, ['*']>[]>;
|
|
108
108
|
abstract query<Result extends XataRecord>(query: Query<Record, Result>): Promise<Page<Record, Result>>;
|
|
109
109
|
}
|
|
110
|
-
export declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> {
|
|
110
|
+
export declare class RestRepository<Data extends BaseData, Record extends XataRecord = Data & XataRecord> extends Query<Record, SelectedPick<Record, ['*']>> implements Repository<Data, Record> {
|
|
111
111
|
#private;
|
|
112
|
+
db: SchemaPluginResult<any>;
|
|
112
113
|
constructor(options: {
|
|
113
114
|
table: string;
|
|
114
115
|
links?: LinkDictionary;
|
|
115
116
|
getFetchProps: () => Promise<FetcherExtraProps>;
|
|
116
|
-
|
|
117
|
+
db: SchemaPluginResult<any>;
|
|
117
118
|
});
|
|
118
119
|
create(object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
|
119
120
|
create(recordId: string, object: EditableData<Data>): Promise<SelectedPick<Record, ['*']>>;
|
|
@@ -19,7 +19,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
19
19
|
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");
|
|
20
20
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
21
21
|
};
|
|
22
|
-
var _RestRepository_instances, _RestRepository_table, _RestRepository_links, _RestRepository_getFetchProps,
|
|
22
|
+
var _RestRepository_instances, _RestRepository_table, _RestRepository_links, _RestRepository_getFetchProps, _RestRepository_insertRecordWithoutId, _RestRepository_insertRecordWithId, _RestRepository_bulkInsertTableRecords, _RestRepository_updateRecordWithID, _RestRepository_upsertRecordWithID, _RestRepository_deleteRecord, _RestRepository_initObject;
|
|
23
23
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
24
|
exports.RestRepository = exports.Repository = void 0;
|
|
25
25
|
const api_1 = require("../api");
|
|
@@ -42,11 +42,10 @@ class RestRepository extends query_1.Query {
|
|
|
42
42
|
_RestRepository_table.set(this, void 0);
|
|
43
43
|
_RestRepository_links.set(this, void 0);
|
|
44
44
|
_RestRepository_getFetchProps.set(this, void 0);
|
|
45
|
-
_RestRepository_schemaNamespace.set(this, void 0);
|
|
46
45
|
__classPrivateFieldSet(this, _RestRepository_table, options.table, "f");
|
|
47
46
|
__classPrivateFieldSet(this, _RestRepository_links, (_a = options.links) !== null && _a !== void 0 ? _a : {}, "f");
|
|
48
47
|
__classPrivateFieldSet(this, _RestRepository_getFetchProps, options.getFetchProps, "f");
|
|
49
|
-
|
|
48
|
+
this.db = options.db;
|
|
50
49
|
}
|
|
51
50
|
create(a, b) {
|
|
52
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -180,7 +179,7 @@ class RestRepository extends query_1.Query {
|
|
|
180
179
|
}
|
|
181
180
|
}
|
|
182
181
|
exports.RestRepository = RestRepository;
|
|
183
|
-
_RestRepository_table = new WeakMap(), _RestRepository_links = new WeakMap(), _RestRepository_getFetchProps = new WeakMap(),
|
|
182
|
+
_RestRepository_table = new WeakMap(), _RestRepository_links = new WeakMap(), _RestRepository_getFetchProps = new WeakMap(), _RestRepository_instances = new WeakSet(), _RestRepository_insertRecordWithoutId = function _RestRepository_insertRecordWithoutId(object) {
|
|
184
183
|
return __awaiter(this, void 0, void 0, function* () {
|
|
185
184
|
const fetchProps = yield __classPrivateFieldGet(this, _RestRepository_getFetchProps, "f").call(this);
|
|
186
185
|
const record = transformObjectLinks(object);
|
|
@@ -257,7 +256,7 @@ _RestRepository_table = new WeakMap(), _RestRepository_links = new WeakMap(), _R
|
|
|
257
256
|
result[field] = __classPrivateFieldGet(this, _RestRepository_instances, "m", _RestRepository_initObject).call(this, linkTable, value);
|
|
258
257
|
}
|
|
259
258
|
}
|
|
260
|
-
const db =
|
|
259
|
+
const db = this.db;
|
|
261
260
|
result.read = function () {
|
|
262
261
|
return db[table].read(result['id']);
|
|
263
262
|
};
|
package/dist/search/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { XataPlugin, XataPluginOptions } from '../plugins';
|
|
2
2
|
import { BaseData, XataRecord } from '../schema/record';
|
|
3
3
|
import { SelectedPick } from '../schema/selection';
|
|
4
4
|
import { GetArrayInnerType, Values } from '../util/types';
|
|
5
|
-
export declare class
|
|
5
|
+
export declare class SearchPlugin<Schemas extends Record<string, BaseData>> extends XataPlugin {
|
|
6
6
|
#private;
|
|
7
|
-
build({ getFetchProps }:
|
|
7
|
+
build({ getFetchProps }: XataPluginOptions): {
|
|
8
8
|
all: <Tables extends Extract<keyof Schemas, string>>(query: string, options?: {
|
|
9
9
|
fuzziness?: number | undefined;
|
|
10
10
|
tables?: Tables[] | undefined;
|
package/dist/search/index.js
CHANGED
|
@@ -13,27 +13,27 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
13
13
|
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");
|
|
14
14
|
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
15
|
};
|
|
16
|
-
var
|
|
16
|
+
var _SearchPlugin_instances, _SearchPlugin_search;
|
|
17
17
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.
|
|
18
|
+
exports.SearchPlugin = void 0;
|
|
19
19
|
const api_1 = require("../api");
|
|
20
|
-
const
|
|
21
|
-
class
|
|
20
|
+
const plugins_1 = require("../plugins");
|
|
21
|
+
class SearchPlugin extends plugins_1.XataPlugin {
|
|
22
22
|
constructor() {
|
|
23
23
|
super(...arguments);
|
|
24
|
-
|
|
24
|
+
_SearchPlugin_instances.add(this);
|
|
25
25
|
}
|
|
26
26
|
build({ getFetchProps }) {
|
|
27
27
|
return {
|
|
28
28
|
all: (query, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
-
const records = yield __classPrivateFieldGet(this,
|
|
29
|
+
const records = yield __classPrivateFieldGet(this, _SearchPlugin_instances, "m", _SearchPlugin_search).call(this, query, options, getFetchProps);
|
|
30
30
|
return records.map((record) => {
|
|
31
31
|
const { table = 'orphan' } = record.xata;
|
|
32
32
|
return { table, record };
|
|
33
33
|
});
|
|
34
34
|
}),
|
|
35
35
|
byTable: (query, options = {}) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
-
const records = yield __classPrivateFieldGet(this,
|
|
36
|
+
const records = yield __classPrivateFieldGet(this, _SearchPlugin_instances, "m", _SearchPlugin_search).call(this, query, options, getFetchProps);
|
|
37
37
|
return records.reduce((acc, record) => {
|
|
38
38
|
var _a;
|
|
39
39
|
const { table = 'orphan' } = record.xata;
|
|
@@ -44,8 +44,8 @@ class SearchNamespace extends namespace_1.Namespace {
|
|
|
44
44
|
};
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
exports.
|
|
48
|
-
|
|
47
|
+
exports.SearchPlugin = SearchPlugin;
|
|
48
|
+
_SearchPlugin_instances = new WeakSet(), _SearchPlugin_search = function _SearchPlugin_search(query, options, getFetchProps) {
|
|
49
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
50
50
|
const fetchProps = yield getFetchProps();
|
|
51
51
|
const { tables, fuzziness } = options !== null && options !== void 0 ? options : {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xata.io/client",
|
|
3
|
-
"version": "0.0.0-alpha.
|
|
3
|
+
"version": "0.0.0-alpha.vea30e82",
|
|
4
4
|
"description": "Xata.io SDK for TypeScript and JavaScript",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -23,5 +23,5 @@
|
|
|
23
23
|
"url": "https://github.com/xataio/client-ts/issues"
|
|
24
24
|
},
|
|
25
25
|
"homepage": "https://github.com/xataio/client-ts/blob/main/client/README.md",
|
|
26
|
-
"gitHead": "
|
|
26
|
+
"gitHead": "ea30e82a7fa5bbecbdb38b6dac6854cd926c2db1"
|
|
27
27
|
}
|
package/dist/namespace.d.ts
DELETED