@runtypelabs/cli 2.59.1 → 2.59.2
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/chunk-0-T9NWjH.js +3899 -0
- package/dist/chunk-0x7UKC1U.js +17 -0
- package/dist/chunk-2ySxXtcg.js +418 -0
- package/dist/chunk-3An_BRHv.js +501 -0
- package/dist/chunk-6uTxgdiY.js +16218 -0
- package/dist/chunk-87nRnNRG.js +1363 -0
- package/dist/chunk-B3wo8uRx.js +322 -0
- package/dist/chunk-BGp3ZdBy.js +560 -0
- package/dist/chunk-BJQv9Elp.js +107 -0
- package/dist/chunk-BOpO6xE-.js +6053 -0
- package/dist/chunk-BQXXCL8B.js +102 -0
- package/dist/chunk-BV-8isOd.js +34 -0
- package/dist/chunk-BVMhjGVe.js +826 -0
- package/dist/chunk-BW2fg46T.js +141 -0
- package/dist/chunk-BWJdY5Ag.js +36 -0
- package/dist/chunk-BYJOrLhh.js +302 -0
- package/dist/chunk-BYab8EVL.js +127 -0
- package/dist/chunk-BfEKvp7h.js +82 -0
- package/dist/chunk-BhgLSfH6.js +1123 -0
- package/dist/chunk-BirUxTtH.js +296 -0
- package/dist/chunk-BmB6UVZ9.js +1559 -0
- package/dist/chunk-BnWhIqW1.js +109 -0
- package/dist/chunk-Bpfnfk0t.js +123 -0
- package/dist/chunk-BrhgdnM3.js +108 -0
- package/dist/chunk-Bt0XAgX5.js +327 -0
- package/dist/chunk-Bu0FJr6S.js +84 -0
- package/dist/chunk-BvEoKpN3.js +255 -0
- package/dist/chunk-BxNJgYbE.js +28 -0
- package/dist/chunk-C1OFhd7F.js +6131 -0
- package/dist/chunk-C7e7WwbU.js +331 -0
- package/dist/chunk-CDTYP6bN.js +558 -0
- package/dist/chunk-CGDQoqDC.js +24 -0
- package/dist/chunk-CJraEBVd.js +127 -0
- package/dist/chunk-CQrNhOtv.js +40 -0
- package/dist/chunk-CW6AzBH6.js +128 -0
- package/dist/chunk-CXgL4w-9.js +317 -0
- package/dist/chunk-CZrqoPyf.js +233 -0
- package/dist/chunk-CcFCyqbB.js +83 -0
- package/dist/chunk-CdaIvO-y.js +485 -0
- package/dist/chunk-CehSXtgK.js +624 -0
- package/dist/chunk-Ciqkop65.js +218 -0
- package/dist/chunk-CoAWdSiE.js +43 -0
- package/dist/chunk-Crb4y7t4.js +830 -0
- package/dist/chunk-CrlqIfmb.js +337 -0
- package/dist/chunk-Cs4pwCQ-.js +324 -0
- package/dist/chunk-CwM_9y01.js +519 -0
- package/dist/chunk-CyRbIJg8.js +440 -0
- package/dist/chunk-D0OHsyMy.js +212 -0
- package/dist/chunk-D3y2bURs.js +1347 -0
- package/dist/chunk-D4_mJk03.js +2338 -0
- package/dist/chunk-D6C8rned.js +578 -0
- package/dist/chunk-D9ZbUnks.js +11 -0
- package/dist/chunk-DEPmLshX.js +834 -0
- package/dist/chunk-DFj1UPB2.js +330 -0
- package/dist/chunk-DGdFdZVf.js +197 -0
- package/dist/chunk-DGv7X9S_.js +63 -0
- package/dist/chunk-DJQ47WYZ.js +664 -0
- package/dist/chunk-DJw3O61j.js +1974 -0
- package/dist/chunk-DK4FbWVK.js +100 -0
- package/dist/chunk-DSRYhUus.js +993 -0
- package/dist/chunk-DajZ9Eg4.js +299 -0
- package/dist/chunk-Df4dunvU.js +195 -0
- package/dist/chunk-DjNTPhfO.js +481 -0
- package/dist/chunk-Dn8eaJuu.js +1042 -0
- package/dist/chunk-DwDWqSxM.js +637 -0
- package/dist/chunk-Dz7cEtxl.js +84 -0
- package/dist/chunk-E_0bgjrS.js +359 -0
- package/dist/chunk-KPYN2vUp.js +776 -0
- package/dist/chunk-KcqPQJBi.js +86 -0
- package/dist/chunk-N9H0JnoG.js +349 -0
- package/dist/chunk-NONFcXkn.js +728 -0
- package/dist/chunk-PrFjcpmH.js +256 -0
- package/dist/chunk-QSfNYiw9.js +11 -0
- package/dist/chunk-R265bzj9.js +226 -0
- package/dist/chunk-X9V_r6jM.js +166 -0
- package/dist/chunk-ZBtPUtyA.js +55 -0
- package/dist/chunk-ZCTfmOs7.js +4939 -0
- package/dist/chunk-h6oavj0t.js +97 -0
- package/dist/chunk-i7DwkvvD.js +42 -0
- package/dist/chunk-mG-4eZ6S.js +203 -0
- package/dist/chunk-o0ygUbCf.js +313 -0
- package/dist/chunk-ucu5lrDZ.js +5715 -0
- package/dist/index.js +11367 -73789
- package/package.json +4 -4
|
@@ -0,0 +1,331 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import express from "express";
|
|
3
|
+
// src/auth/callback-server.ts
|
|
4
|
+
var CallbackServer = class {
|
|
5
|
+
server = null;
|
|
6
|
+
app;
|
|
7
|
+
codeResolve;
|
|
8
|
+
codeReject;
|
|
9
|
+
codePromise;
|
|
10
|
+
expectedState;
|
|
11
|
+
constructor() {
|
|
12
|
+
this.app = express();
|
|
13
|
+
this.codePromise = new Promise((resolve, reject) => {
|
|
14
|
+
this.codeResolve = resolve;
|
|
15
|
+
this.codeReject = reject;
|
|
16
|
+
});
|
|
17
|
+
this.app.get("/callback", (req, res) => {
|
|
18
|
+
const { token, code, state, error } = req.query;
|
|
19
|
+
if (typeof state !== "string" || state !== this.expectedState) {
|
|
20
|
+
res.status(400).send(this.errorHTML("Invalid authentication state. Continue the login you started in the CLI."));
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const values = [
|
|
24
|
+
token,
|
|
25
|
+
code,
|
|
26
|
+
error
|
|
27
|
+
].filter((value) => value !== void 0);
|
|
28
|
+
if (values.length !== 1 || typeof values[0] !== "string" || values[0].length === 0) {
|
|
29
|
+
res.status(400).send(this.errorHTML("Invalid authentication callback"));
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (typeof error === "string") {
|
|
33
|
+
res.send(this.errorHTML(error));
|
|
34
|
+
this.codeReject(new Error(error));
|
|
35
|
+
setTimeout(() => this.stop(), 1e3);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
res.send(this.successHTML());
|
|
39
|
+
this.codeResolve(values[0]);
|
|
40
|
+
setTimeout(() => this.stop(), 1e3);
|
|
41
|
+
});
|
|
42
|
+
this.app.get("/health", (_req, res) => {
|
|
43
|
+
res.json({ status: "ok" });
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
/** Set expected state parameter for OAuth2 CSRF validation */
|
|
47
|
+
setExpectedState(state) {
|
|
48
|
+
if (!state) throw new Error("Authentication requires a nonempty expected state");
|
|
49
|
+
if (this.server) throw new Error("Expected state must be registered before listening");
|
|
50
|
+
this.expectedState = state;
|
|
51
|
+
}
|
|
52
|
+
async start(port = 8765) {
|
|
53
|
+
if (!this.expectedState) throw new Error("Authentication requires an expected state before listening");
|
|
54
|
+
return new Promise((resolveStart, rejectStart) => {
|
|
55
|
+
this.server = this.app.listen(port, "127.0.0.1", () => {
|
|
56
|
+
const address = this.server?.address();
|
|
57
|
+
const actualPort = address && typeof address === "object" && "port" in address ? address.port : port;
|
|
58
|
+
console.log(`Callback server listening on port ${actualPort}`);
|
|
59
|
+
resolveStart({
|
|
60
|
+
actualPort,
|
|
61
|
+
codePromise: this.codePromise
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
this.server.on("error", (error) => {
|
|
65
|
+
if (error.code === "EADDRINUSE") {
|
|
66
|
+
console.log(`Port ${port} is in use, trying ${port + 1}...`);
|
|
67
|
+
this.server = null;
|
|
68
|
+
this.start(port + 1).then(resolveStart).catch(rejectStart);
|
|
69
|
+
} else rejectStart(error);
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
stop() {
|
|
74
|
+
if (this.server) {
|
|
75
|
+
const s = this.server;
|
|
76
|
+
this.server = null;
|
|
77
|
+
s.unref();
|
|
78
|
+
if (typeof s.closeAllConnections === "function") s.closeAllConnections();
|
|
79
|
+
s.close();
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
successHTML() {
|
|
83
|
+
return `<!DOCTYPE html>
|
|
84
|
+
<html lang="en">
|
|
85
|
+
<head>
|
|
86
|
+
<meta charset="utf-8">
|
|
87
|
+
<title>Authentication Successful</title>
|
|
88
|
+
<style>
|
|
89
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
90
|
+
body {
|
|
91
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
92
|
+
height: 100vh;
|
|
93
|
+
overflow: hidden;
|
|
94
|
+
background: #0a0a0a;
|
|
95
|
+
}
|
|
96
|
+
.grid-bg {
|
|
97
|
+
position: absolute;
|
|
98
|
+
inset: 0;
|
|
99
|
+
z-index: 0;
|
|
100
|
+
overflow: hidden;
|
|
101
|
+
}
|
|
102
|
+
.grid-bg .gradient {
|
|
103
|
+
position: absolute;
|
|
104
|
+
inset: 0;
|
|
105
|
+
background: linear-gradient(to bottom, #0a0a0a 0%, #171717 50%, #262626 100%);
|
|
106
|
+
}
|
|
107
|
+
@keyframes gridMove {
|
|
108
|
+
0% { background-position-y: 0; }
|
|
109
|
+
100% { background-position-y: 30px; }
|
|
110
|
+
}
|
|
111
|
+
.grid-bg .grid-vertical-wrap {
|
|
112
|
+
position: absolute;
|
|
113
|
+
left: 0;
|
|
114
|
+
right: 0;
|
|
115
|
+
bottom: 0;
|
|
116
|
+
top: 40%;
|
|
117
|
+
transform-origin: top center;
|
|
118
|
+
transform: perspective(500px) rotateX(60deg);
|
|
119
|
+
}
|
|
120
|
+
.grid-bg .grid-vertical-wrap .fade {
|
|
121
|
+
position: absolute;
|
|
122
|
+
inset: 0;
|
|
123
|
+
background: linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.02) 100%);
|
|
124
|
+
}
|
|
125
|
+
.grid-bg .grid-vertical-wrap .lines {
|
|
126
|
+
position: absolute;
|
|
127
|
+
inset: 0;
|
|
128
|
+
background-image: repeating-linear-gradient(
|
|
129
|
+
90deg,
|
|
130
|
+
transparent 0,
|
|
131
|
+
transparent 49px,
|
|
132
|
+
rgba(255,255,255,0.08) 49px,
|
|
133
|
+
rgba(255,255,255,0.08) 50px
|
|
134
|
+
);
|
|
135
|
+
background-size: 50px 100%;
|
|
136
|
+
}
|
|
137
|
+
.grid-bg .grid-horizontal {
|
|
138
|
+
position: absolute;
|
|
139
|
+
left: 0;
|
|
140
|
+
right: 0;
|
|
141
|
+
bottom: 0;
|
|
142
|
+
top: 40%;
|
|
143
|
+
transform-origin: top center;
|
|
144
|
+
transform: perspective(500px) rotateX(60deg);
|
|
145
|
+
background-image: repeating-linear-gradient(
|
|
146
|
+
0deg,
|
|
147
|
+
transparent 0,
|
|
148
|
+
transparent 29px,
|
|
149
|
+
rgba(255,255,255,0.06) 29px,
|
|
150
|
+
rgba(255,255,255,0.06) 30px
|
|
151
|
+
);
|
|
152
|
+
background-size: 100% 30px;
|
|
153
|
+
animation: gridMove 2s linear infinite;
|
|
154
|
+
}
|
|
155
|
+
.card-wrap {
|
|
156
|
+
position: absolute;
|
|
157
|
+
left: 50%;
|
|
158
|
+
top: 50%;
|
|
159
|
+
transform: translate(-50%, -50%);
|
|
160
|
+
z-index: 10;
|
|
161
|
+
width: 100%;
|
|
162
|
+
max-width: 400px;
|
|
163
|
+
perspective: 1400px;
|
|
164
|
+
animation: cardIn 0.4s ease-out;
|
|
165
|
+
}
|
|
166
|
+
@keyframes cardIn {
|
|
167
|
+
from { opacity: 0; transform: translate(-50%, -50%) translateY(16px); }
|
|
168
|
+
to { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
|
|
169
|
+
}
|
|
170
|
+
.card-inner {
|
|
171
|
+
position: relative;
|
|
172
|
+
}
|
|
173
|
+
.card-layer-back,
|
|
174
|
+
.card-layer-mid {
|
|
175
|
+
position: absolute;
|
|
176
|
+
inset: 0;
|
|
177
|
+
border-radius: 12px;
|
|
178
|
+
border: 1px solid #e5e7eb;
|
|
179
|
+
pointer-events: none;
|
|
180
|
+
}
|
|
181
|
+
.card-layer-back {
|
|
182
|
+
background: rgba(0, 0, 0, 0.08);
|
|
183
|
+
transform: translate3d(0, -18px, -36px) rotateX(6deg);
|
|
184
|
+
}
|
|
185
|
+
.card-layer-mid {
|
|
186
|
+
background: rgba(0, 0, 0, 0.05);
|
|
187
|
+
transform: translate3d(0, -10px, -20px) rotateX(3deg);
|
|
188
|
+
}
|
|
189
|
+
.card-front {
|
|
190
|
+
position: relative;
|
|
191
|
+
border-radius: 12px;
|
|
192
|
+
border: 1px solid rgba(255, 255, 255, 1);
|
|
193
|
+
background: rgba(0, 0, 0, .5);
|
|
194
|
+
backdrop-filter: blur(10px);
|
|
195
|
+
-webkit-backdrop-filter: blur(10px);
|
|
196
|
+
padding: 2rem 2.5rem;
|
|
197
|
+
text-align: center;
|
|
198
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
199
|
+
transform: rotateX(-10deg) translateZ(0);
|
|
200
|
+
transform-style: preserve-3d;
|
|
201
|
+
}
|
|
202
|
+
.card-front .section-title {
|
|
203
|
+
color: #ffffff;
|
|
204
|
+
font-size: 0.8125rem;
|
|
205
|
+
font-weight: 600;
|
|
206
|
+
letter-spacing: 0.05em;
|
|
207
|
+
text-transform: uppercase;
|
|
208
|
+
margin-bottom: 1rem;
|
|
209
|
+
}
|
|
210
|
+
.card-front .flow-arrow {
|
|
211
|
+
color: rgba(255, 255, 255, 0.7);
|
|
212
|
+
font-size: 1rem;
|
|
213
|
+
margin-bottom: 1rem;
|
|
214
|
+
line-height: 1;
|
|
215
|
+
}
|
|
216
|
+
.card-front .message {
|
|
217
|
+
color: #ffffff;
|
|
218
|
+
font-size: 0.75rem;
|
|
219
|
+
font-weight: 100;
|
|
220
|
+
margin-bottom: 0.5rem;
|
|
221
|
+
font-family: monospace;
|
|
222
|
+
}
|
|
223
|
+
.card-front .progress {
|
|
224
|
+
color: rgba(255, 255, 255, 0.75);
|
|
225
|
+
font-size: 0.8125rem;
|
|
226
|
+
}
|
|
227
|
+
</style>
|
|
228
|
+
</head>
|
|
229
|
+
<body>
|
|
230
|
+
<div class="grid-bg">
|
|
231
|
+
<div class="gradient"></div>
|
|
232
|
+
<div class="grid-vertical-wrap">
|
|
233
|
+
<div class="fade"></div>
|
|
234
|
+
<div class="lines"></div>
|
|
235
|
+
</div>
|
|
236
|
+
<div class="grid-horizontal"></div>
|
|
237
|
+
</div>
|
|
238
|
+
<div id="card-wrap" class="card-wrap">
|
|
239
|
+
<div class="card-inner">
|
|
240
|
+
<div class="card-layer-back" aria-hidden="true"></div>
|
|
241
|
+
<div class="card-layer-mid" aria-hidden="true"></div>
|
|
242
|
+
<div id="card" class="card-front">
|
|
243
|
+
<div class="section-title">Authentication Successful</div>
|
|
244
|
+
<div class="flow-arrow" aria-hidden="true">↓</div>
|
|
245
|
+
<p class="message">You can close this window and return to your terminal.</p>
|
|
246
|
+
<p class="progress" id="progress">Closing automatically in 3 seconds…</p>
|
|
247
|
+
</div>
|
|
248
|
+
</div>
|
|
249
|
+
</div>
|
|
250
|
+
<script>
|
|
251
|
+
setTimeout(function() {
|
|
252
|
+
window.close();
|
|
253
|
+
var prog = document.getElementById('progress');
|
|
254
|
+
if (prog) prog.textContent = 'You can now close this window.';
|
|
255
|
+
var card = document.getElementById('card');
|
|
256
|
+
if (card) card.innerHTML = '<div class="section-title">Runtype is Ready</div><p class="message">You can now close this window</p>';
|
|
257
|
+
}, 3000);
|
|
258
|
+
<\/script>
|
|
259
|
+
</body>
|
|
260
|
+
</html>`;
|
|
261
|
+
}
|
|
262
|
+
escapeHtml(str) {
|
|
263
|
+
return str.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
264
|
+
}
|
|
265
|
+
errorHTML(error) {
|
|
266
|
+
return `
|
|
267
|
+
<!DOCTYPE html>
|
|
268
|
+
<html>
|
|
269
|
+
<head>
|
|
270
|
+
<title>Authentication Failed</title>
|
|
271
|
+
<style>
|
|
272
|
+
* {
|
|
273
|
+
margin: 0;
|
|
274
|
+
padding: 0;
|
|
275
|
+
box-sizing: border-box;
|
|
276
|
+
}
|
|
277
|
+
body {
|
|
278
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
|
|
279
|
+
display: flex;
|
|
280
|
+
align-items: center;
|
|
281
|
+
justify-content: center;
|
|
282
|
+
height: 100vh;
|
|
283
|
+
background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
|
|
284
|
+
}
|
|
285
|
+
.container {
|
|
286
|
+
background: white;
|
|
287
|
+
padding: 3rem;
|
|
288
|
+
border-radius: 12px;
|
|
289
|
+
text-align: center;
|
|
290
|
+
box-shadow: 0 20px 40px rgba(0,0,0,0.1);
|
|
291
|
+
max-width: 400px;
|
|
292
|
+
}
|
|
293
|
+
.error-icon {
|
|
294
|
+
color: #ef4444;
|
|
295
|
+
font-size: 64px;
|
|
296
|
+
margin-bottom: 1rem;
|
|
297
|
+
}
|
|
298
|
+
h1 {
|
|
299
|
+
color: #1f2937;
|
|
300
|
+
margin-bottom: 0.5rem;
|
|
301
|
+
font-size: 1.5rem;
|
|
302
|
+
}
|
|
303
|
+
p {
|
|
304
|
+
color: #6b7280;
|
|
305
|
+
font-size: 1rem;
|
|
306
|
+
margin-bottom: 1rem;
|
|
307
|
+
}
|
|
308
|
+
.error-details {
|
|
309
|
+
background: #fef2f2;
|
|
310
|
+
color: #991b1b;
|
|
311
|
+
padding: 0.75rem;
|
|
312
|
+
border-radius: 6px;
|
|
313
|
+
font-size: 0.875rem;
|
|
314
|
+
font-family: monospace;
|
|
315
|
+
}
|
|
316
|
+
</style>
|
|
317
|
+
</head>
|
|
318
|
+
<body>
|
|
319
|
+
<div class="container">
|
|
320
|
+
<div class="error-icon">✕</div>
|
|
321
|
+
<h1>Authentication Failed</h1>
|
|
322
|
+
<p>There was an error during authentication.</p>
|
|
323
|
+
<div class="error-details">${this.escapeHtml(error)}</div>
|
|
324
|
+
</div>
|
|
325
|
+
</body>
|
|
326
|
+
</html>
|
|
327
|
+
`;
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
export { CallbackServer };
|
|
331
|
+
|