@memberjunction/sql-dialect 6.2.0-edge.6 → 6.2.0-edge.7

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 (86) hide show
  1. package/README.md +280 -91
  2. package/dist/dialectFactory.d.ts +34 -14
  3. package/dist/dialectFactory.d.ts.map +1 -1
  4. package/dist/dialectFactory.js +101 -25
  5. package/dist/dialectFactory.js.map +1 -1
  6. package/dist/dialects/ansi.d.ts +55 -0
  7. package/dist/dialects/ansi.d.ts.map +1 -0
  8. package/dist/dialects/ansi.js +136 -0
  9. package/dist/dialects/ansi.js.map +1 -0
  10. package/dist/dialects/baseSchemaDDL.d.ts +78 -0
  11. package/dist/dialects/baseSchemaDDL.d.ts.map +1 -0
  12. package/dist/dialects/baseSchemaDDL.js +63 -0
  13. package/dist/dialects/baseSchemaDDL.js.map +1 -0
  14. package/dist/dialects/databricksQueryDialect.d.ts +41 -0
  15. package/dist/dialects/databricksQueryDialect.d.ts.map +1 -0
  16. package/dist/dialects/databricksQueryDialect.js +103 -0
  17. package/dist/dialects/databricksQueryDialect.js.map +1 -0
  18. package/dist/dialects/mysqlQueryDialect.d.ts +46 -0
  19. package/dist/dialects/mysqlQueryDialect.d.ts.map +1 -0
  20. package/dist/dialects/mysqlQueryDialect.js +117 -0
  21. package/dist/dialects/mysqlQueryDialect.js.map +1 -0
  22. package/dist/dialects/oracleQueryDialect.d.ts +42 -0
  23. package/dist/dialects/oracleQueryDialect.d.ts.map +1 -0
  24. package/dist/dialects/oracleQueryDialect.js +92 -0
  25. package/dist/dialects/oracleQueryDialect.js.map +1 -0
  26. package/dist/dialects/postgresqlSchemaDDL.d.ts +112 -0
  27. package/dist/dialects/postgresqlSchemaDDL.d.ts.map +1 -0
  28. package/dist/dialects/postgresqlSchemaDDL.js +590 -0
  29. package/dist/dialects/postgresqlSchemaDDL.js.map +1 -0
  30. package/dist/dialects/snowflakeQueryDialect.d.ts +41 -0
  31. package/dist/dialects/snowflakeQueryDialect.d.ts.map +1 -0
  32. package/dist/dialects/snowflakeQueryDialect.js +94 -0
  33. package/dist/dialects/snowflakeQueryDialect.js.map +1 -0
  34. package/dist/dialects/sqlServerSchemaDDL.d.ts +83 -0
  35. package/dist/dialects/sqlServerSchemaDDL.d.ts.map +1 -0
  36. package/dist/dialects/sqlServerSchemaDDL.js +507 -0
  37. package/dist/dialects/sqlServerSchemaDDL.js.map +1 -0
  38. package/dist/facets/dialectBinding.d.ts +26 -0
  39. package/dist/facets/dialectBinding.d.ts.map +1 -0
  40. package/dist/facets/dialectBinding.js +2 -0
  41. package/dist/facets/dialectBinding.js.map +1 -0
  42. package/dist/facets/dialectGrammar.d.ts +82 -0
  43. package/dist/facets/dialectGrammar.d.ts.map +1 -0
  44. package/dist/facets/dialectGrammar.js +2 -0
  45. package/dist/facets/dialectGrammar.js.map +1 -0
  46. package/dist/facets/dialectKey.d.ts +9 -0
  47. package/dist/facets/dialectKey.d.ts.map +1 -0
  48. package/dist/facets/dialectKey.js +2 -0
  49. package/dist/facets/dialectKey.js.map +1 -0
  50. package/dist/facets/dialectLexicalRules.d.ts +102 -0
  51. package/dist/facets/dialectLexicalRules.d.ts.map +1 -0
  52. package/dist/facets/dialectLexicalRules.js +2 -0
  53. package/dist/facets/dialectLexicalRules.js.map +1 -0
  54. package/dist/facets/dialectSchemaDDL.d.ts +213 -0
  55. package/dist/facets/dialectSchemaDDL.d.ts.map +1 -0
  56. package/dist/facets/dialectSchemaDDL.js +2 -0
  57. package/dist/facets/dialectSchemaDDL.js.map +1 -0
  58. package/dist/facets/dialectTypes.d.ts +31 -0
  59. package/dist/facets/dialectTypes.d.ts.map +1 -0
  60. package/dist/facets/dialectTypes.js +2 -0
  61. package/dist/facets/dialectTypes.js.map +1 -0
  62. package/dist/facets/dialectWriter.d.ts +59 -0
  63. package/dist/facets/dialectWriter.d.ts.map +1 -0
  64. package/dist/facets/dialectWriter.js +2 -0
  65. package/dist/facets/dialectWriter.js.map +1 -0
  66. package/dist/index.d.ts +21 -5
  67. package/dist/index.d.ts.map +1 -1
  68. package/dist/index.js +13 -4
  69. package/dist/index.js.map +1 -1
  70. package/dist/postgresqlDialect.d.ts +57 -152
  71. package/dist/postgresqlDialect.d.ts.map +1 -1
  72. package/dist/postgresqlDialect.js +110 -683
  73. package/dist/postgresqlDialect.js.map +1 -1
  74. package/dist/queryDialect.d.ts +42 -0
  75. package/dist/queryDialect.d.ts.map +1 -0
  76. package/dist/queryDialect.js +25 -0
  77. package/dist/queryDialect.js.map +1 -0
  78. package/dist/sqlDialect.d.ts +121 -212
  79. package/dist/sqlDialect.d.ts.map +1 -1
  80. package/dist/sqlDialect.js +710 -29
  81. package/dist/sqlDialect.js.map +1 -1
  82. package/dist/sqlServerDialect.d.ts +54 -120
  83. package/dist/sqlServerDialect.d.ts.map +1 -1
  84. package/dist/sqlServerDialect.js +124 -594
  85. package/dist/sqlServerDialect.js.map +1 -1
  86. package/package.json +4 -2
package/README.md CHANGED
@@ -1,46 +1,172 @@
1
1
  # @memberjunction/sql-dialect
2
2
 
