better-auth 1.3.13 → 1.3.15
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/adapters/drizzle-adapter/index.d.cts +1 -1
- package/dist/adapters/drizzle-adapter/index.d.mts +1 -1
- package/dist/adapters/drizzle-adapter/index.d.ts +1 -1
- package/dist/adapters/index.d.cts +2 -2
- package/dist/adapters/index.d.mts +2 -2
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/kysely-adapter/index.cjs +1 -1
- package/dist/adapters/kysely-adapter/index.d.cts +1 -1
- package/dist/adapters/kysely-adapter/index.d.mts +1 -1
- package/dist/adapters/kysely-adapter/index.d.ts +1 -1
- package/dist/adapters/kysely-adapter/index.mjs +1 -1
- package/dist/adapters/memory-adapter/index.cjs +1 -1
- package/dist/adapters/memory-adapter/index.d.cts +1 -1
- package/dist/adapters/memory-adapter/index.d.mts +1 -1
- package/dist/adapters/memory-adapter/index.d.ts +1 -1
- package/dist/adapters/memory-adapter/index.mjs +1 -1
- package/dist/adapters/mongodb-adapter/index.d.cts +1 -1
- package/dist/adapters/mongodb-adapter/index.d.mts +1 -1
- package/dist/adapters/mongodb-adapter/index.d.ts +1 -1
- package/dist/adapters/prisma-adapter/index.d.cts +1 -1
- package/dist/adapters/prisma-adapter/index.d.mts +1 -1
- package/dist/adapters/prisma-adapter/index.d.ts +1 -1
- package/dist/adapters/test.d.cts +1 -1
- package/dist/adapters/test.d.mts +1 -1
- package/dist/adapters/test.d.ts +1 -1
- package/dist/api/index.cjs +3 -3
- package/dist/api/index.d.cts +1 -1
- package/dist/api/index.d.mts +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.mjs +5 -5
- package/dist/client/index.cjs +3 -3
- package/dist/client/index.d.cts +3 -3
- package/dist/client/index.d.mts +3 -3
- package/dist/client/index.d.ts +3 -3
- package/dist/client/index.mjs +3 -3
- package/dist/client/plugins/index.d.cts +3 -3
- package/dist/client/plugins/index.d.mts +3 -3
- package/dist/client/plugins/index.d.ts +3 -3
- package/dist/client/react/index.cjs +2 -2
- package/dist/client/react/index.d.cts +3 -3
- package/dist/client/react/index.d.mts +3 -3
- package/dist/client/react/index.d.ts +3 -3
- package/dist/client/react/index.mjs +2 -2
- package/dist/client/solid/index.cjs +2 -2
- package/dist/client/solid/index.d.cts +9 -9
- package/dist/client/solid/index.d.mts +9 -9
- package/dist/client/solid/index.d.ts +9 -9
- package/dist/client/solid/index.mjs +2 -2
- package/dist/client/svelte/index.cjs +2 -2
- package/dist/client/svelte/index.d.cts +3 -3
- package/dist/client/svelte/index.d.mts +3 -3
- package/dist/client/svelte/index.d.ts +3 -3
- package/dist/client/svelte/index.mjs +2 -2
- package/dist/client/vue/index.cjs +2 -2
- package/dist/client/vue/index.d.cts +3 -3
- package/dist/client/vue/index.d.mts +3 -3
- package/dist/client/vue/index.d.ts +3 -3
- package/dist/client/vue/index.mjs +2 -2
- package/dist/cookies/index.cjs +1 -1
- package/dist/cookies/index.d.cts +1 -1
- package/dist/cookies/index.d.mts +1 -1
- package/dist/cookies/index.d.ts +1 -1
- package/dist/cookies/index.mjs +1 -1
- package/dist/db/index.cjs +3 -3
- package/dist/db/index.d.cts +2 -2
- package/dist/db/index.d.mts +2 -2
- package/dist/db/index.d.ts +2 -2
- package/dist/db/index.mjs +3 -3
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +4 -4
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.mjs +7 -7
- package/dist/integrations/next-js.cjs +4 -4
- package/dist/integrations/next-js.d.cts +1 -1
- package/dist/integrations/next-js.d.mts +1 -1
- package/dist/integrations/next-js.d.ts +1 -1
- package/dist/integrations/next-js.mjs +4 -4
- package/dist/integrations/node.d.cts +1 -1
- package/dist/integrations/node.d.mts +1 -1
- package/dist/integrations/node.d.ts +1 -1
- package/dist/integrations/react-start.cjs +4 -4
- package/dist/integrations/react-start.d.cts +1 -1
- package/dist/integrations/react-start.d.mts +1 -1
- package/dist/integrations/react-start.d.ts +1 -1
- package/dist/integrations/react-start.mjs +4 -4
- package/dist/integrations/svelte-kit.cjs +3 -3
- package/dist/integrations/svelte-kit.d.cts +1 -1
- package/dist/integrations/svelte-kit.d.mts +1 -1
- package/dist/integrations/svelte-kit.d.ts +1 -1
- package/dist/integrations/svelte-kit.mjs +3 -3
- package/dist/oauth2/index.cjs +3 -3
- package/dist/oauth2/index.d.cts +2 -2
- package/dist/oauth2/index.d.mts +2 -2
- package/dist/oauth2/index.d.ts +2 -2
- package/dist/oauth2/index.mjs +3 -3
- package/dist/plugins/admin/index.cjs +4 -4
- package/dist/plugins/admin/index.d.cts +16 -1
- package/dist/plugins/admin/index.d.mts +16 -1
- package/dist/plugins/admin/index.d.ts +16 -1
- package/dist/plugins/admin/index.mjs +4 -4
- package/dist/plugins/anonymous/index.cjs +3 -3
- package/dist/plugins/anonymous/index.d.cts +1 -1
- package/dist/plugins/anonymous/index.d.mts +1 -1
- package/dist/plugins/anonymous/index.d.ts +1 -1
- package/dist/plugins/anonymous/index.mjs +3 -3
- package/dist/plugins/bearer/index.cjs +3 -3
- package/dist/plugins/bearer/index.d.cts +1 -1
- package/dist/plugins/bearer/index.d.mts +1 -1
- package/dist/plugins/bearer/index.d.ts +1 -1
- package/dist/plugins/bearer/index.mjs +3 -3
- package/dist/plugins/captcha/index.d.cts +1 -1
- package/dist/plugins/captcha/index.d.mts +1 -1
- package/dist/plugins/captcha/index.d.ts +1 -1
- package/dist/plugins/custom-session/index.cjs +7 -9
- package/dist/plugins/custom-session/index.d.cts +1 -1
- package/dist/plugins/custom-session/index.d.mts +1 -1
- package/dist/plugins/custom-session/index.d.ts +1 -1
- package/dist/plugins/custom-session/index.mjs +7 -9
- package/dist/plugins/device-authorization/index.cjs +18 -50
- package/dist/plugins/device-authorization/index.d.cts +1 -1
- package/dist/plugins/device-authorization/index.d.mts +1 -1
- package/dist/plugins/device-authorization/index.d.ts +1 -1
- package/dist/plugins/device-authorization/index.mjs +18 -50
- package/dist/plugins/email-otp/index.cjs +20 -60
- package/dist/plugins/email-otp/index.d.cts +1 -1
- package/dist/plugins/email-otp/index.d.mts +1 -1
- package/dist/plugins/email-otp/index.d.ts +1 -1
- package/dist/plugins/email-otp/index.mjs +20 -60
- package/dist/plugins/generic-oauth/index.cjs +24 -42
- package/dist/plugins/generic-oauth/index.d.cts +1 -1
- package/dist/plugins/generic-oauth/index.d.mts +1 -1
- package/dist/plugins/generic-oauth/index.d.ts +1 -1
- package/dist/plugins/generic-oauth/index.mjs +24 -42
- package/dist/plugins/haveibeenpwned/index.cjs +3 -3
- package/dist/plugins/haveibeenpwned/index.d.cts +1 -1
- package/dist/plugins/haveibeenpwned/index.d.mts +1 -1
- package/dist/plugins/haveibeenpwned/index.d.ts +1 -1
- package/dist/plugins/haveibeenpwned/index.mjs +3 -3
- package/dist/plugins/index.cjs +10 -9
- package/dist/plugins/index.d.cts +3 -3
- package/dist/plugins/index.d.mts +3 -3
- package/dist/plugins/index.d.ts +3 -3
- package/dist/plugins/index.mjs +12 -11
- package/dist/plugins/jwt/index.cjs +3 -3
- package/dist/plugins/jwt/index.d.cts +1 -1
- package/dist/plugins/jwt/index.d.mts +1 -1
- package/dist/plugins/jwt/index.d.ts +1 -1
- package/dist/plugins/jwt/index.mjs +3 -3
- package/dist/plugins/magic-link/index.cjs +20 -30
- package/dist/plugins/magic-link/index.mjs +20 -30
- package/dist/plugins/multi-session/index.cjs +5 -9
- package/dist/plugins/multi-session/index.d.cts +1 -1
- package/dist/plugins/multi-session/index.d.mts +1 -1
- package/dist/plugins/multi-session/index.d.ts +1 -1
- package/dist/plugins/multi-session/index.mjs +5 -9
- package/dist/plugins/oauth-proxy/index.cjs +8 -10
- package/dist/plugins/oauth-proxy/index.d.cts +2 -1
- package/dist/plugins/oauth-proxy/index.d.mts +2 -1
- package/dist/plugins/oauth-proxy/index.d.ts +2 -1
- package/dist/plugins/oauth-proxy/index.mjs +8 -10
- package/dist/plugins/oidc-provider/index.cjs +4 -4
- package/dist/plugins/oidc-provider/index.d.cts +9 -9
- package/dist/plugins/oidc-provider/index.d.mts +9 -9
- package/dist/plugins/oidc-provider/index.d.ts +9 -9
- package/dist/plugins/oidc-provider/index.mjs +4 -4
- package/dist/plugins/one-tap/index.cjs +6 -6
- package/dist/plugins/one-tap/index.mjs +6 -6
- package/dist/plugins/one-time-token/index.cjs +6 -6
- package/dist/plugins/one-time-token/index.d.cts +1 -1
- package/dist/plugins/one-time-token/index.d.mts +1 -1
- package/dist/plugins/one-time-token/index.d.ts +1 -1
- package/dist/plugins/one-time-token/index.mjs +6 -6
- package/dist/plugins/open-api/index.cjs +3 -3
- package/dist/plugins/open-api/index.d.cts +1 -1
- package/dist/plugins/open-api/index.d.mts +1 -1
- package/dist/plugins/open-api/index.d.ts +1 -1
- package/dist/plugins/open-api/index.mjs +3 -3
- package/dist/plugins/organization/access/index.d.cts +25 -25
- package/dist/plugins/organization/access/index.d.mts +25 -25
- package/dist/plugins/organization/access/index.d.ts +25 -25
- package/dist/plugins/organization/index.cjs +6 -6
- package/dist/plugins/organization/index.d.cts +77 -13
- package/dist/plugins/organization/index.d.mts +77 -13
- package/dist/plugins/organization/index.d.ts +77 -13
- package/dist/plugins/organization/index.mjs +6 -6
- package/dist/plugins/passkey/index.cjs +14 -18
- package/dist/plugins/passkey/index.d.cts +2 -2
- package/dist/plugins/passkey/index.d.mts +2 -2
- package/dist/plugins/passkey/index.d.ts +2 -2
- package/dist/plugins/passkey/index.mjs +14 -18
- package/dist/plugins/phone-number/index.cjs +23 -39
- package/dist/plugins/phone-number/index.d.cts +1 -1
- package/dist/plugins/phone-number/index.d.mts +1 -1
- package/dist/plugins/phone-number/index.d.ts +1 -1
- package/dist/plugins/phone-number/index.mjs +23 -39
- package/dist/plugins/siwe/index.cjs +3 -3
- package/dist/plugins/siwe/index.d.cts +1 -1
- package/dist/plugins/siwe/index.d.mts +1 -1
- package/dist/plugins/siwe/index.d.ts +1 -1
- package/dist/plugins/siwe/index.mjs +3 -3
- package/dist/plugins/sso/index.cjs +61 -87
- package/dist/plugins/sso/index.d.cts +3 -3
- package/dist/plugins/sso/index.d.mts +3 -3
- package/dist/plugins/sso/index.d.ts +3 -3
- package/dist/plugins/sso/index.mjs +61 -87
- package/dist/plugins/two-factor/index.cjs +18 -48
- package/dist/plugins/two-factor/index.d.cts +1 -1
- package/dist/plugins/two-factor/index.d.mts +1 -1
- package/dist/plugins/two-factor/index.d.ts +1 -1
- package/dist/plugins/two-factor/index.mjs +18 -48
- package/dist/plugins/username/index.cjs +31 -16
- package/dist/plugins/username/index.d.cts +3 -3
- package/dist/plugins/username/index.d.mts +3 -3
- package/dist/plugins/username/index.d.ts +3 -3
- package/dist/plugins/username/index.mjs +31 -16
- package/dist/shared/{better-auth.DNMTw_ds.d.ts → better-auth.6RZwqXI-.d.ts} +1 -1
- package/dist/shared/{better-auth.Btbv22jM.mjs → better-auth.7DsuGNVf.mjs} +5 -3
- package/dist/shared/{better-auth.C1AWk7z7.mjs → better-auth.AYS43XM1.mjs} +1 -1
- package/dist/shared/{better-auth.g33XFa_C.mjs → better-auth.B-3-wkBV.mjs} +167 -262
- package/dist/shared/{better-auth.BkcRiga0.cjs → better-auth.B-RhOtHf.cjs} +1 -1
- package/dist/shared/{better-auth.DTgTiHPJ.d.ts → better-auth.B1CNK_q_.d.ts} +1 -1
- package/dist/shared/{better-auth.BnOSz3eR.mjs → better-auth.BBFsjzvB.mjs} +2 -2
- package/dist/shared/{better-auth.Bhva6lEh.cjs → better-auth.BBk8MRta.cjs} +1 -1
- package/dist/shared/{better-auth.BYskLPvJ.d.ts → better-auth.BCHg51sY.d.ts} +1 -1
- package/dist/shared/{better-auth.C1Tqa_El.d.cts → better-auth.BTUgO__s.d.mts} +1 -1
- package/dist/shared/{better-auth.B5O-5tFi.cjs → better-auth.BclXpYOz.cjs} +5 -3
- package/dist/shared/{better-auth.DHi8l3iG.d.mts → better-auth.BeDYIF5-.d.mts} +1 -1
- package/dist/shared/{better-auth.yovXNUaS.d.cts → better-auth.BeOpqAwl.d.cts} +1 -1
- package/dist/shared/{better-auth.Brg-UO7k.d.ts → better-auth.BsnsCAjn.d.ts} +7 -7
- package/dist/shared/{better-auth.fV_ra52g.mjs → better-auth.C3bLnul-.mjs} +1 -1
- package/dist/shared/{better-auth.D6pGomIg.cjs → better-auth.C5s1d_o-.cjs} +75 -150
- package/dist/shared/{better-auth.C29_dxUJ.cjs → better-auth.CL5zQvRZ.cjs} +167 -262
- package/dist/shared/{better-auth.C0-0BnjK.d.mts → better-auth.CkCyjQ6r.d.mts} +1 -1
- package/dist/shared/{better-auth.CBY7cUGy.mjs → better-auth.Co88PbP3.mjs} +6 -10
- package/dist/shared/{better-auth.BPua9lvR.mjs → better-auth.D-4EtUes.mjs} +75 -150
- package/dist/shared/{better-auth.DXGtScCP.cjs → better-auth.D2444EHu.cjs} +2 -2
- package/dist/shared/{better-auth.DTyvXiMc.cjs → better-auth.DCOXb_2e.cjs} +48 -84
- package/dist/shared/{better-auth.DRukcsOo.d.mts → better-auth.DDOCnCqi.d.cts} +1 -1
- package/dist/shared/{better-auth.B1ufdjSo.mjs → better-auth.DFfA4Mzz.mjs} +5 -5
- package/dist/shared/{better-auth.CXM9s0dx.cjs → better-auth.DIfV2UBl.cjs} +1 -1
- package/dist/shared/{better-auth.spSlDaxD.cjs → better-auth.DP5SyJ_2.cjs} +68 -117
- package/dist/shared/{better-auth.DhsGZ30Q.cjs → better-auth.DUNU0obG.cjs} +1 -1
- package/dist/shared/{better-auth.Ddv1-cj-.mjs → better-auth.DUTxy-hg.mjs} +2 -2
- package/dist/shared/{better-auth.D07k8aB_.d.cts → better-auth.DY9WffSn.d.cts} +1 -1
- package/dist/shared/{better-auth.Bo_XNm3Z.mjs → better-auth.Df_5rmaV.mjs} +24 -48
- package/dist/shared/{better-auth.DL8idXrv.mjs → better-auth.DhQzyejE.mjs} +1 -1
- package/dist/shared/{better-auth.Gu1qAjVj.d.mts → better-auth.DhRmxPro.d.mts} +7 -7
- package/dist/shared/{better-auth.Bb_sp3q4.cjs → better-auth.DnBI2Nus.cjs} +5 -5
- package/dist/shared/{better-auth.Dsq5BCiY.mjs → better-auth.DteMRrRX.mjs} +68 -117
- package/dist/shared/{better-auth.demy6Fla.cjs → better-auth.DxN8-4Pz.cjs} +24 -48
- package/dist/shared/{better-auth.2jEckJ7k.cjs → better-auth.SS_wBML-.cjs} +2 -2
- package/dist/shared/{better-auth.3naUdTMW.mjs → better-auth.T3Ux10v9.mjs} +1 -1
- package/dist/shared/{better-auth.B1kKIM0o.d.cts → better-auth.U9CXSJA_.d.cts} +7 -7
- package/dist/shared/{better-auth.CvVm_hFg.cjs → better-auth.iE8wqp5_.cjs} +1 -1
- package/dist/shared/{better-auth.ffWeg50w.mjs → better-auth.msGOU0m9.mjs} +1 -1
- package/dist/shared/{better-auth.Cj28z0kQ.mjs → better-auth.vd9ibIsl.mjs} +48 -84
- package/dist/shared/{better-auth.CAcHGnwq.cjs → better-auth.wBgaxGEw.cjs} +6 -10
- package/dist/social-providers/index.cjs +3 -3
- package/dist/social-providers/index.mjs +3 -3
- package/dist/test-utils/index.cjs +11 -11
- package/dist/test-utils/index.d.cts +12 -12
- package/dist/test-utils/index.d.mts +12 -12
- package/dist/test-utils/index.d.ts +12 -12
- package/dist/test-utils/index.mjs +11 -11
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.mts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +2 -6
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
const betterCall = require('better-call');
|
|
4
4
|
const z = require('zod');
|
|
5
|
-
const session = require('./better-auth.
|
|
6
|
-
require('./better-auth.
|
|
5
|
+
const session = require('./better-auth.wBgaxGEw.cjs');
|
|
6
|
+
require('./better-auth.C5s1d_o-.cjs');
|
|
7
7
|
require('./better-auth.B6fIklBU.cjs');
|
|
8
8
|
require('@better-auth/utils/base64');
|
|
9
9
|
require('@better-auth/utils/hmac');
|
|
@@ -12,9 +12,9 @@ require('@better-auth/utils/binary');
|
|
|
12
12
|
require('./better-auth.C0qxpMUS.cjs');
|
|
13
13
|
const date = require('./better-auth.C1hdVENX.cjs');
|
|
14
14
|
const index = require('./better-auth.ANpbi45u.cjs');
|
|
15
|
-
const parser = require('./better-auth.
|
|
16
|
-
const schema = require('./better-auth.
|
|
17
|
-
const cookies_index = require('./better-auth.
|
|
15
|
+
const parser = require('./better-auth.DUNU0obG.cjs');
|
|
16
|
+
const schema = require('./better-auth.SS_wBML-.cjs');
|
|
17
|
+
const cookies_index = require('./better-auth.DIfV2UBl.cjs');
|
|
18
18
|
const plugins_organization_access_index = require('../plugins/organization/access/index.cjs');
|
|
19
19
|
const permission = require('./better-auth.CqRypKVa.cjs');
|
|
20
20
|
const toZod = require('./better-auth.CsC4FSOQ.cjs');
|
|
@@ -84,7 +84,8 @@ const getOrgAdapter = (context, options) => {
|
|
|
84
84
|
data: {
|
|
85
85
|
...data.organization,
|
|
86
86
|
metadata: data.organization.metadata ? JSON.stringify(data.organization.metadata) : void 0
|
|
87
|
-
}
|
|
87
|
+
},
|
|
88
|
+
forceAllowId: true
|
|
88
89
|
});
|
|
89
90
|
return {
|
|
90
91
|
...organization,
|
|
@@ -353,12 +354,13 @@ const getOrgAdapter = (context, options) => {
|
|
|
353
354
|
});
|
|
354
355
|
return organizationId;
|
|
355
356
|
},
|
|
356
|
-
setActiveOrganization: async (sessionToken, organizationId) => {
|
|
357
|
+
setActiveOrganization: async (sessionToken, organizationId, ctx) => {
|
|
357
358
|
const session = await context.internalAdapter.updateSession(
|
|
358
359
|
sessionToken,
|
|
359
360
|
{
|
|
360
361
|
activeOrganizationId: organizationId
|
|
361
|
-
}
|
|
362
|
+
},
|
|
363
|
+
ctx
|
|
362
364
|
);
|
|
363
365
|
return session;
|
|
364
366
|
},
|
|
@@ -604,12 +606,13 @@ const getOrgAdapter = (context, options) => {
|
|
|
604
606
|
});
|
|
605
607
|
return invitation;
|
|
606
608
|
},
|
|
607
|
-
setActiveTeam: async (sessionToken, teamId) => {
|
|
609
|
+
setActiveTeam: async (sessionToken, teamId, ctx) => {
|
|
608
610
|
const session = await context.internalAdapter.updateSession(
|
|
609
611
|
sessionToken,
|
|
610
612
|
{
|
|
611
613
|
activeTeamId: teamId
|
|
612
|
-
}
|
|
614
|
+
},
|
|
615
|
+
ctx
|
|
613
616
|
);
|
|
614
617
|
return session;
|
|
615
618
|
},
|
|
@@ -938,34 +941,20 @@ const createInvitation = (option) => {
|
|
|
938
941
|
isClientSide: true
|
|
939
942
|
});
|
|
940
943
|
const baseSchema = z__namespace.object({
|
|
941
|
-
email: z__namespace.string().
|
|
942
|
-
description: "The email address of the user to invite"
|
|
943
|
-
}),
|
|
944
|
+
email: z__namespace.string().describe("The email address of the user to invite"),
|
|
944
945
|
role: z__namespace.union([
|
|
945
|
-
z__namespace.string().
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
description: 'The role(s) to assign to the user. It can be `admin`, `member`, or `guest`. Eg: "member"'
|
|
955
|
-
}),
|
|
956
|
-
organizationId: z__namespace.string().meta({
|
|
957
|
-
description: "The organization ID to invite the user to"
|
|
958
|
-
}).optional(),
|
|
959
|
-
resend: z__namespace.boolean().meta({
|
|
960
|
-
description: "Resend the invitation email, if the user is already invited. Eg: true"
|
|
961
|
-
}).optional(),
|
|
946
|
+
z__namespace.string().describe("The role to assign to the user"),
|
|
947
|
+
z__namespace.array(z__namespace.string().describe("The roles to assign to the user"))
|
|
948
|
+
]).describe(
|
|
949
|
+
"The role(s) to assign to the user. It can be `admin`, `member`, or `guest`. Eg: "
|
|
950
|
+
),
|
|
951
|
+
organizationId: z__namespace.string().describe("The organization ID to invite the user to").optional(),
|
|
952
|
+
resend: z__namespace.boolean().describe(
|
|
953
|
+
"Resend the invitation email, if the user is already invited. Eg: true"
|
|
954
|
+
).optional(),
|
|
962
955
|
teamId: z__namespace.union([
|
|
963
|
-
z__namespace.string().
|
|
964
|
-
|
|
965
|
-
}).optional(),
|
|
966
|
-
z__namespace.array(z__namespace.string()).meta({
|
|
967
|
-
description: "The team IDs to invite the user to"
|
|
968
|
-
}).optional()
|
|
956
|
+
z__namespace.string().describe("The team ID to invite the user to").optional(),
|
|
957
|
+
z__namespace.array(z__namespace.string()).describe("The team IDs to invite the user to").optional()
|
|
969
958
|
])
|
|
970
959
|
});
|
|
971
960
|
return session.createAuthEndpoint(
|
|
@@ -1250,9 +1239,7 @@ const acceptInvitation = (options) => session.createAuthEndpoint(
|
|
|
1250
1239
|
{
|
|
1251
1240
|
method: "POST",
|
|
1252
1241
|
body: z__namespace.object({
|
|
1253
|
-
invitationId: z__namespace.string().
|
|
1254
|
-
description: "The ID of the invitation to accept"
|
|
1255
|
-
})
|
|
1242
|
+
invitationId: z__namespace.string().describe("The ID of the invitation to accept")
|
|
1256
1243
|
}),
|
|
1257
1244
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware],
|
|
1258
1245
|
metadata: {
|
|
@@ -1361,7 +1348,8 @@ const acceptInvitation = (options) => session.createAuthEndpoint(
|
|
|
1361
1348
|
const teamId = teamIds[0];
|
|
1362
1349
|
const updatedSession = await adapter.setActiveTeam(
|
|
1363
1350
|
session.session.token,
|
|
1364
|
-
teamId
|
|
1351
|
+
teamId,
|
|
1352
|
+
ctx
|
|
1365
1353
|
);
|
|
1366
1354
|
await cookies_index.setSessionCookie(ctx, {
|
|
1367
1355
|
session: updatedSession,
|
|
@@ -1377,7 +1365,8 @@ const acceptInvitation = (options) => session.createAuthEndpoint(
|
|
|
1377
1365
|
});
|
|
1378
1366
|
await adapter.setActiveOrganization(
|
|
1379
1367
|
session.session.token,
|
|
1380
|
-
invitation.organizationId
|
|
1368
|
+
invitation.organizationId,
|
|
1369
|
+
ctx
|
|
1381
1370
|
);
|
|
1382
1371
|
if (!acceptedI) {
|
|
1383
1372
|
return ctx.json(null, {
|
|
@@ -1406,9 +1395,7 @@ const rejectInvitation = (options) => session.createAuthEndpoint(
|
|
|
1406
1395
|
{
|
|
1407
1396
|
method: "POST",
|
|
1408
1397
|
body: z__namespace.object({
|
|
1409
|
-
invitationId: z__namespace.string().
|
|
1410
|
-
description: "The ID of the invitation to reject"
|
|
1411
|
-
})
|
|
1398
|
+
invitationId: z__namespace.string().describe("The ID of the invitation to reject")
|
|
1412
1399
|
}),
|
|
1413
1400
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware],
|
|
1414
1401
|
metadata: {
|
|
@@ -1495,9 +1482,7 @@ const cancelInvitation = (options) => session.createAuthEndpoint(
|
|
|
1495
1482
|
{
|
|
1496
1483
|
method: "POST",
|
|
1497
1484
|
body: z__namespace.object({
|
|
1498
|
-
invitationId: z__namespace.string().
|
|
1499
|
-
description: "The ID of the invitation to cancel"
|
|
1500
|
-
})
|
|
1485
|
+
invitationId: z__namespace.string().describe("The ID of the invitation to cancel")
|
|
1501
1486
|
}),
|
|
1502
1487
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware],
|
|
1503
1488
|
openapi: {
|
|
@@ -1593,9 +1578,7 @@ const getInvitation = (options) => session.createAuthEndpoint(
|
|
|
1593
1578
|
use: [schema.orgMiddleware],
|
|
1594
1579
|
requireHeaders: true,
|
|
1595
1580
|
query: z__namespace.object({
|
|
1596
|
-
id: z__namespace.string().
|
|
1597
|
-
description: "The ID of the invitation to get"
|
|
1598
|
-
})
|
|
1581
|
+
id: z__namespace.string().describe("The ID of the invitation to get")
|
|
1599
1582
|
}),
|
|
1600
1583
|
metadata: {
|
|
1601
1584
|
openapi: {
|
|
@@ -1709,9 +1692,7 @@ const listInvitations = (options) => session.createAuthEndpoint(
|
|
|
1709
1692
|
method: "GET",
|
|
1710
1693
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware],
|
|
1711
1694
|
query: z__namespace.object({
|
|
1712
|
-
organizationId: z__namespace.string().
|
|
1713
|
-
description: "The ID of the organization to list invitations for"
|
|
1714
|
-
}).optional()
|
|
1695
|
+
organizationId: z__namespace.string().describe("The ID of the organization to list invitations for").optional()
|
|
1715
1696
|
}).optional()
|
|
1716
1697
|
},
|
|
1717
1698
|
async (ctx) => {
|
|
@@ -1749,9 +1730,9 @@ const listUserInvitations = (options) => session.createAuthEndpoint(
|
|
|
1749
1730
|
method: "GET",
|
|
1750
1731
|
use: [schema.orgMiddleware],
|
|
1751
1732
|
query: z__namespace.object({
|
|
1752
|
-
email: z__namespace.string().
|
|
1753
|
-
|
|
1754
|
-
|
|
1733
|
+
email: z__namespace.string().describe(
|
|
1734
|
+
"The email of the user to list invitations for. This only works for server side API calls."
|
|
1735
|
+
).optional()
|
|
1755
1736
|
}).optional()
|
|
1756
1737
|
},
|
|
1757
1738
|
async (ctx) => {
|
|
@@ -1779,18 +1760,14 @@ const addMember = (option) => {
|
|
|
1779
1760
|
isClientSide: true
|
|
1780
1761
|
});
|
|
1781
1762
|
const baseSchema = z__namespace.object({
|
|
1782
|
-
userId: z__namespace.coerce.string().
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
role: z__namespace.union([z__namespace.string(), z__namespace.array(z__namespace.string())]).
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
|
|
1790
|
-
}).optional(),
|
|
1791
|
-
teamId: z__namespace.string().meta({
|
|
1792
|
-
description: 'An optional team ID to add the member to. Eg: "team-id"'
|
|
1793
|
-
}).optional()
|
|
1763
|
+
userId: z__namespace.coerce.string().describe(
|
|
1764
|
+
"The user Id which represents the user to be added as a member"
|
|
1765
|
+
),
|
|
1766
|
+
role: z__namespace.union([z__namespace.string(), z__namespace.array(z__namespace.string())]).describe("The role(s) to assign to the new member"),
|
|
1767
|
+
organizationId: z__namespace.string().describe(
|
|
1768
|
+
"An optional organization ID to pass. If not provided, will default to the user"
|
|
1769
|
+
).optional(),
|
|
1770
|
+
teamId: z__namespace.string().describe("An optional team ID to add the member to").optional()
|
|
1794
1771
|
});
|
|
1795
1772
|
return session.createAuthEndpoint(
|
|
1796
1773
|
"/organization/add-member",
|
|
@@ -1922,15 +1899,13 @@ const removeMember = (options) => session.createAuthEndpoint(
|
|
|
1922
1899
|
{
|
|
1923
1900
|
method: "POST",
|
|
1924
1901
|
body: z__namespace.object({
|
|
1925
|
-
memberIdOrEmail: z__namespace.string().
|
|
1926
|
-
description: "The ID or email of the member to remove"
|
|
1927
|
-
}),
|
|
1902
|
+
memberIdOrEmail: z__namespace.string().describe("The ID or email of the member to remove"),
|
|
1928
1903
|
/**
|
|
1929
1904
|
* If not provided, the active organization will be used
|
|
1930
1905
|
*/
|
|
1931
|
-
organizationId: z__namespace.string().
|
|
1932
|
-
|
|
1933
|
-
|
|
1906
|
+
organizationId: z__namespace.string().describe(
|
|
1907
|
+
"The ID of the organization to remove the member from. If not provided, the active organization will be used"
|
|
1908
|
+
).optional()
|
|
1934
1909
|
}),
|
|
1935
1910
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware],
|
|
1936
1911
|
metadata: {
|
|
@@ -2075,7 +2050,7 @@ const removeMember = (options) => session.createAuthEndpoint(
|
|
|
2075
2050
|
}
|
|
2076
2051
|
await adapter.deleteMember(toBeRemovedMember.id);
|
|
2077
2052
|
if (session.user.id === toBeRemovedMember.userId && session.session.activeOrganizationId === toBeRemovedMember.organizationId) {
|
|
2078
|
-
await adapter.setActiveOrganization(session.session.token, null);
|
|
2053
|
+
await adapter.setActiveOrganization(session.session.token, null, ctx);
|
|
2079
2054
|
}
|
|
2080
2055
|
if (options?.organizationHooks?.afterRemoveMember) {
|
|
2081
2056
|
await options?.organizationHooks.afterRemoveMember({
|
|
@@ -2094,15 +2069,13 @@ const updateMemberRole = (option) => session.createAuthEndpoint(
|
|
|
2094
2069
|
{
|
|
2095
2070
|
method: "POST",
|
|
2096
2071
|
body: z__namespace.object({
|
|
2097
|
-
role: z__namespace.union([z__namespace.string(), z__namespace.array(z__namespace.string())]).
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
memberId: z__namespace.string().
|
|
2101
|
-
|
|
2102
|
-
|
|
2103
|
-
|
|
2104
|
-
description: 'An optional organization ID which the member is a part of to apply the role update. If not provided, you must provide session headers to get the active organization. Eg: "organization-id"'
|
|
2105
|
-
}).optional()
|
|
2072
|
+
role: z__namespace.union([z__namespace.string(), z__namespace.array(z__namespace.string())]).describe(
|
|
2073
|
+
"The new role to be applied. This can be a string or array of strings representing the roles. Eg: ["
|
|
2074
|
+
),
|
|
2075
|
+
memberId: z__namespace.string().describe("The member id to apply the role update to"),
|
|
2076
|
+
organizationId: z__namespace.string().describe(
|
|
2077
|
+
"An optional organization ID which the member is a part of to apply the role update. If not provided, you must provide session headers to get the active organization"
|
|
2078
|
+
).optional()
|
|
2106
2079
|
}),
|
|
2107
2080
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware],
|
|
2108
2081
|
metadata: {
|
|
@@ -2367,9 +2340,7 @@ const leaveOrganization = (options) => session.createAuthEndpoint(
|
|
|
2367
2340
|
{
|
|
2368
2341
|
method: "POST",
|
|
2369
2342
|
body: z__namespace.object({
|
|
2370
|
-
organizationId: z__namespace.string().
|
|
2371
|
-
description: 'The organization Id for the member to leave. Eg: "organization-id"'
|
|
2372
|
-
})
|
|
2343
|
+
organizationId: z__namespace.string().describe("The organization Id for the member to leave")
|
|
2373
2344
|
}),
|
|
2374
2345
|
requireHeaders: true,
|
|
2375
2346
|
use: [session.sessionMiddleware, schema.orgMiddleware]
|
|
@@ -2409,7 +2380,7 @@ const leaveOrganization = (options) => session.createAuthEndpoint(
|
|
|
2409
2380
|
}
|
|
2410
2381
|
await adapter.deleteMember(member.id);
|
|
2411
2382
|
if (session.session.activeOrganizationId === ctx.body.organizationId) {
|
|
2412
|
-
await adapter.setActiveOrganization(session.session.token, null);
|
|
2383
|
+
await adapter.setActiveOrganization(session.session.token, null, ctx);
|
|
2413
2384
|
}
|
|
2414
2385
|
return ctx.json(member);
|
|
2415
2386
|
}
|
|
@@ -2419,30 +2390,16 @@ const listMembers = (options) => session.createAuthEndpoint(
|
|
|
2419
2390
|
{
|
|
2420
2391
|
method: "GET",
|
|
2421
2392
|
query: z__namespace.object({
|
|
2422
|
-
limit: z__namespace.string().
|
|
2423
|
-
|
|
2424
|
-
|
|
2425
|
-
|
|
2426
|
-
|
|
2427
|
-
|
|
2428
|
-
|
|
2429
|
-
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
description: "The direction to sort by"
|
|
2433
|
-
}).optional(),
|
|
2434
|
-
filterField: z__namespace.string().meta({
|
|
2435
|
-
description: "The field to filter by"
|
|
2436
|
-
}).optional(),
|
|
2437
|
-
filterValue: z__namespace.string().meta({
|
|
2438
|
-
description: "The value to filter by"
|
|
2439
|
-
}).or(z__namespace.number()).or(z__namespace.boolean()).optional(),
|
|
2440
|
-
filterOperator: z__namespace.enum(["eq", "ne", "lt", "lte", "gt", "gte", "contains"]).meta({
|
|
2441
|
-
description: "The operator to use for the filter"
|
|
2442
|
-
}).optional(),
|
|
2443
|
-
organizationId: z__namespace.string().meta({
|
|
2444
|
-
description: `The organization ID to list members for. If not provided, will default to the user's active organization. Eg: "organization-id"`
|
|
2445
|
-
}).optional()
|
|
2393
|
+
limit: z__namespace.string().describe("The number of users to return").or(z__namespace.number()).optional(),
|
|
2394
|
+
offset: z__namespace.string().describe("The offset to start from").or(z__namespace.number()).optional(),
|
|
2395
|
+
sortBy: z__namespace.string().describe("The field to sort by").optional(),
|
|
2396
|
+
sortDirection: z__namespace.enum(["asc", "desc"]).describe("The direction to sort by").optional(),
|
|
2397
|
+
filterField: z__namespace.string().describe("The field to filter by").optional(),
|
|
2398
|
+
filterValue: z__namespace.string().describe("The value to filter by").or(z__namespace.number()).or(z__namespace.boolean()).optional(),
|
|
2399
|
+
filterOperator: z__namespace.enum(["eq", "ne", "lt", "lte", "gt", "gte", "contains"]).describe("The operator to use for the filter").optional(),
|
|
2400
|
+
organizationId: z__namespace.string().describe(
|
|
2401
|
+
"The organization ID to list members for. If not provided, will default to the user"
|
|
2402
|
+
).optional()
|
|
2446
2403
|
}).optional(),
|
|
2447
2404
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware]
|
|
2448
2405
|
},
|
|
@@ -2487,12 +2444,12 @@ const getActiveMemberRole = (options) => session.createAuthEndpoint(
|
|
|
2487
2444
|
{
|
|
2488
2445
|
method: "GET",
|
|
2489
2446
|
query: z__namespace.object({
|
|
2490
|
-
userId: z__namespace.string().
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
organizationId: z__namespace.string().
|
|
2494
|
-
|
|
2495
|
-
|
|
2447
|
+
userId: z__namespace.string().describe(
|
|
2448
|
+
"The user ID to get the role for. If not provided, will default to the current user"
|
|
2449
|
+
).optional(),
|
|
2450
|
+
organizationId: z__namespace.string().describe(
|
|
2451
|
+
"The organization ID to list members for. If not provided, will default to the user"
|
|
2452
|
+
).optional()
|
|
2496
2453
|
}).optional(),
|
|
2497
2454
|
use: [schema.orgMiddleware, schema.orgSessionMiddleware]
|
|
2498
2455
|
},
|
|
@@ -2527,24 +2484,16 @@ const createOrganization = (options) => {
|
|
|
2527
2484
|
isClientSide: true
|
|
2528
2485
|
});
|
|
2529
2486
|
const baseSchema = z__namespace.object({
|
|
2530
|
-
name: z__namespace.string().
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
description: "The logo of the organization"
|
|
2541
|
-
}).optional(),
|
|
2542
|
-
metadata: z__namespace.record(z__namespace.string(), z__namespace.any()).meta({
|
|
2543
|
-
description: "The metadata of the organization"
|
|
2544
|
-
}).optional(),
|
|
2545
|
-
keepCurrentActiveOrganization: z__namespace.boolean().meta({
|
|
2546
|
-
description: "Whether to keep the current active organization active after creating a new one. Eg: true"
|
|
2547
|
-
}).optional()
|
|
2487
|
+
name: z__namespace.string().describe("The name of the organization"),
|
|
2488
|
+
slug: z__namespace.string().describe("The slug of the organization"),
|
|
2489
|
+
userId: z__namespace.coerce.string().describe(
|
|
2490
|
+
"The user id of the organization creator. If not provided, the current user will be used. Should only be used by admins or when called by the server. server-only. Eg: "
|
|
2491
|
+
).optional(),
|
|
2492
|
+
logo: z__namespace.string().describe("The logo of the organization").optional(),
|
|
2493
|
+
metadata: z__namespace.record(z__namespace.string(), z__namespace.any()).describe("The metadata of the organization").optional(),
|
|
2494
|
+
keepCurrentActiveOrganization: z__namespace.boolean().describe(
|
|
2495
|
+
"Whether to keep the current active organization active after creating a new one. Eg: true"
|
|
2496
|
+
).optional()
|
|
2548
2497
|
});
|
|
2549
2498
|
return session.createAuthEndpoint(
|
|
2550
2499
|
"/organization/create",
|
|
@@ -2749,13 +2698,15 @@ const createOrganization = (options) => {
|
|
|
2749
2698
|
if (ctx.context.session && !ctx.body.keepCurrentActiveOrganization) {
|
|
2750
2699
|
await adapter.setActiveOrganization(
|
|
2751
2700
|
ctx.context.session.session.token,
|
|
2752
|
-
organization.id
|
|
2701
|
+
organization.id,
|
|
2702
|
+
ctx
|
|
2753
2703
|
);
|
|
2754
2704
|
}
|
|
2755
2705
|
if (teamMember && ctx.context.session && !ctx.body.keepCurrentActiveOrganization) {
|
|
2756
2706
|
await adapter.setActiveTeam(
|
|
2757
2707
|
ctx.context.session.session.token,
|
|
2758
|
-
teamMember.teamId
|
|
2708
|
+
teamMember.teamId,
|
|
2709
|
+
ctx
|
|
2759
2710
|
);
|
|
2760
2711
|
}
|
|
2761
2712
|
return ctx.json({
|
|
@@ -2771,9 +2722,7 @@ const checkOrganizationSlug = (options) => session.createAuthEndpoint(
|
|
|
2771
2722
|
{
|
|
2772
2723
|
method: "POST",
|
|
2773
2724
|
body: z__namespace.object({
|
|
2774
|
-
slug: z__namespace.string().
|
|
2775
|
-
description: 'The organization slug to check. Eg: "my-org"'
|
|
2776
|
-
})
|
|
2725
|
+
slug: z__namespace.string().describe("The organization slug to check. Eg: ")
|
|
2777
2726
|
}),
|
|
2778
2727
|
use: [session.requestOnlySessionMiddleware, schema.orgMiddleware]
|
|
2779
2728
|
},
|
|
@@ -2802,22 +2751,12 @@ const updateOrganization = (options) => {
|
|
|
2802
2751
|
body: z__namespace.object({
|
|
2803
2752
|
data: z__namespace.object({
|
|
2804
2753
|
...additionalFieldsSchema.shape,
|
|
2805
|
-
name: z__namespace.string().
|
|
2806
|
-
|
|
2807
|
-
|
|
2808
|
-
|
|
2809
|
-
description: "The slug of the organization"
|
|
2810
|
-
}).optional(),
|
|
2811
|
-
logo: z__namespace.string().meta({
|
|
2812
|
-
description: "The logo of the organization"
|
|
2813
|
-
}).optional(),
|
|
2814
|
-
metadata: z__namespace.record(z__namespace.string(), z__namespace.any()).meta({
|
|
2815
|
-
description: "The metadata of the organization"
|
|
2816
|
-
}).optional()
|
|
2754
|
+
name: z__namespace.string().describe("The name of the organization").optional(),
|
|
2755
|
+
slug: z__namespace.string().describe("The slug of the organization").optional(),
|
|
2756
|
+
logo: z__namespace.string().describe("The logo of the organization").optional(),
|
|
2757
|
+
metadata: z__namespace.record(z__namespace.string(), z__namespace.any()).describe("The metadata of the organization").optional()
|
|
2817
2758
|
}).partial(),
|
|
2818
|
-
organizationId: z__namespace.string().
|
|
2819
|
-
description: 'The organization ID. Eg: "org-id"'
|
|
2820
|
-
}).optional()
|
|
2759
|
+
organizationId: z__namespace.string().describe("The organization ID. Eg: ").optional()
|
|
2821
2760
|
}),
|
|
2822
2761
|
requireHeaders: true,
|
|
2823
2762
|
use: [schema.orgMiddleware],
|
|
@@ -2917,9 +2856,7 @@ const deleteOrganization = (options) => {
|
|
|
2917
2856
|
{
|
|
2918
2857
|
method: "POST",
|
|
2919
2858
|
body: z__namespace.object({
|
|
2920
|
-
organizationId: z__namespace.string().
|
|
2921
|
-
description: "The organization id to delete"
|
|
2922
|
-
})
|
|
2859
|
+
organizationId: z__namespace.string().describe("The organization id to delete")
|
|
2923
2860
|
}),
|
|
2924
2861
|
requireHeaders: true,
|
|
2925
2862
|
use: [schema.orgMiddleware],
|
|
@@ -2994,7 +2931,7 @@ const deleteOrganization = (options) => {
|
|
|
2994
2931
|
});
|
|
2995
2932
|
}
|
|
2996
2933
|
if (organizationId === session.session.activeOrganizationId) {
|
|
2997
|
-
await adapter.setActiveOrganization(session.session.token, null);
|
|
2934
|
+
await adapter.setActiveOrganization(session.session.token, null, ctx);
|
|
2998
2935
|
}
|
|
2999
2936
|
const org = await adapter.findOrganizationById(organizationId);
|
|
3000
2937
|
if (!org) {
|
|
@@ -3023,15 +2960,11 @@ const getFullOrganization = (options) => session.createAuthEndpoint(
|
|
|
3023
2960
|
method: "GET",
|
|
3024
2961
|
query: z__namespace.optional(
|
|
3025
2962
|
z__namespace.object({
|
|
3026
|
-
organizationId: z__namespace.string().
|
|
3027
|
-
|
|
3028
|
-
|
|
3029
|
-
|
|
3030
|
-
|
|
3031
|
-
}).optional(),
|
|
3032
|
-
membersLimit: z__namespace.number().or(z__namespace.string().transform((val) => parseInt(val))).meta({
|
|
3033
|
-
description: "The limit of members to get. By default, it uses the membershipLimit option which defaults to 100."
|
|
3034
|
-
}).optional()
|
|
2963
|
+
organizationId: z__namespace.string().describe("The organization id to get").optional(),
|
|
2964
|
+
organizationSlug: z__namespace.string().describe("The organization slug to get").optional(),
|
|
2965
|
+
membersLimit: z__namespace.number().or(z__namespace.string().transform((val) => parseInt(val))).describe(
|
|
2966
|
+
"The limit of members to get. By default, it uses the membershipLimit option which defaults to 100."
|
|
2967
|
+
).optional()
|
|
3035
2968
|
})
|
|
3036
2969
|
),
|
|
3037
2970
|
requireHeaders: true,
|
|
@@ -3082,7 +3015,7 @@ const getFullOrganization = (options) => session.createAuthEndpoint(
|
|
|
3082
3015
|
organizationId: organization.id
|
|
3083
3016
|
});
|
|
3084
3017
|
if (!isMember) {
|
|
3085
|
-
await adapter.setActiveOrganization(session.session.token, null);
|
|
3018
|
+
await adapter.setActiveOrganization(session.session.token, null, ctx);
|
|
3086
3019
|
throw new betterCall.APIError("FORBIDDEN", {
|
|
3087
3020
|
message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
|
|
3088
3021
|
});
|
|
@@ -3096,12 +3029,12 @@ const setActiveOrganization = (options) => {
|
|
|
3096
3029
|
{
|
|
3097
3030
|
method: "POST",
|
|
3098
3031
|
body: z__namespace.object({
|
|
3099
|
-
organizationId: z__namespace.string().
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
organizationSlug: z__namespace.string().
|
|
3103
|
-
|
|
3104
|
-
|
|
3032
|
+
organizationId: z__namespace.string().describe(
|
|
3033
|
+
"The organization id to set as active. It can be null to unset the active organization. Eg: "
|
|
3034
|
+
).nullable().optional(),
|
|
3035
|
+
organizationSlug: z__namespace.string().describe(
|
|
3036
|
+
"The organization slug to set as active. It can be null to unset the active organization if organizationId is not provided. Eg: "
|
|
3037
|
+
).optional()
|
|
3105
3038
|
}),
|
|
3106
3039
|
use: [schema.orgSessionMiddleware, schema.orgMiddleware],
|
|
3107
3040
|
metadata: {
|
|
@@ -3136,7 +3069,8 @@ const setActiveOrganization = (options) => {
|
|
|
3136
3069
|
}
|
|
3137
3070
|
const updatedSession2 = await adapter.setActiveOrganization(
|
|
3138
3071
|
session.session.token,
|
|
3139
|
-
null
|
|
3072
|
+
null,
|
|
3073
|
+
ctx
|
|
3140
3074
|
);
|
|
3141
3075
|
await cookies_index.setSessionCookie(ctx, {
|
|
3142
3076
|
session: updatedSession2,
|
|
@@ -3170,7 +3104,7 @@ const setActiveOrganization = (options) => {
|
|
|
3170
3104
|
organizationId
|
|
3171
3105
|
});
|
|
3172
3106
|
if (!isMember) {
|
|
3173
|
-
await adapter.setActiveOrganization(session.session.token, null);
|
|
3107
|
+
await adapter.setActiveOrganization(session.session.token, null, ctx);
|
|
3174
3108
|
throw new betterCall.APIError("FORBIDDEN", {
|
|
3175
3109
|
message: ORGANIZATION_ERROR_CODES.USER_IS_NOT_A_MEMBER_OF_THE_ORGANIZATION
|
|
3176
3110
|
});
|
|
@@ -3183,7 +3117,8 @@ const setActiveOrganization = (options) => {
|
|
|
3183
3117
|
}
|
|
3184
3118
|
const updatedSession = await adapter.setActiveOrganization(
|
|
3185
3119
|
session.session.token,
|
|
3186
|
-
organization.id
|
|
3120
|
+
organization.id,
|
|
3121
|
+
ctx
|
|
3187
3122
|
);
|
|
3188
3123
|
await cookies_index.setSessionCookie(ctx, {
|
|
3189
3124
|
session: updatedSession,
|
|
@@ -3234,12 +3169,10 @@ const createTeam = (options) => {
|
|
|
3234
3169
|
isClientSide: true
|
|
3235
3170
|
});
|
|
3236
3171
|
const baseSchema = z__namespace.object({
|
|
3237
|
-
name: z__namespace.string().
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
description: 'The organization ID which the team will be created in. Defaults to the active organization. Eg: "organization-id"'
|
|
3242
|
-
}).optional()
|
|
3172
|
+
name: z__namespace.string().describe("The name of the team. Eg: "),
|
|
3173
|
+
organizationId: z__namespace.string().describe(
|
|
3174
|
+
"The organization ID which the team will be created in. Defaults to the active organization. Eg: "
|
|
3175
|
+
).optional()
|
|
3243
3176
|
});
|
|
3244
3177
|
return session.createAuthEndpoint(
|
|
3245
3178
|
"/organization/create-team",
|
|
@@ -3403,12 +3336,10 @@ const removeTeam = (options) => session.createAuthEndpoint(
|
|
|
3403
3336
|
{
|
|
3404
3337
|
method: "POST",
|
|
3405
3338
|
body: z__namespace.object({
|
|
3406
|
-
teamId: z__namespace.string().
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
description: `The organization ID which the team falls under. If not provided, it will default to the user's active organization. Eg: "organization-id"`
|
|
3411
|
-
}).optional()
|
|
3339
|
+
teamId: z__namespace.string().describe(`The team ID of the team to remove. Eg: "team-id"`),
|
|
3340
|
+
organizationId: z__namespace.string().describe(
|
|
3341
|
+
`The organization ID which the team falls under. If not provided, it will default to the user's active organization. Eg: "organization-id"`
|
|
3342
|
+
).optional()
|
|
3412
3343
|
}),
|
|
3413
3344
|
use: [schema.orgMiddleware],
|
|
3414
3345
|
metadata: {
|
|
@@ -3530,9 +3461,7 @@ const updateTeam = (options) => {
|
|
|
3530
3461
|
{
|
|
3531
3462
|
method: "POST",
|
|
3532
3463
|
body: z__namespace.object({
|
|
3533
|
-
teamId: z__namespace.string().
|
|
3534
|
-
description: `The ID of the team to be updated. Eg: "team-id"`
|
|
3535
|
-
}),
|
|
3464
|
+
teamId: z__namespace.string().describe(`The ID of the team to be updated. Eg: "team-id"`),
|
|
3536
3465
|
data: z__namespace.object({
|
|
3537
3466
|
...schema.teamSchema.shape,
|
|
3538
3467
|
...additionalFieldsSchema.shape
|
|
@@ -3688,9 +3617,9 @@ const listOrganizationTeams = (options) => session.createAuthEndpoint(
|
|
|
3688
3617
|
method: "GET",
|
|
3689
3618
|
query: z__namespace.optional(
|
|
3690
3619
|
z__namespace.object({
|
|
3691
|
-
organizationId: z__namespace.string().
|
|
3692
|
-
|
|
3693
|
-
|
|
3620
|
+
organizationId: z__namespace.string().describe(
|
|
3621
|
+
`The organization ID which the teams are under to list. Defaults to the users active organization. Eg: "organziation-id"`
|
|
3622
|
+
).optional()
|
|
3694
3623
|
})
|
|
3695
3624
|
),
|
|
3696
3625
|
requireHeaders: true,
|
|
@@ -3775,9 +3704,9 @@ const setActiveTeam = (options) => session.createAuthEndpoint(
|
|
|
3775
3704
|
{
|
|
3776
3705
|
method: "POST",
|
|
3777
3706
|
body: z__namespace.object({
|
|
3778
|
-
teamId: z__namespace.string().
|
|
3779
|
-
|
|
3780
|
-
|
|
3707
|
+
teamId: z__namespace.string().describe(
|
|
3708
|
+
"The team id to set as active. It can be null to unset the active team"
|
|
3709
|
+
).nullable().optional()
|
|
3781
3710
|
}),
|
|
3782
3711
|
use: [schema.orgSessionMiddleware, schema.orgMiddleware],
|
|
3783
3712
|
metadata: {
|
|
@@ -3810,7 +3739,8 @@ const setActiveTeam = (options) => session.createAuthEndpoint(
|
|
|
3810
3739
|
}
|
|
3811
3740
|
const updatedSession2 = await adapter.setActiveTeam(
|
|
3812
3741
|
session.session.token,
|
|
3813
|
-
null
|
|
3742
|
+
null,
|
|
3743
|
+
ctx
|
|
3814
3744
|
);
|
|
3815
3745
|
await cookies_index.setSessionCookie(ctx, {
|
|
3816
3746
|
session: updatedSession2,
|
|
@@ -3846,7 +3776,8 @@ const setActiveTeam = (options) => session.createAuthEndpoint(
|
|
|
3846
3776
|
}
|
|
3847
3777
|
const updatedSession = await adapter.setActiveTeam(
|
|
3848
3778
|
session.session.token,
|
|
3849
|
-
team.id
|
|
3779
|
+
team.id,
|
|
3780
|
+
ctx
|
|
3850
3781
|
);
|
|
3851
3782
|
await cookies_index.setSessionCookie(ctx, {
|
|
3852
3783
|
session: updatedSession,
|
|
@@ -3899,9 +3830,9 @@ const listTeamMembers = (options) => session.createAuthEndpoint(
|
|
|
3899
3830
|
method: "GET",
|
|
3900
3831
|
query: z__namespace.optional(
|
|
3901
3832
|
z__namespace.object({
|
|
3902
|
-
teamId: z__namespace.string().optional().
|
|
3903
|
-
|
|
3904
|
-
|
|
3833
|
+
teamId: z__namespace.string().optional().describe(
|
|
3834
|
+
"The team whose members we should return. If this is not provided the members of the current active team get returned."
|
|
3835
|
+
)
|
|
3905
3836
|
})
|
|
3906
3837
|
),
|
|
3907
3838
|
metadata: {
|
|
@@ -3977,12 +3908,10 @@ const addTeamMember = (options) => session.createAuthEndpoint(
|
|
|
3977
3908
|
{
|
|
3978
3909
|
method: "POST",
|
|
3979
3910
|
body: z__namespace.object({
|
|
3980
|
-
teamId: z__namespace.string().
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
|
|
3984
|
-
description: "The user Id which represents the user to be added as a member."
|
|
3985
|
-
})
|
|
3911
|
+
teamId: z__namespace.string().describe("The team the user should be a member of."),
|
|
3912
|
+
userId: z__namespace.coerce.string().describe(
|
|
3913
|
+
"The user Id which represents the user to be added as a member."
|
|
3914
|
+
)
|
|
3986
3915
|
}),
|
|
3987
3916
|
metadata: {
|
|
3988
3917
|
openapi: {
|
|
@@ -4122,12 +4051,8 @@ const removeTeamMember = (options) => session.createAuthEndpoint(
|
|
|
4122
4051
|
{
|
|
4123
4052
|
method: "POST",
|
|
4124
4053
|
body: z__namespace.object({
|
|
4125
|
-
teamId: z__namespace.string().
|
|
4126
|
-
|
|
4127
|
-
}),
|
|
4128
|
-
userId: z__namespace.coerce.string().meta({
|
|
4129
|
-
description: "The user which should be removed from the team."
|
|
4130
|
-
})
|
|
4054
|
+
teamId: z__namespace.string().describe("The team the user should be removed from."),
|
|
4055
|
+
userId: z__namespace.coerce.string().describe("The user which should be removed from the team.")
|
|
4131
4056
|
}),
|
|
4132
4057
|
metadata: {
|
|
4133
4058
|
openapi: {
|
|
@@ -4282,15 +4207,11 @@ const createOrgRole = (options) => {
|
|
|
4282
4207
|
{
|
|
4283
4208
|
method: "POST",
|
|
4284
4209
|
body: z__namespace.object({
|
|
4285
|
-
organizationId: z__namespace.string().optional().
|
|
4286
|
-
|
|
4287
|
-
|
|
4288
|
-
role: z__namespace.string().
|
|
4289
|
-
|
|
4290
|
-
}),
|
|
4291
|
-
permission: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).meta({
|
|
4292
|
-
description: "The permission to assign to the role"
|
|
4293
|
-
}),
|
|
4210
|
+
organizationId: z__namespace.string().optional().describe(
|
|
4211
|
+
"The id of the organization to create the role in. If not provided, the user"
|
|
4212
|
+
),
|
|
4213
|
+
role: z__namespace.string().describe("The name of the role to create"),
|
|
4214
|
+
permission: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).describe("The permission to assign to the role"),
|
|
4294
4215
|
additionalFields: z__namespace.object({ ...additionalFieldsSchema.shape }).optional()
|
|
4295
4216
|
}),
|
|
4296
4217
|
metadata: {
|
|
@@ -4457,20 +4378,16 @@ const deleteOrgRole = (options) => {
|
|
|
4457
4378
|
{
|
|
4458
4379
|
method: "POST",
|
|
4459
4380
|
body: z__namespace.object({
|
|
4460
|
-
organizationId: z__namespace.string().optional().
|
|
4461
|
-
|
|
4462
|
-
|
|
4381
|
+
organizationId: z__namespace.string().optional().describe(
|
|
4382
|
+
"The id of the organization to create the role in. If not provided, the user"
|
|
4383
|
+
)
|
|
4463
4384
|
}).and(
|
|
4464
4385
|
z__namespace.union([
|
|
4465
4386
|
z__namespace.object({
|
|
4466
|
-
roleName: z__namespace.string().
|
|
4467
|
-
description: "The name of the role to delete"
|
|
4468
|
-
})
|
|
4387
|
+
roleName: z__namespace.string().describe("The name of the role to delete")
|
|
4469
4388
|
}),
|
|
4470
4389
|
z__namespace.object({
|
|
4471
|
-
roleId: z__namespace.string().
|
|
4472
|
-
description: "The id of the role to delete"
|
|
4473
|
-
})
|
|
4390
|
+
roleId: z__namespace.string().describe("The id of the role to delete")
|
|
4474
4391
|
})
|
|
4475
4392
|
])
|
|
4476
4393
|
),
|
|
@@ -4632,9 +4549,9 @@ const listOrgRoles = (options) => {
|
|
|
4632
4549
|
method: "GET",
|
|
4633
4550
|
use: [schema.orgSessionMiddleware],
|
|
4634
4551
|
query: z__namespace.object({
|
|
4635
|
-
organizationId: z__namespace.string().optional().
|
|
4636
|
-
|
|
4637
|
-
|
|
4552
|
+
organizationId: z__namespace.string().optional().describe(
|
|
4553
|
+
"The id of the organization to list roles for. If not provided, the user"
|
|
4554
|
+
)
|
|
4638
4555
|
}).optional()
|
|
4639
4556
|
},
|
|
4640
4557
|
async (ctx) => {
|
|
@@ -4728,20 +4645,16 @@ const getOrgRole = (options) => {
|
|
|
4728
4645
|
method: "GET",
|
|
4729
4646
|
use: [schema.orgSessionMiddleware],
|
|
4730
4647
|
query: z__namespace.object({
|
|
4731
|
-
organizationId: z__namespace.string().optional().
|
|
4732
|
-
|
|
4733
|
-
|
|
4648
|
+
organizationId: z__namespace.string().optional().describe(
|
|
4649
|
+
"The id of the organization to read a role for. If not provided, the user"
|
|
4650
|
+
)
|
|
4734
4651
|
}).and(
|
|
4735
4652
|
z__namespace.union([
|
|
4736
4653
|
z__namespace.object({
|
|
4737
|
-
roleName: z__namespace.string().
|
|
4738
|
-
description: "The name of the role to read"
|
|
4739
|
-
})
|
|
4654
|
+
roleName: z__namespace.string().describe("The name of the role to read")
|
|
4740
4655
|
}),
|
|
4741
4656
|
z__namespace.object({
|
|
4742
|
-
roleId: z__namespace.string().
|
|
4743
|
-
description: "The id of the role to read"
|
|
4744
|
-
})
|
|
4657
|
+
roleId: z__namespace.string().describe("The id of the role to read")
|
|
4745
4658
|
})
|
|
4746
4659
|
])
|
|
4747
4660
|
).optional(),
|
|
@@ -4867,29 +4780,21 @@ const updateOrgRole = (options) => {
|
|
|
4867
4780
|
{
|
|
4868
4781
|
method: "POST",
|
|
4869
4782
|
body: z__namespace.object({
|
|
4870
|
-
organizationId: z__namespace.string().optional().
|
|
4871
|
-
|
|
4872
|
-
|
|
4783
|
+
organizationId: z__namespace.string().optional().describe(
|
|
4784
|
+
"The id of the organization to update the role in. If not provided, the user"
|
|
4785
|
+
),
|
|
4873
4786
|
data: z__namespace.object({
|
|
4874
|
-
permission: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).optional().
|
|
4875
|
-
|
|
4876
|
-
}),
|
|
4877
|
-
roleName: z__namespace.string().optional().meta({
|
|
4878
|
-
description: "The name of the role to update"
|
|
4879
|
-
}),
|
|
4787
|
+
permission: z__namespace.record(z__namespace.string(), z__namespace.array(z__namespace.string())).optional().describe("The permission to update the role with"),
|
|
4788
|
+
roleName: z__namespace.string().optional().describe("The name of the role to update"),
|
|
4880
4789
|
...additionalFieldsSchema.shape
|
|
4881
4790
|
})
|
|
4882
4791
|
}).and(
|
|
4883
4792
|
z__namespace.union([
|
|
4884
4793
|
z__namespace.object({
|
|
4885
|
-
roleName: z__namespace.string().
|
|
4886
|
-
description: "The name of the role to update"
|
|
4887
|
-
})
|
|
4794
|
+
roleName: z__namespace.string().describe("The name of the role to update")
|
|
4888
4795
|
}),
|
|
4889
4796
|
z__namespace.object({
|
|
4890
|
-
roleId: z__namespace.string().
|
|
4891
|
-
description: "The id of the role to update"
|
|
4892
|
-
})
|
|
4797
|
+
roleId: z__namespace.string().describe("The id of the role to update")
|
|
4893
4798
|
})
|
|
4894
4799
|
])
|
|
4895
4800
|
),
|