@runtypelabs/cli 0.2.1 → 0.2.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/index.js +189 -92
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -231,91 +231,184 @@ var CallbackServer = class {
|
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
233
|
successHTML() {
|
|
234
|
-
return
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
234
|
+
return `<!DOCTYPE html>
|
|
235
|
+
<html lang="en">
|
|
236
|
+
<head>
|
|
237
|
+
<meta charset="utf-8">
|
|
238
|
+
<title>Authentication Successful</title>
|
|
239
|
+
<style>
|
|
240
|
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
|
241
|
+
body {
|
|
242
|
+
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
|
243
|
+
height: 100vh;
|
|
244
|
+
overflow: hidden;
|
|
245
|
+
background: #0a0a0a;
|
|
246
|
+
}
|
|
247
|
+
.grid-bg {
|
|
248
|
+
position: absolute;
|
|
249
|
+
inset: 0;
|
|
250
|
+
z-index: 0;
|
|
251
|
+
overflow: hidden;
|
|
252
|
+
}
|
|
253
|
+
.grid-bg .gradient {
|
|
254
|
+
position: absolute;
|
|
255
|
+
inset: 0;
|
|
256
|
+
background: linear-gradient(to bottom, #0a0a0a 0%, #171717 50%, #262626 100%);
|
|
257
|
+
}
|
|
258
|
+
@keyframes gridMove {
|
|
259
|
+
0% { background-position-y: 0; }
|
|
260
|
+
100% { background-position-y: 30px; }
|
|
261
|
+
}
|
|
262
|
+
.grid-bg .grid-vertical-wrap {
|
|
263
|
+
position: absolute;
|
|
264
|
+
left: 0;
|
|
265
|
+
right: 0;
|
|
266
|
+
bottom: 0;
|
|
267
|
+
top: 40%;
|
|
268
|
+
transform-origin: top center;
|
|
269
|
+
transform: perspective(500px) rotateX(60deg);
|
|
270
|
+
}
|
|
271
|
+
.grid-bg .grid-vertical-wrap .fade {
|
|
272
|
+
position: absolute;
|
|
273
|
+
inset: 0;
|
|
274
|
+
background: linear-gradient(to bottom, transparent 0%, rgba(255,255,255,0.02) 100%);
|
|
275
|
+
}
|
|
276
|
+
.grid-bg .grid-vertical-wrap .lines {
|
|
277
|
+
position: absolute;
|
|
278
|
+
inset: 0;
|
|
279
|
+
background-image: repeating-linear-gradient(
|
|
280
|
+
90deg,
|
|
281
|
+
transparent 0,
|
|
282
|
+
transparent 49px,
|
|
283
|
+
rgba(255,255,255,0.08) 49px,
|
|
284
|
+
rgba(255,255,255,0.08) 50px
|
|
285
|
+
);
|
|
286
|
+
background-size: 50px 100%;
|
|
287
|
+
}
|
|
288
|
+
.grid-bg .grid-horizontal {
|
|
289
|
+
position: absolute;
|
|
290
|
+
left: 0;
|
|
291
|
+
right: 0;
|
|
292
|
+
bottom: 0;
|
|
293
|
+
top: 40%;
|
|
294
|
+
transform-origin: top center;
|
|
295
|
+
transform: perspective(500px) rotateX(60deg);
|
|
296
|
+
background-image: repeating-linear-gradient(
|
|
297
|
+
0deg,
|
|
298
|
+
transparent 0,
|
|
299
|
+
transparent 29px,
|
|
300
|
+
rgba(255,255,255,0.06) 29px,
|
|
301
|
+
rgba(255,255,255,0.06) 30px
|
|
302
|
+
);
|
|
303
|
+
background-size: 100% 30px;
|
|
304
|
+
animation: gridMove 2s linear infinite;
|
|
305
|
+
}
|
|
306
|
+
.card-wrap {
|
|
307
|
+
position: absolute;
|
|
308
|
+
left: 50%;
|
|
309
|
+
top: 50%;
|
|
310
|
+
transform: translate(-50%, -50%);
|
|
311
|
+
z-index: 10;
|
|
312
|
+
width: 100%;
|
|
313
|
+
max-width: 400px;
|
|
314
|
+
perspective: 1400px;
|
|
315
|
+
animation: cardIn 0.4s ease-out;
|
|
316
|
+
}
|
|
317
|
+
@keyframes cardIn {
|
|
318
|
+
from { opacity: 0; transform: translate(-50%, -50%) translateY(16px); }
|
|
319
|
+
to { opacity: 1; transform: translate(-50%, -50%) translateY(0); }
|
|
320
|
+
}
|
|
321
|
+
.card-inner {
|
|
322
|
+
position: relative;
|
|
323
|
+
}
|
|
324
|
+
.card-layer-back,
|
|
325
|
+
.card-layer-mid {
|
|
326
|
+
position: absolute;
|
|
327
|
+
inset: 0;
|
|
328
|
+
border-radius: 12px;
|
|
329
|
+
border: 1px solid #e5e7eb;
|
|
330
|
+
pointer-events: none;
|
|
331
|
+
}
|
|
332
|
+
.card-layer-back {
|
|
333
|
+
background: rgba(0, 0, 0, 0.08);
|
|
334
|
+
transform: translate3d(0, -18px, -36px) rotateX(6deg);
|
|
335
|
+
}
|
|
336
|
+
.card-layer-mid {
|
|
337
|
+
background: rgba(0, 0, 0, 0.05);
|
|
338
|
+
transform: translate3d(0, -10px, -20px) rotateX(3deg);
|
|
339
|
+
}
|
|
340
|
+
.card-front {
|
|
341
|
+
position: relative;
|
|
342
|
+
border-radius: 12px;
|
|
343
|
+
border: 1px solid rgba(255, 255, 255, 1);
|
|
344
|
+
background: rgba(0, 0, 0, .5);
|
|
345
|
+
backdrop-filter: blur(10px);
|
|
346
|
+
-webkit-backdrop-filter: blur(10px);
|
|
347
|
+
padding: 2rem 2.5rem;
|
|
348
|
+
text-align: center;
|
|
349
|
+
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
|
|
350
|
+
transform: rotateX(-10deg) translateZ(0);
|
|
351
|
+
transform-style: preserve-3d;
|
|
352
|
+
}
|
|
353
|
+
.card-front .section-title {
|
|
354
|
+
color: #ffffff;
|
|
355
|
+
font-size: 0.8125rem;
|
|
356
|
+
font-weight: 600;
|
|
357
|
+
letter-spacing: 0.05em;
|
|
358
|
+
text-transform: uppercase;
|
|
359
|
+
margin-bottom: 1rem;
|
|
360
|
+
}
|
|
361
|
+
.card-front .flow-arrow {
|
|
362
|
+
color: rgba(255, 255, 255, 0.7);
|
|
363
|
+
font-size: 1rem;
|
|
364
|
+
margin-bottom: 1rem;
|
|
365
|
+
line-height: 1;
|
|
366
|
+
}
|
|
367
|
+
.card-front .message {
|
|
368
|
+
color: #ffffff;
|
|
369
|
+
font-size: 0.75rem;
|
|
370
|
+
font-weight: 100;
|
|
371
|
+
margin-bottom: 0.5rem;
|
|
372
|
+
font-family: monospace;
|
|
373
|
+
}
|
|
374
|
+
.card-front .progress {
|
|
375
|
+
color: rgba(255, 255, 255, 0.75);
|
|
376
|
+
font-size: 0.8125rem;
|
|
377
|
+
}
|
|
378
|
+
</style>
|
|
379
|
+
</head>
|
|
380
|
+
<body>
|
|
381
|
+
<div class="grid-bg">
|
|
382
|
+
<div class="gradient"></div>
|
|
383
|
+
<div class="grid-vertical-wrap">
|
|
384
|
+
<div class="fade"></div>
|
|
385
|
+
<div class="lines"></div>
|
|
386
|
+
</div>
|
|
387
|
+
<div class="grid-horizontal"></div>
|
|
388
|
+
</div>
|
|
389
|
+
<div id="card-wrap" class="card-wrap">
|
|
390
|
+
<div class="card-inner">
|
|
391
|
+
<div class="card-layer-back" aria-hidden="true"></div>
|
|
392
|
+
<div class="card-layer-mid" aria-hidden="true"></div>
|
|
393
|
+
<div id="card" class="card-front">
|
|
394
|
+
<div class="section-title">Authentication Successful</div>
|
|
395
|
+
<div class="flow-arrow" aria-hidden="true">\u2193</div>
|
|
396
|
+
<p class="message">You can close this window and return to your terminal.</p>
|
|
397
|
+
<p class="progress" id="progress">Closing automatically in 3 seconds\u2026</p>
|
|
398
|
+
</div>
|
|
399
|
+
</div>
|
|
400
|
+
</div>
|
|
401
|
+
<script>
|
|
402
|
+
setTimeout(function() {
|
|
403
|
+
window.close();
|
|
404
|
+
var prog = document.getElementById('progress');
|
|
405
|
+
if (prog) prog.textContent = 'You can now close this window.';
|
|
406
|
+
var card = document.getElementById('card');
|
|
407
|
+
if (card) card.innerHTML = '<div class="section-title">Runtype is Ready</div><p class="message">You can now close this window</p>';
|
|
408
|
+
}, 3000);
|
|
409
|
+
</script>
|
|
410
|
+
</body>
|
|
411
|
+
</html>`;
|
|
319
412
|
}
|
|
320
413
|
errorHTML(error) {
|
|
321
414
|
return `
|
|
@@ -469,10 +562,10 @@ var isAuthMeResponse = (value) => {
|
|
|
469
562
|
return typeof record.user_id === "string";
|
|
470
563
|
};
|
|
471
564
|
var ApiKeyManager = class {
|
|
472
|
-
async exchangeSessionForApiKey(authCode, apiUrl) {
|
|
565
|
+
async exchangeSessionForApiKey(authCode, apiUrl, dashboardUrl) {
|
|
473
566
|
void apiUrl;
|
|
474
|
-
const
|
|
475
|
-
const authResponse = await fetch(`${
|
|
567
|
+
const base = dashboardUrl ?? getDashboardUrl();
|
|
568
|
+
const authResponse = await fetch(`${base.replace(/\/$/, "")}/api/cli/auth?code=${encodeURIComponent(authCode)}`, {
|
|
476
569
|
method: "GET",
|
|
477
570
|
headers: {
|
|
478
571
|
"Content-Type": "application/json"
|
|
@@ -544,7 +637,8 @@ authCommand.command("signup").description("Create a new Runtype account").option
|
|
|
544
637
|
const apiKeyManager = new ApiKeyManager();
|
|
545
638
|
const { key, userId, orgId } = await apiKeyManager.exchangeSessionForApiKey(
|
|
546
639
|
sessionToken,
|
|
547
|
-
options.apiUrl || getApiUrl()
|
|
640
|
+
options.apiUrl || getApiUrl(),
|
|
641
|
+
options.dashboardUrl || getDashboardUrl()
|
|
548
642
|
);
|
|
549
643
|
spinner.text = "Storing credentials securely...";
|
|
550
644
|
const store = new CredentialStore();
|
|
@@ -610,7 +704,8 @@ authCommand.command("login").description("Login to existing account").option("--
|
|
|
610
704
|
const apiKeyManager = new ApiKeyManager();
|
|
611
705
|
const { key, userId, orgId } = await apiKeyManager.exchangeSessionForApiKey(
|
|
612
706
|
sessionToken,
|
|
613
|
-
options.apiUrl || getApiUrl()
|
|
707
|
+
options.apiUrl || getApiUrl(),
|
|
708
|
+
options.dashboardUrl || getDashboardUrl()
|
|
614
709
|
);
|
|
615
710
|
spinner.text = "Storing credentials...";
|
|
616
711
|
await store.saveCredentials({
|
|
@@ -886,7 +981,8 @@ async function handleBrowserLogin(store, apiUrl) {
|
|
|
886
981
|
const apiKeyManager = new ApiKeyManager();
|
|
887
982
|
const { key, userId, orgId } = await apiKeyManager.exchangeSessionForApiKey(
|
|
888
983
|
sessionToken,
|
|
889
|
-
apiUrl || getApiUrl()
|
|
984
|
+
apiUrl || getApiUrl(),
|
|
985
|
+
getDashboardUrl()
|
|
890
986
|
);
|
|
891
987
|
spinner.text = "Storing credentials...";
|
|
892
988
|
await store.saveCredentials({
|
|
@@ -2500,7 +2596,8 @@ async function handleBrowserAuth(store, mode, apiUrl) {
|
|
|
2500
2596
|
const apiKeyManager = new ApiKeyManager();
|
|
2501
2597
|
const { key, userId, orgId } = await apiKeyManager.exchangeSessionForApiKey(
|
|
2502
2598
|
sessionToken,
|
|
2503
|
-
apiUrl || getApiUrl()
|
|
2599
|
+
apiUrl || getApiUrl(),
|
|
2600
|
+
getDashboardUrl()
|
|
2504
2601
|
);
|
|
2505
2602
|
await store.saveCredentials({
|
|
2506
2603
|
apiKey: key,
|