@~lyre/auth 0.10.0 → 0.11.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/dist/admin.d.ts CHANGED
@@ -89,7 +89,13 @@ interface ProfileFieldSpec {
89
89
  /** Whether an email can be invited to an app. See `checkInviteEmail`. */
90
90
  interface InviteEmailCheck {
91
91
  email: string;
92
- /** `member` = already has app access; `invited` = a live invite exists; `available` = go ahead. */
92
+ /**
93
+ * `member` = already in scope; `invited` = a live invite exists; `available` = go ahead.
94
+ *
95
+ * SCOPE depends on whether `userGroupId` was passed: with one, each state is about that
96
+ * WORKSPACE; without, about the app as a whole. For a multi-workspace app the app-level answer is
97
+ * usually the wrong one — someone in another workspace is not a member of this one.
98
+ */
93
99
  state: 'member' | 'invited' | 'available';
94
100
  /** Whether an Accounts user already exists for this address (they keep their own profile). */
95
101
  hasAccount: boolean;
@@ -252,7 +258,9 @@ declare class AccountsAdmin {
252
258
  * BEFORE submitting that someone is already a member or already invited. Email only, exact match.
253
259
  * Session-authed.
254
260
  */
255
- checkInviteEmail(appSlug: string, email: string): Promise<InviteEmailCheck>;
261
+ checkInviteEmail(appSlug: string, email: string, opts?: {
262
+ userGroupId?: string | null;
263
+ }): Promise<InviteEmailCheck>;
256
264
  /**
257
265
  * A workspace's own details — name plus its app-scoped profile values (support email, …).
258
266
  * Service-key authed (`stats:read`). Pass `appId` to scope the profile values.
package/dist/admin.js CHANGED
@@ -103,10 +103,12 @@ var AccountsAdmin = class {
103
103
  * BEFORE submitting that someone is already a member or already invited. Email only, exact match.
104
104
  * Session-authed.
105
105
  */
106
- async checkInviteEmail(appSlug, email) {
106
+ async checkInviteEmail(appSlug, email, opts) {
107
+ const query = new URLSearchParams({ email });
108
+ if (opts?.userGroupId) query.set("userGroupId", opts.userGroupId);
107
109
  return this.request(
108
110
  "GET",
109
- `/api/auth/apps/${encodeURIComponent(appSlug)}/invites/lookup?email=${encodeURIComponent(email)}`,
111
+ `/api/auth/apps/${encodeURIComponent(appSlug)}/invites/lookup?${query.toString()}`,
110
112
  { auth: "session" }
111
113
  );
112
114
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@~lyre/auth",
3
- "version": "0.10.0",
4
- "description": "Shared Axis Accounts auth SDK — framework-agnostic session/identity core (HMAC-signed cookies, accounts login/callback/logout) plus an optional turnkey SvelteKit adapter.",
3
+ "version": "0.11.0",
4
+ "description": "Shared Axis Accounts auth SDK \u2014 framework-agnostic session/identity core (HMAC-signed cookies, accounts login/callback/logout) plus an optional turnkey SvelteKit adapter.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
7
7
  "license": "MIT",