Skip to content

Commit

Permalink
idk
Browse files Browse the repository at this point in the history
  • Loading branch information
david-plugge committed Jan 16, 2024
1 parent 3119099 commit b31d017
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
9 changes: 1 addition & 8 deletions example/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,6 @@ import { TypedPocketBase, eq, or } from '../src/index.js';
const db = new TypedPocketBase<Schema>('http://localhost:8090');
await db.admins.authWithPassword('[email protected]', 'secretpassword');

{
const res = await db
.from('users')
.authWithPassword('users44494', '12341234');
console.log(res.record);
}

{
const posts = await db.from('posts').getFullList({
select: {
Expand All @@ -30,7 +23,7 @@ await db.admins.authWithPassword('[email protected]', 'secretpassword');
filter: eq('published', true)
});

console.log(posts);
console.log(posts[0].expand);
}

{
Expand Down
18 changes: 9 additions & 9 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface ViewCollectionService<
collectionName: Collection['collectionName'];
client: PocketBase;

getFullList<TSelect extends SelectWithExpand<Collection> = {}>(
getFullList<TSelect extends SelectWithExpand<Collection>>(
options?: {
select?: TSelect;
page?: number;
Expand All @@ -37,7 +37,7 @@ export interface ViewCollectionService<
filter?: Filter<ExpandedRecord>;
} & SendOptions
): Promise<ResolveSelectWithExpand<Collection, TSelect>[]>;
getList<TSelect extends SelectWithExpand<Collection> = {}>(
getList<TSelect extends SelectWithExpand<Collection>>(
page?: number,
perPage?: number,
options?: {
Expand All @@ -46,14 +46,14 @@ export interface ViewCollectionService<
filter?: Filter<ExpandedRecord>;
} & SendOptions
): Promise<ListResult<ResolveSelectWithExpand<Collection, TSelect>>>;
getFirstListItem<TSelect extends SelectWithExpand<Collection> = {}>(
getFirstListItem<TSelect extends SelectWithExpand<Collection>>(
filter: Filter<ExpandedRecord>,
options?: {
select?: TSelect;
sort?: MaybeArray<Sort<ExpandedRecord>>;
} & SendOptions
): Promise<ResolveSelectWithExpand<Collection, TSelect>>;
getOne<TSelect extends SelectWithExpand<Collection> = {}>(
getOne<TSelect extends SelectWithExpand<Collection>>(
id: string,
options?: {
select?: TSelect;
Expand All @@ -69,13 +69,13 @@ export interface ViewCollectionService<

export interface BaseCollectionService<Collection extends GenericCollection>
extends ViewCollectionService<Collection> {
create<TSelect extends SelectWithExpand<Collection> = {}>(
create<TSelect extends SelectWithExpand<Collection>>(
bodyParams: Collection['create'],
options?: {
select?: TSelect;
} & SendOptions
): Promise<ResolveSelectWithExpand<Collection, TSelect>>;
update<TSelect extends SelectWithExpand<Collection> = {}>(
update<TSelect extends SelectWithExpand<Collection>>(
id: string,
bodyParams: Collection['update'],
options?: {
Expand All @@ -88,7 +88,7 @@ export interface BaseCollectionService<Collection extends GenericCollection>
export interface AuthCollectionService<Collection extends GenericCollection>
extends BaseCollectionService<Collection>,
Pick<RecordService, (typeof FORWARD_METHODS)[number]> {
authWithPassword<TSelect extends SelectWithExpand<Collection> = {}>(
authWithPassword<TSelect extends SelectWithExpand<Collection>>(
usernameOrEmail: string,
password: string,
options?: {
Expand All @@ -97,7 +97,7 @@ export interface AuthCollectionService<Collection extends GenericCollection>
): Promise<
RecordAuthResponse<ResolveSelectWithExpand<Collection, TSelect>>
>;
authWithOAuth2Code<TSelect extends SelectWithExpand<Collection> = {}>(
authWithOAuth2Code<TSelect extends SelectWithExpand<Collection>>(
provider: string,
code: string,
codeVerifier: string,
Expand All @@ -116,7 +116,7 @@ export interface AuthCollectionService<Collection extends GenericCollection>
createData?: Collection['create'];
} & SendOptions
): Promise<RecordAuthResponse<Collection['response']>>;
authRefresh<TSelect extends SelectWithExpand<Collection> = {}>(
authRefresh<TSelect extends SelectWithExpand<Collection>>(
options?: {
select?: TSelect;
} & SendOptions
Expand Down

0 comments on commit b31d017

Please sign in to comment.