@finueva/auth 0.8.1 → 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/README.md +90 -4
- package/dist/device.d.ts +15 -2
- package/dist/device.js +509 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +447 -28
- package/dist/server.d.ts +15 -3
- package/dist/server.js +445 -24
- package/dist/types-Byw9JQwL.d.ts +235 -0
- package/package.json +1 -1
- package/dist/types-DDopQNZR.d.ts +0 -123
package/README.md
CHANGED
|
@@ -7,12 +7,14 @@ Use it to:
|
|
|
7
7
|
- sign users in with email and password;
|
|
8
8
|
- read the current session;
|
|
9
9
|
- manage profile and password details;
|
|
10
|
-
-
|
|
10
|
+
- read organizations, create ordinary teams, replace display data, and accept invitations;
|
|
11
11
|
- request short-lived Drive credentials;
|
|
12
12
|
- authenticate CLIs and native applications.
|
|
13
13
|
|
|
14
14
|
The package is ESM-only and has no runtime dependencies. Its API is experimental while the package is below `1.0.0`.
|
|
15
15
|
|
|
16
|
+
Sections marked **Unreleased** describe repository source and are not available in the currently published `@finueva/auth@0.9.0` package.
|
|
17
|
+
|
|
16
18
|
## Install
|
|
17
19
|
|
|
18
20
|
```sh
|
|
@@ -181,13 +183,67 @@ The callback must use the application's exact origin. Omit it to use the default
|
|
|
181
183
|
### List Organizations
|
|
182
184
|
|
|
183
185
|
```ts
|
|
184
|
-
|
|
186
|
+
let page = await auth.listOrganizations({ limit: 50 });
|
|
185
187
|
|
|
186
|
-
for (const organization of organizations) {
|
|
188
|
+
for (const organization of page.organizations) {
|
|
187
189
|
console.log(organization.id, organization.name, organization.slug);
|
|
188
190
|
}
|
|
191
|
+
|
|
192
|
+
if (page.nextCursor) {
|
|
193
|
+
page = await auth.listOrganizations({ limit: 50, cursor: page.nextCursor });
|
|
194
|
+
}
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
All organization collections use an opaque cursor and a page size from 1 through 100. Use
|
|
198
|
+
`getOrganization()`, `listOrganizationMembers()`, `listOrganizationTeams()`, and
|
|
199
|
+
`listOrganizationTeamMembers()` with an explicit organization ID. Manual owners and admins can use
|
|
200
|
+
`listOrganizationInvitations()` and `getOrganizationInvitation()`. A verified recipient can use
|
|
201
|
+
`listReceivedInvitations()` and `getReceivedInvitation()`.
|
|
202
|
+
|
|
203
|
+
Pagination is deterministic while a collection does not change. During concurrent mutation, an
|
|
204
|
+
insert at or before the cursor can be absent, an insert after it can appear once, and a delete,
|
|
205
|
+
update, status change, or expiry can change later pages. Restart pagination when you need a current
|
|
206
|
+
view.
|
|
207
|
+
|
|
208
|
+
### Create A Team
|
|
209
|
+
|
|
210
|
+
**Unreleased:** this method will ship in a later package version and is not in `@finueva/auth@0.9.0`.
|
|
211
|
+
|
|
212
|
+
```ts
|
|
213
|
+
const idempotencyKey = crypto.randomUUID();
|
|
214
|
+
const team = await auth.createOrganizationTeam("org_01J8R7M6N5P4Q3S2T1", "Platform Engineering", idempotencyKey);
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
The name and caller-owned idempotency key must each contain from 1 through 255 UTF-8 bytes. Use a
|
|
218
|
+
new key for each intended team. If a response is lost, send the same organization ID, name, and key
|
|
219
|
+
again. Auth returns the original creation result for a completed same-key request, even if a later
|
|
220
|
+
operation changed the team display. A conflicting or unresolved same-key request returns
|
|
221
|
+
`state_conflict`. The SDK never retries automatically.
|
|
222
|
+
|
|
223
|
+
For an ordinary organization, a current effective owner or administrator can use the cookie or
|
|
224
|
+
bearer lane. For a managed organization, a current manual owner or manual administrator must use the
|
|
225
|
+
cookie lane. The method creates only an ordinary team.
|
|
226
|
+
|
|
227
|
+
### Create A Member Invitation
|
|
228
|
+
|
|
229
|
+
**Unreleased:** this method will ship in a later package version and is not in `@finueva/auth@0.9.0`.
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
const invitation = await auth.createOrganizationMemberInvitation("org_01J8R7M6N5P4Q3S2T1", {
|
|
233
|
+
email: "member@example.com",
|
|
234
|
+
teamIds: ["team_01J8R7M6N5P4Q3S2T1"],
|
|
235
|
+
idempotencyKey: crypto.randomUUID(),
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
console.log(invitation.id, invitation.expiresAt);
|
|
189
239
|
```
|
|
190
240
|
|
|
241
|
+
The SDK trims and lowercases the email address. The email address can contain no more than 320 UTF-8 bytes. `teamIds` is optional and can contain no more than 100 unique ordinary team IDs. The caller-owned idempotency key must contain from 1 through 255 UTF-8 bytes.
|
|
242
|
+
|
|
243
|
+
Use a new key for each intended invitation. If a response is lost, send the same organization ID and input again. The method returns only the invitation ID and expiry. It does not report email delivery. The SDK never retries automatically.
|
|
244
|
+
|
|
245
|
+
For an ordinary organization, a current effective owner or administrator can use the cookie or bearer lane. Managed organizations are denied.
|
|
246
|
+
|
|
191
247
|
### Accept An Invitation
|
|
192
248
|
|
|
193
249
|
```ts
|
|
@@ -198,6 +254,36 @@ const result = await auth.acceptInvitation({
|
|
|
198
254
|
console.log(result.organizationId);
|
|
199
255
|
```
|
|
200
256
|
|
|
257
|
+
### Replace Organization Display
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
const display = await auth.updateOrganizationDisplay("org_01J8R7M6N5P4Q3S2T1", {
|
|
261
|
+
name: "Example Group",
|
|
262
|
+
slug: "example-group",
|
|
263
|
+
logo: null,
|
|
264
|
+
});
|
|
265
|
+
```
|
|
266
|
+
|
|
267
|
+
Send all three fields. `name` and `slug` can contain no more than 255 UTF-8 bytes. Use `logo: null` to remove the logo. A non-null logo must be an exact canonical HTTPS URL of no more than 2048 UTF-8 bytes. The method supports manual owners and manual administrators of ordinary organizations. Provider-only administrators are denied. It does not update metadata, lifecycle, membership, teams, invitations, or active-organization state.
|
|
268
|
+
|
|
269
|
+
Browser and cookie-based server calls require the exact configured application Origin. The SDK reports a denied or missing Origin as `request_origin_denied`. Other organization authority denials use `access_denied`.
|
|
270
|
+
|
|
271
|
+
The method does not retry. If a response is lost, submit the same complete desired state again. Concurrent different updates use last-write-wins behavior.
|
|
272
|
+
|
|
273
|
+
### Replace Team Display
|
|
274
|
+
|
|
275
|
+
**Unreleased:** this method will ship in a later package version and is not in `@finueva/auth@0.9.0`.
|
|
276
|
+
|
|
277
|
+
```ts
|
|
278
|
+
const display = await auth.updateOrganizationTeamDisplay("org_01J8R7M6N5P4Q3S2T1", "team_01J8R7M6N5P4Q3S2T1", {
|
|
279
|
+
name: "Platform Engineering",
|
|
280
|
+
});
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
Send the complete `name`. It can contain no more than 255 UTF-8 bytes. For an ordinary organization, a current effective owner or administrator can use the cookie or bearer lane. For a managed organization, a current manual owner or manual administrator must use the cookie lane. Managed teams are denied.
|
|
284
|
+
|
|
285
|
+
The method does not retry. If a response is lost, submit the same complete desired name again. Concurrent different updates use last-write-wins behavior.
|
|
286
|
+
|
|
201
287
|
### Sign Out
|
|
202
288
|
|
|
203
289
|
```ts
|
|
@@ -454,7 +540,7 @@ The SDK does not automatically retry requests.
|
|
|
454
540
|
- Browser snapshots and bearer authorization values are limited to 16 KiB.
|
|
455
541
|
- Organization lists fail closed at 100 records.
|
|
456
542
|
- Organization Drive context supports at most 50 current teams.
|
|
457
|
-
- Account deletion and organization management are not exposed.
|
|
543
|
+
- Ordinary-organization display replacement is the only organization mutation in `@finueva/auth@0.9.0`. Unreleased source also exposes ordinary-team creation and display replacement. Account deletion and other organization management are not exposed.
|
|
458
544
|
- Cross-root SSO and custom refresh tokens are not implemented.
|
|
459
545
|
- Hosted mobile transport and operating-system vault qualification are incomplete.
|
|
460
546
|
- Production support gates are not complete.
|
package/dist/device.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { A as ReceivedOrganizationInvitationPage, B as AuthErrorCode, C as OrganizationTeam, E as OrganizationTeamPage, F as UpdateOrganizationDisplayInput, I as UpdateOrganizationTeamDisplayInput, L as UpdateProfileInput, N as SocialIdTokenInput, P as SocialIdTokenProvider, S as OrganizationPageInput, T as OrganizationTeamMemberPage, V as AuthErrorStatus, _ as OrganizationInvitation, b as OrganizationMemberPage, d as CreatedOrganizationTeam, f as DriveCredential, g as OrganizationDisplay, k as ReceivedOrganizationInvitation, l as CreateOrganizationMemberInvitationInput, o as AuthSession, p as DriveCredentialInput, r as AuthOrganization, u as CreatedOrganizationMemberInvitation, v as OrganizationInvitationPage, w as OrganizationTeamDisplay, x as OrganizationPage, y as OrganizationMember, z as AuthError } from "./types-Byw9JQwL.js";
|
|
2
2
|
//#region src/device.d.ts
|
|
3
3
|
type DeviceAuthorizationErrorCode = "device_access_denied" | "device_authorization_cancelled" | "device_code_expired" | "invalid_device_authorization" | "identity_authority_unavailable";
|
|
4
4
|
declare class DeviceAuthorizationError extends Error {
|
|
@@ -43,6 +43,19 @@ interface DeviceAuthClient {
|
|
|
43
43
|
}): Promise<DeviceAuthorization>;
|
|
44
44
|
pollForToken(authorization: DeviceAuthorization, options?: PollDeviceOptions): Promise<DeviceToken>;
|
|
45
45
|
getSession(): Promise<AuthSession | null>;
|
|
46
|
+
listOrganizations(input?: OrganizationPageInput): Promise<OrganizationPage>;
|
|
47
|
+
getOrganization(organizationId: string): Promise<AuthOrganization>;
|
|
48
|
+
createOrganizationTeam(organizationId: string, name: string, idempotencyKey: string): Promise<CreatedOrganizationTeam>;
|
|
49
|
+
createOrganizationMemberInvitation(organizationId: string, input: CreateOrganizationMemberInvitationInput): Promise<CreatedOrganizationMemberInvitation>;
|
|
50
|
+
updateOrganizationDisplay(organizationId: string, input: UpdateOrganizationDisplayInput): Promise<OrganizationDisplay>;
|
|
51
|
+
updateOrganizationTeamDisplay(organizationId: string, teamId: string, input: UpdateOrganizationTeamDisplayInput): Promise<OrganizationTeamDisplay>;
|
|
52
|
+
listOrganizationMembers(organizationId: string, input?: OrganizationPageInput): Promise<OrganizationMemberPage>;
|
|
53
|
+
listOrganizationTeams(organizationId: string, input?: OrganizationPageInput): Promise<OrganizationTeamPage>;
|
|
54
|
+
listOrganizationTeamMembers(organizationId: string, teamId: string, input?: OrganizationPageInput): Promise<OrganizationTeamMemberPage>;
|
|
55
|
+
listOrganizationInvitations(organizationId: string, input?: OrganizationPageInput): Promise<OrganizationInvitationPage>;
|
|
56
|
+
getOrganizationInvitation(organizationId: string, invitationId: string): Promise<OrganizationInvitation>;
|
|
57
|
+
listReceivedInvitations(input?: OrganizationPageInput): Promise<ReceivedOrganizationInvitationPage>;
|
|
58
|
+
getReceivedInvitation(invitationId: string): Promise<ReceivedOrganizationInvitation>;
|
|
46
59
|
getToken(): Promise<DeviceToken | null>;
|
|
47
60
|
signUpWithEmail(email: string, password: string, name: string): Promise<AuthSession>;
|
|
48
61
|
signInWithEmail(email: string, password: string): Promise<AuthSession>;
|
|
@@ -55,4 +68,4 @@ interface DeviceAuthClient {
|
|
|
55
68
|
}
|
|
56
69
|
declare function createDeviceAuth(options: DeviceAuthOptions): DeviceAuthClient;
|
|
57
70
|
//#endregion
|
|
58
|
-
export { AuthError, type AuthErrorCode, type AuthErrorStatus, DeviceAuthClient, DeviceAuthOptions, DeviceAuthorization, DeviceAuthorizationError, DeviceAuthorizationErrorCode, DeviceToken, DeviceTokenPersistence, PollDeviceOptions, type SocialIdTokenInput, type SocialIdTokenProvider, createDeviceAuth };
|
|
71
|
+
export { AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type CreateOrganizationMemberInvitationInput, type CreatedOrganizationMemberInvitation, type CreatedOrganizationTeam, DeviceAuthClient, DeviceAuthOptions, DeviceAuthorization, DeviceAuthorizationError, DeviceAuthorizationErrorCode, DeviceToken, DeviceTokenPersistence, type OrganizationDisplay, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamDisplay, type OrganizationTeamMemberPage, type OrganizationTeamPage, PollDeviceOptions, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, type SocialIdTokenInput, type SocialIdTokenProvider, type UpdateOrganizationDisplayInput, type UpdateOrganizationTeamDisplayInput, createDeviceAuth };
|