@~lyre/auth 0.8.0 → 0.10.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
@@ -123,7 +123,34 @@ interface GroupMember {
123
123
  name?: string | null;
124
124
  firstName?: string | null;
125
125
  lastName?: string | null;
126
+ /**
127
+ * The group MEMBERSHIP role (`owner` / `admin` / `member`) — how this person relates to the
128
+ * workspace itself. NOT the app's account type; see `appRoles`.
129
+ */
126
130
  role?: string | null;
131
+ /**
132
+ * The app's own RBAC roles for this member, scoped to this group (e.g. `engage:admin`,
133
+ * `engage:agent`). This is what "account type" means to a consumer, and what an account-type
134
+ * change writes. Empty when the member holds no group-scoped app role.
135
+ */
136
+ appRoles?: string[];
137
+ /** Set when the account is deactivated in Accounts; null for an active account. */
138
+ disabledAt?: string | null;
139
+ /** When the user account was created (ISO). */
140
+ createdAt?: string | null;
141
+ /**
142
+ * Last sign-in (ISO), or null for someone who has never signed in.
143
+ *
144
+ * Derived from `MAX(sessions.last_seen_at)` — the definition Accounts uses everywhere else for
145
+ * this question. There is no separate `last_login_at` column.
146
+ */
147
+ lastSeenAt?: string | null;
148
+ /**
149
+ * App-scoped profile values (`phone_number`, `assignable`, `availability`, …). Present only when
150
+ * the request passed an `appId`; profile data is app-scoped by definition. Values are strings —
151
+ * the store is an EAV of text — so a boolean reads as `'true'` / `'false'`.
152
+ */
153
+ profileData?: Record<string, string>;
127
154
  }
128
155
  /** Thrown on a non-2xx Accounts response so callers can surface the upstream message + status. */
129
156
  declare class AccountsAdminError extends Error {
@@ -148,11 +175,23 @@ declare class AccountsAdmin {
148
175
  appId?: string;
149
176
  profileData?: Record<string, string>;
150
177
  }): Promise<AccountsUser>;
151
- /** Change the signed-in user's password. Session-authed; Accounts verifies `currentPassword` and,
152
- * with `revokeOtherSessions`, logs the user out everywhere else. The target is the session's own
153
- * user — no id is passed. */
178
+ /** Set or change the signed-in user's password. Session-authed; the target is the session's own
179
+ * user — no id is passed.
180
+ *
181
+ * ONE call serves both cases. Accounts reads the credential and decides: with none it SETS the
182
+ * password (no `currentPassword` required); with one it verifies `currentPassword` and CHANGES
183
+ * it. The result's `mode` says which happened. With `revokeOtherSessions`, the user is logged
184
+ * out everywhere else. */
154
185
  changePassword(input: {
155
- currentPassword: string;
186
+ /**
187
+ * OPTIONAL, and omitted when the account has no password yet — someone who signed up with
188
+ * Google has none to verify. Accounts decides which case applies by reading the credential
189
+ * itself (`setOrChangePassword`), so omitting this cannot bypass verification: when a
190
+ * password DOES exist and this is absent, the request is rejected.
191
+ *
192
+ * Read `hasPassword` from the `/me` payload to decide whether to collect it.
193
+ */
194
+ currentPassword?: string;
156
195
  newPassword: string;
157
196
  confirmPassword?: string;
158
197
  revokeOtherSessions?: boolean;
@@ -173,6 +212,33 @@ declare class AccountsAdmin {
173
212
  * Accounts drops any key the app does not collect, so authorization-shaped values
174
213
  * (role, assignability) can never be set from here. */
175
214
  profileData?: Record<string, string> | null;
215
+ /**
216
+ * The inviting app's OAuth callback — where accepting the invite should land the invitee.
217
+ *
218
+ * Acceptance hands off to `/auth/authorize`, which requires a redirect_uri it can validate
219
+ * against the app's authorized list; without one the invitee reaches the gateway app
220
+ * chooser instead of the app that invited them. Must already be in that allowlist — an
221
+ * unauthorized value is rejected at invite time (400) rather than stored.
222
+ */
223
+ redirectUri?: string | null;
224
+ /**
225
+ * The roles to grant when this invite is accepted, overriding the app's configured default
226
+ * invite roles. Role IDS resolved by the caller from its own vocabulary — Accounts has no
227
+ * notion of "admin" or "agent".
228
+ *
229
+ * A LIST because one account type commonly means several roles. Each id is validated as
230
+ * grantable by the inviting app at invite time (400 if not), so a bad invite fails the
231
+ * person creating it rather than the person accepting it.
232
+ */
233
+ invitedRoleIds?: string[] | null;
234
+ /**
235
+ * App-scoped `assignable` default, written to the invitee's profile on acceptance.
236
+ *
237
+ * A COLUMN on the invite, not a `profileData` key: it is authorization (whether work can be
238
+ * routed to this person) and the profile bag is invitee-editable, so Accounts drops it from
239
+ * there by design. Omit to leave unset — readers treat missing as assignable.
240
+ */
241
+ assignable?: boolean | null;
176
242
  }): Promise<InviteResult>;
177
243
  /**
178
244
  * The profile fields this app collects about a SUBJECT — the spec to render a form from.
package/dist/admin.js CHANGED
@@ -49,9 +49,13 @@ var AccountsAdmin = class {
49
49
  body: input
50
50
  });
51
51
  }
52
- /** Change the signed-in user's password. Session-authed; Accounts verifies `currentPassword` and,
53
- * with `revokeOtherSessions`, logs the user out everywhere else. The target is the session's own
54
- * user — no id is passed. */
52
+ /** Set or change the signed-in user's password. Session-authed; the target is the session's own
53
+ * user — no id is passed.
54
+ *
55
+ * ONE call serves both cases. Accounts reads the credential and decides: with none it SETS the
56
+ * password (no `currentPassword` required); with one it verifies `currentPassword` and CHANGES
57
+ * it. The result's `mode` says which happened. With `revokeOtherSessions`, the user is logged
58
+ * out everywhere else. */
55
59
  async changePassword(input) {
56
60
  return this.request("POST", "/api/auth/change-password", {
57
61
  auth: "session",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@~lyre/auth",
3
- "version": "0.8.0",
3
+ "version": "0.10.0",
4
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.",
5
5
  "type": "module",
6
6
  "sideEffects": false,