supalite 0.7.0 → 0.7.2
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/CHANGELOG.md +18 -0
- package/README.ko.md +14 -9
- package/README.md +14 -9
- package/SPEC.md +5 -1
- package/dist/cli.js +65 -10
- package/dist/gen-types.d.ts +5 -0
- package/dist/gen-types.js +1000 -236
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## [0.7.2] - 2026-01-17
|
|
4
|
+
|
|
5
|
+
### ✨ Added
|
|
6
|
+
- `--no-bigint` 옵션을 추가해 BIGINT를 `number`로 출력할 수 있습니다.
|
|
7
|
+
|
|
8
|
+
### 🐞 Fixed
|
|
9
|
+
- `js-yaml` 의존성을 보안 패치 버전으로 업데이트했습니다. (prototype pollution 대응)
|
|
10
|
+
|
|
11
|
+
## [0.7.1] - 2026-01-17
|
|
12
|
+
|
|
13
|
+
### ✨ Added
|
|
14
|
+
- `supalite gen types` 기본 출력이 Supabase CLI 포맷과 최대한 동일하도록 정렬/포맷/헬퍼 타입/Constants를 추가했습니다.
|
|
15
|
+
- `--format supabase|supalite`, `--bigint-type`, `--json-bigint` 옵션을 추가했습니다.
|
|
16
|
+
- Supabase 포맷에서 insertable view에 `Insert`/`Update`를 포함하고, 함수 오버로드 출력 형태를 Supabase와 맞췄습니다.
|
|
17
|
+
|
|
18
|
+
### 🔧 Changed
|
|
19
|
+
- Supabase 포맷 기본값 기준으로 관계/복합 타입/함수 시그니처가 기본 포함됩니다. (legacy 출력은 `--format supalite`)
|
|
20
|
+
|
|
3
21
|
## [0.7.0] - 2026-01-17
|
|
4
22
|
|
|
5
23
|
### ✨ Added
|
package/README.ko.md
CHANGED
|
@@ -57,7 +57,7 @@ ORM 기능(관계 모델링/중첩 쓰기 등)이 꼭 필요하면 Prisma/Drizzl
|
|
|
57
57
|
|
|
58
58
|
`supabase db pull`에 대해서: 이는 ORM 기능이 아니라 마이그레이션/스키마 동기화 단계입니다. SupaLite 내부에 구현하기보다 “권장 워크플로우”로 문서화하고, 필요하다면 `pg-schema-sync` + 타입 생성기를 묶는 간단한 CLI 래퍼가 현실적입니다.
|
|
59
59
|
|
|
60
|
-
SupaLite
|
|
60
|
+
SupaLite는 `supalite gen types`를 포함하며, 기본 출력은 SupaLite 포맷(Supabase CLI 출력의 상위 집합)입니다. Supabase CLI와 1:1로 맞추려면 `--format supabase`를 사용하세요.
|
|
61
61
|
|
|
62
62
|
## SupaLite vs Prisma / Drizzle
|
|
63
63
|
|
|
@@ -129,7 +129,7 @@ const data = await db
|
|
|
129
129
|
- Node/pg 버전별 CI 매트릭스와 통합 테스트
|
|
130
130
|
- 벤치마크 및 성능 가이드
|
|
131
131
|
- Auth/Storage/Realtime 마이그레이션 가이드 (Cognito/GIP, S3/GCS, Realtime 대안)
|
|
132
|
-
- `supalite gen types` (
|
|
132
|
+
- `supalite gen types` (SupaLite 중심 타입 생성기, Supabase 포맷 옵션 제공)
|
|
133
133
|
- 기여 가이드/이슈 템플릿
|
|
134
134
|
|
|
135
135
|
## 성능 노트 (서버리스 Supabase vs 클라우드 Postgres)
|
|
@@ -254,14 +254,19 @@ npx supalite gen types --db-url "postgresql://user:pass@localhost:5432/db" --sch
|
|
|
254
254
|
```
|
|
255
255
|
|
|
256
256
|
- `--out -`는 stdout으로 출력합니다.
|
|
257
|
-
-
|
|
257
|
+
- 기본 출력은 SupaLite 포맷(= Supabase CLI의 상위 집합)입니다. Supabase CLI와 1:1로 맞추려면 `--format supabase`를 사용하세요.
|
|
258
|
+
- SupaLite 포맷은 `Constraints`/`Indexes`, `Relationships`의 `referencedSchema`, `bigint` + `Json` bigint 지원, setof RPC용 `SetofOptions`를 추가로 포함합니다.
|
|
259
|
+
- BIGINT 컬럼 타입은 `--bigint-type bigint|number|string`로 제어합니다. (기본: supabase=number, supalite=bigint)
|
|
260
|
+
- `--no-bigint`는 `--bigint-type number`의 간편 옵션입니다.
|
|
261
|
+
- `--json-bigint`는 `Json` 타입에 `bigint`를 포함합니다. (기본: supabase=false, supalite=true)
|
|
262
|
+
- `--no-json-bigint`는 `Json` 타입에서 `bigint`를 제외합니다.
|
|
258
263
|
- `--date-as-date`는 `date`/`timestamp` 컬럼을 `Date`로 생성합니다.
|
|
259
|
-
- `--include-relationships`는 FK 메타데이터를 `Relationships`에 포함합니다.
|
|
260
|
-
- `--include-constraints`는 PK/UNIQUE/CHECK/FK 메타데이터를 포함합니다.
|
|
261
|
-
- `--include-indexes`는 인덱스 메타데이터(이름/유니크/정의)를 포함합니다.
|
|
262
|
-
- `--include-composite-types`는 `CompositeTypes` 정의를 포함합니다.
|
|
263
|
-
- `--include-function-signatures`는 `Functions.Args/Returns`를 스키마 메타데이터로 매핑합니다.
|
|
264
|
-
- `Functions`에는 감지된 함수명이 기본 포함되며,
|
|
264
|
+
- `--include-relationships`는 FK 메타데이터를 `Relationships`에 포함합니다. (기본: true)
|
|
265
|
+
- `--include-constraints`는 PK/UNIQUE/CHECK/FK 메타데이터를 포함합니다. (기본: supabase=false, supalite=true)
|
|
266
|
+
- `--include-indexes`는 인덱스 메타데이터(이름/유니크/정의)를 포함합니다. (기본: supabase=false, supalite=true)
|
|
267
|
+
- `--include-composite-types`는 `CompositeTypes` 정의를 포함합니다. (기본: true)
|
|
268
|
+
- `--include-function-signatures`는 `Functions.Args/Returns`를 스키마 메타데이터로 매핑합니다. (기본: true)
|
|
269
|
+
- `Functions`에는 감지된 함수명이 기본 포함되며, 시그니처도 기본 포함됩니다.
|
|
265
270
|
- `--type-case`는 enum/composite 타입 키의 케이스를 제어합니다 (`preserve` | `snake` | `camel` | `pascal`)
|
|
266
271
|
- `--function-case`는 함수 키의 케이스를 제어합니다 (`preserve` | `snake` | `camel` | `pascal`)
|
|
267
272
|
- `--dump-functions-sql [path]`는 `pg_get_functiondef` 기반의 `CREATE FUNCTION/PROCEDURE` 정의를 로컬 파일로 저장합니다.
|
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ ORM features (relations, nested writes, etc.) are best handled by Prisma/Drizzle
|
|
|
58
58
|
|
|
59
59
|
About `supabase db pull`: it is a schema/migration sync step, not an ORM feature. Rather than implementing it inside SupaLite, we recommend documenting the workflow and optionally providing a lightweight CLI wrapper that combines `pg-schema-sync` + type generation.
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
SupaLite now includes `supalite gen types`, which defaults to the SupaLite format (a superset of Supabase CLI output). Use `--format supabase` for byte-for-byte Supabase CLI output.
|
|
62
62
|
|
|
63
63
|
## SupaLite vs Prisma / Drizzle
|
|
64
64
|
|
|
@@ -130,7 +130,7 @@ const data = await db
|
|
|
130
130
|
- CI matrix for Node/pg versions with integration tests
|
|
131
131
|
- Benchmarks and performance guidance
|
|
132
132
|
- Auth/Storage/Realtime migration guidance (Cognito/GIP, S3/GCS, Realtime options)
|
|
133
|
-
- `supalite gen types` (Supabase-compatible
|
|
133
|
+
- `supalite gen types` (SupaLite-first generator with Supabase-compatible output)
|
|
134
134
|
- Contribution guide and issue templates
|
|
135
135
|
|
|
136
136
|
## Performance notes (serverless Supabase vs cloud Postgres)
|
|
@@ -255,14 +255,19 @@ npx supalite gen types --db-url "postgresql://user:pass@localhost:5432/db" --sch
|
|
|
255
255
|
```
|
|
256
256
|
|
|
257
257
|
- `--out -` prints to stdout
|
|
258
|
-
-
|
|
258
|
+
- Default output is SupaLite format (superset of Supabase CLI). Use `--format supabase` for byte-for-byte Supabase CLI output.
|
|
259
|
+
- SupaLite format also includes `Constraints`/`Indexes`, `referencedSchema` in `Relationships`, `bigint` + `Json` bigint support, and `SetofOptions` for setof RPCs.
|
|
260
|
+
- BIGINT type mapping is controlled by `--bigint-type bigint|number|string` (default: supabase=number, supalite=bigint)
|
|
261
|
+
- `--no-bigint` is a shortcut for `--bigint-type number`
|
|
262
|
+
- `--json-bigint` includes `bigint` in the `Json` union (default: supabase=false, supalite=true)
|
|
263
|
+
- `--no-json-bigint` disables bigint in the `Json` union
|
|
259
264
|
- `--date-as-date` maps `date`/`timestamp` columns to `Date`
|
|
260
|
-
- `--include-relationships` emits foreign-key metadata into `Relationships`
|
|
261
|
-
- `--include-constraints` emits primary/unique/check/foreign key metadata
|
|
262
|
-
- `--include-indexes` emits index metadata (name, uniqueness, definition)
|
|
263
|
-
- `--include-composite-types` emits `CompositeTypes` definitions
|
|
264
|
-
- `--include-function-signatures` maps `Functions.Args/Returns` from schema metadata
|
|
265
|
-
- `Functions` always lists detected function names;
|
|
265
|
+
- `--include-relationships` emits foreign-key metadata into `Relationships` (default: true)
|
|
266
|
+
- `--include-constraints` emits primary/unique/check/foreign key metadata (default: supabase=false, supalite=true)
|
|
267
|
+
- `--include-indexes` emits index metadata (name, uniqueness, definition) (default: supabase=false, supalite=true)
|
|
268
|
+
- `--include-composite-types` emits `CompositeTypes` definitions (default: true)
|
|
269
|
+
- `--include-function-signatures` maps `Functions.Args/Returns` from schema metadata (default: true)
|
|
270
|
+
- `Functions` always lists detected function names; signatures are included by default
|
|
266
271
|
- `--type-case` controls enum/composite type key casing (`preserve` | `snake` | `camel` | `pascal`)
|
|
267
272
|
- `--function-case` controls function key casing (`preserve` | `snake` | `camel` | `pascal`)
|
|
268
273
|
- `--dump-functions-sql [path]` writes `CREATE FUNCTION/PROCEDURE` definitions (from `pg_get_functiondef`) to a local file
|
package/SPEC.md
CHANGED
|
@@ -155,7 +155,11 @@ Notes:
|
|
|
155
155
|
- `supalite gen types --db-url <postgres_url> [--schema public,analytics] [--out supalite.types.ts]`
|
|
156
156
|
- Reads schema metadata from `information_schema` and `pg_catalog`.
|
|
157
157
|
- Emits `Json` and a `Database` type with `Tables`, `Views`, `Functions`, `Enums`, and `CompositeTypes`.
|
|
158
|
-
-
|
|
158
|
+
- `--format supalite|supabase` (default: supalite).
|
|
159
|
+
- `--format supabase` matches Supabase CLI output (including formatting).
|
|
160
|
+
- SupaLite format is a superset of Supabase: `Constraints`/`Indexes`, `referencedSchema` in `Relationships`, `bigint` defaults, `Json` bigint, and `SetofOptions` for setof RPCs.
|
|
161
|
+
- `BIGINT` maps to `bigint` by default (`--format supabase` defaults to `number`); `--no-bigint` is a shorthand for `--bigint-type number`.
|
|
162
|
+
- `json/jsonb` map to `Json` with optional `bigint` (`--json-bigint` default: supalite=true, supabase=false; disable via `--no-json-bigint`).
|
|
159
163
|
- `--date-as-date` maps `date`/`timestamp` columns to `Date`.
|
|
160
164
|
- `--include-relationships` emits FK metadata in `Relationships`.
|
|
161
165
|
- `--include-constraints` emits PK/UNIQUE/CHECK/FK metadata per table.
|
package/dist/cli.js
CHANGED
|
@@ -11,6 +11,11 @@ const printUsage = () => {
|
|
|
11
11
|
--db-url <postgres_url> \\
|
|
12
12
|
[--schema public,analytics] \\
|
|
13
13
|
[--out supalite.types.ts] \\
|
|
14
|
+
[--format supabase|supalite] \\
|
|
15
|
+
[--bigint-type bigint|number|string] \\
|
|
16
|
+
[--no-bigint] \\
|
|
17
|
+
[--json-bigint] \\
|
|
18
|
+
[--no-json-bigint] \\
|
|
14
19
|
[--date-as-date] \\
|
|
15
20
|
[--include-relationships] \\
|
|
16
21
|
[--include-constraints] \\
|
|
@@ -24,12 +29,16 @@ const printUsage = () => {
|
|
|
24
29
|
Defaults:
|
|
25
30
|
- schema: public
|
|
26
31
|
- out: supalite.types.ts (use --out - to print to stdout)
|
|
32
|
+
- format: supalite
|
|
27
33
|
- dateAsDate: false
|
|
28
|
-
- includeRelationships:
|
|
29
|
-
- includeConstraints: false
|
|
30
|
-
- includeIndexes: false
|
|
31
|
-
- includeCompositeTypes:
|
|
32
|
-
- includeFunctionSignatures:
|
|
34
|
+
- includeRelationships: true
|
|
35
|
+
- includeConstraints: false (supabase), true (supalite)
|
|
36
|
+
- includeIndexes: false (supabase), true (supalite)
|
|
37
|
+
- includeCompositeTypes: true
|
|
38
|
+
- includeFunctionSignatures: true
|
|
39
|
+
- bigintType: number (supabase), bigint (supalite)
|
|
40
|
+
- noBigint: false
|
|
41
|
+
- jsonBigint: false (supabase), true (supalite)
|
|
33
42
|
- typeCase: preserve
|
|
34
43
|
- functionCase: preserve
|
|
35
44
|
- dumpFunctionsSql: false
|
|
@@ -44,16 +53,37 @@ const parseCase = (value) => {
|
|
|
44
53
|
}
|
|
45
54
|
return undefined;
|
|
46
55
|
};
|
|
56
|
+
const parseFormat = (value) => {
|
|
57
|
+
if (!value) {
|
|
58
|
+
return undefined;
|
|
59
|
+
}
|
|
60
|
+
if (value === 'supabase' || value === 'supalite') {
|
|
61
|
+
return value;
|
|
62
|
+
}
|
|
63
|
+
return undefined;
|
|
64
|
+
};
|
|
65
|
+
const parseBigintType = (value) => {
|
|
66
|
+
if (!value) {
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
if (value === 'bigint' || value === 'number' || value === 'string') {
|
|
70
|
+
return value;
|
|
71
|
+
}
|
|
72
|
+
return undefined;
|
|
73
|
+
};
|
|
47
74
|
const parseArgs = (args) => {
|
|
48
75
|
const result = {
|
|
49
76
|
schemas: [],
|
|
50
77
|
out: 'supalite.types.ts',
|
|
78
|
+
format: undefined,
|
|
79
|
+
bigintType: undefined,
|
|
80
|
+
jsonBigint: undefined,
|
|
51
81
|
dateAsDate: false,
|
|
52
|
-
includeRelationships:
|
|
53
|
-
includeConstraints:
|
|
54
|
-
includeIndexes:
|
|
55
|
-
includeCompositeTypes:
|
|
56
|
-
includeFunctionSignatures:
|
|
82
|
+
includeRelationships: undefined,
|
|
83
|
+
includeConstraints: undefined,
|
|
84
|
+
includeIndexes: undefined,
|
|
85
|
+
includeCompositeTypes: undefined,
|
|
86
|
+
includeFunctionSignatures: undefined,
|
|
57
87
|
dumpFunctionsSql: false,
|
|
58
88
|
help: false,
|
|
59
89
|
};
|
|
@@ -83,6 +113,28 @@ const parseArgs = (args) => {
|
|
|
83
113
|
i += 1;
|
|
84
114
|
continue;
|
|
85
115
|
}
|
|
116
|
+
if (arg === '--format') {
|
|
117
|
+
result.format = parseFormat(args[i + 1]);
|
|
118
|
+
i += 1;
|
|
119
|
+
continue;
|
|
120
|
+
}
|
|
121
|
+
if (arg === '--bigint-type') {
|
|
122
|
+
result.bigintType = parseBigintType(args[i + 1]);
|
|
123
|
+
i += 1;
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (arg === '--no-bigint') {
|
|
127
|
+
result.bigintType = 'number';
|
|
128
|
+
continue;
|
|
129
|
+
}
|
|
130
|
+
if (arg === '--json-bigint') {
|
|
131
|
+
result.jsonBigint = true;
|
|
132
|
+
continue;
|
|
133
|
+
}
|
|
134
|
+
if (arg === '--no-json-bigint') {
|
|
135
|
+
result.jsonBigint = false;
|
|
136
|
+
continue;
|
|
137
|
+
}
|
|
86
138
|
if (arg === '--date-as-date') {
|
|
87
139
|
result.dateAsDate = true;
|
|
88
140
|
continue;
|
|
@@ -150,6 +202,9 @@ const run = async () => {
|
|
|
150
202
|
const output = await (0, gen_types_1.generateTypes)({
|
|
151
203
|
dbUrl,
|
|
152
204
|
schemas,
|
|
205
|
+
format: parsed.format,
|
|
206
|
+
bigintType: parsed.bigintType,
|
|
207
|
+
jsonBigint: parsed.jsonBigint,
|
|
153
208
|
dateAsDate: parsed.dateAsDate,
|
|
154
209
|
includeRelationships: parsed.includeRelationships,
|
|
155
210
|
includeConstraints: parsed.includeConstraints,
|
package/dist/gen-types.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
type NameCase = 'preserve' | 'snake' | 'camel' | 'pascal';
|
|
2
|
+
type OutputFormat = 'supalite' | 'supabase';
|
|
3
|
+
type BigintType = 'bigint' | 'number' | 'string';
|
|
2
4
|
export type GenTypesOptions = {
|
|
3
5
|
dbUrl: string;
|
|
4
6
|
schemas?: string[];
|
|
@@ -10,6 +12,9 @@ export type GenTypesOptions = {
|
|
|
10
12
|
includeFunctionSignatures?: boolean;
|
|
11
13
|
typeCase?: NameCase;
|
|
12
14
|
functionCase?: NameCase;
|
|
15
|
+
format?: OutputFormat;
|
|
16
|
+
bigintType?: BigintType;
|
|
17
|
+
jsonBigint?: boolean;
|
|
13
18
|
};
|
|
14
19
|
export type DumpFunctionsSqlOptions = {
|
|
15
20
|
dbUrl: string;
|