@appconda/nextjs 1.0.114 → 1.0.115

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
@@ -2,7 +2,7 @@
2
2
  "name": "@appconda/nextjs",
3
3
  "homepage": "https://appconda.io/support",
4
4
  "description": "Appconda is an open-source self-hosted backend server that abstract and simplify complex and repetitive development tasks behind a very simple REST API",
5
- "version": "1.0.114",
5
+ "version": "1.0.115",
6
6
  "license": "BSD-3-Clause",
7
7
  "main": "src/index.ts",
8
8
  "types": "src/index.ts",
@@ -3,6 +3,7 @@ import { getServerSession } from "next-auth";
3
3
  import { DEFAULT_SERVER_ERROR_MESSAGE, createSafeActionClient } from "next-safe-action";
4
4
  import { authOptions } from "./authOptions";
5
5
  import { AuthenticationError, AuthorizationError } from "../lib/errors";
6
+ import { getSDKForCurrentUser } from "../getSDKForCurrentUser";
6
7
 
7
8
 
8
9
  export const actionClient = createSafeActionClient({
@@ -27,7 +28,8 @@ export const actionClient = createSafeActionClient({
27
28
 
28
29
 
29
30
  export const authenticatedActionClient = actionClient.use(async ({ next }) => {
30
- const session = await getServerSession(authOptions());
31
+ const options = authOptions();
32
+ const session = options ? await getServerSession(options) : null;
31
33
  //@ts-ignore
32
34
  if (!session?.user) {
33
35
  throw new AuthenticationError("Not authenticated");
@@ -36,8 +38,9 @@ export const authenticatedActionClient = actionClient.use(async ({ next }) => {
36
38
  //@ts-ignore
37
39
  const userId = session.user.id;
38
40
 
39
- //@ts-ignore
40
- const user = await getUser(userId);
41
+ // Get the SDK and use users.get method to fetch the user
42
+ const { users } = await getSDKForCurrentUser();
43
+ const user = await users.get(userId);
41
44
  if (!user) {
42
45
  throw new AuthorizationError("User not found");
43
46
  }
@@ -2,5 +2,6 @@ import { getServerSession } from "next-auth"
2
2
  import { authOptions } from "./authOptions";
3
3
 
4
4
  export const auth = async ()=> {
5
- return await getServerSession(authOptions());
5
+ const options = authOptions();
6
+ return options ? await getServerSession(options) : null;
6
7
  }
@@ -37,7 +37,7 @@ export async function signIn({ userName, password }: { userName: string, passwor
37
37
  }
38
38
 
39
39
  export const authOptions = (() => {
40
- let options = null;
40
+ let options : any= null;
41
41
 
42
42
  return () => {
43
43
  if (options == null) {
package/src/client.ts CHANGED
@@ -291,7 +291,7 @@ class Client {
291
291
  }
292
292
 
293
293
  let start = 0;
294
- let response = null;
294
+ let response: any = null;
295
295
 
296
296
  while (start < file.size) {
297
297
  let end = start + Client.CHUNK_SIZE; // Prepare end for the next chunk
package/src/lib/env.ts CHANGED
@@ -3,7 +3,7 @@ import { z } from "zod";
3
3
 
4
4
 
5
5
  export const getEnv = (() => {
6
- let env = null;
6
+ let env: any = {};
7
7
  return () => {
8
8
  if (env == null) {
9
9
  env = createEnv({
package/src/lib/jwt.ts CHANGED
@@ -69,7 +69,7 @@ export const verifyToken = async (token: string): Promise<JwtPayload> => {
69
69
  }
70
70
 
71
71
  // If no email provided, look up the user
72
- const foundUser = null;/* await prisma.user.findUnique({
72
+ const foundUser: any = null;/* await prisma.user.findUnique({
73
73
  where: { id: decryptedId },
74
74
  }); */
75
75
 
@@ -10,7 +10,7 @@ export const CreateUser = actionClient
10
10
  .schema(CreateUserSchema)
11
11
  .action(async ({ parsedInput }): Promise<User> => {
12
12
  try {
13
- const { userId, email, password, name } = parsedInput;
13
+ const { userId, email, password, name } = parsedInput as any;
14
14
  const { accounts } = await getSDKForCurrentUser();
15
15
  return await accounts.create(userId, email, password, name);
16
16
 
@@ -10,7 +10,7 @@ export const CreateProjectSchema = z.object({
10
10
 
11
11
  export const ListProjectsSchema = z.object({
12
12
  tenantId: z.string()
13
- }).strict();
13
+ });
14
14
 
15
15
  export const CreateTaskListSchema = z.object({
16
16
  id: z.string().optional(),
package/tsconfig.json CHANGED
@@ -19,6 +19,8 @@
19
19
  "traceResolution": false,
20
20
  "experimentalDecorators": true,
21
21
  "emitDecoratorMetadata": true,
22
+ "strictNullChecks": true,
23
+ "exactOptionalPropertyTypes": true,
22
24
  "outDir": "./dist",
23
25
  "paths": {
24
26
  "next-safe-action": ["./node_modules/next-safe-action/index.d.ts"]