supalite 0.5.6 → 0.6.1

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/AGENTS.md ADDED
@@ -0,0 +1,39 @@
1
+ # AGENTS
2
+
3
+ Guidance for automated agents working in this repository.
4
+
5
+ ## Repo map (high level)
6
+ - `src/postgres-client.ts`: core client, connection config, transactions, RPC, schema/foreign-key caches.
7
+ - `src/query-builder.ts`: query builder, SQL generation, query execution.
8
+ - `src/types.ts`: public types, schema typing helpers, result shapes.
9
+ - `src/errors.ts`: `PostgresError` wrapper.
10
+ - `src/client.ts`: `SupaliteClient` wrapper over `SupaLitePG`.
11
+ - `src/__tests__`: Jest tests (some use a real Postgres DB).
12
+
13
+ ## Runtime behavior to keep in mind
14
+ - QueryBuilder builds SQL and runs it via `pool.query`. Transaction state is tracked on `SupaLitePG`, but QueryBuilder does not currently switch to the transaction client; only schema metadata queries use the transaction client.
15
+ - JSON/JSONB values are stringified on INSERT/UPDATE when the value is an array/object; native arrays (e.g. `text[]`) are passed through as arrays.
16
+ - BigInt handling is configured via `bigintTransform` using pg type parsers.
17
+ - `count: 'exact'` uses a window function and strips `exact_count` from result rows.
18
+ - `head: true` returns `COUNT(*)` only and `data: []`.
19
+ - `single()` / `maybeSingle()` enforce row count and return Supabase-like errors.
20
+ - `or()` expects `col.op.value` segments and only supports a fixed set of operators.
21
+
22
+ ## Development workflow
23
+ - Build: `npm run build`
24
+ - Test: `npm test` (integration tests need `DB_CONNECTION` or other DB env vars)
25
+ - Lint: `npm run lint`
26
+
27
+ ## Change checklist
28
+ - If you add/modify query behavior:
29
+ - Update `src/query-builder.ts` and relevant types in `src/types.ts`.
30
+ - Add/adjust Jest tests in `src/__tests__` (raw SQL tests are preferred for SQL shape).
31
+ - Update `README.md` and `SPEC.md` to reflect the new behavior.
32
+ - If you add/modify RPC behavior:
33
+ - Update `src/postgres-client.ts` and `src/__tests__/rpc.test.ts`.
34
+ - If you touch JSON/BigInt behavior:
35
+ - Update conversion rules and document in `SPEC.md`.
36
+
37
+ ## Safe defaults
38
+ - Prefer explicit, deterministic SQL generation (avoid relying on implicit column order).
39
+ - Keep new docs and examples ASCII unless the file already uses Unicode.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,32 @@
1
1
  # Changelog
2
2
 
3
- ## [0.5.6] - 2025-12-17
3
+ ## [0.6.1] - 2026-01-16
4
+
5
+ ### ✨ Added
6
+ - `count: 'planned' | 'estimated'`가 `EXPLAIN (FORMAT JSON)` 기반 추정치를 반환하도록 추가했습니다.
7
+
8
+ ### 🐞 Fixed
9
+ - 트랜잭션 내 쿼리가 트랜잭션 클라이언트로 실행되도록 수정했습니다.
10
+ - `in()`에 `null`이 포함될 때 `IS NULL`을 포함하도록 개선했습니다.
11
+
12
+ ## [0.6.0] - 2026-01-16
13
+
14
+ ### ✨ Added
15
+ - PostgREST-style embed에 중첩 관계, `!inner`, 관계 테이블 필터(`table.column`) 지원을 추가했습니다.
16
+ - `insert()`에 `onConflict`/`ignoreDuplicates` 옵션을 추가했습니다. (`ON CONFLICT DO NOTHING`)
17
+ - `upsert()`에 `ignoreDuplicates` 옵션을 추가했습니다. (`ON CONFLICT DO NOTHING`)
18
+ - `or()`에서 `now()`를 `NOW()`로 인라인 처리합니다.
19
+ - README 영어화 및 `README.ko.md` 추가.
20
+ - `or()`에 따옴표 값 파싱을 추가해 `,`/`.` 포함 값을 안전하게 처리합니다.
21
+
22
+ ### 🐞 Fixed
23
+ - `single()`/`maybeSingle()`/RPC 내부 PGRST 에러에 `error.code`를 채워 분기 처리를 안정화했습니다.
24
+ - RPC가 빈 결과에서 `data: []`를 반환하고, 스칼라 언랩은 스칼라 반환 함수에만 적용합니다.
25
+
26
+ ## [0.5.7] - 2026-01-14
27
+
28
+ ### ✨ Added
29
+ - `upsert()`에 `onConflict` 다중 컬럼 지정 지원을 추가했습니다. 이제 콤마 구분 문자열 또는 문자열 배열을 사용할 수 있습니다. (예: `'set_id, name'`, `['set_id', 'name']`)
4
30
 
5
31
  ### 🐞 Fixed
6
32
  - `select()`의 PostgREST-style embed(`related_table(*)`)가 **양방향 FK**를 지원하도록 개선했습니다. 이제 1:N 관계는 배열(`[]` 기본값), N:1 관계는 객체(또는 `null`)로 반환합니다. (See [docs/changelog/2025-12-17-embed-many-to-one.md](docs/changelog/2025-12-17-embed-many-to-one.md))