@keepkit/core 0.9.0 → 0.11.0
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 +8 -0
- package/dist/{chunk-DBRHZ6XU.js → chunk-36YIELZE.js} +192 -25
- package/dist/chunk-36YIELZE.js.map +1 -0
- package/dist/chunk-MDTL5L64.js +320 -0
- package/dist/chunk-MDTL5L64.js.map +1 -0
- package/dist/core.d.ts +27 -48
- package/dist/core.js +110 -131
- package/dist/core.js.map +1 -1
- package/dist/react.d.ts +23 -7
- package/dist/react.js +188 -11
- package/dist/react.js.map +1 -1
- package/dist/schema.d.ts +1 -1
- package/dist/scope-CtLSlZhq.d.ts +38 -0
- package/dist/storage.d.ts +19 -2
- package/dist/storage.js +7 -1
- package/dist/{types-BCziYE6E.d.ts → types-D-xRiz1Y.d.ts} +22 -2
- package/dist/url-BYFEfulm.d.ts +186 -0
- package/package.json +1 -1
- package/dist/chunk-AWQWKK4V.js +0 -151
- package/dist/chunk-AWQWKK4V.js.map +0 -1
- package/dist/chunk-DBRHZ6XU.js.map +0 -1
- package/dist/store-CqNh-2DS.d.ts +0 -104
package/dist/store-CqNh-2DS.d.ts
DELETED
|
@@ -1,104 +0,0 @@
|
|
|
1
|
-
import { a as KeepItem, S as StorageAdapter, f as KeepChangeContext } from './types-BCziYE6E.js';
|
|
2
|
-
|
|
3
|
-
type KeepListQuery<TMeta = Record<string, unknown>> = {
|
|
4
|
-
targetType?: string;
|
|
5
|
-
tags?: string[];
|
|
6
|
-
sort?: {
|
|
7
|
-
by: "savedAt" | "updatedAt";
|
|
8
|
-
direction?: "asc" | "desc";
|
|
9
|
-
};
|
|
10
|
-
search?: {
|
|
11
|
-
query?: string;
|
|
12
|
-
mode?: "and" | "or";
|
|
13
|
-
tokenize?: boolean;
|
|
14
|
-
fields?: Array<"note" | "meta" | "tags">;
|
|
15
|
-
};
|
|
16
|
-
pagination?: {
|
|
17
|
-
page?: number;
|
|
18
|
-
pageSize?: number;
|
|
19
|
-
};
|
|
20
|
-
filter?: (item: KeepItem<TMeta>) => boolean;
|
|
21
|
-
savedBetween?: readonly [Date | number, Date | number];
|
|
22
|
-
};
|
|
23
|
-
type QueryKeepItemsResult<TMeta = Record<string, unknown>> = {
|
|
24
|
-
items: KeepItem<TMeta>[];
|
|
25
|
-
totalCount: number;
|
|
26
|
-
tagCounts: Record<string, number>;
|
|
27
|
-
page: number;
|
|
28
|
-
pageCount: number;
|
|
29
|
-
hasNextPage: boolean;
|
|
30
|
-
hasPreviousPage: boolean;
|
|
31
|
-
};
|
|
32
|
-
/** Apply the collection query and one-based pagination without React. */
|
|
33
|
-
declare function queryKeepItems<TMeta = Record<string, unknown>>(source: KeepItem<TMeta>[], query?: KeepListQuery<TMeta>): QueryKeepItemsResult<TMeta>;
|
|
34
|
-
declare function getTagCounts<TMeta = Record<string, unknown>>(items: KeepItem<TMeta>[]): Record<string, number>;
|
|
35
|
-
|
|
36
|
-
type KeepItemStatus = "available" | "deleted" | "private" | "expired" | "unknown";
|
|
37
|
-
type KeepItemRevalidationResult<TMeta = Record<string, unknown>> = {
|
|
38
|
-
status: "available";
|
|
39
|
-
meta?: TMeta;
|
|
40
|
-
} | {
|
|
41
|
-
status: Exclude<KeepItemStatus, "available">;
|
|
42
|
-
reason?: string;
|
|
43
|
-
};
|
|
44
|
-
type KeepItemRevalidator<TMeta = Record<string, unknown>> = (item: KeepItem<TMeta>) => KeepItemRevalidationResult<TMeta> | KeepItemRevalidationResult<TMeta>["status"] | Promise<KeepItemRevalidationResult<TMeta> | KeepItemRevalidationResult<TMeta>["status"]>;
|
|
45
|
-
type KeepItemMetadataRefresher<TMeta = Record<string, unknown>> = (item: KeepItem<TMeta>) => TMeta | Promise<TMeta>;
|
|
46
|
-
/** Return whether source metadata should be fetched again based on its age. */
|
|
47
|
-
declare function isKeepItemMetadataStale<TMeta>(item: KeepItem<TMeta>, maxAgeMs: number, now?: () => number): boolean;
|
|
48
|
-
type KeepItemRevalidationRecord<TMeta = Record<string, unknown>> = {
|
|
49
|
-
item: KeepItem<TMeta>;
|
|
50
|
-
status: KeepItemStatus;
|
|
51
|
-
reason?: string;
|
|
52
|
-
updated: boolean;
|
|
53
|
-
};
|
|
54
|
-
type RevalidateKeepItemsOptions = {
|
|
55
|
-
/** Statuses that should be removed after they are detected. Detection is the default. */
|
|
56
|
-
removeStatuses?: Array<Exclude<KeepItemStatus, "available">>;
|
|
57
|
-
now?: () => number;
|
|
58
|
-
};
|
|
59
|
-
type KeepItemRevalidationSummary<TMeta = Record<string, unknown>> = {
|
|
60
|
-
items: KeepItem<TMeta>[];
|
|
61
|
-
checked: number;
|
|
62
|
-
updated: number;
|
|
63
|
-
removed: number;
|
|
64
|
-
updatedItems: KeepItem<TMeta>[];
|
|
65
|
-
removedIds: string[];
|
|
66
|
-
results: KeepItemRevalidationRecord<TMeta>[];
|
|
67
|
-
};
|
|
68
|
-
/** Revalidate saved items without coupling the checker to a network client. */
|
|
69
|
-
declare function revalidateKeepItems<TMeta = Record<string, unknown>>(source: KeepItem<TMeta>[], revalidator: KeepItemRevalidator<TMeta>, options?: RevalidateKeepItemsOptions): Promise<KeepItemRevalidationSummary<TMeta>>;
|
|
70
|
-
/** Revalidate and persist saved items for framework-neutral applications. */
|
|
71
|
-
declare function reconcileKeepItems<TMeta = Record<string, unknown>>(storage: StorageAdapter<TMeta>, revalidator: KeepItemRevalidator<TMeta>, options?: RevalidateKeepItemsOptions): Promise<KeepItemRevalidationSummary<TMeta>>;
|
|
72
|
-
|
|
73
|
-
type KeepStoreState<TMeta = Record<string, unknown>> = {
|
|
74
|
-
items: KeepItem<TMeta>[];
|
|
75
|
-
isLoading: boolean;
|
|
76
|
-
isHydrated: boolean;
|
|
77
|
-
isMutating: boolean;
|
|
78
|
-
error: unknown | null;
|
|
79
|
-
lastChange?: KeepChangeContext<TMeta>;
|
|
80
|
-
};
|
|
81
|
-
type KeepStoreActions<TMeta = Record<string, unknown>> = {
|
|
82
|
-
saveItem: (item: KeepItem<TMeta>) => Promise<void>;
|
|
83
|
-
updateNote: (id: string, note?: string) => Promise<void>;
|
|
84
|
-
updateTags: (id: string, tags?: string[]) => Promise<void>;
|
|
85
|
-
updateTagsBatch: (ids: string[], tags?: string[]) => Promise<void>;
|
|
86
|
-
addTagsBatch: (ids: string[], tags: string[]) => Promise<void>;
|
|
87
|
-
removeTagsBatch: (ids: string[], tags: string[]) => Promise<void>;
|
|
88
|
-
removeItem: (id: string) => Promise<void>;
|
|
89
|
-
removeItems: (ids: string[]) => Promise<void>;
|
|
90
|
-
clear: () => Promise<void>;
|
|
91
|
-
refresh: () => Promise<void>;
|
|
92
|
-
refreshItemMetadata: (id: string, refresh: KeepItemMetadataRefresher<TMeta>) => Promise<void>;
|
|
93
|
-
revalidateItems: (revalidator: KeepItemRevalidator<TMeta>, options?: RevalidateKeepItemsOptions) => Promise<KeepItemRevalidationSummary<TMeta>>;
|
|
94
|
-
};
|
|
95
|
-
declare class KeepStore<TMeta = Record<string, unknown>> {
|
|
96
|
-
private state;
|
|
97
|
-
private readonly listeners;
|
|
98
|
-
constructor(initialState: KeepStoreState<TMeta>);
|
|
99
|
-
getSnapshot: () => KeepStoreState<TMeta>;
|
|
100
|
-
subscribe: (listener: () => void) => (() => void);
|
|
101
|
-
setState(next: Partial<KeepStoreState<TMeta>>): void;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export { type KeepItemMetadataRefresher as K, type QueryKeepItemsResult as Q, type RevalidateKeepItemsOptions as R, type KeepItemRevalidationRecord as a, type KeepItemRevalidationResult as b, type KeepItemRevalidationSummary as c, type KeepItemRevalidator as d, type KeepItemStatus as e, type KeepListQuery as f, KeepStore as g, type KeepStoreActions as h, type KeepStoreState as i, getTagCounts as j, isKeepItemMetadataStale as k, revalidateKeepItems as l, queryKeepItems as q, reconcileKeepItems as r };
|