create-m5kdev 0.6.0 → 0.7.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/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type createAuthContext,
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import {
|
|
2
|
+
type createAuthContext,
|
|
3
|
+
verifyAdminProcedureContext,
|
|
4
|
+
verifyProtectedProcedureContext,
|
|
5
|
+
} from "@m5kdev/backend/utils/trpc";
|
|
5
6
|
import { transformer } from "@m5kdev/commons/utils/trpc";
|
|
6
7
|
import { initTRPC } from "@trpc/server";
|
|
7
8
|
|
|
@@ -9,19 +10,22 @@ type Context = Awaited<ReturnType<ReturnType<typeof createAuthContext>>>;
|
|
|
9
10
|
|
|
10
11
|
const t = initTRPC.context<Context>().create({ transformer });
|
|
11
12
|
|
|
12
|
-
export const publicProcedure = t.procedure;
|
|
13
|
-
|
|
14
|
-
export const procedure = t.procedure.use(({ ctx, next }) => {
|
|
15
|
-
verifyProtectedProcedureContext(ctx);
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
export const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
13
|
+
export const publicProcedure = t.procedure;
|
|
14
|
+
|
|
15
|
+
export const procedure = t.procedure.use(({ ctx, next }) => {
|
|
16
|
+
return next({ ctx: verifyProtectedProcedureContext(ctx) });
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
export const adminProcedure = t.procedure.use(({ ctx, next }) => {
|
|
20
|
+
return next({ ctx: verifyAdminProcedureContext(ctx) });
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
export const router = t.router;
|
|
24
|
+
export const mergeRouters = t.mergeRouters;
|
|
25
|
+
|
|
26
|
+
export const trpcObject = {
|
|
27
|
+
router,
|
|
28
|
+
privateProcedure: procedure,
|
|
29
|
+
adminProcedure,
|
|
30
|
+
publicProcedure,
|
|
31
|
+
};
|