claudemesh-cli 1.0.0-alpha.24 → 1.0.0-alpha.26
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/entrypoints/cli.js +33 -6
- package/dist/entrypoints/cli.js.map +4 -4
- package/package.json +21 -20
- package/LICENSE.md +0 -37
package/dist/entrypoints/cli.js
CHANGED
|
@@ -908,6 +908,24 @@ var init_facade6 = __esm(() => {
|
|
|
908
908
|
});
|
|
909
909
|
|
|
910
910
|
// src/services/invite/generate.ts
|
|
911
|
+
async function generateInvite(meshSlug, opts) {
|
|
912
|
+
const auth = getStoredToken();
|
|
913
|
+
if (!auth)
|
|
914
|
+
throw new Error("Not signed in");
|
|
915
|
+
let userId = "";
|
|
916
|
+
try {
|
|
917
|
+
const payload = JSON.parse(Buffer.from(auth.session_token.split(".")[1], "base64url").toString());
|
|
918
|
+
userId = payload.sub ?? "";
|
|
919
|
+
} catch {}
|
|
920
|
+
if (!userId)
|
|
921
|
+
throw new Error("Invalid token");
|
|
922
|
+
return request({
|
|
923
|
+
path: `/cli/mesh/${meshSlug}/invite`,
|
|
924
|
+
method: "POST",
|
|
925
|
+
body: { user_id: userId, email: opts?.email, role: opts?.role },
|
|
926
|
+
baseUrl: BROKER_HTTP2
|
|
927
|
+
});
|
|
928
|
+
}
|
|
911
929
|
var BROKER_HTTP2;
|
|
912
930
|
var init_generate = __esm(() => {
|
|
913
931
|
init_facade2();
|
|
@@ -4869,7 +4887,7 @@ async function invite(email, opts = {}) {
|
|
|
4869
4887
|
}
|
|
4870
4888
|
}
|
|
4871
4889
|
try {
|
|
4872
|
-
const result = await
|
|
4890
|
+
const result = await generateInvite(meshSlug, {
|
|
4873
4891
|
email,
|
|
4874
4892
|
expires_in: opts.expires ?? "7d",
|
|
4875
4893
|
max_uses: opts.uses,
|
|
@@ -4880,10 +4898,19 @@ async function invite(email, opts = {}) {
|
|
|
4880
4898
|
console.log(JSON.stringify({ schema_version: "1.0", ...result, copied }, null, 2));
|
|
4881
4899
|
} else {
|
|
4882
4900
|
if (email) {
|
|
4883
|
-
|
|
4901
|
+
if (result.emailed) {
|
|
4902
|
+
console.log(`
|
|
4884
4903
|
${green(icons.check)} Invite sent to ${bold(email)}`);
|
|
4885
|
-
|
|
4886
|
-
|
|
4904
|
+
if (copied)
|
|
4905
|
+
console.log(` ${green(icons.check)} Link also copied to clipboard`);
|
|
4906
|
+
} else {
|
|
4907
|
+
console.log(`
|
|
4908
|
+
${icons.cross} Email to ${bold(email)} was NOT sent (server did not send).`);
|
|
4909
|
+
console.log(` ${dim("Share the link manually:")}`);
|
|
4910
|
+
console.log(` ${result.url}`);
|
|
4911
|
+
if (copied)
|
|
4912
|
+
console.log(` ${green(icons.check)} Link copied to clipboard`);
|
|
4913
|
+
}
|
|
4887
4914
|
} else {
|
|
4888
4915
|
console.log(`
|
|
4889
4916
|
${green(icons.check)} Invite link${copied ? " copied to clipboard" : ""}:`);
|
|
@@ -4907,7 +4934,7 @@ async function invite(email, opts = {}) {
|
|
|
4907
4934
|
}
|
|
4908
4935
|
var init_invite = __esm(() => {
|
|
4909
4936
|
init_facade6();
|
|
4910
|
-
|
|
4937
|
+
init_generate();
|
|
4911
4938
|
init_facade5();
|
|
4912
4939
|
init_facade12();
|
|
4913
4940
|
init_styles();
|
|
@@ -10251,4 +10278,4 @@ main().catch((err) => {
|
|
|
10251
10278
|
process.exit(EXIT.INTERNAL_ERROR);
|
|
10252
10279
|
});
|
|
10253
10280
|
|
|
10254
|
-
//# debugId=
|
|
10281
|
+
//# debugId=3B0AB051A285774164756E2164756E21
|