Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@xata.io/client

Package Overview
Dependencies
Maintainers
4
Versions
4350
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@xata.io/client - npm Package Compare versions

Comparing version 0.0.0-alpha.29a45cc to 0.0.0-alpha.29ac30d

29

dist/index.d.ts

@@ -23,3 +23,4 @@ export interface XataRecord {

export declare type Selectable<T> = Omit<OmitQueries<OmitMethods<T>>, 'id' | 'xata'>;
export declare type Select<T, K extends keyof T> = Pick<T, K> & Queries<T> & XataRecord;
export declare type SelectableColumn<T> = keyof Selectable<T> | '*';
export declare type Select<T, K extends SelectableColumn<T>> = (K extends keyof T ? Pick<T, K> : T) & Queries<T> & XataRecord;
export declare type Include<T> = {

@@ -73,4 +74,5 @@ [key in keyof T as T[key] extends XataRecord ? key : never]?: boolean | Array<keyof Selectable<T[key]>>;

page?: PaginationOptions;
columns?: Array<keyof Selectable<T>>;
};
declare type QueryOrConstraint<T, R> = Query<T, R> | Constraint<T>;
declare type QueryOrConstraint<T extends XataRecord, R extends XataRecord> = Query<T, R> | Constraint<T>;
declare type QueryMeta = {

@@ -82,3 +84,3 @@ page: {

};
interface BasePage<T, R> {
interface BasePage<T extends XataRecord, R extends XataRecord> {
query: Query<T, R>;

@@ -93,3 +95,3 @@ meta: QueryMeta;

}
declare class Page<T, R> implements BasePage<T, R> {
declare class Page<T extends XataRecord, R extends XataRecord> implements BasePage<T, R> {
readonly query: Query<T, R>;

@@ -105,3 +107,3 @@ readonly meta: QueryMeta;

}
export declare class Query<T, R = T> implements BasePage<T, R> {
export declare class Query<T extends XataRecord, R extends XataRecord = T> implements BasePage<T, R> {
table: string;

@@ -114,2 +116,3 @@ repository: Repository<T>;

readonly $sort?: Record<string, SortDirection>;
readonly columns: SelectableColumn<T>[];
readonly query: Query<T, R>;

@@ -139,4 +142,4 @@ readonly meta: QueryMeta;

}
export declare abstract class Repository<T> extends Query<T, Selectable<T>> {
select<K extends keyof Selectable<T>>(...columns: K[]): Query<T, Select<T, K>>;
export declare abstract class Repository<T extends XataRecord> extends Query<T, T> {
select<K extends SelectableColumn<T>>(columns: K[]): Query<T, Select<T, K>>;
abstract create(object: Selectable<T>): Promise<T>;

@@ -147,5 +150,5 @@ abstract createMany(objects: Selectable<T>[]): Promise<T[]>;

abstract delete(id: string): void;
abstract _runQuery<R>(query: Query<T, R>, options?: BulkQueryOptions<T>): Promise<Page<T, R>>;
abstract _runQuery<R extends XataRecord>(query: Query<T, R>, options?: BulkQueryOptions<T>): Promise<Page<T, R>>;
}
export declare class RestRepository<T> extends Repository<T> {
export declare class RestRepository<T extends XataRecord> extends Repository<T> {
client: BaseClient<any>;

@@ -155,3 +158,3 @@ fetch: any;

request<T>(method: string, path: string, body?: unknown): Promise<T | undefined>;
select<K extends keyof T>(...columns: K[]): Query<T, Select<T, K>>;
select<K extends SelectableColumn<T>>(columns: K[]): Query<T, Select<T, K>>;
create(object: T): Promise<T>;

@@ -162,9 +165,9 @@ createMany(objects: T[]): Promise<T[]>;

delete(id: string): Promise<void>;
_runQuery<R>(query: Query<T, R>, options?: BulkQueryOptions<T>): Promise<Page<T, R>>;
_runQuery<R extends XataRecord>(query: Query<T, R>, options?: BulkQueryOptions<T>): Promise<Page<T, R>>;
}
interface RepositoryFactory {
createRepository<T>(client: BaseClient<any>, table: string): Repository<T>;
createRepository<T extends XataRecord>(client: BaseClient<any>, table: string): Repository<T>;
}
export declare class RestRespositoryFactory implements RepositoryFactory {
createRepository<T>(client: BaseClient<any>, table: string): Repository<T>;
createRepository<T extends XataRecord>(client: BaseClient<any>, table: string): Repository<T>;
}

@@ -171,0 +174,0 @@ declare type BranchStrategyValue = string | undefined | null;

@@ -103,2 +103,3 @@ "use strict";

constructor(repository, table, data, parent) {
this.columns = ['*'];
// Cursor pagination

@@ -263,4 +264,4 @@ this.query = this;

class Repository extends Query {
select(...columns) {
return new Query(this.repository, this.table, {});
select(columns) {
return new Query(this.repository, this.table, { columns });
}

@@ -322,4 +323,4 @@ }

}
select(...columns) {
return new Query(this.repository, this.table, {});
select(columns) {
return new Query(this.repository, this.table, { columns });
}

@@ -386,2 +387,3 @@ create(object) {

_runQuery(query, options) {
var _a;
return __awaiter(this, void 0, void 0, function* () {

@@ -397,3 +399,4 @@ const filter = {

sort: query.$sort,
page: options === null || options === void 0 ? void 0 : options.page
page: options === null || options === void 0 ? void 0 : options.page,
columns: (_a = options === null || options === void 0 ? void 0 : options.columns) !== null && _a !== void 0 ? _a : query.columns
};

@@ -400,0 +403,0 @@ const response = yield this.request('POST', `/tables/${this.table}/query`, body);

{
"name": "@xata.io/client",
"version": "0.0.0-alpha.29a45cc",
"version": "0.0.0-alpha.29ac30d",
"description": "Xata.io SDK for TypeScript and JavaScript",

@@ -23,3 +23,3 @@ "main": "./dist/index.js",

"homepage": "https://github.com/xataio/client-ts/blob/main/client/README.md",
"gitHead": "29a45cccfbf8d8818473c5f2d69886d8ffcd50c2"
"gitHead": "29ac30ddab3b685b5cf4c5547895b2c22ca07888"
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc