@sortlist/cli 0.54.0 → 0.55.0

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/README.md CHANGED
@@ -65,7 +65,7 @@ When the token expires, renewing needs your own login again — so this is a loc
65
65
 
66
66
  ## Acting for a company
67
67
 
68
- A person can belong to several companies, and a subgraph that counts usage — Atlas records which contact details it hands out — needs to know which one a call is for. Every authenticated request carries that company as an `X-Company-Id` header, taken from `--company` or from `sl config set company`. Both take the company's slug or its GraphQL `id`, as `sl hermes companies` lists them; a slug costs one lookup per command, and a raw uuid is refused. The subgraph checks it against the companies your token lists and refuses the request outright when it names one you do not belong to. Without either, no company is named, and Atlas refuses any person who names none, staff included; the CLI then retries the call once for your personal company, so that is where it is counted. An application belongs to exactly one company, so acting as one needs no header.
68
+ A person can belong to several companies, and a subgraph that counts usage — Atlas records which contact details it hands out — needs to know which one a call is for. Every authenticated request carries that company as an `X-Company-Id` header, taken from `--company` or from `sl config set company`. Both take the company's slug or its GraphQL `id`, as `sl hermes companies` lists them; a slug costs one lookup per command, and a raw uuid is refused. The subgraph checks it against the companies your token lists and refuses the request outright when it names one you do not belong to. Without either, no company is named. Atlas still answers a search then, with every contact detail `LOCKED`, but refuses any call that would reveal one (`FORBIDDEN_COMPANY`), staff included; the CLI then retries that call once for your personal company, so that is where a reveal is counted. `--wait` names your personal company from the start, since a retry would miss the result. An application belongs to exactly one company, so acting as one needs no header.
69
69
 
70
70
  ```bash
71
71
  sl config set company acme # for every command from now on
@@ -83,7 +83,7 @@ sl atlas find-contacts --page '{"first":5}' --wait --reveal contactIdentity,cont
83
83
  --fields firstName,emailAddress # reveal, once per window
84
84
  ```
85
85
 
86
- The finds are searches: the mutation is acknowledged at once and the page arrives on a subscription, which `--wait` listens to. Atlas sends a page again as it fills it, and `--wait` prints its last, `COMPLETE`, version. Each edge's `reveals` says what happened to every dimension: `REVEALED` was recorded by this call, `OWNED` means the window is still running and nothing was counted again, `LOCKED` means Atlas has it and nobody asked, `UNAVAILABLE` means Atlas has nothing, and nothing is counted. The page's `credits` is the bill: `held` is the ceiling reserved before the page was read (rows × dimensions asked), `used` what it actually consumed, one unit per dimension revealed on one row. Nothing is charged yet — these are the figures that would be. Every list argument typed as an enum accepts the same comma-separated shorthand.
86
+ The finds are searches: the mutation is acknowledged at once and the page arrives on a subscription, which `--wait` listens to. Atlas sends a page again as it fills it, and `--wait` prints its last, `COMPLETE`, version. Each edge's `reveals` says what happened to every dimension: `REVEALED` was recorded by this call, `OWNED` means the window is still running and nothing was counted again, `LOCKED` means Atlas has it and nobody asked, `UNAVAILABLE` means Atlas has nothing, and nothing is counted. The page's `credits` is the bill: `held` is the ceiling reserved before the page was read (rows × dimensions asked), `used` what it actually consumed, one unit per dimension revealed on one row. In staging and production those units are taken from the company's credit balance; a local Atlas only logs them. Every list argument typed as an enum accepts the same comma-separated shorthand.
87
87
 
88
88
  ## Unattended authentication
89
89
 
package/dist/index.js CHANGED
@@ -2191,6 +2191,11 @@ function openBrowser(url) {
2191
2191
  });
2192
2192
  }
2193
2193
 
2194
+ // src/lib/person.ts
2195
+ function personName(person) {
2196
+ return [person.firstName, person.lastName].filter(Boolean).join(" ") || null;
2197
+ }
2198
+
2194
2199
  // src/commands/login.ts
2195
2200
  var SERVICES = ["atlas", "core", "signals", "billing", "outreach", "hermes"];
2196
2201
  var ADMIN_API_SCOPES = SERVICES.map((service) => `${service}/*:read`);
@@ -2221,8 +2226,9 @@ async function setupUserContext(endpoint) {
2221
2226
  const userData = await graphql(Me, void 0, { endpoint });
2222
2227
  const user = userData.me;
2223
2228
  if (!user) return;
2229
+ const identity = [personName(user), `<${user.email}>`].filter(Boolean).join(" ");
2224
2230
  info("");
2225
- info(` User: ${user.firstName} ${user.lastName} <${user.email}>`);
2231
+ info(` User: ${identity}`);
2226
2232
  hint("Run `sl whoami` to verify.");
2227
2233
  }
2228
2234
  function reportScopeGrant(requestedScope, accessToken) {
@@ -2239,8 +2245,8 @@ var loginCommand = new Command3("login").summary("Log in to your Sortlist accoun
2239
2245
  `Log in to your Sortlist account
2240
2246
 
2241
2247
  Opens a browser to complete authentication, then saves your
2242
- credentials locally. If you belong to multiple companies, you'll
2243
- be prompted to pick one.
2248
+ credentials locally. To act for one of your companies, pass
2249
+ --company or run \`sl config set company <slug>\`.
2244
2250
 
2245
2251
  Examples:
2246
2252
  sl login Log in with the user scopes, no staff scope
@@ -2662,7 +2668,7 @@ var whoamiCommand = new Command7("whoami").summary("Show what the CLI is current
2662
2668
  ` : "Acting as yourself.\n");
2663
2669
  info(
2664
2670
  formatResult({
2665
- name: [user.firstName, user.lastName].filter(Boolean).join(" ") || null,
2671
+ name: personName(user),
2666
2672
  email: user.email,
2667
2673
  id: user.id,
2668
2674
  ...elevation && { "elevated until": elevation.until },