Skip to content

Commit

Permalink
removed the AuthStore type
Browse files Browse the repository at this point in the history
  • Loading branch information
ganigeorgiev committed Aug 26, 2022
1 parent 0f4d5f9 commit 0aa9a3b
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 239 deletions.
49 changes: 4 additions & 45 deletions dist/pocketbase.cjs.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore {
onChange(callback: () => void): () => void;
protected triggerChange(): void;
}
/**
* The minimal AuthStore interface.
*
* @deprecated
* This interface predates the abstract BaseAuthStore class
* and it is kept mainly for backward compatibility.
*
* New AuthStore implementations should extend directly the
* BaseAuthStore abstract class.
*/
type AuthStore = {
/**
* Retrieves the stored token (if any).
*/
readonly token: string;
/**
* Retrieves the stored model data (if any).
*/
readonly model: User | Admin | null;
/**
* Checks if the store has valid (aka. existing and unexpired) token.
*/
readonly isValid: boolean;
/**
* Saves new token and model data in the auth store.
*/
save(token: string, model: User | Admin | null): void;
/**
* Removes the stored token and model data form the auth store.
*/
clear(): void;
/**
* Parses the provided cookie string and updates the store state
* with the cookie's token and model data.
*/
loadFromCookie(cookie: string, key?: string): void;
/**
* Exports the current store state as cookie string.
*/
exportToCookie(options?: SerializeOptions, key?: string): string;
};
/**
* BaseService class that should be inherited from all API services.
*/
Expand Down Expand Up @@ -639,9 +598,9 @@ declare class Client {
*/
lang: string;
/**
* A replaceable instance of the local `AuthStore` service.
* A replaceable instance of the local auth store service.
*/
authStore: AuthStore | BaseAuthStore;
authStore: BaseAuthStore;
/**
* An instance of the service that handles the **Settings APIs**.
*/
Expand Down Expand Up @@ -671,11 +630,11 @@ declare class Client {
*/
readonly realtime: Realtime;
private cancelControllers;
constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null);
constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null);
/**
* @deprecated Legacy alias for `this.authStore`.
*/
get AuthStore(): AuthStore;
get AuthStore(): BaseAuthStore;
/**
* @deprecated Legacy alias for `this.settings`.
*/
Expand Down
49 changes: 4 additions & 45 deletions dist/pocketbase.es.d.mts
Original file line number Diff line number Diff line change
Expand Up @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore {
onChange(callback: () => void): () => void;
protected triggerChange(): void;
}
/**
* The minimal AuthStore interface.
*
* @deprecated
* This interface predates the abstract BaseAuthStore class
* and it is kept mainly for backward compatibility.
*
* New AuthStore implementations should extend directly the
* BaseAuthStore abstract class.
*/
type AuthStore = {
/**
* Retrieves the stored token (if any).
*/
readonly token: string;
/**
* Retrieves the stored model data (if any).
*/
readonly model: User | Admin | null;
/**
* Checks if the store has valid (aka. existing and unexpired) token.
*/
readonly isValid: boolean;
/**
* Saves new token and model data in the auth store.
*/
save(token: string, model: User | Admin | null): void;
/**
* Removes the stored token and model data form the auth store.
*/
clear(): void;
/**
* Parses the provided cookie string and updates the store state
* with the cookie's token and model data.
*/
loadFromCookie(cookie: string, key?: string): void;
/**
* Exports the current store state as cookie string.
*/
exportToCookie(options?: SerializeOptions, key?: string): string;
};
/**
* BaseService class that should be inherited from all API services.
*/
Expand Down Expand Up @@ -639,9 +598,9 @@ declare class Client {
*/
lang: string;
/**
* A replaceable instance of the local `AuthStore` service.
* A replaceable instance of the local auth store service.
*/
authStore: AuthStore | BaseAuthStore;
authStore: BaseAuthStore;
/**
* An instance of the service that handles the **Settings APIs**.
*/
Expand Down Expand Up @@ -671,11 +630,11 @@ declare class Client {
*/
readonly realtime: Realtime;
private cancelControllers;
constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null);
constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null);
/**
* @deprecated Legacy alias for `this.authStore`.
*/
get AuthStore(): AuthStore;
get AuthStore(): BaseAuthStore;
/**
* @deprecated Legacy alias for `this.settings`.
*/
Expand Down
2 changes: 1 addition & 1 deletion dist/pocketbase.es.mjs.map

Large diffs are not rendered by default.

