@xata.io/client
Advanced tools
Comparing version 0.0.0-alpha.46dda8e to 0.0.0-alpha.483ae18
@@ -84,5 +84,3 @@ import type * as Types from './components'; | ||
insertRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, record: Record<string, any>): Promise<Types.InsertRecordResponse>; | ||
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>; | ||
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>; | ||
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>; | ||
insertRecordWithID(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, record: Record<string, any>, options?: Types.InsertRecordWithIDQueryParams): Promise<Types.InsertRecordWithIDResponse>; | ||
deleteRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID): Promise<void>; | ||
@@ -92,4 +90,3 @@ getRecord(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, recordId: Schemas.RecordID, options?: Types.GetRecordRequestBody): Promise<Schemas.XataRecord>; | ||
queryTable(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, tableName: Schemas.TableName, query: Types.QueryTableRequestBody): Promise<Responses.QueryResponse>; | ||
searchBranch(workspace: Schemas.WorkspaceID, database: Schemas.DBName, branch: Schemas.BranchName, query: Types.SearchBranchRequestBody): Promise<Responses.SearchResponse>; | ||
} | ||
export {}; |
@@ -208,8 +208,2 @@ "use strict"; | ||
} | ||
updateRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) { | ||
return components_1.operationsByTag.records.updateRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps)); | ||
} | ||
upsertRecordWithID(workspace, database, branch, tableName, recordId, record, options = {}) { | ||
return components_1.operationsByTag.records.upsertRecordWithID(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId }, queryParams: options, body: record }, this.extraProps)); | ||
} | ||
deleteRecord(workspace, database, branch, tableName, recordId) { | ||
@@ -227,5 +221,2 @@ return components_1.operationsByTag.records.deleteRecord(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}`, tableName, recordId } }, this.extraProps)); | ||
} | ||
searchBranch(workspace, database, branch, query) { | ||
return components_1.operationsByTag.records.searchBranch(Object.assign({ pathParams: { workspace, dbBranchName: `${database}:${branch}` }, body: query }, this.extraProps)); | ||
} | ||
} |
@@ -164,2 +164,40 @@ /** | ||
export declare const inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<Schemas.WorkspaceInvite>; | ||
export declare type UpdateWorkspaceMemberInvitePathParams = { | ||
workspaceId: Schemas.WorkspaceID; | ||
inviteId: Schemas.InviteID; | ||
}; | ||
export declare type UpdateWorkspaceMemberInviteRequestBody = { | ||
role: Schemas.Role; | ||
}; | ||
export declare type UpdateWorkspaceMemberInviteVariables = { | ||
body: UpdateWorkspaceMemberInviteRequestBody; | ||
pathParams: UpdateWorkspaceMemberInvitePathParams; | ||
} & FetcherExtraProps; | ||
/** | ||
* This operation provides a way to update an invite. | ||
* The role can be updated while the email cannot. | ||
*/ | ||
export declare const updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<Schemas.WorkspaceInvite>; | ||
export declare type CancelWorkspaceMemberInvitePathParams = { | ||
workspaceId: Schemas.WorkspaceID; | ||
inviteId: Schemas.InviteID; | ||
}; | ||
export declare type CancelWorkspaceMemberInviteVariables = { | ||
pathParams: CancelWorkspaceMemberInvitePathParams; | ||
} & FetcherExtraProps; | ||
/** | ||
* This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted. | ||
*/ | ||
export declare const cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>; | ||
export declare type ResendWorkspaceMemberInvitePathParams = { | ||
workspaceId: Schemas.WorkspaceID; | ||
inviteId: Schemas.InviteID; | ||
}; | ||
export declare type ResendWorkspaceMemberInviteVariables = { | ||
pathParams: ResendWorkspaceMemberInvitePathParams; | ||
} & FetcherExtraProps; | ||
/** | ||
* This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted. | ||
*/ | ||
export declare const resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>; | ||
export declare type AcceptWorkspaceMemberInvitePathParams = { | ||
@@ -532,2 +570,8 @@ workspaceId: Schemas.WorkspaceID; | ||
}; | ||
export declare type InsertRecordWithIDResponse = { | ||
id: string; | ||
xata: { | ||
version: number; | ||
}; | ||
}; | ||
export declare type InsertRecordWithIDVariables = { | ||
@@ -541,33 +585,3 @@ body?: Record<string, any>; | ||
*/ | ||
export declare const insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>; | ||
export declare type UpdateRecordWithIDPathParams = { | ||
dbBranchName: Schemas.DBBranchName; | ||
tableName: Schemas.TableName; | ||
recordId: Schemas.RecordID; | ||
workspace: string; | ||
}; | ||
export declare type UpdateRecordWithIDQueryParams = { | ||
ifVersion?: number; | ||
}; | ||
export declare type UpdateRecordWithIDVariables = { | ||
body?: Record<string, any>; | ||
pathParams: UpdateRecordWithIDPathParams; | ||
queryParams?: UpdateRecordWithIDQueryParams; | ||
} & FetcherExtraProps; | ||
export declare const updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>; | ||
export declare type UpsertRecordWithIDPathParams = { | ||
dbBranchName: Schemas.DBBranchName; | ||
tableName: Schemas.TableName; | ||
recordId: Schemas.RecordID; | ||
workspace: string; | ||
}; | ||
export declare type UpsertRecordWithIDQueryParams = { | ||
ifVersion?: number; | ||
}; | ||
export declare type UpsertRecordWithIDVariables = { | ||
body?: Record<string, any>; | ||
pathParams: UpsertRecordWithIDPathParams; | ||
queryParams?: UpsertRecordWithIDQueryParams; | ||
} & FetcherExtraProps; | ||
export declare const upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>; | ||
export declare const insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<InsertRecordWithIDResponse>; | ||
export declare type DeleteRecordPathParams = { | ||
@@ -1348,3 +1362,2 @@ dbBranchName: Schemas.DBBranchName; | ||
query: string; | ||
fuzziness?: number; | ||
}; | ||
@@ -1356,3 +1369,3 @@ export declare type SearchBranchVariables = { | ||
/** | ||
* Run a free text search operation across the database branch. | ||
* Run a free text search operation across the Database. | ||
*/ | ||
@@ -1379,2 +1392,5 @@ export declare const searchBranch: (variables: SearchBranchVariables) => Promise<Responses.SearchResponse>; | ||
inviteWorkspaceMember: (variables: InviteWorkspaceMemberVariables) => Promise<Schemas.WorkspaceInvite>; | ||
updateWorkspaceMemberInvite: (variables: UpdateWorkspaceMemberInviteVariables) => Promise<Schemas.WorkspaceInvite>; | ||
cancelWorkspaceMemberInvite: (variables: CancelWorkspaceMemberInviteVariables) => Promise<undefined>; | ||
resendWorkspaceMemberInvite: (variables: ResendWorkspaceMemberInviteVariables) => Promise<undefined>; | ||
acceptWorkspaceMemberInvite: (variables: AcceptWorkspaceMemberInviteVariables) => Promise<undefined>; | ||
@@ -1413,5 +1429,3 @@ }; | ||
insertRecord: (variables: InsertRecordVariables) => Promise<InsertRecordResponse>; | ||
insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>; | ||
updateRecordWithID: (variables: UpdateRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>; | ||
upsertRecordWithID: (variables: UpsertRecordWithIDVariables) => Promise<Responses.RecordUpdateResponse>; | ||
insertRecordWithID: (variables: InsertRecordWithIDVariables) => Promise<InsertRecordWithIDResponse>; | ||
deleteRecord: (variables: DeleteRecordVariables) => Promise<undefined>; | ||
@@ -1418,0 +1432,0 @@ getRecord: (variables: GetRecordVariables) => Promise<Schemas.XataRecord>; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.operationsByTag = 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.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; | ||
exports.operationsByTag = exports.searchBranch = exports.queryTable = exports.bulkInsertTableRecords = exports.getRecord = exports.deleteRecord = 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.updateWorkspaceMemberInvite = 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; | ||
/** | ||
@@ -86,2 +86,18 @@ * Generated by @openapi-codegen | ||
/** | ||
* This operation provides a way to update an invite. | ||
* The role can be updated while the email cannot. | ||
*/ | ||
const updateWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}', method: 'patch' }, variables)); | ||
exports.updateWorkspaceMemberInvite = updateWorkspaceMemberInvite; | ||
/** | ||
* This operation provides a way to cancel invites by deleting them. Already accepted invites cannot be deleted. | ||
*/ | ||
const cancelWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}', method: 'delete' }, variables)); | ||
exports.cancelWorkspaceMemberInvite = cancelWorkspaceMemberInvite; | ||
/** | ||
* This operation provides a way to resend an Invite notification. Invite notifications can only be sent for Invites not yet accepted. | ||
*/ | ||
const resendWorkspaceMemberInvite = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/workspaces/{workspaceId}/invites/{inviteId}/resend', method: 'post' }, variables)); | ||
exports.resendWorkspaceMemberInvite = resendWorkspaceMemberInvite; | ||
/** | ||
* Accept the invitation to join a workspace. If the operation succeeds the user will be a member of the workspace | ||
@@ -210,6 +226,2 @@ */ | ||
exports.insertRecordWithID = insertRecordWithID; | ||
const updateRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'patch' }, variables)); | ||
exports.updateRecordWithID = updateRecordWithID; | ||
const upsertRecordWithID = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'post' }, variables)); | ||
exports.upsertRecordWithID = upsertRecordWithID; | ||
const deleteRecord = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/tables/{tableName}/data/{recordId}', method: 'delete' }, variables)); | ||
@@ -936,3 +948,3 @@ exports.deleteRecord = deleteRecord; | ||
/** | ||
* Run a free text search operation across the database branch. | ||
* Run a free text search operation across the Database. | ||
*/ | ||
@@ -953,2 +965,5 @@ const searchBranch = (variables) => (0, fetcher_1.fetch)(Object.assign({ url: '/db/{dbBranchName}/search', method: 'post' }, variables)); | ||
inviteWorkspaceMember: exports.inviteWorkspaceMember, | ||
updateWorkspaceMemberInvite: exports.updateWorkspaceMemberInvite, | ||
cancelWorkspaceMemberInvite: exports.cancelWorkspaceMemberInvite, | ||
resendWorkspaceMemberInvite: exports.resendWorkspaceMemberInvite, | ||
acceptWorkspaceMemberInvite: exports.acceptWorkspaceMemberInvite | ||
@@ -984,4 +999,2 @@ }, | ||
insertRecordWithID: exports.insertRecordWithID, | ||
updateRecordWithID: exports.updateRecordWithID, | ||
upsertRecordWithID: exports.upsertRecordWithID, | ||
deleteRecord: exports.deleteRecord, | ||
@@ -988,0 +1001,0 @@ getRecord: exports.getRecord, |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -8,2 +8,3 @@ /** | ||
export declare type APIKeyNameParam = Schemas.APIKeyName; | ||
export declare type InviteIDParam = Schemas.InviteID; | ||
export declare type InviteKeyParam = Schemas.InviteKey; | ||
@@ -10,0 +11,0 @@ export declare type UserIDParam = Schemas.UserID; |
@@ -26,8 +26,2 @@ /** | ||
}; | ||
export declare type RecordUpdateResponse = { | ||
id: string; | ||
xata: { | ||
version: number; | ||
}; | ||
}; | ||
export declare type QueryResponse = { | ||
@@ -34,0 +28,0 @@ records: Schemas.XataRecord[]; |
@@ -133,3 +133,3 @@ /** | ||
name: string; | ||
type: 'bool' | 'int' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object'; | ||
type: 'bool' | 'int' | 'float' | 'string' | 'text' | 'email' | 'multiple' | 'link' | 'object'; | ||
link?: { | ||
@@ -136,0 +136,0 @@ table: string; |
@@ -11,3 +11,3 @@ import { FetchImpl } from './api/fetcher'; | ||
read(): Promise<this>; | ||
update(data: Partial<Selectable<this>>): Promise<this>; | ||
update(data: Selectable<this>): Promise<this>; | ||
delete(): Promise<void>; | ||
@@ -19,4 +19,3 @@ } | ||
abstract read(id: string): Promise<T | null>; | ||
abstract update(id: string, object: Partial<Selectable<T>>): Promise<T>; | ||
abstract upsert(id: string, object: Selectable<T>): Promise<T>; | ||
abstract update(id: string, object: Partial<T>): Promise<T>; | ||
abstract delete(id: string): void; | ||
@@ -28,7 +27,6 @@ abstract query<R extends XataRecord, Options extends QueryOptions<T>>(query: Query<T, R>, options: Options): Promise<Page<T, typeof options['columns'] extends SelectableColumn<T>[] ? Select<T, typeof options['columns'][number]> : R>>; | ||
constructor(client: BaseClient<any>, table: string); | ||
create(object: Selectable<T>): Promise<T>; | ||
create(object: T): Promise<T>; | ||
createMany(objects: T[]): Promise<T[]>; | ||
read(recordId: string): Promise<T | null>; | ||
update(recordId: string, object: Partial<Selectable<T>>): Promise<T>; | ||
upsert(recordId: string, object: Selectable<T>): Promise<T>; | ||
update(recordId: string, object: Partial<T>): Promise<T>; | ||
delete(recordId: string): Promise<void>; | ||
@@ -35,0 +33,0 @@ query<R extends XataRecord, Options extends QueryOptions<T>>(query: Query<T, R>, options: Options): Promise<Page<T, typeof options['columns'] extends SelectableColumn<T>[] ? Select<T, typeof options['columns'][number]> : R>>; |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -69,14 +73,3 @@ if (k2 === undefined) k2 = k; | ||
const record = transformObjectLinks(object); | ||
const response = object.id | ||
? yield (0, api_1.insertRecordWithID)(Object.assign({ pathParams: { | ||
workspace: '{workspaceId}', | ||
dbBranchName: '{dbBranch}', | ||
tableName: __classPrivateFieldGet(this, _RestRepository_table, "f"), | ||
recordId: object.id | ||
}, body: record }, fetchProps)) | ||
: yield (0, api_1.insertRecord)(Object.assign({ pathParams: { | ||
workspace: '{workspaceId}', | ||
dbBranchName: '{dbBranch}', | ||
tableName: __classPrivateFieldGet(this, _RestRepository_table, "f") | ||
}, body: record }, fetchProps)); | ||
const response = yield (0, api_1.insertRecord)(Object.assign({ pathParams: { workspace: '{workspaceId}', dbBranchName: '{dbBranch}', tableName: __classPrivateFieldGet(this, _RestRepository_table, "f") }, body: record }, fetchProps)); | ||
const finalObject = yield this.read(response.id); | ||
@@ -112,19 +105,7 @@ if (!finalObject) { | ||
const fetchProps = yield __classPrivateFieldGet(this, _RestRepository_instances, "m", _RestRepository_getFetchProps).call(this); | ||
const response = yield (0, api_1.updateRecordWithID)(Object.assign({ pathParams: { workspace: '{workspaceId}', dbBranchName: '{dbBranch}', tableName: __classPrivateFieldGet(this, _RestRepository_table, "f"), recordId }, body: object }, fetchProps)); | ||
const item = yield this.read(response.id); | ||
if (!item) | ||
throw new Error('The server failed to save the record'); | ||
return item; | ||
const response = yield (0, api_1.insertRecordWithID)(Object.assign({ pathParams: { workspace: '{workspaceId}', dbBranchName: '{dbBranch}', tableName: __classPrivateFieldGet(this, _RestRepository_table, "f"), recordId }, body: object }, fetchProps)); | ||
// TODO: Review this, not sure we are properly initializing the object | ||
return __classPrivateFieldGet(this, _RestRepository_client, "f").initObject(__classPrivateFieldGet(this, _RestRepository_table, "f"), response); | ||
}); | ||
} | ||
upsert(recordId, object) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
const fetchProps = yield __classPrivateFieldGet(this, _RestRepository_instances, "m", _RestRepository_getFetchProps).call(this); | ||
const response = yield (0, api_1.upsertRecordWithID)(Object.assign({ pathParams: { workspace: '{workspaceId}', dbBranchName: '{dbBranch}', tableName: __classPrivateFieldGet(this, _RestRepository_table, "f"), recordId }, body: object }, fetchProps)); | ||
const item = yield this.read(response.id); | ||
if (!item) | ||
throw new Error('The server failed to save the record'); | ||
return item; | ||
}); | ||
} | ||
delete(recordId) { | ||
@@ -131,0 +112,0 @@ return __awaiter(this, void 0, void 0, function* () { |
"use strict"; | ||
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { | ||
if (k2 === undefined) k2 = k; | ||
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); | ||
var desc = Object.getOwnPropertyDescriptor(m, k); | ||
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) { | ||
desc = { enumerable: true, get: function() { return m[k]; } }; | ||
} | ||
Object.defineProperty(o, k2, desc); | ||
}) : (function(o, m, k, k2) { | ||
@@ -6,0 +10,0 @@ if (k2 === undefined) k2 = k; |
@@ -6,3 +6,3 @@ import { XataRecord, Repository } from '..'; | ||
import { Selectable, SelectableColumn, Select } from './selection'; | ||
export declare type QueryOptions<T extends XataRecord> = { | ||
export declare type QueryOptions<T> = { | ||
page?: PaginationOptions; | ||
@@ -9,0 +9,0 @@ columns?: Extract<keyof Selectable<T>, string>[]; |
@@ -80,15 +80,15 @@ "use strict"; | ||
any(...queries) { | ||
const $any = queries.map((query) => query.getQueryOptions().filter); | ||
const $any = (0, lang_1.compact)(queries.map((query) => query.getQueryOptions().filter.$any)).flat(); | ||
return new Query(__classPrivateFieldGet(this, _Query_repository, "f"), __classPrivateFieldGet(this, _Query_table, "f"), { filter: { $any } }, __classPrivateFieldGet(this, _Query_data, "f")); | ||
} | ||
all(...queries) { | ||
const $all = queries.map((query) => query.getQueryOptions().filter); | ||
const $all = (0, lang_1.compact)(queries.map((query) => query.getQueryOptions().filter.$all)).flat(); | ||
return new Query(__classPrivateFieldGet(this, _Query_repository, "f"), __classPrivateFieldGet(this, _Query_table, "f"), { filter: { $all } }, __classPrivateFieldGet(this, _Query_data, "f")); | ||
} | ||
not(...queries) { | ||
const $not = queries.map((query) => query.getQueryOptions().filter); | ||
const $not = (0, lang_1.compact)(queries.map((query) => query.getQueryOptions().filter.$not)).flat(); | ||
return new Query(__classPrivateFieldGet(this, _Query_repository, "f"), __classPrivateFieldGet(this, _Query_table, "f"), { filter: { $not } }, __classPrivateFieldGet(this, _Query_data, "f")); | ||
} | ||
none(...queries) { | ||
const $none = queries.map((query) => query.getQueryOptions().filter); | ||
const $none = (0, lang_1.compact)(queries.map((query) => query.getQueryOptions().filter.$none)).flat(); | ||
return new Query(__classPrivateFieldGet(this, _Query_repository, "f"), __classPrivateFieldGet(this, _Query_table, "f"), { filter: { $none } }, __classPrivateFieldGet(this, _Query_data, "f")); | ||
@@ -95,0 +95,0 @@ } |
import { XataRecord } from '..'; | ||
import { PartialBy } from '../util/lang'; | ||
import { StringKeys, UnionToIntersection, Values } from '../util/types'; | ||
@@ -8,4 +7,9 @@ import { Query } from './query'; | ||
}; | ||
declare type InternalProperties = 'xata' | 'read' | 'update' | 'delete'; | ||
export declare type Selectable<T extends XataRecord> = Omit<PartialBy<T, 'id'>, InternalProperties>; | ||
declare type OmitQueries<T> = { | ||
[key in keyof T as T[key] extends Query<any> ? never : key]: T[key]; | ||
}; | ||
declare type OmitMethods<T> = { | ||
[key in keyof T as T[key] extends Function ? never : key]: T[key]; | ||
}; | ||
export declare type Selectable<T> = Omit<OmitQueries<OmitMethods<T>>, 'id' | 'xata'>; | ||
export declare type SelectableColumn<O> = '*' | (O extends Array<unknown> ? never : O extends Record<string, any> ? '*' | Values<{ | ||
@@ -12,0 +16,0 @@ [K in StringKeys<O>]: O[K] extends Record<string, any> ? `${K}.${SelectableColumn<O[K]>}` : K; |
export declare function compact<T>(arr: Array<T | null | undefined>): T[]; | ||
export declare type PartialBy<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>; |
{ | ||
"name": "@xata.io/client", | ||
"version": "0.0.0-alpha.46dda8e", | ||
"version": "0.0.0-alpha.483ae18", | ||
"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": "46dda8e7552b99ef19bed4b3cd35c86b25f024c0" | ||
"gitHead": "483ae184de012058e73ec934745053167a0c95a5" | ||
} |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
5
172368
4103