locality-idb 1.5.6 → 1.5.8
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 +3 -6
- package/dist/index.cjs +5 -5
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.iife.js +5 -5
- package/dist/index.mjs +5 -5
- package/package.json +8 -8
package/README.md
CHANGED
|
@@ -335,7 +335,7 @@ const schema = defineSchema({
|
|
|
335
335
|
> - `onUpdate()` modifier can be used to auto-update values on update operations (e.g. `updatedAt` timestamp).
|
|
336
336
|
> - Type extensions for `uuid` and `timestamp` are not applicable since they are already typed.
|
|
337
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).
|
|
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.
|
|
338
|
+
> - For custom timestamp formats, use date libraries like [`Chronos`](https://toolbox.nazmul-nhb.dev/docs/classes/Chronos) or [`getTimestamp`](https://toolbox.nazmul-nhb.dev/docs/utilities/date/getTimestamp) (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.
|
|
339
339
|
|
|
340
340
|
##### Boolean Types (`bool`, `boolean`)
|
|
341
341
|
|
|
@@ -2225,16 +2225,13 @@ type UserRow = $InferRow<typeof schema.users.columns>;
|
|
|
2225
2225
|
|
|
2226
2226
|
### Branded Types
|
|
2227
2227
|
|
|
2228
|
-
Locality IDB uses branded
|
|
2228
|
+
Locality IDB uses branded type for UUIDv4 for better type safety:
|
|
2229
2229
|
|
|
2230
2230
|
```typescript
|
|
2231
|
-
import type { UUID
|
|
2231
|
+
import type { UUID } from 'locality-idb';
|
|
2232
2232
|
|
|
2233
2233
|
// UUID types are branded with their version
|
|
2234
2234
|
type UserId = UUID<'v4'>; // Branded UUID v4
|
|
2235
|
-
|
|
2236
|
-
// Timestamps are branded ISO 8601 strings
|
|
2237
|
-
type CreatedAt = Timestamp; // Branded timestamp string
|
|
2238
2235
|
```
|
|
2239
2236
|
|
|
2240
2237
|
### Helper Types
|
package/dist/index.cjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
2
|
|
|
3
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
3
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
4
4
|
function isNumber(value) {
|
|
5
5
|
return typeof value === "number" && Number.isFinite(value);
|
|
6
6
|
}
|
|
@@ -24,7 +24,7 @@ function isNonEmptyString(value) {
|
|
|
24
24
|
}
|
|
25
25
|
|
|
26
26
|
//#endregion
|
|
27
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
27
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
28
28
|
function isArray(value) {
|
|
29
29
|
return Array.isArray(value);
|
|
30
30
|
}
|
|
@@ -54,13 +54,13 @@ function isMap(value) {
|
|
|
54
54
|
}
|
|
55
55
|
|
|
56
56
|
//#endregion
|
|
57
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
57
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/string/utilities.js
|
|
58
58
|
const extractNumbersFromString = (input) => {
|
|
59
59
|
return (input.match(/\d+/g) || [])?.map(Number);
|
|
60
60
|
};
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
63
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/specials.js
|
|
64
64
|
function isEmail$1(value) {
|
|
65
65
|
return isString(value) && /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(value);
|
|
66
66
|
}
|
|
@@ -82,7 +82,7 @@ function isNumericString(value) {
|
|
|
82
82
|
}
|
|
83
83
|
|
|
84
84
|
//#endregion
|
|
85
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
85
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/array/sort.js
|
|
86
86
|
function naturalSort(a, b, options) {
|
|
87
87
|
const { caseInsensitive = true, localeAware = false } = options || {};
|
|
88
88
|
const _createChunks = (str) => {
|
package/dist/index.d.cts
CHANGED
|
@@ -576,7 +576,7 @@ type $InferUUID<T extends ColumnDefinition> = { [K in keyof T]: T[K] extends Col
|
|
|
576
576
|
/** Finds the field name with {@link Timestamp} type. */
|
|
577
577
|
type $InferTimestamp<T extends ColumnDefinition> = { [K in keyof T]: T[K] extends Column<infer C, TypeName> ? C extends Timestamp ? K : never : never }[keyof T];
|
|
578
578
|
/** Timestamp string type in ISO 8601 format */
|
|
579
|
-
type Timestamp =
|
|
579
|
+
type Timestamp = `${number}-${number}-${number}T${number}:${number}:${number}.${number}${'Z' | `${'+' | '-'}${number}:${number}`}`;
|
|
580
580
|
/** Sort direction type for ordering queries */
|
|
581
581
|
type SortDirection = 'asc' | 'desc';
|
|
582
582
|
/** Predicate function type for WHERE clauses in queries */
|
|
@@ -588,8 +588,8 @@ type InferUpdateType<T extends Table> = Prettify<Partial<Omit<$InferRow<T['colum
|
|
|
588
588
|
/** Creates a type for select operations. */
|
|
589
589
|
type InferSelectType<S extends Table> = Prettify<S extends infer T ? T extends Table<infer C> ? $InferRow<C> : never : never>;
|
|
590
590
|
type PrimaryKeyType<S extends Table> = InferSelectType<S>[$InferPrimaryKey<S['columns']>];
|
|
591
|
-
type IndexKeyType<S extends Table> = InferSelectType<S>[$
|
|
592
|
-
type UniqueKeyType<S extends Table> = InferSelectType<S>[$
|
|
591
|
+
type IndexKeyType<S extends Table> = InferSelectType<S>[$InferIndex<S['columns']>];
|
|
592
|
+
type UniqueKeyType<S extends Table> = InferSelectType<S>[$InferUnique<S['columns']>];
|
|
593
593
|
/** Column type strings used in {@link Column} definitions */
|
|
594
594
|
type TypeName = LooseLiteral<'int' | 'float' | 'number' | 'numeric' | 'bigint' | 'text' | 'string' | `char${number}` | `varchar${number}` | 'uuid' | 'timestamp' | 'email' | 'url' | 'bool' | 'boolean' | 'date' | 'object' | 'array' | 'list' | 'tuple' | 'set' | 'map' | 'custom'>;
|
|
595
595
|
/** Email string type in basic format */
|
|
@@ -1164,7 +1164,7 @@ declare const column: {
|
|
|
1164
1164
|
* - This column type is used for storing date and time information in ISO 8601 format.
|
|
1165
1165
|
* - Automatically generates the current timestamp when no value is provided.
|
|
1166
1166
|
*/
|
|
1167
|
-
timestamp: () => Column
|
|
1167
|
+
timestamp: () => Column<`${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | `${number}-${number}-${number}T${number}:${number}:${number}.${number}+${number}:${number}` | `${number}-${number}-${number}T${number}:${number}:${number}.${number}-${number}:${number}`, "timestamp">;
|
|
1168
1168
|
/**
|
|
1169
1169
|
* Creates an email column.
|
|
1170
1170
|
* @returns A new {@link Column} instance for emails.
|
package/dist/index.d.mts
CHANGED
|
@@ -576,7 +576,7 @@ type $InferUUID<T extends ColumnDefinition> = { [K in keyof T]: T[K] extends Col
|
|
|
576
576
|
/** Finds the field name with {@link Timestamp} type. */
|
|
577
577
|
type $InferTimestamp<T extends ColumnDefinition> = { [K in keyof T]: T[K] extends Column<infer C, TypeName> ? C extends Timestamp ? K : never : never }[keyof T];
|
|
578
578
|
/** Timestamp string type in ISO 8601 format */
|
|
579
|
-
type Timestamp =
|
|
579
|
+
type Timestamp = `${number}-${number}-${number}T${number}:${number}:${number}.${number}${'Z' | `${'+' | '-'}${number}:${number}`}`;
|
|
580
580
|
/** Sort direction type for ordering queries */
|
|
581
581
|
type SortDirection = 'asc' | 'desc';
|
|
582
582
|
/** Predicate function type for WHERE clauses in queries */
|
|
@@ -588,8 +588,8 @@ type InferUpdateType<T extends Table> = Prettify<Partial<Omit<$InferRow<T['colum
|
|
|
588
588
|
/** Creates a type for select operations. */
|
|
589
589
|
type InferSelectType<S extends Table> = Prettify<S extends infer T ? T extends Table<infer C> ? $InferRow<C> : never : never>;
|
|
590
590
|
type PrimaryKeyType<S extends Table> = InferSelectType<S>[$InferPrimaryKey<S['columns']>];
|
|
591
|
-
type IndexKeyType<S extends Table> = InferSelectType<S>[$
|
|
592
|
-
type UniqueKeyType<S extends Table> = InferSelectType<S>[$
|
|
591
|
+
type IndexKeyType<S extends Table> = InferSelectType<S>[$InferIndex<S['columns']>];
|
|
592
|
+
type UniqueKeyType<S extends Table> = InferSelectType<S>[$InferUnique<S['columns']>];
|
|
593
593
|
/** Column type strings used in {@link Column} definitions */
|
|
594
594
|
type TypeName = LooseLiteral<'int' | 'float' | 'number' | 'numeric' | 'bigint' | 'text' | 'string' | `char${number}` | `varchar${number}` | 'uuid' | 'timestamp' | 'email' | 'url' | 'bool' | 'boolean' | 'date' | 'object' | 'array' | 'list' | 'tuple' | 'set' | 'map' | 'custom'>;
|
|
595
595
|
/** Email string type in basic format */
|
|
@@ -1164,7 +1164,7 @@ declare const column: {
|
|
|
1164
1164
|
* - This column type is used for storing date and time information in ISO 8601 format.
|
|
1165
1165
|
* - Automatically generates the current timestamp when no value is provided.
|
|
1166
1166
|
*/
|
|
1167
|
-
timestamp: () => Column
|
|
1167
|
+
timestamp: () => Column<`${number}-${number}-${number}T${number}:${number}:${number}.${number}Z` | `${number}-${number}-${number}T${number}:${number}:${number}.${number}+${number}:${number}` | `${number}-${number}-${number}T${number}:${number}:${number}.${number}-${number}:${number}`, "timestamp">;
|
|
1168
1168
|
/**
|
|
1169
1169
|
* Creates an email column.
|
|
1170
1170
|
* @returns A new {@link Column} instance for emails.
|
package/dist/index.iife.js
CHANGED
|
@@ -2,7 +2,7 @@ var LocalityIDB = (function(exports) {
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
5
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
6
6
|
function isNumber(value) {
|
|
7
7
|
return typeof value === "number" && Number.isFinite(value);
|
|
8
8
|
}
|
|
@@ -26,7 +26,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
26
26
|
}
|
|
27
27
|
|
|
28
28
|
//#endregion
|
|
29
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
29
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
30
30
|
function isArray(value) {
|
|
31
31
|
return Array.isArray(value);
|
|
32
32
|
}
|
|
@@ -56,13 +56,13 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
59
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/string/utilities.js
|
|
60
60
|
const extractNumbersFromString = (input) => {
|
|
61
61
|
return (input.match(/\d+/g) || [])?.map(Number);
|
|
62
62
|
};
|
|
63
63
|
|
|
64
64
|
//#endregion
|
|
65
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
65
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/specials.js
|
|
66
66
|
function isEmail$1(value) {
|
|
67
67
|
return isString(value) && /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(value);
|
|
68
68
|
}
|
|
@@ -84,7 +84,7 @@ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
//#endregion
|
|
87
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
87
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/array/sort.js
|
|
88
88
|
function naturalSort(a, b, options) {
|
|
89
89
|
const { caseInsensitive = true, localeAware = false } = options || {};
|
|
90
90
|
const _createChunks = (str) => {
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
1
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/primitives.js
|
|
2
2
|
function isNumber(value) {
|
|
3
3
|
return typeof value === "number" && Number.isFinite(value);
|
|
4
4
|
}
|
|
@@ -22,7 +22,7 @@ function isNonEmptyString(value) {
|
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
//#endregion
|
|
25
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
25
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/non-primitives.js
|
|
26
26
|
function isArray(value) {
|
|
27
27
|
return Array.isArray(value);
|
|
28
28
|
}
|
|
@@ -52,13 +52,13 @@ function isMap(value) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
55
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/string/utilities.js
|
|
56
56
|
const extractNumbersFromString = (input) => {
|
|
57
57
|
return (input.match(/\d+/g) || [])?.map(Number);
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
//#endregion
|
|
61
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
61
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/guards/specials.js
|
|
62
62
|
function isEmail$1(value) {
|
|
63
63
|
return isString(value) && /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/.test(value);
|
|
64
64
|
}
|
|
@@ -80,7 +80,7 @@ function isNumericString(value) {
|
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
//#endregion
|
|
83
|
-
//#region node_modules/.pnpm/nhb-toolbox@4.28.
|
|
83
|
+
//#region node_modules/.pnpm/nhb-toolbox@4.28.80/node_modules/nhb-toolbox/dist/esm/array/sort.js
|
|
84
84
|
function naturalSort(a, b, options) {
|
|
85
85
|
const { caseInsensitive = true, localeAware = false } = options || {};
|
|
86
86
|
const _createChunks = (str) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "locality-idb",
|
|
3
|
-
"version": "1.5.
|
|
3
|
+
"version": "1.5.8",
|
|
4
4
|
"description": "SQL-like query builder for IndexedDB with Drizzle-style API",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -67,20 +67,20 @@
|
|
|
67
67
|
"database"
|
|
68
68
|
],
|
|
69
69
|
"devDependencies": {
|
|
70
|
-
"@eslint/js": "^
|
|
71
|
-
"@types/node": "^25.
|
|
72
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
73
|
-
"@typescript-eslint/parser": "^8.
|
|
74
|
-
"eslint": "^
|
|
70
|
+
"@eslint/js": "^10.0.1",
|
|
71
|
+
"@types/node": "^25.3.0",
|
|
72
|
+
"@typescript-eslint/eslint-plugin": "^8.56.0",
|
|
73
|
+
"@typescript-eslint/parser": "^8.56.0",
|
|
74
|
+
"eslint": "^10.0.1",
|
|
75
75
|
"eslint-config-prettier": "^10.1.8",
|
|
76
76
|
"eslint-plugin-prettier": "^5.5.5",
|
|
77
77
|
"globals": "^17.3.0",
|
|
78
78
|
"nhb-scripts": "^1.9.2",
|
|
79
|
-
"nhb-toolbox": "^4.28.
|
|
79
|
+
"nhb-toolbox": "^4.28.80",
|
|
80
80
|
"prettier": "^3.8.1",
|
|
81
81
|
"tsdown": "^0.20.3",
|
|
82
82
|
"typescript": "^5.9.3",
|
|
83
|
-
"typescript-eslint": "^8.
|
|
83
|
+
"typescript-eslint": "^8.56.0"
|
|
84
84
|
},
|
|
85
85
|
"main": "./dist/index.cjs",
|
|
86
86
|
"module": "./dist/index.mjs",
|