@starbemtech/star-db-query-builder 1.3.0 → 1.4.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/.claude/skills/star-db-query-builder/SKILL.md +104 -0
- package/CHANGELOG.md +81 -46
- package/LICENSE +21 -0
- package/README.md +194 -94
- package/bin/install-skill.js +53 -0
- package/dist/src/core/repository.d.ts +92 -9
- package/dist/src/core/repository.js +275 -27
- package/dist/src/core/repository.js.map +1 -1
- package/dist/src/core/types.d.ts +17 -2
- package/dist/src/core/utils.d.ts +102 -0
- package/dist/src/core/utils.js +287 -70
- package/dist/src/core/utils.js.map +1 -1
- package/dist/src/db/initDb.d.ts +60 -50
- package/dist/src/db/initDb.js +96 -64
- package/dist/src/db/initDb.js.map +1 -1
- package/dist/src/db/mysqlClient.d.ts +3 -8
- package/dist/src/db/mysqlClient.js +9 -11
- package/dist/src/db/mysqlClient.js.map +1 -1
- package/dist/src/db/pgClient.js +0 -2
- package/dist/src/db/pgClient.js.map +1 -1
- package/dist/src/monitor/monitor.js +7 -0
- package/dist/src/monitor/monitor.js.map +1 -1
- package/package.json +28 -20
- package/.github/workflows/publish.yml +0 -118
- package/.prettierignore +0 -3
- package/.prettierrc +0 -5
- package/ARCHITECTURE.md +0 -313
- package/coverage/base.css +0 -224
- package/coverage/block-navigation.js +0 -87
- package/coverage/favicon.png +0 -0
- package/coverage/index.html +0 -131
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +0 -131
- package/coverage/lcov-report/mysqlClient.ts.html +0 -685
- package/coverage/lcov-report/pgClient.ts.html +0 -823
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -210
- package/coverage/lcov.info +0 -533
- package/coverage/mysqlClient.ts.html +0 -685
- package/coverage/pgClient.ts.html +0 -823
- package/coverage/prettify.css +0 -1
- package/coverage/prettify.js +0 -2
- package/coverage/sort-arrow-sprite.png +0 -0
- package/coverage/sorter.js +0 -210
- package/dist/src/setupTests.d.ts +0 -26
- package/dist/src/setupTests.js +0 -43
- package/dist/src/setupTests.js.map +0 -1
- package/docs/INDEX.md +0 -145
- package/docs/methods/findFirst.md +0 -394
- package/docs/methods/findMany.md +0 -587
- package/docs/methods/insert.md +0 -536
- package/docs/methods/insertMany.md +0 -627
- package/docs/methods/joins.md +0 -781
- package/docs/methods/rawQuery.md +0 -284
- package/docs/methods/transactions.md +0 -737
- package/eslint.config.mjs +0 -77
- package/index.ts +0 -16
- package/jest.config.ts +0 -194
- package/scripts/release.sh +0 -123
- package/src/core/repository.ts +0 -865
- package/src/core/types.ts +0 -97
- package/src/core/utils.ts +0 -357
- package/src/db/IDatabaseClient.ts +0 -16
- package/src/db/__tests__/mysqlClient.test.ts +0 -262
- package/src/db/__tests__/pgClient.test.ts +0 -260
- package/src/db/initDb.ts +0 -181
- package/src/db/mysqlClient.ts +0 -200
- package/src/db/pgClient.ts +0 -246
- package/src/monitor/monitor.ts +0 -16
- package/src/setupTests.ts +0 -45
- package/tsconfig.test.json +0 -21
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: star-db-query-builder
|
|
3
|
+
description: >
|
|
4
|
+
Use this skill whenever writing, reviewing, or debugging code that uses
|
|
5
|
+
`@starbemtech/star-db-query-builder` (Starbem's internal Postgres/MySQL query
|
|
6
|
+
builder) — importing it, calling initDb/findFirst/findMany/findManyCursor/
|
|
7
|
+
insert/insertMany/update/updateMany/upsert/deleteOne/deleteMany/joins/rawQuery/
|
|
8
|
+
withTransaction, or adding a new backend service endpoint that needs a
|
|
9
|
+
database query. Also use it when asked to "use the query builder", "add a
|
|
10
|
+
query with star-db-query-builder", or when a file already imports from
|
|
11
|
+
`@starbemtech/star-db-query-builder`. DO NOT use for Prisma/Knex/TypeORM code,
|
|
12
|
+
and do not use it to modify the library's own source (that's a repo working
|
|
13
|
+
directly in `libs/star-db-query-builder` — see its AGENTS.md instead).
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
# star-db-query-builder usage
|
|
17
|
+
|
|
18
|
+
Function-based SQL query builder for Postgres (`pg`) and MySQL (`mysql2`). No ORM. You write against a typed function API; the library builds parameterized SQL for you. This skill exists so agents write **correct** calls on the first try instead of guessing an API shape that doesn't exist.
|
|
19
|
+
|
|
20
|
+
Full reference: `docs/methods/*.md` and `README.md` in the library repo (`starbem/star-db-query-builder`). This skill is the fast-path summary — when in doubt on an edge case, read the actual doc file for that method rather than guessing.
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
import { initDb, getDbClient } from '@starbemtech/star-db-query-builder'
|
|
26
|
+
|
|
27
|
+
await initDb({
|
|
28
|
+
type: 'pg', // or 'mysql' — NOT 'postgres', that string throws "Unsupported database type"
|
|
29
|
+
options: { host, port, user, password, database },
|
|
30
|
+
// optional: name (for multiple named connections), retryOptions, queryTimeout,
|
|
31
|
+
// installUnaccentExtension (pg only)
|
|
32
|
+
})
|
|
33
|
+
|
|
34
|
+
const dbClient = getDbClient() // or getDbClient('name') for a named connection
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Every query function below takes `dbClient` explicitly — it is not implicit/global per call.
|
|
38
|
+
|
|
39
|
+
## Core functions
|
|
40
|
+
|
|
41
|
+
```ts
|
|
42
|
+
findFirst({ tableName, dbClient, where?, select?, orderBy?, groupBy? }) // -> T | null, always LIMIT 1
|
|
43
|
+
findMany({ tableName, dbClient, where?, select?, orderBy?, groupBy?, limit?, offset?, unaccent? }) // -> T[]
|
|
44
|
+
findManyCursor({ tableName, dbClient, cursorField, cursor?, limit, direction?, where?, select? }) // -> { data, nextCursor }
|
|
45
|
+
insert({ tableName, dbClient, data, returning? }) // single row, all column names auto-quoted
|
|
46
|
+
insertMany({ tableName, dbClient, data: T[], returning? }) // batch insert, every item must share the same keys
|
|
47
|
+
update({ tableName, dbClient, id, data }) // SET col = literal value only, see gotcha below
|
|
48
|
+
updateMany({ tableName, dbClient, where, data })
|
|
49
|
+
upsert({ tableName, dbClient, data, conflictFields, updateFields?, returning? })
|
|
50
|
+
deleteOne({ tableName, dbClient, id, permanently? }) // soft delete by default (sets status = 'deleted'), permanently=true for hard delete
|
|
51
|
+
deleteMany({ tableName, dbClient, ids, field? }) // field defaults to 'id'
|
|
52
|
+
joins({ tableName, dbClient, joins: [...], where?, select?, orderBy?, groupBy?, limit?, offset? })
|
|
53
|
+
rawQuery({ dbClient, sql, params? }) // escape hatch — you write the SQL, still parameterized
|
|
54
|
+
withTransaction(dbClient, async (txClient) => { ... }) // auto commit/rollback
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Gotchas that will produce wrong or broken code if ignored
|
|
58
|
+
|
|
59
|
+
1. **`update()`/`updateMany()` do NOT support arithmetic updates.** `data: { stock: { operator: '-', value: qty } }` is not interpreted — it is not a supported shape at all. If you need `stock = stock - qty`, read the current value first (`findFirst`), compute in JS, then pass the literal result:
|
|
60
|
+
```ts
|
|
61
|
+
const row = await findFirst({ tableName: 'products', dbClient, where: { id: { operator: '=', value: productId } } })
|
|
62
|
+
await update({ tableName: 'products', dbClient, id: productId, data: { stock: row.stock - qty } })
|
|
63
|
+
```
|
|
64
|
+
Do this inside `withTransaction` if it must be atomic against concurrent writes — the library does not do this for you.
|
|
65
|
+
|
|
66
|
+
2. **`joins()` has no `having` parameter.** `QueryParams<T>` doesn't declare one, so `joins({ ..., having: {...} })` is a TypeScript type error, not a runtime no-op. For HAVING, use `rawQuery`.
|
|
67
|
+
|
|
68
|
+
3. **`JOINS` inside a `Conditions<T>` `where` object is NOT a SQL JOIN.** It's a nested AND-group of conditions, unfortunately named. If you want an actual SQL join, use the `joins()` function, not a `JOINS` key inside `where`.
|
|
69
|
+
|
|
70
|
+
4. **`upsert()` on MySQL does not put `conflictFields` in the generated SQL.** MySQL's `ON DUPLICATE KEY UPDATE` relies entirely on the table's real unique/PK constraint — `conflictFields` is only used to re-select the row afterward (MySQL has no `RETURNING`). The function does not create or verify that the constraint exists. Before using `upsert`, confirm the target table actually has a unique constraint or PK on the fields you're passing as `conflictFields` — otherwise MySQL will just insert duplicates.
|
|
71
|
+
|
|
72
|
+
5. **Table/column/field names go through strict identifier validation** (`assertValidIdentifier` for `tableName`, `join.table`, `deleteMany.field`, `data` keys in `insert`/`insertMany`/`upsert`/`update`/`updateMany`, and `where` field names; a looser `assertSafeSqlFragment` for `select`/`groupBy`/`orderBy.field`/`join.on`/`where` `NOT EXISTS` subqueries that still allows real SQL expressions like `COUNT(*) as count`). Never build these strings by concatenating unsanitized user input yourself and passing them in expecting the library to catch it silently — it throws on invalid identifiers, so validate/allowlist at your own layer too if the name comes from user input.
|
|
73
|
+
|
|
74
|
+
6. **`findManyCursor()` is a separate function, not a `findMany()` option.** Its return shape is `{ data, nextCursor }`, not a bare array — don't destructure it like `findMany`'s return.
|
|
75
|
+
|
|
76
|
+
7. **Values are always parameterized — never string-interpolate a value into `where`/`data`.** The library already does this correctly for you; the mistake to avoid is bypassing it via `rawQuery` with interpolated strings instead of `params`.
|
|
77
|
+
|
|
78
|
+
8. **Every `where` condition must be `{ operator, value }` — a plain value throws, it is not silently ignored.** `where: { status: 'active' }` throws `Invalid where condition for "status"`; use `where: { status: { operator: '=', value: 'active' } }`. This matters most on `updateMany`/`deleteMany`: getting the shape wrong used to silently drop the condition and run the write against every row in the table — now it throws instead, but write your conditions correctly rather than relying on the error.
|
|
79
|
+
|
|
80
|
+
9. **`IN`/`NOT IN`/`BETWEEN` cap at 10,000 values in `value`**, throwing a descriptive error past that — chunk the list instead of forwarding an unbounded array (e.g. raw search results) as a single condition. `BETWEEN` additionally requires exactly 2 values.
|
|
81
|
+
|
|
82
|
+
## Where conditions (`Conditions<T>`)
|
|
83
|
+
|
|
84
|
+
Every condition is `{ operator, value }` — there is no `{ EQUALS: x }` / `{ IN: [...] }` shorthand, that shape does not exist in the code:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
where: {
|
|
88
|
+
id: { operator: '=', value: someId },
|
|
89
|
+
status: { operator: 'IN', value: ['active', 'pending'] },
|
|
90
|
+
createdAt: { operator: 'BETWEEN', value: [start, end] },
|
|
91
|
+
name: { operator: 'ILIKE', value: '%term%' }, // add unaccent: true on findMany/joins to also strip accents (pg only)
|
|
92
|
+
deletedAt: { operator: 'IS NULL', value: null },
|
|
93
|
+
OR: [
|
|
94
|
+
{ email: { operator: '=', value: a } },
|
|
95
|
+
{ email: { operator: '=', value: b } },
|
|
96
|
+
],
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
Valid `operator` values: `=`, `!=`, `>`, `<`, `>=`, `<=`, `LIKE`, `NOT LIKE`, `ILIKE`, `IN`, `NOT IN`, `BETWEEN`, `IS NULL`, `IS NOT NULL`, `NOT EXISTS`.
|
|
101
|
+
|
|
102
|
+
## Common mistake to avoid: don't invent methods
|
|
103
|
+
|
|
104
|
+
If a method/param you want to use isn't in the list above, check `docs/methods/` and `README.md` in the library repo before assuming it exists. This library's docs have previously drifted from the implementation (phantom params, unsupported shapes) — when unsure, prefer reading `src/core/repository.ts` in the library repo over trusting an example that "looks right."
|
package/CHANGELOG.md
CHANGED
|
@@ -5,63 +5,98 @@ All notable changes to this project will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
-
|
|
8
|
+
Entries below are generated from the real commit history for each tagged release. See each release on GitHub for the full commit list: https://github.com/starbem/star-db-query-builder/releases
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
## [Unreleased]
|
|
11
11
|
|
|
12
|
-
-
|
|
13
|
-
- **TypeScript Support**: Complete typing with TypeScript 5.8+
|
|
14
|
-
- **Auto Retry Mechanism**: Automatic retry system for transient errors
|
|
15
|
-
- **Monitoring System**: Event system for monitoring and logging
|
|
16
|
-
- **Batch Operations**: Optimized batch operations (insertMany, updateMany)
|
|
17
|
-
- **Unaccent Support**: Support for PostgreSQL unaccent extension
|
|
18
|
-
- **Complex Query Builder**: Fluent interface for complex queries
|
|
19
|
-
- **Transaction Support**: Transaction support
|
|
20
|
-
- **Connection Pooling**: Efficient connection management
|
|
12
|
+
## [1.4.0] - 2026-09-04
|
|
21
13
|
|
|
22
|
-
|
|
14
|
+
- `fix`: `createWhereClause` no longer throws `RangeError: Maximum call stack size exceeded` on a large `IN`/`NOT IN`/`BETWEEN` condition — `values.push(...value)` (spreading the array into a function call) replaced with a plain loop. Fixes #21 (item 1) / #22.
|
|
15
|
+
- `fix`: `IN`/`NOT IN`/`BETWEEN` condition arrays are now capped at 10,000 values with a descriptive error, instead of silently building a query with tens of thousands of bind parameters. Fixes #21 (item 2).
|
|
16
|
+
- `fix`: `update()`/`deleteOne()` now include the table name in the `ID is required` error instead of a bare generic message. Fixes #21 (item 3).
|
|
17
|
+
- `fix`: `createLimitClause`/`createOffsetClause` now validate `limit`/`offset` are positive/non-negative integers instead of interpolating whatever the caller passes into the SQL string — a non-numeric value (e.g. forwarded from an unvalidated HTTP query param) previously went straight into `LIMIT`/`OFFSET`.
|
|
18
|
+
- `fix`: a `where` condition using a plain value (e.g. `{ status: 'active' }` instead of `{ status: { operator: '=', value: 'active' } }`) now throws instead of being silently dropped from the generated WHERE clause — the silent-drop behavior meant `updateMany`/`deleteMany` calls that intended to scope a write could end up running against every row in the table. `updateMany` additionally refuses to run if `where` produces an empty WHERE clause.
|
|
19
|
+
- `fix`: an `operator` passed in lowercase or mixed case (e.g. `'ilike'`, supported pre-1.4.0 since operators used to be interpolated as-is) is now normalized before the whitelist check instead of being rejected — a regression introduced by the P0/#21 sanitization work in this same release.
|
|
20
|
+
- `fix`: `BETWEEN` now rejects a `value` array that isn't exactly 2 items, and `NOT EXISTS` now rejects a non-string `value`, instead of building malformed SQL.
|
|
21
|
+
- `fix`: `insert`/`insertMany`/`upsert` now reject `data` containing `id` or `updated_at` instead of silently duplicating them in the generated column list (previously produced e.g. `INSERT INTO t ("id", "id", ...)`, a database error with no clear cause).
|
|
22
|
+
- `fix`: `upsert`'s `updateFields` now accepts `updated_at` — the function always refreshes it itself regardless of `data`, so rejecting it as "not present in data" (introduced in the prior sanitization pass) was an inconsistent contract.
|
|
23
|
+
- `fix`: `deleteMany`/`insertMany` now validate the total bind-parameter count against the same 65535 driver limit `createWhereClause`'s `IN`/`BETWEEN` guard already enforced, instead of only guarding one of the code paths that can build an oversized query.
|
|
24
|
+
- `fix`: `createWhereClause` no longer silently drops the `AND` group when `OR` is also present in the same `where` object — both are now rendered.
|
|
23
25
|
|
|
24
|
-
-
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
-
|
|
29
|
-
-
|
|
26
|
+
- `fix`: `findFirst` now adds `LIMIT 1` to the generated query instead of fetching every matching row and taking the first in JS.
|
|
27
|
+
- `fix`: `update()` no longer concatenates `id` directly into the SQL string — parameterized for both pg and mysql (was a real SQL injection vector).
|
|
28
|
+
- `fix`: `update()`/`updateMany()` now validate and quote every column name in `data` (`assertValidIdentifier` + `quoteIdentifier`), matching `insert`/`upsert`. Previously these column names were interpolated into the SQL string unvalidated.
|
|
29
|
+
- `fix`: `createWhereClause` now validates `where` field names (`assertValidIdentifier`), restricts `operator` to a runtime whitelist, and validates `NOT EXISTS` subquery fragments (`assertSafeSqlFragment`) — previously all three were interpolated into the SQL string unvalidated.
|
|
30
|
+
- `fix`: `upsert()` no longer duplicates `updated_at` in the generated `SET`/`ON CONFLICT DO UPDATE` clause when it's also named in `updateFields`.
|
|
31
|
+
- `fix`: `upsert()` now rejects `updateFields`/`conflictFields` entries that aren't a key of `data`, instead of silently resolving to the column's table default (pg) or building a `WHERE col = NULL` re-select (mysql).
|
|
32
|
+
- `fix`: `findManyCursor()` returns `nextCursor: null` (not `undefined`) when `select` omits `cursorField` from the returned rows, matching its declared `string | number | null` return type.
|
|
33
|
+
- `feat`: `upsert()` — `ON CONFLICT ... DO UPDATE` (pg) / `ON DUPLICATE KEY UPDATE` (mysql).
|
|
34
|
+
- `feat`: `findManyCursor()` — keyset/cursor pagination (`WHERE cursorField > cursor` + `LIMIT limit+1`, no `OFFSET`).
|
|
35
|
+
- `feat`: `closeDb`, `closeAllDbClients`, `resetDbClients` for connection pool lifecycle management.
|
|
36
|
+
- `feat`: configurable query timeout (`queryTimeout`) for `initDb` and the MySQL client.
|
|
37
|
+
- Identifier sanitization added across the query builder (`assertValidIdentifier`, `assertSafeSqlFragment`) to prevent injection via table/column/field names, now covering every code path.
|
|
38
|
+
- `insert`/`insertMany` now quote every column name for pg/mysql instead of a single hardcoded special case — fixes reserved-word columns (`order`, `group`, `user`, etc.). Surface-level SQL output change, runtime-equivalent.
|
|
39
|
+
- `docs/` and `README.md` audited against the real implementation and corrected (removed a phantom `having` param on `joins()`, fixed `update`/`updateMany` examples that used an unsupported `{operator, value}` shape, fixed the `JOINS` type definition, added docs for `upsert`, `findManyCursor`, and the connection-pool lifecycle functions).
|
|
40
|
+
- CI/CD split into `ci.yml` (lint/format/type-check/build/test on push+PR) and `release.yml` (tag-triggered, npm Trusted Publishing via OIDC, no `NPM_TOKEN`).
|
|
41
|
+
- Dependency cleanup: removed unused `@typescript-eslint/eslint-plugin`/`parser`; safe in-range updates to `mysql2`, `pg`, `eslint`, `typescript`, and others.
|
|
42
|
+
- Published npm package restricted to `dist`, `bin`, `.claude`, `CHANGELOG.md` via an explicit `files` allowlist — previously shipped `coverage/`, test sources, `.github/`, and other dev-only files due to a missing `files` field combined with a near-empty `.npmignore`.
|
|
30
43
|
|
|
31
|
-
|
|
44
|
+
## [1.3.0] - 2025-09-08
|
|
32
45
|
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
36
|
-
-
|
|
37
|
-
-
|
|
46
|
+
- `insertMany`/`updateMany` batch operations added to the query builder.
|
|
47
|
+
- `rawQuery` added with documentation.
|
|
48
|
+
- `beginTransaction`/commit/rollback test coverage added for both MySQL and PostgreSQL clients.
|
|
49
|
+
- Pre-commit hook updated to run type-checking, then tests.
|
|
50
|
+
- README rewritten: clearer title/description, install instructions, usage examples, table of contents, method docs links.
|
|
51
|
+
- Outdated `genericRepository`/`utils` tests removed as part of a broader cleanup.
|
|
52
|
+
- Dependency bump: `braces` 3.0.2 → 3.0.3 (#9).
|
|
53
|
+
- Removed unused `.eslintignore`/`.eslintrc.json` (#18).
|
|
38
54
|
|
|
39
|
-
|
|
55
|
+
## [1.0.38] - 2025-06-12
|
|
40
56
|
|
|
41
|
-
-
|
|
42
|
-
- **Practical Examples**: Practical usage examples
|
|
43
|
-
- **Advanced Use Cases**: Advanced use cases
|
|
44
|
-
- **Monitoring Guide**: Monitoring and logging guide
|
|
45
|
-
- **Installation Guide**: Installation and configuration guide
|
|
57
|
+
- Removed an unnecessary local dependency link to `@starbemtech/star-db-query-builder` left over from local development.
|
|
46
58
|
|
|
47
|
-
## [
|
|
59
|
+
## [1.0.37] - 2025-04-23
|
|
60
|
+
|
|
61
|
+
- `pgClient`: `installUnaccentExtension` is now conditional instead of always running.
|
|
62
|
+
- `initDb`/`getDbClient`: optional `name` parameter to target a specific database client instance.
|
|
63
|
+
|
|
64
|
+
## [1.0.34] - 2025-03-26
|
|
65
|
+
|
|
66
|
+
- New `monitor` module exported from the package entrypoint for observability (connection/query/transaction events).
|
|
67
|
+
|
|
68
|
+
## [1.0.33] - 2025-03-11
|
|
69
|
+
|
|
70
|
+
- `OperatorCondition`: added `ILIKE`, `IS NULL` / `IS NOT NULL`, and `NOT EXISTS` operators; `createWhereClause` updated to handle each correctly.
|
|
71
|
+
- `initDb` made asynchronous to support async setup operations.
|
|
72
|
+
- `pgClient`: ensures the `unaccent` extension is installed when requested.
|
|
73
|
+
- `findMany`/`joins`: added `unaccent` support via `QueryParams`.
|
|
74
|
+
- `deleteMany` added — delete multiple records by a list of IDs.
|
|
75
|
+
- `insert`: reserved-word column names are wrapped in double quotes for PostgreSQL.
|
|
76
|
+
- Multi-connection support for MySQL and PostgreSQL, automatic retry mechanism for transient errors, externally configurable connection pool/retry settings, and monitoring/logging events.
|
|
77
|
+
- Dependency bumps: `@types/pg` → 8.11.11, `typescript` → 5.8.2, `mysql2` → 3.13.0, `pg` → 8.13.3, `uuid` → 11.1.0; added `@types/promise-retry`.
|
|
78
|
+
|
|
79
|
+
## [1.0.23] - 2024-07-18
|
|
80
|
+
|
|
81
|
+
- Version bump only, no functional change since 1.0.22.
|
|
82
|
+
|
|
83
|
+
## [1.0.22] - 2024-07-04
|
|
84
|
+
|
|
85
|
+
- `joins`: added `orderBy` and `groupBy` support.
|
|
86
|
+
- `findMany`/`joins`: added `offset` support for pagination.
|
|
87
|
+
- Fixed a Postgres-specific bug in the WHERE-clause utility.
|
|
88
|
+
- Fixed `RETURNING` clause behavior on `update`.
|
|
89
|
+
- `package.json`: raised the minimum Node version requirement to `>=18`; removed the pinned `pnpm` version constraint from `engines` for flexibility; removed the unused commit-message linter package.
|
|
90
|
+
|
|
91
|
+
## [1.0.14] - 2024-04-11
|
|
48
92
|
|
|
49
|
-
|
|
93
|
+
- Added `joins` query support with an updated interface and query fixes.
|
|
50
94
|
|
|
51
|
-
|
|
95
|
+
## [1.0.13] - 2024-04-05
|
|
52
96
|
|
|
53
|
-
-
|
|
54
|
-
-
|
|
55
|
-
- **Query Caching**: Query caching system
|
|
56
|
-
- **Connection Health Checks**: Connection health checks
|
|
57
|
-
- **Performance Metrics**: Detailed performance metrics
|
|
58
|
-
- **Migration Tools**: Data migration tools
|
|
59
|
-
- **Schema Validation**: Schema validation
|
|
60
|
-
- **GraphQL Integration**: GraphQL integration
|
|
97
|
+
- Added a query to fetch by user subscription.
|
|
98
|
+
- Type declarations introduced; return type adjustments.
|
|
61
99
|
|
|
62
|
-
|
|
100
|
+
## [1.0.11] - 2024-04-02
|
|
63
101
|
|
|
64
|
-
-
|
|
65
|
-
- **Query Optimization**: Additional query optimizations
|
|
66
|
-
- **Memory Management**: Better memory management
|
|
67
|
-
- **Connection Pool Tuning**: Automatic connection pool tuning
|
|
102
|
+
- Initial tagged release: core query methods, MySQL function support, `createWhereClause`, and initial type definitions.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Starbem
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|