3
- **Version**: 5.2.0
4
- **Zero runtime dependencies**
3
+ **No database driver dependencies.** The only runtime dependency is `@memberjunction/global`, whose class
4
+ factory lets other packages register their own dialects.
5
5
 
6
6
  ## Overview
7
7
 
8
- `@memberjunction/sql-dialect` is an abstract SQL dialect layer that enables database-agnostic SQL generation across MemberJunction. It encapsulates every platform-specific SQL syntax pattern -- identifier quoting, pagination, data types, DDL generation, full-text search, and more -- into a single, testable abstraction with zero database driver dependencies.
8
+ `@memberjunction/sql-dialect` is an abstract SQL dialect layer that enables database-agnostic SQL generation across MemberJunction. It encapsulates every platform-specific SQL syntax pattern -- identifier quoting, pagination, data types, DDL generation, full-text search, and more -- into a single, testable abstraction with no database driver dependencies.
9
9
 
10
- This package is used by CodeGen, data providers, and SQL converters throughout the MemberJunction monorepo. When code needs to emit SQL that works on both SQL Server and PostgreSQL, it programs against the `SQLDialect` abstract class and lets the concrete dialect handle platform differences.
10
+ This package is used by CodeGen, data providers, the SQL parser, the RunQuery pipeline and SQL converters throughout the MemberJunction monorepo. When code needs to emit SQL that works on both SQL Server and PostgreSQL, it programs against the `SQLDialect` abstract class and lets the concrete dialect handle platform differences.
11
+
12
+ It ships six dialects:
13
+
14
+ - **Platform dialects** for the databases MJ itself runs on: `SQLServerDialect` (`'sqlserver'`) and `PostgreSQLDialect` (`'postgresql'`). These are full `SQLDialect`s, with DDL.
15
+ - **Query-only dialects** for External Data Sources, databases MJ reads but does not run on: `MySQLQueryDialect` (`'mysql'`), `OracleQueryDialect` (`'oracle'`), `SnowflakeQueryDialect` (`'snowflake'`) and `DatabricksQueryDialect` (`'databricks'`). See [Query-only dialects](#query-only-dialects).
11
16
 
12
17
  ## Architecture
13
18
 
14
19
  ### Class Hierarchy
15
20
 
16
21
  ```
17
- SQLDialect (abstract base)
18
- |-- SQLServerDialect
19
- |-- PostgreSQLDialect
22
+ QueryDialect (abstract: Key, DisplayName, Lexical, Grammar, Writer, Types, Binding)
23
+ |-- SQLDialect (abstract: adds PlatformKey, DDL, FormatterLanguage and the method surface below)
24
+ | |-- SQLServerDialect
25
+ | |-- PostgreSQLDialect
26
+ |-- AnsiQueryDialect (standard SQL facets)
27
+ |-- MySQLQueryDialect
28
+ |-- OracleQueryDialect
29
+ |-- SnowflakeQueryDialect
30
+ |-- DatabricksQueryDialect
20
31
  ```
21
32
 
22
- `SQLDialect` defines approximately 30 abstract methods spanning identifier quoting, pagination, literal expressions, INSERT/UPDATE return patterns, DDL generation, full-text search, data type mapping, and schema introspection. Each concrete dialect implements every method with platform-native SQL.
33
+ A dialect is split into **facets**: small objects that each hold one kind of fact about the database.
34
+ `QueryDialect` is the set of facets needed to read, screen and write queries. `SQLDialect` adds the `DDL`
35
+ facet MJ needs to create and run its own schema. Every method listed under [Key Methods](#key-methods) is a
36
+ member of `SQLDialect` that delegates to one of its facets; those methods are kept for existing callers,
37
+ and new code that only needs one kind of fact can read the facet directly.
38
+
39
+ ### Facets
40
+
41
+ | Facet | Interface | Holds | Where |
42
+ |---|---|---|---|
43
+ | `Lexical` | `DialectLexicalRules` | How text splits into tokens: identifier quote forms (`IdentifierQuoteForm`), string literal forms and their prefixes and escapes (`StringLiteralForm`), dollar quoting (`DollarQuoting`), Oracle-style `q'[…]'` quoting, line comment openers (`LineCommentForm`), nested or executable block comments (`BlockCommentRules`), parameter placeholder forms (`ParameterPlaceholderForm`), unquoted identifier case folding (`IdentifierCaseFolding`), and whether a server setting can turn backslash escapes on or off. | Every `QueryDialect`. A frozen plain object. |
44
+ | `Grammar` | `DialectGrammar` | Statement-level facts: the node-sql-parser grammar (`ParserGrammar`, or `null` when there is none), the default schema, row-cap forms (`RowCapForm`), ORDER BY legality in CTEs and derived tables, nested WITH, the recursive keyword, the query-hint keyword, document tail clauses (`FOR JSON`), set operators, the correlated-join form (`CorrelatedJoinForm`), write-statement keywords, functions caller SQL may not call, keywords that start a new statement without a separator (`UnseparatedStatementKeywords`), paging ORDER BY defaults, and extra column alias forms (`ColumnAliasForm`). | Every `QueryDialect`. A frozen plain object. |
45
+ | `Writer` | `DialectWriter` | Writes SQL fragments: identifier and schema quoting, string literals and their prefix, LIKE escaping, boolean and NULL literals, `LimitClause`, casts, null-coalescing, concatenation, JSON extraction, date arithmetic, the current UTC timestamp, `LowerCase` and `IIF`. | Every `QueryDialect`. Writers extend `AnsiWriter`. |
46
+ | `Types` | `DialectTypes` | The SQL type names in each category (boolean, string, fixed-width string, date, integer, float, UUID, binary, JSON, currency, interval, network). | `SQLDialect`; `null` on the shipped query-only dialects. |
47
+ | `Binding` | `DialectBinding` | How values cross to the driver: `ParameterPlaceholder`, `TypedParameter` (returns a `TypedParameterReference`), `BooleanParameterValue` and `IsConnectionError`. | `SQLDialect`; `null` on the shipped query-only dialects. |
48
+ | `DDL` | `DialectSchemaDDL` | DDL, stored-procedure calls, migrations, schema introspection, type mapping (`TypeMap`), batch splitting, savepoints and other transaction SQL. Implementations extend `BaseSchemaDDL`. | `SQLDialect` only. |
49
+
50
+ The facets of the shipped dialects are exported, so a new dialect can start from one and change only what
51
+ differs: `ANSI_LEXICAL`, `ANSI_GRAMMAR`, `SQL_SERVER_LEXICAL`, `SQL_SERVER_GRAMMAR`, `SQL_SERVER_TYPES`,
52
+ `POSTGRESQL_LEXICAL`, `POSTGRESQL_GRAMMAR`, `POSTGRESQL_TYPES`, `MYSQL_LEXICAL`, `MYSQL_GRAMMAR`,
53
+ `ORACLE_LEXICAL`, `ORACLE_GRAMMAR`, `SNOWFLAKE_LEXICAL`, `SNOWFLAKE_GRAMMAR`, `DATABRICKS_LEXICAL` and
54
+ `DATABRICKS_GRAMMAR`, plus the writer classes (`AnsiWriter`, `SQLServerWriter`, `PostgreSQLWriter`,
55
+ `MySQLWriter`, `OracleWriter`, `SnowflakeWriter`, `DatabricksWriter`), the binding classes
56
+ (`SQLServerBinding`, `PostgreSQLBinding`) and the DDL classes (`BaseSchemaDDL`, `SQLServerSchemaDDL`,
57
+ `PostgreSQLSchemaDDL`).
58
+
59
+ ### `ParserDialect` and the deprecated `SQLParserDialect`
60
+
61
+ `ParserDialect` is `Pick<QueryDialect, 'Key' | 'Lexical' | 'Grammar'>`: the part of a dialect the SQL
62
+ tokenizer and parser in `@memberjunction/sql-parser` read. Any `QueryDialect` satisfies it.
63
+
64
+ `SQLParserDialect` is the older, flat interface the parser used to read (`ParserDialect` as a string,
65
+ `QuoteIdentifier`, `AllowsOrderByInCTE`, `SupportsEscapeStringLiterals`, `QueryHintKeyword`, and so on). It
66
+ is **deprecated** in favour of `ParserDialect` or `QueryDialect`. `SQLDialect` still implements it, so code
67
+ that passes a `SQLDialect` where a `SQLParserDialect` is expected keeps working; it is kept until 7.0.
23
68
 
24
69
  ### Key Interfaces
25
70
 
26
71
  | Interface | Purpose |
27
72
  |---|---|
73
+ | `DialectKey` | The key a dialect is registered and resolved under: `'sqlserver'`, `'postgresql'`, `'mysql'`, `'oracle'`, `'snowflake'`, `'databricks'`, or any other string a consumer registered. Lower case by convention. Wider than `DatabasePlatform`. |
74
+ | `DatabasePlatform` | Union type: `'sqlserver' \| 'postgresql'`. The platforms MJ itself runs on. |
28
75
  | `LimitClauseResult` | `{ prefix: string; suffix: string }` -- Flexible pagination fragments. SQL Server uses `prefix` (TOP), PostgreSQL uses `suffix` (LIMIT/OFFSET). |
76
+ | `DateAddUnit` | `'MINUTE' \| 'HOUR' \| 'DAY'`, the units `DateAddExpression` accepts. |
29
77
  | `SchemaIntrospectionSQL` | Catalog query templates for discovering tables, columns, constraints, foreign keys, and indexes. |
30
78
  | `TriggerOptions` | Configuration for trigger DDL generation (schema, table, timing, events, body, function name, FOR EACH ROW/STATEMENT). |
31
79
  | `IndexOptions` | Configuration for index DDL generation (columns, uniqueness, method, partial WHERE, INCLUDE columns). |
80
+ | `ColumnDDLOptions` / `AlterColumnOptions` | Column definitions for `AddColumnClause` and `AlterColumnDDL`. |
81
+ | `SchemaFieldType` / `ResolveTypeOptions` | Abstract column types and the options `ResolveAbstractType` maps to a concrete SQL type. |
32
82
  | `DataTypeMap` | Maps source database types to target platform types. |
33
83
  | `MappedType` | Describes a mapped type: `typeName`, `supportsLength`, `supportsPrecisionScale`, `defaultLength`. |
34
- | `DatabasePlatform` | Union type: `'sqlserver' \| 'postgresql'` |
84
+
85
+ ## Resolving a dialect
86
+
87
+ Callers get a dialect from a key instead of constructing one, so no package keeps its own
88
+ switch over platform names.
89
+
90
+ | Function | Returns |
91
+ |---|---|
92
+ | `GetDialect(key)` | A new full `SQLDialect` for a platform key (`'sqlserver'`, `'postgresql'`, or a full `SQLDialect` a consumer registered). **Throws** for a query-only dialect and for an unknown key: `No SQLDialect registered for "mysql". Supported platforms: sqlserver, postgresql`. |
93
+ | `GetQueryDialect(key)` | A new `QueryDialect` for any registered key, platform or query-only. **Throws** for an unknown key: `No QueryDialect registered for "teradata". Registered dialects: sqlserver, postgresql, mysql, oracle, snowflake, databricks`. |
94
+ | `IsSupportedPlatform(value)` | Whether a string is a platform key; narrows it to `DatabasePlatform`. False for the query-only keys. |
95
+ | `SupportedPlatforms()` | The platform keys: `['sqlserver', 'postgresql']`. |
96
+ | `RegisteredDialectKeys()` | Every key that resolves: the built-in ones, then any registered by a consumer. |
97
+ | `ShippedQueryOnlyDialectKeys()` | The query-only keys this package ships: `['mysql', 'oracle', 'snowflake', 'databricks']`. |
98
+
99
+ How a key resolves:
100
+
101
+ 1. **Keys match exactly, case included.** `'MySQL'` is an unknown key; there are no aliases (`'mssql'`,
102
+ `'postgres'` and `'pg'` are not recognized).
103
+ 2. **Built-in keys resolve directly.** The six shipped dialects are constructed by the factory, not looked up
104
+ in the class factory, so import order cannot make one unresolvable and a registration under a built-in key
105
+ cannot replace it.
106
+ 3. **Any other key resolves through the MJ class factory.** A package registers its dialect with
107
+ `@RegisterClass(QueryDialect, '<key>')`, and both `GetQueryDialect` and `RegisteredDialectKeys` then see it.
108
+ `GetDialect` serves such a registration only if the class is a full `SQLDialect`.
109
+ 4. **An unknown key throws**, naming the keys that do resolve. Nothing falls back to a default dialect.
110
+
111
+ ```typescript
112
+ import { GetDialect, GetQueryDialect, IsSupportedPlatform } from '@memberjunction/sql-dialect';
113
+
114
+ const platform = GetDialect('postgresql'); // PostgreSQLDialect
115
+ platform.DDL.BatchSeparator(); // ''
116
+
117
+ const source = GetQueryDialect('snowflake'); // SnowflakeQueryDialect
118
+ source.Writer.QuoteIdentifier('Name'); // '"Name"'
119
+ source.Writer.LimitClause(10).suffix; // 'LIMIT 10'
120
+ source.Grammar.ParserGrammar; // 'Snowflake'
121
+
122
+ IsSupportedPlatform('snowflake'); // false
123
+ GetDialect('snowflake'); // throws: not a full SQLDialect
124
+ ```
125
+
126
+ ## Query-only dialects
127
+
128
+ A query-only dialect describes a database MJ reads through an External Data Source. It has the `Lexical`,
129
+ `Grammar` and `Writer` facets, which is enough for MJ to:
130
+
131
+ - tokenize the query text safely (strings, quoted identifiers and comments end where the database says they do);
132
+ - screen it: refuse write statements (`WriteStatementKeywords`) and functions caller SQL may not call (`CallerSQLForbiddenFunctions`);
133
+ - cap and page its rows with the database's own row-cap syntax;
134
+ - render RunQuery template filters (`sqlString`, `sqlIn`, `sqlBoolean`, `sqlIdentifier`, the LIKE filters) with the database's literal and quoting rules.
135
+
136
+ What a query-only dialect does **not** have:
137
+
138
+ - **No `DDL` facet.** `GetDialect` refuses it, so CodeGen, migrations and anything else that creates schema cannot use it.
139
+ - **No `Types` or `Binding` facet** on the shipped ones (both are `null`). A boolean query parameter therefore keeps its JavaScript boolean value instead of being converted for the driver.
140
+ - **No node-sql-parser grammar for Oracle** (`ParserGrammar` is `null`), so features that need an AST are not available there.
141
+
142
+ | | MySQL | Oracle | Snowflake | Databricks |
143
+ |---|---|---|---|---|
144
+ | Key | `'mysql'` | `'oracle'` | `'snowflake'` | `'databricks'` |
145
+ | Identifier quoting | `` `name` `` | `"name"` (no doubled-quote escape) | `"name"` | `` `name` `` |
146
+ | Unquoted identifiers | kept as written | folded to upper case | folded to upper case | kept as written |
147
+ | Strings | `'…'` and `"…"`, backslash escapes | `'…'`, `q'[…]'` alternative quoting | `'…'` with backslash escapes, `$$…$$` | `'…'` and `"…"`, backslash escapes, `r'…'` raw strings |
148
+ | Backslash escapes depend on a server setting | yes (`NO_BACKSLASH_ESCAPES`) | no | no | yes (`spark.sql.parser.escapedStringLiterals`) |
149
+ | Comments | `#`, `-- ` (needs a space), `/* */`; `/*!` and `/*+` are executable | `--`, `/* */` | `--`, `//`, `/* */` | `--`, nestable `/* */` |
150
+ | Placeholders | `?` | `:name`, `:1` | `?`, `:name`, `:1` | `:name`, `?` |
151
+ | `LimitClause(10, 20)` | `LIMIT 10 OFFSET 20` | `OFFSET 20 ROWS FETCH NEXT 10 ROWS ONLY` | `LIMIT 10 OFFSET 20` | `LIMIT 10 OFFSET 20` |
152
+ | `BooleanLiteral(true)` | `TRUE` | `1` | `TRUE` | `TRUE` |
153
+ | `IsNull(a, b)` | `COALESCE(a, b)` | `NVL(a, b)` | `NVL(a, b)` | `COALESCE(a, b)` |
154
+ | Concatenation | `CONCAT(…)` (no operator) | `\|\|` | `\|\|` | `\|\|` |
155
+ | node-sql-parser grammar | `MySQL` | none | `Snowflake` | `Hive` |
156
+ | Forbidden functions in caller SQL | `load_file`, `sleep`, `benchmark`, lock functions | none | none | `reflect`, `try_reflect`, `java_method` |
35
157
 
36
158
  ## Key Methods
37
159
 
160
+ These are members of `SQLDialect`. Each delegates to a facet: quoting, literals and expressions to
161
+ `Writer`, placeholders and boolean binding to `Binding`, grammar facts to `Grammar`, and DDL, return
162
+ patterns, introspection and type mapping to `DDL`.
163
+
38
164
  ### Identifier Quoting
39
165
 
40
166
  | Method | Description | SQL Server | PostgreSQL |
41
167
  |---|---|---|---|
42
168
  | `QuoteIdentifier(name)` | Wraps a single identifier | `[name]` | `"name"` |
43
- | `QuoteSchema(schema, object)` | Schema-qualified reference | `[schema].[object]` | `schema."object"` |
169
+ | `QuoteSchema(schema, object)` | Schema-qualified reference | `[schema].[object]` | `"schema"."object"` |
44
170
 
45
171
  #### PostgreSQL auto-quoting (whole-statement)
46
172
 
@@ -77,8 +203,8 @@ duplicates.
77
203
  | `NewUUID()` | Generate UUID | `NEWID()` | `gen_random_uuid()` |
78
204
  | `CastToText(expr)` | Cast to text type | `CAST(expr AS NVARCHAR(MAX))` | `CAST(expr AS TEXT)` |
79
205
  | `CastToUUID(expr)` | Cast to UUID type | `CAST(expr AS UNIQUEIDENTIFIER)` | `CAST(expr AS UUID)` |
80
- | `Coalesce(expr, fallback)` | Null coalescing (concrete) | `COALESCE(expr, fallback)` | `COALESCE(expr, fallback)` |
81
- | `IsNull(expr, fallback)` | Alias for Coalesce | `COALESCE(expr, fallback)` | `COALESCE(expr, fallback)` |
206
+ | `Coalesce(expr, fallback)` | N-ary null coalescing | `COALESCE(expr, fallback)` | `COALESCE(expr, fallback)` |
207
+ | `IsNull(expr, fallback)` | Two-argument null coalescing in the platform's native spelling | `ISNULL(expr, fallback)` | `COALESCE(expr, fallback)` |
82
208
  | `IIF(condition, trueVal, falseVal)` | Conditional expression | `IIF(cond, t, f)` | `CASE WHEN cond THEN t ELSE f END` |
83
209
 
84
210
  ### INSERT/UPDATE Return Patterns
@@ -219,7 +345,7 @@ const dialect: SQLDialect = new PostgreSQLDialect();
219
345
 
220
346
  // Identifier quoting
221
347
  dialect.QuoteIdentifier('UserName'); // "UserName"
222
- dialect.QuoteSchema('__mj', 'User'); // __mj."User"
348
+ dialect.QuoteSchema('__mj', 'User'); // "__mj"."User"
223
349
 
224
350
  // Pagination
225
351
  const { prefix, suffix } = dialect.LimitClause(10, 20);
@@ -307,19 +433,119 @@ function buildSelectQuery(dialect: SQLDialect, schema: string, table: string,
307
433
  // SELECT TOP 10 [ID], [Name] FROM [__mj].[User]
308
434
 
309
435
  // PostgreSQL output:
310
- // SELECT "ID", "Name" FROM __mj."User" LIMIT 10
436
+ // SELECT "ID", "Name" FROM "__mj"."User" LIMIT 10
311
437
  ```
312
438
 
313
439
  ## Adding a New Dialect
314
440
 
315
- To add support for a new database platform (e.g., MySQL):
441
+ First decide which kind of dialect the database needs:
442
+
443
+ - **A query-only dialect** when MJ only reads the database through an External Data Source. It needs the
444
+ `Lexical`, `Grammar` and `Writer` facets, and optionally `Types` and `Binding`.
445
+ - **A platform dialect** when MJ itself will run on the database. It needs every facet, including `DDL`.
446
+
447
+ ### A query-only dialect
448
+
449
+ Extend `AnsiQueryDialect`, which supplies standard SQL facets, and override only what the database does
450
+ differently. Build each data facet by spreading the closest existing one (`ANSI_LEXICAL`, `MYSQL_GRAMMAR`,
451
+ and so on) and freezing the result; build the writer by extending `AnsiWriter` or another shipped writer.
452
+
453
+ ```typescript
454
+ import { RegisterClass } from '@memberjunction/global';
455
+ import {
456
+ QueryDialect, AnsiQueryDialect, AnsiWriter, ANSI_LEXICAL, ANSI_GRAMMAR, ANSI_WRITE_STATEMENT_KEYWORDS,
457
+ GetQueryDialect,
458
+ } from '@memberjunction/sql-dialect';
459
+ import type { DialectKey, DialectLexicalRules, DialectGrammar, DialectWriter, LimitClauseResult } from '@memberjunction/sql-dialect';
460
+
461
+ /** Lexical rules: standard SQL, plus backtick identifiers and `#` line comments. */
462
+ const ACME_LEXICAL: DialectLexicalRules = Object.freeze({
463
+ ...ANSI_LEXICAL,
464
+ IdentifierQuotes: Object.freeze([Object.freeze({ Open: '`', Close: '`', DoubledCloseEscape: true })]),
465
+ LineComments: Object.freeze([
466
+ Object.freeze({ Opener: '--', RequiresWhitespaceAfter: false }),
467
+ Object.freeze({ Opener: '#', RequiresWhitespaceAfter: false }),
468
+ ]),
469
+ UnquotedIdentifierCase: 'none',
470
+ });
471
+
472
+ /** Grammar facts: standard SQL, with LIMIT row caps and two extra write keywords. */
473
+ const ACME_GRAMMAR: DialectGrammar = Object.freeze({
474
+ ...ANSI_GRAMMAR,
475
+ ParserGrammar: null,
476
+ RowCapForms: Object.freeze(['limit-offset'] as const),
477
+ WriteStatementKeywords: Object.freeze([...ANSI_WRITE_STATEMENT_KEYWORDS, 'UPSERT', 'LOAD']),
478
+ CallerSQLForbiddenFunctions: Object.freeze(['read_file']),
479
+ });
480
+
481
+ /** Writes what differs from standard SQL; everything else comes from AnsiWriter. */
482
+ class AcmeWriter extends AnsiWriter {
483
+ QuoteIdentifier(name: string): string {
484
+ return `\`${name.replace(/`/g, '``')}\``;
485
+ }
486
+
487
+ LimitClause(limit: number, offset?: number): LimitClauseResult {
488
+ return { prefix: '', suffix: offset != null ? `LIMIT ${limit} OFFSET ${offset}` : `LIMIT ${limit}` };
489
+ }
490
+ }
491
+
492
+ @RegisterClass(QueryDialect, 'acme')
493
+ export class AcmeQueryDialect extends AnsiQueryDialect {
494
+ private readonly writer: DialectWriter = Object.freeze(new AcmeWriter());
495
+
496
+ get Key(): DialectKey { return 'acme'; }
497
+ get DisplayName(): string { return 'Acme SQL'; }
498
+ get Lexical(): DialectLexicalRules { return ACME_LEXICAL; }
499
+ get Grammar(): DialectGrammar { return ACME_GRAMMAR; }
500
+ get Writer(): DialectWriter { return this.writer; }
501
+ }
502
+
503
+ GetQueryDialect('acme').Writer.QuoteIdentifier('Name'); // '`Name`'
504
+ ```
505
+
506
+ The lexical and grammar facts are what keep the RunQuery safety checks sound on that database: a wrong
507
+ string or comment rule lets text hide from the scan for write statements, so take each one from the
508
+ database's own documentation.
509
+
510
+ Registered this way, in your own package, the dialect resolves as soon as the module that declares it has
511
+ been loaded. The key must not be one of the built-in keys, which cannot be replaced.
512
+
513
+ To **ship** a query-only dialect in this package instead:
514
+
515
+ 1. Add it under `src/dialects/` and export it, its writer and its facet constants from `src/index.ts`.
516
+ 2. Add the class to `QUERY_ONLY_DIALECT_CLASSES` in `src/dialectFactory.ts`, so it resolves without the class
517
+ factory. Do not register it with `@RegisterClass`.
518
+ 3. Add its row to `EXPECTED_FACTS` in `src/__tests__/conformance/dialectConformance.test.ts`. The conformance
519
+ suite runs over every key `RegisteredDialectKeys()` returns. It checks the declared facts, that the data
520
+ facets are frozen, that a quoted identifier reads back the way the lexical rules say, that row caps use a
521
+ form the grammar declares, and that every writer method writes without throwing.
316
522
 
317
- 1. **Create the type map class** implementing `DataTypeMap`:
523
+ ### A platform dialect
524
+
525
+ Extend `SQLDialect` and supply every facet. The members listed under [Key Methods](#key-methods) are already
526
+ implemented by `SQLDialect` and delegate to the facets, so there are no per-method overrides to write.
527
+
528
+ | Member | Supply |
529
+ |---|---|
530
+ | `PlatformKey` | The new key. Also add it to the `DatabasePlatform` union in `sqlDialect.ts`. |
531
+ | `DisplayName`, `FormatterLanguage` | The human-readable name and the `sql-formatter` language key. |
532
+ | `Lexical`, `Grammar` | Frozen facet objects, as for a query-only dialect. |
533
+ | `Writer` | A class extending `AnsiWriter`. |
534
+ | `Types` | A frozen `DialectTypes`. Required on a `SQLDialect`. |
535
+ | `Binding` | A class implementing `DialectBinding`. Required on a `SQLDialect`. |
536
+ | `DDL` | A class extending `BaseSchemaDDL`, constructed over the dialect's writer, with a `DataTypeMap` for `TypeMap`. |
537
+
538
+ `SQLServerDialect` and `PostgreSQLDialect` are the reference implementations. Then add the class to
539
+ `PLATFORM_DIALECT_CLASSES` in `src/dialectFactory.ts`, export it from `src/index.ts`, and add its row to
540
+ `EXPECTED_FACTS` in the conformance suite. The existing `crossDialect.test.ts` provides a pattern for testing
541
+ multiple dialects against the same assertions.
542
+
543
+ The `DataTypeMap` maps SQL Server types to the new platform's types:
318
544
 
319
545
  ```typescript
320
- import { DataTypeMap, MappedType } from '@memberjunction/sql-dialect';
546
+ import type { DataTypeMap, MappedType } from '@memberjunction/sql-dialect';
321
547
 
322
- class MySQLDataTypeMap implements DataTypeMap {
548
+ class AcmeDataTypeMap implements DataTypeMap {
323
549
  MapType(sourceType: string, sourceLength?: number,
324
550
  sourcePrecision?: number, sourceScale?: number): MappedType {
325
551
  const normalized = sourceType.toUpperCase().trim();
@@ -328,7 +554,7 @@ class MySQLDataTypeMap implements DataTypeMap {
328
554
  return { typeName: 'CHAR', supportsLength: true,
329
555
  supportsPrecisionScale: false, defaultLength: 36 };
330
556
  case 'BIT':
331
- return { typeName: 'TINYINT(1)', supportsLength: false,
557
+ return { typeName: 'BOOLEAN', supportsLength: false,
332
558
  supportsPrecisionScale: false };
333
559
  // ... map remaining types
334
560
  default:
@@ -346,62 +572,15 @@ class MySQLDataTypeMap implements DataTypeMap {
346
572
  }
347
573
  ```
348
574
 
349
- 2. **Create the dialect class** extending `SQLDialect`:
350
-
351
- ```typescript
352
- import { SQLDialect, DataTypeMap } from '@memberjunction/sql-dialect';
353
-
354
- export class MySQLDialect extends SQLDialect {
355
- get PlatformKey(): DatabasePlatform { return 'mysql' as DatabasePlatform; }
356
- get TypeMap(): DataTypeMap { return new MySQLDataTypeMap(); }
357
-
358
- QuoteIdentifier(name: string): string { return `\`${name}\``; }
359
- QuoteSchema(schema: string, object: string): string {
360
- return `\`${schema}\`.\`${object}\``;
361
- }
362
- LimitClause(limit: number, offset?: number): LimitClauseResult {
363
- const suffix = offset != null
364
- ? `LIMIT ${limit} OFFSET ${offset}`
365
- : `LIMIT ${limit}`;
366
- return { prefix: '', suffix };
367
- }
368
- BooleanLiteral(value: boolean): string { return value ? '1' : '0'; }
369
-
370
- // Query rendering: the pipeline reads these instead of checking the platform name
371
- get SelectListPagingOrderBy(): string | null { return null; }
372
- get PagingRequiresOrderBy(): boolean { return false; }
373
- get SupportsEscapeStringLiterals(): boolean { return false; }
374
- get SupportsDollarQuotedStrings(): boolean { return false; }
375
- get QueryHintKeyword(): string | null { return null; }
376
- get CallerSQLForbiddenFunctions(): readonly string[] { return ['load_file']; }
377
- StringLiteralPrefix(_text: string): string { return ''; }
378
- EscapeLikePattern(text: string): string {
379
- return text.replace(/\\/g, '\\\\').replace(/%/g, '\\%').replace(/_/g, '\\_');
380
- }
381
- BooleanParameterValue(value: boolean): boolean | number { return value ? 1 : 0; }
382
- // ... implement all remaining abstract methods (~25+)
383
- }
384
- ```
385
-
386
- The query rendering members decide how row caps, paging, composed queries and the RunQuery
387
- template filters behave on the platform; see [Query rendering members](#query-rendering-members).
388
-
389
- 3. **Update the `DatabasePlatform` type** in `sqlDialect.ts` to include the new platform key.
390
-
391
- 4. **Export from `index.ts`**:
392
-
393
- ```typescript
394
- export { MySQLDialect } from './mysqlDialect.js';
395
- ```
396
-
397
- 5. **Add tests** in `src/__tests__/mysqlDialect.test.ts` covering every method. The existing `crossDialect.test.ts` provides a pattern for testing multiple dialects against the same assertions.
575
+ The facets also decide how row caps, paging, composed queries and the RunQuery template filters behave on
576
+ the database; see [Query rendering members](#query-rendering-members).
398
577
 
399
578
  ## Side-by-Side Dialect Comparison
400
579
 
401
580
  | Feature | SQL Server (`SQLServerDialect`) | PostgreSQL (`PostgreSQLDialect`) |
402
581
  |---|---|---|
403
582
  | **Identifier quoting** | `[name]` | `"name"` |
404
- | **Schema-qualified** | `[schema].[object]` | `schema."object"` |
583
+ | **Schema-qualified** | `[schema].[object]` | `"schema"."object"` |
405
584
  | **Boolean literals** | `1` / `0` | `true` / `false` |
406
585
  | **Current UTC time** | `GETUTCDATE()` | `(NOW() AT TIME ZONE 'UTC')` |
407
586
  | **New UUID** | `NEWID()` | `gen_random_uuid()` |
@@ -432,27 +611,37 @@ export { MySQLDialect } from './mysqlDialect.js';
432
611
 
433
612
  The RunQuery rendering pipeline (SQLParser's lexer and paging-shape analysis, the paging and
434
613
  composition engines in `@memberjunction/generic-database-provider`, the template filters in
435
- `@memberjunction/core` and the parameter processor) reads these members rather than the platform
436
- name, so a new dialect gets correct rendering by declaring them:
437
-
438
- | Member | SQL Server | PostgreSQL | Used for |
439
- |---|---|---|---|
440
- | `LimitClause(limit, offset?)` | `TOP n` / `OFFSET … FETCH` | `LIMIT … OFFSET` | Row caps and pages |
441
- | `DefaultPagingOrderBy` | `(SELECT NULL)` | `1` | Paging a query with no ORDER BY |
442
- | `SelectListPagingOrderBy` | `1` | `null` | Paging a set operation or `SELECT DISTINCT` with no ORDER BY |
443
- | `PagingRequiresOrderBy` | `true` | `false` | Whether a page from a derived table needs an ORDER BY |
444
- | `AllowsOrderByInCTE` | `false` | `true` | Stripping a composed dependency's ORDER BY |
445
- | `RecursiveCTESyntax()` | `WITH` | `WITH RECURSIVE` | Composing into a recursive WITH clause |
446
- | `QueryHintKeyword` | `OPTION` | `null` | Keeping a trailing hint clause last; lifting a dependency's hints |
447
- | `CallerSQLForbiddenFunctions` | `openrowset`, `openquery`, … | `query_to_xml*`, `ts_stat`, `pg_read_file`, `dblink*`, … | Refusing calls in caller-supplied SQL that read what a check of its tables cannot see |
448
- | `SupportsEscapeStringLiterals` | `false` | `true` | Lexing `E'…'` strings |
449
- | `SupportsDollarQuotedStrings` | `false` | `true` | Lexing `$$…$$` strings |
450
- | `QuoteIdentifier(name)` | `[name]` | `"name"` | Lexing quoted identifiers; `sqlIdentifier` |
451
- | `StringLiteralPrefix(text)` | `N` for non-ASCII | none | `sqlString`, `sqlIn`, LIKE filters |
452
- | `EscapeLikePattern(text)` | `[%]`, `[_]`, `[[]` | `\%`, `\_`, `\\` | LIKE filters |
453
- | `BooleanLiteral(value)` | `1` / `0` | `true` / `false` | `sqlBoolean` |
454
- | `BooleanParameterValue(value)` | `1` / `0` | `true` / `false` | Binding a boolean query parameter |
455
- | `ParserDialect` | `TransactSQL` | `PostgresQL` | node-sql-parser grammar, where the AST is used |
614
+ `@memberjunction/core` and the parameter processor) reads these facts rather than the platform
615
+ name, so a new dialect gets correct rendering by declaring them. Each render uses the dialect of
616
+ the request: the provider's platform, or the External Data Source's dialect for a query on one.
617
+
618
+ The `SQLDialect` members in the first column are kept for existing callers; each reads the facet
619
+ member in the second column, which is what code written against a `QueryDialect` reads.
620
+
621
+ | `SQLDialect` member | Facet member | SQL Server | PostgreSQL | Used for |
622
+ |---|---|---|---|---|
623
+ | `LimitClause(limit, offset?)` | `Writer.LimitClause` | `TOP n` / `OFFSET … FETCH` | `LIMIT … OFFSET` | Row caps and pages |
624
+ | `DefaultPagingOrderBy` | `Grammar.DefaultPagingOrderBy` | `(SELECT NULL)` | `1` | Paging a query with no ORDER BY |
625
+ | `SelectListPagingOrderBy` | `Grammar.SelectListPagingOrderBy` | `1` | `null` | Paging a set operation or `SELECT DISTINCT` with no ORDER BY |
626
+ | `PagingRequiresOrderBy` | `Grammar.PagingRequiresOrderBy` | `true` | `false` | Whether a page from a derived table needs an ORDER BY |
627
+ | `AllowsOrderByInCTE` | `Grammar.AllowsOrderByInCTE` | `false` | `true` | Stripping a composed dependency's ORDER BY |
628
+ | `RecursiveCTESyntax()` | `Grammar.RecursiveKeyword` | `WITH` | `WITH RECURSIVE` | Composing into a recursive WITH clause |
629
+ | `QueryHintKeyword` | `Grammar.QueryHintKeyword` | `OPTION` | `null` | Keeping a trailing hint clause last; lifting a dependency's hints |
630
+ | `CallerSQLForbiddenFunctions` | `Grammar.CallerSQLForbiddenFunctions` | `openrowset`, `openquery`, … | `query_to_xml*`, `ts_stat`, `pg_read_file`, `dblink*`, … | Refusing calls in caller-supplied SQL that read what a check of its tables cannot see |
631
+ | `UnseparatedStatementKeywords` | `Grammar.UnseparatedStatementKeywords` | The T-SQL statement keywords (`INSERT`, `DELETE`, `EXEC`, `DECLARE`, …) | none | Finding a second statement that has no separator before it (T-SQL runs `SELECT 1 DELETE FROM t` as two statements) |
632
+ | — | `Grammar.WriteStatementKeywords` | `INSERT`, `UPDATE`, `DELETE`, `MERGE`, … | `INSERT`, `UPDATE`, `DELETE`, `COPY`, … | Refusing a statement that writes data, changes the schema or runs code |
633
+ | `SupportsEscapeStringLiterals` | `Lexical.StringLiterals` (an `E` prefix with backslash escapes) | `false` | `true` | Lexing `E'…'` strings |
634
+ | `SupportsDollarQuotedStrings` | `Lexical.DollarQuotedStrings` | `false` (`'none'`) | `true` (`'tagged'`) | Lexing `$$…$$` strings |
635
+ | `QuoteIdentifier(name)` | `Lexical.IdentifierQuotes`, `Writer.QuoteIdentifier` | `[name]` | `"name"` | Lexing quoted identifiers; `sqlIdentifier` |
636
+ | `StringLiteralPrefix(text)` | `Writer.StringLiteralPrefix` | `N` for non-ASCII | none | `sqlString`, `sqlIn`, LIKE filters |
637
+ | `QuoteStringLiteral(value)` | `Writer.QuoteStringLiteral` | `'…'`, `''` for a quote | `'…'`, `''` for a quote | `sqlString`, `sqlIn`, LIKE filters |
638
+ | `EscapeLikePattern(text)` | `Writer.EscapeLikePattern` | `[%]`, `[_]`, `[[]` | `\%`, `\_`, `\\` | LIKE filters |
639
+ | `BooleanLiteral(value)` | `Writer.BooleanLiteral` | `1` / `0` | `true` / `false` | `sqlBoolean` |
640
+ | `BooleanParameterValue(value)` | `Binding.BooleanParameterValue` | `1` / `0` | `true` / `false` | Binding a boolean query parameter |
641
+ | `ParserDialect` | `Grammar.ParserGrammar` | `TransactSQL` | `PostgresQL` | node-sql-parser grammar, where the AST is used. The `SQLDialect` getter throws when the grammar is `null`. |
642
+
643
+ The template filters read only the `Writer` facet, so they work for a query-only dialect too. A dialect
644
+ without a `Binding` facet keeps a boolean parameter as a JavaScript boolean.
456
645
 
457
646
  ## Installation
458
647
 
@@ -460,7 +649,7 @@ name, so a new dialect gets correct rendering by declaring them:
460
649
  npm install @memberjunction/sql-dialect
461
650
  ```
462
651
 
463
- Or, in a MemberJunction workspace, add the dependency to your package's `package.json` and run `npm install` from the repo root.
652
+ Or, in a MemberJunction workspace, add the dependency to your package's `package.json` and run `pnpm install` from the repo root.
464
653
 
465
654
  ## License
466
655
 
@@ -1,25 +1,45 @@
1
1
  import { SQLDialect, DatabasePlatform } from './sqlDialect.js';
2
- /**
3
- * Resolves a {@link DatabasePlatform} string to its concrete {@link SQLDialect} instance.
4
- *
5
- * This is the single factory for dialect resolution — all consumers should
6
- * call this instead of maintaining their own switch/map.
7
- *
8
- * @param platform - The database platform key (e.g., 'sqlserver', 'postgresql')
9
- * @returns The concrete SQLDialect instance for the platform
10
- * @throws Error if the platform is not registered
11
- */
2
+ import { QueryDialect } from './queryDialect.js';
3
+ import type { DialectKey } from './facets/dialectKey.js';
12
4
  /**
13
5
  * Narrows an arbitrary string to a {@link DatabasePlatform} this build can
14
6
  * actually serve. Use this instead of comparing against a hardcoded
15
- * `'sqlserver' | 'postgresql'` literal union at call sites — the registry
16
- * below is the single source of truth for which platforms exist.
7
+ * `'sqlserver' | 'postgresql'` literal union at call sites — the platform
8
+ * dialects are the single source of truth for which platforms exist.
17
9
  */
18
10
  export declare function IsSupportedPlatform(platform: string | null | undefined): platform is DatabasePlatform;
19
11
  /**
20
12
  * The platform keys this build has a dialect for. Derived from the same
21
- * registry {@link GetDialect} uses, so callers never maintain a parallel list.
13
+ * dialects {@link GetDialect} serves, so callers never maintain a parallel list.
22
14
  */
23
15
  export declare function SupportedPlatforms(): DatabasePlatform[];
24
- export declare function GetDialect(platform: DatabasePlatform | string): SQLDialect;
16
+ /**
17
+ * The keys of every dialect that resolves: the built-in ones, then any third-party dialect
18
+ * registered with the class factory under {@link QueryDialect}.
19
+ */
20
+ export declare function RegisteredDialectKeys(): DialectKey[];
21
+ /**
22
+ * Resolves a dialect key to a new instance of its {@link QueryDialect}, such as `'mysql'` or
23
+ * `'snowflake'` for an External Data Source, or `'sqlserver'` / `'postgresql'` (which are full
24
+ * {@link SQLDialect}s). Built-in keys resolve directly; any other key resolves through a
25
+ * class-factory registration under {@link QueryDialect}.
26
+ *
27
+ * @throws Error if no dialect exists under the key
28
+ */
29
+ export declare function GetQueryDialect(key: DialectKey): QueryDialect;
30
+ /**
31
+ * Resolves a platform key to its concrete {@link SQLDialect} instance.
32
+ *
33
+ * This is the single factory for platform dialect resolution — all consumers should
34
+ * call this instead of maintaining their own switch/map. It serves the built-in platform
35
+ * dialects and any full {@link SQLDialect} registered with the class factory; a query-only
36
+ * dialect (see {@link GetQueryDialect}) is refused.
37
+ *
38
+ * @param platform - The database platform key (e.g., 'sqlserver', 'postgresql')
39
+ * @returns The concrete SQLDialect instance for the platform
40
+ * @throws Error if no SQLDialect exists under the key
41
+ */
42
+ export declare function GetDialect(platform: DatabasePlatform | DialectKey): SQLDialect;
43
+ /** The keys of the query-only dialects this package ships. */
44
+ export declare function ShippedQueryOnlyDialectKeys(): DialectKey[];
25
45
  //# sourceMappingURL=dialectFactory.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"dialectFactory.d.ts","sourceRoot":"","sources":["../src/dialectFactory.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAa/D;;;;;;;;;GASG;AACH;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,IAAI,gBAAgB,CAErG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,EAAE,CAEvD;AAED,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,GAAG,MAAM,GAAG,UAAU,CAS1E"}
1
+ {"version":3,"file":"dialectFactory.d.ts","sourceRoot":"","sources":["../src/dialectFactory.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AA6BzD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,QAAQ,IAAI,gBAAgB,CAErG;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,IAAI,gBAAgB,EAAE,CAEvD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,UAAU,EAAE,CAEpD;AAoCD;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,UAAU,GAAG,YAAY,CAS7D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,UAAU,CAAC,QAAQ,EAAE,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAS9E;AAED,8DAA8D;AAC9D,wBAAgB,2BAA2B,IAAI,UAAU,EAAE,CAE1D"}