@keepkit/core 0.10.0 → 0.12.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/dist/core.d.ts CHANGED
@@ -1,8 +1,11 @@
1
- export { I as ImportItemsOptions, a as ImportItemsResult, K as KEEP_BACKUP_FORMAT, b as KEEP_BACKUP_VERSION, c as KeepBackup, d as KeepBackupImportError, e as KeepBackupParseError, f as KeepItemMetadataRefresher, g as KeepItemResolver, h as KeepItemRevalidationRecord, i as KeepItemRevalidationResult, j as KeepItemRevalidationSummary, k as KeepItemRevalidator, l as KeepListQuery, m as KeepStore, n as KeepStoreActions, o as KeepStoreState, Q as QueryKeepItemsResult, R as RevalidateKeepItemsOptions, p as exportItems, q as getTagCounts, r as importItems, s as isKeepItemMetadataStale, t as queryKeepItems, u as reconcileKeepItems, v as revalidateKeepItems } from './store-Cgqx7_xd.js';
2
- import { b as KeepPluginContext, c as KeepPlugin, a as KeepItem, S as StorageAdapter } from './types--YahIoEB.js';
3
- export { d as KeepAction, e as KeepChangeContext, f as KeepChangePhase, g as KeepConflictContext, h as KeepConflictResolver, i as KeepErrorContext, j as KeepErrorHandler, k as KeepEventHandlers, l as KeepInvalidItemPolicy, m as KeepItemInput, n as KeepItemStatus, K as KeepSchema, o as KeepSchemaParseResult, p as KeepStorageAccessError, q as KeepStorageError, r as KeepStorageOperation, s as KeepStorageParseError, t as KeepStorageQuotaError, u as KeepSyncState, v as KeepSyncStatus, R as RemoteSyncDriver, w as RemoteSyncResult, x as SyncCapableStorageAdapter, y as SyncOperation, z as SyncQueueAdapter, A as SyncScope, B as normalizeKeepTags } from './types--YahIoEB.js';
1
+ export { D as DEFAULT_KEEP_URL_PARAMS, I as ImportItemsOptions, a as ImportItemsResult, K as KEEP_BACKUP_FORMAT, b as KEEP_BACKUP_VERSION, c as KeepAutoRevalidationOptions, d as KeepBackup, e as KeepBackupImportError, f as KeepBackupParseError, g as KeepItemMetadataRefresher, h as KeepItemResolver, i as KeepItemRevalidationRecord, j as KeepItemRevalidationResult, k as KeepItemRevalidationSummary, l as KeepItemRevalidator, m as KeepListQuery, n as KeepStore, o as KeepStoreActions, p as KeepStoreState, q as KeepUrlParamNames, r as KeepUrlState, s as KeepUrlSyncOptions, Q as QueryKeepItemsResult, R as RevalidateKeepItemsOptions, t as decodeKeepListQuery, u as encodeKeepListQuery, v as exportItems, w as getTagCounts, x as importItems, y as isKeepItemMetadataStale, z as mergeKeepListQueryFromUrl, A as queryKeepItems, B as reconcileKeepItems, C as revalidateKeepItems, E as serializeKeepListQuery } from './url-VhisKZCR.js';
2
+ import { e as KeepPluginContext, f as KeepPlugin, a as KeepItem, b as StorageAdapter, R as RemoteSyncDriver, d as SyncOperation, S as SyncScope, g as SyncCapableStorageAdapter, h as RemoteSyncResult, i as KeepSyncAuthError } from './types-iMK12pmy.js';
3
+ export { j as KeepAction, k as KeepChangeContext, l as KeepChangePhase, m as KeepConflictContext, n as KeepConflictResolver, o as KeepErrorContext, p as KeepErrorHandler, q as KeepEventHandlers, r as KeepInvalidItemPolicy, s as KeepItemInput, t as KeepItemStatus, K as KeepSchema, u as KeepSchemaParseResult, v as KeepStorageAccessError, w as KeepStorageError, x as KeepStorageOperation, y as KeepStorageParseError, z as KeepStorageQuotaError, A as KeepSyncAuthStatus, B as KeepSyncConflict, C as KeepSyncResolution, D as KeepSyncState, E as KeepSyncStatus, F as KeepUndoState, c as SyncQueueAdapter, G as isKeepSyncAuthError, H as normalizeKeepTags } from './types-iMK12pmy.js';
4
+ import { K as KeepScope } from './scope-y_aBm363.js';
5
+ export { S as ScopedStorageAdapter, a as ScopedSyncQueueAdapter, c as createScopedStorageAdapter, g as getKeepScopeKey, i as isSameKeepScope } from './scope-y_aBm363.js';
4
6
  export { KeepSchemaValidationError, parseKeepMeta, validateKeepItem } from './schema.js';
5
- export { BrowserStorageAdapterOptions, DEFAULT_INDEXEDDB_DATABASE, DEFAULT_INDEXEDDB_STORE, DEFAULT_STORAGE_KEY, DEFAULT_SYNC_QUEUE_DATABASE, DEFAULT_SYNC_QUEUE_KEY, DEFAULT_SYNC_QUEUE_STORE, FallbackStorageAdapter, FallbackStorageAdapterOptions, FallbackSyncQueueAdapter, FallbackSyncQueueAdapterOptions, IndexedDBAdapter, IndexedDBAdapterOptions, IndexedDBSyncQueueAdapter, IndexedDBSyncQueueOptions, LocalStorageAdapter, LocalStorageAdapterOptions, LocalStorageSyncQueueAdapter, LocalStorageSyncQueueOptions, StorageAdapterFactoryOptions, SyncStorageAdapter, SyncStorageAdapterOptions, createBrowserStorageAdapter, createStorageAdapter } from './storage.js';
7
+ import { SyncStorageAdapterOptions, BrowserStorageAdapterOptions } from './storage.js';
8
+ export { DEFAULT_INDEXEDDB_DATABASE, DEFAULT_INDEXEDDB_STORE, DEFAULT_STORAGE_KEY, DEFAULT_SYNC_QUEUE_DATABASE, DEFAULT_SYNC_QUEUE_KEY, DEFAULT_SYNC_QUEUE_STORE, FallbackStorageAdapter, FallbackStorageAdapterOptions, FallbackSyncQueueAdapter, FallbackSyncQueueAdapterOptions, IndexedDBAdapter, IndexedDBAdapterOptions, IndexedDBSyncQueueAdapter, IndexedDBSyncQueueOptions, LocalStorageAdapter, LocalStorageAdapterOptions, LocalStorageSyncQueueAdapter, LocalStorageSyncQueueOptions, StorageAdapterFactoryOptions, SyncStorageAdapter, createBrowserStorageAdapter, createStorageAdapter } from './storage.js';
6
9
 
