@typed-sql/compiler 1.0.0-rc.0 → 1.0.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.
Files changed (3) hide show
  1. package/CHANGELOG.md +47 -0
  2. package/README.md +12 -37
  3. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,52 @@
1
1
  # @typed-sql/compiler
2
2
 
3
+ ## 1.0.0
4
+
5
+ ### Major Changes
6
+
7
+ - 7ca256b: Release the first public typed-sql beta: exact TypeScript 7 row inference from static PostgreSQL and
8
+ MySQL, versioned schema introspection, application-owned drivers, config-driven grammar plugins,
9
+ CLI verification, editor language-server integration, versioned diagnostics, bounded parsing, and
10
+ real-database plus packed-tarball verification.
11
+
12
+ ### Patch Changes
13
+
14
+ - 1563a7a: Declare and enforce the 1.0 package stability boundary. Core SQL, compiler, schema, config, AST,
15
+ PostgreSQL, MySQL, and CLI packages form the stable train; the TypeScript preview bridge and
16
+ language server remain explicitly experimental. Freeze public entrypoints and query type contracts,
17
+ and remove internal compiler/type helpers from stable package-root exports before 1.0.
18
+ - 16e2475: Prove npm trusted publishing and provenance after the initial registry bootstrap.
19
+ - bd26d6e: Replace potentially expensive parser regular expressions with bounded scanners, tighten editor
20
+ completion matching, and prevent releases while high-severity CodeQL alerts remain open.
21
+ - 69c7d87: Report `TSQ004` for bare nested templates used as conditional SQL structure and offer an alias-aware
22
+ language-server quick fix that prefixes the template with `sql.fragment`. Ordinary and nested
23
+ values remain parameterized across the edit.
24
+ - 3e2c75c: Infer ordered query parameter tuples and let TypeScript reject interpolation values that do not
25
+ match their SQL context. Dialect contract version 2 adds explicit parameter analysis; unresolved
26
+ positions remain `unknown`. Add typed nullable predicate composition through `sql.fragment()`,
27
+ `sql.and()`, `sql.or()`, `sql.where()`, and `sql.append()` while preserving row and parameter tuples.
28
+ Direct append fragments are grammar-analyzed cumulatively against their static base, so TypeScript
29
+ rejects fragment interpolation values that disagree with the referenced database columns.
30
+ Add `sql.empty` and SQL-template-native conditional structural fragments. The compiler analyzes
31
+ complete branch variants, preserves literal boolean-dependent result rows, and type-checks nested
32
+ fragment parameters without adding a query-builder DSL. Bound independent structural expansion at
33
+ 64 variants by default, correlate repeated conditions, merge diagnostics and fragment expectations
34
+ across variants, and fail closed on incompatible contexts. Share indexed catalog and conservative
35
+ parameter-resolution primitives across grammars, harden cooked-template scanning, and add runtime,
36
+ resolver, scanner, and structural performance gates.
37
+ - Updated dependencies [eb16de7]
38
+ - Updated dependencies [b6389e4]
39
+ - Updated dependencies [eb16de7]
40
+ - Updated dependencies [b6389e4]
41
+ - Updated dependencies [eb16de7]
42
+ - Updated dependencies [1563a7a]
43
+ - Updated dependencies [9dd6bc4]
44
+ - Updated dependencies [7ca256b]
45
+ - Updated dependencies [16e2475]
46
+ - Updated dependencies [69c7d87]
47
+ - Updated dependencies [3e2c75c]
48
+ - @typed-sql/core@1.0.0
49
+
3
50
  ## 1.0.0-rc.0
4
51
 
5
52
  ### Patch Changes
package/README.md CHANGED
@@ -1,15 +1,16 @@
1
1
  # @typed-sql/compiler
2
2
 
