t3code-cli 0.4.0 → 0.5.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/dist/bin.js +4 -2
- package/dist/index.js +12 -2
- package/dist/{runtime-Cq64iuZr.js → runtime-KQVRmRk-.js} +229 -174
- package/dist/src/application/layer.d.ts +2 -2
- package/dist/src/auth/layer.d.ts +4 -2
- package/dist/src/auth/local-base-dir.d.ts +7 -0
- package/dist/src/auth/local-origin.d.ts +18 -0
- package/dist/src/auth/local-token.d.ts +26 -0
- package/dist/src/auth/local.d.ts +8 -11
- package/dist/src/auth/pairing.d.ts +6 -6
- package/dist/src/auth/service.d.ts +2 -1
- package/dist/src/auth/transport.d.ts +6 -3
- package/dist/src/auth/type.d.ts +18 -0
- package/dist/src/connection/error.d.ts +8 -0
- package/dist/src/connection/layer.d.ts +3 -0
- package/dist/src/connection/node.d.ts +2 -0
- package/dist/src/connection/service.d.ts +13 -0
- package/dist/src/connection/type.d.ts +10 -0
- package/dist/src/connection.d.ts +5 -0
- package/dist/src/index.d.ts +23 -1
- package/dist/src/rpc/error.d.ts +4 -3
- package/dist/src/rpc/layer.d.ts +5 -4
- package/dist/src/runtime.d.ts +9 -2
- package/package.json +1 -1
- package/src/auth/layer.ts +17 -0
- package/src/auth/local-base-dir.ts +22 -0
- package/src/auth/local-origin.ts +62 -0
- package/src/auth/local-token.ts +302 -0
- package/src/auth/local.ts +13 -348
- package/src/auth/pairing.ts +8 -19
- package/src/auth/service.ts +2 -1
- package/src/auth/transport.ts +17 -11
- package/src/auth/type.ts +22 -0
- package/src/cli/auth.ts +2 -0
- package/src/connection/error.ts +9 -0
- package/src/connection/layer.ts +10 -0
- package/src/connection/node.ts +12 -0
- package/src/connection/service.ts +26 -0
- package/src/connection/type.ts +12 -0
- package/src/connection.ts +9 -0
- package/src/index.ts +75 -1
- package/src/rpc/error.ts +4 -11
- package/src/rpc/layer.ts +25 -15
- package/src/runtime.ts +45 -7
package/dist/bin.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { $ as
|
|
2
|
+
import { $ as T3Config, $n as hasInterruptsOnly, $t as endUnsafe, An as map$2, Ar as isSome, At as WatchBackend, Bn as serviceOption, Br as hasProperty, Bt as runCollect, Cn as forEach, Cr as make$13, Ct as fromWritable, Dn as interrupt, Dr as getOrElse, Dt as FileSystem, En as ignore, Er as fromUndefinedOr, Et as FileDescriptor, Fn as provideContext, Fr as Prototype, Ft as fromIterable, Gn as tapError, Gr as constVoid, Gt as succeed$4, Hn as suspend, Hr as isNotUndefined, Ht as runFold, In as provideService, Ir as PipeInspectableProto, It as isStream, J as ThreadSessionError, Jn as try_, Jr as pipe, Jt as unwrap, Kn as timeoutOrElse, Kr as dual, Kt as tap, Ln as result, Lr as withFiber, Lt as merge, Mn as matchEffect, Mr as match, Mt as callback$1, Nn as orDie, Nr as none, Nt as decodeText, On as isEffect, Or as getOrUndefined, Ot as FileTypeId, Pn as provide$1, Pr as some, Pt as empty, Q as Environment, Qn as fail$1, Qt as isSink, Rn as runFork, Rr as BaseProto, Rt as mkString, Sn as fnUntraced, Sr as getUnsafe, St as fromReadable, Tn as gen, Tr as fromNullishOr, Tt as TypeId$7, Un as sync, Ur as isNullish, Ut as runLast, Vn as succeed, Vr as isNotNull, Vt as runDrain, Wn as tapCause, Wr as isUndefined, Wt as splitLines, X as threadStatus, Xn as void_, Xr as __commonJSMin, Xt as make$11, Y as latestAssistantMessage, Yn as uninterruptible, Yr as pipeArguments, Yt as get, Z as T3Application, Zn as TaggedError, Zr as __require, Zt as drain, _n as catch_, _r as fail$2, _t as optionalKey, an as badArgument, ar as succeed$2, at as Int, bn as flatMap, br as Service, bt as Crypto, cn as transform$1, cr as _await, ct as String$1, dn as andThen, dr as makeUnsafe, dt as Union, en as failCauseUnsafe, er as squash, et as T3Auth, fn as as, fr as isSuccess, ft as decodeTo, gn as catchTags, gr as map$3, gt as optional$3, hn as catchFilter, hr as sync$1, ht as is, in as BadArgument, ir as provideMerge, it as ErrorClass, jn as mapError, jr as map$4, jt as make$10, kn as logError, kr as isNone, kt as Size, ln as acquireRelease, lr as doneUnsafe, lt as Struct, mn as callback, mr as ConsoleRef, mt as fromJsonString, nn as offer, nr as mergeAll, nt as Boolean$2, on as systemError, or as sync$2, ot as Literal, pn as asVoid, pr as succeed$1, pt as decodeUnknownEffect, q as NodeEnvironmentLive, qn as tryPromise, qr as identity, qt as transduce, rn as offerUnsafe, rr as provide, rt as Defect, sn as nominal, sr as MinimumLogLevel, st as Literals, t as AppLayer, tn as make$12, tr as effect, tt as ArraySchema, un as addFinalizer, ur as isDone, ut as TaggedErrorClass, vn as effectify, vr as succeed$3, vt as tag, wn as forkScoped, wr as flatMap$1, wt as Path$1, xn as fn, xr as empty$1, xt as make$9, yn as fail, yr as Reference, yt as toCodecStringTree, zn as scoped, zr as format, zt as run$1 } from "./runtime-KQVRmRk-.js";
|
|
3
3
|
import * as NodeChildProcess from "node:child_process";
|
|
4
4
|
import * as NodeCrypto from "node:crypto";
|
|
5
5
|
import * as NFS from "node:fs";
|
|
@@ -17584,6 +17584,7 @@ const pairCommand = make("pair", {
|
|
|
17584
17584
|
const output = yield* T3Output;
|
|
17585
17585
|
const resolvedFormat = resolveOutputFormat(format, environment, "json");
|
|
17586
17586
|
const result = yield* auth.pair(url);
|
|
17587
|
+
yield* auth.writeConfig(result);
|
|
17587
17588
|
if (resolvedFormat === "json") yield* output.printJson(result);
|
|
17588
17589
|
else yield* output.printInfo(formatAuthPaired(result));
|
|
17589
17590
|
})).pipe(withDescription("pair with t3code server"));
|
|
@@ -17606,6 +17607,7 @@ const localCommand = make("local", {
|
|
|
17606
17607
|
...isSome(baseDir) ? { baseDir: baseDir.value } : {},
|
|
17607
17608
|
...isSome(origin) ? { origin: origin.value } : {}
|
|
17608
17609
|
});
|
|
17610
|
+
yield* auth.writeConfig(result);
|
|
17609
17611
|
if (resolvedFormat === "json") yield* output.printJson(formatAuthLocalJson(result));
|
|
17610
17612
|
else yield* output.printInfo(formatAuthLocalHuman(result));
|
|
17611
17613
|
})).pipe(withDescription("authenticate with local t3code installation"));
|
|
@@ -18147,7 +18149,7 @@ var T3Version = class extends Service()("t3cli/T3Version") {};
|
|
|
18147
18149
|
//#endregion
|
|
18148
18150
|
//#region src/version/layer.ts
|
|
18149
18151
|
const PackageJsonSchema = fromJsonString(Struct({ version: String$1 }));
|
|
18150
|
-
const T3VersionBundledLive = sync$2(T3Version, () => ({ version: "0.
|
|
18152
|
+
const T3VersionBundledLive = sync$2(T3Version, () => ({ version: "0.5.1" }));
|
|
18151
18153
|
effect(T3Version, gen(function* () {
|
|
18152
18154
|
const packageJson = yield* (yield* FileSystem).readFileString(fileURLToPath(new URL("../../package.json", import.meta.url)));
|
|
18153
18155
|
return { version: (yield* decodeUnknownEffect(PackageJsonSchema)(packageJson)).version };
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,12 @@
|
|
|
1
|
-
import { n as AuthAppLayer,
|
|
2
|
-
|
|
1
|
+
import { $ as T3Config, A as T3LocalAuthTokenLive, B as AuthLocalSigningError, C as makeT3AuthPairing, D as T3LocalAuthLive, E as T3LocalAuth, F as makeT3LocalAuthOrigin, G as layerWebSocketConstructor, H as AuthTransportError, I as AuthConfigError, K as layerUndici, L as AuthLocalDatabaseError, M as SqlClientFactory, N as T3LocalAuthOrigin, O as makeT3LocalAuth, P as T3LocalAuthOriginLive, Q as Environment, R as AuthLocalError, S as T3AuthPairingLive, T as T3AuthTransportLive, U as ConfigError, V as AuthPairingUrlError, W as UrlError, Z as T3Application, _ as makeT3CodeConnectionProvider, a as T3AuthTransportLayer, b as makeT3Auth, c as T3LocalAuthTokenLayer, d as makeNodeSqliteClient, et as T3Auth, f as T3RpcLive, g as T3CodeConnectionProviderLive, h as T3CodeConnectionProvider, i as T3AuthPairingLayer, j as makeT3LocalAuthToken, k as T3LocalAuthToken, l as NodeSqlClientFactoryLive, m as makeT3Config, n as AuthAppLayer, nr as mergeAll, o as T3LocalAuthLayer, p as T3ConfigLive, q as NodeEnvironmentLive, r as T3AuthLayer, rr as provide, s as T3LocalAuthOriginLayer, t as AppLayer, u as NodeSqliteClientLive, v as T3CodeConnectionError, w as parsePairingUrl, x as T3AuthPairing, y as T3AuthLive, z as AuthLocalSecretError } from "./runtime-KQVRmRk-.js";
|
|
2
|
+
//#region src/connection/layer.ts
|
|
3
|
+
function makeT3CodeRpcLayer() {
|
|
4
|
+
return T3RpcLive.pipe(provide(T3AuthTransportLive));
|
|
5
|
+
}
|
|
6
|
+
const T3CodeRpcLayer = makeT3CodeRpcLayer();
|
|
7
|
+
//#endregion
|
|
8
|
+
//#region src/connection/node.ts
|
|
9
|
+
const NodeConnectionPlatformLayer = mergeAll(layerUndici, layerWebSocketConstructor);
|
|
10
|
+
const T3CodeNodeRpcLayer = T3CodeRpcLayer.pipe(provide(NodeConnectionPlatformLayer));
|
|
11
|
+
//#endregion
|
|
12
|
+
export { AppLayer, AuthAppLayer, AuthConfigError, AuthLocalDatabaseError, AuthLocalError, AuthLocalSecretError, AuthLocalSigningError, AuthPairingUrlError, AuthTransportError, ConfigError, Environment, NodeEnvironmentLive, NodeSqlClientFactoryLive, NodeSqliteClientLive, SqlClientFactory, T3Application, T3Auth, T3AuthLayer, T3AuthLive, T3AuthPairing, T3AuthPairingLayer, T3AuthPairingLive, T3AuthTransportLayer, T3CodeConnectionError, T3CodeConnectionProvider, T3CodeConnectionProviderLive, T3CodeNodeRpcLayer, T3CodeRpcLayer, T3Config, T3ConfigLive, T3LocalAuth, T3LocalAuthLayer, T3LocalAuthLive, T3LocalAuthOrigin, T3LocalAuthOriginLayer, T3LocalAuthOriginLive, T3LocalAuthToken, T3LocalAuthTokenLayer, T3LocalAuthTokenLive, UrlError, makeNodeSqliteClient, makeT3Auth, makeT3AuthPairing, makeT3CodeConnectionProvider, makeT3CodeRpcLayer, makeT3Config, makeT3LocalAuth, makeT3LocalAuthOrigin, makeT3LocalAuthToken, parsePairingUrl };
|
|
@@ -65511,6 +65511,120 @@ var AuthLocalError = class extends TaggedErrorClass()("AuthLocalError", {
|
|
|
65511
65511
|
]))
|
|
65512
65512
|
}) {};
|
|
65513
65513
|
//#endregion
|
|
65514
|
+
//#region src/config/url.ts
|
|
65515
|
+
function normalizeHttpBaseUrl(value) {
|
|
65516
|
+
return parseUrl$1(value).pipe(flatMap$2((url) => succeed$2(normalizeBaseUrl$1(url))));
|
|
65517
|
+
}
|
|
65518
|
+
function toHttpEndpointUrl(httpBaseUrl, pathname) {
|
|
65519
|
+
return parseUrl$1(httpBaseUrl).pipe(flatMap$2((url) => succeed$2(withPathname(url, pathname).toString())));
|
|
65520
|
+
}
|
|
65521
|
+
function toWebSocketEndpointUrl(httpBaseUrl, pathname) {
|
|
65522
|
+
return parseUrl$1(httpBaseUrl).pipe(flatMap$2((url) => {
|
|
65523
|
+
if (url.protocol === "http:") return succeed$2(withPathname(url, pathname, "ws:").toString());
|
|
65524
|
+
if (url.protocol === "https:") return succeed$2(withPathname(url, pathname, "wss:").toString());
|
|
65525
|
+
return fail$2(new UrlError({
|
|
65526
|
+
message: `unsupported server url protocol: ${url.protocol}`,
|
|
65527
|
+
protocol: url.protocol
|
|
65528
|
+
}));
|
|
65529
|
+
}));
|
|
65530
|
+
}
|
|
65531
|
+
function parseUrl$1(value) {
|
|
65532
|
+
return fromResult(fromString(value)).pipe(catchTags$1({ IllegalArgumentError: (error) => fail$2(new UrlError({
|
|
65533
|
+
message: "invalid url",
|
|
65534
|
+
cause: error
|
|
65535
|
+
})) }));
|
|
65536
|
+
}
|
|
65537
|
+
function normalizeBaseUrl$1(url) {
|
|
65538
|
+
return mutate(url, (current) => {
|
|
65539
|
+
current.hash = "";
|
|
65540
|
+
current.search = "";
|
|
65541
|
+
current.pathname = normalizePathname(current.pathname);
|
|
65542
|
+
}).toString().replace(/\/$/, "");
|
|
65543
|
+
}
|
|
65544
|
+
function withPathname(url, pathname, protocol) {
|
|
65545
|
+
return mutate(url, (current) => {
|
|
65546
|
+
if (protocol !== void 0) current.protocol = protocol;
|
|
65547
|
+
current.pathname = appendPathname(current.pathname, pathname);
|
|
65548
|
+
current.search = "";
|
|
65549
|
+
current.hash = "";
|
|
65550
|
+
});
|
|
65551
|
+
}
|
|
65552
|
+
function normalizePathname(pathname) {
|
|
65553
|
+
return pathname === "/" ? "" : pathname.replace(/\/+$/u, "");
|
|
65554
|
+
}
|
|
65555
|
+
function appendPathname(basePathname, pathname) {
|
|
65556
|
+
return `${normalizePathname(basePathname)}${pathname.startsWith("/") ? pathname : `/${pathname}`}`;
|
|
65557
|
+
}
|
|
65558
|
+
//#endregion
|
|
65559
|
+
//#region src/auth/local-base-dir.ts
|
|
65560
|
+
function resolveLocalBaseDir(input) {
|
|
65561
|
+
const envBaseDir = input.environment.env["T3CODE_HOME"];
|
|
65562
|
+
const raw = input.baseDir ?? envBaseDir;
|
|
65563
|
+
if (raw === void 0 || raw.length === 0) return input.path.join(input.environment.homeDir, ".t3");
|
|
65564
|
+
if (raw === "~") return input.environment.homeDir;
|
|
65565
|
+
if (raw.startsWith("~/") || raw.startsWith("~\\")) return input.path.join(input.environment.homeDir, raw.slice(2));
|
|
65566
|
+
return input.path.resolve(input.environment.cwd, raw);
|
|
65567
|
+
}
|
|
65568
|
+
//#endregion
|
|
65569
|
+
//#region src/auth/schema.ts
|
|
65570
|
+
const AuthAccessTokenResultSchema = Struct({
|
|
65571
|
+
access_token: String$1,
|
|
65572
|
+
issued_token_type: String$1,
|
|
65573
|
+
token_type: Literal("Bearer"),
|
|
65574
|
+
expires_in: Number$1,
|
|
65575
|
+
scope: String$1
|
|
65576
|
+
});
|
|
65577
|
+
const AuthSessionStateSchema = Struct({
|
|
65578
|
+
authenticated: Boolean$1,
|
|
65579
|
+
role: optionalKey(Literals(["owner", "client"])),
|
|
65580
|
+
sessionMethod: optionalKey(String$1),
|
|
65581
|
+
expiresAt: optionalKey(String$1)
|
|
65582
|
+
});
|
|
65583
|
+
const AuthWebSocketTicketResultSchema = Struct({
|
|
65584
|
+
ticket: String$1,
|
|
65585
|
+
expiresAt: String$1
|
|
65586
|
+
});
|
|
65587
|
+
const AuthLocalRuntimeStateSchema = Struct({
|
|
65588
|
+
version: Literal(1),
|
|
65589
|
+
origin: String$1
|
|
65590
|
+
});
|
|
65591
|
+
const decodeAuthAccessTokenResult = decodeUnknownEffect(AuthAccessTokenResultSchema);
|
|
65592
|
+
const decodeAuthSessionState = decodeUnknownEffect(AuthSessionStateSchema);
|
|
65593
|
+
const decodeAuthWebSocketTicketResult = decodeUnknownEffect(AuthWebSocketTicketResultSchema);
|
|
65594
|
+
decodeUnknownEffect(AuthLocalRuntimeStateSchema);
|
|
65595
|
+
const decodeAuthLocalRuntimeStateFromJson = decodeUnknownEffect(fromJsonString(AuthLocalRuntimeStateSchema));
|
|
65596
|
+
//#endregion
|
|
65597
|
+
//#region src/auth/local-origin.ts
|
|
65598
|
+
var T3LocalAuthOrigin = class extends Service$1()("t3cli/T3LocalAuthOrigin") {};
|
|
65599
|
+
const makeT3LocalAuthOrigin = fn("makeT3LocalAuthOrigin")(function* () {
|
|
65600
|
+
const fs = yield* FileSystem;
|
|
65601
|
+
const path = yield* Path;
|
|
65602
|
+
const environment = yield* Environment;
|
|
65603
|
+
return { resolve: fn("T3LocalAuthOriginLive.resolve")(function* (input) {
|
|
65604
|
+
const baseDir = resolveLocalBaseDir({
|
|
65605
|
+
baseDir: input?.baseDir,
|
|
65606
|
+
environment,
|
|
65607
|
+
path
|
|
65608
|
+
});
|
|
65609
|
+
if (input?.origin !== void 0) return yield* normalizeLocalOrigin(input.origin);
|
|
65610
|
+
const runtimeStatePath = path.join(baseDir, "userdata", "server-runtime.json");
|
|
65611
|
+
return yield* normalizeLocalOrigin((yield* decodeAuthLocalRuntimeStateFromJson(yield* fs.readFileString(runtimeStatePath).pipe(mapError$2((error) => new AuthLocalError({
|
|
65612
|
+
message: `local runtime state not found: ${runtimeStatePath}. Make sure T3 Code is running with Network access enabled, or pass --origin manually.`,
|
|
65613
|
+
cause: error
|
|
65614
|
+
})))).pipe(mapError$2((error) => new AuthLocalError({
|
|
65615
|
+
message: "local runtime state has invalid shape",
|
|
65616
|
+
cause: error
|
|
65617
|
+
})))).origin);
|
|
65618
|
+
}) };
|
|
65619
|
+
});
|
|
65620
|
+
const T3LocalAuthOriginLive = effect(T3LocalAuthOrigin, makeT3LocalAuthOrigin());
|
|
65621
|
+
function normalizeLocalOrigin(origin) {
|
|
65622
|
+
return normalizeHttpBaseUrl(origin).pipe(mapError$2((error) => new AuthLocalError({
|
|
65623
|
+
message: error.message,
|
|
65624
|
+
cause: error
|
|
65625
|
+
})));
|
|
65626
|
+
}
|
|
65627
|
+
//#endregion
|
|
65514
65628
|
//#region node_modules/.pnpm/effect@4.0.0-beta.78/node_modules/effect/dist/unstable/reactivity/Reactivity.js
|
|
65515
65629
|
/**
|
|
65516
65630
|
* The `Reactivity` module provides process-local invalidation for connecting
|
|
@@ -66488,112 +66602,17 @@ const makeWithTransaction = (options) => (effect) => {
|
|
|
66488
66602
|
*/
|
|
66489
66603
|
const TransactionConnection = (clientId) => Service$1(`effect/sql/SqlClient/TransactionConnection/${clientId}`);
|
|
66490
66604
|
//#endregion
|
|
66491
|
-
//#region src/config/url.ts
|
|
66492
|
-
function normalizeHttpBaseUrl(value) {
|
|
66493
|
-
return parseUrl$1(value).pipe(flatMap$2((url) => succeed$2(normalizeBaseUrl$1(url))));
|
|
66494
|
-
}
|
|
66495
|
-
function toHttpEndpointUrl(httpBaseUrl, pathname) {
|
|
66496
|
-
return parseUrl$1(httpBaseUrl).pipe(flatMap$2((url) => succeed$2(withPathname(url, pathname).toString())));
|
|
66497
|
-
}
|
|
66498
|
-
function toWebSocketEndpointUrl(httpBaseUrl, pathname) {
|
|
66499
|
-
return parseUrl$1(httpBaseUrl).pipe(flatMap$2((url) => {
|
|
66500
|
-
if (url.protocol === "http:") return succeed$2(withPathname(url, pathname, "ws:").toString());
|
|
66501
|
-
if (url.protocol === "https:") return succeed$2(withPathname(url, pathname, "wss:").toString());
|
|
66502
|
-
return fail$2(new UrlError({
|
|
66503
|
-
message: `unsupported server url protocol: ${url.protocol}`,
|
|
66504
|
-
protocol: url.protocol
|
|
66505
|
-
}));
|
|
66506
|
-
}));
|
|
66507
|
-
}
|
|
66508
|
-
function parseUrl$1(value) {
|
|
66509
|
-
return fromResult(fromString(value)).pipe(catchTags$1({ IllegalArgumentError: (error) => fail$2(new UrlError({
|
|
66510
|
-
message: "invalid url",
|
|
66511
|
-
cause: error
|
|
66512
|
-
})) }));
|
|
66513
|
-
}
|
|
66514
|
-
function normalizeBaseUrl$1(url) {
|
|
66515
|
-
return mutate(url, (current) => {
|
|
66516
|
-
current.hash = "";
|
|
66517
|
-
current.search = "";
|
|
66518
|
-
current.pathname = normalizePathname(current.pathname);
|
|
66519
|
-
}).toString().replace(/\/$/, "");
|
|
66520
|
-
}
|
|
66521
|
-
function withPathname(url, pathname, protocol) {
|
|
66522
|
-
return mutate(url, (current) => {
|
|
66523
|
-
if (protocol !== void 0) current.protocol = protocol;
|
|
66524
|
-
current.pathname = appendPathname(current.pathname, pathname);
|
|
66525
|
-
current.search = "";
|
|
66526
|
-
current.hash = "";
|
|
66527
|
-
});
|
|
66528
|
-
}
|
|
66529
|
-
function normalizePathname(pathname) {
|
|
66530
|
-
return pathname === "/" ? "" : pathname.replace(/\/+$/u, "");
|
|
66531
|
-
}
|
|
66532
|
-
function appendPathname(basePathname, pathname) {
|
|
66533
|
-
return `${normalizePathname(basePathname)}${pathname.startsWith("/") ? pathname : `/${pathname}`}`;
|
|
66534
|
-
}
|
|
66535
|
-
//#endregion
|
|
66536
66605
|
//#region src/sql/service.ts
|
|
66537
66606
|
var SqlClientFactory = class extends Service$1()("t3cli/SqlClientFactory") {};
|
|
66538
66607
|
//#endregion
|
|
66539
|
-
//#region src/auth/
|
|
66540
|
-
|
|
66541
|
-
|
|
66542
|
-
issued_token_type: String$1,
|
|
66543
|
-
token_type: Literal("Bearer"),
|
|
66544
|
-
expires_in: Number$1,
|
|
66545
|
-
scope: String$1
|
|
66546
|
-
});
|
|
66547
|
-
const AuthSessionStateSchema = Struct({
|
|
66548
|
-
authenticated: Boolean$1,
|
|
66549
|
-
role: optionalKey(Literals(["owner", "client"])),
|
|
66550
|
-
sessionMethod: optionalKey(String$1),
|
|
66551
|
-
expiresAt: optionalKey(String$1)
|
|
66552
|
-
});
|
|
66553
|
-
const AuthWebSocketTicketResultSchema = Struct({
|
|
66554
|
-
ticket: String$1,
|
|
66555
|
-
expiresAt: String$1
|
|
66556
|
-
});
|
|
66557
|
-
const AuthLocalRuntimeStateSchema = Struct({
|
|
66558
|
-
version: Literal(1),
|
|
66559
|
-
origin: String$1
|
|
66560
|
-
});
|
|
66561
|
-
const decodeAuthAccessTokenResult = decodeUnknownEffect(AuthAccessTokenResultSchema);
|
|
66562
|
-
const decodeAuthSessionState = decodeUnknownEffect(AuthSessionStateSchema);
|
|
66563
|
-
const decodeAuthWebSocketTicketResult = decodeUnknownEffect(AuthWebSocketTicketResultSchema);
|
|
66564
|
-
decodeUnknownEffect(AuthLocalRuntimeStateSchema);
|
|
66565
|
-
const decodeAuthLocalRuntimeStateFromJson = decodeUnknownEffect(fromJsonString(AuthLocalRuntimeStateSchema));
|
|
66566
|
-
//#endregion
|
|
66567
|
-
//#region src/auth/local.ts
|
|
66568
|
-
var T3LocalAuth = class extends Service$1()("t3cli/T3LocalAuth") {};
|
|
66569
|
-
const T3LocalAuthLive = effect(T3LocalAuth, fn("makeT3LocalAuth")(function* () {
|
|
66570
|
-
const config = yield* T3Config;
|
|
66608
|
+
//#region src/auth/local-token.ts
|
|
66609
|
+
var T3LocalAuthToken = class extends Service$1()("t3cli/T3LocalAuthToken") {};
|
|
66610
|
+
const makeT3LocalAuthToken = fn("makeT3LocalAuthToken")(function* () {
|
|
66571
66611
|
const fs = yield* FileSystem;
|
|
66572
66612
|
const path = yield* Path;
|
|
66573
66613
|
const environment = yield* Environment;
|
|
66574
66614
|
const crypto = yield* Crypto;
|
|
66575
66615
|
const sqlClientFactory = yield* SqlClientFactory;
|
|
66576
|
-
function resolveLocalBaseDir(input) {
|
|
66577
|
-
const envBaseDir = environment.env["T3CODE_HOME"];
|
|
66578
|
-
const raw = input ?? envBaseDir;
|
|
66579
|
-
if (raw === void 0 || raw.length === 0) return path.join(environment.homeDir, ".t3");
|
|
66580
|
-
if (raw === "~") return environment.homeDir;
|
|
66581
|
-
if (raw.startsWith("~/") || raw.startsWith("~\\")) return path.join(environment.homeDir, raw.slice(2));
|
|
66582
|
-
return path.resolve(environment.cwd, raw);
|
|
66583
|
-
}
|
|
66584
|
-
function resolveLocalOrigin(input) {
|
|
66585
|
-
return gen(function* () {
|
|
66586
|
-
if (input.origin !== void 0) return yield* normalizeLocalOrigin(input.origin);
|
|
66587
|
-
const runtimeStatePath = path.join(input.baseDir, "userdata", "server-runtime.json");
|
|
66588
|
-
return yield* normalizeLocalOrigin((yield* decodeAuthLocalRuntimeStateFromJson(yield* fs.readFileString(runtimeStatePath).pipe(mapError$2((error) => new AuthLocalError({
|
|
66589
|
-
message: `local runtime state not found: ${runtimeStatePath}. Make sure T3 Code is running with Network access enabled, or pass --origin manually.`,
|
|
66590
|
-
cause: error
|
|
66591
|
-
})))).pipe(mapError$2((error) => new AuthLocalError({
|
|
66592
|
-
message: "local runtime state has invalid shape",
|
|
66593
|
-
cause: error
|
|
66594
|
-
})))).origin);
|
|
66595
|
-
});
|
|
66596
|
-
}
|
|
66597
66616
|
function readSigningSecret(secretPath) {
|
|
66598
66617
|
return fs.readFile(secretPath).pipe(map$3((bytes) => Uint8Array.from(bytes)), catchFilter$2(reason("PlatformError", "NotFound"), () => succeed$2(void 0)), mapError$2((error) => new AuthLocalSecretError({
|
|
66599
66618
|
message: `failed to read signing secret: ${secretPath}`,
|
|
@@ -66668,26 +66687,14 @@ const T3LocalAuthLive = effect(T3LocalAuth, fn("makeT3LocalAuth")(function* () {
|
|
|
66668
66687
|
expiresAt: formatIso(expiresAt)
|
|
66669
66688
|
};
|
|
66670
66689
|
});
|
|
66671
|
-
function
|
|
66672
|
-
return gen(function* () {
|
|
66673
|
-
const existing = yield* config.readStored().pipe(catchTags$1({ ConfigError: (error) => fail$2(new AuthConfigError({
|
|
66674
|
-
message: "auth config failed",
|
|
66675
|
-
cause: error
|
|
66676
|
-
})) }));
|
|
66677
|
-
yield* config.writeStored({
|
|
66678
|
-
...existing,
|
|
66679
|
-
url: input.url,
|
|
66680
|
-
token: input.token
|
|
66681
|
-
}).pipe(catchTags$1({ ConfigError: (error) => fail$2(new AuthConfigError({
|
|
66682
|
-
message: "auth config failed",
|
|
66683
|
-
cause: error
|
|
66684
|
-
})) }));
|
|
66685
|
-
});
|
|
66686
|
-
}
|
|
66687
|
-
return { local: fn("T3LocalAuthLive.local")(function* (input) {
|
|
66690
|
+
return { create: fn("T3LocalAuthTokenLive.create")(function* (input) {
|
|
66688
66691
|
if (input.label.length === 0) return yield* fail$2(new AuthLocalError({ message: "local auth label cannot be empty" }));
|
|
66689
66692
|
if (input.subject.length === 0) return yield* fail$2(new AuthLocalError({ message: "local auth subject cannot be empty" }));
|
|
66690
|
-
const baseDir = resolveLocalBaseDir(
|
|
66693
|
+
const baseDir = resolveLocalBaseDir({
|
|
66694
|
+
baseDir: input.baseDir,
|
|
66695
|
+
environment,
|
|
66696
|
+
path
|
|
66697
|
+
});
|
|
66691
66698
|
const session = yield* issueLocalDatabaseSession({
|
|
66692
66699
|
dbPath: path.join(baseDir, "userdata", "state.sqlite"),
|
|
66693
66700
|
secretsDir: path.join(baseDir, "userdata", "secrets"),
|
|
@@ -66698,23 +66705,16 @@ const T3LocalAuthLive = effect(T3LocalAuth, fn("makeT3LocalAuth")(function* () {
|
|
|
66698
66705
|
message: `local auth failed: ${error.message}`,
|
|
66699
66706
|
cause: error
|
|
66700
66707
|
})));
|
|
66701
|
-
const url = yield* resolveLocalOrigin({
|
|
66702
|
-
baseDir,
|
|
66703
|
-
...input.origin !== void 0 ? { origin: input.origin } : {}
|
|
66704
|
-
});
|
|
66705
|
-
yield* writeLocalConfig({
|
|
66706
|
-
url,
|
|
66707
|
-
token: session.token
|
|
66708
|
-
});
|
|
66709
66708
|
return {
|
|
66710
|
-
|
|
66709
|
+
token: session.token,
|
|
66711
66710
|
role: session.role,
|
|
66712
66711
|
expiresAt: session.expiresAt,
|
|
66713
66712
|
source: "local",
|
|
66714
66713
|
baseDir
|
|
66715
66714
|
};
|
|
66716
66715
|
}) };
|
|
66717
|
-
})
|
|
66716
|
+
});
|
|
66717
|
+
const T3LocalAuthTokenLive = effect(T3LocalAuthToken, makeT3LocalAuthToken());
|
|
66718
66718
|
function insertAuthSession(input) {
|
|
66719
66719
|
return gen(function* () {
|
|
66720
66720
|
const sql = yield* SqlClient;
|
|
@@ -66758,12 +66758,6 @@ function insertAuthSession(input) {
|
|
|
66758
66758
|
`;
|
|
66759
66759
|
});
|
|
66760
66760
|
}
|
|
66761
|
-
function normalizeLocalOrigin(origin) {
|
|
66762
|
-
return normalizeHttpBaseUrl(origin).pipe(mapError$2((error) => new AuthLocalError({
|
|
66763
|
-
message: error.message,
|
|
66764
|
-
cause: error
|
|
66765
|
-
})));
|
|
66766
|
-
}
|
|
66767
66761
|
const defaultSessionTtlMs = 720 * 60 * 60 * 1e3;
|
|
66768
66762
|
const signingSecretName = "server-signing-key";
|
|
66769
66763
|
const sha256BlockSize = 64;
|
|
@@ -66774,6 +66768,28 @@ function concatBytes(first, second) {
|
|
|
66774
66768
|
return bytes;
|
|
66775
66769
|
}
|
|
66776
66770
|
//#endregion
|
|
66771
|
+
//#region src/auth/local.ts
|
|
66772
|
+
var T3LocalAuth = class extends Service$1()("t3cli/T3LocalAuth") {};
|
|
66773
|
+
const makeT3LocalAuth = fn("makeT3LocalAuth")(function* () {
|
|
66774
|
+
const origin = yield* T3LocalAuthOrigin;
|
|
66775
|
+
const token = yield* T3LocalAuthToken;
|
|
66776
|
+
return { local: fn("T3LocalAuthLive.local")(function* (input) {
|
|
66777
|
+
const created = yield* token.create(input);
|
|
66778
|
+
return {
|
|
66779
|
+
url: yield* origin.resolve({
|
|
66780
|
+
baseDir: created.baseDir,
|
|
66781
|
+
...input.origin !== void 0 ? { origin: input.origin } : {}
|
|
66782
|
+
}),
|
|
66783
|
+
token: created.token,
|
|
66784
|
+
role: created.role,
|
|
66785
|
+
expiresAt: created.expiresAt,
|
|
66786
|
+
source: "local",
|
|
66787
|
+
baseDir: created.baseDir
|
|
66788
|
+
};
|
|
66789
|
+
}) };
|
|
66790
|
+
});
|
|
66791
|
+
const T3LocalAuthLive = effect(T3LocalAuth, makeT3LocalAuth());
|
|
66792
|
+
//#endregion
|
|
66777
66793
|
//#region src/auth/transport.ts
|
|
66778
66794
|
var T3AuthTransport = class extends Service$1()("t3cli/T3AuthTransport") {};
|
|
66779
66795
|
const T3AuthTransportLive = effect(T3AuthTransport, fn("makeT3AuthTransport")(function* () {
|
|
@@ -66808,8 +66824,8 @@ const T3AuthTransportLive = effect(T3AuthTransport, fn("makeT3AuthTransport")(fu
|
|
|
66808
66824
|
sessionToken: result.access_token
|
|
66809
66825
|
};
|
|
66810
66826
|
}),
|
|
66811
|
-
getSession: fn("AuthTransport.getSession")(function* (
|
|
66812
|
-
const request = get$1(yield* makeHttpEndpointUrl(
|
|
66827
|
+
getSession: fn("AuthTransport.getSession")(function* (connection) {
|
|
66828
|
+
const request = get$1(yield* makeHttpEndpointUrl(connection.url, "/api/auth/session")).pipe(authenticatedRequest(connection));
|
|
66813
66829
|
return yield* (yield* client.execute(request).pipe(catchTags$1({ HttpClientError: (error) => fail$2(new AuthTransportError({
|
|
66814
66830
|
message: "auth request failed",
|
|
66815
66831
|
cause: HttpClientErrorSchema.fromHttpClientError(error)
|
|
@@ -66824,8 +66840,8 @@ const T3AuthTransportLive = effect(T3AuthTransport, fn("makeT3AuthTransport")(fu
|
|
|
66824
66840
|
}))
|
|
66825
66841
|
}));
|
|
66826
66842
|
}),
|
|
66827
|
-
issueWebSocketTicket: fn("AuthTransport.issueWebSocketTicket")(function* (
|
|
66828
|
-
const request = post$1(yield* makeHttpEndpointUrl(
|
|
66843
|
+
issueWebSocketTicket: fn("AuthTransport.issueWebSocketTicket")(function* (connection) {
|
|
66844
|
+
const request = post$1(yield* makeHttpEndpointUrl(connection.url, "/api/auth/websocket-ticket")).pipe(authenticatedRequest(connection));
|
|
66829
66845
|
return yield* (yield* client.execute(request).pipe(catchTags$1({ HttpClientError: (error) => fail$2(new AuthTransportError({
|
|
66830
66846
|
message: "auth request failed",
|
|
66831
66847
|
cause: HttpClientErrorSchema.fromHttpClientError(error)
|
|
@@ -66842,7 +66858,7 @@ const T3AuthTransportLive = effect(T3AuthTransport, fn("makeT3AuthTransport")(fu
|
|
|
66842
66858
|
})
|
|
66843
66859
|
};
|
|
66844
66860
|
})());
|
|
66845
|
-
const authenticatedRequest = (
|
|
66861
|
+
const authenticatedRequest = (connection) => (request) => request.pipe(acceptJson, bearerToken(connection.token));
|
|
66846
66862
|
function makeHttpEndpointUrl(baseUrl, path) {
|
|
66847
66863
|
return toHttpEndpointUrl(baseUrl, path).pipe(catchTags$1({ UrlError: (error) => fail$2(new AuthTransportError({
|
|
66848
66864
|
message: "auth request failed",
|
|
@@ -66852,31 +66868,20 @@ function makeHttpEndpointUrl(baseUrl, path) {
|
|
|
66852
66868
|
//#endregion
|
|
66853
66869
|
//#region src/auth/pairing.ts
|
|
66854
66870
|
var T3AuthPairing = class extends Service$1()("t3cli/T3AuthPairing") {};
|
|
66855
|
-
const
|
|
66856
|
-
const config = yield* T3Config;
|
|
66871
|
+
const makeT3AuthPairing = fn("makeT3AuthPairing")(function* () {
|
|
66857
66872
|
const transport = yield* T3AuthTransport;
|
|
66858
66873
|
return { pair: fn("T3AuthPairingLive.pair")(function* (pairingUrl) {
|
|
66859
66874
|
const parsed = yield* parsePairingUrl(pairingUrl);
|
|
66860
66875
|
const result = yield* transport.bootstrapBearer(parsed);
|
|
66861
|
-
const existing = yield* config.readStored().pipe(catchTags$1({ ConfigError: (error) => fail$2(new AuthConfigError({
|
|
66862
|
-
message: "auth config failed",
|
|
66863
|
-
cause: error
|
|
66864
|
-
})) }));
|
|
66865
|
-
yield* config.writeStored({
|
|
66866
|
-
...existing,
|
|
66867
|
-
url: parsed.baseUrl,
|
|
66868
|
-
token: result.sessionToken
|
|
66869
|
-
}).pipe(catchTags$1({ ConfigError: (error) => fail$2(new AuthConfigError({
|
|
66870
|
-
message: "auth config failed",
|
|
66871
|
-
cause: error
|
|
66872
|
-
})) }));
|
|
66873
66876
|
return {
|
|
66874
66877
|
url: parsed.baseUrl,
|
|
66878
|
+
token: result.sessionToken,
|
|
66875
66879
|
role: result.role,
|
|
66876
66880
|
expiresAt: result.expiresAt
|
|
66877
66881
|
};
|
|
66878
66882
|
}) };
|
|
66879
|
-
})
|
|
66883
|
+
});
|
|
66884
|
+
const T3AuthPairingLive = effect(T3AuthPairing, makeT3AuthPairing());
|
|
66880
66885
|
function parsePairingUrl(value) {
|
|
66881
66886
|
return gen(function* () {
|
|
66882
66887
|
const url = yield* parseUrl(value);
|
|
@@ -66909,7 +66914,9 @@ function readPairingToken(url) {
|
|
|
66909
66914
|
return hashToken !== void 0 && hashToken.length > 0 ? hashToken : token !== void 0 && token.length > 0 ? token : "";
|
|
66910
66915
|
});
|
|
66911
66916
|
}
|
|
66912
|
-
|
|
66917
|
+
//#endregion
|
|
66918
|
+
//#region src/auth/layer.ts
|
|
66919
|
+
const makeT3Auth = fn("makeT3Auth")(function* () {
|
|
66913
66920
|
const config = yield* T3Config;
|
|
66914
66921
|
const transport = yield* T3AuthTransport;
|
|
66915
66922
|
const localAuth = yield* T3LocalAuth;
|
|
@@ -66940,14 +66947,47 @@ const T3AuthLive = effect(T3Auth, fn("makeT3Auth")(function* () {
|
|
|
66940
66947
|
}));
|
|
66941
66948
|
return yield* transport.issueWebSocketTicket(resolved);
|
|
66942
66949
|
});
|
|
66950
|
+
const writeConfig = fn("T3AuthLive.writeConfig")(function* (input) {
|
|
66951
|
+
const existing = yield* config.readStored().pipe(catchTags$1({ ConfigError: (error) => fail$2(new AuthConfigError({
|
|
66952
|
+
message: "auth config failed",
|
|
66953
|
+
cause: error
|
|
66954
|
+
})) }));
|
|
66955
|
+
yield* config.writeStored({
|
|
66956
|
+
...existing,
|
|
66957
|
+
url: input.url,
|
|
66958
|
+
token: input.token
|
|
66959
|
+
}).pipe(catchTags$1({ ConfigError: (error) => fail$2(new AuthConfigError({
|
|
66960
|
+
message: "auth config failed",
|
|
66961
|
+
cause: error
|
|
66962
|
+
})) }));
|
|
66963
|
+
});
|
|
66943
66964
|
return {
|
|
66944
66965
|
pair: pairing.pair,
|
|
66945
66966
|
local: localAuth.local,
|
|
66967
|
+
writeConfig,
|
|
66946
66968
|
status,
|
|
66947
66969
|
issueWebSocketTicket
|
|
66948
66970
|
};
|
|
66949
|
-
})
|
|
66950
|
-
const
|
|
66971
|
+
});
|
|
66972
|
+
const T3AuthLive = effect(T3Auth, makeT3Auth());
|
|
66973
|
+
//#endregion
|
|
66974
|
+
//#region src/connection/error.ts
|
|
66975
|
+
var T3CodeConnectionError = class extends TaggedErrorClass()("T3CodeConnectionError", {
|
|
66976
|
+
message: String$1,
|
|
66977
|
+
cause: optionalKey(Unknown)
|
|
66978
|
+
}) {};
|
|
66979
|
+
//#endregion
|
|
66980
|
+
//#region src/connection/service.ts
|
|
66981
|
+
var T3CodeConnectionProvider = class extends Service$1()("t3cli/T3CodeConnectionProvider") {};
|
|
66982
|
+
function makeT3CodeConnectionProvider(get) {
|
|
66983
|
+
return { get };
|
|
66984
|
+
}
|
|
66985
|
+
function T3CodeConnectionProviderLive(connection) {
|
|
66986
|
+
return succeed$3(T3CodeConnectionProvider, makeT3CodeConnectionProvider(succeed$2(connection)));
|
|
66987
|
+
}
|
|
66988
|
+
//#endregion
|
|
66989
|
+
//#region src/config/layer.ts
|
|
66990
|
+
const makeT3Config = fn("makeT3Config")(function* () {
|
|
66951
66991
|
const fs = yield* FileSystem;
|
|
66952
66992
|
const path = yield* Path;
|
|
66953
66993
|
const environment = yield* Environment;
|
|
@@ -66992,7 +67032,8 @@ const T3ConfigLive = effect(T3Config, fn("makeT3Config")(function* () {
|
|
|
66992
67032
|
};
|
|
66993
67033
|
})
|
|
66994
67034
|
};
|
|
66995
|
-
})
|
|
67035
|
+
});
|
|
67036
|
+
const T3ConfigLive = effect(T3Config, makeT3Config());
|
|
66996
67037
|
const StoredConfigSchema = Struct({
|
|
66997
67038
|
url: optionalKey(String$1),
|
|
66998
67039
|
token: optionalKey(String$1)
|
|
@@ -70270,11 +70311,8 @@ const RpcErrorCauseSchema = Union([
|
|
|
70270
70311
|
OrchestrationDispatchCommandError,
|
|
70271
70312
|
OrchestrationGetSnapshotError,
|
|
70272
70313
|
ServerSettingsError,
|
|
70273
|
-
AuthConfigError,
|
|
70274
|
-
AuthLocalError,
|
|
70275
|
-
AuthPairingUrlError,
|
|
70276
70314
|
AuthTransportError,
|
|
70277
|
-
|
|
70315
|
+
T3CodeConnectionError,
|
|
70278
70316
|
HttpClientErrorSchema,
|
|
70279
70317
|
UrlError,
|
|
70280
70318
|
instanceOf(SchemaError)
|
|
@@ -70877,17 +70915,18 @@ const makeClient = make$1(make$5(WsOrchestrationDispatchCommandRpc, WsOrchestrat
|
|
|
70877
70915
|
})));
|
|
70878
70916
|
const connectionRetrySchedule = exponential("100 millis").pipe(take$2(4));
|
|
70879
70917
|
const makeT3RpcLayer = fn("makeT3RpcLayer")(function* () {
|
|
70880
|
-
const
|
|
70881
|
-
const
|
|
70918
|
+
const connectionProvider = yield* T3CodeConnectionProvider;
|
|
70919
|
+
const authTransport = yield* T3AuthTransport;
|
|
70920
|
+
const webSocketConstructor = yield* WebSocketConstructor;
|
|
70882
70921
|
const parentScope = yield* Scope;
|
|
70883
70922
|
const connection = yield* make(none());
|
|
70884
70923
|
const openConnection = fn("T3RpcLive.openConnection")(function* () {
|
|
70885
70924
|
const scope = yield* fork(parentScope);
|
|
70886
70925
|
return yield* gen(function* () {
|
|
70887
70926
|
const protocol = yield* buildWithScope(makeProtocolLayer(yield* makeWsUrl({
|
|
70888
|
-
|
|
70889
|
-
|
|
70890
|
-
})), scope);
|
|
70927
|
+
authTransport,
|
|
70928
|
+
connectionProvider
|
|
70929
|
+
}), webSocketConstructor), scope);
|
|
70891
70930
|
return {
|
|
70892
70931
|
scope,
|
|
70893
70932
|
client: yield* makeClient.pipe(provide(protocol), provideService$1(Scope, scope))
|
|
@@ -70914,12 +70953,16 @@ const makeT3RpcLayer = fn("makeT3RpcLayer")(function* () {
|
|
|
70914
70953
|
};
|
|
70915
70954
|
});
|
|
70916
70955
|
const makeWsUrl = fn("makeWsUrl")(function* (input) {
|
|
70917
|
-
const
|
|
70918
|
-
const
|
|
70919
|
-
|
|
70956
|
+
const connection = yield* input.connectionProvider.get;
|
|
70957
|
+
const origin = yield* normalizeHttpBaseUrl(connection.origin.url);
|
|
70958
|
+
const wsTicket = yield* input.authTransport.issueWebSocketTicket({
|
|
70959
|
+
url: origin,
|
|
70960
|
+
token: connection.auth.token
|
|
70961
|
+
});
|
|
70962
|
+
return getOrThrow(toUrl(get$1(yield* toWebSocketEndpointUrl(origin, "/ws")).pipe(setUrlParam("wsTicket", wsTicket.ticket)))).toString();
|
|
70920
70963
|
});
|
|
70921
|
-
function makeProtocolLayer(url) {
|
|
70922
|
-
const socketLayer = layerWebSocket(url).pipe(provide$2(
|
|
70964
|
+
function makeProtocolLayer(url, webSocketConstructor) {
|
|
70965
|
+
const socketLayer = layerWebSocket(url).pipe(provide$2(succeed$3(WebSocketConstructor, webSocketConstructor)));
|
|
70923
70966
|
return layerProtocolSocket({ retryTransientErrors: true }).pipe(provide$2(socketLayer), provide$2(layerJson));
|
|
70924
70967
|
}
|
|
70925
70968
|
const T3RpcLive = effectContext(makeT3RpcLayer().pipe(map$3((rpc) => make$40(T3Rpc, rpc))));
|
|
@@ -71415,6 +71458,7 @@ const makeNodeSqliteClient = fn("makeNodeSqliteClient")(function* (config) {
|
|
|
71415
71458
|
transformRows
|
|
71416
71459
|
});
|
|
71417
71460
|
});
|
|
71461
|
+
const NodeSqliteClientLive = (config) => effectContext(map$3(makeNodeSqliteClient(config), (client) => make$40(SqlClient, client))).pipe(provide$2(layer));
|
|
71418
71462
|
const NodeSqlClientFactoryLive = succeed$3(SqlClientFactory, { sqliteClient: (config) => makeNodeSqliteClient(config).pipe(provide(layer)) });
|
|
71419
71463
|
function toSqlInputValue(value) {
|
|
71420
71464
|
if (value === void 0 || value === null) return null;
|
|
@@ -71432,13 +71476,24 @@ function toSqlInputValue(value) {
|
|
|
71432
71476
|
//#endregion
|
|
71433
71477
|
//#region src/runtime.ts
|
|
71434
71478
|
const T3AuthTransportLayer = T3AuthTransportLive.pipe(provide$2(layerUndici));
|
|
71435
|
-
const
|
|
71436
|
-
const
|
|
71479
|
+
const T3LocalAuthOriginLayer = T3LocalAuthOriginLive;
|
|
71480
|
+
const T3LocalAuthTokenLayer = T3LocalAuthTokenLive.pipe(provide$2(NodeSqlClientFactoryLive));
|
|
71481
|
+
const T3LocalAuthLayer = T3LocalAuthLive.pipe(provide$2(mergeAll$1(T3LocalAuthOriginLayer, T3LocalAuthTokenLayer)));
|
|
71482
|
+
const T3AuthPairingLayer = T3AuthPairingLive.pipe(provide$2(T3AuthTransportLayer));
|
|
71437
71483
|
const T3AuthLayer = T3AuthLive.pipe(provide$2(mergeAll$1(T3ConfigLive, T3AuthTransportLayer, T3LocalAuthLayer, T3AuthPairingLayer)));
|
|
71438
|
-
const
|
|
71484
|
+
const T3ConfigConnectionProviderLayer = effect(T3CodeConnectionProvider, gen(function* () {
|
|
71485
|
+
return makeT3CodeConnectionProvider((yield* T3Config).resolve().pipe(map$3((resolved) => ({
|
|
71486
|
+
origin: { url: resolved.url },
|
|
71487
|
+
auth: { token: resolved.token }
|
|
71488
|
+
})), mapError$2((error) => new T3CodeConnectionError({
|
|
71489
|
+
message: "failed to resolve T3 Code connection from CLI config",
|
|
71490
|
+
cause: error
|
|
71491
|
+
}))));
|
|
71492
|
+
})).pipe(provide$2(T3ConfigLive));
|
|
71493
|
+
const T3RpcLayer = T3RpcLive.pipe(provide$2(mergeAll$1(T3ConfigConnectionProviderLayer, T3AuthTransportLayer, layerWebSocketConstructor)));
|
|
71439
71494
|
const T3OrchestrationLayer = T3OrchestrationLive.pipe(provide$2(T3RpcLayer));
|
|
71440
71495
|
const T3ApplicationLayer = T3ApplicationLive.pipe(provide$2(T3OrchestrationLayer));
|
|
71441
71496
|
const AuthAppLayer = mergeAll$1(T3ConfigLive, T3AuthLayer);
|
|
71442
71497
|
const AppLayer = mergeAll$1(T3ConfigLive, T3AuthLayer, T3RpcLayer, T3OrchestrationLayer, T3ApplicationLayer);
|
|
71443
71498
|
//#endregion
|
|
71444
|
-
export {
|
|
71499
|
+
export { T3Config as $, hasInterruptsOnly as $n, endUnsafe as $t, T3LocalAuthTokenLive as A, map$3 as An, isSome as Ar, WatchBackend as At, AuthLocalSigningError as B, serviceOption as Bn, hasProperty as Br, runCollect as Bt, makeT3AuthPairing as C, forEach$1 as Cn, make$40 as Cr, fromWritable as Ct, T3LocalAuthLive as D, interrupt$1 as Dn, getOrElse$1 as Dr, FileSystem as Dt, T3LocalAuth as E, ignore$1 as En, fromUndefinedOr as Er, FileDescriptor as Et, makeT3LocalAuthOrigin as F, provideContext$2 as Fn, Prototype as Fr, fromIterable$1 as Ft, layerWebSocketConstructor as G, tapError$2 as Gn, constVoid as Gr, succeed as Gt, AuthTransportError as H, suspend$3 as Hn, isNotUndefined as Hr, runFold as Ht, AuthConfigError as I, provideService$1 as In, PipeInspectableProto as Ir, isStream as It, ThreadSessionError as J, try_ as Jn, pipe as Jr, unwrap as Jt, layerUndici as K, timeoutOrElse as Kn, dual as Kr, tap as Kt, AuthLocalDatabaseError as L, result as Ln, withFiber$1 as Lr, merge$1 as Lt, SqlClientFactory as M, matchEffect as Mn, match$3 as Mr, callback as Mt, T3LocalAuthOrigin as N, orDie as Nn, none as Nr, decodeText as Nt, makeT3LocalAuth as O, isEffect as On, getOrUndefined as Or, FileTypeId as Ot, T3LocalAuthOriginLive as P, provide as Pn, some as Pr, empty$6 as Pt, Environment as Q, fail$3 as Qn, __toESM as Qr, isSink as Qt, AuthLocalError as R, runFork as Rn, BaseProto as Rr, mkString as Rt, T3AuthPairingLive as S, fnUntraced as Sn, getUnsafe$2 as Sr, fromReadable as St, T3AuthTransportLive as T, gen as Tn, fromNullishOr as Tr, TypeId$29 as Tt, ConfigError as U, sync as Un, isNullish as Ur, runLast as Ut, AuthPairingUrlError as V, succeed$2 as Vn, isNotNull as Vr, runDrain as Vt, UrlError as W, tapCause as Wn, isUndefined as Wr, splitLines as Wt, threadStatus as X, void_$1 as Xn, __commonJSMin as Xr, make$25 as Xt, latestAssistantMessage as Y, uninterruptible as Yn, pipeArguments as Yr, get$2 as Yt, T3Application as Z, TaggedError as Zn, __require as Zr, drain as Zt, makeT3CodeConnectionProvider as _, catch_$1 as _n, fail$6 as _r, optionalKey as _t, T3AuthTransportLayer as a, badArgument as an, succeed$3 as ar, Int as at, makeT3Auth as b, flatMap$2 as bn, Service$1 as br, Crypto as bt, T3LocalAuthTokenLayer as c, transform as cn, _await as cr, String$1 as ct, makeNodeSqliteClient as d, andThen as dn, makeUnsafe$8 as dr, Union as dt, failCauseUnsafe as en, squash as er, T3Auth as et, T3RpcLive as f, as as fn, isSuccess as fr, decodeTo as ft, T3CodeConnectionProviderLive as g, catchTags$1 as gn, map$5 as gr, optional as gt, T3CodeConnectionProvider as h, catchFilter$2 as hn, sync$2 as hr, is as ht, T3AuthPairingLayer as i, BadArgument as in, provideMerge as ir, ErrorClass as it, makeT3LocalAuthToken as j, mapError$2 as jn, map$7 as jr, make$24 as jt, T3LocalAuthToken as k, logError as kn, isNone as kr, Size as kt, NodeSqlClientFactoryLive as l, acquireRelease as ln, doneUnsafe as lr, Struct as lt, makeT3Config as m, callback$1 as mn, ConsoleRef as mr, fromJsonString as mt, AuthAppLayer as n, offer as nn, mergeAll$1 as nr, Boolean$1 as nt, T3LocalAuthLayer as o, systemError as on, sync$1 as or, Literal as ot, T3ConfigLive as p, asVoid as pn, succeed$4 as pr, decodeUnknownEffect as pt, NodeEnvironmentLive as q, tryPromise as qn, identity as qr, transduce as qt, T3AuthLayer as r, offerUnsafe as rn, provide$2 as rr, Defect as rt, T3LocalAuthOriginLayer as s, nominal as sn, MinimumLogLevel as sr, Literals as st, AppLayer as t, make$27 as tn, effect as tr, ArraySchema as tt, NodeSqliteClientLive as u, addFinalizer as un, isDone$1 as ur, TaggedErrorClass as ut, T3CodeConnectionError as v, effectify as vn, succeed$6 as vr, tag as vt, parsePairingUrl as w, forkScoped as wn, flatMap$4 as wr, Path as wt, T3AuthPairing as x, fn as xn, empty$11 as xr, make$23 as xt, T3AuthLive as y, fail$2 as yn, Reference as yr, toCodecStringTree as yt, AuthLocalSecretError as z, scoped$2 as zn, format$1 as zr, run$1 as zt };
|