7
10
  type KeepInvalidationPluginOptions<TMeta = Record<string, unknown>> = {
8
11
  /** Query keys to invalidate after a successful local KeepKit mutation. */
@@ -19,4 +22,67 @@ declare function mergeKeepItems<TMeta>(localItems: KeepItem<TMeta>[], target: St
19
22
  /** Read anonymous items, merge them into the target, then clear the source. */
20
23
  declare function migrateKeepItems<TMeta>(source: StorageAdapter<TMeta>, target: StorageAdapter<TMeta>): Promise<KeepItem<TMeta>[]>;
21
24
 
22
- export { type KeepInvalidationPluginOptions, KeepItem, KeepPlugin, KeepPluginContext, StorageAdapter, createKeepInvalidationPlugin, mergeKeepItems, migrateKeepItems };
25
+ type KeepKitPresetMode = "local" | "sync" | "backup";
26
+ type KeepKitPresetOptions<TMeta = Record<string, unknown>> = {
27
+ mode?: KeepKitPresetMode;
28
+ key?: string;
29
+ scope?: KeepScope;
30
+ remote?: RemoteSyncDriver<TMeta>;
31
+ storage?: StorageAdapter<TMeta>;
32
+ };
33
+ type KeepKitSetup<TMeta = Record<string, unknown>> = {
34
+ mode: KeepKitPresetMode;
35
+ scope?: KeepScope;
36
+ storage: StorageAdapter<TMeta>;
37
+ exportBackup: () => Promise<string>;
38
+ };
39
+ /**
40
+ * Build the recommended local/sync/backup wiring without imposing an auth or
41
+ * API client. Pass the current user and tenant scope whenever the account changes.
42
+ */
43
+ declare function createKeepKitPreset<TMeta = Record<string, unknown>>(options?: KeepKitPresetOptions<TMeta>): KeepKitSetup<TMeta>;
44
+ declare const createKeepKitSetup: typeof createKeepKitPreset;
45
+
46
+ type AuthenticatedSyncRequestContext<TMeta = Record<string, unknown>> = {
47
+ token: string | null;
48
+ scope?: SyncScope;
49
+ operation?: SyncOperation<TMeta>;
50
+ };
51
+ /** Transport boundary for auth-aware requests; cookies and bearer tokens remain host concerns. */
52
+ type AuthenticatedSyncTransport<TMeta = Record<string, unknown>> = {
53
+ push: (operation: SyncOperation<TMeta>, context: AuthenticatedSyncRequestContext<TMeta>) => Promise<RemoteSyncResult<TMeta>>;
54
+ pull?: (context: AuthenticatedSyncRequestContext<TMeta>) => Promise<KeepItem<TMeta>[]>;
55
+ };
56
+ type AuthenticatedSyncAuthContext<TMeta = Record<string, unknown>> = {
57
+ operation?: SyncOperation<TMeta>;
58
+ scope?: SyncScope;
59
+ };
60
+ type AuthenticatedSyncKitOptions<TMeta = Record<string, unknown>> = Omit<SyncStorageAdapterOptions<TMeta>, "local" | "remote" | "scope"> & {
61
+ /** Optional custom local adapter. Browser storage is used when omitted. */
62
+ local?: StorageAdapter<TMeta>;
63
+ key?: BrowserStorageAdapterOptions["key"];
64
+ databaseName?: BrowserStorageAdapterOptions["databaseName"];
65
+ scope?: SyncScope;
66
+ /** Resolve the active account or tenant before storage operations. */
67
+ getScope?: () => SyncScope | undefined | Promise<SyncScope | undefined>;
68
+ getAuthToken: () => Promise<string | null>;
69
+ transport: AuthenticatedSyncTransport<TMeta>;
70
+ onAuthError?: (error: KeepSyncAuthError<TMeta>, context: AuthenticatedSyncAuthContext<TMeta>) => void | Promise<void>;
71
+ onReauthenticate?: (error: KeepSyncAuthError<TMeta>, context: AuthenticatedSyncAuthContext<TMeta>) => void | Promise<void>;
72
+ onScopeChange?: (next: SyncScope | undefined, previous: SyncScope | undefined) => void | Promise<void>;
73
+ };
74
+ type AuthenticatedSyncKit<TMeta = Record<string, unknown>> = {
75
+ readonly mode: "sync";
76
+ readonly storage: SyncCapableStorageAdapter<TMeta>;
77
+ readonly scope?: SyncScope;
78
+ readonly scopeKey: string;
79
+ getScope(): SyncScope | undefined;
80
+ setScope(scope?: SyncScope): Promise<void>;
81
+ subscribeScope(listener: () => void): () => void;
82
+ exportBackup(): Promise<string>;
83
+ dispose(): void;
84
+ };
85
+ /** Creates auth-independent sync wiring with per-request tokens and isolated account scopes. */
86
+ declare function createAuthenticatedSyncKit<TMeta = Record<string, unknown>>(options: AuthenticatedSyncKitOptions<TMeta>): AuthenticatedSyncKit<TMeta>;
87
+
88
+ export { type AuthenticatedSyncAuthContext, type AuthenticatedSyncKit, type AuthenticatedSyncKitOptions, type AuthenticatedSyncRequestContext, type AuthenticatedSyncTransport, BrowserStorageAdapterOptions, type KeepInvalidationPluginOptions, KeepItem, type KeepKitPresetMode, type KeepKitPresetOptions, type KeepKitSetup, KeepPlugin, KeepPluginContext, KeepScope, KeepSyncAuthError, RemoteSyncDriver, RemoteSyncResult, StorageAdapter, SyncCapableStorageAdapter, SyncOperation, SyncScope, SyncStorageAdapterOptions, createAuthenticatedSyncKit, createKeepInvalidationPlugin, createKeepKitPreset, createKeepKitSetup, mergeKeepItems, migrateKeepItems };
package/dist/core.js CHANGED
@@ -13,7 +13,7 @@ import {
13
13
  queryKeepItems,
14
14
  reconcileKeepItems,
15
15
  revalidateKeepItems
16
- } from "./chunk-XF5VI6O5.js";
16
+ } from "./chunk-MDTL5L64.js";
17
17
  import {
18
18
  KeepSchemaValidationError,
19
19
  parseKeepMeta,
@@ -34,13 +34,20 @@ import {
34
34
  KeepStorageError,
35
35
  KeepStorageParseError,
36
36
  KeepStorageQuotaError,
37
+ KeepSyncAuthError,
37
38
  LocalStorageAdapter,
38
39
  LocalStorageSyncQueueAdapter,
40
+ ScopedStorageAdapter,
41
+ ScopedSyncQueueAdapter,
39
42
  SyncStorageAdapter,
40
43
  createBrowserStorageAdapter,
44
+ createScopedStorageAdapter,
41
45
  createStorageAdapter,
46
+ getKeepScopeKey,
47
+ isKeepSyncAuthError,
48
+ isSameKeepScope,
42
49
  normalizeKeepTags
43
- } from "./chunk-EXE4E3GA.js";
50
+ } from "./chunk-VJDO3GFH.js";
44
51
 
45
52
  // src/integrations.ts
46
53
  function createKeepInvalidationPlugin(options) {
@@ -52,9 +59,291 @@ function createKeepInvalidationPlugin(options) {
52
59
  }
53
60
  };
54
61
  }
