@albertomarturelo/cta-core 0.1.0-rc.1
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/LICENSE +21 -0
- package/README.md +21 -0
- package/dist/accounts/match-cuenta.d.ts +7 -0
- package/dist/accounts/match-cuenta.d.ts.map +1 -0
- package/dist/accounts/match-cuenta.js +23 -0
- package/dist/accounts/match-cuenta.js.map +1 -0
- package/dist/banks/bci/config.d.ts +38 -0
- package/dist/banks/bci/config.d.ts.map +1 -0
- package/dist/banks/bci/config.js +78 -0
- package/dist/banks/bci/config.js.map +1 -0
- package/dist/banks/bci/login-flow.d.ts +37 -0
- package/dist/banks/bci/login-flow.d.ts.map +1 -0
- package/dist/banks/bci/login-flow.js +79 -0
- package/dist/banks/bci/login-flow.js.map +1 -0
- package/dist/banks/bci/reads.d.ts +33 -0
- package/dist/banks/bci/reads.d.ts.map +1 -0
- package/dist/banks/bci/reads.js +181 -0
- package/dist/banks/bci/reads.js.map +1 -0
- package/dist/dates/dates.d.ts +5 -0
- package/dist/dates/dates.d.ts.map +1 -0
- package/dist/dates/dates.js +25 -0
- package/dist/dates/dates.js.map +1 -0
- package/dist/domain/types.d.ts +43 -0
- package/dist/domain/types.d.ts.map +1 -0
- package/dist/domain/types.js +2 -0
- package/dist/domain/types.js.map +1 -0
- package/dist/errors/errors.d.ts +64 -0
- package/dist/errors/errors.d.ts.map +1 -0
- package/dist/errors/errors.js +107 -0
- package/dist/errors/errors.js.map +1 -0
- package/dist/identity/resolve-bank.d.ts +7 -0
- package/dist/identity/resolve-bank.d.ts.map +1 -0
- package/dist/identity/resolve-bank.js +13 -0
- package/dist/identity/resolve-bank.js.map +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -0
- package/dist/money/money.d.ts +21 -0
- package/dist/money/money.d.ts.map +1 -0
- package/dist/money/money.js +53 -0
- package/dist/money/money.js.map +1 -0
- package/dist/movements/coverage.d.ts +12 -0
- package/dist/movements/coverage.d.ts.map +1 -0
- package/dist/movements/coverage.js +19 -0
- package/dist/movements/coverage.js.map +1 -0
- package/dist/node/banks/bci-driver.d.ts +41 -0
- package/dist/node/banks/bci-driver.d.ts.map +1 -0
- package/dist/node/banks/bci-driver.js +254 -0
- package/dist/node/banks/bci-driver.js.map +1 -0
- package/dist/node/file-session-store.d.ts +18 -0
- package/dist/node/file-session-store.d.ts.map +1 -0
- package/dist/node/file-session-store.js +106 -0
- package/dist/node/file-session-store.js.map +1 -0
- package/dist/node/http-client.d.ts +11 -0
- package/dist/node/http-client.d.ts.map +1 -0
- package/dist/node/http-client.js +25 -0
- package/dist/node/http-client.js.map +1 -0
- package/dist/node/jsonl-audit-sink.d.ts +12 -0
- package/dist/node/jsonl-audit-sink.d.ts.map +1 -0
- package/dist/node/jsonl-audit-sink.js +29 -0
- package/dist/node/jsonl-audit-sink.js.map +1 -0
- package/dist/node/package-version.d.ts +6 -0
- package/dist/node/package-version.d.ts.map +1 -0
- package/dist/node/package-version.js +23 -0
- package/dist/node/package-version.js.map +1 -0
- package/dist/node/system-clock.d.ts +5 -0
- package/dist/node/system-clock.d.ts.map +1 -0
- package/dist/node/system-clock.js +6 -0
- package/dist/node/system-clock.js.map +1 -0
- package/dist/node.d.ts +9 -0
- package/dist/node.d.ts.map +1 -0
- package/dist/node.js +12 -0
- package/dist/node.js.map +1 -0
- package/dist/seams/fakes.d.ts +51 -0
- package/dist/seams/fakes.d.ts.map +1 -0
- package/dist/seams/fakes.js +106 -0
- package/dist/seams/fakes.js.map +1 -0
- package/dist/seams/seams.d.ts +113 -0
- package/dist/seams/seams.d.ts.map +1 -0
- package/dist/seams/seams.js +2 -0
- package/dist/seams/seams.js.map +1 -0
- package/dist/tasks/tasks.d.ts +94 -0
- package/dist/tasks/tasks.d.ts.map +1 -0
- package/dist/tasks/tasks.js +225 -0
- package/dist/tasks/tasks.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { matchCuenta } from '../../accounts/match-cuenta.js';
|
|
2
|
+
import { BCI } from '../../banks/bci/config.js';
|
|
3
|
+
import { bankCookies, classifyDocumentResponse, hasSessionCookie, isLoggedInUrl, pageMessage, } from '../../banks/bci/login-flow.js';
|
|
4
|
+
import { appHeaders, grantExpiry, isAppUrl, judgeApiAnswer, parseCuentas, parseMovimientos, parseSaldo, } from '../../banks/bci/reads.js';
|
|
5
|
+
import { BankError, BrowserMissing, LoginCancelled, NotAuthenticated, } from '../../errors/errors.js';
|
|
6
|
+
import { inRange, latestOnlyCoverage } from '../../movements/coverage.js';
|
|
7
|
+
import { FetchHttpClient } from '../http-client.js';
|
|
8
|
+
const FIVE_MINUTES = 5 * 60_000;
|
|
9
|
+
const SESSION_COOKIE_WAIT = 10_000;
|
|
10
|
+
/**
|
|
11
|
+
* Lazy-load Playwright — an optional peer of the core (STACK). Importing `./node`
|
|
12
|
+
* never loads it; a missing install fails here, at first use, with an actionable
|
|
13
|
+
* message. Lineage: sii adapters/node/portal.ts.
|
|
14
|
+
*/
|
|
15
|
+
async function loadChromium() {
|
|
16
|
+
try {
|
|
17
|
+
return (await import('playwright')).chromium;
|
|
18
|
+
}
|
|
19
|
+
catch (err) {
|
|
20
|
+
const code = err.code;
|
|
21
|
+
if (code === 'ERR_MODULE_NOT_FOUND' || code === 'MODULE_NOT_FOUND')
|
|
22
|
+
throw new BrowserMissing();
|
|
23
|
+
throw err;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async function launchVisible(chromium) {
|
|
27
|
+
try {
|
|
28
|
+
// A normal, visible Chromium: no flags, no plugins, no user-agent change (ADR-004).
|
|
29
|
+
return await chromium.launch({ headless: false });
|
|
30
|
+
}
|
|
31
|
+
catch (err) {
|
|
32
|
+
if (err instanceof Error && /Executable doesn't exist|playwright install/i.test(err.message)) {
|
|
33
|
+
throw new BrowserMissing();
|
|
34
|
+
}
|
|
35
|
+
throw err;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async function errorPageText(page, fallback) {
|
|
39
|
+
await page.waitForLoadState('domcontentloaded', { timeout: 5_000 }).catch(() => undefined);
|
|
40
|
+
const title = await page.title().catch(() => undefined);
|
|
41
|
+
const heading = await page
|
|
42
|
+
.locator('h1, h2')
|
|
43
|
+
.first()
|
|
44
|
+
.textContent({ timeout: 2_000 })
|
|
45
|
+
.catch(() => undefined);
|
|
46
|
+
return pageMessage({ title, heading: heading ?? undefined }, fallback);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Watches — and only watches — a login the user performs by hand: it never
|
|
50
|
+
* fills, clicks or submits anything, and resolves on the first decisive signal.
|
|
51
|
+
*/
|
|
52
|
+
function watchLogin(context, first, timeoutMs) {
|
|
53
|
+
return new Promise((resolve) => {
|
|
54
|
+
let done = false;
|
|
55
|
+
const finish = (o) => {
|
|
56
|
+
if (done)
|
|
57
|
+
return;
|
|
58
|
+
done = true;
|
|
59
|
+
clearTimeout(timer);
|
|
60
|
+
resolve(o);
|
|
61
|
+
};
|
|
62
|
+
const timer = setTimeout(() => finish({ kind: 'timeout' }), timeoutMs);
|
|
63
|
+
const watchPage = (page) => {
|
|
64
|
+
page.on('framenavigated', (frame) => {
|
|
65
|
+
if (frame === page.mainFrame() && isLoggedInUrl(frame.url()))
|
|
66
|
+
finish({ kind: 'success' });
|
|
67
|
+
});
|
|
68
|
+
page.on('close', () => {
|
|
69
|
+
if (context.pages().length === 0)
|
|
70
|
+
finish({ kind: 'closed' });
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
watchPage(first);
|
|
74
|
+
context.on('page', watchPage);
|
|
75
|
+
context.on('response', (res) => {
|
|
76
|
+
if (res.request().resourceType() !== 'document')
|
|
77
|
+
return;
|
|
78
|
+
const kind = classifyDocumentResponse({ url: res.url(), status: res.status() });
|
|
79
|
+
// A challenge during an attended login is the user's to resolve (ADR-004):
|
|
80
|
+
// keep waiting. Only the bank's login error ends the attempt here.
|
|
81
|
+
if (kind !== 'login-server-error')
|
|
82
|
+
return;
|
|
83
|
+
let page;
|
|
84
|
+
try {
|
|
85
|
+
page = res.frame().page();
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return; // no frame to read the message from; the watcher keeps waiting
|
|
89
|
+
}
|
|
90
|
+
finish({ kind, page });
|
|
91
|
+
});
|
|
92
|
+
context.on('close', () => finish({ kind: 'closed' }));
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* The bank's cookies once its session cookie is readable. The orchestrator's
|
|
97
|
+
* `/home` is a client-side route and the probe first read `__Host-SESSIONID`
|
|
98
|
+
* seconds after it (contract, 2026-09-28), so this waits a moment for it — it
|
|
99
|
+
* only reads the browser's jar and sends nothing to the bank.
|
|
100
|
+
*/
|
|
101
|
+
async function sessionCookies(context) {
|
|
102
|
+
const deadline = Date.now() + SESSION_COOKIE_WAIT;
|
|
103
|
+
for (;;) {
|
|
104
|
+
const cookies = bankCookies(await context.cookies());
|
|
105
|
+
if (hasSessionCookie(cookies) || Date.now() >= deadline)
|
|
106
|
+
return cookies;
|
|
107
|
+
await new Promise((r) => setTimeout(r, 500));
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* The BCI driver (ADR-003), built from `docs/bank-contract/bci.md`. The login
|
|
112
|
+
* only watches, then takes the read grant from the bank's own saldos app; reads
|
|
113
|
+
* go over HTTP with that grant (ADR-015).
|
|
114
|
+
*/
|
|
115
|
+
export class BciDriver {
|
|
116
|
+
options;
|
|
117
|
+
slug = BCI.slug;
|
|
118
|
+
code = BCI.code;
|
|
119
|
+
name = BCI.name;
|
|
120
|
+
// A Node client with the app's grant read for 46 min (contract, GH-37).
|
|
121
|
+
readMode = 'http';
|
|
122
|
+
http;
|
|
123
|
+
constructor(options = {}) {
|
|
124
|
+
this.options = options;
|
|
125
|
+
this.http = options.http ?? new FetchHttpClient();
|
|
126
|
+
}
|
|
127
|
+
async login() {
|
|
128
|
+
const browser = await launchVisible(await loadChromium());
|
|
129
|
+
try {
|
|
130
|
+
const context = await browser.newContext();
|
|
131
|
+
const page = await context.newPage();
|
|
132
|
+
const outcome = watchLogin(context, page, this.options.loginTimeoutMs ?? FIVE_MINUTES);
|
|
133
|
+
// A failed first load is not retried; the watcher still decides the outcome.
|
|
134
|
+
await page.goto(BCI.loginEntryUrl).catch(() => undefined);
|
|
135
|
+
const result = await outcome;
|
|
136
|
+
switch (result.kind) {
|
|
137
|
+
case 'success': {
|
|
138
|
+
const cookies = await sessionCookies(context);
|
|
139
|
+
if (!hasSessionCookie(cookies)) {
|
|
140
|
+
throw new BankError(this.slug, 'El banco no entregó una sesión reconocible.');
|
|
141
|
+
}
|
|
142
|
+
return { kind: 'grant', grant: await this.captureGrant(context) };
|
|
143
|
+
}
|
|
144
|
+
case 'login-server-error':
|
|
145
|
+
throw new BankError(this.slug, await errorPageText(result.page, 'El banco respondió con un error al iniciar sesión.'));
|
|
146
|
+
case 'closed':
|
|
147
|
+
case 'timeout':
|
|
148
|
+
throw new LoginCancelled(this.slug, result.kind);
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
finally {
|
|
152
|
+
await browser.close().catch(() => undefined);
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Waits for the user to open the saldos app from the bank's home — the login
|
|
157
|
+
* only watches (ADR-006) — and keeps what the app's own account listing
|
|
158
|
+
* carried: its headers (bearer included) and the accounts it got. `cta` never
|
|
159
|
+
* builds a URL into the app, nor sends, reads or stores the RUT (ADR-012).
|
|
160
|
+
*/
|
|
161
|
+
async captureGrant(context) {
|
|
162
|
+
// Only the saldos app's own listing counts: another frame's call is ignored,
|
|
163
|
+
// not taken as a failure.
|
|
164
|
+
const fromApp = (r) => {
|
|
165
|
+
try {
|
|
166
|
+
return isAppUrl(r.frame().url(), BCI.saldosApp);
|
|
167
|
+
}
|
|
168
|
+
catch {
|
|
169
|
+
return false; // a response without a frame is not the app's
|
|
170
|
+
}
|
|
171
|
+
};
|
|
172
|
+
const listing = context.waitForEvent('response', {
|
|
173
|
+
predicate: (r) => r.request().method() === 'POST' && r.url() === BCI.api.cuentasPorRut && fromApp(r),
|
|
174
|
+
timeout: this.options.loginTimeoutMs ?? FIVE_MINUTES,
|
|
175
|
+
});
|
|
176
|
+
listing.catch(() => undefined); // awaited below
|
|
177
|
+
// The user opens "últimos movimientos"; `cta` clicks nothing. Clicking the old
|
|
178
|
+
// JSF link inside the new home led to a bank error page (2026-09-28).
|
|
179
|
+
let res;
|
|
180
|
+
try {
|
|
181
|
+
res = await listing;
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
throw new LoginCancelled(this.slug, context.pages().length === 0 ? 'closed' : 'timeout');
|
|
185
|
+
}
|
|
186
|
+
if (res.status() === 401)
|
|
187
|
+
throw new NotAuthenticated(this.slug);
|
|
188
|
+
if (res.status() !== 200) {
|
|
189
|
+
throw new BankError(this.slug, `El banco respondió ${res.status()} al listar las cuentas.`);
|
|
190
|
+
}
|
|
191
|
+
const cuentas = parseCuentas(await res.json().catch(() => undefined));
|
|
192
|
+
const headers = appHeaders(await res.request().allHeaders());
|
|
193
|
+
return {
|
|
194
|
+
banco: this.slug,
|
|
195
|
+
headers,
|
|
196
|
+
expiresAt: grantExpiry(headers['authorization'] ?? ''),
|
|
197
|
+
cuentas,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
async cuentas(auth) {
|
|
201
|
+
return this.grantOf(auth).cuentas;
|
|
202
|
+
}
|
|
203
|
+
async saldos(auth, cuenta) {
|
|
204
|
+
const grant = this.grantOf(auth);
|
|
205
|
+
const saldos = [];
|
|
206
|
+
// One account at a time, like the app itself (contract, Accounts / balances).
|
|
207
|
+
for (const numero of this.targets(grant, cuenta)) {
|
|
208
|
+
const json = await this.post(grant, BCI.api.saldoPorCuenta, { cuentaNumero: numero });
|
|
209
|
+
saldos.push(parseSaldo(json));
|
|
210
|
+
}
|
|
211
|
+
return saldos;
|
|
212
|
+
}
|
|
213
|
+
/**
|
|
214
|
+
* BCI's only JSON movements read has no range: the latest movements per
|
|
215
|
+
* account (50 seen). Filtered here, with coverage saying how far back it
|
|
216
|
+
* reached (ADR-014); the JSF date search is not used yet (#27).
|
|
217
|
+
*/
|
|
218
|
+
async movimientos(auth, range, cuenta) {
|
|
219
|
+
const grant = this.grantOf(auth);
|
|
220
|
+
const movimientos = [];
|
|
221
|
+
const cobertura = [];
|
|
222
|
+
for (const numero of this.targets(grant, cuenta)) {
|
|
223
|
+
const json = await this.post(grant, BCI.api.movimientosPorCuenta, { numeroCuenta: numero });
|
|
224
|
+
const all = parseMovimientos(json, numero);
|
|
225
|
+
cobertura.push(latestOnlyCoverage(numero, all, range));
|
|
226
|
+
movimientos.push(...all.filter((m) => inRange(m.fecha, range)));
|
|
227
|
+
}
|
|
228
|
+
return { movimientos, cobertura };
|
|
229
|
+
}
|
|
230
|
+
/** HTTP mode reads with the held grant only; stored cookies are not a session here. */
|
|
231
|
+
grantOf(auth) {
|
|
232
|
+
if (auth.kind !== 'grant')
|
|
233
|
+
throw new NotAuthenticated(this.slug);
|
|
234
|
+
return auth.grant;
|
|
235
|
+
}
|
|
236
|
+
targets(grant, cuenta) {
|
|
237
|
+
const numeros = grant.cuentas.map((c) => c.numero);
|
|
238
|
+
return cuenta === undefined ? numeros : [matchCuenta(this.slug, numeros, cuenta)];
|
|
239
|
+
}
|
|
240
|
+
/** One POST with the app's own headers only; judged by content, never retried (ADR-004). */
|
|
241
|
+
async post(grant, url, body) {
|
|
242
|
+
let answer;
|
|
243
|
+
try {
|
|
244
|
+
answer = await this.http.post(url, grant.headers, JSON.stringify(body));
|
|
245
|
+
}
|
|
246
|
+
catch (err) {
|
|
247
|
+
// Network failure or timeout: the class only (a cause may echo the request).
|
|
248
|
+
const kind = err instanceof Error ? err.name : 'Error';
|
|
249
|
+
throw new BankError(this.slug, `No se pudo contactar al banco (${kind}).`);
|
|
250
|
+
}
|
|
251
|
+
return judgeApiAnswer(answer);
|
|
252
|
+
}
|
|
253
|
+
}
|
|
254
|
+
//# sourceMappingURL=bci-driver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"bci-driver.js","sourceRoot":"","sources":["../../../src/node/banks/bci-driver.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAC7D,OAAO,EAAE,GAAG,EAAE,MAAM,2BAA2B,CAAC;AAChD,OAAO,EACL,WAAW,EACX,wBAAwB,EACxB,gBAAgB,EAChB,aAAa,EACb,WAAW,GACZ,MAAM,+BAA+B,CAAC;AACvC,OAAO,EACL,UAAU,EACV,WAAW,EACX,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,UAAU,GACX,MAAM,0BAA0B,CAAC;AAElC,OAAO,EACL,SAAS,EACT,cAAc,EACd,cAAc,EACd,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,kBAAkB,EAAE,MAAM,6BAA6B,CAAC;AAW1E,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,YAAY,GAAG,CAAC,GAAG,MAAM,CAAC;AAChC,MAAM,mBAAmB,GAAG,MAAM,CAAC;AAEnC;;;;GAIG;AACH,KAAK,UAAU,YAAY;IACzB,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,QAAQ,CAAC;IAC/C,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,MAAM,IAAI,GAAI,GAA6B,CAAC,IAAI,CAAC;QACjD,IAAI,IAAI,KAAK,sBAAsB,IAAI,IAAI,KAAK,kBAAkB;YAAE,MAAM,IAAI,cAAc,EAAE,CAAC;QAC/F,MAAM,GAAG,CAAC;IACZ,CAAC;AACH,CAAC;AAED,KAAK,UAAU,aAAa,CAAC,QAAqB;IAChD,IAAI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AO,MAAM,KAAK,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC;IACpF,CAAC;IAED,4FAA4F;IACpF,KAAK,CAAC,IAAI,CAAC,KAAgB,EAAE,GAAW,EAAE,IAAa;QAC7D,IAAI,MAAkB,CAAC;QACvB,IAAI,CAAC;YACH,MAAM,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;QAC1E,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,6EAA6E;YAC7E,MAAM,IAAI,GAAG,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC;YACvD,MAAM,IAAI,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,kCAAkC,IAAI,IAAI,CAAC,CAAC;QAC7E,CAAC;QACD,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { SessionStore, StoredSession } from '../seams/seams.js';
|
|
2
|
+
/** Default state directory. Never inside the repo (ADR-006). */
|
|
3
|
+
export declare function defaultCtaHome(): string;
|
|
4
|
+
/**
|
|
5
|
+
* Cookies per bank at `<home>/sessions/<banco>.json` — directory `0700`, file
|
|
6
|
+
* `0600`, written atomically. Only `{banco, cookies, savedAt}` is ever stored;
|
|
7
|
+
* credentials never reach this layer (ADR-006).
|
|
8
|
+
*/
|
|
9
|
+
export declare class FileSessionStore implements SessionStore {
|
|
10
|
+
private readonly dir;
|
|
11
|
+
constructor(home?: string);
|
|
12
|
+
private file;
|
|
13
|
+
get(banco: string): Promise<StoredSession | undefined>;
|
|
14
|
+
put(session: StoredSession): Promise<void>;
|
|
15
|
+
delete(banco: string): Promise<void>;
|
|
16
|
+
list(): Promise<readonly string[]>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=file-session-store.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-session-store.d.ts","sourceRoot":"","sources":["../../src/node/file-session-store.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,YAAY,EAAgB,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKnF,gEAAgE;AAChE,wBAAgB,cAAc,IAAI,MAAM,CAEvC;AAkBD;;;;GAIG;AACH,qBAAa,gBAAiB,YAAW,YAAY;IACnD,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAS;gBAEjB,IAAI,GAAE,MAAyB;IAI3C,OAAO,CAAC,IAAI;IAMN,GAAG,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;IA2BtD,GAAG,CAAC,OAAO,EAAE,aAAa,GAAG,OAAO,CAAC,IAAI,CAAC;IAoB1C,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAIpC,IAAI,IAAI,OAAO,CAAC,SAAS,MAAM,EAAE,CAAC;CAYzC"}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { chmod, mkdir, readdir, readFile, rename, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { homedir } from 'node:os';
|
|
3
|
+
import { join } from 'node:path';
|
|
4
|
+
import { NotAuthenticated } from '../errors/errors.js';
|
|
5
|
+
const SLUG = /^[a-z0-9][a-z0-9-]{0,31}$/;
|
|
6
|
+
const SAME_SITE = new Set(['Strict', 'Lax', 'None']);
|
|
7
|
+
/** Default state directory. Never inside the repo (ADR-006). */
|
|
8
|
+
export function defaultCtaHome() {
|
|
9
|
+
return join(homedir(), '.cta');
|
|
10
|
+
}
|
|
11
|
+
function isCookie(c) {
|
|
12
|
+
if (typeof c !== 'object' || c === null)
|
|
13
|
+
return false;
|
|
14
|
+
const o = c;
|
|
15
|
+
return (typeof o.name === 'string' &&
|
|
16
|
+
typeof o.value === 'string' &&
|
|
17
|
+
typeof o.domain === 'string' &&
|
|
18
|
+
typeof o.path === 'string' &&
|
|
19
|
+
typeof o.expires === 'number' &&
|
|
20
|
+
typeof o.httpOnly === 'boolean' &&
|
|
21
|
+
typeof o.secure === 'boolean' &&
|
|
22
|
+
typeof o.sameSite === 'string' &&
|
|
23
|
+
SAME_SITE.has(o.sameSite));
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Cookies per bank at `<home>/sessions/<banco>.json` — directory `0700`, file
|
|
27
|
+
* `0600`, written atomically. Only `{banco, cookies, savedAt}` is ever stored;
|
|
28
|
+
* credentials never reach this layer (ADR-006).
|
|
29
|
+
*/
|
|
30
|
+
export class FileSessionStore {
|
|
31
|
+
dir;
|
|
32
|
+
constructor(home = defaultCtaHome()) {
|
|
33
|
+
this.dir = join(home, 'sessions');
|
|
34
|
+
}
|
|
35
|
+
file(banco) {
|
|
36
|
+
// The slug becomes a file name: refuse anything that could leave the directory.
|
|
37
|
+
if (!SLUG.test(banco))
|
|
38
|
+
throw new RangeError(`Invalid bank slug '${banco}'`);
|
|
39
|
+
return join(this.dir, `${banco}.json`);
|
|
40
|
+
}
|
|
41
|
+
async get(banco) {
|
|
42
|
+
let text;
|
|
43
|
+
try {
|
|
44
|
+
text = await readFile(this.file(banco), 'utf8');
|
|
45
|
+
}
|
|
46
|
+
catch (err) {
|
|
47
|
+
if (err.code === 'ENOENT')
|
|
48
|
+
return undefined;
|
|
49
|
+
throw err;
|
|
50
|
+
}
|
|
51
|
+
try {
|
|
52
|
+
const data = JSON.parse(text);
|
|
53
|
+
const o = data;
|
|
54
|
+
if (typeof o === 'object' &&
|
|
55
|
+
o !== null &&
|
|
56
|
+
o.banco === banco &&
|
|
57
|
+
typeof o.savedAt === 'string' &&
|
|
58
|
+
Array.isArray(o.cookies) &&
|
|
59
|
+
o.cookies.every(isCookie)) {
|
|
60
|
+
return { banco, cookies: o.cookies, savedAt: o.savedAt };
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
catch {
|
|
64
|
+
/* fall through: unreadable is the same as absent, but said out loud */
|
|
65
|
+
}
|
|
66
|
+
throw new NotAuthenticated(banco);
|
|
67
|
+
}
|
|
68
|
+
async put(session) {
|
|
69
|
+
const target = this.file(session.banco);
|
|
70
|
+
await mkdir(this.dir, { recursive: true, mode: 0o700 });
|
|
71
|
+
await chmod(this.dir, 0o700);
|
|
72
|
+
const tmp = `${target}.${process.pid}.tmp`;
|
|
73
|
+
const body = JSON.stringify({
|
|
74
|
+
banco: session.banco,
|
|
75
|
+
cookies: session.cookies,
|
|
76
|
+
savedAt: session.savedAt,
|
|
77
|
+
});
|
|
78
|
+
try {
|
|
79
|
+
await writeFile(tmp, body, { mode: 0o600 });
|
|
80
|
+
await rename(tmp, target);
|
|
81
|
+
}
|
|
82
|
+
catch (err) {
|
|
83
|
+
await rm(tmp, { force: true });
|
|
84
|
+
throw err;
|
|
85
|
+
}
|
|
86
|
+
await chmod(target, 0o600);
|
|
87
|
+
}
|
|
88
|
+
async delete(banco) {
|
|
89
|
+
await rm(this.file(banco), { force: true });
|
|
90
|
+
}
|
|
91
|
+
async list() {
|
|
92
|
+
try {
|
|
93
|
+
return (await readdir(this.dir))
|
|
94
|
+
.filter((f) => f.endsWith('.json'))
|
|
95
|
+
.map((f) => f.slice(0, -'.json'.length))
|
|
96
|
+
.filter((s) => SLUG.test(s))
|
|
97
|
+
.sort();
|
|
98
|
+
}
|
|
99
|
+
catch (err) {
|
|
100
|
+
if (err.code === 'ENOENT')
|
|
101
|
+
return [];
|
|
102
|
+
throw err;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
//# sourceMappingURL=file-session-store.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-session-store.js","sourceRoot":"","sources":["../../src/node/file-session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,CAAC;iBAC7B,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;iBAClC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;iBACvC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;iBAC3B,IAAI,EAAE,CAAC;QACZ,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,IAAK,GAA6B,CAAC,IAAI,KAAK,QAAQ;gBAAE,OAAO,EAAE,CAAC;YAChE,MAAM,GAAG,CAAC;QACZ,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { HttpAnswer, HttpClient } from '../seams/seams.js';
|
|
2
|
+
/**
|
|
3
|
+
* The Node `fetch` behind HTTP-mode reads (ADR-015): exactly the headers given,
|
|
4
|
+
* no cookie jar, no browser headers added by `cta`, one attempt.
|
|
5
|
+
*/
|
|
6
|
+
export declare class FetchHttpClient implements HttpClient {
|
|
7
|
+
private readonly timeoutMs;
|
|
8
|
+
constructor(timeoutMs?: number);
|
|
9
|
+
post(url: string, headers: Readonly<Record<string, string>>, body: string): Promise<HttpAnswer>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=http-client.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.d.ts","sourceRoot":"","sources":["../../src/node/http-client.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAEhE;;;GAGG;AACH,qBAAa,eAAgB,YAAW,UAAU;IACpC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,SAAS;IAEzC,IAAI,CACR,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,UAAU,CAAC;CAcvB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Node `fetch` behind HTTP-mode reads (ADR-015): exactly the headers given,
|
|
3
|
+
* no cookie jar, no browser headers added by `cta`, one attempt.
|
|
4
|
+
*/
|
|
5
|
+
export class FetchHttpClient {
|
|
6
|
+
timeoutMs;
|
|
7
|
+
constructor(timeoutMs = 30_000) {
|
|
8
|
+
this.timeoutMs = timeoutMs;
|
|
9
|
+
}
|
|
10
|
+
async post(url, headers, body) {
|
|
11
|
+
const r = await fetch(url, {
|
|
12
|
+
method: 'POST',
|
|
13
|
+
headers: { ...headers },
|
|
14
|
+
body,
|
|
15
|
+
redirect: 'manual',
|
|
16
|
+
signal: AbortSignal.timeout(this.timeoutMs),
|
|
17
|
+
});
|
|
18
|
+
return {
|
|
19
|
+
status: r.status,
|
|
20
|
+
contentType: r.headers.get('content-type') ?? '',
|
|
21
|
+
body: await r.text(),
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=http-client.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-client.js","sourceRoot":"","sources":["../../src/node/http-client.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,MAAM,OAAO,eAAe;IACG;IAA7B,YAA6B,YAAY,MAAM;QAAlB,cAAS,GAAT,SAAS,CAAS;IAAG,CAAC;IAEnD,KAAK,CAAC,IAAI,CACR,GAAW,EACX,OAAyC,EACzC,IAAY;QAEZ,MAAM,CAAC,GAAG,MAAM,KAAK,CAAC,GAAG,EAAE;YACzB,MAAM,EAAE,MAAM;YACd,OAAO,EAAE,EAAE,GAAG,OAAO,EAAE;YACvB,IAAI;YACJ,QAAQ,EAAE,QAAQ;YAClB,MAAM,EAAE,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC;SAC5C,CAAC,CAAC;QACH,OAAO;YACL,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,WAAW,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,IAAI,EAAE;YAChD,IAAI,EAAE,MAAM,CAAC,CAAC,IAAI,EAAE;SACrB,CAAC;IACJ,CAAC;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { AuditEntry, AuditSink } from '../seams/seams.js';
|
|
2
|
+
/**
|
|
3
|
+
* Appends one receipt per line to `<home>/audit.jsonl` (`0600`). Only the
|
|
4
|
+
* fixed receipt fields are written — never account data (ADR-004).
|
|
5
|
+
*/
|
|
6
|
+
export declare class JsonlAuditSink implements AuditSink {
|
|
7
|
+
private readonly home;
|
|
8
|
+
private readonly file;
|
|
9
|
+
constructor(home?: string);
|
|
10
|
+
record(entry: AuditEntry): Promise<void>;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=jsonl-audit-sink.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-audit-sink.d.ts","sourceRoot":"","sources":["../../src/node/jsonl-audit-sink.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG/D;;;GAGG;AACH,qBAAa,cAAe,YAAW,SAAS;IAGlC,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,OAAO,CAAC,QAAQ,CAAC,IAAI,CAAS;gBAED,IAAI,GAAE,MAAyB;IAItD,MAAM,CAAC,KAAK,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC;CAa/C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { appendFile, chmod, mkdir } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { defaultCtaHome } from './file-session-store.js';
|
|
4
|
+
/**
|
|
5
|
+
* Appends one receipt per line to `<home>/audit.jsonl` (`0600`). Only the
|
|
6
|
+
* fixed receipt fields are written — never account data (ADR-004).
|
|
7
|
+
*/
|
|
8
|
+
export class JsonlAuditSink {
|
|
9
|
+
home;
|
|
10
|
+
file;
|
|
11
|
+
constructor(home = defaultCtaHome()) {
|
|
12
|
+
this.home = home;
|
|
13
|
+
this.file = join(home, 'audit.jsonl');
|
|
14
|
+
}
|
|
15
|
+
async record(entry) {
|
|
16
|
+
const line = {
|
|
17
|
+
ts: entry.ts,
|
|
18
|
+
action: entry.action,
|
|
19
|
+
banco: entry.banco,
|
|
20
|
+
result: entry.result,
|
|
21
|
+
durationMs: entry.durationMs,
|
|
22
|
+
...(entry.errorCode === undefined ? {} : { errorCode: entry.errorCode }),
|
|
23
|
+
};
|
|
24
|
+
await mkdir(this.home, { recursive: true, mode: 0o700 });
|
|
25
|
+
await appendFile(this.file, `${JSON.stringify(line)}\n`, { mode: 0o600 });
|
|
26
|
+
await chmod(this.file, 0o600);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=jsonl-audit-sink.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-audit-sink.js","sourceRoot":"","sources":["../../src/node/jsonl-audit-sink.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC5D,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAGjC,OAAO,EAAE,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAEzD;;;GAGG;AACH,MAAM,OAAO,cAAc;IAGI;IAFZ,IAAI,CAAS;IAE9B,YAA6B,OAAe,cAAc,EAAE;QAA/B,SAAI,GAAJ,IAAI,CAA2B;QAC1D,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,KAAiB;QAC5B,MAAM,IAAI,GAAG;YACX,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,KAAK,EAAE,KAAK,CAAC,KAAK;YAClB,MAAM,EAAE,KAAK,CAAC,MAAM;YACpB,UAAU,EAAE,KAAK,CAAC,UAAU;YAC5B,GAAG,CAAC,KAAK,CAAC,SAAS,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,CAAC;SACzE,CAAC;QACF,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QACzD,MAAM,UAAU,CAAC,IAAI,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,IAAI,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;QAC1E,MAAM,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC;CACF"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Reads `version` from a package.json. Surfaces pass the URL of their own
|
|
3
|
+
* manifest so the lockstep version (ADR-002) has a single source per package.
|
|
4
|
+
*/
|
|
5
|
+
export declare function readPackageVersion(packageJsonUrl: URL): string;
|
|
6
|
+
//# sourceMappingURL=package-version.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.d.ts","sourceRoot":"","sources":["../../src/node/package-version.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,cAAc,EAAE,GAAG,GAAG,MAAM,CAiB9D"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readFileSync } from 'node:fs';
|
|
2
|
+
/**
|
|
3
|
+
* Reads `version` from a package.json. Surfaces pass the URL of their own
|
|
4
|
+
* manifest so the lockstep version (ADR-002) has a single source per package.
|
|
5
|
+
*/
|
|
6
|
+
export function readPackageVersion(packageJsonUrl) {
|
|
7
|
+
let manifest;
|
|
8
|
+
try {
|
|
9
|
+
manifest = JSON.parse(readFileSync(packageJsonUrl, 'utf8'));
|
|
10
|
+
}
|
|
11
|
+
catch (cause) {
|
|
12
|
+
throw new Error(`Cannot read ${packageJsonUrl.pathname}`, { cause });
|
|
13
|
+
}
|
|
14
|
+
if (typeof manifest !== 'object' ||
|
|
15
|
+
manifest === null ||
|
|
16
|
+
!('version' in manifest) ||
|
|
17
|
+
typeof manifest.version !== 'string' ||
|
|
18
|
+
manifest.version === '') {
|
|
19
|
+
throw new Error(`No version field in ${packageJsonUrl.pathname}`);
|
|
20
|
+
}
|
|
21
|
+
return manifest.version;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=package-version.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"package-version.js","sourceRoot":"","sources":["../../src/node/package-version.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC;;;GAGG;AACH,MAAM,UAAU,kBAAkB,CAAC,cAAmB;IACpD,IAAI,QAAiB,CAAC;IACtB,IAAI,CAAC;QACH,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,cAAc,EAAE,MAAM,CAAC,CAAC,CAAC;IAC9D,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,MAAM,IAAI,KAAK,CAAC,eAAe,cAAc,CAAC,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC;IACvE,CAAC;IACD,IACE,OAAO,QAAQ,KAAK,QAAQ;QAC5B,QAAQ,KAAK,IAAI;QACjB,CAAC,CAAC,SAAS,IAAI,QAAQ,CAAC;QACxB,OAAO,QAAQ,CAAC,OAAO,KAAK,QAAQ;QACpC,QAAQ,CAAC,OAAO,KAAK,EAAE,EACvB,CAAC;QACD,MAAM,IAAI,KAAK,CAAC,uBAAuB,cAAc,CAAC,QAAQ,EAAE,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,QAAQ,CAAC,OAAO,CAAC;AAC1B,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-clock.d.ts","sourceRoot":"","sources":["../../src/node/system-clock.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAE/C,qBAAa,WAAY,YAAW,KAAK;IACvC,GAAG,IAAI,IAAI;CAGZ"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"system-clock.js","sourceRoot":"","sources":["../../src/node/system-clock.ts"],"names":[],"mappings":"AAEA,MAAM,OAAO,WAAW;IACtB,GAAG;QACD,OAAO,IAAI,IAAI,EAAE,CAAC;IACpB,CAAC;CACF"}
|
package/dist/node.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export { readPackageVersion } from './node/package-version.js';
|
|
2
|
+
export { FileSessionStore, defaultCtaHome } from './node/file-session-store.js';
|
|
3
|
+
export { JsonlAuditSink } from './node/jsonl-audit-sink.js';
|
|
4
|
+
export { SystemClock } from './node/system-clock.js';
|
|
5
|
+
import type { BankDriver } from './seams/seams.js';
|
|
6
|
+
export { BciDriver } from './node/banks/bci-driver.js';
|
|
7
|
+
/** The drivers a real run uses, in registry order (append-only). */
|
|
8
|
+
export declare function defaultDrivers(): readonly BankDriver[];
|
|
9
|
+
//# sourceMappingURL=node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.d.ts","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,oEAAoE;AACpE,wBAAgB,cAAc,IAAI,SAAS,UAAU,EAAE,CAEtD"}
|
package/dist/node.js
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
// `./node` subpath: the Node composition root that surfaces import (ADR-003).
|
|
2
|
+
export { readPackageVersion } from './node/package-version.js';
|
|
3
|
+
export { FileSessionStore, defaultCtaHome } from './node/file-session-store.js';
|
|
4
|
+
export { JsonlAuditSink } from './node/jsonl-audit-sink.js';
|
|
5
|
+
export { SystemClock } from './node/system-clock.js';
|
|
6
|
+
import { BciDriver } from './node/banks/bci-driver.js';
|
|
7
|
+
export { BciDriver } from './node/banks/bci-driver.js';
|
|
8
|
+
/** The drivers a real run uses, in registry order (append-only). */
|
|
9
|
+
export function defaultDrivers() {
|
|
10
|
+
return [new BciDriver()];
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=node.js.map
|
package/dist/node.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"node.js","sourceRoot":"","sources":["../src/node.ts"],"names":[],"mappings":"AAAA,8EAA8E;AAC9E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,EAAE,gBAAgB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAGrD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,OAAO,EAAE,SAAS,EAAE,MAAM,4BAA4B,CAAC;AAEvD,oEAAoE;AACpE,MAAM,UAAU,cAAc;IAC5B,OAAO,CAAC,IAAI,SAAS,EAAE,CAAC,CAAC;AAC3B,CAAC"}
|