@clavis.nexus/setup 3.0.1 → 3.0.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/mcp.js CHANGED
@@ -1112,8 +1112,8 @@ async function buildSetupStatus(args) {
1112
1112
  }
1113
1113
 
1114
1114
  // src/setup-client.ts
1115
- async function requireSession(client) {
1116
- const stored = await loadSession(client.sessionPath);
1115
+ async function requireSession(sessionPath) {
1116
+ const stored = await loadSession(sessionPath);
1117
1117
  if (!stored?.session?.accessToken) {
1118
1118
  return {
1119
1119
  ok: false,
@@ -1124,7 +1124,7 @@ async function requireSession(client) {
1124
1124
  }
1125
1125
  };
1126
1126
  }
1127
- return { ok: true, data: { session: stored.session, origins: stored.origins ?? client.origins } };
1127
+ return { ok: true, data: { session: stored.session, origins: stored.origins } };
1128
1128
  }
1129
1129
  async function runPasskeyCeremony(args) {
1130
1130
  const returnTo = setupCeremonyReturnTo(args.origins.developersOrigin);
@@ -1202,7 +1202,7 @@ function createSetupClient(options = {}) {
1202
1202
  const checked = checkOrgCreationTerms(terms);
1203
1203
  if (!checked.ok) return checked;
1204
1204
  const { incorporation } = checked;
1205
- const auth = await requireSession({ origins, sessionPath });
1205
+ const auth = await requireSession(sessionPath);
1206
1206
  if (!auth.ok) return auth;
1207
1207
  const apiOrigin = auth.data.origins.apiOrigin;
1208
1208
  const closed = await getClosedIncorporations(apiOrigin).catch(() => []);
@@ -1256,7 +1256,7 @@ function createSetupClient(options = {}) {
1256
1256
  };
1257
1257
  },
1258
1258
  async orgAnchorFinish(args) {
1259
- const auth = await requireSession({ origins, sessionPath });
1259
+ const auth = await requireSession(sessionPath);
1260
1260
  if (!auth.ok) return auth;
1261
1261
  const payload = await pollCeremonyResult({
1262
1262
  apiOrigin: auth.data.origins.apiOrigin,
@@ -1294,7 +1294,7 @@ function createSetupClient(options = {}) {
1294
1294
  const checked = checkOrgCreationTerms(args);
1295
1295
  if (!checked.ok) return checked;
1296
1296
  const { incorporation } = checked;
1297
- const auth = await requireSession({ origins, sessionPath });
1297
+ const auth = await requireSession(sessionPath);
1298
1298
  if (!auth.ok) return auth;
1299
1299
  try {
1300
1300
  const out = await postVerifyAnchor(auth.data.origins.apiOrigin, auth.data.session.accessToken, {
@@ -1319,7 +1319,7 @@ function createSetupClient(options = {}) {
1319
1319
  }
1320
1320
  },
1321
1321
  async policyBootstrap(orgId) {
1322
- const auth = await requireSession({ origins, sessionPath });
1322
+ const auth = await requireSession(sessionPath);
1323
1323
  if (!auth.ok) return auth;
1324
1324
  const detail = await getOrg(auth.data.origins.apiOrigin, auth.data.session.accessToken, orgId);
1325
1325
  try {
@@ -1351,7 +1351,7 @@ function createSetupClient(options = {}) {
1351
1351
  const checked = checkOrgCreationTerms(args, INCORPORATION_TERMS_HUMAN);
1352
1352
  if (!checked.ok) return checked;
1353
1353
  const code = checked.incorporation;
1354
- const auth = await requireSession({ origins, sessionPath });
1354
+ const auth = await requireSession(sessionPath);
1355
1355
  if (!auth.ok) return auth;
1356
1356
  const sub = auth.data.session.sub;
1357
1357
  if (!sub) return { ok: false, error: "session_missing_sub \u2014 re-login" };
@@ -1389,7 +1389,7 @@ function createSetupClient(options = {}) {
1389
1389
  async cardCheckout(orgId, opts = {}) {
1390
1390
  const offer = opts.offer === "bundle" ? "bundle" : "meter";
1391
1391
  const lang = checkoutLang(opts.lang);
1392
- const auth = await requireSession({ origins, sessionPath });
1392
+ const auth = await requireSession(sessionPath);
1393
1393
  if (!auth.ok) return auth;
1394
1394
  const sub = auth.data.session.sub;
1395
1395
  if (!sub) return { ok: false, error: "session_missing_sub \u2014 re-login" };
@@ -1472,7 +1472,7 @@ function createSetupClient(options = {}) {
1472
1472
  };
1473
1473
  },
1474
1474
  async appRegister(args) {
1475
- const auth = await requireSession({ origins, sessionPath });
1475
+ const auth = await requireSession(sessionPath);
1476
1476
  if (!auth.ok) return auth;
1477
1477
  const sub = auth.data.session.sub;
1478
1478
  if (!sub) return { ok: false, error: "session_missing_sub \u2014 re-login" };
@@ -1517,7 +1517,7 @@ function createSetupClient(options = {}) {
1517
1517
  };
1518
1518
  },
1519
1519
  async appHostPlan(orgId, appId) {
1520
- const auth = await requireSession({ origins, sessionPath });
1520
+ const auth = await requireSession(sessionPath);
1521
1521
  if (!auth.ok) return auth;
1522
1522
  const ch = await getHostChallenge(auth.data.origins.apiOrigin, auth.data.session.accessToken, orgId, appId);
1523
1523
  return {
@@ -1534,7 +1534,7 @@ function createSetupClient(options = {}) {
1534
1534
  };
1535
1535
  },
1536
1536
  async appVerifyHost(args) {
1537
- const auth = await requireSession({ origins, sessionPath });
1537
+ const auth = await requireSession(sessionPath);
1538
1538
  if (!auth.ok) return auth;
1539
1539
  const ch = await getHostChallenge(
1540
1540
  auth.data.origins.apiOrigin,
@@ -1575,7 +1575,7 @@ function createSetupClient(options = {}) {
1575
1575
  }
1576
1576
  },
1577
1577
  async declarationSet(args) {
1578
- const auth = await requireSession({ origins, sessionPath });
1578
+ const auth = await requireSession(sessionPath);
1579
1579
  if (!auth.ok) return auth;
1580
1580
  const declaration = { endUsers: args.endUsers, uses: args.uses };
1581
1581
  const cer = await runPasskeyCeremony({
@@ -1599,7 +1599,7 @@ function createSetupClient(options = {}) {
1599
1599
  const read = readAppRegionsInput(args.regions);
1600
1600
  if (!read.ok) return read;
1601
1601
  const regions = read.regions;
1602
- const auth = await requireSession({ origins, sessionPath });
1602
+ const auth = await requireSession(sessionPath);
1603
1603
  if (!auth.ok) return auth;
1604
1604
  const sub = auth.data.session.sub;
1605
1605
  if (!sub) return { ok: false, error: "session_missing_sub \u2014 re-login" };