@finueva/auth 0.8.1 → 0.9.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 +17 -2
- package/dist/device.d.ts +11 -2
- package/dist/device.js +320 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +299 -28
- package/dist/server.d.ts +11 -3
- package/dist/server.js +291 -24
- package/dist/types-B67VIvTQ.d.ts +208 -0
- package/package.json +1 -1
- package/dist/types-DDopQNZR.d.ts +0 -123
package/dist/index.js
CHANGED
|
@@ -1884,6 +1884,7 @@ const messages = {
|
|
|
1884
1884
|
password_reset_invalid: "The password reset request is invalid.",
|
|
1885
1885
|
authentication_required: "Authentication is required.",
|
|
1886
1886
|
request_origin_denied: "The request origin is not allowed.",
|
|
1887
|
+
invalid_request: "The request is invalid.",
|
|
1887
1888
|
invalid_invitation: "The invitation is invalid.",
|
|
1888
1889
|
invitation_unavailable: "The invitation is not available.",
|
|
1889
1890
|
invitation_recipient_mismatch: "The invitation cannot be accepted by this account.",
|
|
@@ -2282,18 +2283,208 @@ function normalizeDriveCredential(value, now) {
|
|
|
2282
2283
|
expiresAt: new Date(now + value.expiresIn * 1e3)
|
|
2283
2284
|
};
|
|
2284
2285
|
}
|
|
2286
|
+
function normalizeOrganizationPageInput(value) {
|
|
2287
|
+
if (value === void 0) return new URLSearchParams();
|
|
2288
|
+
if (!isObject(value) || Object.keys(value).some((key) => key !== "limit" && key !== "cursor")) throw new AuthError("invalid_request", 400);
|
|
2289
|
+
const input = value;
|
|
2290
|
+
const query = new URLSearchParams();
|
|
2291
|
+
if (input.limit !== void 0) {
|
|
2292
|
+
if (!Number.isSafeInteger(input.limit) || input.limit < 1 || input.limit > 100) throw new AuthError("invalid_request", 400);
|
|
2293
|
+
query.set("limit", String(input.limit));
|
|
2294
|
+
}
|
|
2295
|
+
if (input.cursor !== void 0) {
|
|
2296
|
+
if (typeof input.cursor !== "string" || input.cursor.length < 1 || input.cursor.length > 820 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(input.cursor)) throw new AuthError("invalid_request", 400);
|
|
2297
|
+
query.set("cursor", input.cursor);
|
|
2298
|
+
}
|
|
2299
|
+
return query;
|
|
2300
|
+
}
|
|
2301
|
+
function normalizeIdInput(value) {
|
|
2302
|
+
if (!isId(value)) throw new AuthError("invalid_request", 400);
|
|
2303
|
+
return value;
|
|
2304
|
+
}
|
|
2305
|
+
function normalizeOrganization(value) {
|
|
2306
|
+
exact(value, [
|
|
2307
|
+
"capabilities",
|
|
2308
|
+
"id",
|
|
2309
|
+
"lifecycle",
|
|
2310
|
+
"logo",
|
|
2311
|
+
"name",
|
|
2312
|
+
"role",
|
|
2313
|
+
"slug"
|
|
2314
|
+
]);
|
|
2315
|
+
if (!isId(value.id) || !boundedString(value.name, 255) || !boundedString(value.slug, 255) || value.lifecycle !== "ordinary" && value.lifecycle !== "managed" || !role(value.role) || !isObject(value.capabilities)) throw authorityUnavailable();
|
|
2316
|
+
exact(value.capabilities, [
|
|
2317
|
+
"readInvitations",
|
|
2318
|
+
"readMembers",
|
|
2319
|
+
"readTeams"
|
|
2320
|
+
]);
|
|
2321
|
+
if (value.capabilities.readMembers !== true || value.capabilities.readTeams !== true || typeof value.capabilities.readInvitations !== "boolean") throw authorityUnavailable();
|
|
2322
|
+
return {
|
|
2323
|
+
id: value.id,
|
|
2324
|
+
name: value.name,
|
|
2325
|
+
slug: value.slug,
|
|
2326
|
+
logo: nullableHttpsUrl(value.logo),
|
|
2327
|
+
lifecycle: value.lifecycle,
|
|
2328
|
+
role: value.role,
|
|
2329
|
+
capabilities: {
|
|
2330
|
+
readMembers: true,
|
|
2331
|
+
readTeams: true,
|
|
2332
|
+
readInvitations: value.capabilities.readInvitations
|
|
2333
|
+
}
|
|
2334
|
+
};
|
|
2335
|
+
}
|
|
2285
2336
|
function normalizeOrganizations(value) {
|
|
2286
|
-
|
|
2287
|
-
|
|
2288
|
-
return
|
|
2289
|
-
|
|
2290
|
-
|
|
2291
|
-
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2337
|
+
exact(value, ["nextCursor", "organizations"]);
|
|
2338
|
+
if (!Array.isArray(value.organizations) || value.organizations.length > 100) throw authorityUnavailable();
|
|
2339
|
+
return {
|
|
2340
|
+
organizations: unique(value.organizations.map(normalizeOrganization), (item) => item.id),
|
|
2341
|
+
nextCursor: nullableCursor(value.nextCursor)
|
|
2342
|
+
};
|
|
2343
|
+
}
|
|
2344
|
+
function normalizeOrganizationMembers(value) {
|
|
2345
|
+
exact(value, ["members", "nextCursor"]);
|
|
2346
|
+
if (!Array.isArray(value.members) || value.members.length > 100) throw authorityUnavailable();
|
|
2347
|
+
return {
|
|
2348
|
+
members: unique(value.members.map((member) => {
|
|
2349
|
+
exact(member, [
|
|
2350
|
+
"email",
|
|
2351
|
+
"id",
|
|
2352
|
+
"image",
|
|
2353
|
+
"joinedAt",
|
|
2354
|
+
"name",
|
|
2355
|
+
"owner",
|
|
2356
|
+
"role",
|
|
2357
|
+
"teamIds",
|
|
2358
|
+
"userId"
|
|
2359
|
+
]);
|
|
2360
|
+
if (!isId(member.id) || !isId(member.userId) || !boundedString(member.name, 255) || typeof member.email !== "string" || member.email.length > 320 || !email.test(member.email) || !role(member.role) || typeof member.owner !== "boolean" || !Array.isArray(member.teamIds) || member.teamIds.length > 100) throw authorityUnavailable();
|
|
2361
|
+
const teamIds = unique(member.teamIds.map((teamId) => normalizeResponseId(teamId)), (item) => item);
|
|
2362
|
+
return {
|
|
2363
|
+
id: member.id,
|
|
2364
|
+
userId: member.userId,
|
|
2365
|
+
name: member.name,
|
|
2366
|
+
email: member.email,
|
|
2367
|
+
image: nullableHttpsUrl(member.image),
|
|
2368
|
+
role: member.role,
|
|
2369
|
+
owner: member.owner,
|
|
2370
|
+
joinedAt: responseDate(member.joinedAt),
|
|
2371
|
+
teamIds
|
|
2372
|
+
};
|
|
2373
|
+
}), (item) => item.id),
|
|
2374
|
+
nextCursor: nullableCursor(value.nextCursor)
|
|
2375
|
+
};
|
|
2376
|
+
}
|
|
2377
|
+
function normalizeOrganizationTeams(value) {
|
|
2378
|
+
exact(value, ["nextCursor", "teams"]);
|
|
2379
|
+
if (!Array.isArray(value.teams) || value.teams.length > 100) throw authorityUnavailable();
|
|
2380
|
+
return {
|
|
2381
|
+
teams: unique(value.teams.map((team) => {
|
|
2382
|
+
exact(team, [
|
|
2383
|
+
"category",
|
|
2384
|
+
"createdAt",
|
|
2385
|
+
"id",
|
|
2386
|
+
"name"
|
|
2387
|
+
]);
|
|
2388
|
+
if (!isId(team.id) || !boundedString(team.name, 255) || team.category !== "manual" && team.category !== "managed") throw authorityUnavailable();
|
|
2389
|
+
return {
|
|
2390
|
+
id: team.id,
|
|
2391
|
+
name: team.name,
|
|
2392
|
+
category: team.category,
|
|
2393
|
+
createdAt: responseDate(team.createdAt)
|
|
2394
|
+
};
|
|
2395
|
+
}), (item) => item.id),
|
|
2396
|
+
nextCursor: nullableCursor(value.nextCursor)
|
|
2397
|
+
};
|
|
2398
|
+
}
|
|
2399
|
+
function normalizeOrganizationTeamMembers(value) {
|
|
2400
|
+
exact(value, ["memberIds", "nextCursor"]);
|
|
2401
|
+
if (!Array.isArray(value.memberIds) || value.memberIds.length > 100) throw authorityUnavailable();
|
|
2402
|
+
return {
|
|
2403
|
+
memberIds: unique(value.memberIds.map((item) => normalizeResponseId(item)), (item) => item),
|
|
2404
|
+
nextCursor: nullableCursor(value.nextCursor)
|
|
2405
|
+
};
|
|
2406
|
+
}
|
|
2407
|
+
function normalizeOrganizationInvitation(value) {
|
|
2408
|
+
exact(value, [
|
|
2409
|
+
"createdAt",
|
|
2410
|
+
"email",
|
|
2411
|
+
"expiresAt",
|
|
2412
|
+
"id",
|
|
2413
|
+
"inviter",
|
|
2414
|
+
"role",
|
|
2415
|
+
"status",
|
|
2416
|
+
"teamIds"
|
|
2417
|
+
]);
|
|
2418
|
+
if (!isId(value.id) || typeof value.email !== "string" || value.email.length > 320 || !email.test(value.email) || !role(value.role) || value.status !== "pending" || !Array.isArray(value.teamIds) || value.teamIds.length > 100 || !isObject(value.inviter)) throw authorityUnavailable();
|
|
2419
|
+
exact(value.inviter, ["membershipId", "name"]);
|
|
2420
|
+
if (!isId(value.inviter.membershipId) || !boundedString(value.inviter.name, 255)) throw authorityUnavailable();
|
|
2421
|
+
return {
|
|
2422
|
+
id: value.id,
|
|
2423
|
+
email: value.email,
|
|
2424
|
+
role: value.role,
|
|
2425
|
+
teamIds: unique(value.teamIds.map(normalizeResponseId), (item) => item),
|
|
2426
|
+
inviter: {
|
|
2427
|
+
membershipId: value.inviter.membershipId,
|
|
2428
|
+
name: value.inviter.name
|
|
2429
|
+
},
|
|
2430
|
+
createdAt: responseDate(value.createdAt),
|
|
2431
|
+
expiresAt: responseDate(value.expiresAt),
|
|
2432
|
+
status: "pending"
|
|
2433
|
+
};
|
|
2434
|
+
}
|
|
2435
|
+
function normalizeOrganizationInvitations(value) {
|
|
2436
|
+
exact(value, ["invitations", "nextCursor"]);
|
|
2437
|
+
if (!Array.isArray(value.invitations) || value.invitations.length > 100) throw authorityUnavailable();
|
|
2438
|
+
return {
|
|
2439
|
+
invitations: unique(value.invitations.map(normalizeOrganizationInvitation), (item) => item.id),
|
|
2440
|
+
nextCursor: nullableCursor(value.nextCursor)
|
|
2441
|
+
};
|
|
2442
|
+
}
|
|
2443
|
+
function normalizeReceivedInvitation(value) {
|
|
2444
|
+
exact(value, [
|
|
2445
|
+
"expiresAt",
|
|
2446
|
+
"id",
|
|
2447
|
+
"inviterName",
|
|
2448
|
+
"organization",
|
|
2449
|
+
"role",
|
|
2450
|
+
"teams"
|
|
2451
|
+
]);
|
|
2452
|
+
if (!isId(value.id) || !boundedString(value.inviterName, 255) || !role(value.role) || !Array.isArray(value.teams) || value.teams.length > 100 || !isObject(value.organization)) throw authorityUnavailable();
|
|
2453
|
+
exact(value.organization, [
|
|
2454
|
+
"id",
|
|
2455
|
+
"logo",
|
|
2456
|
+
"name",
|
|
2457
|
+
"slug"
|
|
2458
|
+
]);
|
|
2459
|
+
if (!isId(value.organization.id) || !boundedString(value.organization.name, 255) || !boundedString(value.organization.slug, 255)) throw authorityUnavailable();
|
|
2460
|
+
return {
|
|
2461
|
+
id: value.id,
|
|
2462
|
+
organization: {
|
|
2463
|
+
id: value.organization.id,
|
|
2464
|
+
name: value.organization.name,
|
|
2465
|
+
slug: value.organization.slug,
|
|
2466
|
+
logo: nullableHttpsUrl(value.organization.logo)
|
|
2467
|
+
},
|
|
2468
|
+
role: value.role,
|
|
2469
|
+
teams: unique(value.teams.map((team) => {
|
|
2470
|
+
exact(team, ["id", "name"]);
|
|
2471
|
+
if (!isId(team.id) || !boundedString(team.name, 255)) throw authorityUnavailable();
|
|
2472
|
+
return {
|
|
2473
|
+
id: team.id,
|
|
2474
|
+
name: team.name
|
|
2475
|
+
};
|
|
2476
|
+
}), (item) => item.id),
|
|
2477
|
+
inviterName: value.inviterName,
|
|
2478
|
+
expiresAt: responseDate(value.expiresAt)
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
function normalizeReceivedInvitations(value) {
|
|
2482
|
+
exact(value, ["invitations", "nextCursor"]);
|
|
2483
|
+
if (!Array.isArray(value.invitations) || value.invitations.length > 100) throw authorityUnavailable();
|
|
2484
|
+
return {
|
|
2485
|
+
invitations: unique(value.invitations.map(normalizeReceivedInvitation), (item) => item.id),
|
|
2486
|
+
nextCursor: nullableCursor(value.nextCursor)
|
|
2487
|
+
};
|
|
2297
2488
|
}
|
|
2298
2489
|
function normalizeInvitationInput(value) {
|
|
2299
2490
|
if (!isObject(value) || Object.keys(value).length !== 1 || !isId(value.invitationId)) throw new AuthError("invalid_invitation", 422);
|
|
@@ -2359,6 +2550,12 @@ function fromOrganizationListError(error) {
|
|
|
2359
2550
|
if (error instanceof AuthError) return error;
|
|
2360
2551
|
return authorityUnavailable();
|
|
2361
2552
|
}
|
|
2553
|
+
function fromOrganizationReadAuthorityError(value, status) {
|
|
2554
|
+
if (status === 400) return new AuthError("invalid_request", 400);
|
|
2555
|
+
if (status === 401) return new AuthError("authentication_required", 401);
|
|
2556
|
+
if (status === 403) return new AuthError("access_denied", 403);
|
|
2557
|
+
return authorityUnavailable();
|
|
2558
|
+
}
|
|
2362
2559
|
function fromInvitationAuthorityError(value, status) {
|
|
2363
2560
|
const code = isObject(value) && typeof value.code === "string" ? value.code : void 0;
|
|
2364
2561
|
if (status === 401 && code === "UNAUTHORIZED") return new AuthError("authentication_required", 401);
|
|
@@ -2445,6 +2642,46 @@ function normalizeProfileImage(value) {
|
|
|
2445
2642
|
function isId(value) {
|
|
2446
2643
|
return typeof value === "string" && id.test(value);
|
|
2447
2644
|
}
|
|
2645
|
+
function exact(value, keys) {
|
|
2646
|
+
if (!isObject(value) || Object.keys(value).sort().join(",") !== [...keys].sort().join(",")) throw authorityUnavailable();
|
|
2647
|
+
}
|
|
2648
|
+
function boundedString(value, maximum) {
|
|
2649
|
+
return typeof value === "string" && value.length > 0 && new TextEncoder().encode(value).byteLength <= maximum;
|
|
2650
|
+
}
|
|
2651
|
+
function role(value) {
|
|
2652
|
+
return value === "owner" || value === "admin" || value === "member";
|
|
2653
|
+
}
|
|
2654
|
+
function nullableHttpsUrl(value) {
|
|
2655
|
+
if (value === null) return null;
|
|
2656
|
+
if (typeof value !== "string" || value.length > 2048) throw authorityUnavailable();
|
|
2657
|
+
let url;
|
|
2658
|
+
try {
|
|
2659
|
+
url = new URL(value);
|
|
2660
|
+
} catch {
|
|
2661
|
+
throw authorityUnavailable();
|
|
2662
|
+
}
|
|
2663
|
+
if (url.protocol !== "https:" || url.username || url.password || url.toString() !== value) throw authorityUnavailable();
|
|
2664
|
+
return value;
|
|
2665
|
+
}
|
|
2666
|
+
function responseDate(value) {
|
|
2667
|
+
if (typeof value !== "string") throw authorityUnavailable();
|
|
2668
|
+
const date = new Date(value);
|
|
2669
|
+
if (!Number.isFinite(date.getTime()) || date.toISOString() !== value) throw authorityUnavailable();
|
|
2670
|
+
return date;
|
|
2671
|
+
}
|
|
2672
|
+
function nullableCursor(value) {
|
|
2673
|
+
if (value === null) return null;
|
|
2674
|
+
if (typeof value !== "string" || value.length < 1 || value.length > 820 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(value)) throw authorityUnavailable();
|
|
2675
|
+
return value;
|
|
2676
|
+
}
|
|
2677
|
+
function normalizeResponseId(value) {
|
|
2678
|
+
if (!isId(value)) throw authorityUnavailable();
|
|
2679
|
+
return value;
|
|
2680
|
+
}
|
|
2681
|
+
function unique(items, key) {
|
|
2682
|
+
if (new Set(items.map(key)).size !== items.length) throw authorityUnavailable();
|
|
2683
|
+
return items;
|
|
2684
|
+
}
|
|
2448
2685
|
function isObject(value) {
|
|
2449
2686
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
2450
2687
|
}
|
|
@@ -2474,18 +2711,18 @@ async function requestJsonResponse(url, options) {
|
|
|
2474
2711
|
}
|
|
2475
2712
|
const contentType = response.headers.get("content-type")?.split(";", 1)[0]?.trim().toLowerCase();
|
|
2476
2713
|
if (response.status >= 300 || response.status < 200 || contentType !== "application/json") {
|
|
2477
|
-
const body = contentType === "application/json" ? await readJson(response) : void 0;
|
|
2714
|
+
const body = contentType === "application/json" ? await readJson(response, options.maxResponseBytes) : void 0;
|
|
2478
2715
|
await response.body?.cancel();
|
|
2479
2716
|
throw (options.mapError ?? fromAuthorityError)(body, response.status, response.headers.get("retry-after"));
|
|
2480
2717
|
}
|
|
2481
2718
|
return {
|
|
2482
|
-
value: await readJson(response),
|
|
2719
|
+
value: await readJson(response, options.maxResponseBytes),
|
|
2483
2720
|
headers: response.headers
|
|
2484
2721
|
};
|
|
2485
2722
|
}
|
|
2486
|
-
async function readJson(response) {
|
|
2723
|
+
async function readJson(response, maximum = MAX_RESPONSE_BYTES) {
|
|
2487
2724
|
const length = response.headers.get("content-length");
|
|
2488
|
-
if (length && (!/^\d+$/.test(length) || Number(length) >
|
|
2725
|
+
if (length && (!/^\d+$/.test(length) || Number(length) > maximum)) {
|
|
2489
2726
|
await response.body?.cancel();
|
|
2490
2727
|
throw authorityUnavailable();
|
|
2491
2728
|
}
|
|
@@ -2498,7 +2735,7 @@ async function readJson(response) {
|
|
|
2498
2735
|
const { done, value } = await reader.read();
|
|
2499
2736
|
if (done) break;
|
|
2500
2737
|
size += value.byteLength;
|
|
2501
|
-
if (size >
|
|
2738
|
+
if (size > maximum) throw authorityUnavailable();
|
|
2502
2739
|
chunks.push(value);
|
|
2503
2740
|
}
|
|
2504
2741
|
} catch (error) {
|
|
@@ -3534,6 +3771,25 @@ function createAuthClient(options) {
|
|
|
3534
3771
|
mapError
|
|
3535
3772
|
})).value;
|
|
3536
3773
|
}
|
|
3774
|
+
async function organizationRead(path, input, normalize) {
|
|
3775
|
+
if (signOutRequest || activeAccountMutationGeneration !== void 0 || invitationRequest) throw new AuthError("state_conflict", 409);
|
|
3776
|
+
const generation = authorityGeneration;
|
|
3777
|
+
const query = normalizeOrganizationPageInput(input);
|
|
3778
|
+
const value = await requestJson(`${joinURL(authOrigin, "api/v1/auth/organizations", path)}${query.size ? `?${query}` : ""}`, {
|
|
3779
|
+
fetch: fetchImpl,
|
|
3780
|
+
timeoutMs,
|
|
3781
|
+
method: "GET",
|
|
3782
|
+
mapError: fromOrganizationReadAuthorityError,
|
|
3783
|
+
maxResponseBytes: 256 * 1024
|
|
3784
|
+
});
|
|
3785
|
+
if (generation !== authorityGeneration) throw new AuthError("state_conflict", 409);
|
|
3786
|
+
try {
|
|
3787
|
+
return normalize(value);
|
|
3788
|
+
} catch (error) {
|
|
3789
|
+
if (generation !== authorityGeneration) throw new AuthError("state_conflict", 409);
|
|
3790
|
+
throw error;
|
|
3791
|
+
}
|
|
3792
|
+
}
|
|
3537
3793
|
return {
|
|
3538
3794
|
_type: "browser",
|
|
3539
3795
|
acceptInvitation(input) {
|
|
@@ -3544,7 +3800,7 @@ function createAuthClient(options) {
|
|
|
3544
3800
|
return Promise.reject(error);
|
|
3545
3801
|
}
|
|
3546
3802
|
if (signOutRequest || activeAccountMutationGeneration !== void 0 || invitationRequest) return Promise.reject(new AuthError("state_conflict", 409));
|
|
3547
|
-
const generation = authorityGeneration;
|
|
3803
|
+
const generation = ++authorityGeneration;
|
|
3548
3804
|
const controller = new AbortController();
|
|
3549
3805
|
clearCredential();
|
|
3550
3806
|
const request = (async () => {
|
|
@@ -3575,22 +3831,37 @@ function createAuthClient(options) {
|
|
|
3575
3831
|
return request;
|
|
3576
3832
|
},
|
|
3577
3833
|
getSession,
|
|
3578
|
-
async listOrganizations() {
|
|
3579
|
-
if (signOutRequest || activeAccountMutationGeneration !== void 0 || invitationRequest) throw new AuthError("state_conflict", 409);
|
|
3580
|
-
const generation = authorityGeneration;
|
|
3834
|
+
async listOrganizations(input) {
|
|
3581
3835
|
try {
|
|
3582
|
-
|
|
3583
|
-
fetch: fetchImpl,
|
|
3584
|
-
timeoutMs,
|
|
3585
|
-
method: "GET"
|
|
3586
|
-
});
|
|
3587
|
-
if (generation !== authorityGeneration) throw new AuthError("state_conflict", 409);
|
|
3588
|
-
return normalizeOrganizations(value);
|
|
3836
|
+
return await organizationRead("", input, normalizeOrganizations);
|
|
3589
3837
|
} catch (error) {
|
|
3590
|
-
if (generation !== authorityGeneration) throw new AuthError("state_conflict", 409);
|
|
3591
3838
|
throw fromOrganizationListError(error);
|
|
3592
3839
|
}
|
|
3593
3840
|
},
|
|
3841
|
+
async getOrganization(organizationId) {
|
|
3842
|
+
return organizationRead(normalizeIdInput(organizationId), void 0, normalizeOrganization);
|
|
3843
|
+
},
|
|
3844
|
+
async listOrganizationMembers(organizationId, input) {
|
|
3845
|
+
return organizationRead(`${normalizeIdInput(organizationId)}/members`, input, normalizeOrganizationMembers);
|
|
3846
|
+
},
|
|
3847
|
+
async listOrganizationTeams(organizationId, input) {
|
|
3848
|
+
return organizationRead(`${normalizeIdInput(organizationId)}/teams`, input, normalizeOrganizationTeams);
|
|
3849
|
+
},
|
|
3850
|
+
async listOrganizationTeamMembers(organizationId, teamId, input) {
|
|
3851
|
+
return organizationRead(`${normalizeIdInput(organizationId)}/teams/${normalizeIdInput(teamId)}/members`, input, normalizeOrganizationTeamMembers);
|
|
3852
|
+
},
|
|
3853
|
+
async listOrganizationInvitations(organizationId, input) {
|
|
3854
|
+
return organizationRead(`${normalizeIdInput(organizationId)}/invitations`, input, normalizeOrganizationInvitations);
|
|
3855
|
+
},
|
|
3856
|
+
async getOrganizationInvitation(organizationId, invitationId) {
|
|
3857
|
+
return organizationRead(`${normalizeIdInput(organizationId)}/invitations/${normalizeIdInput(invitationId)}`, void 0, normalizeOrganizationInvitation);
|
|
3858
|
+
},
|
|
3859
|
+
async listReceivedInvitations(input) {
|
|
3860
|
+
return organizationRead("received-invitations", input, normalizeReceivedInvitations);
|
|
3861
|
+
},
|
|
3862
|
+
async getReceivedInvitation(invitationId) {
|
|
3863
|
+
return organizationRead(`received-invitations/${normalizeIdInput(invitationId)}`, void 0, normalizeReceivedInvitation);
|
|
3864
|
+
},
|
|
3594
3865
|
async signIn(input) {
|
|
3595
3866
|
const body = {
|
|
3596
3867
|
email: normalizeEmail(input?.email),
|
package/dist/server.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as AuthErrorStatus, S as
|
|
1
|
+
import { C as PersonalWorkspaceSelection, M as AuthError, N as AuthErrorCode, O as SocialIdTokenInput, P as AuthErrorStatus, S as OrganizationWorkspaceSelection, T as ReceivedOrganizationInvitationPage, _ as OrganizationPage, b as OrganizationTeamMemberPage, c as AuthUser, f as InvitationAcceptance, g as OrganizationMemberPage, h as OrganizationMember, j as WorkspaceSelection, k as SocialIdTokenProvider, l as DriveCredential, m as OrganizationInvitationPage, o as AuthSession, p as OrganizationInvitation, r as AuthOrganization, t as AcceptInvitationInput, u as DriveCredentialInput, v as OrganizationPageInput, w as ReceivedOrganizationInvitation, x as OrganizationTeamPage, y as OrganizationTeam } from "./types-B67VIvTQ.js";
|
|
2
2
|
//#region src/server.d.ts
|
|
3
3
|
interface ServerAuthOptions {
|
|
4
4
|
authOrigin: string;
|
|
@@ -20,11 +20,19 @@ interface ServerSocialIdTokenSession extends AuthSession {
|
|
|
20
20
|
interface FinuevaServerAuth {
|
|
21
21
|
acceptInvitation(input: AcceptInvitationInput): Promise<ServerInvitationAcceptance>;
|
|
22
22
|
getSession(): Promise<AuthSession | null>;
|
|
23
|
-
listOrganizations(): Promise<
|
|
23
|
+
listOrganizations(input?: OrganizationPageInput): Promise<OrganizationPage>;
|
|
24
|
+
getOrganization(organizationId: string): Promise<AuthOrganization>;
|
|
25
|
+
listOrganizationMembers(organizationId: string, input?: OrganizationPageInput): Promise<OrganizationMemberPage>;
|
|
26
|
+
listOrganizationTeams(organizationId: string, input?: OrganizationPageInput): Promise<OrganizationTeamPage>;
|
|
27
|
+
listOrganizationTeamMembers(organizationId: string, teamId: string, input?: OrganizationPageInput): Promise<OrganizationTeamMemberPage>;
|
|
28
|
+
listOrganizationInvitations(organizationId: string, input?: OrganizationPageInput): Promise<OrganizationInvitationPage>;
|
|
29
|
+
getOrganizationInvitation(organizationId: string, invitationId: string): Promise<OrganizationInvitation>;
|
|
30
|
+
listReceivedInvitations(input?: OrganizationPageInput): Promise<ReceivedOrganizationInvitationPage>;
|
|
31
|
+
getReceivedInvitation(invitationId: string): Promise<ReceivedOrganizationInvitation>;
|
|
24
32
|
signInWithSocialIdToken(input: SocialIdTokenInput): Promise<ServerSocialIdTokenSession>;
|
|
25
33
|
getDriveCredential(input: DriveCredentialInput): Promise<DriveCredential>;
|
|
26
34
|
signOut(): Promise<ServerSignOutResult>;
|
|
27
35
|
}
|
|
28
36
|
declare function createServerAuth(options: ServerAuthOptions): FinuevaServerAuth;
|
|
29
37
|
//#endregion
|
|
30
|
-
export { type AcceptInvitationInput, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthSession, type AuthUser, type DriveCredential, type DriveCredentialInput, FinuevaServerAuth, type InvitationAcceptance, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, ServerAuthOptions, ServerInvitationAcceptance, ServerSignOutResult, ServerSocialIdTokenSession, type SocialIdTokenInput, type SocialIdTokenProvider, type WorkspaceSelection, createServerAuth };
|
|
38
|
+
export { type AcceptInvitationInput, AuthError, type AuthErrorCode, type AuthErrorStatus, type AuthOrganization, type AuthSession, type AuthUser, type DriveCredential, type DriveCredentialInput, FinuevaServerAuth, type InvitationAcceptance, type OrganizationInvitation, type OrganizationInvitationPage, type OrganizationMember, type OrganizationMemberPage, type OrganizationPage, type OrganizationPageInput, type OrganizationTeam, type OrganizationTeamMemberPage, type OrganizationTeamPage, type OrganizationWorkspaceSelection, type PersonalWorkspaceSelection, type ReceivedOrganizationInvitation, type ReceivedOrganizationInvitationPage, ServerAuthOptions, ServerInvitationAcceptance, ServerSignOutResult, ServerSocialIdTokenSession, type SocialIdTokenInput, type SocialIdTokenProvider, type WorkspaceSelection, createServerAuth };
|