3
- The dialect-neutral TypeScript source compiler behind [typed-sql](https://github.com/Lojhan/typed-sql).
4
- It finds static SQL templates, asks the configured grammar for row and parameter shapes, injects them into
5
- an in-memory TypeScript program, and preserves source mappings for diagnostics and editor tooling.
3
+ The stable, grammar-neutral TypeScript source compiler behind
4
+ [typed-sql](https://github.com/Lojhan/typed-sql). It finds static SQL templates, asks the configured
5
+ grammar for row and parameter shapes, creates an in-memory TypeScript overlay, and preserves source
6
+ mappings for diagnostics and editor tooling.
6
7
 
7
8
  ```sh
8
- pnpm add @typed-sql/compiler@next
9
+ pnpm add @typed-sql/compiler
9
10
  ```
10
11
 
11
12
  ```ts
12
- import { checkFile, compileSource, extractStaticQueries, mapSqlRange } from "@typed-sql/compiler";
13
+ import { compileSource } from "@typed-sql/compiler";
13
14
  import { postgres } from "@typed-sql/postgres";
14
15
 
15
16
  const result = compileSource({
@@ -19,38 +20,12 @@ const result = compileSource({
19
20
  });
20
21
  ```
21
22
 
22
- `compileSource` does not branch on PostgreSQL, MySQL, package names, or database drivers. It only
23
- consumes the public `DialectPlugin` contract from `@typed-sql/core`. Unsupported, dynamic, invalid,
24
- or ambiguous SQL remains a diagnostic or an `unknown` position—never `any`. The resulting overlay
25
- uses `Query<Row, readonly [Param1, Param2, ...]>`, which lets TypeScript report incorrect `${...}`
26
- values at their original source locations.
23
+ `compileSource` consumes only `DialectPlugin`; it does not branch on a database, grammar package,
24
+ or driver. Its public options include the structural-variant bound used for conditional fragments.
25
+ Application projects normally use the compiler through `typed-sql check` or the language server.
27
26
 
28
- Direct `sql.append(base, ...fragments)` expressions are analyzed cumulatively. The compiler resolves
29
- the statically bound base query, adds each visible `sql.fragment` in source order, and injects the
30
- grammar-derived parameter tuple into that fragment. Composed values are therefore checked against
31
- their referenced columns even when a preceding fragment introduces structure such as
32
- `WHERE 1 = 1`. Indirect function-returned fragments and arbitrary mutable collections remain at the
33
- core runtime's parameter-safe boundary rather than being guessed.
34
-
35
- Structural fragment interpolations inside a complete `sql` template are expanded as correlated,
36
- finite branches. The compiler analyzes each resulting complete SQL statement, emits a conditional
37
- row for generic boolean property selections, and injects expected parameter types into nested
38
- fragments. `sql.empty` represents the absent branch without turning it into a driver parameter.
39
- The expansion is a grammar-neutral intermediate representation: SQL parsing and resolution still
40
- belong exclusively to `DialectPlugin.analyze()`.
41
-
42
- `compileSource` accepts `maxStructuralVariants`, defaulting to 64. The compiler counts independent
43
- conditions and returns `TSQ003` before invoking the grammar when the bound would be exceeded.
44
- Repeated uses of the same condition are correlated and do not multiply the branch count. A shared
45
- fragment that receives incompatible parameter expectations across valid branches fails closed with
46
- `TSQ205`.
47
-
48
- Before grammar analysis, the scanner rejects an untagged template paired with `sql.empty` or a
49
- trusted fragment as `TSQ004`. This produces one focused source diagnostic instead of a downstream
50
- SQL parse error. Ordinary value templates remain parameters; the compiler never interprets their
51
- runtime strings as SQL structure.
52
-
53
- Application projects normally use this through `typed-sql check` or the language server. It is
54
- public for grammar, editor, and build-tool integrations.
27
+ Read [Architecture](https://github.com/Lojhan/typed-sql/blob/main/docs/concepts/architecture.md),
28
+ [Compose conditional SQL](https://github.com/Lojhan/typed-sql/blob/main/docs/guides/composition.md), and
29
+ [Inference and safety](https://github.com/Lojhan/typed-sql/blob/main/docs/concepts/type-safety.md).
55
30
 
56
31
  MIT © typed-sql contributors
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typed-sql/compiler",
3
- "version": "1.0.0-rc.0",
3
+ "version": "1.0.0",
4
4
  "description": "Dialect-neutral TypeScript source extraction and typed SQL compilation.",
5
5
  "license": "MIT",
6
6
  "author": "Lojhan",
@@ -36,7 +36,7 @@
36
36
  ".": "./dist/packages/compiler/src/index.js"
37
37
  },
38
38
  "dependencies": {
39
- "@typed-sql/core": "1.0.0-rc.0"
39
+ "@typed-sql/core": "1.0.0"
40
40
  },
41
41
  "scripts": {
42
42
  "test": "poku test --reporter=compact --enforce",