@voltro/sql-mssql 0.84.0 → 0.86.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/CHANGELOG.md +1215 -0
- package/THIRD-PARTY-NOTICES.md +12 -124
- package/dist/binaryParameter.js +9 -0
- package/dist/cdcOffsetsTable.js +1 -0
- package/dist/changeTrackingCdc.js +111 -0
- package/dist/index.d.ts +10 -7
- package/dist/index.js +12 -812
- package/dist/numberParameter.js +19 -0
- package/dist/replicationAdapter.js +35 -0
- package/dist/retry.js +20 -0
- package/dist/rowResultProjection.js +16 -0
- package/dist/sqlLayer.js +78 -0
- package/dist/store.js +553 -0
- package/dist/writeOutput.js +18 -0
- package/package.json +6 -7
package/THIRD-PARTY-NOTICES.md
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
# Third-Party Notices — @voltro/sql-mssql
|
|
2
2
|
|
|
3
|
-
This package
|
|
3
|
+
This package uses the open-source software listed below. Each is the
|
|
4
4
|
property of its respective copyright holders and is used under the terms of
|
|
5
5
|
its license. This file is provided for attribution; it grants no rights in
|
|
6
6
|
@voltro/sql-mssql itself, which is proprietary (see LICENSE).
|
|
7
7
|
|
|
8
|
-
Generated from the resolved runtime dependency closure (
|
|
8
|
+
Generated from the resolved runtime dependency closure (72 packages).
|
|
9
9
|
|
|
10
10
|
---
|
|
11
11
|
|
|
@@ -121,34 +121,6 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
121
121
|
SOFTWARE.
|
|
122
122
|
```
|
|
123
123
|
|
|
124
|
-
## @azure/core-http-compat@2.4.0
|
|
125
|
-
|
|
126
|
-
License: MIT
|
|
127
|
-
|
|
128
|
-
```
|
|
129
|
-
Copyright (c) Microsoft Corporation.
|
|
130
|
-
|
|
131
|
-
MIT License
|
|
132
|
-
|
|
133
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
134
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
135
|
-
in the Software without restriction, including without limitation the rights
|
|
136
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
137
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
138
|
-
furnished to do so, subject to the following conditions:
|
|
139
|
-
|
|
140
|
-
The above copyright notice and this permission notice shall be included in all
|
|
141
|
-
copies or substantial portions of the Software.
|
|
142
|
-
|
|
143
|
-
THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
144
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
145
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
146
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
147
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
148
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
149
|
-
SOFTWARE.
|
|
150
|
-
```
|
|
151
|
-
|
|
152
124
|
## @azure/core-lro@2.7.2
|
|
153
125
|
|
|
154
126
|
License: MIT
|
|
@@ -345,7 +317,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
345
317
|
SOFTWARE.
|
|
346
318
|
```
|
|
347
319
|
|
|
348
|
-
## @azure/keyvault-keys@4.10.
|
|
320
|
+
## @azure/keyvault-keys@4.10.2
|
|
349
321
|
|
|
350
322
|
License: MIT
|
|
351
323
|
|
|
@@ -485,7 +457,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
485
457
|
SOFTWARE.
|
|
486
458
|
```
|
|
487
459
|
|
|
488
|
-
## @effect/
|
|
460
|
+
## @effect/sql-mssql@4.0.1
|
|
489
461
|
|
|
490
462
|
License: MIT
|
|
491
463
|
|
|
@@ -513,63 +485,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
513
485
|
SOFTWARE.
|
|
514
486
|
```
|
|
515
487
|
|
|
516
|
-
## @
|
|
517
|
-
|
|
518
|
-
License: MIT
|
|
519
|
-
|
|
520
|
-
```
|
|
521
|
-
MIT License
|
|
522
|
-
|
|
523
|
-
Copyright (c) 2023-present The Contributors
|
|
524
|
-
|
|
525
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
526
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
527
|
-
in the Software without restriction, including without limitation the rights
|
|
528
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
529
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
530
|
-
furnished to do so, subject to the following conditions:
|
|
531
|
-
|
|
532
|
-
The above copyright notice and this permission notice shall be included in all
|
|
533
|
-
copies or substantial portions of the Software.
|
|
534
|
-
|
|
535
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
536
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
537
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
538
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
539
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
540
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
541
|
-
SOFTWARE.
|
|
542
|
-
```
|
|
543
|
-
|
|
544
|
-
## @effect/sql-mssql@0.54.0
|
|
545
|
-
|
|
546
|
-
License: MIT
|
|
547
|
-
|
|
548
|
-
```
|
|
549
|
-
MIT License
|
|
550
|
-
|
|
551
|
-
Copyright (c) 2023-present The Contributors
|
|
552
|
-
|
|
553
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
554
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
555
|
-
in the Software without restriction, including without limitation the rights
|
|
556
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
557
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
558
|
-
furnished to do so, subject to the following conditions:
|
|
559
|
-
|
|
560
|
-
The above copyright notice and this permission notice shall be included in all
|
|
561
|
-
copies or substantial portions of the Software.
|
|
562
|
-
|
|
563
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
564
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
565
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
566
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
567
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
568
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
569
|
-
SOFTWARE.
|
|
570
|
-
```
|
|
571
|
-
|
|
572
|
-
## @js-joda/core@5.7.0
|
|
488
|
+
## @js-joda/core@6.2.0
|
|
573
489
|
|
|
574
490
|
License: BSD-3-Clause
|
|
575
491
|
|
|
@@ -609,7 +525,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
|
|
609
525
|
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
610
526
|
```
|
|
611
527
|
|
|
612
|
-
## @types/node@26.
|
|
528
|
+
## @types/node@26.6.1
|
|
613
529
|
|
|
614
530
|
License: MIT
|
|
615
531
|
|
|
@@ -1258,7 +1174,7 @@ TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
1258
1174
|
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1259
1175
|
```
|
|
1260
1176
|
|
|
1261
|
-
## iconv-lite@0.
|
|
1177
|
+
## iconv-lite@0.7.3
|
|
1262
1178
|
|
|
1263
1179
|
License: MIT
|
|
1264
1180
|
|
|
@@ -1476,34 +1392,6 @@ FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TOR
|
|
|
1476
1392
|
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1477
1393
|
```
|
|
1478
1394
|
|
|
1479
|
-
## layerr@3.0.0
|
|
1480
|
-
|
|
1481
|
-
License: MIT
|
|
1482
|
-
|
|
1483
|
-
```
|
|
1484
|
-
MIT License
|
|
1485
|
-
|
|
1486
|
-
Copyright (c) 2020 Perry Mitchell
|
|
1487
|
-
|
|
1488
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
1489
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
1490
|
-
in the Software without restriction, including without limitation the rights
|
|
1491
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
1492
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
1493
|
-
furnished to do so, subject to the following conditions:
|
|
1494
|
-
|
|
1495
|
-
The above copyright notice and this permission notice shall be included in all
|
|
1496
|
-
copies or substantial portions of the Software.
|
|
1497
|
-
|
|
1498
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
1499
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
1500
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
1501
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
1502
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
1503
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
1504
|
-
SOFTWARE.
|
|
1505
|
-
```
|
|
1506
|
-
|
|
1507
1395
|
## lodash.includes@4.3.0
|
|
1508
1396
|
|
|
1509
1397
|
License: MIT
|
|
@@ -2141,7 +2029,7 @@ IN THE SOFTWARE.
|
|
|
2141
2029
|
"""
|
|
2142
2030
|
```
|
|
2143
2031
|
|
|
2144
|
-
## tedious@
|
|
2032
|
+
## tedious@20.3.3
|
|
2145
2033
|
|
|
2146
2034
|
License: MIT
|
|
2147
2035
|
|
|
@@ -2396,14 +2284,14 @@ Apache License
|
|
|
2396
2284
|
limitations under the License.
|
|
2397
2285
|
```
|
|
2398
2286
|
|
|
2399
|
-
##
|
|
2287
|
+
## ulid@3.0.2
|
|
2400
2288
|
|
|
2401
2289
|
License: MIT
|
|
2402
2290
|
|
|
2403
2291
|
```
|
|
2404
|
-
MIT License
|
|
2292
|
+
The MIT License (MIT)
|
|
2405
2293
|
|
|
2406
|
-
Copyright (c)
|
|
2294
|
+
Copyright (c) 2017 Alizain Feerasta
|
|
2407
2295
|
|
|
2408
2296
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
2409
2297
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -2424,7 +2312,7 @@ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
|
2424
2312
|
SOFTWARE.
|
|
2425
2313
|
```
|
|
2426
2314
|
|
|
2427
|
-
## undici-types@8.
|
|
2315
|
+
## undici-types@8.9.0
|
|
2428
2316
|
|
|
2429
2317
|
License: MIT
|
|
2430
2318
|
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { TYPES as e } from "tedious";
|
|
2
|
+
//#region src/binaryParameter.ts
|
|
3
|
+
var t = {
|
|
4
|
+
...e.VarBinary,
|
|
5
|
+
resolveLength: (t) => Math.max(1, e.VarBinary.resolveLength(t)),
|
|
6
|
+
validate: (t, n, r) => e.VarBinary.validate(t instanceof Uint8Array && !Buffer.isBuffer(t) ? Buffer.from(t.buffer, t.byteOffset, t.byteLength) : t, n, r)
|
|
7
|
+
};
|
|
8
|
+
//#endregion
|
|
9
|
+
export { t as binaryParameter };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CDC_OFFSETS_TABLE, _voltroMssqlCdcOffsetsTable } from "@voltro/database";
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { mssqlRowResultProjection as e, readMssqlPhysicalColumns as t } from "./rowResultProjection.js";
|
|
2
|
+
import { Effect as n } from "effect";
|
|
3
|
+
import { decodeRowsFromSchema as r } from "@voltro/database";
|
|
4
|
+
import { createLogger as i } from "@voltro/logger";
|
|
5
|
+
import { SqlClient as a } from "effect/sql/SqlClient";
|
|
6
|
+
//#region src/changeTrackingCdc.ts
|
|
7
|
+
var o = {
|
|
8
|
+
I: "insert",
|
|
9
|
+
U: "update",
|
|
10
|
+
D: "delete"
|
|
11
|
+
}, s = (e, t) => e(n.gen(function* () {
|
|
12
|
+
let e = yield* a;
|
|
13
|
+
if (((yield* e`
|
|
14
|
+
SELECT COUNT(*) AS ${e("on")}
|
|
15
|
+
FROM sys.change_tracking_databases
|
|
16
|
+
WHERE database_id = DB_ID()`)[0]?.on ?? 0) === 0) return yield* n.fail(/* @__PURE__ */ Error("mssql Change Tracking CDC requires CT enabled on the database. Run `ALTER DATABASE <db> SET CHANGE_TRACKING = ON (CHANGE_RETENTION = 2 DAYS, AUTO_CLEANUP = ON)`, or set CDC=0 for inline emit."));
|
|
17
|
+
let r = [];
|
|
18
|
+
for (let n of t) ((yield* e`
|
|
19
|
+
SELECT CASE WHEN OBJECT_ID(${n}, 'U') IS NULL THEN 0 ELSE 1 END AS ${e("present")}`)[0]?.present ?? 0) === 0 ? r.push(n) : yield* e.unsafe(`IF NOT EXISTS (
|
|
20
|
+
SELECT 1 FROM sys.change_tracking_tables
|
|
21
|
+
WHERE object_id = OBJECT_ID(${c(n)})
|
|
22
|
+
)
|
|
23
|
+
ALTER TABLE ${l(n)} ENABLE CHANGE_TRACKING WITH (TRACK_COLUMNS_UPDATED = OFF)`);
|
|
24
|
+
return r;
|
|
25
|
+
})), c = (e) => `'${e.replace(/'/g, "''")}'`, l = (e) => `[${e.replace(/\]/g, "]]")}]`, u = async (u) => {
|
|
26
|
+
let d = i({ scope: "voltro:mssql:cdc" }), f = u.pollIntervalMs ?? 500, p = await s(u.run, u.tables), m = /* @__PURE__ */ new Set(), h = async () => (await u.run(n.gen(function* () {
|
|
27
|
+
return yield* (yield* a)`SELECT CONVERT(VARCHAR(40), CHANGE_TRACKING_CURRENT_VERSION()) AS v`;
|
|
28
|
+
})))[0]?.v ?? "0", g = u.startVersion ?? await h(), _ = !1, v = null, y = !1, b = (e, t) => BigInt(e) > BigInt(t), x = async (i, s) => {
|
|
29
|
+
let f = await u.run(n.gen(function* () {
|
|
30
|
+
let n = yield* a, r = n.unsafe(l(i)), o = (yield* n`
|
|
31
|
+
SELECT CONVERT(VARCHAR(40), CHANGE_TRACKING_MIN_VALID_VERSION(OBJECT_ID(${n.unsafe(c(i))}))) AS floor`)[0]?.floor, u = s;
|
|
32
|
+
if (o != null && BigInt(s) < BigInt(o)) {
|
|
33
|
+
if (!m.has(i)) return {
|
|
34
|
+
resync: !0,
|
|
35
|
+
rows: []
|
|
36
|
+
};
|
|
37
|
+
u = o;
|
|
38
|
+
}
|
|
39
|
+
let d = yield* t(n, i);
|
|
40
|
+
return {
|
|
41
|
+
resync: !1,
|
|
42
|
+
rows: yield* n`
|
|
43
|
+
SELECT ct.SYS_CHANGE_OPERATION AS __ct_op, ct.id AS __ct_id, ${e(n, d, "t")}
|
|
44
|
+
FROM CHANGETABLE(CHANGES ${r}, ${BigInt(u)}) AS ct
|
|
45
|
+
LEFT JOIN ${r} AS t ON t.id = ct.id
|
|
46
|
+
ORDER BY ct.SYS_CHANGE_VERSION`.unprepared
|
|
47
|
+
};
|
|
48
|
+
}));
|
|
49
|
+
if (f.resync) d.warn("cdc: CT retention floor passed our cursor — resyncing to current version", { table: i }), g = await h(), u.onResync?.(), u.onVersion?.(g);
|
|
50
|
+
else for (let e of f.rows) {
|
|
51
|
+
let t = o[e.__ct_op];
|
|
52
|
+
if (!t) continue;
|
|
53
|
+
let { __ct_op: n, __ct_id: a, ...s } = e;
|
|
54
|
+
if (t === "delete") u.onChange({
|
|
55
|
+
table: i,
|
|
56
|
+
op: "delete",
|
|
57
|
+
old: { id: a },
|
|
58
|
+
new: null,
|
|
59
|
+
netChange: !0
|
|
60
|
+
});
|
|
61
|
+
else {
|
|
62
|
+
let e = r([s], i, "mssql")[0];
|
|
63
|
+
u.onChange({
|
|
64
|
+
table: i,
|
|
65
|
+
op: t,
|
|
66
|
+
old: null,
|
|
67
|
+
new: e,
|
|
68
|
+
netChange: !0
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}, S = async () => {
|
|
73
|
+
if (!(_ || y)) {
|
|
74
|
+
y = !0;
|
|
75
|
+
try {
|
|
76
|
+
if (p.length > 0) {
|
|
77
|
+
let e = p;
|
|
78
|
+
p = await s(u.run, e);
|
|
79
|
+
for (let t of e) p.includes(t) || m.add(t);
|
|
80
|
+
}
|
|
81
|
+
let e = await h();
|
|
82
|
+
if (b(e, g)) {
|
|
83
|
+
for (let e of u.tables) {
|
|
84
|
+
if (_) break;
|
|
85
|
+
p.includes(e) || (await x(e, g), m.delete(e));
|
|
86
|
+
}
|
|
87
|
+
g = b(e, g) ? e : g, u.onVersion?.(g);
|
|
88
|
+
}
|
|
89
|
+
} catch (e) {
|
|
90
|
+
_ || (d.warn("cdc: poll cycle failed — retrying next tick", {}, e), u.onError?.(e));
|
|
91
|
+
} finally {
|
|
92
|
+
y = !1, _ || (v = setTimeout(() => {
|
|
93
|
+
S();
|
|
94
|
+
}, f));
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
return v = setTimeout(() => {
|
|
99
|
+
S();
|
|
100
|
+
}, f), v.unref && v.unref(), d.info("cdc: Change Tracking reader attached", {
|
|
101
|
+
tables: u.tables.length,
|
|
102
|
+
from: u.startVersion ?? g
|
|
103
|
+
}), {
|
|
104
|
+
stop: async () => {
|
|
105
|
+
_ = !0, v &&= (clearTimeout(v), null);
|
|
106
|
+
},
|
|
107
|
+
currentVersion: () => g
|
|
108
|
+
};
|
|
109
|
+
};
|
|
110
|
+
//#endregion
|
|
111
|
+
export { s as ensureChangeTracking, u as startChangeTrackingCdc };
|
package/dist/index.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { CDC_OFFSETS_TABLE } from '@voltro/database';
|
|
|
2
2
|
import { CdcConfig } from '@voltro/database';
|
|
3
3
|
import { ChangeEvent } from '@voltro/database';
|
|
4
4
|
import { ChangeStrategy } from '@voltro/database';
|
|
5
|
-
import {
|
|
5
|
+
import { Config } from 'effect';
|
|
6
6
|
import { ConnectionConfig } from '@voltro/database';
|
|
7
7
|
import { Context } from 'effect';
|
|
8
8
|
import { DataStore } from '@voltro/database';
|
|
@@ -20,11 +20,11 @@ import { RawSqlFragment } from '@voltro/database/sql';
|
|
|
20
20
|
import { RetryDecision } from '@voltro/database';
|
|
21
21
|
import { Row } from '@voltro/database';
|
|
22
22
|
import { RowKey } from '@voltro/database';
|
|
23
|
-
import { SqlClient } from '
|
|
24
|
-
import { SqlClient as SqlClient_2 } from '
|
|
23
|
+
import { SqlClient } from 'effect/sql';
|
|
24
|
+
import { SqlClient as SqlClient_2 } from 'effect/sql/SqlClient';
|
|
25
25
|
import { SqlDialect } from '@voltro/database';
|
|
26
|
-
import { SqlError } from '
|
|
27
|
-
import { TransactionConnection } from '
|
|
26
|
+
import { SqlError } from 'effect/sql';
|
|
27
|
+
import { TransactionConnection } from 'effect/sql/SqlClient';
|
|
28
28
|
import { UpsertOptions } from '@voltro/database';
|
|
29
29
|
import { _voltroMssqlCdcOffsetsTable } from '@voltro/database';
|
|
30
30
|
import { WriteAttribution } from '@voltro/database';
|
|
@@ -348,6 +348,9 @@ export declare class MssqlStore implements DataStore {
|
|
|
348
348
|
* promotion, attribution threading and exit settling are shared — see
|
|
349
349
|
* `transactionOutcome.ts` for why none of those may be re-decided here.
|
|
350
350
|
*/
|
|
351
|
+
/** The key under which this client's transactions provide their pinned
|
|
352
|
+
* connection (per client in Effect 4). Views reach it through the parent. */
|
|
353
|
+
get transactionService(): Context.Service<TransactionConnection, TransactionConnection.Service>;
|
|
351
354
|
private txnSpec;
|
|
352
355
|
onChange(listener: (event: ChangeEvent) => void): () => void;
|
|
353
356
|
/** 'fleet' under Change Tracking CDC (every replica gets the full
|
|
@@ -365,7 +368,7 @@ export declare class MssqlStore implements DataStore {
|
|
|
365
368
|
}
|
|
366
369
|
|
|
367
370
|
export declare interface MssqlStoreOptions {
|
|
368
|
-
readonly sqlLayer: Layer.Layer<SqlClient.SqlClient | MssqlClient.MssqlClient,
|
|
371
|
+
readonly sqlLayer: Layer.Layer<SqlClient.SqlClient | MssqlClient.MssqlClient, Config.ConfigError | SqlError.SqlError, never>;
|
|
369
372
|
readonly tracerLayer?: Layer.Layer<never, never, never>;
|
|
370
373
|
/** `'inline'` (default): the writing instance emits its own deltas.
|
|
371
374
|
* `'cdc'`: a SQL Server Change Tracking reader is the sole emitter, so
|
|
@@ -385,7 +388,7 @@ export declare interface MssqlStoreOptions {
|
|
|
385
388
|
*/
|
|
386
389
|
export declare const startChangeTrackingCdc: (opts: ChangeTrackingCdcOptions) => Promise<ChangeTrackingCdcHandle>;
|
|
387
390
|
|
|
388
|
-
declare type TxnContext =
|
|
391
|
+
declare type TxnContext = TransactionConnection.Service;
|
|
389
392
|
|
|
390
393
|
export { _voltroMssqlCdcOffsetsTable }
|
|
391
394
|
|