@rpcbase/auth 0.74.0 → 0.76.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/{handler-DDGoeMLQ.js → handler-BIDgXiiq.js} +2 -2
- package/dist/{handler-SQkbSqqd.js → handler-Bmcd9YmA.js} +2 -2
- package/dist/{handler-DT8jbCdX.js → handler-BmlInQbc.js} +3 -3
- package/dist/{handler-ekuyY0v_.js → handler-Bs__eoKT.js} +2 -2
- package/dist/{handler-Bq9NwTuS.js → handler-DFSQG3-U.js} +2 -2
- package/dist/routes.js +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import crypto from "crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { models } from "@rpcbase/db";
|
|
3
3
|
import { sendEmail } from "@rpcbase/server";
|
|
4
4
|
import { o as object, s as string, b as boolean } from "./schemas-BfVe_QYZ.js";
|
|
5
5
|
const Route = "/api/rb/auth/resend-otp";
|
|
@@ -11,7 +11,7 @@ object({
|
|
|
11
11
|
error: string().optional()
|
|
12
12
|
});
|
|
13
13
|
const resendOtp = async (payload, ctx) => {
|
|
14
|
-
const User = await
|
|
14
|
+
const User = await models.getGlobal("RBUser", ctx);
|
|
15
15
|
const parsed = requestSchema.safeParse(payload);
|
|
16
16
|
if (!parsed.success) {
|
|
17
17
|
ctx.res.status(400);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { models } from "@rpcbase/db";
|
|
2
2
|
import { r as restrictSessionMiddleware } from "./middleware-BiMXO6Dq.js";
|
|
3
3
|
import { o as object, s as string, a as array } from "./schemas-BfVe_QYZ.js";
|
|
4
4
|
const Route = "/api/rb/auth/me";
|
|
@@ -25,7 +25,7 @@ const me = async (_payload, ctx) => {
|
|
|
25
25
|
error: "not_authenticated"
|
|
26
26
|
};
|
|
27
27
|
}
|
|
28
|
-
const User = await
|
|
28
|
+
const User = await models.getGlobal("RBUser", ctx);
|
|
29
29
|
const user = await User.findById(sessionUser.id);
|
|
30
30
|
if (!user) {
|
|
31
31
|
ctx.res.status(404);
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import crypto from "crypto";
|
|
2
|
-
import {
|
|
2
|
+
import { models } from "@rpcbase/db";
|
|
3
3
|
import { hashPasswordForStorage, sendEmail } from "@rpcbase/server";
|
|
4
4
|
import { R as Route, r as requestSchema } from "./index-FbCE80yc.js";
|
|
5
5
|
const signUp = async (payload, ctx) => {
|
|
6
|
-
const User = await
|
|
7
|
-
const Tenant = await
|
|
6
|
+
const User = await models.getGlobal("RBUser", ctx);
|
|
7
|
+
const Tenant = await models.getGlobal("RBTenant", ctx);
|
|
8
8
|
const parsed = requestSchema.safeParse(payload);
|
|
9
9
|
if (!parsed.success) {
|
|
10
10
|
ctx.res.status(400);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { models } from "@rpcbase/db";
|
|
2
2
|
import { o as object, b as boolean, s as string } from "./schemas-BfVe_QYZ.js";
|
|
3
3
|
const Route = "/api/rb/auth/verify-otp";
|
|
4
4
|
const requestSchema = object({
|
|
@@ -13,7 +13,7 @@ object({
|
|
|
13
13
|
tenantId: string().optional()
|
|
14
14
|
});
|
|
15
15
|
const verifyOtp = async (payload, ctx) => {
|
|
16
|
-
const User = await
|
|
16
|
+
const User = await models.getGlobal("RBUser", ctx);
|
|
17
17
|
const parsed = requestSchema.safeParse(payload);
|
|
18
18
|
if (!parsed.success) {
|
|
19
19
|
ctx.res.status(400);
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { models } from "@rpcbase/db";
|
|
2
2
|
import { verifyPasswordFromStorage } from "@rpcbase/server";
|
|
3
3
|
import { R as Route, r as requestSchema } from "./index-V5AZ3kmZ.js";
|
|
4
4
|
const signIn = async (payload, ctx) => {
|
|
5
|
-
const User = await
|
|
5
|
+
const User = await models.getGlobal("RBUser", ctx);
|
|
6
6
|
const parsed = requestSchema.safeParse(payload);
|
|
7
7
|
if (!parsed.success) {
|
|
8
8
|
ctx.res.status(400);
|
package/dist/routes.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const routes = Object.entries({
|
|
2
|
-
.../* @__PURE__ */ Object.assign({ "./api/me/handler.ts": () => import("./handler-
|
|
2
|
+
.../* @__PURE__ */ Object.assign({ "./api/me/handler.ts": () => import("./handler-Bmcd9YmA.js"), "./api/resend-otp/handler.ts": () => import("./handler-BIDgXiiq.js"), "./api/sign-in/handler.ts": () => import("./handler-DFSQG3-U.js"), "./api/sign-out/handler.ts": () => import("./handler-BEAVSu5T.js"), "./api/sign-up/handler.ts": () => import("./handler-BmlInQbc.js"), "./api/verify-otp/handler.ts": () => import("./handler-Bs__eoKT.js") })
|
|
3
3
|
}).reduce((acc, [path, mod]) => {
|
|
4
4
|
acc[path.replace("./api/", "@rpcbase/auth/api/")] = mod;
|
|
5
5
|
return acc;
|