@syncular/typegen 0.15.44 → 0.15.45
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 +6 -5
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/ir.d.ts +1 -1
- package/dist/ir.js +1 -1
- package/dist/lower.js +1 -1
- package/dist/manifest.js +1 -1
- package/dist/naming.d.ts +1 -1
- package/dist/naming.js +2 -2
- package/dist/query-ir.d.ts +1 -1
- package/dist/sql.js +3 -3
- package/package.json +3 -3
- package/src/index.ts +1 -1
- package/src/ir.ts +2 -2
- package/src/lower.ts +1 -1
- package/src/manifest.ts +1 -1
- package/src/naming.ts +2 -2
- package/src/query-ir.ts +1 -1
- package/src/sql.ts +3 -3
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# @syncular/typegen
|
|
2
2
|
|
|
3
3
|
SQL migrations + one manifest → neutral schema IR (JSON) → generated TS
|
|
4
|
-
module
|
|
4
|
+
module. This file is the authoritative contract for the three
|
|
5
5
|
tool-level formats: the manifest, the IR, and the SQL subset. Wire-protocol
|
|
6
6
|
semantics (column types, scope patterns, schema-version gating) live in
|
|
7
7
|
[`../../docs/SPEC.md`](../../docs/SPEC.md) §2.4, §3.1, §1.5 — this document never
|
|
@@ -374,8 +374,9 @@ The emitted `*.generated.ts` module:
|
|
|
374
374
|
(requested scopes), plus an `SParams` interface when the template has
|
|
375
375
|
`{param}` placeholders.
|
|
376
376
|
|
|
377
|
-
**Lint/freshness split**: `*.generated.ts` is excluded from
|
|
378
|
-
`
|
|
377
|
+
**Lint/freshness split**: `*.generated.ts` is excluded from oxlint and oxfmt
|
|
378
|
+
(see `.oxlintrc.json` / `.oxfmtrc.json`) — hand-format rules on machine
|
|
379
|
+
output only create churn.
|
|
379
380
|
Freshness and migration-history integrity are enforced instead by `syncular
|
|
380
381
|
generate --check`, which is byte-exact and refuses locked-history drift; the
|
|
381
382
|
generated fixture is still typechecked by `tsc` and exercised by tests.
|
|
@@ -450,8 +451,8 @@ revision-1 structured frontend: authoritative typed inputs, explicit
|
|
|
450
451
|
`when(...)` conjuncts, atomic optional groups, imported hygienic predicates,
|
|
451
452
|
inferred scope dependencies, explicit sync coverage, complete sort profiles,
|
|
452
453
|
bounded limits, and inferred identity. Its complete normative definition is
|
|
453
|
-
[`../../docs/SYQL.md`](../../docs/SYQL.md)
|
|
454
|
-
|
|
454
|
+
[`../../docs/SYQL.md`](../../docs/SYQL.md). Both frontends produce the same
|
|
455
|
+
deterministic QueryIR consumed by every language emitter.
|
|
455
456
|
|
|
456
457
|
Tooling: `syncular generate --print <name>` prints every selected checked
|
|
457
458
|
statement and bind, `syncular fmt` is the semantic-preserving canonical
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @syncular/typegen — SQL migrations + syncular.json → neutral schema
|
|
3
|
-
* IR (JSON) → generated TS module
|
|
3
|
+
* IR (JSON) → generated TS module. Dependency-free; the CLI
|
|
4
4
|
* lives in `src/cli.ts` (bin `syncular`).
|
|
5
5
|
*/
|
|
6
6
|
export * from './emit.js';
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @syncular/typegen — SQL migrations + syncular.json → neutral schema
|
|
3
|
-
* IR (JSON) → generated TS module
|
|
3
|
+
* IR (JSON) → generated TS module. Dependency-free; the CLI
|
|
4
4
|
* lives in `src/cli.ts` (bin `syncular`).
|
|
5
5
|
*/
|
|
6
6
|
export * from './emit.js';
|
package/dist/ir.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface IrScope {
|
|
|
27
27
|
* One local secondary index declared by a `CREATE [UNIQUE] INDEX` migration.
|
|
28
28
|
* Applied on BOTH sides: the client materializes it in its local SQLite, and
|
|
29
29
|
* the server creates it on the relational per-app row table
|
|
30
|
-
* (
|
|
30
|
+
* (the server-storage user-index contract; the sync read path
|
|
31
31
|
* itself still uses the scope inverted-index). `columns` preserves declared
|
|
32
32
|
* order (a compound index is order-sensitive). Index order within a table is
|
|
33
33
|
* declaration order.
|
package/dist/ir.js
CHANGED
package/dist/lower.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Projection lowering
|
|
2
|
+
* Projection lowering: rewrite a query's top-level
|
|
3
3
|
* SELECT list so the runtime result keys ARE the language-facing names —
|
|
4
4
|
* `select created_at from todos` lowers to
|
|
5
5
|
* `select created_at as createdAt from todos` under camelCase naming, so
|
package/dist/manifest.js
CHANGED
package/dist/naming.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export declare function snakeToCamel(name: string): string;
|
|
|
8
8
|
* small set that breaks generated FUNCTION/const identifiers). */
|
|
9
9
|
export type NamingTarget = 'ts' | 'swift' | 'kotlin' | 'dart' | 'rust';
|
|
10
10
|
export declare function isRustKeyword(name: string): boolean;
|
|
11
|
-
/** Pinned Rust identifier conversion
|
|
11
|
+
/** Pinned Rust identifier conversion. */
|
|
12
12
|
export declare function rustSnakeCase(name: string): string;
|
|
13
13
|
export declare function rustPascalCase(name: string): string;
|
|
14
14
|
export interface RustNameMapping {
|
package/dist/naming.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The pinned naming-map algorithm
|
|
2
|
+
* The pinned naming-map algorithm: SQL stays
|
|
3
3
|
* snake_case; emitters render their language's convention. The IR carries
|
|
4
4
|
* SQL-truth names plus a derived, collision-checked map — this module is
|
|
5
5
|
* that derivation.
|
|
@@ -259,7 +259,7 @@ const TARGET_KEYWORDS = {
|
|
|
259
259
|
export function isRustKeyword(name) {
|
|
260
260
|
return TARGET_KEYWORDS.rust.has(name);
|
|
261
261
|
}
|
|
262
|
-
/** Pinned Rust identifier conversion
|
|
262
|
+
/** Pinned Rust identifier conversion. */
|
|
263
263
|
export function rustSnakeCase(name) {
|
|
264
264
|
if (!/^_*[A-Za-z][A-Za-z0-9_]*$/.test(name))
|
|
265
265
|
return name;
|
package/dist/query-ir.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QueryIR serialization
|
|
2
|
+
* QueryIR serialization: the frontend-agnostic,
|
|
3
3
|
* deterministic JSON form of analyzed queries. This is the golden-fixture
|
|
4
4
|
* format — equivalent inputs in any frontend (`.sql` today, `.syql` later)
|
|
5
5
|
* must produce byte-identical IR JSON, the same trick the wire protocol
|
package/dist/sql.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SQL migration subset parser
|
|
2
|
+
* SQL migration subset parser.
|
|
3
3
|
*
|
|
4
4
|
* Parses exactly the subset v1-style migrations need:
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - `DROP INDEX [IF EXISTS] name`
|
|
11
11
|
* - `DROP TABLE [IF EXISTS] name`
|
|
12
12
|
* - `CREATE VIRTUAL TABLE name USING fts5(cols…, content=table,
|
|
13
|
-
* [tokenize='allowlisted tokenizer'])` (
|
|
13
|
+
* [tokenize='allowlisted tokenizer'])` (client-local FTS5 projection)
|
|
14
14
|
* - column defs: `name TYPE [PRIMARY KEY] [NOT NULL] [NULL]
|
|
15
15
|
* [DEFAULT literal]`; `ALTER TABLE … ADD COLUMN` is restricted to nullable
|
|
16
16
|
* columns because Syncular does not execute SQL-default backfills
|
|
@@ -337,7 +337,7 @@ const ALLOWED_FTS_TOKENIZERS = new Set([
|
|
|
337
337
|
'trigram',
|
|
338
338
|
]);
|
|
339
339
|
/** Parse the deliberately narrow migration-subset v2 FTS5 form documented in
|
|
340
|
-
*
|
|
340
|
+
* The virtual table is attached to its owning synced
|
|
341
341
|
* table and is not itself a synced table. */
|
|
342
342
|
function parseCreateVirtualTable(cursor, tables, source, options) {
|
|
343
343
|
cursor.expectWord('TABLE', 'after CREATE VIRTUAL');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@syncular/typegen",
|
|
3
|
-
"version": "0.15.
|
|
3
|
+
"version": "0.15.45",
|
|
4
4
|
"description": "Syncular schema-to-TypeScript type generator and the `syncular` CLI",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Benjamin Kniffler",
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
"!dist/**/*.test.d.ts"
|
|
57
57
|
],
|
|
58
58
|
"dependencies": {
|
|
59
|
-
"@syncular/core": "0.15.
|
|
59
|
+
"@syncular/core": "0.15.45"
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@syncular/server": "0.15.
|
|
62
|
+
"@syncular/server": "0.15.45"
|
|
63
63
|
}
|
|
64
64
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @syncular/typegen — SQL migrations + syncular.json → neutral schema
|
|
3
|
-
* IR (JSON) → generated TS module
|
|
3
|
+
* IR (JSON) → generated TS module. Dependency-free; the CLI
|
|
4
4
|
* lives in `src/cli.ts` (bin `syncular`).
|
|
5
5
|
*/
|
|
6
6
|
export * from './emit';
|
package/src/ir.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Neutral schema IR
|
|
2
|
+
* Neutral schema IR.
|
|
3
3
|
*
|
|
4
4
|
* The IR is a versioned, language-neutral JSON document: tables with the
|
|
5
5
|
* SPEC §2.4 column types (+ nullability + primary key), scope patterns
|
|
@@ -53,7 +53,7 @@ export interface IrScope {
|
|
|
53
53
|
* One local secondary index declared by a `CREATE [UNIQUE] INDEX` migration.
|
|
54
54
|
* Applied on BOTH sides: the client materializes it in its local SQLite, and
|
|
55
55
|
* the server creates it on the relational per-app row table
|
|
56
|
-
* (
|
|
56
|
+
* (the server-storage user-index contract; the sync read path
|
|
57
57
|
* itself still uses the scope inverted-index). `columns` preserves declared
|
|
58
58
|
* order (a compound index is order-sensitive). Index order within a table is
|
|
59
59
|
* declaration order.
|
package/src/lower.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Projection lowering
|
|
2
|
+
* Projection lowering: rewrite a query's top-level
|
|
3
3
|
* SELECT list so the runtime result keys ARE the language-facing names —
|
|
4
4
|
* `select created_at from todos` lowers to
|
|
5
5
|
* `select created_at as createdAt from todos` under camelCase naming, so
|
package/src/manifest.ts
CHANGED
package/src/naming.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* The pinned naming-map algorithm
|
|
2
|
+
* The pinned naming-map algorithm: SQL stays
|
|
3
3
|
* snake_case; emitters render their language's convention. The IR carries
|
|
4
4
|
* SQL-truth names plus a derived, collision-checked map — this module is
|
|
5
5
|
* that derivation.
|
|
@@ -270,7 +270,7 @@ export function isRustKeyword(name: string): boolean {
|
|
|
270
270
|
return TARGET_KEYWORDS.rust.has(name);
|
|
271
271
|
}
|
|
272
272
|
|
|
273
|
-
/** Pinned Rust identifier conversion
|
|
273
|
+
/** Pinned Rust identifier conversion. */
|
|
274
274
|
export function rustSnakeCase(name: string): string {
|
|
275
275
|
if (!/^_*[A-Za-z][A-Za-z0-9_]*$/.test(name)) return name;
|
|
276
276
|
const lead = /^_*/.exec(name)?.[0] ?? '';
|
package/src/query-ir.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* QueryIR serialization
|
|
2
|
+
* QueryIR serialization: the frontend-agnostic,
|
|
3
3
|
* deterministic JSON form of analyzed queries. This is the golden-fixture
|
|
4
4
|
* format — equivalent inputs in any frontend (`.sql` today, `.syql` later)
|
|
5
5
|
* must produce byte-identical IR JSON, the same trick the wire protocol
|
package/src/sql.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* SQL migration subset parser
|
|
2
|
+
* SQL migration subset parser.
|
|
3
3
|
*
|
|
4
4
|
* Parses exactly the subset v1-style migrations need:
|
|
5
5
|
*
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - `DROP INDEX [IF EXISTS] name`
|
|
11
11
|
* - `DROP TABLE [IF EXISTS] name`
|
|
12
12
|
* - `CREATE VIRTUAL TABLE name USING fts5(cols…, content=table,
|
|
13
|
-
* [tokenize='allowlisted tokenizer'])` (
|
|
13
|
+
* [tokenize='allowlisted tokenizer'])` (client-local FTS5 projection)
|
|
14
14
|
* - column defs: `name TYPE [PRIMARY KEY] [NOT NULL] [NULL]
|
|
15
15
|
* [DEFAULT literal]`; `ALTER TABLE … ADD COLUMN` is restricted to nullable
|
|
16
16
|
* columns because Syncular does not execute SQL-default backfills
|
|
@@ -434,7 +434,7 @@ const ALLOWED_FTS_TOKENIZERS = new Set([
|
|
|
434
434
|
]);
|
|
435
435
|
|
|
436
436
|
/** Parse the deliberately narrow migration-subset v2 FTS5 form documented in
|
|
437
|
-
*
|
|
437
|
+
* The virtual table is attached to its owning synced
|
|
438
438
|
* table and is not itself a synced table. */
|
|
439
439
|
function parseCreateVirtualTable(
|
|
440
440
|
cursor: Cursor,
|