@~lyre/auth 0.9.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 +26 -6
- package/dist/admin.js +11 -5
- package/package.json +2 -2
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
|
-
/**
|
|
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;
|
|
@@ -175,11 +181,23 @@ declare class AccountsAdmin {
|
|
|
175
181
|
appId?: string;
|
|
176
182
|
profileData?: Record<string, string>;
|
|
177
183
|
}): Promise<AccountsUser>;
|
|
178
|
-
/**
|
|
179
|
-
*
|
|
180
|
-
*
|
|
184
|
+
/** Set or change the signed-in user's password. Session-authed; the target is the session's own
|
|
185
|
+
* user — no id is passed.
|
|
186
|
+
*
|
|
187
|
+
* ONE call serves both cases. Accounts reads the credential and decides: with none it SETS the
|
|
188
|
+
* password (no `currentPassword` required); with one it verifies `currentPassword` and CHANGES
|
|
189
|
+
* it. The result's `mode` says which happened. With `revokeOtherSessions`, the user is logged
|
|
190
|
+
* out everywhere else. */
|
|
181
191
|
changePassword(input: {
|
|
182
|
-
|
|
192
|
+
/**
|
|
193
|
+
* OPTIONAL, and omitted when the account has no password yet — someone who signed up with
|
|
194
|
+
* Google has none to verify. Accounts decides which case applies by reading the credential
|
|
195
|
+
* itself (`setOrChangePassword`), so omitting this cannot bypass verification: when a
|
|
196
|
+
* password DOES exist and this is absent, the request is rejected.
|
|
197
|
+
*
|
|
198
|
+
* Read `hasPassword` from the `/me` payload to decide whether to collect it.
|
|
199
|
+
*/
|
|
200
|
+
currentPassword?: string;
|
|
183
201
|
newPassword: string;
|
|
184
202
|
confirmPassword?: string;
|
|
185
203
|
revokeOtherSessions?: boolean;
|
|
@@ -240,7 +258,9 @@ declare class AccountsAdmin {
|
|
|
240
258
|
* BEFORE submitting that someone is already a member or already invited. Email only, exact match.
|
|
241
259
|
* Session-authed.
|
|
242
260
|
*/
|
|
243
|
-
checkInviteEmail(appSlug: string, email: string
|
|
261
|
+
checkInviteEmail(appSlug: string, email: string, opts?: {
|
|
262
|
+
userGroupId?: string | null;
|
|
263
|
+
}): Promise<InviteEmailCheck>;
|
|
244
264
|
/**
|
|
245
265
|
* A workspace's own details — name plus its app-scoped profile values (support email, …).
|
|
246
266
|
* Service-key authed (`stats:read`). Pass `appId` to scope the profile values.
|
package/dist/admin.js
CHANGED
|
@@ -49,9 +49,13 @@ var AccountsAdmin = class {
|
|
|
49
49
|
body: input
|
|
50
50
|
});
|
|
51
51
|
}
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
*
|
|
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",
|
|
@@ -99,10 +103,12 @@ var AccountsAdmin = class {
|
|
|
99
103
|
* BEFORE submitting that someone is already a member or already invited. Email only, exact match.
|
|
100
104
|
* Session-authed.
|
|
101
105
|
*/
|
|
102
|
-
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);
|
|
103
109
|
return this.request(
|
|
104
110
|
"GET",
|
|
105
|
-
`/api/auth/apps/${encodeURIComponent(appSlug)}/invites/lookup
|
|
111
|
+
`/api/auth/apps/${encodeURIComponent(appSlug)}/invites/lookup?${query.toString()}`,
|
|
106
112
|
{ auth: "session" }
|
|
107
113
|
);
|
|
108
114
|
}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@~lyre/auth",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "Shared Axis Accounts auth SDK
|
|
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",
|