@mesh-tech/mesh-cli 0.40.9 → 0.40.11

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.
Files changed (56) hide show
  1. package/dist/bin/{mesh.auth-preflight-AUFQ2FGD.js → mesh.auth-preflight-BGI5LPLN.js} +1 -1
  2. package/dist/bin/{mesh.chunk-7HTKSUWR.js → mesh.chunk-3WJGDNHA.js} +86 -33
  3. package/dist/bin/mesh.chunk-3WJGDNHA.js.map +6 -0
  4. package/dist/bin/{mesh.chunk-6SSOVZOI.js → mesh.chunk-4XX62O6Z.js} +1 -1
  5. package/dist/bin/{mesh.chunk-HJGMOEUG.js → mesh.chunk-DYWR76EO.js} +1 -1
  6. package/dist/bin/{mesh.chunk-YE2WIY3Y.js → mesh.chunk-EHLBX24J.js} +1 -1
  7. package/dist/bin/{mesh.chunk-HYXH4YMU.js → mesh.chunk-GLG5JBI7.js} +23 -24
  8. package/dist/bin/mesh.chunk-GLG5JBI7.js.map +6 -0
  9. package/dist/bin/{mesh.chunk-F44A3ACW.js → mesh.chunk-O5CP4NPZ.js} +2 -2
  10. package/dist/bin/{mesh.chunk-QPGAPLPU.js → mesh.chunk-O677AU5E.js} +1 -1
  11. package/dist/bin/{mesh.chunk-NSQJEX36.js → mesh.chunk-WT27GBE4.js} +1 -1
  12. package/dist/bin/{mesh.chunk-6AIG5OJM.js → mesh.chunk-YKW256CK.js} +3 -3
  13. package/dist/bin/{mesh.create-app-Z3RKSTBO.js → mesh.create-app-GQIGCZNI.js} +3 -3
  14. package/dist/bin/{mesh.dev-token-server-XG26C6IQ.js → mesh.dev-token-server-IJUVRBWI.js} +2 -2
  15. package/dist/bin/mesh.js +9 -9
  16. package/dist/bin/{mesh.login-3AWVGPCM.js → mesh.login-N5LPLRRX.js} +2 -2
  17. package/dist/bin/{mesh.platform-setup-2ZDMHRCI.js → mesh.platform-setup-PCDLE2EI.js} +1 -1
  18. package/dist/bin/{mesh.program-UKPDHRVX.js → mesh.program-WSFVQU7P.js} +9 -9
  19. package/dist/bin/{mesh.registry-JLQYFUNN.js → mesh.registry-5U4L6256.js} +4 -4
  20. package/dist/bin/{mesh.registry-identity-3AR27UGO.js → mesh.registry-identity-6UPUHKO2.js} +3 -3
  21. package/dist/bin/{mesh.review-command-LUVZQN2T.js → mesh.review-command-MLBWVHF7.js} +3 -3
  22. package/dist/bin/{mesh.start-OU2V6C7B.js → mesh.start-24YIFB4O.js} +2 -2
  23. package/dist/bin/{mesh.wizard-FCTT55KI.js → mesh.wizard-6HMOBC5L.js} +7 -7
  24. package/dist/build-info.json +2 -2
  25. package/dist/src/commands/local/index.js +5 -7
  26. package/dist/src/commands/local/seed-zitadel.d.ts +18 -0
  27. package/dist/src/commands/local/seed-zitadel.js +53 -19
  28. package/dist/src/commands/temporal.js +15 -6
  29. package/dist/src/commands/temporal.js.map +1 -1
  30. package/dist/src/utils/temporal-auth.d.ts +9 -1
  31. package/dist/src/utils/temporal-auth.js +16 -6
  32. package/fragments/base/index.ts.hbs +5 -2
  33. package/package.json +3 -3
  34. package/stack/docker-compose.hub.yml +6 -1
  35. package/templates/api-auth/index.ts.hbs +2 -1
  36. package/templates/api-role-gating/index.ts.hbs +2 -1
  37. package/dist/bin/mesh.chunk-7HTKSUWR.js.map +0 -6
  38. package/dist/bin/mesh.chunk-HYXH4YMU.js.map +0 -6
  39. /package/dist/bin/{mesh.auth-preflight-AUFQ2FGD.js.map → mesh.auth-preflight-BGI5LPLN.js.map} +0 -0
  40. /package/dist/bin/{mesh.chunk-6SSOVZOI.js.map → mesh.chunk-4XX62O6Z.js.map} +0 -0
  41. /package/dist/bin/{mesh.chunk-HJGMOEUG.js.map → mesh.chunk-DYWR76EO.js.map} +0 -0
  42. /package/dist/bin/{mesh.chunk-YE2WIY3Y.js.map → mesh.chunk-EHLBX24J.js.map} +0 -0
  43. /package/dist/bin/{mesh.chunk-F44A3ACW.js.map → mesh.chunk-O5CP4NPZ.js.map} +0 -0
  44. /package/dist/bin/{mesh.chunk-QPGAPLPU.js.map → mesh.chunk-O677AU5E.js.map} +0 -0
  45. /package/dist/bin/{mesh.chunk-NSQJEX36.js.map → mesh.chunk-WT27GBE4.js.map} +0 -0
  46. /package/dist/bin/{mesh.chunk-6AIG5OJM.js.map → mesh.chunk-YKW256CK.js.map} +0 -0
  47. /package/dist/bin/{mesh.create-app-Z3RKSTBO.js.map → mesh.create-app-GQIGCZNI.js.map} +0 -0
  48. /package/dist/bin/{mesh.dev-token-server-XG26C6IQ.js.map → mesh.dev-token-server-IJUVRBWI.js.map} +0 -0
  49. /package/dist/bin/{mesh.login-3AWVGPCM.js.map → mesh.login-N5LPLRRX.js.map} +0 -0
  50. /package/dist/bin/{mesh.platform-setup-2ZDMHRCI.js.map → mesh.platform-setup-PCDLE2EI.js.map} +0 -0
  51. /package/dist/bin/{mesh.program-UKPDHRVX.js.map → mesh.program-WSFVQU7P.js.map} +0 -0
  52. /package/dist/bin/{mesh.registry-JLQYFUNN.js.map → mesh.registry-5U4L6256.js.map} +0 -0
  53. /package/dist/bin/{mesh.registry-identity-3AR27UGO.js.map → mesh.registry-identity-6UPUHKO2.js.map} +0 -0
  54. /package/dist/bin/{mesh.review-command-LUVZQN2T.js.map → mesh.review-command-MLBWVHF7.js.map} +0 -0
  55. /package/dist/bin/{mesh.start-OU2V6C7B.js.map → mesh.start-24YIFB4O.js.map} +0 -0
  56. /package/dist/bin/{mesh.wizard-FCTT55KI.js.map → mesh.wizard-6HMOBC5L.js.map} +0 -0