62
+
63
+ // src/presets.ts
64
+ function createKeepKitPreset(options = {}) {
65
+ const mode = options.mode ?? "local";
66
+ const local = options.storage ? options.scope ? createScopedStorageAdapter(options.storage, options.scope) : options.storage : createBrowserStorageAdapter({ key: options.key, scope: options.scope });
67
+ if (mode === "sync" && !options.remote) {
68
+ throw new Error('createKeepKitPreset({ mode: "sync" }) requires a remote driver.');
69
+ }
70
+ let storage = local;
71
+ if (mode === "sync") {
72
+ const remote = options.remote;
73
+ if (!remote) throw new Error('createKeepKitPreset({ mode: "sync" }) requires a remote driver.');
74
+ storage = new SyncStorageAdapter({
75
+ local,
76
+ remote,
77
+ userId: options.scope?.userId,
78
+ tenantId: options.scope?.tenantId
79
+ });
80
+ }
81
+ return {
82
+ mode,
83
+ scope: options.scope,
84
+ storage,
85
+ exportBackup: () => exportItems(storage)
86
+ };
87
+ }
88
+ var createKeepKitSetup = createKeepKitPreset;
89
+
90
+ // src/templates/auth-sync.ts
91
+ function createAuthenticatedSyncKit(options) {
92
+ const controller = new AuthenticatedSyncStorageController(options);
93
+ return {
94
+ mode: "sync",
95
+ storage: controller,
96
+ get scope() {
97
+ return controller.scope;
98
+ },
99
+ get scopeKey() {
100
+ return controller.scopeKey;
101
+ },
102
+ getScope: () => controller.scope,
103
+ setScope: (scope) => controller.setScope(scope),
104
+ subscribeScope: (listener) => controller.subscribeScope(listener),
105
+ exportBackup: () => controller.exportBackup(),
106
+ dispose: () => controller.dispose()
107
+ };
108
+ }
109
+ var AuthenticatedSyncStorageController = class {
110
+ constructor(options) {
111
+ this.scopeListeners = /* @__PURE__ */ new Set();
112
+ this.dataListeners = /* @__PURE__ */ new Set();
113
+ this.syncListeners = /* @__PURE__ */ new Set();
114
+ this.unsubscribeData = () => void 0;
115
+ this.unsubscribeSync = () => void 0;
116
+ this.transition = Promise.resolve();
117
+ this.disposed = false;
118
+ this.options = options;
119
+ this.currentScope = options.scope;
120
+ this.current = this.createAdapter(this.currentScope);
121
+ this.attach(this.current);
122
+ }
123
+ get storageKey() {
124
+ return this.current.storageKey;
125
+ }
126
+ get scope() {
127
+ return this.currentScope;
128
+ }
129
+ get scopeKey() {
130
+ return getKeepScopeKey(this.currentScope);
131
+ }
132
+ async getAll() {
133
+ await this.ensureScope();
134
+ return this.current.getAll();
135
+ }
136
+ async set(item) {
137
+ await this.ensureScope();
138
+ return this.current.set(item);
139
+ }
140
+ async setMany(items) {
141
+ await this.ensureScope();
142
+ return this.current.setMany(items);
143
+ }
144
+ async remove(id) {
145
+ await this.ensureScope();
146
+ return this.current.remove(id);
147
+ }
148
+ async removeMany(ids) {
149
+ await this.ensureScope();
150
+ return this.current.removeMany(ids);
151
+ }
152
+ async clear() {
153
+ await this.ensureScope();
154
+ return this.current.clear();
155
+ }
156
+ async merge(items) {
157
+ await this.ensureScope();
158
+ return this.current.merge(items);
159
+ }
160
+ subscribe(listener) {
161
+ this.dataListeners.add(listener);
162
+ return () => this.dataListeners.delete(listener);
163
+ }
164
+ getSyncState() {
165
+ return this.current.getSyncState();
166
+ }
167
+ subscribeSync(listener) {
168
+ this.syncListeners.add(listener);
169
+ return () => this.syncListeners.delete(listener);
170
+ }
171
+ async flushSync() {
172
+ await this.ensureScope();
173
+ return this.current.flushSync();
174
+ }
175
+ async retrySync() {
176
+ await this.ensureScope();
177
+ return this.current.retrySync?.() ?? this.current.flushSync();
178
+ }
179
+ async resolveSyncConflict(id, resolution, item) {
180
+ await this.ensureScope();
181
+ if (!this.current.resolveSyncConflict) {
182
+ throw new Error("The authenticated sync adapter does not support conflict resolution.");
183
+ }
184
+ return this.current.resolveSyncConflict(id, resolution, item);
185
+ }
186
+ async setScope(nextScope) {
187
+ const run = this.transition.then(async () => {
188
+ if (isSameKeepScope(this.currentScope, nextScope)) return;
189
+ if (this.disposed) throw new Error("AuthenticatedSyncKit has been disposed.");
190
+ const previousScope = this.currentScope;
191
+ this.unsubscribeData();
192
+ this.unsubscribeSync();
193
+ this.current.dispose?.();
194
+ this.currentScope = nextScope;
195
+ this.current = this.createAdapter(nextScope);
196
+ this.attach(this.current);
197
+ await this.options.onScopeChange?.(nextScope, previousScope);
198
+ this.notify(this.scopeListeners);
199
+ this.notify(this.dataListeners);
200
+ this.notify(this.syncListeners);
201
+ });
202
+ this.transition = run.catch(() => void 0);
203
+ return run;
204
+ }
205
+ subscribeScope(listener) {
206
+ this.scopeListeners.add(listener);
207
+ return () => this.scopeListeners.delete(listener);
208
+ }
209
+ async exportBackup() {
210
+ await this.ensureScope();
211
+ return exportItems(this.current);
212
+ }
213
+ dispose() {
214
+ this.disposed = true;
215
+ this.unsubscribeData();
216
+ this.unsubscribeSync();
217
+ this.current.dispose?.();
218
+ this.scopeListeners.clear();
219
+ this.dataListeners.clear();
220
+ this.syncListeners.clear();
221
+ }
222
+ createAdapter(scope) {
223
+ const local = this.options.local ? scope ? createScopedStorageAdapter(this.options.local, scope) : this.options.local : createBrowserStorageAdapter({ key: this.options.key, databaseName: this.options.databaseName, scope });
224
+ const queue = this.options.queue && scope ? new ScopedSyncQueueAdapter(this.options.queue, scope) : this.options.queue;
225
+ const remote = createAuthenticatedRemote(this.options, scope);
226
+ return new SyncStorageAdapter({
227
+ ...this.options,
228
+ local,
229
+ remote,
230
+ queue,
231
+ scope
232
+ });
233
+ }
234
+ attach(adapter) {
235
+ this.unsubscribeData = adapter.subscribe?.(() => this.notify(this.dataListeners)) ?? (() => void 0);
236
+ this.unsubscribeSync = adapter.subscribeSync(() => this.notify(this.syncListeners));
237
+ }
238
+ async ensureScope() {
239
+ if (!this.options.getScope) return;
240
+ await this.setScope(await this.options.getScope());
241
+ }
242
+ notify(listeners) {
243
+ for (const listener of listeners) listener();
244
+ }
245
+ };
246
+ function createAuthenticatedRemote(options, scope) {
247
+ const pull = options.transport.pull;
248
+ return {
249
+ push: async (operation) => {
250
+ try {
251
+ const token = await options.getAuthToken();
252
+ return await options.transport.push(operation, { token, scope, operation });
253
+ } catch (cause) {
254
+ return handleAuthFailure(cause, options, { operation, scope });
255
+ }
256
+ },
257
+ pull: pull ? async () => {
258
+ try {
259
+ const token = await options.getAuthToken();
260
+ return await pull({ token, scope });
261
+ } catch (cause) {
262
+ return handleAuthFailure(cause, options, { scope });
263
+ }
264
+ } : void 0
265
+ };
266
+ }
267
+ async function handleAuthFailure(cause, options, context) {
268
+ const status = getAuthStatus(cause);
269
+ if (!status) throw cause;
270
+ const error = cause instanceof KeepSyncAuthError ? cause : new KeepSyncAuthError(status, { operation: context.operation, scope: context.scope, cause });
271
+ await options.onAuthError?.(error, context);
272
+ await options.onReauthenticate?.(error, context);
273
+ throw error;
274
+ }
275
+ function getAuthStatus(error) {
276
+ if (error instanceof KeepSyncAuthError) return error.status;
277
+ if (!error || typeof error !== "object") return void 0;
278
+ const candidate = error;
279
+ if (candidate.status === 401 || candidate.status === 403) return candidate.status;
280
+ if (candidate.response?.status === 401 || candidate.response?.status === 403) return candidate.response.status;
281
+ return candidate.cause ? getAuthStatus(candidate.cause) : void 0;
282
+ }
283
+
284
+ // src/url.ts
285
+ var DEFAULT_KEEP_URL_PARAMS = {
286
+ search: "q",
287
+ tags: "tag",
288
+ sort: "sort",
289
+ page: "page"
290
+ };
291
+ function encodeKeepListQuery(query = {}, options = {}) {
292
+ const params = { ...DEFAULT_KEEP_URL_PARAMS, ...options.params };
293
+ const result = new URLSearchParams();
294
+ const search = query.search?.query?.trim();
295
+ if (search) result.set(params.search, search);
296
+ for (const tag of query.tags ?? []) {
297
+ const normalized = tag.trim();
298
+ if (normalized) result.append(params.tags, normalized);
299
+ }
300
+ if (query.sort?.by) result.set(params.sort, `${query.sort.by}:${query.sort.direction ?? "desc"}`);
301
+ const page = query.pagination?.page;
302
+ if (page !== void 0 && Number.isFinite(page) && page > 1) result.set(params.page, String(Math.floor(page)));
303
+ return result;
304
+ }
305
+ function decodeKeepListQuery(input, options = {}) {
306
+ const params = { ...DEFAULT_KEEP_URL_PARAMS, ...options.params };
307
+ const searchParams = input instanceof URLSearchParams ? input : new URL(input, "http://keepkit.invalid").searchParams;
308
+ const search = searchParams.get(params.search)?.trim();
309
+ const tags = [
310
+ ...new Set(
311
+ searchParams.getAll(params.tags).map((tag) => tag.trim()).filter(Boolean)
312
+ )
313
+ ];
314
+ const sortValue = searchParams.get(params.sort)?.split(":");
315
+ const sort = sortValue?.[0] === "savedAt" || sortValue?.[0] === "updatedAt" ? {
316
+ by: sortValue[0],
317
+ direction: sortValue[1] === "asc" ? "asc" : "desc"
318
+ } : void 0;
319
+ const rawPage = Number(searchParams.get(params.page));
320
+ const page = Number.isInteger(rawPage) && rawPage > 0 ? rawPage : void 0;
321
+ return {
322
+ ...search ? { search: { query: search } } : {},
323
+ ...tags.length > 0 ? { tags } : {},
324
+ ...sort ? { sort } : {},
325
+ ...page ? { pagination: { page } } : {}
326
+ };
327
+ }
328
+ function serializeKeepListQuery(query = {}, options = {}) {
329
+ const value = encodeKeepListQuery(query, options).toString();
330
+ return value ? `?${value}` : "";
331
+ }
332
+ function mergeKeepListQueryFromUrl(query, input, options = {}) {
333
+ const decoded = decodeKeepListQuery(input, options);
334
+ return {
335
+ ...query,
336
+ ...decoded,
337
+ search: decoded.search ?? query.search,
338
+ tags: decoded.tags ?? query.tags,
339
+ sort: decoded.sort ?? query.sort,
340
+ pagination: decoded.pagination ? { ...query.pagination, ...decoded.pagination } : query.pagination
341
+ };
342
+ }
55
343
  export {
56
344
  DEFAULT_INDEXEDDB_DATABASE,
57
345
  DEFAULT_INDEXEDDB_STORE,
346
+ DEFAULT_KEEP_URL_PARAMS,
58
347
  DEFAULT_STORAGE_KEY,
59
348
  DEFAULT_SYNC_QUEUE_DATABASE,
60
349
  DEFAULT_SYNC_QUEUE_KEY,
@@ -73,23 +362,37 @@ export {
73
362
  KeepStorageParseError,
74
363
  KeepStorageQuotaError,
75
364
  KeepStore,
365
+ KeepSyncAuthError,
76
366
  LocalStorageAdapter,
77
367
  LocalStorageSyncQueueAdapter,
368
+ ScopedStorageAdapter,
369
+ ScopedSyncQueueAdapter,
78
370
  SyncStorageAdapter,
371
+ createAuthenticatedSyncKit,
79
372
  createBrowserStorageAdapter,
80
373
  createKeepInvalidationPlugin,
374
+ createKeepKitPreset,
375
+ createKeepKitSetup,
376
+ createScopedStorageAdapter,
81
377
  createStorageAdapter,
378
+ decodeKeepListQuery,
379
+ encodeKeepListQuery,
82
380
  exportItems,
381
+ getKeepScopeKey,
83
382
  getTagCounts,
84
383
  importItems,
85
384
  isKeepItemMetadataStale,
385
+ isKeepSyncAuthError,
386
+ isSameKeepScope,
86
387
  mergeKeepItems,
388
+ mergeKeepListQueryFromUrl,
87
389
  migrateKeepItems,
88
390
  normalizeKeepTags,
89
391
  parseKeepMeta,
90
392
  queryKeepItems,
91
393
  reconcileKeepItems,
92
394
  revalidateKeepItems,
395
+ serializeKeepListQuery,
93
396
  validateKeepItem
94
397
  };
95
398
  //# sourceMappingURL=core.js.map
package/dist/core.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/integrations.ts"],"sourcesContent":["import type { KeepPlugin, KeepPluginContext } from \"./types\";\n\nexport type KeepInvalidationPluginOptions<TMeta = Record<string, unknown>> = {\n /** Query keys to invalidate after a successful local KeepKit mutation. */\n queryKeys: readonly unknown[] | ((context: KeepPluginContext<TMeta>) => readonly (readonly unknown[])[]);\n /** Connect this callback to queryClient.invalidateQueries or SWR mutate. */\n invalidate: (queryKey: readonly unknown[], context: KeepPluginContext<TMeta>) => void | Promise<void>;\n name?: string;\n};\n\n/** Framework-neutral bridge for TanStack Query, SWR, and similar caches. */\nexport function createKeepInvalidationPlugin<TMeta = Record<string, unknown>>(\n options: KeepInvalidationPluginOptions<TMeta>,\n): KeepPlugin<TMeta> {\n return {\n name: options.name ?? \"keepkit-cache-invalidation\",\n after: async (context) => {\n const keys = typeof options.queryKeys === \"function\" ? options.queryKeys(context) : [options.queryKeys];\n await Promise.all(keys.map((queryKey) => options.invalidate(queryKey, context)));\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,6BACd,SACmB;AACnB,SAAO;AAAA,IACL,MAAM,QAAQ,QAAQ;AAAA,IACtB,OAAO,OAAO,YAAY;AACxB,YAAM,OAAO,OAAO,QAAQ,cAAc,aAAa,QAAQ,UAAU,OAAO,IAAI,CAAC,QAAQ,SAAS;AACtG,YAAM,QAAQ,IAAI,KAAK,IAAI,CAAC,aAAa,QAAQ,WAAW,UAAU,OAAO,CAAC,CAAC;AAAA,IACjF;AAAA,EACF;AACF;","names":[]}
1
+ {"version":3,"sources":["../src/integrations.ts","../src/presets.ts","../src/templates/auth-sync.ts","../src/url.ts"],"sourcesContent":["import type { KeepPlugin, KeepPluginContext } from \"./types\";\n\nexport type KeepInvalidationPluginOptions<TMeta = Record<string, unknown>> = {\n /** Query keys to invalidate after a successful local KeepKit mutation. */\n queryKeys: readonly unknown[] | ((context: KeepPluginContext<TMeta>) => readonly (readonly unknown[])[]);\n /** Connect this callback to queryClient.invalidateQueries or SWR mutate. */\n invalidate: (queryKey: readonly unknown[], context: KeepPluginContext<TMeta>) => void | Promise<void>;\n name?: string;\n};\n\n/** Framework-neutral bridge for TanStack Query, SWR, and similar caches. */\nexport function createKeepInvalidationPlugin<TMeta = Record<string, unknown>>(\n options: KeepInvalidationPluginOptions<TMeta>,\n): KeepPlugin<TMeta> {\n return {\n name: options.name ?? \"keepkit-cache-invalidation\",\n after: async (context) => {\n const keys = typeof options.queryKeys === \"function\" ? options.queryKeys(context) : [options.queryKeys];\n await Promise.all(keys.map((queryKey) => options.invalidate(queryKey, context)));\n },\n };\n}\n","import { exportItems } from \"./backup\";\nimport { createScopedStorageAdapter, type KeepScope } from \"./scope\";\nimport { createBrowserStorageAdapter } from \"./storage/index\";\nimport { SyncStorageAdapter } from \"./storage/sync\";\nimport type { RemoteSyncDriver, StorageAdapter } from \"./types\";\n\nexport type KeepKitPresetMode = \"local\" | \"sync\" | \"backup\";\n\nexport type KeepKitPresetOptions<TMeta = Record<string, unknown>> = {\n mode?: KeepKitPresetMode;\n key?: string;\n scope?: KeepScope;\n remote?: RemoteSyncDriver<TMeta>;\n storage?: StorageAdapter<TMeta>;\n};\n\nexport type KeepKitSetup<TMeta = Record<string, unknown>> = {\n mode: KeepKitPresetMode;\n scope?: KeepScope;\n storage: StorageAdapter<TMeta>;\n exportBackup: () => Promise<string>;\n};\n\n/**\n * Build the recommended local/sync/backup wiring without imposing an auth or\n * API client. Pass the current user and tenant scope whenever the account changes.\n */\nexport function createKeepKitPreset<TMeta = Record<string, unknown>>(\n options: KeepKitPresetOptions<TMeta> = {},\n): KeepKitSetup<TMeta> {\n const mode = options.mode ?? \"local\";\n const local = options.storage\n ? options.scope\n ? createScopedStorageAdapter(options.storage, options.scope)\n : options.storage\n : createBrowserStorageAdapter<TMeta>({ key: options.key, scope: options.scope });\n if (mode === \"sync\" && !options.remote) {\n throw new Error('createKeepKitPreset({ mode: \"sync\" }) requires a remote driver.');\n }\n let storage: StorageAdapter<TMeta> = local;\n if (mode === \"sync\") {\n const remote = options.remote;\n if (!remote) throw new Error('createKeepKitPreset({ mode: \"sync\" }) requires a remote driver.');\n storage = new SyncStorageAdapter<TMeta>({\n local,\n remote,\n userId: options.scope?.userId,\n tenantId: options.scope?.tenantId,\n });\n }\n return {\n mode,\n scope: options.scope,\n storage,\n exportBackup: () => exportItems(storage),\n };\n}\n\nexport const createKeepKitSetup = createKeepKitPreset;\n","import { exportItems } from \"../backup\";\nimport { createScopedStorageAdapter, getKeepScopeKey, isSameKeepScope, ScopedSyncQueueAdapter } from \"../scope\";\nimport { type BrowserStorageAdapterOptions, createBrowserStorageAdapter } from \"../storage\";\nimport { SyncStorageAdapter, type SyncStorageAdapterOptions } from \"../storage/sync\";\nimport type {\n KeepItem,\n KeepSyncAuthError,\n KeepSyncAuthStatus,\n KeepSyncState,\n RemoteSyncDriver,\n RemoteSyncResult,\n StorageAdapter,\n SyncCapableStorageAdapter,\n SyncOperation,\n SyncScope,\n} from \"../types\";\nimport { KeepSyncAuthError as KeepSyncAuthErrorClass } from \"../types\";\n\nexport type AuthenticatedSyncRequestContext<TMeta = Record<string, unknown>> = {\n token: string | null;\n scope?: SyncScope;\n operation?: SyncOperation<TMeta>;\n};\n\n/** Transport boundary for auth-aware requests; cookies and bearer tokens remain host concerns. */\nexport type AuthenticatedSyncTransport<TMeta = Record<string, unknown>> = {\n push: (\n operation: SyncOperation<TMeta>,\n context: AuthenticatedSyncRequestContext<TMeta>,\n ) => Promise<RemoteSyncResult<TMeta>>;\n pull?: (context: AuthenticatedSyncRequestContext<TMeta>) => Promise<KeepItem<TMeta>[]>;\n};\n\nexport type AuthenticatedSyncAuthContext<TMeta = Record<string, unknown>> = {\n operation?: SyncOperation<TMeta>;\n scope?: SyncScope;\n};\n\nexport type AuthenticatedSyncKitOptions<TMeta = Record<string, unknown>> = Omit<\n SyncStorageAdapterOptions<TMeta>,\n \"local\" | \"remote\" | \"scope\"\n> & {\n /** Optional custom local adapter. Browser storage is used when omitted. */\n local?: StorageAdapter<TMeta>;\n key?: BrowserStorageAdapterOptions[\"key\"];\n databaseName?: BrowserStorageAdapterOptions[\"databaseName\"];\n scope?: SyncScope;\n /** Resolve the active account or tenant before storage operations. */\n getScope?: () => SyncScope | undefined | Promise<SyncScope | undefined>;\n getAuthToken: () => Promise<string | null>;\n transport: AuthenticatedSyncTransport<TMeta>;\n onAuthError?: (error: KeepSyncAuthError<TMeta>, context: AuthenticatedSyncAuthContext<TMeta>) => void | Promise<void>;\n onReauthenticate?: (\n error: KeepSyncAuthError<TMeta>,\n context: AuthenticatedSyncAuthContext<TMeta>,\n ) => void | Promise<void>;\n onScopeChange?: (next: SyncScope | undefined, previous: SyncScope | undefined) => void | Promise<void>;\n};\n\nexport type AuthenticatedSyncKit<TMeta = Record<string, unknown>> = {\n readonly mode: \"sync\";\n readonly storage: SyncCapableStorageAdapter<TMeta>;\n readonly scope?: SyncScope;\n readonly scopeKey: string;\n getScope(): SyncScope | undefined;\n setScope(scope?: SyncScope): Promise<void>;\n subscribeScope(listener: () => void): () => void;\n exportBackup(): Promise<string>;\n dispose(): void;\n};\n\n/** Creates auth-independent sync wiring with per-request tokens and isolated account scopes. */\nexport function createAuthenticatedSyncKit<TMeta = Record<string, unknown>>(\n options: AuthenticatedSyncKitOptions<TMeta>,\n): AuthenticatedSyncKit<TMeta> {\n const controller = new AuthenticatedSyncStorageController(options);\n return {\n mode: \"sync\",\n storage: controller,\n get scope() {\n return controller.scope;\n },\n get scopeKey() {\n return controller.scopeKey;\n },\n getScope: () => controller.scope,\n setScope: (scope) => controller.setScope(scope),\n subscribeScope: (listener) => controller.subscribeScope(listener),\n exportBackup: () => controller.exportBackup(),\n dispose: () => controller.dispose(),\n };\n}\n\nclass AuthenticatedSyncStorageController<TMeta = Record<string, unknown>> implements SyncCapableStorageAdapter<TMeta> {\n private readonly options: AuthenticatedSyncKitOptions<TMeta>;\n private currentScope: SyncScope | undefined;\n private current: SyncStorageAdapter<TMeta>;\n private readonly scopeListeners = new Set<() => void>();\n private readonly dataListeners = new Set<() => void>();\n private readonly syncListeners = new Set<() => void>();\n private unsubscribeData: () => void = () => undefined;\n private unsubscribeSync: () => void = () => undefined;\n private transition = Promise.resolve();\n private disposed = false;\n\n constructor(options: AuthenticatedSyncKitOptions<TMeta>) {\n this.options = options;\n this.currentScope = options.scope;\n this.current = this.createAdapter(this.currentScope);\n this.attach(this.current);\n }\n\n get storageKey(): string | undefined {\n return this.current.storageKey;\n }\n\n get scope(): SyncScope | undefined {\n return this.currentScope;\n }\n\n get scopeKey(): string {\n return getKeepScopeKey(this.currentScope);\n }\n\n async getAll(): Promise<KeepItem<TMeta>[]> {\n await this.ensureScope();\n return this.current.getAll();\n }\n\n async set(item: KeepItem<TMeta>): Promise<void> {\n await this.ensureScope();\n return this.current.set(item);\n }\n\n async setMany(items: KeepItem<TMeta>[]): Promise<void> {\n await this.ensureScope();\n return this.current.setMany(items);\n }\n\n async remove(id: string): Promise<void> {\n await this.ensureScope();\n return this.current.remove(id);\n }\n\n async removeMany(ids: string[]): Promise<void> {\n await this.ensureScope();\n return this.current.removeMany(ids);\n }\n\n async clear(): Promise<void> {\n await this.ensureScope();\n return this.current.clear();\n }\n\n async merge(items: KeepItem<TMeta>[]): Promise<KeepItem<TMeta>[]> {\n await this.ensureScope();\n return this.current.merge(items);\n }\n\n subscribe(listener: () => void): () => void {\n this.dataListeners.add(listener);\n return () => this.dataListeners.delete(listener);\n }\n\n getSyncState(): KeepSyncState<TMeta> {\n return this.current.getSyncState();\n }\n\n subscribeSync(listener: () => void): () => void {\n this.syncListeners.add(listener);\n return () => this.syncListeners.delete(listener);\n }\n\n async flushSync(): Promise<void> {\n await this.ensureScope();\n return this.current.flushSync();\n }\n\n async retrySync(): Promise<void> {\n await this.ensureScope();\n return this.current.retrySync?.() ?? this.current.flushSync();\n }\n\n async resolveSyncConflict(\n id: string,\n resolution: \"local\" | \"remote\" | \"manual\",\n item?: KeepItem<TMeta>,\n ): Promise<void> {\n await this.ensureScope();\n if (!this.current.resolveSyncConflict) {\n throw new Error(\"The authenticated sync adapter does not support conflict resolution.\");\n }\n return this.current.resolveSyncConflict(id, resolution, item);\n }\n\n async setScope(nextScope?: SyncScope): Promise<void> {\n const run = this.transition.then(async () => {\n if (isSameKeepScope(this.currentScope, nextScope)) return;\n if (this.disposed) throw new Error(\"AuthenticatedSyncKit has been disposed.\");\n const previousScope = this.currentScope;\n this.unsubscribeData();\n this.unsubscribeSync();\n this.current.dispose?.();\n this.currentScope = nextScope;\n this.current = this.createAdapter(nextScope);\n this.attach(this.current);\n await this.options.onScopeChange?.(nextScope, previousScope);\n this.notify(this.scopeListeners);\n this.notify(this.dataListeners);\n this.notify(this.syncListeners);\n });\n this.transition = run.catch(() => undefined);\n return run;\n }\n\n subscribeScope(listener: () => void): () => void {\n this.scopeListeners.add(listener);\n return () => this.scopeListeners.delete(listener);\n }\n\n async exportBackup(): Promise<string> {\n await this.ensureScope();\n return exportItems(this.current);\n }\n\n dispose(): void {\n this.disposed = true;\n this.unsubscribeData();\n this.unsubscribeSync();\n this.current.dispose?.();\n this.scopeListeners.clear();\n this.dataListeners.clear();\n this.syncListeners.clear();\n }\n\n private createAdapter(scope: SyncScope | undefined): SyncStorageAdapter<TMeta> {\n const local = this.options.local\n ? scope\n ? createScopedStorageAdapter(this.options.local, scope)\n : this.options.local\n : createBrowserStorageAdapter<TMeta>({ key: this.options.key, databaseName: this.options.databaseName, scope });\n const queue =\n this.options.queue && scope ? new ScopedSyncQueueAdapter(this.options.queue, scope) : this.options.queue;\n const remote = createAuthenticatedRemote(this.options, scope);\n return new SyncStorageAdapter<TMeta>({\n ...this.options,\n local,\n remote,\n queue,\n scope,\n });\n }\n\n private attach(adapter: SyncStorageAdapter<TMeta>): void {\n this.unsubscribeData = adapter.subscribe?.(() => this.notify(this.dataListeners)) ?? (() => undefined);\n this.unsubscribeSync = adapter.subscribeSync(() => this.notify(this.syncListeners));\n }\n\n private async ensureScope(): Promise<void> {\n if (!this.options.getScope) return;\n await this.setScope(await this.options.getScope());\n }\n\n private notify(listeners: Set<() => void>): void {\n for (const listener of listeners) listener();\n }\n}\n\nfunction createAuthenticatedRemote<TMeta>(\n options: AuthenticatedSyncKitOptions<TMeta>,\n scope: SyncScope | undefined,\n): RemoteSyncDriver<TMeta> {\n const pull = options.transport.pull;\n return {\n push: async (operation) => {\n try {\n const token = await options.getAuthToken();\n return await options.transport.push(operation, { token, scope, operation });\n } catch (cause) {\n return handleAuthFailure(cause, options, { operation, scope });\n }\n },\n pull: pull\n ? async () => {\n try {\n const token = await options.getAuthToken();\n return await pull({ token, scope });\n } catch (cause) {\n return handleAuthFailure(cause, options, { scope });\n }\n }\n : undefined,\n };\n}\n\nasync function handleAuthFailure<TMeta>(\n cause: unknown,\n options: AuthenticatedSyncKitOptions<TMeta>,\n context: AuthenticatedSyncAuthContext<TMeta>,\n): Promise<never> {\n const status = getAuthStatus(cause);\n if (!status) throw cause;\n const error =\n cause instanceof KeepSyncAuthErrorClass\n ? cause\n : new KeepSyncAuthErrorClass(status, { operation: context.operation, scope: context.scope, cause });\n await options.onAuthError?.(error, context);\n await options.onReauthenticate?.(error, context);\n throw error;\n}\n\nfunction getAuthStatus(error: unknown): KeepSyncAuthStatus | undefined {\n if (error instanceof KeepSyncAuthErrorClass) return error.status;\n if (!error || typeof error !== \"object\") return undefined;\n const candidate = error as { status?: unknown; response?: { status?: unknown }; cause?: unknown };\n if (candidate.status === 401 || candidate.status === 403) return candidate.status;\n if (candidate.response?.status === 401 || candidate.response?.status === 403) return candidate.response.status;\n return candidate.cause ? getAuthStatus(candidate.cause) : undefined;\n}\n","import type { KeepListQuery } from \"./query\";\n\nexport type KeepUrlParamNames = {\n search: string;\n tags: string;\n sort: string;\n page: string;\n};\n\nexport type KeepUrlSyncOptions = {\n /** Parameters are intentionally short so shared collection URLs stay readable. */\n params?: Partial<KeepUrlParamNames>;\n /** Push is the default so browser back/forward restores collection states. */\n history?: \"replace\" | \"push\";\n /** URL to read/write. Defaults to the current browser URL. */\n url?: string;\n};\n\nexport const DEFAULT_KEEP_URL_PARAMS: KeepUrlParamNames = {\n search: \"q\",\n tags: \"tag\",\n sort: \"sort\",\n page: \"page\",\n};\n\nexport type KeepUrlState = Pick<KeepListQuery, \"search\" | \"tags\" | \"sort\" | \"pagination\">;\n\n/** Convert a list query to stable URLSearchParams without serializing functions or unsupported filters. */\nexport function encodeKeepListQuery<TMeta = Record<string, unknown>>(\n query: KeepListQuery<TMeta> = {},\n options: Pick<KeepUrlSyncOptions, \"params\"> = {},\n): URLSearchParams {\n const params = { ...DEFAULT_KEEP_URL_PARAMS, ...options.params };\n const result = new URLSearchParams();\n const search = query.search?.query?.trim();\n if (search) result.set(params.search, search);\n for (const tag of query.tags ?? []) {\n const normalized = tag.trim();\n if (normalized) result.append(params.tags, normalized);\n }\n if (query.sort?.by) result.set(params.sort, `${query.sort.by}:${query.sort.direction ?? \"desc\"}`);\n const page = query.pagination?.page;\n if (page !== undefined && Number.isFinite(page) && page > 1) result.set(params.page, String(Math.floor(page)));\n return result;\n}\n\n/** Parse a URL into the query fields supported by KeepCollection. Invalid values are ignored. */\nexport function decodeKeepListQuery(\n input: string | URL | URLSearchParams,\n options: Pick<KeepUrlSyncOptions, \"params\"> = {},\n): KeepUrlState {\n const params = { ...DEFAULT_KEEP_URL_PARAMS, ...options.params };\n const searchParams = input instanceof URLSearchParams ? input : new URL(input, \"http://keepkit.invalid\").searchParams;\n const search = searchParams.get(params.search)?.trim();\n const tags = [\n ...new Set(\n searchParams\n .getAll(params.tags)\n .map((tag) => tag.trim())\n .filter(Boolean),\n ),\n ];\n const sortValue = searchParams.get(params.sort)?.split(\":\");\n const sort: KeepListQuery[\"sort\"] =\n sortValue?.[0] === \"savedAt\" || sortValue?.[0] === \"updatedAt\"\n ? {\n by: sortValue[0],\n direction: sortValue[1] === \"asc\" ? (\"asc\" as const) : (\"desc\" as const),\n }\n : undefined;\n const rawPage = Number(searchParams.get(params.page));\n const page = Number.isInteger(rawPage) && rawPage > 0 ? rawPage : undefined;\n return {\n ...(search ? { search: { query: search } } : {}),\n ...(tags.length > 0 ? { tags } : {}),\n ...(sort ? { sort } : {}),\n ...(page ? { pagination: { page } } : {}),\n };\n}\n\nexport function serializeKeepListQuery<TMeta = Record<string, unknown>>(\n query: KeepListQuery<TMeta> = {},\n options: Pick<KeepUrlSyncOptions, \"params\"> = {},\n): string {\n const value = encodeKeepListQuery(query, options).toString();\n return value ? `?${value}` : \"\";\n}\n\nexport function mergeKeepListQueryFromUrl<TMeta = Record<string, unknown>>(\n query: KeepListQuery<TMeta>,\n input: string | URL | URLSearchParams,\n options: Pick<KeepUrlSyncOptions, \"params\"> = {},\n): KeepListQuery<TMeta> {\n const decoded = decodeKeepListQuery(input, options);\n return {\n ...query,\n ...decoded,\n search: decoded.search ?? query.search,\n tags: decoded.tags ?? query.tags,\n sort: decoded.sort ?? query.sort,\n pagination: decoded.pagination ? { ...query.pagination, ...decoded.pagination } : query.pagination,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAWO,SAAS,6BACd,SACmB;AACnB,SAAO;AAAA,IACL,MAAM,QAAQ,QAAQ;AAAA,IACtB,OAAO,OAAO,YAAY;AACxB,YAAM,OAAO,OAAO,QAAQ,cAAc,aAAa,QAAQ,UAAU,OAAO,IAAI,CAAC,QAAQ,SAAS;AACtG,YAAM,QAAQ,IAAI,KAAK,IAAI,CAAC,aAAa,QAAQ,WAAW,UAAU,OAAO,CAAC,CAAC;AAAA,IACjF;AAAA,EACF;AACF;;;ACMO,SAAS,oBACd,UAAuC,CAAC,GACnB;AACrB,QAAM,OAAO,QAAQ,QAAQ;AAC7B,QAAM,QAAQ,QAAQ,UAClB,QAAQ,QACN,2BAA2B,QAAQ,SAAS,QAAQ,KAAK,IACzD,QAAQ,UACV,4BAA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AS,QAAmB;AAAA,EAC1D,IACA;AACN,QAAM,UAAU,OAAO,aAAa,IAAI,OAAO,IAAI,CAAC;AACpD,QAAM,OAAO,OAAO,UAAU,OAAO,KAAK,UAAU,IAAI,UAAU;AAClE,SAAO;AAAA,IACL,GAAI,SAAS,EAAE,QAAQ,EAAE,OAAO,OAAO,EAAE,IAAI,CAAC;AAAA,IAC9C,GAAI,KAAK,SAAS,IAAI,EAAE,KAAK,IAAI,CAAC;AAAA,IAClC,GAAI,OAAO,EAAE,KAAK,IAAI,CAAC;AAAA,IACvB,GAAI,OAAO,EAAE,YAAY,EAAE,KAAK,EAAE,IAAI,CAAC;AAAA,EACzC;AACF;AAEO,SAAS,uBACd,QAA8B,CAAC,GAC/B,UAA8C,CAAC,GACvC;AACR,QAAM,QAAQ,oBAAoB,OAAO,OAAO,EAAE,SAAS;AAC3D,SAAO,QAAQ,IAAI,KAAK,KAAK;AAC/B;AAEO,SAAS,0BACd,OACA,OACA,UAA8C,CAAC,GACzB;AACtB,QAAM,UAAU,oBAAoB,OAAO,OAAO;AAClD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,GAAG;AAAA,IACH,QAAQ,QAAQ,UAAU,MAAM;AAAA,IAChC,MAAM,QAAQ,QAAQ,MAAM;AAAA,IAC5B,MAAM,QAAQ,QAAQ,MAAM;AAAA,IAC5B,YAAY,QAAQ,aAAa,EAAE,GAAG,MAAM,YAAY,GAAG,QAAQ,WAAW,IAAI,MAAM;AAAA,EAC1F;AACF;","names":[]}
package/dist/react.d.ts CHANGED
@@ -1,9 +1,10 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode, ButtonHTMLAttributes, MouseEvent, HTMLAttributes, ReactElement, ErrorInfo, Component, PropsWithChildren, ComponentType } from 'react';
3
- import { f as KeepItemMetadataRefresher, k as KeepItemRevalidator, R as RevalidateKeepItemsOptions, j as KeepItemRevalidationSummary, l as KeepListQuery, g as KeepItemResolver, I as ImportItemsOptions, a as ImportItemsResult, m as KeepStore, n as KeepStoreActions } from './store-Cgqx7_xd.js';
4
- export { i as KeepItemRevalidationResult, s as isKeepItemMetadataStale } from './store-Cgqx7_xd.js';
5
- import { m as KeepItemInput, a as KeepItem, k as KeepEventHandlers, S as StorageAdapter, c as KeepPlugin, K as KeepSchema, l as KeepInvalidItemPolicy, e as KeepChangeContext, u as KeepSyncState } from './types--YahIoEB.js';
6
- export { n as KeepItemStatus } from './types--YahIoEB.js';
3
+ import { g as KeepItemMetadataRefresher, l as KeepItemRevalidator, R as RevalidateKeepItemsOptions, k as KeepItemRevalidationSummary, m as KeepListQuery, h as KeepItemResolver, c as KeepAutoRevalidationOptions, I as ImportItemsOptions, a as ImportItemsResult, n as KeepStore, o as KeepStoreActions } from './url-VhisKZCR.js';
4
+ export { j as KeepItemRevalidationResult, q as KeepUrlParamNames, r as KeepUrlState, s as KeepUrlSyncOptions, y as isKeepItemMetadataStale } from './url-VhisKZCR.js';
5
+ import { s as KeepItemInput, a as KeepItem, q as KeepEventHandlers, b as StorageAdapter, f as KeepPlugin, K as KeepSchema, r as KeepInvalidItemPolicy, k as KeepChangeContext, D as KeepSyncState, F as KeepUndoState } from './types-iMK12pmy.js';
6
+ export { t as KeepItemStatus } from './types-iMK12pmy.js';
7
+ export { K as KeepScope, S as ScopedStorageAdapter } from './scope-y_aBm363.js';
7
8
 
