@syncular/typegen 0.5.1 → 0.6.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/README.md +75 -33
- package/dist/cli.js +43 -17
- package/dist/emit-queries-dart.js +167 -55
- package/dist/emit-queries-kotlin.js +166 -55
- package/dist/emit-queries-swift.js +182 -57
- package/dist/emit-queries.js +289 -123
- package/dist/fmt.d.ts +2 -2
- package/dist/fmt.js +323 -316
- package/dist/generate.d.ts +1 -1
- package/dist/generate.js +28 -9
- package/dist/index.d.ts +3 -1
- package/dist/index.js +3 -1
- package/dist/lsp.d.ts +1 -3
- package/dist/lsp.js +359 -185
- package/dist/manifest.d.ts +1 -3
- package/dist/manifest.js +1 -1
- package/dist/query-ir.js +53 -42
- package/dist/query.d.ts +115 -63
- package/dist/query.js +60 -11
- package/dist/syql-lexer.d.ts +2 -0
- package/dist/syql-lexer.js +9 -2
- package/dist/syql-lowering.d.ts +22 -0
- package/dist/syql-lowering.js +411 -0
- package/dist/syql-semantics.d.ts +76 -0
- package/dist/syql-semantics.js +551 -0
- package/dist/syql-validator.d.ts +35 -0
- package/dist/syql-validator.js +966 -0
- package/package.json +3 -3
- package/src/cli.ts +51 -21
- package/src/emit-queries-dart.ts +195 -69
- package/src/emit-queries-kotlin.ts +197 -69
- package/src/emit-queries-swift.ts +224 -68
- package/src/emit-queries.ts +413 -165
- package/src/fmt.ts +377 -303
- package/src/generate.ts +43 -9
- package/src/index.ts +3 -1
- package/src/lsp.ts +425 -215
- package/src/manifest.ts +2 -4
- package/src/query-ir.ts +52 -42
- package/src/query.ts +199 -79
- package/src/syql-lexer.ts +12 -1
- package/src/syql-lowering.ts +638 -0
- package/src/syql-semantics.ts +859 -0
- package/src/syql-validator.ts +1492 -0
- package/dist/syql.d.ts +0 -102
- package/dist/syql.js +0 -1141
- package/src/syql.ts +0 -1470
package/dist/syql.d.ts
DELETED
|
@@ -1,102 +0,0 @@
|
|
|
1
|
-
import type { IrDocument } from './ir.js';
|
|
2
|
-
import { type AnalyzedQuery, type QueryDb, type QueryNamingOptions } from './query.js';
|
|
3
|
-
export interface SyqlParamDecl {
|
|
4
|
-
readonly name: string;
|
|
5
|
-
readonly optional: boolean;
|
|
6
|
-
/** `from+to?` pairing: both params share the group key. */
|
|
7
|
-
readonly group?: string;
|
|
8
|
-
/** `name?: flag` — a boolean guard param (§3). */
|
|
9
|
-
readonly flag: boolean;
|
|
10
|
-
}
|
|
11
|
-
export interface SyqlOrderBy {
|
|
12
|
-
readonly allowed: readonly string[];
|
|
13
|
-
readonly defaultColumn: string;
|
|
14
|
-
readonly defaultDir: 'asc' | 'desc';
|
|
15
|
-
}
|
|
16
|
-
export interface SyqlLimit {
|
|
17
|
-
readonly max?: number;
|
|
18
|
-
readonly default?: number;
|
|
19
|
-
}
|
|
20
|
-
export interface SyqlDepends {
|
|
21
|
-
readonly table: string;
|
|
22
|
-
readonly variable: string;
|
|
23
|
-
readonly params: readonly string[];
|
|
24
|
-
}
|
|
25
|
-
export interface SyqlWindow {
|
|
26
|
-
readonly table: string;
|
|
27
|
-
readonly variable: string;
|
|
28
|
-
readonly units: readonly string[];
|
|
29
|
-
readonly fixedScopes: readonly {
|
|
30
|
-
readonly variable: string;
|
|
31
|
-
readonly param: string;
|
|
32
|
-
}[];
|
|
33
|
-
}
|
|
34
|
-
export interface SyqlFragmentDecl {
|
|
35
|
-
readonly name: string;
|
|
36
|
-
readonly params: readonly SyqlParamDecl[];
|
|
37
|
-
/** The predicate body (raw SQL expression text). */
|
|
38
|
-
readonly body: string;
|
|
39
|
-
/** Source offset of the `fragment` keyword (editor tooling). */
|
|
40
|
-
readonly offset: number;
|
|
41
|
-
}
|
|
42
|
-
export interface SyqlQueryDecl {
|
|
43
|
-
readonly name: string;
|
|
44
|
-
readonly params: readonly SyqlParamDecl[];
|
|
45
|
-
readonly orderBy?: SyqlOrderBy;
|
|
46
|
-
readonly limit?: SyqlLimit;
|
|
47
|
-
/** §7 opt-in: lower to 2^N enumerated statements (perfect index use)
|
|
48
|
-
* instead of one neutralized statement. API-invisible. */
|
|
49
|
-
readonly variants?: boolean;
|
|
50
|
-
/** Checked escape hatches for SQL shapes the conservative analyzer cannot
|
|
51
|
-
* prove. They live with the query, never in React application code. */
|
|
52
|
-
readonly depends?: readonly SyqlDepends[];
|
|
53
|
-
readonly windows?: readonly SyqlWindow[];
|
|
54
|
-
readonly keyBy?: readonly string[];
|
|
55
|
-
/** The SQL-shaped body (may contain @fragment refs and if-guards). */
|
|
56
|
-
readonly body: string;
|
|
57
|
-
/** Source offset of the `query` keyword (editor tooling). */
|
|
58
|
-
readonly offset: number;
|
|
59
|
-
}
|
|
60
|
-
export interface SyqlFile {
|
|
61
|
-
readonly fragments: readonly SyqlFragmentDecl[];
|
|
62
|
-
readonly queries: readonly SyqlQueryDecl[];
|
|
63
|
-
}
|
|
64
|
-
/** Parse one `.syql` file into its declarations (no lowering yet). */
|
|
65
|
-
export declare function parseSyqlFile(file: string, content: string): SyqlFile;
|
|
66
|
-
interface ParamInfo {
|
|
67
|
-
optional: boolean;
|
|
68
|
-
group?: string;
|
|
69
|
-
flag: boolean;
|
|
70
|
-
declared: boolean;
|
|
71
|
-
}
|
|
72
|
-
/** One top-level WHERE conjunct after guard analysis: `governing` is the
|
|
73
|
-
* set of OPTIONAL param names gating it (empty = required conjunct). */
|
|
74
|
-
export interface LoweredConjunct {
|
|
75
|
-
readonly pred: string;
|
|
76
|
-
readonly governing: readonly string[];
|
|
77
|
-
}
|
|
78
|
-
export interface LoweredSyqlQuery {
|
|
79
|
-
/** The lowered single SQL statement (named params, no knob tails). */
|
|
80
|
-
readonly sql: string;
|
|
81
|
-
/** Params discovered/declared, in signature-then-first-use order. */
|
|
82
|
-
readonly paramInfo: ReadonlyMap<string, ParamInfo>;
|
|
83
|
-
/** Statement text before the `where` keyword (whole statement when there
|
|
84
|
-
* is no WHERE). */
|
|
85
|
-
readonly prefix: string;
|
|
86
|
-
/** Statement text after the WHERE clause (may be empty). */
|
|
87
|
-
readonly suffix: string;
|
|
88
|
-
/** The structured conjuncts (empty when there is no WHERE) — the §7
|
|
89
|
-
* variant backend re-assembles per provided-combination from these. */
|
|
90
|
-
readonly conjuncts: readonly LoweredConjunct[];
|
|
91
|
-
}
|
|
92
|
-
/**
|
|
93
|
-
* Lower one query body: splice fragments, auto-guard optional conjuncts,
|
|
94
|
-
* expand `if` guards, enforce B1. Returns plain SQL (knob tails are the
|
|
95
|
-
* caller's job).
|
|
96
|
-
*/
|
|
97
|
-
export declare function lowerSyqlBody(decl: SyqlQueryDecl, fragments: ReadonlyMap<string, SyqlFragmentDecl>, location: string): LoweredSyqlQuery;
|
|
98
|
-
/** Analyze every query of one `.syql` file into `AnalyzedQuery` units —
|
|
99
|
-
* byte-compatible with the `.sql` frontend's output (§1: nothing below the
|
|
100
|
-
* IR knows the frontend). */
|
|
101
|
-
export declare function analyzeSyqlFile(relPath: string, content: string, ir: IrDocument, db: QueryDb, naming?: QueryNamingOptions): AnalyzedQuery[];
|
|
102
|
-
export {};
|