@@ -21,7 +21,7 @@ import {
21
21
  registryPreflight,
22
22
  stripUnscopedCodeArtifactRegistry,
23
23
  upsertNpmrcLines
24
- } from "./mesh.chunk-6SSOVZOI.js";
24
+ } from "./mesh.chunk-4XX62O6Z.js";
25
25
  export {
26
26
  REGISTRY_LOGIN_FIX,
27
27
  REGISTRY_LOGIN_FIX_AWS,
@@ -49,7 +49,7 @@ import {
49
49
  isExpiredAwsTokenMessage,
50
50
  probeRegistryToken,
51
51
  registryLoginFix
52
- } from "./mesh.chunk-6SSOVZOI.js";
52
+ } from "./mesh.chunk-4XX62O6Z.js";
53
53
 
54
54
  // packages/mesh-cli/src/commands/login.ts
55
55
  import * as http from "http";
@@ -1478,9 +1478,9 @@ async function ensureKubeconfig(platformName, env, sessionName, deps = {}) {
1478
1478
 
1479
1479
  // packages/mesh-cli/src/utils/temporal-auth.ts
1480
1480
  import { execFileSync as execFileSync3 } from "node:child_process";
1481
- async function resolveTemporalAuth(tenant, env, platformName = tenant) {
1481
+ async function resolveTemporalAuth(tenant, env, platformName = tenant, deps = {}) {
1482
1482
  const { SSMClient: SSMClient2, GetParameterCommand: GetParameterCommand2 } = await import("@aws-sdk/client-ssm");
1483
- const ssm = new SSMClient2({ region: process.env.AWS_REGION || "us-east-2" });
1483
+ const ssm = deps.ssm ?? new SSMClient2({ region: process.env.AWS_REGION || "us-east-2" });
1484
1484
  const results = {};
1485
1485
  async function trySSM(name) {
1486
1486
  try {
@@ -1490,16 +1490,25 @@ async function resolveTemporalAuth(tenant, env, platformName = tenant) {
1490
1490
  return void 0;
1491
1491
  }
1492
1492
  }
1493
+ async function tryFirstSSM(names) {
1494
+ for (const name of names) {
1495
+ const value = await trySSM(name);
1496
+ if (value !== void 0) return value;
1497
+ }
1498
+ return void 0;
1499
+ }
1493
1500
  try {
1494
- const workerPath = `/mesh-platform/${tenant}/${env}/temporal/worker-service-account-key`;
1495
- const exchangePath = `/mesh-platform/${tenant}/${env}/temporal/token-exchange-app`;
1496
- const workerJson = await trySSM(workerPath);
1501
+ const temporalSecret = (name) => [
1502
+ `/platform-secrets/${tenant}/${env}/temporal/${name}`,
1503
+ `/mesh-platform/${tenant}/${env}/temporal/${name}`
1504
+ ];
1505
+ const workerJson = await tryFirstSSM(temporalSecret("worker-service-account-key"));
1497
1506
  if (workerJson) {
1498
1507
  const worker = JSON.parse(workerJson);
1499
1508
  results.TEMPORAL_AUTH_CLIENT_ID = worker.clientId;
1500
1509
  results.TEMPORAL_AUTH_CLIENT_SECRET = worker.clientSecret;
1501
1510
  }
1502
- const exchangeJson = await trySSM(exchangePath);
1511
+ const exchangeJson = await tryFirstSSM(temporalSecret("token-exchange-app"));
1503
1512
  if (exchangeJson) {
1504
1513
  const exchange = JSON.parse(exchangeJson);
1505
1514
  results.ZITADEL_TOKEN_EXCHANGE_CLIENT_ID = exchange.clientId;
@@ -2691,16 +2700,33 @@ async function ensureZitadelProject(pat, name, opts = {}) {
2691
2700
  { queries: [{ nameQuery: { name, method: "TEXT_QUERY_METHOD_EQUALS" } }] },
2692
2701
  opts.orgId
2693
2702
  );
2694
- const existing = search?.result?.[0]?.id;
2695
- if (existing) {
2703
+ const existing = search?.result?.[0];
2704
+ if (existing?.id) {
2696
2705
  if (opts.logExisting) logInfo(`Zitadel project '${name}' already exists`);
2697
- return existing;
2706
+ const wanted = opts.projectRoleAssertion;
2707
+ if (wanted !== void 0 && (existing.projectRoleAssertion ?? false) !== wanted) {
2708
+ await api(
2709
+ pat,
2710
+ "PUT",
2711
+ `/management/v1/projects/${existing.id}`,
2712
+ {
2713
+ name: existing.name ?? name,
2714
+ projectRoleAssertion: wanted,
2715
+ projectRoleCheck: existing.projectRoleCheck ?? false,
2716
+ hasProjectCheck: existing.hasProjectCheck ?? false,
2717
+ ...existing.privateLabelingSetting ? { privateLabelingSetting: existing.privateLabelingSetting } : {}
2718
+ },
2719
+ opts.orgId
2720
+ );
2721
+ logSuccess(`Zitadel project '${name}': role assertion turned ${wanted ? "on" : "off"}`);
2722
+ }
2723
+ return existing.id;
2698
2724
  }
2699
2725
  const created = await api(
2700
2726
  pat,
2701
2727
  "POST",
2702
2728
  "/management/v1/projects",
2703
- { name, projectRoleAssertion: true },
2729
+ { name, projectRoleAssertion: opts.projectRoleAssertion ?? true },
2704
2730
  opts.orgId
2705
2731
  );
2706
2732
  logSuccess(`Created Zitadel project '${name}'${opts.describe ? ` (${opts.describe})` : ""}`);
@@ -2762,6 +2788,21 @@ async function ensureTestUsers(pat) {
2762
2788
  function hubAuthPath() {
2763
2789
  return path10.join(meshCacheDir("mesh-local"), "hub-auth.json");
2764
2790
  }
2791
+ function hubSignInScope(projectId) {
2792
+ return [
2793
+ "openid email profile",
2794
+ "urn:zitadel:iam:org:projects:roles",
2795
+ `urn:zitadel:iam:org:project:id:${projectId}:aud`
2796
+ ].join(" ");
2797
+ }
2798
+ function hubAuthComposeEnv(auth) {
2799
+ return {
2800
+ MESH_HUB_OAUTH2_CLIENT_ID: auth.clientId,
2801
+ MESH_HUB_OAUTH2_CLIENT_SECRET: auth.clientSecret,
2802
+ MESH_HUB_OAUTH2_COOKIE_SECRET: auth.cookieSecret,
2803
+ ...auth.projectId ? { MESH_HUB_OAUTH2_SCOPE: hubSignInScope(auth.projectId) } : {}
2804
+ };
2805
+ }
2765
2806
  function readHubAuth() {
2766
2807
  try {
2767
2808
  const parsed = JSON.parse(fs10.readFileSync(hubAuthPath(), "utf-8"));
@@ -2771,7 +2812,10 @@ function readHubAuth() {
2771
2812
  return null;
2772
2813
  }
2773
2814
  }
2774
- var ensureHubProject = (pat) => ensureZitadelProject(pat, HUB_PROJECT_NAME, { describe: "Hub platform app" });
2815
+ var ensureHubProject = (pat) => ensureZitadelProject(pat, HUB_PROJECT_NAME, {
2816
+ describe: "Hub platform app",
2817
+ projectRoleAssertion: false
2818
+ });
2775
2819
  function hubRoleDisplayName(roleKey) {
2776
2820
  const tenant = hubRoleKeyTenant(roleKey);
2777
2821
  return tenant === null ? roleKey : `${restrictedRoleBase(roleKey) ?? roleKey} (${tenant})`;
@@ -2826,23 +2870,8 @@ async function reconcileHubRedirectUris(pat, projectId, app) {
2826
2870
  `Registered Hub redirect URI http://localhost:${hubPort()}/oauth2/callback (MESH_HUB_PORT)`
2827
2871
  );
2828
2872
  }
2829
- async function ensureHubApp(pat, projectId) {
2830
- const existing = await searchZitadelApp(pat, projectId, HUB_APP_NAME);
2831
- if (existing) {
2832
- await reconcileHubRedirectUris(pat, projectId, existing);
2833
- const clientId = existing?.oidcConfig?.clientId;
2834
- const persisted = readHubAuth();
2835
- if (persisted && persisted.clientId === clientId) return { clientId };
2836
- const regenerated = await api(
2837
- pat,
2838
- "POST",
2839
- `/management/v1/projects/${projectId}/apps/${existing.id}/oidc_config/_generate_client_secret`,
2840
- {}
2841
- );
2842
- logSuccess(`Regenerated Hub UI client secret (local copy was missing)`);
2843
- return { clientId, clientSecret: regenerated.clientSecret };
2844
- }
2845
- const created = await api(pat, "POST", `/management/v1/projects/${projectId}/apps/oidc`, {
2873
+ function buildHubAppPayload() {
2874
+ return {
2846
2875
  name: HUB_APP_NAME,
2847
2876
  redirectUris: [.../* @__PURE__ */ new Set([hubRedirectUri(), HUB_DEFAULT_REDIRECT_URI])],
2848
2877
  postLogoutRedirectUris: [
@@ -2864,7 +2893,30 @@ async function ensureHubApp(pat, projectId) {
2864
2893
  idTokenRoleAssertion: true,
2865
2894
  idTokenUserinfoAssertion: true,
2866
2895
  devMode: true
2867
- });
2896
+ };
2897
+ }
2898
+ async function ensureHubApp(pat, projectId) {
2899
+ const existing = await searchZitadelApp(pat, projectId, HUB_APP_NAME);
2900
+ if (existing) {
2901
+ await reconcileHubRedirectUris(pat, projectId, existing);
2902
+ const clientId = existing?.oidcConfig?.clientId;
2903
+ const persisted = readHubAuth();
2904
+ if (persisted && persisted.clientId === clientId) return { clientId };
2905
+ const regenerated = await api(
2906
+ pat,
2907
+ "POST",
2908
+ `/management/v1/projects/${projectId}/apps/${existing.id}/oidc_config/_generate_client_secret`,
2909
+ {}
2910
+ );
2911
+ logSuccess(`Regenerated Hub UI client secret (local copy was missing)`);
2912
+ return { clientId, clientSecret: regenerated.clientSecret };
2913
+ }
2914
+ const created = await api(
2915
+ pat,
2916
+ "POST",
2917
+ `/management/v1/projects/${projectId}/apps/oidc`,
2918
+ buildHubAppPayload()
2919
+ );
2868
2920
  logSuccess(`Created Zitadel application '${HUB_APP_NAME}' (Hub UI web client, code flow)`);
2869
2921
  return { clientId: created.clientId, clientSecret: created.clientSecret };
2870
2922
  }
@@ -7833,7 +7885,7 @@ function registerDevCommand(program) {
7833
7885
  "tmux"
7834
7886
  );
7835
7887
  dev.command("__token-server <port> <context>", { hidden: true }).action(async (port, context) => {
7836
- const { startTokenServer } = await import("./mesh.dev-token-server-XG26C6IQ.js");
7888
+ const { startTokenServer } = await import("./mesh.dev-token-server-IJUVRBWI.js");
7837
7889
  await startTokenServer(Number(port), context);
7838
7890
  });
7839
7891
  dev.action(async (options) => {
@@ -10971,9 +11023,9 @@ function refuseReservedRegistryContext(context, verb) {
10971
11023
  }
10972
11024
  async function hintRegistryIfMissing() {
10973
11025
  try {
10974
- const { readRegistrySession } = await import("./mesh.registry-identity-3AR27UGO.js");
11026
+ const { readRegistrySession } = await import("./mesh.registry-identity-6UPUHKO2.js");
10975
11027
  if (readRegistrySession()) return;
10976
- const { probeRegistryToken: probeRegistryToken2 } = await import("./mesh.auth-preflight-AUFQ2FGD.js");
11028
+ const { probeRegistryToken: probeRegistryToken2 } = await import("./mesh.auth-preflight-BGI5LPLN.js");
10977
11029
  const probe = await probeRegistryToken2();
10978
11030
  if (probe.state === "missing" || probe.state === "expired") {
10979
11031
  logInfo(REGISTRY_SEPARATE_HINT);
@@ -11394,6 +11446,7 @@ export {
11394
11446
  mockIdpComposeEnv,
11395
11447
  LOGIN_CONTEXT,
11396
11448
  TEST_USERS,
11449
+ hubAuthComposeEnv,
11397
11450
  readHubAuth,
11398
11451
  seedZitadel,
11399
11452
  seedMockIdps,