drizzle-sybase 1.3.0 → 2.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.
- package/README.md +151 -3
- package/dist/codecs.d.ts +54 -0
- package/dist/codecs.d.ts.map +1 -0
- package/dist/codecs.js +112 -0
- package/dist/codecs.js.map +1 -0
- package/dist/columns/index.d.ts +16 -6
- package/dist/columns/index.d.ts.map +1 -1
- package/dist/columns/index.js +52 -35
- package/dist/columns/index.js.map +1 -1
- package/dist/connection.d.ts +20 -0
- package/dist/connection.d.ts.map +1 -1
- package/dist/connection.js +9 -1
- package/dist/connection.js.map +1 -1
- package/dist/datetime.d.ts +69 -0
- package/dist/datetime.d.ts.map +1 -0
- package/dist/datetime.js +384 -0
- package/dist/datetime.js.map +1 -0
- package/dist/db.d.ts +8 -1
- package/dist/db.d.ts.map +1 -1
- package/dist/db.js +22 -39
- package/dist/db.js.map +1 -1
- package/dist/dialect.d.ts +24 -2
- package/dist/dialect.d.ts.map +1 -1
- package/dist/dialect.js +46 -10
- package/dist/dialect.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/introspect/codegen.d.ts.map +1 -1
- package/dist/introspect/codegen.js +99 -32
- package/dist/introspect/codegen.js.map +1 -1
- package/dist/introspect/type-map.d.ts +64 -1
- package/dist/introspect/type-map.d.ts.map +1 -1
- package/dist/introspect/type-map.js +56 -5
- package/dist/introspect/type-map.js.map +1 -1
- package/dist/native/index.d.ts +2 -0
- package/dist/native/index.d.ts.map +1 -1
- package/dist/native/index.js.map +1 -1
- package/dist/native/sybase_native.darwin-arm64.node +0 -0
- package/dist/native/sybase_native.darwin-x64.node +0 -0
- package/dist/native/sybase_native.linux-arm64.node +0 -0
- package/dist/native/sybase_native.linux-x64.node +0 -0
- package/dist/native/sybase_native.win32-x64.node +0 -0
- package/dist/query-builders/insert.d.ts +9 -0
- package/dist/query-builders/insert.d.ts.map +1 -1
- package/dist/query-builders/insert.js +11 -2
- package/dist/query-builders/insert.js.map +1 -1
- package/dist/session.d.ts +4 -2
- package/dist/session.d.ts.map +1 -1
- package/dist/session.js +38 -17
- package/dist/session.js.map +1 -1
- package/package.json +11 -10
- package/src/native/binding.c +204 -11
- package/dist/__tests__/dialect.test.d.ts +0 -2
- package/dist/__tests__/dialect.test.d.ts.map +0 -1
- package/dist/__tests__/dialect.test.js +0 -50
- package/dist/__tests__/dialect.test.js.map +0 -1
- package/dist/__tests__/errors.test.d.ts +0 -2
- package/dist/__tests__/errors.test.d.ts.map +0 -1
- package/dist/__tests__/errors.test.js +0 -75
- package/dist/__tests__/errors.test.js.map +0 -1
- package/dist/__tests__/integration.test.d.ts +0 -2
- package/dist/__tests__/integration.test.d.ts.map +0 -1
- package/dist/__tests__/integration.test.js +0 -119
- package/dist/__tests__/integration.test.js.map +0 -1
- package/dist/__tests__/pool.test.d.ts +0 -2
- package/dist/__tests__/pool.test.d.ts.map +0 -1
- package/dist/__tests__/pool.test.js +0 -194
- package/dist/__tests__/pool.test.js.map +0 -1
- package/dist/introspect/__tests__/introspect.test.d.ts +0 -2
- package/dist/introspect/__tests__/introspect.test.d.ts.map +0 -1
- package/dist/introspect/__tests__/introspect.test.js +0 -411
- package/dist/introspect/__tests__/introspect.test.js.map +0 -1
- package/dist/native/__tests__/native.test.d.ts +0 -2
- package/dist/native/__tests__/native.test.d.ts.map +0 -1
- package/dist/native/__tests__/native.test.js +0 -25
- package/dist/native/__tests__/native.test.js.map +0 -1
- package/dist/query-builders/__tests__/query-builders.test.d.ts +0 -2
- package/dist/query-builders/__tests__/query-builders.test.d.ts.map +0 -1
- package/dist/query-builders/__tests__/query-builders.test.js +0 -477
- package/dist/query-builders/__tests__/query-builders.test.js.map +0 -1
package/README.md
CHANGED
|
@@ -140,6 +140,134 @@ This will:
|
|
|
140
140
|
- **Identifiers**: Quoted with `[brackets]`
|
|
141
141
|
- **Date format**: `'YYYY-MM-DD HH:MM:SS.mmm'` (no T separator)
|
|
142
142
|
|
|
143
|
+
## Exact Numeric Types
|
|
144
|
+
|
|
145
|
+
`money`, `smallmoney`, `bigint` and `numeric`/`decimal` hold more significant
|
|
146
|
+
digits than a JS double (money alone needs 19), so the driver never routes them
|
|
147
|
+
through one:
|
|
148
|
+
|
|
149
|
+
| Sybase type | Read as | Accepts on write |
|
|
150
|
+
| ------------------------------------------ | ---------------------- | ----------------------------------------------------------------- |
|
|
151
|
+
| `money`, `smallmoney`, `numeric`/`decimal` | string (digits intact) | string → `convert(<type>, '...')`, number/`BigInt` → bare literal |
|
|
152
|
+
| `bigint` | `BigInt` | `BigInt`/number → bare literal, string → `convert(bigint, '...')` |
|
|
153
|
+
| `int`, `smallint`, `tinyint` | number | bare literal |
|
|
154
|
+
| `float`, `real` | number | bare literal |
|
|
155
|
+
|
|
156
|
+
ASE refuses a quoted literal against these types (`Msg 257: Implicit conversion
|
|
157
|
+
from datatype 'VARCHAR' to 'MONEY' is not allowed`), so a decimal string bound to
|
|
158
|
+
one is wrapped in `CONVERT` — in `values()`, `set()` and in `where` / `join ... on`
|
|
159
|
+
/ `having` alike. The value stays quoted and escaped, so this is not an injection
|
|
160
|
+
vector, and `CONVERT` parses the digits server-side at full precision, so nothing
|
|
161
|
+
is lost.
|
|
162
|
+
|
|
163
|
+
Two cases are deliberately **not** wrapped, so that they fail loudly rather than
|
|
164
|
+
lose digits:
|
|
165
|
+
|
|
166
|
+
- **A literal with more fraction digits than the target keeps.** `'1.5'` against
|
|
167
|
+
`bigint`, or `'1.234'` against `numeric(10,2)`, stays a plain string and ASE
|
|
168
|
+
rejects it with Msg 257. Converting it would silently round instead.
|
|
169
|
+
- **`numeric`/`decimal` declared without a precision.** ASE defaults a bare
|
|
170
|
+
`numeric` to `(18,0)`, which would round every fraction away, so
|
|
171
|
+
`numeric("col")` never gets a `CONVERT`. Declare the width the column actually
|
|
172
|
+
has — `numeric("col", { precision: 19, scale: 4 })` — and it works. Introspected
|
|
173
|
+
schemas always carry the width, so this only affects hand-written ones.
|
|
174
|
+
|
|
175
|
+
`insertId` after an `INSERT` follows the same rule. `@@identity` is
|
|
176
|
+
`numeric(38,0)`, so an identity past 2^53 has no exact `number`; `insertId` is
|
|
177
|
+
`undefined` in that case and `insertIdText` carries the digits, which is always
|
|
178
|
+
populated when the table has an identity column.
|
|
179
|
+
|
|
180
|
+
### Serializing rows that contain a `bigint`
|
|
181
|
+
|
|
182
|
+
`bigint` columns come back as `BigInt`, which `JSON.stringify` refuses to
|
|
183
|
+
serialize. Nothing in the type system catches this, so anywhere a row reaches
|
|
184
|
+
JSON — an API response, a log line, a cache write — needs a replacer:
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
JSON.stringify(rows, (_, v) => (typeof v === "bigint" ? v.toString() : v));
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
### Arbitrary-precision arithmetic
|
|
191
|
+
|
|
192
|
+
The driver deliberately does none, and needs no decimal library: exact numerics
|
|
193
|
+
cross the wire as digit strings and `CONVERT` has ASE parse them server-side at
|
|
194
|
+
full precision. If you need to _compute_ with them, do it in your own code with
|
|
195
|
+
whichever library you already use, and hand back a plain decimal string:
|
|
196
|
+
|
|
197
|
+
```ts
|
|
198
|
+
import Decimal from "decimal.js";
|
|
199
|
+
|
|
200
|
+
const total = new Decimal(row.totPrRoyalty).plus("0.0001");
|
|
201
|
+
await db.update(winf).set({ totPrRoyalty: total.toFixed(4) }).where(...);
|
|
202
|
+
```
|
|
203
|
+
|
|
204
|
+
`$mapToDriver` can do that last step per column. There is no `$mapFromDriver`:
|
|
205
|
+
results are decoded from the type metadata the addon reports, and at that point
|
|
206
|
+
the query's schema is no longer available — `db.select()` may return `*`, joined
|
|
207
|
+
columns can share a name, and an aggregate belongs to no column. Converting on
|
|
208
|
+
read is a line at the use site instead.
|
|
209
|
+
|
|
210
|
+
A bare value interpolated into a raw `sql` template carries no column, so nothing
|
|
211
|
+
can be inferred for it. Bind it explicitly when the target is an exact numeric:
|
|
212
|
+
|
|
213
|
+
```ts
|
|
214
|
+
// Rejected by ASE — the literal is a plain string
|
|
215
|
+
await db.execute(sql`select * from WINF where tot_pr_royalty = ${"1.5000"}`);
|
|
216
|
+
|
|
217
|
+
// Converted, because the parameter knows its column
|
|
218
|
+
await db.execute(
|
|
219
|
+
sql`select * from WINF where tot_pr_royalty = ${sql.param("1.5000", winf.totPrRoyalty)}`
|
|
220
|
+
);
|
|
221
|
+
```
|
|
222
|
+
|
|
223
|
+
## Date and Time Columns
|
|
224
|
+
|
|
225
|
+
`datetime` and `smalldatetime` are always returned as `Date`, and `Date` values
|
|
226
|
+
are always written as `'YYYY-MM-DD HH:MM:SS.mmm'`. The type never varies with
|
|
227
|
+
configuration, so a row is never sometimes a `Date` and sometimes a string.
|
|
228
|
+
|
|
229
|
+
These columns store a naive wall clock — no offset, no zone — so `timeZone` says
|
|
230
|
+
which zone that wall clock belongs to. It applies to both directions and defaults
|
|
231
|
+
to `UTC`:
|
|
232
|
+
|
|
233
|
+
```ts
|
|
234
|
+
const db = createSybaseDrizzle({
|
|
235
|
+
/* ... */
|
|
236
|
+
timeZone: "Australia/Sydney"
|
|
237
|
+
});
|
|
238
|
+
```
|
|
239
|
+
|
|
240
|
+
An invalid zone is rejected when the connection is created, not on the first
|
|
241
|
+
query. Leaving `timeZone` unset makes reads and writes exact inverses in UTC,
|
|
242
|
+
which is correct as long as nothing else interprets the stored values; set it when
|
|
243
|
+
the stored wall clocks are meant to be a particular zone's local time.
|
|
244
|
+
|
|
245
|
+
A stored wall clock cannot always be mapped to one instant, because the column
|
|
246
|
+
holds no offset. Both cases follow `Temporal`'s `compatible` disambiguation,
|
|
247
|
+
which is also what `new Date("YYYY-MM-DDTHH:mm")` does with the process zone:
|
|
248
|
+
|
|
249
|
+
- **A wall clock a backward transition repeats** matches two instants. The
|
|
250
|
+
**earlier** one is returned.
|
|
251
|
+
- **A wall clock a forward transition skips** matches none. It is moved forward
|
|
252
|
+
by the size of the jump — what the zone's clocks did. Only reachable for values
|
|
253
|
+
written by something other than this driver, since the driver never writes a
|
|
254
|
+
wall clock that does not exist.
|
|
255
|
+
|
|
256
|
+
A `Date` outside what an ASE `datetime` can hold — before 1753-01-01 or after
|
|
257
|
+
9999-12-31 **on the server's clock** — is rejected before the statement is built,
|
|
258
|
+
rather than sent as a literal ASE answers with an arithmetic-overflow error that
|
|
259
|
+
names neither the column nor the value.
|
|
260
|
+
|
|
261
|
+
`date`, `time`, `bigdatetime` and `bigtime` are returned as canonical text
|
|
262
|
+
(`2016-06-09`, `09:48:46.753`, `2016-06-09 09:48:46.753456`) rather than `Date`: a
|
|
263
|
+
bare date or time is not an instant, and `bigdatetime`/`bigtime` carry microseconds
|
|
264
|
+
that a `Date` would silently truncate.
|
|
265
|
+
|
|
266
|
+
All of these are formatted by the native addon from the raw value, not by db-lib's
|
|
267
|
+
text conversion. db-lib formats through a locale-dependent format string, which in
|
|
268
|
+
several common locales drops the seconds and milliseconds entirely — under
|
|
269
|
+
`LANG=it_IT.UTF-8` the same value comes out as `09/06/2016 09:48`.
|
|
270
|
+
|
|
143
271
|
## Schema Introspection (generate schema from an existing database)
|
|
144
272
|
|
|
145
273
|
Reverse-engineer Sybase ASE tables into drizzle-sybase definitions, Zod
|
|
@@ -178,9 +306,7 @@ warnings.forEach(w => console.warn(w));
|
|
|
178
306
|
writeFileSync("src/drizzle/generated/sybase.ts", code);
|
|
179
307
|
|
|
180
308
|
// Or reuse an existing db/pool (e.g. credentials from a secrets manager):
|
|
181
|
-
const db = createSybaseDrizzle({
|
|
182
|
-
/* ... */
|
|
183
|
-
});
|
|
309
|
+
const db = createSybaseDrizzle({/* ... */});
|
|
184
310
|
const result = await introspectWith(db, { database: "mydb", tables: ["USERS"] });
|
|
185
311
|
```
|
|
186
312
|
|
|
@@ -195,6 +321,28 @@ and emits:
|
|
|
195
321
|
- Zod select schemas (`<table>Schema` + `<Table>Row` type)
|
|
196
322
|
- Zod insert schemas (`<table>InsertSchema` + `New<Table>` type, identity columns excluded)
|
|
197
323
|
|
|
324
|
+
The two are not mirror images. `<Table>Row` describes what the driver actually
|
|
325
|
+
returns, so exact numerics are `z.string()` (digits intact) and `bigint` is
|
|
326
|
+
`z.bigint()`; it never coerces, because a coercion there would only paper over a
|
|
327
|
+
row type that disagrees with reality.
|
|
328
|
+
|
|
329
|
+
The insert schema accepts every type the column can hold **without losing
|
|
330
|
+
digits**, and no others:
|
|
331
|
+
|
|
332
|
+
| Column width | Insert accepts |
|
|
333
|
+
| ---------------------------------- | ------------------------------------------------ |
|
|
334
|
+
| scale 0, precision ≤ 15 | `number` (integer) or an integer string |
|
|
335
|
+
| scale > 0, precision ≤ 15 | `number` or a decimal string |
|
|
336
|
+
| scale 0, precision > 15 (`bigint`) | `BigInt` or an integer string — **not** `number` |
|
|
337
|
+
| scale > 0, precision > 15 | a decimal string only |
|
|
338
|
+
|
|
339
|
+
A plain `number` is refused for integers wider than a double on purpose:
|
|
340
|
+
`9007199254740993` has already become `...992` before any validator sees it, so
|
|
341
|
+
`z.coerce.bigint()` would report success on a value that had silently lost a
|
|
342
|
+
digit. The string forms are constrained to plain digit literals, which is exactly
|
|
343
|
+
what the dialect can write — anything else would reach ASE as a quoted value and
|
|
344
|
+
come back as Msg 257, so it fails validation instead.
|
|
345
|
+
|
|
198
346
|
Unmapped Sybase types fall back to `varchar` and are reported via `warnings`.
|
|
199
347
|
|
|
200
348
|
## License
|
package/dist/codecs.d.ts
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codecs for Sybase types that need a CONVERT around inlined parameters.
|
|
3
|
+
*
|
|
4
|
+
* ASE refuses to compare or assign a quoted literal against an exact numeric
|
|
5
|
+
* type:
|
|
6
|
+
*
|
|
7
|
+
* Msg 257: Implicit conversion from datatype 'VARCHAR' to 'MONEY' is not
|
|
8
|
+
* allowed. Use the CONVERT function to run this query.
|
|
9
|
+
*
|
|
10
|
+
* These are exactly the types the native driver returns as strings (see
|
|
11
|
+
* `binding.c`: money and decimal are handed over as text so no digits are
|
|
12
|
+
* lost), so without a CONVERT they could be read but never written back or
|
|
13
|
+
* filtered on — `money` alone needs 19 significant digits and a JS double
|
|
14
|
+
* carries about 15.
|
|
15
|
+
*
|
|
16
|
+
* CONVERT parses the digits server-side at full precision, so no JS double is
|
|
17
|
+
* involved and nothing is lost: money 922337203685477.5807, numeric(19,4)
|
|
18
|
+
* 999999999999999.9999 and numeric(20,0) 99999999999999999999 all round-trip
|
|
19
|
+
* exactly.
|
|
20
|
+
*
|
|
21
|
+
* ASE would equally accept the digits emitted bare, unquoted, and since only
|
|
22
|
+
* values matching {@link QUOTED_DECIMAL_LITERAL} are ever rewritten that would
|
|
23
|
+
* be no less safe against injection. CONVERT is used instead because it keeps
|
|
24
|
+
* the *target's* width in the statement: a value too precise for the column is
|
|
25
|
+
* then a hard error rather than something ASE quietly rounds on the way in. See
|
|
26
|
+
* {@link castExactNumericLiteral} for how that guard is applied.
|
|
27
|
+
*/
|
|
28
|
+
import type { Codecs } from "drizzle-orm/codecs";
|
|
29
|
+
/** Type keys of the codecs below; set as `codec` on the matching columns. */
|
|
30
|
+
export declare const EXACT_NUMERIC_TYPES: readonly ["money", "smallmoney", "bigint", "numeric", "decimal"];
|
|
31
|
+
/**
|
|
32
|
+
* Column shape the helpers here rely on. Satisfied by `SybaseColumn` and by
|
|
33
|
+
* drizzle-orm's `Column`, both of which always expose `getSQLType()`.
|
|
34
|
+
*/
|
|
35
|
+
export interface SqlTypedColumn {
|
|
36
|
+
getSQLType?: () => unknown;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Wrap an already-escaped literal in CONVERT when the column requires it.
|
|
40
|
+
*
|
|
41
|
+
* Returns the literal untouched when the target is not an exact numeric with a
|
|
42
|
+
* known scale, when the literal is not a plain quoted decimal, or when it
|
|
43
|
+
* carries more fraction digits than the target keeps. That last guard matters:
|
|
44
|
+
* `'1.5'` against `bigint` is a hard error today (Msg 257), and wrapping it
|
|
45
|
+
* would turn that into a silent round to 2. Refusing to convert keeps the loud
|
|
46
|
+
* failure, which is the whole point of this module.
|
|
47
|
+
*/
|
|
48
|
+
export declare const castExactNumericLiteral: (literal: string, col: SqlTypedColumn) => string;
|
|
49
|
+
/**
|
|
50
|
+
* Applied by drizzle-orm to inlined parameters (WHERE, JOIN ... ON, HAVING),
|
|
51
|
+
* which do not pass through `SybaseDialect#serializeColumnValue`.
|
|
52
|
+
*/
|
|
53
|
+
export declare const SYBASE_CODECS: Codecs;
|
|
54
|
+
//# sourceMappingURL=codecs.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs.d.ts","sourceRoot":"","sources":["../src/codecs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAEH,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAEjD,6EAA6E;AAC7E,eAAO,MAAM,mBAAmB,YAAI,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,CAAU,CAAC;AAEpG;;;GAGG;AACH,MAAM,WAAW,cAAc;IAC7B,UAAU,CAAC,EAAE,MAAM,OAAO,CAAC;CAC5B;AA2DD;;;;;;;;;GASG;AACH,eAAO,MAAM,uBAAuB,YAAa,MAAM,OAAO,cAAc,KAAG,MAU9E,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAQ3B,CAAC"}
|
package/dist/codecs.js
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Codecs for Sybase types that need a CONVERT around inlined parameters.
|
|
3
|
+
*
|
|
4
|
+
* ASE refuses to compare or assign a quoted literal against an exact numeric
|
|
5
|
+
* type:
|
|
6
|
+
*
|
|
7
|
+
* Msg 257: Implicit conversion from datatype 'VARCHAR' to 'MONEY' is not
|
|
8
|
+
* allowed. Use the CONVERT function to run this query.
|
|
9
|
+
*
|
|
10
|
+
* These are exactly the types the native driver returns as strings (see
|
|
11
|
+
* `binding.c`: money and decimal are handed over as text so no digits are
|
|
12
|
+
* lost), so without a CONVERT they could be read but never written back or
|
|
13
|
+
* filtered on — `money` alone needs 19 significant digits and a JS double
|
|
14
|
+
* carries about 15.
|
|
15
|
+
*
|
|
16
|
+
* CONVERT parses the digits server-side at full precision, so no JS double is
|
|
17
|
+
* involved and nothing is lost: money 922337203685477.5807, numeric(19,4)
|
|
18
|
+
* 999999999999999.9999 and numeric(20,0) 99999999999999999999 all round-trip
|
|
19
|
+
* exactly.
|
|
20
|
+
*
|
|
21
|
+
* ASE would equally accept the digits emitted bare, unquoted, and since only
|
|
22
|
+
* values matching {@link QUOTED_DECIMAL_LITERAL} are ever rewritten that would
|
|
23
|
+
* be no less safe against injection. CONVERT is used instead because it keeps
|
|
24
|
+
* the *target's* width in the statement: a value too precise for the column is
|
|
25
|
+
* then a hard error rather than something ASE quietly rounds on the way in. See
|
|
26
|
+
* {@link castExactNumericLiteral} for how that guard is applied.
|
|
27
|
+
*/
|
|
28
|
+
/** Type keys of the codecs below; set as `codec` on the matching columns. */
|
|
29
|
+
export const EXACT_NUMERIC_TYPES = ["money", "smallmoney", "bigint", "numeric", "decimal"];
|
|
30
|
+
/** Declared SQL type of a column, or `""` for anything that cannot report one. */
|
|
31
|
+
const columnSqlType = (col) => {
|
|
32
|
+
const sqlType = typeof col.getSQLType === "function" ? col.getSQLType() : undefined;
|
|
33
|
+
return typeof sqlType === "string" ? sqlType.trim() : "";
|
|
34
|
+
};
|
|
35
|
+
/** Scales fixed by the type itself, for types that declare no precision/scale. */
|
|
36
|
+
const FIXED_SCALES = {
|
|
37
|
+
money: 4,
|
|
38
|
+
smallmoney: 4,
|
|
39
|
+
bigint: 0
|
|
40
|
+
};
|
|
41
|
+
/**
|
|
42
|
+
* `numeric` / `decimal` with a declared width, capturing the scale.
|
|
43
|
+
*
|
|
44
|
+
* A bare `numeric`/`decimal` deliberately does not match: ASE would default it
|
|
45
|
+
* to (18,0) and silently round the fraction away, so those are left to fail
|
|
46
|
+
* loudly rather than lose digits. Precision must be non-zero, since
|
|
47
|
+
* `convert(numeric(0), ...)` is not valid SQL.
|
|
48
|
+
*/
|
|
49
|
+
const SIZED_DECIMAL = /^(?:numeric|decimal)\s*\(\s*[1-9]\d*\s*(?:,\s*(\d+)\s*)?\)$/i;
|
|
50
|
+
/**
|
|
51
|
+
* Digits after the point the target keeps, or `undefined` when the type is not
|
|
52
|
+
* an exact numeric that needs converting. This is the single gate: a type is
|
|
53
|
+
* convertible exactly when it has a known scale.
|
|
54
|
+
*/
|
|
55
|
+
const declaredScale = (sqlType) => {
|
|
56
|
+
const fixed = FIXED_SCALES[sqlType.toLowerCase()];
|
|
57
|
+
if (fixed !== undefined) {
|
|
58
|
+
return fixed;
|
|
59
|
+
}
|
|
60
|
+
const match = SIZED_DECIMAL.exec(sqlType);
|
|
61
|
+
// ASE defaults an undeclared scale to 0.
|
|
62
|
+
return match ? Number(match[1] ?? 0) : undefined;
|
|
63
|
+
};
|
|
64
|
+
/**
|
|
65
|
+
* A decimal literal as it appears in the statement, i.e. after `escapeString`.
|
|
66
|
+
*
|
|
67
|
+
* Matching on the quoted form is what makes this safe to apply to arbitrary
|
|
68
|
+
* serialized values: bare numbers, `NULL`, hex blobs and date literals all fail
|
|
69
|
+
* it, and so does any string that is not purely digits — including one carrying
|
|
70
|
+
* a quote, which could otherwise reach the parser through CONVERT's argument.
|
|
71
|
+
*/
|
|
72
|
+
const QUOTED_DECIMAL_LITERAL = /^'[+-]?(?:\d+(?:\.\d*)?|\.\d+)'$/;
|
|
73
|
+
/** Significant digits after the point; trailing zeros carry no value. */
|
|
74
|
+
const fractionDigits = (literal) => {
|
|
75
|
+
const point = literal.indexOf(".");
|
|
76
|
+
if (point < 0) {
|
|
77
|
+
return 0;
|
|
78
|
+
}
|
|
79
|
+
return literal.slice(point + 1).replace(/0+$/, "").length;
|
|
80
|
+
};
|
|
81
|
+
/**
|
|
82
|
+
* Wrap an already-escaped literal in CONVERT when the column requires it.
|
|
83
|
+
*
|
|
84
|
+
* Returns the literal untouched when the target is not an exact numeric with a
|
|
85
|
+
* known scale, when the literal is not a plain quoted decimal, or when it
|
|
86
|
+
* carries more fraction digits than the target keeps. That last guard matters:
|
|
87
|
+
* `'1.5'` against `bigint` is a hard error today (Msg 257), and wrapping it
|
|
88
|
+
* would turn that into a silent round to 2. Refusing to convert keeps the loud
|
|
89
|
+
* failure, which is the whole point of this module.
|
|
90
|
+
*/
|
|
91
|
+
export const castExactNumericLiteral = (literal, col) => {
|
|
92
|
+
if (!QUOTED_DECIMAL_LITERAL.test(literal)) {
|
|
93
|
+
return literal;
|
|
94
|
+
}
|
|
95
|
+
const sqlType = columnSqlType(col);
|
|
96
|
+
const scale = declaredScale(sqlType);
|
|
97
|
+
if (scale === undefined || fractionDigits(literal.slice(1, -1)) > scale) {
|
|
98
|
+
return literal;
|
|
99
|
+
}
|
|
100
|
+
return `convert(${sqlType}, ${literal})`;
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* Applied by drizzle-orm to inlined parameters (WHERE, JOIN ... ON, HAVING),
|
|
104
|
+
* which do not pass through `SybaseDialect#serializeColumnValue`.
|
|
105
|
+
*/
|
|
106
|
+
export const SYBASE_CODECS = Object.fromEntries(EXACT_NUMERIC_TYPES.map(type => [
|
|
107
|
+
type,
|
|
108
|
+
{
|
|
109
|
+
castParam: (name, column) => castExactNumericLiteral(name, column)
|
|
110
|
+
}
|
|
111
|
+
]));
|
|
112
|
+
//# sourceMappingURL=codecs.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"codecs.js","sourceRoot":"","sources":["../src/codecs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAIH,6EAA6E;AAC7E,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE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AO,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC,MAAM,CAAC;AAC5D,CAAC,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAe,EAAE,GAAmB,EAAU,EAAE;IACtF,IAAI,CAAC,sBAAsB,CAAC,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1C,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,MAAM,OAAO,GAAG,aAAa,CAAC,GAAG,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,aAAa,CAAC,OAAO,CAAC,CAAC;IACrC,IAAI,KAAK,KAAK,SAAS,IAAI,cAAc,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,KAAK,EAAE,CAAC;QACxE,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,WAAW,OAAO,KAAK,OAAO,GAAG,CAAC;AAC3C,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,MAAM,aAAa,GAAW,MAAM,CAAC,WAAW,CACrD,mBAAmB,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;IAC9B,IAAI;IACJ;QACE,SAAS,EAAE,CAAC,IAAY,EAAE,MAAe,EAAE,EAAE,CAC3C,uBAAuB,CAAC,IAAI,EAAE,MAAwB,CAAC;KAC1D;CACF,CAAC,CACH,CAAC"}
|
package/dist/columns/index.d.ts
CHANGED
|
@@ -27,7 +27,22 @@ export declare class SybaseColumn {
|
|
|
27
27
|
dataType: string;
|
|
28
28
|
columnType: string;
|
|
29
29
|
identity: boolean;
|
|
30
|
-
|
|
30
|
+
/**
|
|
31
|
+
* Codec key read by drizzle-orm when it inlines a parameter, so types that
|
|
32
|
+
* need a CONVERT around the literal get one in WHERE / JOIN ... ON / HAVING
|
|
33
|
+
* too — those build their SQL from drizzle's chunks, not through
|
|
34
|
+
* `SybaseDialect#serializeColumnValue`. Left undefined for types that need no
|
|
35
|
+
* codec, which makes the lookup a no-op.
|
|
36
|
+
*/
|
|
37
|
+
codec: string | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* Applied by the dialect when a value is written. There is deliberately no
|
|
40
|
+
* read-side counterpart: results are decoded from the type metadata the addon
|
|
41
|
+
* reports (see `columnTypes`), and by then the schema that produced the query
|
|
42
|
+
* is no longer in hand — `db.select()` may return `*`, joined columns can share
|
|
43
|
+
* a name, and an aggregate belongs to no column at all. A hook that silently
|
|
44
|
+
* applied to some of those and not others would be worse than none.
|
|
45
|
+
*/
|
|
31
46
|
mapToDriverValue: (value: any) => any;
|
|
32
47
|
constructor(table: any, config: SybaseColumnConfig);
|
|
33
48
|
getSQLType(): string;
|
|
@@ -45,7 +60,6 @@ export interface SybaseColumnConfig {
|
|
|
45
60
|
dataType?: string;
|
|
46
61
|
columnType?: string;
|
|
47
62
|
identity?: boolean;
|
|
48
|
-
mapFromDriverValue?: (value: any) => any;
|
|
49
63
|
mapToDriverValue?: (value: any) => any;
|
|
50
64
|
}
|
|
51
65
|
export declare class SybaseColumnBuilder {
|
|
@@ -62,10 +76,6 @@ export declare class SybaseColumnBuilder {
|
|
|
62
76
|
* Set a custom mapToDriverValue function for this column.
|
|
63
77
|
*/
|
|
64
78
|
$mapToDriver(fn: (value: any) => any): this;
|
|
65
|
-
/**
|
|
66
|
-
* Set a custom mapFromDriverValue function for this column.
|
|
67
|
-
*/
|
|
68
|
-
$mapFromDriver(fn: (value: any) => any): this;
|
|
69
79
|
/** @internal — called by sybaseTable to produce the final Column object */
|
|
70
80
|
build(table: any): SybaseColumn;
|
|
71
81
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/columns/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/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
|
10
11
|
// We use the entityKind symbol to make our classes recognized by drizzle-orm's
|
|
11
12
|
// `is()` function without needing to extend the heavily-generic base classes.
|
|
12
13
|
const entityKind = Symbol.for("drizzle:entityKind");
|
|
14
|
+
/** Codec keys, by the base type name a declared SQL type starts with. */
|
|
15
|
+
const CODEC_KEYS = new Set(EXACT_NUMERIC_TYPES);
|
|
16
|
+
/**
|
|
17
|
+
* Codec key for a declared SQL type, or `undefined` when the type needs none.
|
|
18
|
+
* The width is stripped, so `numeric(19,4)` and `numeric` share one codec — the
|
|
19
|
+
* codec re-reads the full type from the column when it matters.
|
|
20
|
+
*/
|
|
21
|
+
function codecKey(dataType) {
|
|
22
|
+
const base = dataType.replace(/\s*\(.*$/, "").toLowerCase();
|
|
23
|
+
return CODEC_KEYS.has(base) ? base : undefined;
|
|
24
|
+
}
|
|
13
25
|
// ---------------------------------------------------------------------------
|
|
14
26
|
// SybaseColumn — the built column instance attached to tables
|
|
15
27
|
// ---------------------------------------------------------------------------
|
|
@@ -34,7 +46,22 @@ export class SybaseColumn {
|
|
|
34
46
|
dataType;
|
|
35
47
|
columnType;
|
|
36
48
|
identity;
|
|
37
|
-
|
|
49
|
+
/**
|
|
50
|
+
* Codec key read by drizzle-orm when it inlines a parameter, so types that
|
|
51
|
+
* need a CONVERT around the literal get one in WHERE / JOIN ... ON / HAVING
|
|
52
|
+
* too — those build their SQL from drizzle's chunks, not through
|
|
53
|
+
* `SybaseDialect#serializeColumnValue`. Left undefined for types that need no
|
|
54
|
+
* codec, which makes the lookup a no-op.
|
|
55
|
+
*/
|
|
56
|
+
codec;
|
|
57
|
+
/**
|
|
58
|
+
* Applied by the dialect when a value is written. There is deliberately no
|
|
59
|
+
* read-side counterpart: results are decoded from the type metadata the addon
|
|
60
|
+
* reports (see `columnTypes`), and by then the schema that produced the query
|
|
61
|
+
* is no longer in hand — `db.select()` may return `*`, joined columns can share
|
|
62
|
+
* a name, and an aggregate belongs to no column at all. A hook that silently
|
|
63
|
+
* applied to some of those and not others would be worse than none.
|
|
64
|
+
*/
|
|
38
65
|
mapToDriverValue;
|
|
39
66
|
constructor(table, config) {
|
|
40
67
|
this.table = table;
|
|
@@ -48,7 +75,7 @@ export class SybaseColumn {
|
|
|
48
75
|
this.dataType = config.dataType ?? "string";
|
|
49
76
|
this.columnType = config.columnType ?? "SybaseColumn";
|
|
50
77
|
this.identity = config.identity ?? false;
|
|
51
|
-
this.
|
|
78
|
+
this.codec = codecKey(this.dataType);
|
|
52
79
|
this.mapToDriverValue = config.mapToDriverValue ?? ((v) => v);
|
|
53
80
|
}
|
|
54
81
|
getSQLType() {
|
|
@@ -126,13 +153,6 @@ export class SybaseColumnBuilder {
|
|
|
126
153
|
this._config.mapToDriverValue = fn;
|
|
127
154
|
return this;
|
|
128
155
|
}
|
|
129
|
-
/**
|
|
130
|
-
* Set a custom mapFromDriverValue function for this column.
|
|
131
|
-
*/
|
|
132
|
-
$mapFromDriver(fn) {
|
|
133
|
-
this._config.mapFromDriverValue = fn;
|
|
134
|
-
return this;
|
|
135
|
-
}
|
|
136
156
|
/** @internal — called by sybaseTable to produce the final Column object */
|
|
137
157
|
build(table) {
|
|
138
158
|
return new SybaseColumn(table, this._config);
|
|
@@ -145,40 +165,37 @@ export const int = (name) => new SybaseColumnBuilder(name, "int");
|
|
|
145
165
|
export const bigint = (name) => new SybaseColumnBuilder(name, "bigint");
|
|
146
166
|
export const smallint = (name) => new SybaseColumnBuilder(name, "smallint");
|
|
147
167
|
export const tinyint = (name) => new SybaseColumnBuilder(name, "tinyint");
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
168
|
+
/**
|
|
169
|
+
* A type whose width is a single length, e.g. `varchar(30)`.
|
|
170
|
+
*
|
|
171
|
+
* A length of 0 is treated as absent, so the type is emitted bare — ASE supplies
|
|
172
|
+
* its own default and a `varchar(0)` would be rejected.
|
|
173
|
+
*/
|
|
174
|
+
const sizedByLength = (type) => (name, opts) => new SybaseColumnBuilder(name, opts?.length ? `${type}(${opts.length})` : type);
|
|
175
|
+
/** A type whose width is a precision and an optional scale, e.g. `numeric(19,4)`. */
|
|
176
|
+
const sizedByPrecision = (type) => (name, opts) => {
|
|
177
|
+
if (opts?.precision === undefined) {
|
|
178
|
+
return new SybaseColumnBuilder(name, type);
|
|
179
|
+
}
|
|
180
|
+
const width = opts.scale === undefined ? `${opts.precision}` : `${opts.precision},${opts.scale}`;
|
|
181
|
+
return new SybaseColumnBuilder(name, `${type}(${width})`);
|
|
182
|
+
};
|
|
183
|
+
export const varchar = sizedByLength("varchar");
|
|
184
|
+
export const nvarchar = sizedByLength("nvarchar");
|
|
185
|
+
export const char = sizedByLength("char");
|
|
186
|
+
export const nchar = sizedByLength("nchar");
|
|
152
187
|
export const text = (name) => new SybaseColumnBuilder(name, "text");
|
|
153
188
|
export const ntext = (name) => new SybaseColumnBuilder(name, "ntext");
|
|
154
189
|
export const datetime = (name) => new SybaseColumnBuilder(name, "datetime");
|
|
155
190
|
export const smalldatetime = (name) => new SybaseColumnBuilder(name, "smalldatetime");
|
|
156
|
-
export const numeric = (
|
|
157
|
-
|
|
158
|
-
if (opts?.precision !== undefined) {
|
|
159
|
-
type =
|
|
160
|
-
opts.scale !== undefined
|
|
161
|
-
? `numeric(${opts.precision},${opts.scale})`
|
|
162
|
-
: `numeric(${opts.precision})`;
|
|
163
|
-
}
|
|
164
|
-
return new SybaseColumnBuilder(name, type);
|
|
165
|
-
};
|
|
166
|
-
export const decimal = (name, opts) => {
|
|
167
|
-
let type = "decimal";
|
|
168
|
-
if (opts?.precision !== undefined) {
|
|
169
|
-
type =
|
|
170
|
-
opts.scale !== undefined
|
|
171
|
-
? `decimal(${opts.precision},${opts.scale})`
|
|
172
|
-
: `decimal(${opts.precision})`;
|
|
173
|
-
}
|
|
174
|
-
return new SybaseColumnBuilder(name, type);
|
|
175
|
-
};
|
|
191
|
+
export const numeric = sizedByPrecision("numeric");
|
|
192
|
+
export const decimal = sizedByPrecision("decimal");
|
|
176
193
|
export const float = (name) => new SybaseColumnBuilder(name, "float");
|
|
177
194
|
export const real = (name) => new SybaseColumnBuilder(name, "real");
|
|
178
195
|
export const money = (name) => new SybaseColumnBuilder(name, "money");
|
|
179
196
|
export const smallmoney = (name) => new SybaseColumnBuilder(name, "smallmoney");
|
|
180
197
|
export const bit = (name) => new SybaseColumnBuilder(name, "bit");
|
|
181
|
-
export const binary = (
|
|
182
|
-
export const varbinary = (
|
|
198
|
+
export const binary = sizedByLength("binary");
|
|
199
|
+
export const varbinary = sizedByLength("varbinary");
|
|
183
200
|
export const image = (name) => new SybaseColumnBuilder(name, "image");
|
|
184
201
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/columns/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,+EAA+E;AAC/E,8EAA8E;AAC9E,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;AAEpD,8EAA8E;AAC9E,8DAA8D;AAC9D,8EAA8E;AAE9E;;;;GAIG;AACH,MAAM,OAAO,YAAY;IACvB,MAAM,CAAC,CAAC,UAAU,CAAC,GAAG,cAAc,CAAC;IAErC,0EAA0E;IAC1E,IAAI,CAAS;IACb,KAAK,CAAM;IACX,OAAO,GAAG,KAAK,CAAC;IAEhB,wCAAwC;IACxC,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,OAAO,CAAU;IACjB,SAAS,CAAiB;IAC1B,UAAU,CAAiB;IAC3B,UAAU,CAAU;IACpB,QAAQ,CAAS;IACjB,UAAU,CAAS;IACnB,QAAQ,CAAU;IAClB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/columns/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,mBAAmB,EAAE,MAAM,cAAc,CAAC;AAEnD,+EAA+E;AAC/E,8EAA8E;AAC9E,MAAM,UA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AAC,CAAC;AAC9E,MAAM,CAAC,MAAM,IAAI,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAC5E,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC9E,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,EAAE,YAAY,CAAC,CAAC;AAExF,MAAM,CAAC,MAAM,GAAG,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;AAE1E,MAAM,CAAC,MAAM,MAAM,GAAG,aAAa,CAAC,QAAQ,CAAC,CAAC;AAC9C,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC,WAAW,CAAC,CAAC;AACpD,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,mBAAmB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/connection.d.ts
CHANGED
|
@@ -21,6 +21,20 @@ export interface SybaseConnectionConfig {
|
|
|
21
21
|
* Defaults to `max(2 * timeout * 1000, 30000)` on the native side.
|
|
22
22
|
*/
|
|
23
23
|
hardTimeoutMs?: number;
|
|
24
|
+
/**
|
|
25
|
+
* IANA zone the ASE server keeps its clocks in, e.g. `Australia/Sydney`.
|
|
26
|
+
* Default: `UTC`.
|
|
27
|
+
*
|
|
28
|
+
* `datetime` / `smalldatetime` columns store a naive wall clock with no
|
|
29
|
+
* offset, so this is the only way the driver can map them to instants. It is
|
|
30
|
+
* used in both directions: `Date` values are written as this zone's wall clock
|
|
31
|
+
* and datetime columns are read back as the `Date` that wall clock denotes
|
|
32
|
+
* here. Leaving it unset makes reads and writes exact inverses in UTC, which
|
|
33
|
+
* is correct as long as nothing else interprets the stored values.
|
|
34
|
+
*
|
|
35
|
+
* Validated when the connection is created, not on first use.
|
|
36
|
+
*/
|
|
37
|
+
timeZone?: string;
|
|
24
38
|
}
|
|
25
39
|
export interface SybasePoolConfig extends SybaseConnectionConfig {
|
|
26
40
|
/** Maximum connections in pool. Default: 5 */
|
|
@@ -43,6 +57,12 @@ export interface SybasePoolConfig extends SybaseConnectionConfig {
|
|
|
43
57
|
export interface QueryResult<T = Record<string, unknown>> {
|
|
44
58
|
rows: T[];
|
|
45
59
|
columns: string[];
|
|
60
|
+
/**
|
|
61
|
+
* Sybase system type name per column, in column order (`datetime`, `money`,
|
|
62
|
+
* `varchar`, ...). Reported by the native addon so results can be decoded by
|
|
63
|
+
* type even for raw SQL with no schema attached.
|
|
64
|
+
*/
|
|
65
|
+
columnTypes: string[];
|
|
46
66
|
rowCount: number;
|
|
47
67
|
affectedRows: number;
|
|
48
68
|
}
|
package/dist/connection.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"connection.d.ts","sourceRoot":"","sources":["../src/connection.ts"],"names":[],"mappings":"AA6BA,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,uDAAuD;IACvD,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;;;;;OAQG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;;;;;;;;;;OAYG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,gBAAiB,SAAQ,sBAAsB;IAC9D,8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