locality-idb 1.5.3 β†’ 1.5.6

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 CHANGED
@@ -26,6 +26,15 @@
26
26
 
27
27
  ---
28
28
 
29
+ ## Why Not Raw IndexedDB?
30
+
31
+ If you're weighing using `Locality IDB` vs. the raw `IndexedDB` API:
32
+
33
+ - **Type safety**: schema-driven types reduce runtime errors.
34
+ - **Query ergonomics**: SQL-like query builder replaces verbose cursor boilerplate.
35
+ - **Validation built-in**: column type checks and custom validators run automatically.
36
+ - **Consistency**: reusable schema + shared helpers keep data access uniform.
37
+
29
38
  ## πŸ“‹ Table of Contents
30
39
 
31
40
  - [Features](#-features)
@@ -56,6 +65,7 @@
56
65
  - [Utility Functions](#utility-functions)
57
66
  - [Validation](#validation)
58
67
  - [Type System](#-type-system)
68
+ - [FAQ / Common Pitfalls](#-faq--common-pitfalls)
59
69
  - [License](#-license)
60
70
 
61
71
  ---
@@ -64,16 +74,16 @@
64
74
 
65
75
  - 🎯 **Type-Safe**: Full TypeScript support with automatic type inference
66
76
  - πŸ” **SQL-like Queries**: Familiar query syntax inspired by Drizzle ORM
67
- - πŸš€ **Modern API**: Clean and intuitive interface for IndexedDB operations
77
+ - πŸš€ **Modern API**: Clean and intuitive interface for `IndexedDB` operations
68
78
  - πŸ“¦ **Zero Dependencies**: Lightweight with only development dependencies
69
79
  - πŸ”„ **Auto-Generation**: Automatic UUID and timestamp generation
70
80
  - 🎨 **Schema-First**: Define your database schema with a simple, declarative API
71
81
  - πŸ› οΈ **Rich Column Types**: Support for various data types including custom types
72
- - βœ… **Built-in Validation**: Automatic data type validation for built-in column types during insert and update operations
82
+ - βœ… **Built-in Validation**: Validation for built-in column types during insert and update operations
73
83
  - πŸ”§ **Custom Validators**: Define custom validation logic for columns to enforce complex rules
74
- - πŸ”’ **Atomic Transactions**: Execute multiple operations across tables with automatic rollback on failure
84
+ - πŸ”’ **Transactions**: Execute multiple operations across tables with automatic rollback on failure
75
85
  - πŸ“€ **Database Export**: Export database data as JSON for backup, migration, or debugging
76
- - πŸ“₯ **Database Import**: Import exported data with merge, replace, or upsert modes
86
+ - πŸ“₯ **Database Import**: Import exported data with `'merge'`, `'replace'`, or `'upsert'` modes
77
87
 
78
88
  ---
79
89
 
@@ -322,6 +332,7 @@ const schema = defineSchema({
322
332
  > - Auto-generated values can be overridden by providing explicit values during insert.
323
333
  > - Use the `default()` modifier to set custom default values instead of auto-generated ones.
324
334
  > - Auto-generated values are generated at runtime during insert operations.
335
+ > - `onUpdate()` modifier can be used to auto-update values on update operations (e.g. `updatedAt` timestamp).
325
336
  > - Type extensions for `uuid` and `timestamp` are not applicable since they are already typed.
326
337
  > - For custom UUID versions, use [`uuid`](https://toolbox.nazmul-nhb.dev/docs/utilities/hash/uuid) utility from [`nhb-toolbox`](https://www.npmjs.com/package/nhb-toolbox).
327
338
  > - For custom timestamp formats, use date libraries like [`Chronos`](https://toolbox.nazmul-nhb.dev/docs/classes/Chronos) (from [`nhb-toolbox`](https://www.npmjs.com/package/nhb-toolbox)) or [`date-fns`](https://www.npmjs.com/package/date-fns) to generate ISO 8601 strings.
@@ -2325,6 +2336,15 @@ type PagedResult = PageResult<User, null>;
2325
2336
 
2326
2337
  ---
2327
2338
 
2339
+ ## ❓ FAQ / Common Pitfalls
2340
+
2341
+ - **Schema changes aren’t automatic**: any schema change should bump the database `version` so the upgrade path runs.
2342
+ - **Index queries require indexes**: `where('field', value)` only works for primary keys or fields defined with `.index()` or `.unique()`.
2343
+ - **Predicate filters are in-memory**: `where((row) => ...)` filters client-side after fetching rows, so prefer indexes for large datasets.
2344
+ - **IndexedDB is browser-only**: calls will fail in SSR/Node environments without a shim.
2345
+
2346
+ ---
2347
+
2328
2348
  ## πŸ“„ License
2329
2349
 
2330
2350
  [MIT](LICENSE) Β© [Nazmul Hassan](https://github.com/nazmul-nhb)
package/dist/index.cjs CHANGED
@@ -1,3 +1,4 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
1
2
 
2
3
  //#region node_modules/.pnpm/nhb-toolbox@4.28.66/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
3
4
  function isNumber(value) {
@@ -150,7 +151,7 @@ function sortAnArray(array, options) {
150
151
 
151
152
  //#endregion
152
153
  //#region src/core.ts
153
- /** Symbol key for column column data type */
154
+ /** Symbol key for column data type */
154
155
  const ColumnType = Symbol("ColumnType");
155
156
  /** Symbol key for primary key marker */
156
157
  const IsPrimaryKey = Symbol("IsPrimaryKey");
@@ -400,7 +401,7 @@ function uuidV4(uppercase = false) {
400
401
  * * Get current timestamp in ISO 8601 format
401
402
  * @param value Optional date input (string, number, or Date object). Defaults to {@link Date new Date()}
402
403
  * @remarks If the provided value is invalid, the current date and time will be used.
403
- * @return Timestamp string in ISO 8601 format
404
+ * @returns Timestamp string in ISO 8601 format
404
405
  */
405
406
  function getTimestamp(value) {
406
407
  let date = value instanceof Date ? value : new Date(isNonEmptyString(value) ? value.replace(/['"]/g, "") : value ?? Date.now());
@@ -704,7 +705,7 @@ var SelectQuery = class {
704
705
  return this;
705
706
  }
706
707
  /**
707
- * @instance Order results by specified key and direction
708
+ * @instance Order results by specified key and direction
708
709
  * @param key Key to order by
709
710
  * @param dir Direction: 'asc' | 'desc' (default: 'asc')
710
711
  *
@@ -1394,7 +1395,7 @@ var Locality = class Locality {
1394
1395
  /**
1395
1396
  * @instance Select records from a table.
1396
1397
  * @param table Table name.
1397
- * @returns
1398
+ * @returns Select query builder for the table.
1398
1399
  */
1399
1400
  from(table) {
1400
1401
  return new SelectQuery(table, () => this.#db, this.#readyPromise);
@@ -1574,7 +1575,7 @@ var Locality = class Locality {
1574
1575
  * }),
1575
1576
  * });
1576
1577
  *
1577
- * // Export all tables pretty-printed pretty-printed with default filename
1578
+ * // Export all tables pretty-printed with default filename
1578
1579
  * await db.export();
1579
1580
  *
1580
1581
  * // Export specific tables pretty-printed with custom filename
package/dist/index.d.cts CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region src/core.d.ts
2
- /** Symbol key for column column data type */
2
+ /** Symbol key for column data type */
3
3
  declare const ColumnType: unique symbol;
4
4
  /** Symbol key for primary key marker */
5
5
  declare const IsPrimaryKey: unique symbol;
@@ -162,7 +162,7 @@ declare class SelectQuery<T extends GenericObject, S extends Partial<Record<stri
162
162
  */
163
163
  where<IdxKey extends $InferPrimaryKey<Tbl['columns']> | $InferIndex<Tbl['columns']>>(indexName: IdxKey, query: IDBKeyRange | T[IdxKey]): this;
164
164
  /**
165
- * @instance Order results by specified key and direction
165
+ * @instance Order results by specified key and direction
166
166
  * @param key Key to order by
167
167
  * @param dir Direction: 'asc' | 'desc' (default: 'asc')
168
168
  *
@@ -300,9 +300,9 @@ type $Brand<B> = {
300
300
  /**
301
301
  * * Creates a branded version of a base type by intersecting it with a unique compile-time marker.
302
302
  *
303
- * @param T - Base type to brand.
304
- * @param B - Brand identifier used to distinguish this type from structurally similar types.
305
-
303
+ * @typeParam T - Base type to brand.
304
+ * @typeParam B - Brand identifier used to distinguish this type from structurally similar types.
305
+ *
306
306
  * @remarks Useful for preventing accidental mixing of structurally identical types, while keeping the runtime value unchanged.
307
307
  *
308
308
  * @example
@@ -313,7 +313,10 @@ type Branded<T, B> = T & $Brand<B>;
313
313
  /**
314
314
  * * Broadens a literal union (typically `string` or `number`) to also accept any other value of the base type, without losing IntelliSense autocomplete for the provided literals.
315
315
  *
316
- * *This is especially useful in API design where you want to provide suggestions for common options but still allow flexibility for custom user-defined values.*
316
+ * @remarks
317
+ * This is especially useful in API design where you want to provide suggestions for common options but still allow flexibility for custom user-defined values.
318
+ *
319
+ * Technically, this uses intersection with primitive base types (`string & {}` or `number & {}`) to retain IntelliSense while avoiding type narrowing.
317
320
  *
318
321
  * @example
319
322
  * // βœ… String literal usage
@@ -332,8 +335,6 @@ type Branded<T, B> = T & $Brand<B>;
332
335
  * const m2: Mixed = 2; // βœ…
333
336
  * const m3: Mixed = 'anything'; // βœ…
334
337
  * const m4: Mixed = 123; // βœ…
335
- *
336
- * @note Technically, this uses intersection with primitive base types (`string & {}` or `number & {}`) to retain IntelliSense while avoiding type narrowing.
337
338
  */
338
339
  type LooseLiteral<T extends string | number> = T | (T extends string ? string & {} : number & {});
339
340
  type ForcedAny = any;
@@ -365,7 +366,7 @@ type $UnionToTuple<T, L = $LastOf<T>> = [T] extends [never] ? [] : [...$UnionToT
365
366
  * - If `T` is a single type, it produces a one-element tuple `[T]`.
366
367
  * - If `T` is `never`, it produces an empty tuple `[]`.
367
368
  *
368
- * @param T - The type to convert into a tuple.
369
+ * @typeParam T - The type to convert into a tuple.
369
370
  * @returns A tuple type containing the elements of `T`.
370
371
  *
371
372
  * @example
@@ -383,7 +384,7 @@ type Tuple<T> = [T] extends [never] ? [] : $UnionToTuple<T>;
383
384
  * - Useful when you want to preserve all possible union members as a tuple literal instead of an array.
384
385
  * - For converting any type to tuple use {@link Tuple}.
385
386
  *
386
- * @param T - An array type whose element type is a union.
387
+ * @typeParam T - An array type whose element type is a union.
387
388
  * @returns A tuple type containing each member of the union in order.
388
389
  *
389
390
  * @example
@@ -435,7 +436,7 @@ type AdvancedTypes = Array<unknown> | File | FileList | Blob | Date | RegExp | C
435
436
  /**
436
437
  * * Extracts the parameters of the first overload of a function type `T`.
437
438
  *
438
- * @template T - The function type to extract parameters from.
439
+ * @typeParam T - The function type to extract parameters from.
439
440
  *
440
441
  * @returns A tuple type representing the parameters of the first overload of `T`.
441
442
  *
@@ -457,8 +458,8 @@ type FirstOverloadParams<T> = T extends ({
457
458
  /**
458
459
  * * Maps all values of object `T` to a fixed type `R`, keeping original keys.
459
460
  *
460
- * @template T - The source object type.
461
- * @template R - The replacement value type.
461
+ * @typeParam T - The source object type.
462
+ * @typeParam R - The replacement value type.
462
463
  *
463
464
  * @example
464
465
  * type T = { name: string; age: number };
@@ -488,14 +489,15 @@ type PageResult<T, Selection extends Partial<Record<keyof T, boolean>> | null> =
488
489
  /** Retrieved items for the current page */items: Selection extends null ? T[] : SelectFields<T, Extract<Selection, object>>[]; /** Cursor key for the next page, if more results are available */
489
490
  nextCursor: Maybe<IDBValidKey>;
490
491
  };
491
- /** - Extract only primitive keys from an object, including nested dot-notation keys. */
492
+ /** Extract only primitive keys from an object, including nested dot-notation keys. */
492
493
  type NestedPrimitiveKey<T> = T extends AdvancedTypes ? never : T extends GenericObject ? { [K in keyof T & string]: T[K] extends Function ? never : T[K] extends NormalPrimitive ? K : T[K] extends GenericObject ? `${K}.${NestedPrimitiveKey<T[K]>}` : never }[keyof T & string] : never;
493
- /** - Generic object but with `any` value */
494
+ /** Generic object but with `any` value */
494
495
  type GenericObject = Record<string, any>;
495
496
  /**
496
497
  * * Forces TypeScript to simplify a complex or inferred type into a more readable flat object.
497
498
  *
498
- * *Useful when working with utility types like `Merge`, `Omit`, etc., that produce deeply nested or unresolved intersections.*
499
+ * @remarks
500
+ * Useful when working with utility types like `Merge`, `Omit`, etc., that produce deeply nested or unresolved intersections.
499
501
  *
500
502
  * @example
501
503
  * type A = { a: number };
@@ -696,7 +698,7 @@ declare class Locality<DBName extends string = string, Version extends number =
696
698
  /**
697
699
  * @instance Select records from a table.
698
700
  * @param table Table name.
699
- * @returns
701
+ * @returns Select query builder for the table.
700
702
  */
701
703
  from<T extends TName, Row extends $InferRow<Schema[T]['columns']>>(table: T): SelectQuery<Row, null, Schema[T]>;
702
704
  /**
@@ -824,7 +826,7 @@ declare class Locality<DBName extends string = string, Version extends number =
824
826
  * }),
825
827
  * });
826
828
  *
827
- * // Export all tables pretty-printed pretty-printed with default filename
829
+ * // Export all tables pretty-printed with default filename
828
830
  * await db.export();
829
831
  *
830
832
  * // Export specific tables pretty-printed with custom filename
@@ -1372,7 +1374,7 @@ declare function uuidV4(uppercase?: boolean): UUID<'v4'>;
1372
1374
  * * Get current timestamp in ISO 8601 format
1373
1375
  * @param value Optional date input (string, number, or Date object). Defaults to {@link Date new Date()}
1374
1376
  * @remarks If the provided value is invalid, the current date and time will be used.
1375
- * @return Timestamp string in ISO 8601 format
1377
+ * @returns Timestamp string in ISO 8601 format
1376
1378
  */
1377
1379
  declare function getTimestamp(value?: string | number | Date): Timestamp;
1378
1380
  /**
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
1
  //#region src/core.d.ts
2
- /** Symbol key for column column data type */
2
+ /** Symbol key for column data type */
3
3
  declare const ColumnType: unique symbol;
4
4
  /** Symbol key for primary key marker */
5
5
  declare const IsPrimaryKey: unique symbol;
@@ -162,7 +162,7 @@ declare class SelectQuery<T extends GenericObject, S extends Partial<Record<stri
162
162
  */
163
163
  where<IdxKey extends $InferPrimaryKey<Tbl['columns']> | $InferIndex<Tbl['columns']>>(indexName: IdxKey, query: IDBKeyRange | T[IdxKey]): this;
164
164
  /**
165
- * @instance Order results by specified key and direction
165
+ * @instance Order results by specified key and direction
166
166
  * @param key Key to order by
167
167
  * @param dir Direction: 'asc' | 'desc' (default: 'asc')
168
168
  *
@@ -300,9 +300,9 @@ type $Brand<B> = {
300
300
  /**
301
301
  * * Creates a branded version of a base type by intersecting it with a unique compile-time marker.
302
302
  *
303
- * @param T - Base type to brand.
304
- * @param B - Brand identifier used to distinguish this type from structurally similar types.
305
-
303
+ * @typeParam T - Base type to brand.
304
+ * @typeParam B - Brand identifier used to distinguish this type from structurally similar types.
305
+ *
306
306
  * @remarks Useful for preventing accidental mixing of structurally identical types, while keeping the runtime value unchanged.
307
307
  *
308
308
  * @example
@@ -313,7 +313,10 @@ type Branded<T, B> = T & $Brand<B>;
313
313
  /**
314
314
  * * Broadens a literal union (typically `string` or `number`) to also accept any other value of the base type, without losing IntelliSense autocomplete for the provided literals.
315
315
  *
316
- * *This is especially useful in API design where you want to provide suggestions for common options but still allow flexibility for custom user-defined values.*
316
+ * @remarks
317
+ * This is especially useful in API design where you want to provide suggestions for common options but still allow flexibility for custom user-defined values.
318
+ *
319
+ * Technically, this uses intersection with primitive base types (`string & {}` or `number & {}`) to retain IntelliSense while avoiding type narrowing.
317
320
  *
318
321
  * @example
319
322
  * // βœ… String literal usage
@@ -332,8 +335,6 @@ type Branded<T, B> = T & $Brand<B>;
332
335
  * const m2: Mixed = 2; // βœ…
333
336
  * const m3: Mixed = 'anything'; // βœ…
334
337
  * const m4: Mixed = 123; // βœ…
335
- *
336
- * @note Technically, this uses intersection with primitive base types (`string & {}` or `number & {}`) to retain IntelliSense while avoiding type narrowing.
337
338
  */
338
339
  type LooseLiteral<T extends string | number> = T | (T extends string ? string & {} : number & {});
339
340
  type ForcedAny = any;
@@ -365,7 +366,7 @@ type $UnionToTuple<T, L = $LastOf<T>> = [T] extends [never] ? [] : [...$UnionToT
365
366
  * - If `T` is a single type, it produces a one-element tuple `[T]`.
366
367
  * - If `T` is `never`, it produces an empty tuple `[]`.
367
368
  *
368
- * @param T - The type to convert into a tuple.
369
+ * @typeParam T - The type to convert into a tuple.
369
370
  * @returns A tuple type containing the elements of `T`.
370
371
  *
371
372
  * @example
@@ -383,7 +384,7 @@ type Tuple<T> = [T] extends [never] ? [] : $UnionToTuple<T>;
383
384
  * - Useful when you want to preserve all possible union members as a tuple literal instead of an array.
384
385
  * - For converting any type to tuple use {@link Tuple}.
385
386
  *
386
- * @param T - An array type whose element type is a union.
387
+ * @typeParam T - An array type whose element type is a union.
387
388
  * @returns A tuple type containing each member of the union in order.
388
389
  *
389
390
  * @example
@@ -435,7 +436,7 @@ type AdvancedTypes = Array<unknown> | File | FileList | Blob | Date | RegExp | C
435
436
  /**
436
437
  * * Extracts the parameters of the first overload of a function type `T`.
437
438
  *
438
- * @template T - The function type to extract parameters from.
439
+ * @typeParam T - The function type to extract parameters from.
439
440
  *
440
441
  * @returns A tuple type representing the parameters of the first overload of `T`.
441
442
  *
@@ -457,8 +458,8 @@ type FirstOverloadParams<T> = T extends ({
457
458
  /**
458
459
  * * Maps all values of object `T` to a fixed type `R`, keeping original keys.
459
460
  *
460
- * @template T - The source object type.
461
- * @template R - The replacement value type.
461
+ * @typeParam T - The source object type.
462
+ * @typeParam R - The replacement value type.
462
463
  *
463
464
  * @example
464
465
  * type T = { name: string; age: number };
@@ -488,14 +489,15 @@ type PageResult<T, Selection extends Partial<Record<keyof T, boolean>> | null> =
488
489
  /** Retrieved items for the current page */items: Selection extends null ? T[] : SelectFields<T, Extract<Selection, object>>[]; /** Cursor key for the next page, if more results are available */
489
490
  nextCursor: Maybe<IDBValidKey>;
490
491
  };
491
- /** - Extract only primitive keys from an object, including nested dot-notation keys. */
492
+ /** Extract only primitive keys from an object, including nested dot-notation keys. */
492
493
  type NestedPrimitiveKey<T> = T extends AdvancedTypes ? never : T extends GenericObject ? { [K in keyof T & string]: T[K] extends Function ? never : T[K] extends NormalPrimitive ? K : T[K] extends GenericObject ? `${K}.${NestedPrimitiveKey<T[K]>}` : never }[keyof T & string] : never;
493
- /** - Generic object but with `any` value */
494
+ /** Generic object but with `any` value */
494
495
  type GenericObject = Record<string, any>;
495
496
  /**
496
497
  * * Forces TypeScript to simplify a complex or inferred type into a more readable flat object.
497
498
  *
498
- * *Useful when working with utility types like `Merge`, `Omit`, etc., that produce deeply nested or unresolved intersections.*
499
+ * @remarks
500
+ * Useful when working with utility types like `Merge`, `Omit`, etc., that produce deeply nested or unresolved intersections.
499
501
  *
500
502
  * @example
501
503
  * type A = { a: number };
@@ -696,7 +698,7 @@ declare class Locality<DBName extends string = string, Version extends number =
696
698
  /**
697
699
  * @instance Select records from a table.
698
700
  * @param table Table name.
699
- * @returns
701
+ * @returns Select query builder for the table.
700
702
  */
701
703
  from<T extends TName, Row extends $InferRow<Schema[T]['columns']>>(table: T): SelectQuery<Row, null, Schema[T]>;
702
704
  /**
@@ -824,7 +826,7 @@ declare class Locality<DBName extends string = string, Version extends number =
824
826
  * }),
825
827
  * });
826
828
  *
827
- * // Export all tables pretty-printed pretty-printed with default filename
829
+ * // Export all tables pretty-printed with default filename
828
830
  * await db.export();
829
831
  *
830
832
  * // Export specific tables pretty-printed with custom filename
@@ -1372,7 +1374,7 @@ declare function uuidV4(uppercase?: boolean): UUID<'v4'>;
1372
1374
  * * Get current timestamp in ISO 8601 format
1373
1375
  * @param value Optional date input (string, number, or Date object). Defaults to {@link Date new Date()}
1374
1376
  * @remarks If the provided value is invalid, the current date and time will be used.
1375
- * @return Timestamp string in ISO 8601 format
1377
+ * @returns Timestamp string in ISO 8601 format
1376
1378
  */
1377
1379
  declare function getTimestamp(value?: string | number | Date): Timestamp;
1378
1380
  /**
@@ -1,5 +1,6 @@
1
1
  var LocalityIDB = (function(exports) {
2
2
 
3
+ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
3
4
 
4
5
  //#region node_modules/.pnpm/nhb-toolbox@4.28.66/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
5
6
  function isNumber(value) {
@@ -152,7 +153,7 @@ var LocalityIDB = (function(exports) {
152
153
 
153
154
  //#endregion
154
155
  //#region src/core.ts
155
- /** Symbol key for column column data type */
156
+ /** Symbol key for column data type */
156
157
  const ColumnType = Symbol("ColumnType");
157
158
  /** Symbol key for primary key marker */
158
159
  const IsPrimaryKey = Symbol("IsPrimaryKey");
@@ -402,7 +403,7 @@ var LocalityIDB = (function(exports) {
402
403
  * * Get current timestamp in ISO 8601 format
403
404
  * @param value Optional date input (string, number, or Date object). Defaults to {@link Date new Date()}
404
405
  * @remarks If the provided value is invalid, the current date and time will be used.
405
- * @return Timestamp string in ISO 8601 format
406
+ * @returns Timestamp string in ISO 8601 format
406
407
  */
407
408
  function getTimestamp(value) {
408
409
  let date = value instanceof Date ? value : new Date(isNonEmptyString(value) ? value.replace(/['"]/g, "") : value ?? Date.now());
@@ -706,7 +707,7 @@ var LocalityIDB = (function(exports) {
706
707
  return this;
707
708
  }
708
709
  /**
709
- * @instance Order results by specified key and direction
710
+ * @instance Order results by specified key and direction
710
711
  * @param key Key to order by
711
712
  * @param dir Direction: 'asc' | 'desc' (default: 'asc')
712
713
  *
@@ -1396,7 +1397,7 @@ var LocalityIDB = (function(exports) {
1396
1397
  /**
1397
1398
  * @instance Select records from a table.
1398
1399
  * @param table Table name.
1399
- * @returns
1400
+ * @returns Select query builder for the table.
1400
1401
  */
1401
1402
  from(table) {
1402
1403
  return new SelectQuery(table, () => this.#db, this.#readyPromise);
@@ -1576,7 +1577,7 @@ var LocalityIDB = (function(exports) {
1576
1577
  * }),
1577
1578
  * });
1578
1579
  *
1579
- * // Export all tables pretty-printed pretty-printed with default filename
1580
+ * // Export all tables pretty-printed with default filename
1580
1581
  * await db.export();
1581
1582
  *
1582
1583
  * // Export specific tables pretty-printed with custom filename
package/dist/index.mjs CHANGED
@@ -149,7 +149,7 @@ function sortAnArray(array, options) {
149
149
 
150
150
  //#endregion
151
151
  //#region src/core.ts
152
- /** Symbol key for column column data type */
152
+ /** Symbol key for column data type */
153
153
  const ColumnType = Symbol("ColumnType");
154
154
  /** Symbol key for primary key marker */
155
155
  const IsPrimaryKey = Symbol("IsPrimaryKey");
@@ -399,7 +399,7 @@ function uuidV4(uppercase = false) {
399
399
  * * Get current timestamp in ISO 8601 format
400
400
  * @param value Optional date input (string, number, or Date object). Defaults to {@link Date new Date()}
401
401
  * @remarks If the provided value is invalid, the current date and time will be used.
402
- * @return Timestamp string in ISO 8601 format
402
+ * @returns Timestamp string in ISO 8601 format
403
403
  */
404
404
  function getTimestamp(value) {
405
405
  let date = value instanceof Date ? value : new Date(isNonEmptyString(value) ? value.replace(/['"]/g, "") : value ?? Date.now());
@@ -703,7 +703,7 @@ var SelectQuery = class {
703
703
  return this;
704
704
  }
705
705
  /**
706
- * @instance Order results by specified key and direction
706
+ * @instance Order results by specified key and direction
707
707
  * @param key Key to order by
708
708
  * @param dir Direction: 'asc' | 'desc' (default: 'asc')
709
709
  *
@@ -1393,7 +1393,7 @@ var Locality = class Locality {
1393
1393
  /**
1394
1394
  * @instance Select records from a table.
1395
1395
  * @param table Table name.
1396
- * @returns
1396
+ * @returns Select query builder for the table.
1397
1397
  */
1398
1398
  from(table) {
1399
1399
  return new SelectQuery(table, () => this.#db, this.#readyPromise);
@@ -1573,7 +1573,7 @@ var Locality = class Locality {
1573
1573
  * }),
1574
1574
  * });
1575
1575
  *
1576
- * // Export all tables pretty-printed pretty-printed with default filename
1576
+ * // Export all tables pretty-printed with default filename
1577
1577
  * await db.export();
1578
1578
  *
1579
1579
  * // Export specific tables pretty-printed with custom filename
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "locality-idb",
3
- "version": "1.5.3",
3
+ "version": "1.5.6",
4
4
  "description": "SQL-like query builder for IndexedDB with Drizzle-style API",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "types": "./dist/index.d.cts",
8
8
  "exports": {
9
9
  ".": {
10
- "require": "./dist/index.cjs",
11
- "import": "./dist/index.mjs"
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.cjs"
12
12
  },
13
13
  "./package.json": "./package.json"
14
14
  },
@@ -47,11 +47,23 @@
47
47
  "package.json"
48
48
  ],
49
49
  "keywords": [
50
+ "indexeddb",
50
51
  "indexed-db",
52
+ "indexeddb-orm",
53
+ "indexed-db-orm",
51
54
  "sql",
52
- "drizzle",
53
55
  "db",
56
+ "orm",
57
+ "idb",
58
+ "idb-orm",
59
+ "typescript",
60
+ "typescript-orm",
61
+ "typescript-idb",
62
+ "typescript-indexeddb",
63
+ "typescript-indexed-db",
64
+ "locality-idb",
54
65
  "locality",
66
+ "drizzle",
55
67
  "database"
56
68
  ],
57
69
  "devDependencies": {
@@ -64,20 +76,19 @@
64
76
  "eslint-plugin-prettier": "^5.5.5",
65
77
  "globals": "^17.3.0",
66
78
  "nhb-scripts": "^1.9.2",
79
+ "nhb-toolbox": "^4.28.66",
67
80
  "prettier": "^3.8.1",
68
- "tsdown": "^0.20.1",
81
+ "tsdown": "^0.20.3",
69
82
  "typescript": "^5.9.3",
70
83
  "typescript-eslint": "^8.54.0"
71
84
  },
72
85
  "main": "./dist/index.cjs",
73
86
  "module": "./dist/index.mjs",
74
- "dependencies": {
75
- "nhb-toolbox": "^4.28.66"
76
- },
77
87
  "scripts": {
78
88
  "build": "tsdown",
79
89
  "dev:pkg": "tsdown --watch",
80
90
  "dev": "pnpm --dir demo run dev",
91
+ "install:demo": "pnpm --dir demo install",
81
92
  "build:demo": "pnpm --dir demo run build",
82
93
  "preview": "pnpm --dir demo run preview",
83
94
  "typecheck": "tsc --noEmit",