t3code-cli 0.5.1 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -16
- package/dist/Context-DueQ9iMH.js +4916 -0
- package/dist/Path-D8WPdPwR.js +11406 -0
- package/dist/Schema-DsQxYh6_.js +13581 -0
- package/dist/UrlParams-BA6gBvaY.js +205 -0
- package/dist/application.js +2 -0
- package/dist/auth.js +3 -0
- package/dist/base-dir-R12OMDso.js +20 -0
- package/dist/bin.js +236 -13526
- package/dist/chunk-B5meny8j.js +36 -0
- package/dist/cli.js +2 -0
- package/dist/config.js +4 -0
- package/dist/connection.js +15 -0
- package/dist/contracts.js +1 -0
- package/dist/error-B2t1bAP9.js +169 -0
- package/dist/error-BHRnjLux.js +15 -0
- package/dist/error-jwMt3VoW.js +54 -0
- package/dist/flags-CM7_iGdA.js +13371 -0
- package/dist/index.js +5 -12
- package/dist/layer-CfC5qZol.js +1508 -0
- package/dist/layer-DHhKS5jd.js +13 -0
- package/dist/layer-DIg0RxSO.js +1217 -0
- package/dist/layer-DUv99vsS.js +72 -0
- package/dist/layer-DvHnKBYj.js +29466 -0
- package/dist/layout.js +2 -0
- package/dist/orchestration.js +2 -0
- package/dist/rpc.js +2 -0
- package/dist/runtime.js +3 -0
- package/dist/scope-GycYiJ54.js +29 -0
- package/dist/scope.js +2 -0
- package/dist/service-CLmRO2Dp.js +8 -0
- package/dist/service-ybOWV9pL.js +5 -0
- package/dist/src/application/index.d.ts +3 -0
- package/dist/src/application/layer.d.ts +4 -4
- package/dist/src/application/projects.d.ts +1 -1
- package/dist/src/application/service.d.ts +1 -1
- package/dist/src/application/threads.d.ts +4 -4
- package/dist/src/auth/index.d.ts +10 -0
- package/dist/src/auth/local-base-dir.d.ts +5 -7
- package/dist/src/auth/local-token.d.ts +2 -2
- package/dist/src/auth/type.d.ts +1 -0
- package/dist/src/cli/flags.d.ts +15 -0
- package/dist/src/cli/index.d.ts +1 -0
- package/dist/src/cli/output-format.d.ts +9 -0
- package/dist/src/config/index.d.ts +5 -0
- package/dist/src/config/layer.d.ts +2 -0
- package/dist/src/config/service.d.ts +2 -0
- package/dist/src/connection/index.d.ts +5 -0
- package/dist/src/contracts/index.d.ts +1 -0
- package/dist/src/domain/helpers.d.ts +164 -32
- package/dist/src/index.d.ts +4 -28
- package/dist/src/layout/base-dir.d.ts +12 -0
- package/dist/src/layout/index.d.ts +1 -0
- package/dist/src/orchestration/index.d.ts +2 -0
- package/dist/src/rpc/index.d.ts +1 -0
- package/dist/src/runtime/index.d.ts +2 -0
- package/dist/src/runtime/layer.d.ts +11 -0
- package/dist/src/scope/index.d.ts +1 -0
- package/dist/src/scope/resolve.d.ts +19 -0
- package/dist/src/t3tools/index.d.ts +1 -0
- package/dist/src-KdbHqrex.js +8874 -0
- package/dist/t3tools.js +2 -0
- package/dist/transport-D3zBdZ1h.js +539 -0
- package/dist/url-SlsaG8nY.js +165 -0
- package/package.json +50 -1
- package/src/application/index.ts +3 -0
- package/src/application/service.ts +1 -1
- package/src/application/threads.ts +40 -11
- package/src/auth/index.ts +28 -0
- package/src/auth/layer.ts +13 -6
- package/src/auth/local-base-dir.ts +15 -19
- package/src/auth/local-origin.ts +4 -1
- package/src/auth/local-token.ts +4 -1
- package/src/auth/type.ts +1 -0
- package/src/bin.ts +1 -1
- package/src/cli/app.ts +6 -6
- package/src/cli/auth-format.ts +2 -0
- package/src/cli/auth.ts +19 -9
- package/src/cli/error.ts +7 -0
- package/src/cli/flags.ts +51 -0
- package/src/cli/index.ts +10 -0
- package/src/cli/{models.ts → model.ts} +5 -4
- package/src/cli/{projects.ts → project.ts} +8 -7
- package/src/cli/require.ts +31 -0
- package/src/cli/{threads.ts → thread.ts} +2 -2
- package/src/cli/threads/archive.ts +24 -8
- package/src/cli/threads/list.ts +12 -5
- package/src/cli/threads/messages.ts +20 -5
- package/src/cli/threads/send.ts +27 -23
- package/src/cli/threads/start.ts +22 -21
- package/src/cli/threads/wait.ts +22 -12
- package/src/config/index.ts +5 -0
- package/src/config/layer.ts +2 -0
- package/src/config/service.ts +2 -0
- package/src/connection/index.ts +9 -0
- package/src/contracts/index.ts +8 -0
- package/src/domain/helpers.ts +136 -16
- package/src/index.ts +4 -87
- package/src/layout/base-dir.ts +35 -0
- package/src/layout/index.ts +1 -0
- package/src/orchestration/index.ts +7 -0
- package/src/rpc/index.ts +1 -0
- package/src/runtime/index.ts +12 -0
- package/src/{runtime.ts → runtime/layer.ts} +15 -15
- package/src/scope/index.ts +6 -0
- package/src/scope/resolve.ts +62 -0
- package/src/t3tools/index.ts +1 -0
- package/dist/runtime-KQVRmRk-.js +0 -71499
- package/dist/src/connection.d.ts +0 -5
- package/dist/src/runtime.d.ts +0 -10
- package/src/connection.ts +0 -9
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
import { J as make$1, On as dual, Xt as symbol, Y as strictEqual, Zt as array, in as symbol$1, it as PipeInspectableProto } from "./Context-DueQ9iMH.js";
|
|
2
|
+
import { Gr as append, Jr as filter, Yr as fromIterable, ci as makeEquivalence$1, ei as makeEquivalence, li as fail, on as TaggedError, pi as succeed } from "./Path-D8WPdPwR.js";
|
|
3
|
+
import "./Schema-DsQxYh6_.js";
|
|
4
|
+
//#region node_modules/.pnpm/effect@4.0.0-beta.78/node_modules/effect/dist/unstable/http/UrlParams.js
|
|
5
|
+
/**
|
|
6
|
+
* Immutable URL query parameters represented as ordered string pairs.
|
|
7
|
+
*
|
|
8
|
+
* This module is the shared query-parameter model for HTTP client request
|
|
9
|
+
* queries, URL-encoded form bodies, and server-side decoding. A `UrlParams`
|
|
10
|
+
* value can be built from records, iterables, or native `URLSearchParams`, then
|
|
11
|
+
* inspected, appended, replaced, removed, serialized, converted to a `URL`, or
|
|
12
|
+
* decoded with schemas.
|
|
13
|
+
*
|
|
14
|
+
* **Mental model**
|
|
15
|
+
*
|
|
16
|
+
* The core representation is a list of `[key, value]` string pairs. Duplicate
|
|
17
|
+
* keys and pair order are preserved by `make`, `fromInput`, iteration, and
|
|
18
|
+
* append-style operations. Record input is a convenience layer: primitive values
|
|
19
|
+
* become strings, arrays become repeated parameters, nested records use bracket
|
|
20
|
+
* notation, and `undefined` fields are skipped.
|
|
21
|
+
*
|
|
22
|
+
* **Common tasks**
|
|
23
|
+
*
|
|
24
|
+
* - Build query parameters from plain records, tuples, or `URLSearchParams`.
|
|
25
|
+
* - Read the first, last, or all values for a key.
|
|
26
|
+
* - Replace, append, transform, or remove keys without mutating the original.
|
|
27
|
+
* - Serialize a query string, merge parameters into a URL, or decode records and
|
|
28
|
+
* JSON fields with schemas.
|
|
29
|
+
*
|
|
30
|
+
* **Gotchas**
|
|
31
|
+
*
|
|
32
|
+
* Use `getAll` when every duplicate value matters. `set` and `setAll` replace
|
|
33
|
+
* existing values for matching keys, while `append` and `appendAll` preserve
|
|
34
|
+
* them. Serialization through `toString` and `makeUrl` delegates to the platform
|
|
35
|
+
* `URLSearchParams` / `URL` implementations, so pass decoded strings rather
|
|
36
|
+
* than pre-encoded query fragments. Record-based and schema-based conversions
|
|
37
|
+
* collapse repeated keys into string arrays and do not preserve the full global
|
|
38
|
+
* pair ordering; `schemaJsonField` reads the first matching value for the
|
|
39
|
+
* selected field.
|
|
40
|
+
*
|
|
41
|
+
* @since 4.0.0
|
|
42
|
+
*/
|
|
43
|
+
const TypeId = "~effect/http/UrlParams";
|
|
44
|
+
const Proto = {
|
|
45
|
+
...PipeInspectableProto,
|
|
46
|
+
[TypeId]: TypeId,
|
|
47
|
+
[Symbol.iterator]() {
|
|
48
|
+
return this.params[Symbol.iterator]();
|
|
49
|
+
},
|
|
50
|
+
toJSON() {
|
|
51
|
+
return {
|
|
52
|
+
_id: "UrlParams",
|
|
53
|
+
params: Object.fromEntries(this.params)
|
|
54
|
+
};
|
|
55
|
+
},
|
|
56
|
+
[symbol](that) {
|
|
57
|
+
return Equivalence(this, that);
|
|
58
|
+
},
|
|
59
|
+
[symbol$1]() {
|
|
60
|
+
return array(this.params.flat());
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* Creates `UrlParams` from ordered string key-value pairs.
|
|
65
|
+
*
|
|
66
|
+
* **Details**
|
|
67
|
+
*
|
|
68
|
+
* The input pairs are used as-is and are not coerced or normalized.
|
|
69
|
+
*
|
|
70
|
+
* @category constructors
|
|
71
|
+
* @since 4.0.0
|
|
72
|
+
*/
|
|
73
|
+
const make = (params) => {
|
|
74
|
+
const self = Object.create(Proto);
|
|
75
|
+
self.params = params;
|
|
76
|
+
return self;
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* Creates `UrlParams` from a supported input shape.
|
|
80
|
+
*
|
|
81
|
+
* **Details**
|
|
82
|
+
*
|
|
83
|
+
* Primitive values are converted to strings, arrays produce repeated parameters,
|
|
84
|
+
* nested records use bracket notation, and `undefined` values are omitted.
|
|
85
|
+
*
|
|
86
|
+
* @category constructors
|
|
87
|
+
* @since 4.0.0
|
|
88
|
+
*/
|
|
89
|
+
const fromInput = (input) => {
|
|
90
|
+
const parsed = fromInputNested(input);
|
|
91
|
+
const out = [];
|
|
92
|
+
for (let i = 0; i < parsed.length; i++) if (Array.isArray(parsed[i][0])) {
|
|
93
|
+
const [keys, value] = parsed[i];
|
|
94
|
+
out.push([`${keys[0]}[${keys.slice(1).join("][")}]`, value]);
|
|
95
|
+
} else out.push(parsed[i]);
|
|
96
|
+
return make(out);
|
|
97
|
+
};
|
|
98
|
+
const fromInputNested = (input) => {
|
|
99
|
+
const entries = typeof input[Symbol.iterator] === "function" ? fromIterable(input) : Object.entries(input);
|
|
100
|
+
const out = [];
|
|
101
|
+
for (const [key, value] of entries) if (Array.isArray(value)) {
|
|
102
|
+
for (let i = 0; i < value.length; i++) if (value[i] !== void 0) out.push([key, String(value[i])]);
|
|
103
|
+
} else if (typeof value === "object") {
|
|
104
|
+
const nested = fromInputNested(value);
|
|
105
|
+
for (const [k, v] of nested) out.push([[key, ...typeof k === "string" ? [k] : k], v]);
|
|
106
|
+
} else if (value !== void 0) out.push([key, String(value)]);
|
|
107
|
+
return out;
|
|
108
|
+
};
|
|
109
|
+
/**
|
|
110
|
+
* Provides an order-sensitive `Equivalence` instance for `UrlParams`.
|
|
111
|
+
*
|
|
112
|
+
* **Details**
|
|
113
|
+
*
|
|
114
|
+
* Two values are equivalent when they contain the same key-value pairs in the same
|
|
115
|
+
* order.
|
|
116
|
+
*
|
|
117
|
+
* @category instances
|
|
118
|
+
* @since 4.0.0
|
|
119
|
+
*/
|
|
120
|
+
const Equivalence = /*#__PURE__*/ make$1((a, b) => arrayEquivalence(a.params, b.params));
|
|
121
|
+
const arrayEquivalence = /*#__PURE__*/ makeEquivalence(/*#__PURE__*/ makeEquivalence$1([/*#__PURE__*/ strictEqual(), /*#__PURE__*/ strictEqual()]));
|
|
122
|
+
/**
|
|
123
|
+
* An empty `UrlParams` value.
|
|
124
|
+
*
|
|
125
|
+
* @category constructors
|
|
126
|
+
* @since 4.0.0
|
|
127
|
+
*/
|
|
128
|
+
const empty = /*#__PURE__*/ make([]);
|
|
129
|
+
/**
|
|
130
|
+
* Sets a query parameter to a single value.
|
|
131
|
+
*
|
|
132
|
+
* **Details**
|
|
133
|
+
*
|
|
134
|
+
* Existing values for the same key are removed, and the new value is appended to
|
|
135
|
+
* the end.
|
|
136
|
+
*
|
|
137
|
+
* @category combinators
|
|
138
|
+
* @since 4.0.0
|
|
139
|
+
*/
|
|
140
|
+
const set = /*#__PURE__*/ dual(3, (self, key, value) => make(append(filter(self.params, ([k]) => k !== key), [key, String(value)])));
|
|
141
|
+
/**
|
|
142
|
+
* Sets multiple query parameters from input.
|
|
143
|
+
*
|
|
144
|
+
* **Details**
|
|
145
|
+
*
|
|
146
|
+
* Keys present in the input replace existing values for those keys, while
|
|
147
|
+
* unmentioned existing parameters are preserved.
|
|
148
|
+
*
|
|
149
|
+
* @category combinators
|
|
150
|
+
* @since 4.0.0
|
|
151
|
+
*/
|
|
152
|
+
const setAll = /*#__PURE__*/ dual(2, (self, input) => {
|
|
153
|
+
const out = fromInput(input);
|
|
154
|
+
const params = out.params;
|
|
155
|
+
const keys = /* @__PURE__ */ new Set();
|
|
156
|
+
for (let i = 0; i < params.length; i++) keys.add(params[i][0]);
|
|
157
|
+
for (let i = 0; i < self.params.length; i++) {
|
|
158
|
+
if (keys.has(self.params[i][0])) continue;
|
|
159
|
+
params.push(self.params[i]);
|
|
160
|
+
}
|
|
161
|
+
return out;
|
|
162
|
+
});
|
|
163
|
+
/**
|
|
164
|
+
* Error returned when constructing a `URL` from `UrlParams` fails.
|
|
165
|
+
*
|
|
166
|
+
* @category errors
|
|
167
|
+
* @since 4.0.0
|
|
168
|
+
*/
|
|
169
|
+
var UrlParamsError = class extends TaggedError("UrlParamsError") {};
|
|
170
|
+
/**
|
|
171
|
+
* Creates a `URL` safely by appending `UrlParams` and an optional hash to a URL string.
|
|
172
|
+
*
|
|
173
|
+
* **Details**
|
|
174
|
+
*
|
|
175
|
+
* Returns a `Result` that fails with `UrlParamsError` if the URL cannot be
|
|
176
|
+
* constructed.
|
|
177
|
+
*
|
|
178
|
+
* @category converting
|
|
179
|
+
* @since 4.0.0
|
|
180
|
+
*/
|
|
181
|
+
const makeUrl = (url, params, hash) => {
|
|
182
|
+
try {
|
|
183
|
+
const urlInstance = new URL(url, baseUrl());
|
|
184
|
+
for (let i = 0; i < params.params.length; i++) {
|
|
185
|
+
const [key, value] = params.params[i];
|
|
186
|
+
if (value !== void 0) urlInstance.searchParams.append(key, value);
|
|
187
|
+
}
|
|
188
|
+
if (hash !== void 0) urlInstance.hash = hash;
|
|
189
|
+
return succeed(urlInstance);
|
|
190
|
+
} catch (e) {
|
|
191
|
+
return fail(new UrlParamsError({ cause: e }));
|
|
192
|
+
}
|
|
193
|
+
};
|
|
194
|
+
/**
|
|
195
|
+
* Serializes `UrlParams` to a URL query string without a leading question mark.
|
|
196
|
+
*
|
|
197
|
+
* @category converting
|
|
198
|
+
* @since 4.0.0
|
|
199
|
+
*/
|
|
200
|
+
const toString = (self) => new URLSearchParams(self.params).toString();
|
|
201
|
+
const baseUrl = () => {
|
|
202
|
+
if ("location" in globalThis && globalThis.location !== void 0 && globalThis.location.origin !== void 0 && globalThis.location.pathname !== void 0) return location.origin + location.pathname;
|
|
203
|
+
};
|
|
204
|
+
//#endregion
|
|
205
|
+
export { setAll as a, set as i, fromInput as n, toString as o, makeUrl as r, empty as t };
|
package/dist/auth.js
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { a as makeT3AuthPairing, b as makeT3LocalAuthOrigin, c as T3LocalAuthLive, d as T3LocalAuthTokenLive, f as makeT3LocalAuthToken, i as T3AuthPairingLive, l as makeT3LocalAuth, n as makeT3Auth, o as parsePairingUrl, r as T3AuthPairing, s as T3LocalAuth, t as T3AuthLive, u as T3LocalAuthToken, v as T3LocalAuthOrigin, x as T3Auth, y as T3LocalAuthOriginLive } from "./layer-CfC5qZol.js";
|
|
2
|
+
import { a as AuthLocalSigningError, i as AuthLocalSecretError, n as AuthLocalDatabaseError, o as AuthPairingUrlError, r as AuthLocalError, s as AuthTransportError, t as AuthConfigError } from "./error-jwMt3VoW.js";
|
|
3
|
+
export { AuthConfigError, AuthLocalDatabaseError, AuthLocalError, AuthLocalSecretError, AuthLocalSigningError, AuthPairingUrlError, AuthTransportError, T3Auth, T3AuthLive, T3AuthPairing, T3AuthPairingLive, T3LocalAuth, T3LocalAuthLive, T3LocalAuthOrigin, T3LocalAuthOriginLive, T3LocalAuthToken, T3LocalAuthTokenLive, makeT3Auth, makeT3AuthPairing, makeT3LocalAuth, makeT3LocalAuthOrigin, makeT3LocalAuthToken, parsePairingUrl };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { P as fn, t as Path } from "./Path-D8WPdPwR.js";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
//#region src/layout/base-dir.ts
|
|
4
|
+
function readT3LayoutFromNodeProcess() {
|
|
5
|
+
return {
|
|
6
|
+
cwd: process.cwd(),
|
|
7
|
+
homeDir: homedir(),
|
|
8
|
+
t3codeHome: process.env["T3CODE_HOME"]
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
const resolveT3BaseDir = fn("resolveT3BaseDir")(function* (input) {
|
|
12
|
+
const path = yield* Path;
|
|
13
|
+
const raw = input.baseDir ?? input.layout.t3codeHome;
|
|
14
|
+
if (raw === void 0 || raw.length === 0) return path.join(input.layout.homeDir, ".t3");
|
|
15
|
+
if (raw === "~") return input.layout.homeDir;
|
|
16
|
+
if (raw.startsWith("~/") || raw.startsWith("~\\")) return path.join(input.layout.homeDir, raw.slice(2));
|
|
17
|
+
return path.resolve(input.layout.cwd, raw);
|
|
18
|
+
});
|
|
19
|
+
//#endregion
|
|
20
|
+
export { resolveT3BaseDir as n, readT3LayoutFromNodeProcess as t };
|