camstack 0.7.0 → 0.7.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/cli.js +10 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -540,6 +540,7 @@ async function loginCommand(opts) {
|
|
|
540
540
|
let attempt = 1;
|
|
541
541
|
let jwt;
|
|
542
542
|
let displayName;
|
|
543
|
+
let userId;
|
|
543
544
|
while (true) {
|
|
544
545
|
const authSpinner = clack.spinner();
|
|
545
546
|
authSpinner.start(`Authenticating as ${username}${attempt > 1 ? ` (attempt ${attempt}/${MAX_ATTEMPTS})` : ""}`);
|
|
@@ -552,6 +553,7 @@ async function loginCommand(opts) {
|
|
|
552
553
|
);
|
|
553
554
|
jwt = login.token;
|
|
554
555
|
displayName = login.user.username;
|
|
556
|
+
userId = login.user.id;
|
|
555
557
|
authSpinner.stop(`Authenticated as ${displayName}`);
|
|
556
558
|
break;
|
|
557
559
|
} catch (err) {
|
|
@@ -578,13 +580,18 @@ async function loginCommand(opts) {
|
|
|
578
580
|
}
|
|
579
581
|
}
|
|
580
582
|
const mintSpinner = clack.spinner();
|
|
581
|
-
mintSpinner.start("Creating upload
|
|
583
|
+
mintSpinner.start("Creating scoped token (upload + log streaming)");
|
|
582
584
|
const tokenName = opts.tokenName ?? `camstack-cli@${os2.hostname()}`;
|
|
583
|
-
const scopes = [
|
|
585
|
+
const scopes = [
|
|
586
|
+
{ type: "route-prefix", target: "/api/addons/upload" },
|
|
587
|
+
{ type: "route-prefix", target: "/trpc/addons.onAddonLogs" },
|
|
588
|
+
{ type: "route-prefix", target: "/trpc/addons.getLogs" },
|
|
589
|
+
{ type: "route-prefix", target: "/trpc/addons.list" }
|
|
590
|
+
];
|
|
584
591
|
const created = await callTrpcMutation(
|
|
585
592
|
`${server}/trpc/userManagement.createScopedToken?batch=1`,
|
|
586
593
|
`Bearer ${jwt}`,
|
|
587
|
-
{ name: tokenName, scopes },
|
|
594
|
+
{ userId, name: tokenName, scopes },
|
|
588
595
|
isCreateScopedTokenPayload
|
|
589
596
|
);
|
|
590
597
|
const scopedToken = created.token;
|