authhero 0.221.0 → 0.223.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/authhero.cjs +2 -2
- package/dist/authhero.d.ts +2 -2
- package/dist/authhero.mjs +25 -23
- package/package.json +2 -2
package/dist/authhero.d.ts
CHANGED
|
@@ -16198,7 +16198,7 @@ export declare function init(config: AuthHeroConfig): {
|
|
|
16198
16198
|
};
|
|
16199
16199
|
} & {
|
|
16200
16200
|
json: {
|
|
16201
|
-
|
|
16201
|
+
members: string[];
|
|
16202
16202
|
};
|
|
16203
16203
|
};
|
|
16204
16204
|
output: {};
|
|
@@ -16219,7 +16219,7 @@ export declare function init(config: AuthHeroConfig): {
|
|
|
16219
16219
|
};
|
|
16220
16220
|
} & {
|
|
16221
16221
|
json: {
|
|
16222
|
-
|
|
16222
|
+
members: string[];
|
|
16223
16223
|
};
|
|
16224
16224
|
};
|
|
16225
16225
|
output: {};
|
package/dist/authhero.mjs
CHANGED
|
@@ -20648,11 +20648,11 @@ const cx = qt.extend({
|
|
|
20648
20648
|
description: "Array of organization members"
|
|
20649
20649
|
})
|
|
20650
20650
|
}), vx = o.object({
|
|
20651
|
-
|
|
20651
|
+
members: o.array(o.string()).openapi({
|
|
20652
20652
|
description: "Array of user IDs to add to the organization"
|
|
20653
20653
|
})
|
|
20654
20654
|
}), bx = o.object({
|
|
20655
|
-
|
|
20655
|
+
members: o.array(o.string()).openapi({
|
|
20656
20656
|
description: "Array of user IDs to remove from the organization"
|
|
20657
20657
|
})
|
|
20658
20658
|
}), $x = new be().openapi(
|
|
@@ -20951,7 +20951,7 @@ const cx = qt.extend({
|
|
|
20951
20951
|
}
|
|
20952
20952
|
}),
|
|
20953
20953
|
async (t) => {
|
|
20954
|
-
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), {
|
|
20954
|
+
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), { members: r } = t.req.valid("json");
|
|
20955
20955
|
if (!await t.env.data.organizations.get(
|
|
20956
20956
|
e,
|
|
20957
20957
|
n
|
|
@@ -21004,7 +21004,7 @@ const cx = qt.extend({
|
|
|
21004
21004
|
}
|
|
21005
21005
|
}),
|
|
21006
21006
|
async (t) => {
|
|
21007
|
-
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), {
|
|
21007
|
+
const { "tenant-id": e } = t.req.valid("header"), { id: n } = t.req.valid("param"), { members: r } = t.req.valid("json");
|
|
21008
21008
|
for (const i of r) {
|
|
21009
21009
|
const a = (await t.env.data.userOrganizations.list(e, {
|
|
21010
21010
|
q: `user_id:${i}`,
|
|
@@ -24981,7 +24981,7 @@ const SE = new be().openapi(
|
|
|
24981
24981
|
}
|
|
24982
24982
|
}),
|
|
24983
24983
|
async (t) => {
|
|
24984
|
-
var
|
|
24984
|
+
var u, d, p, h, g;
|
|
24985
24985
|
const e = t.req.valid("form"), n = EE(t.req.header("Authorization")), r = { ...e, ...n };
|
|
24986
24986
|
if (!r.client_id)
|
|
24987
24987
|
throw new E(400, { message: "client_id is required" });
|
|
@@ -25023,52 +25023,54 @@ const SE = new be().openapi(
|
|
|
25023
25023
|
}
|
|
25024
25024
|
const s = new Headers();
|
|
25025
25025
|
if (i.session_id) {
|
|
25026
|
-
const
|
|
25026
|
+
const b = wa(
|
|
25027
25027
|
i.client.tenant.id,
|
|
25028
25028
|
i.session_id,
|
|
25029
25029
|
t.var.host || ""
|
|
25030
25030
|
);
|
|
25031
|
-
s.set("Set-Cookie",
|
|
25031
|
+
s.set("Set-Cookie", b);
|
|
25032
25032
|
}
|
|
25033
|
+
let a = [];
|
|
25033
25034
|
if (i.authParams.audience)
|
|
25034
25035
|
try {
|
|
25035
|
-
let
|
|
25036
|
+
let b;
|
|
25036
25037
|
if (e.grant_type === En.ClientCredential)
|
|
25037
|
-
|
|
25038
|
+
b = await va(t, {
|
|
25038
25039
|
grantType: En.ClientCredential,
|
|
25039
25040
|
tenantId: i.client.tenant.id,
|
|
25040
25041
|
clientId: i.client.client_id,
|
|
25041
25042
|
audience: i.authParams.audience,
|
|
25042
|
-
requestedScopes: ((
|
|
25043
|
-
organizationId: (
|
|
25043
|
+
requestedScopes: ((u = i.authParams.scope) == null ? void 0 : u.split(" ")) || [],
|
|
25044
|
+
organizationId: (d = i.organization) == null ? void 0 : d.id
|
|
25044
25045
|
});
|
|
25045
25046
|
else {
|
|
25046
|
-
if (!((
|
|
25047
|
+
if (!((p = i.user) != null && p.user_id))
|
|
25047
25048
|
throw new Rs(400, {
|
|
25048
25049
|
error: "invalid_request",
|
|
25049
25050
|
error_description: "User ID is required for user-based grants"
|
|
25050
25051
|
});
|
|
25051
|
-
|
|
25052
|
+
b = await va(t, {
|
|
25052
25053
|
grantType: e.grant_type,
|
|
25053
25054
|
tenantId: i.client.tenant.id,
|
|
25054
25055
|
userId: i.user.user_id,
|
|
25055
25056
|
clientId: i.client.client_id,
|
|
25056
25057
|
audience: i.authParams.audience,
|
|
25057
|
-
requestedScopes: ((
|
|
25058
|
-
organizationId: (
|
|
25058
|
+
requestedScopes: ((h = i.authParams.scope) == null ? void 0 : h.split(" ")) || [],
|
|
25059
|
+
organizationId: (g = i.organization) == null ? void 0 : g.id
|
|
25059
25060
|
});
|
|
25060
25061
|
}
|
|
25061
|
-
i.authParams.scope =
|
|
25062
|
-
} catch (
|
|
25063
|
-
if (
|
|
25064
|
-
throw
|
|
25065
|
-
console.error("Error calculating scopes and permissions:",
|
|
25062
|
+
i.authParams.scope = b.scopes.join(" "), a = b.permissions;
|
|
25063
|
+
} catch (b) {
|
|
25064
|
+
if (b instanceof E)
|
|
25065
|
+
throw b;
|
|
25066
|
+
console.error("Error calculating scopes and permissions:", b);
|
|
25066
25067
|
}
|
|
25067
|
-
const
|
|
25068
|
+
const l = await yc(t, {
|
|
25068
25069
|
...i,
|
|
25069
|
-
grantType: e.grant_type
|
|
25070
|
+
grantType: e.grant_type,
|
|
25071
|
+
permissions: a.length > 0 ? a : void 0
|
|
25070
25072
|
});
|
|
25071
|
-
return t.json(
|
|
25073
|
+
return t.json(l, {
|
|
25072
25074
|
headers: s
|
|
25073
25075
|
});
|
|
25074
25076
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "authhero",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.223.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist"
|
|
6
6
|
],
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"vite": "^5.4.11",
|
|
36
36
|
"vite-plugin-dts": "^4.3.0",
|
|
37
37
|
"vitest": "^2.1.5",
|
|
38
|
-
"@authhero/kysely-adapter": "^10.
|
|
38
|
+
"@authhero/kysely-adapter": "^10.47.0"
|
|
39
39
|
},
|
|
40
40
|
"dependencies": {
|
|
41
41
|
"@peculiar/x509": "^1.12.3",
|