8
9
  type UseKeepItemResult<TMeta = Record<string, unknown>> = {
9
10
  item: KeepItem<TMeta> | undefined;
@@ -13,6 +14,8 @@ type UseKeepItemResult<TMeta = Record<string, unknown>> = {
13
14
  error: unknown | null;
14
15
  save: () => Promise<void>;
15
16
  remove: () => Promise<void>;
17
+ removeWithUndo: () => Promise<void>;
18
+ undo: () => Promise<void>;
16
19
  toggle: () => Promise<void>;
17
20
  updateNote: (note?: string) => Promise<void>;
18
21
  updateTags: (tags?: string[]) => Promise<void>;
@@ -36,6 +39,8 @@ type UseKeepListResult<TMeta = Record<string, unknown>> = {
36
39
  error: unknown | null;
37
40
  remove: (id: string) => Promise<void>;
38
41
  removeBatch: (ids: string[]) => Promise<void>;
42
+ removeWithUndo: (id: string) => Promise<void>;
43
+ removeBatchWithUndo: (ids: string[]) => Promise<void>;
39
44
  updateTagsBatch: (ids: string[], tags?: string[]) => Promise<void>;
40
45
  addTagsBatch: (ids: string[], tags: string[]) => Promise<void>;
41
46
  removeTagsBatch: (ids: string[], tags: string[]) => Promise<void>;
@@ -121,7 +126,8 @@ type KeepContextValue<TMeta = Record<string, unknown>> = {
121
126
  isMutating: boolean;
122
127
  error: unknown | null;
123
128
  lastChange?: KeepChangeContext<TMeta>;
124
- syncState: KeepSyncState;
129
+ syncState: KeepSyncState<TMeta>;
130
+ undo: KeepUndoState;
125
131
  saveItem: (item: KeepItem<TMeta>) => Promise<void>;
126
132
  updateNote: (id: string, note?: string) => Promise<void>;
127
133
  updateTags: (id: string, tags?: string[]) => Promise<void>;
@@ -130,9 +136,13 @@ type KeepContextValue<TMeta = Record<string, unknown>> = {
130
136
  removeTagsBatch: (ids: string[], tags: string[]) => Promise<void>;
131
137
  removeItem: (id: string) => Promise<void>;
132
138
  removeItems: (ids: string[]) => Promise<void>;
139
+ removeItemWithUndo: (id: string) => Promise<void>;
140
+ removeItemsWithUndo: (ids: string[]) => Promise<void>;
141
+ undoLastRemoval: () => Promise<void>;
133
142
  clear: () => Promise<void>;
134
143
  refresh: () => Promise<void>;
135
144
  flushSync: () => Promise<void>;
145
+ resolveSyncConflict: (id: string, resolution: "local" | "remote" | "manual", item?: KeepItem<TMeta>) => Promise<void>;
136
146
  refreshItemMetadata: (id: string, refresh: KeepItemMetadataRefresher<TMeta>) => Promise<void>;
137
147
  revalidateItems: (revalidator?: KeepItemRevalidator<TMeta>, options?: RevalidateKeepItemsOptions<TMeta>) => Promise<KeepItemRevalidationSummary<TMeta>>;
138
148
  exportBackup: () => Promise<string>;
@@ -158,12 +168,14 @@ type KeepProviderProps<TMeta = Record<string, unknown>> = PropsWithChildren<Keep
158
168
  boundaryResetKey?: unknown;
159
169
  validateItem?: KeepItemRevalidator<TMeta>;
160
170
  resolveItem?: KeepItemResolver<TMeta>;
171
+ autoRevalidation?: KeepAutoRevalidationOptions<TMeta>;
172
+ undoTimeoutMs?: number;
161
173
  }>;
162
174
  type KeepStoreAccess<TMeta> = {
163
175
  store: KeepStore<TMeta>;
164
176
  actions: KeepStoreActions<TMeta>;
165
177
  };
166
- declare function KeepProvider<TMeta = Record<string, unknown>>({ storage, initialItems, onSave, onRemove, onNoteUpdate, onTagsUpdate, onChange, onError, plugins, schemaVersion, schema, invalidItemPolicy, onInvalidItem, migrateMeta, fallback, onBoundaryError, boundaryResetKey, validateItem, resolveItem, children, }: KeepProviderProps<TMeta>): react.JSX.Element;
178
+ declare function KeepProvider<TMeta = Record<string, unknown>>({ storage, initialItems, onSave, onRemove, onNoteUpdate, onTagsUpdate, onChange, onUndo, onError, plugins, schemaVersion, schema, invalidItemPolicy, onInvalidItem, migrateMeta, fallback, onBoundaryError, boundaryResetKey, validateItem, resolveItem, autoRevalidation, undoTimeoutMs, children, }: KeepProviderProps<TMeta>): react.JSX.Element;
167
179
  declare function useKeepContext<TMeta = Record<string, unknown>>(): KeepContextValue<TMeta>;
168
180
  declare function useKeepStore<TMeta = Record<string, unknown>>(): KeepStoreAccess<TMeta>;
169
181
 
@@ -179,4 +191,4 @@ type KeepKit<TMeta> = {
179
191
  /** Create an app-specific, fully typed set of KeepKit components and hooks. */
180
192
  declare function createKeepKit<TMeta = Record<string, unknown>>(options?: CreateKeepKitOptions<TMeta>): KeepKit<TMeta>;
181
193
 
182
- export { type CreateKeepKitOptions, KeepButton, type KeepButtonItem, type KeepButtonProps, type KeepButtonState, type KeepContextValue, KeepErrorBoundary, type KeepErrorBoundaryProps, KeepItemMetadataRefresher, KeepItemResolver, KeepItemRevalidationSummary, KeepItemRevalidator, type KeepKit, KeepListQuery, KeepProvider, type KeepProviderProps, type KeepShortcutModifier, type KeepShortcutOptions, RevalidateKeepItemsOptions, type UseKeepItemResult, type UseKeepListResult, createKeepKit, useKeepContext, useKeepItem, useKeepList, useKeepShortcut, useKeepStore };
194
+ export { type CreateKeepKitOptions, KeepAutoRevalidationOptions, KeepButton, type KeepButtonItem, type KeepButtonProps, type KeepButtonState, type KeepContextValue, KeepErrorBoundary, type KeepErrorBoundaryProps, KeepItemMetadataRefresher, KeepItemResolver, KeepItemRevalidationSummary, KeepItemRevalidator, type KeepKit, KeepListQuery, KeepProvider, type KeepProviderProps, type KeepShortcutModifier, type KeepShortcutOptions, KeepUndoState, RevalidateKeepItemsOptions, type UseKeepItemResult, type UseKeepListResult, createKeepKit, useKeepContext, useKeepItem, useKeepList, useKeepShortcut, useKeepStore };