49 changes: 4 additions & 45 deletions dist/pocketbase.iife.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore {
onChange(callback: () => void): () => void;
protected triggerChange(): void;
}
/**
* The minimal AuthStore interface.
*
* @deprecated
* This interface predates the abstract BaseAuthStore class
* and it is kept mainly for backward compatibility.
*
* New AuthStore implementations should extend directly the
* BaseAuthStore abstract class.
*/
type AuthStore = {
/**
* Retrieves the stored token (if any).
*/
readonly token: string;
/**
* Retrieves the stored model data (if any).
*/
readonly model: User | Admin | null;
/**
* Checks if the store has valid (aka. existing and unexpired) token.
*/
readonly isValid: boolean;
/**
* Saves new token and model data in the auth store.
*/
save(token: string, model: User | Admin | null): void;
/**
* Removes the stored token and model data form the auth store.
*/
clear(): void;
/**
* Parses the provided cookie string and updates the store state
* with the cookie's token and model data.
*/
loadFromCookie(cookie: string, key?: string): void;
/**
* Exports the current store state as cookie string.
*/
exportToCookie(options?: SerializeOptions, key?: string): string;
};
/**
* BaseService class that should be inherited from all API services.
*/
Expand Down Expand Up @@ -639,9 +598,9 @@ declare class Client {
*/
lang: string;
/**
* A replaceable instance of the local `AuthStore` service.
* A replaceable instance of the local auth store service.
*/
authStore: AuthStore | BaseAuthStore;
authStore: BaseAuthStore;
/**
* An instance of the service that handles the **Settings APIs**.
*/
Expand Down Expand Up @@ -671,11 +630,11 @@ declare class Client {
*/
readonly realtime: Realtime;
private cancelControllers;
constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null);
constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null);
/**
* @deprecated Legacy alias for `this.authStore`.
*/
get AuthStore(): AuthStore;
get AuthStore(): BaseAuthStore;
/**
* @deprecated Legacy alias for `this.settings`.
*/
Expand Down
49 changes: 4 additions & 45 deletions dist/pocketbase.umd.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,47 +131,6 @@ declare abstract class BaseAuthStore {
onChange(callback: () => void): () => void;
protected triggerChange(): void;
}
/**
* The minimal AuthStore interface.
*
* @deprecated
* This interface predates the abstract BaseAuthStore class
* and it is kept mainly for backward compatibility.
*
* New AuthStore implementations should extend directly the
* BaseAuthStore abstract class.
*/
type AuthStore = {
/**
* Retrieves the stored token (if any).
*/
readonly token: string;
/**
* Retrieves the stored model data (if any).
*/
readonly model: User | Admin | null;
/**
* Checks if the store has valid (aka. existing and unexpired) token.
*/
readonly isValid: boolean;
/**
* Saves new token and model data in the auth store.
*/
save(token: string, model: User | Admin | null): void;
/**
* Removes the stored token and model data form the auth store.
*/
clear(): void;
/**
* Parses the provided cookie string and updates the store state
* with the cookie's token and model data.
*/
loadFromCookie(cookie: string, key?: string): void;
/**
* Exports the current store state as cookie string.
*/
exportToCookie(options?: SerializeOptions, key?: string): string;
};
/**
* BaseService class that should be inherited from all API services.
*/
Expand Down Expand Up @@ -639,9 +598,9 @@ declare class Client {
*/
lang: string;
/**
* A replaceable instance of the local `AuthStore` service.
* A replaceable instance of the local auth store service.
*/
authStore: AuthStore | BaseAuthStore;
authStore: BaseAuthStore;
/**
* An instance of the service that handles the **Settings APIs**.
*/
Expand Down Expand Up @@ -671,11 +630,11 @@ declare class Client {
*/
readonly realtime: Realtime;
private cancelControllers;
constructor(baseUrl?: string, lang?: string, authStore?: AuthStore | BaseAuthStore | null);
constructor(baseUrl?: string, lang?: string, authStore?: BaseAuthStore | null);
/**
* @deprecated Legacy alias for `this.authStore`.
*/
get AuthStore(): AuthStore;
get AuthStore(): BaseAuthStore;
/**
* @deprecated Legacy alias for `this.settings`.
*/
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.6.0",
"version": "0.6.1",
"name": "pocketbase",
"description": "PocketBase JavaScript SDK",
"author": "Gani Georgiev",
Expand Down
9 changes: 4 additions & 5 deletions src/Client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import ClientResponseError from '@/ClientResponseError';
import BaseAuthStore from '@/stores/BaseAuthStore';
import { AuthStore } from '@/stores/utils/AuthStore';
import LocalAuthStore from '@/stores/LocalAuthStore';
import Settings from '@/services/Settings';
import Admins from '@/services/Admins';
Expand Down Expand Up @@ -70,9 +69,9 @@ export default class Client {
lang: string;

/**
* A replaceable instance of the local `AuthStore` service.
* A replaceable instance of the local auth store service.
*/
authStore: AuthStore | BaseAuthStore;
authStore: BaseAuthStore;

/**
* An instance of the service that handles the **Settings APIs**.
Expand Down Expand Up @@ -114,7 +113,7 @@ export default class Client {
constructor(
baseUrl = '/',
lang = 'en-US',
authStore?: AuthStore | BaseAuthStore | null,
authStore?: BaseAuthStore | null,
) {
this.baseUrl = baseUrl;
this.lang = lang;
Expand All @@ -133,7 +132,7 @@ export default class Client {
/**
* @deprecated Legacy alias for `this.authStore`.
*/
get AuthStore(): AuthStore {
get AuthStore(): BaseAuthStore {
return this.authStore;
};

Expand Down
52 changes: 0 additions & 52 deletions src/stores/utils/AuthStore.ts

This file was deleted.

0 comments on commit 0aa9a3b

Please sign in to comment.