claudemesh-cli 1.0.0-alpha.23 → 1.0.0-alpha.25

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.
@@ -908,9 +908,30 @@ 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
+ }
929
+ var BROKER_HTTP2;
911
930
  var init_generate = __esm(() => {
912
931
  init_facade2();
913
932
  init_facade6();
933
+ init_urls();
934
+ BROKER_HTTP2 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
914
935
  });
915
936
  // src/services/invite/errors.ts
916
937
  var init_errors3 = () => {};
@@ -4412,7 +4433,7 @@ async function createMesh2(name, opts) {
4412
4433
  path: "/cli/mesh/create",
4413
4434
  method: "POST",
4414
4435
  body: { user_id: userId, name, pubkey: kp.publicKey, ...opts },
4415
- baseUrl: BROKER_HTTP2
4436
+ baseUrl: BROKER_HTTP3
4416
4437
  });
4417
4438
  const mesh = {
4418
4439
  meshId: result.id,
@@ -4427,14 +4448,14 @@ async function createMesh2(name, opts) {
4427
4448
  setMeshConfig(result.slug, mesh);
4428
4449
  return { slug: result.slug, id: result.id };
4429
4450
  }
4430
- var BROKER_HTTP2;
4451
+ var BROKER_HTTP3;
4431
4452
  var init_create = __esm(() => {
4432
4453
  init_facade2();
4433
4454
  init_facade6();
4434
4455
  init_facade7();
4435
4456
  init_facade5();
4436
4457
  init_urls();
4437
- BROKER_HTTP2 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
4458
+ BROKER_HTTP3 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
4438
4459
  });
4439
4460
 
4440
4461
  // src/services/mesh/rename.ts
@@ -4568,7 +4589,7 @@ async function runList() {
4568
4589
  if (userId) {
4569
4590
  const res = await request({
4570
4591
  path: `/cli/meshes?user_id=${userId}`,
4571
- baseUrl: BROKER_HTTP3
4592
+ baseUrl: BROKER_HTTP4
4572
4593
  });
4573
4594
  serverMeshes = res.meshes ?? [];
4574
4595
  }
@@ -4624,14 +4645,14 @@ async function runList() {
4624
4645
  console.log(dim(` Config: ${getConfigPath()}`));
4625
4646
  console.log("");
4626
4647
  }
4627
- var BROKER_HTTP3;
4648
+ var BROKER_HTTP4;
4628
4649
  var init_list2 = __esm(() => {
4629
4650
  init_facade5();
4630
4651
  init_facade6();
4631
4652
  init_facade2();
4632
4653
  init_urls();
4633
4654
  init_styles();
4634
- BROKER_HTTP3 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
4655
+ BROKER_HTTP4 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
4635
4656
  });
4636
4657
 
4637
4658
  // src/commands/delete-mesh.ts
@@ -4661,7 +4682,7 @@ async function isOwner(slug, userId) {
4661
4682
  try {
4662
4683
  const res = await request({
4663
4684
  path: `/cli/meshes?user_id=${userId}`,
4664
- baseUrl: BROKER_HTTP4
4685
+ baseUrl: BROKER_HTTP5
4665
4686
  });
4666
4687
  return res.meshes?.find((m) => m.slug === slug)?.is_owner ?? false;
4667
4688
  } catch {
@@ -4720,7 +4741,7 @@ async function deleteMesh(slug, opts = {}) {
4720
4741
  path: `/cli/mesh/${slug}`,
4721
4742
  method: "DELETE",
4722
4743
  body: { user_id: userId },
4723
- baseUrl: BROKER_HTTP4
4744
+ baseUrl: BROKER_HTTP5
4724
4745
  });
4725
4746
  console.log(` ${green(icons.check)} Deleted "${slug}" from server.`);
4726
4747
  } catch (err) {
@@ -4755,7 +4776,7 @@ async function deleteMesh(slug, opts = {}) {
4755
4776
  }
4756
4777
  return EXIT.SUCCESS;
4757
4778
  }
4758
- var BROKER_HTTP4;
4779
+ var BROKER_HTTP5;
4759
4780
  var init_delete_mesh = __esm(() => {
4760
4781
  init_facade5();
4761
4782
  init_facade11();
@@ -4764,7 +4785,7 @@ var init_delete_mesh = __esm(() => {
4764
4785
  init_urls();
4765
4786
  init_styles();
4766
4787
  init_exit_codes();
4767
- BROKER_HTTP4 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
4788
+ BROKER_HTTP5 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
4768
4789
  });
4769
4790
 
4770
4791
  // src/commands/rename.ts
@@ -4866,7 +4887,7 @@ async function invite(email, opts = {}) {
4866
4887
  }
4867
4888
  }
4868
4889
  try {
4869
- const result = await exports_my.createInvite(auth.session_token, meshSlug, {
4890
+ const result = await generateInvite(meshSlug, {
4870
4891
  email,
4871
4892
  expires_in: opts.expires ?? "7d",
4872
4893
  max_uses: opts.uses,
@@ -4904,7 +4925,7 @@ async function invite(email, opts = {}) {
4904
4925
  }
4905
4926
  var init_invite = __esm(() => {
4906
4927
  init_facade6();
4907
- init_facade2();
4928
+ init_generate();
4908
4929
  init_facade5();
4909
4930
  init_facade12();
4910
4931
  init_styles();
@@ -6562,7 +6583,7 @@ async function runTest() {
6562
6583
  await run("server list", async () => {
6563
6584
  const res = await request({
6564
6585
  path: `/cli/meshes?user_id=${userId}`,
6565
- baseUrl: BROKER_HTTP5
6586
+ baseUrl: BROKER_HTTP6
6566
6587
  });
6567
6588
  const found = res.meshes?.find((m) => m.slug === meshSlug);
6568
6589
  if (!found)
@@ -6636,7 +6657,7 @@ async function runTest() {
6636
6657
  path: `/cli/mesh/${meshSlug}`,
6637
6658
  method: "DELETE",
6638
6659
  body: { user_id: userId },
6639
- baseUrl: BROKER_HTTP5
6660
+ baseUrl: BROKER_HTTP6
6640
6661
  });
6641
6662
  leaveMesh(meshSlug);
6642
6663
  return `deleted "${meshSlug}" from server + local`;
@@ -6653,7 +6674,7 @@ async function runTest() {
6653
6674
  console.log("");
6654
6675
  return failed > 0 ? EXIT.INTERNAL_ERROR : EXIT.SUCCESS;
6655
6676
  }
6656
- var BROKER_HTTP5, results;
6677
+ var BROKER_HTTP6, results;
6657
6678
  var init_test = __esm(() => {
6658
6679
  init_facade6();
6659
6680
  init_facade11();
@@ -6665,7 +6686,7 @@ var init_test = __esm(() => {
6665
6686
  init_facade13();
6666
6687
  init_styles();
6667
6688
  init_exit_codes();
6668
- BROKER_HTTP5 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
6689
+ BROKER_HTTP6 = URLS.BROKER.replace("wss://", "https://").replace("ws://", "http://").replace("/ws", "");
6669
6690
  results = [];
6670
6691
  });
6671
6692
 
@@ -10248,4 +10269,4 @@ main().catch((err) => {
10248
10269
  process.exit(EXIT.INTERNAL_ERROR);
10249
10270
  });
10250
10271
 
10251
- //# debugId=B7FAE005EC6978EE64756E2164756E21
10272
+ //# debugId=1610C6DD0978105264756E2164756E21