@superbright/indexeddb-orm 0.1.4 → 0.1.5
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/README.md +16 -14
- package/dist/adapters/dexie.d.ts +14 -0
- package/dist/adapters/structured-store.d.ts +44 -0
- package/dist/adapters/zustand-store.d.ts +54 -0
- package/dist/api/favorites.d.ts +4 -0
- package/dist/api/properties.d.ts +22 -0
- package/dist/api/users.d.ts +5 -0
- package/dist/db.d.ts +15 -0
- package/dist/debug.d.ts +2 -0
- package/dist/errors.d.ts +8 -0
- package/dist/features/units/transformers.d.ts +75 -0
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +14 -0
- package/dist/index.mjs +261 -352
- package/dist/index.mjs.map +1 -1
- package/dist/schema.d.ts +2880 -0
- package/dist/storage.d.ts +14 -0
- package/dist/stores/store.d.ts +42 -0
- package/dist/units/favorites.d.ts +7 -0
- package/dist/validation.d.ts +7 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface AsyncStringStorage {
|
|
2
|
+
getItem(name: string): Promise<string | null>;
|
|
3
|
+
setItem(name: string, value: string): Promise<void>;
|
|
4
|
+
removeItem(name: string): Promise<void>;
|
|
5
|
+
}
|
|
6
|
+
type storeKeys = "property" | "user" | "app";
|
|
7
|
+
export declare function kvGet<T>(key: storeKeys): Promise<T | null>;
|
|
8
|
+
export declare function kvSet<T>(key: storeKeys, value: T): Promise<void>;
|
|
9
|
+
export declare function kvRemove(key: storeKeys): Promise<void>;
|
|
10
|
+
export declare function createORMStringStorage(opts?: {
|
|
11
|
+
prefix?: string;
|
|
12
|
+
fallbackToMemory?: boolean;
|
|
13
|
+
}): AsyncStringStorage;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import type { ZodObject, ZodTypeAny } from "zod";
|
|
2
|
+
import { type UnifiedStoreData, type UserPropertyState, type Filters, type QueryParams, type ResultsMode, type SortBy, type TourContactData } from "../schema";
|
|
3
|
+
export declare class UnifiedStore {
|
|
4
|
+
private getState;
|
|
5
|
+
private setState;
|
|
6
|
+
initializeProperty(propertyId: string | number, slug: string): Promise<void>;
|
|
7
|
+
setUnitResults(units: unknown, schema?: ZodTypeAny): Promise<void>;
|
|
8
|
+
clearUnitResults(): Promise<void>;
|
|
9
|
+
setPropertyData(propertyId: string | number, data: unknown, schema?: ZodObject<any, any, any, any, any>): Promise<void>;
|
|
10
|
+
mergePropertyData(propertyId: string | number, partial: unknown, schema?: ZodObject<any, any, any, any, any>): Promise<void>;
|
|
11
|
+
upsertPropertyFromApi(apiProperty: unknown, schema?: ZodTypeAny): Promise<void>;
|
|
12
|
+
setCurrentProperty(propertyId: string | number, slug?: string): Promise<void>;
|
|
13
|
+
setCurrentPropertySlug(slug: string): Promise<void>;
|
|
14
|
+
setHasPreviouslySearched(slug: string): Promise<void>;
|
|
15
|
+
toggleFavorite(unitId: string): Promise<void>;
|
|
16
|
+
markUnitAsViewed(unitId: string, slug: string): Promise<void>;
|
|
17
|
+
setTourContactedOn(): Promise<void>;
|
|
18
|
+
getTourContactedOn(): Promise<string | null>;
|
|
19
|
+
setQuestionnaireResults(results: unknown): Promise<void>;
|
|
20
|
+
setTourContactData(data: TourContactData): Promise<void>;
|
|
21
|
+
setFilters(filters: Partial<Filters>): Promise<void>;
|
|
22
|
+
setTempFilters(filters: Partial<Filters>): Promise<void>;
|
|
23
|
+
setFiltersToDefault(): Promise<void>;
|
|
24
|
+
setApiFilters(filters: Partial<QueryParams>): Promise<void>;
|
|
25
|
+
handleTempFilterChange<K extends keyof Filters>(key: K, value: Filters[K]): Promise<void>;
|
|
26
|
+
submitFilterUpdate(): Promise<void>;
|
|
27
|
+
setResultsMode(mode: ResultsMode): Promise<void>;
|
|
28
|
+
setSortBy(sortBy: SortBy): Promise<void>;
|
|
29
|
+
setResolvedQuestionnaireValues(name: string, values: string[]): Promise<void>;
|
|
30
|
+
getUnitState(unitId: string): Promise<{
|
|
31
|
+
isFavorite: boolean;
|
|
32
|
+
viewedDate: string;
|
|
33
|
+
}>;
|
|
34
|
+
getResultsUrl(): Promise<string | null>;
|
|
35
|
+
getCurrentProperty(): Promise<UserPropertyState | null>;
|
|
36
|
+
getPropertyData(propertyId?: string | number): Promise<UserPropertyState | null>;
|
|
37
|
+
getFullState(): Promise<UnifiedStoreData>;
|
|
38
|
+
initialize(): Promise<void>;
|
|
39
|
+
}
|
|
40
|
+
export declare const store: UnifiedStore;
|
|
41
|
+
export { UnifiedStore as Store };
|
|
42
|
+
export type { UserPropertyState, Filters } from "../schema";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
declare const favorites: {
|
|
2
|
+
isFavorite(propertyId: string | number, unitId: string): Promise<boolean>;
|
|
3
|
+
toggle(propertyId: string | number, unitId: string): Promise<string[]>;
|
|
4
|
+
set(propertyId: string | number, unitId: string, on: boolean): Promise<string[]>;
|
|
5
|
+
getAll(propertyId: string | number): Promise<string[]>;
|
|
6
|
+
};
|
|
7
|
+
export { favorites };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { z } from "zod";
|
|
2
|
+
export type ValidationMode = "strict" | "warn" | "silent";
|
|
3
|
+
export declare function configureValidation(opts: {
|
|
4
|
+
mode?: ValidationMode;
|
|
5
|
+
onIssue?: (ctx: string, details: unknown) => void;
|
|
6
|
+
}): void;
|
|
7
|
+
export declare function validate<T>(schema: z.ZodType<T>, value: unknown, ctx: string): T | null;
|