rhythia-api 68.0.0 → 70.0.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.
@@ -27,7 +27,7 @@ export async function POST(res: Response): Promise<NextResponse> {
27
27
  });
28
28
  }
29
29
 
30
- async function handler(
30
+ export async function handler(
31
31
  data: (typeof Schema)["input"]["_type"]
32
32
  ): Promise<NextResponse<(typeof Schema)["output"]["_type"]>> {
33
33
  const user = (await supabase.auth.getUser(data.session)).data.user!;
package/api/getProfile.ts CHANGED
@@ -1,4 +1,3 @@
1
- import { NOT_FOUND } from "http-status";
2
1
  import { NextResponse } from "next/server";
3
2
  import z from "zod";
4
3
  import { protectedApi, validUser } from "../utils/requestUtils";
@@ -36,7 +35,7 @@ export async function POST(res: Response): Promise<NextResponse> {
36
35
  });
37
36
  }
38
37
 
39
- async function handler(
38
+ export async function handler(
40
39
  data: (typeof Schema)["input"]["_type"]
41
40
  ): Promise<NextResponse<(typeof Schema)["output"]["_type"]>> {
42
41
  let { data: profiles, error } = await supabase
@@ -51,7 +50,7 @@ async function handler(
51
50
  {
52
51
  error: "User not found",
53
52
  },
54
- { status: NOT_FOUND }
53
+ { status: 404 }
55
54
  );
56
55
  }
57
56
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rhythia-api",
3
- "version": "68.0.0",
3
+ "version": "70.0.0",
4
4
  "main": "index.ts",
5
5
  "scripts": {
6
6
  "update": "bun ./scripts/update.ts",
@@ -11,9 +11,6 @@
11
11
  "pipeline:deploy-testing": "tsx ./scripts/build.ts"
12
12
  },
13
13
  "license": "MIT",
14
- "devDependencies": {
15
- "next": "^14.2.5"
16
- },
17
14
  "dependencies": {
18
15
  "@netlify/zip-it-and-ship-it": "^9.37.9",
19
16
  "@supabase/supabase-js": "^2.45.1",
@@ -26,9 +23,9 @@
26
23
  "bufferutil": "^4.0.8",
27
24
  "bun": "^1.1.22",
28
25
  "esbuild": "^0.23.0",
29
- "http-status": "^1.7.4",
30
26
  "isomorphic-git": "^1.27.1",
31
27
  "lodash": "^4.17.21",
28
+ "next": "^14.2.5",
32
29
  "simple-git": "^3.25.0",
33
30
  "supabase": "^1.190.0",
34
31
  "tsx": "^4.17.0",
@@ -1,4 +1,3 @@
1
- import status, { INTERNAL_SERVER_ERROR, UNAUTHORIZED } from "http-status";
2
1
  import { NextResponse } from "next/server";
3
2
  import { supabase } from "./supabase";
4
3
 
@@ -19,10 +18,7 @@ export async function protectedApi({
19
18
  const toParse = await response.json();
20
19
  data = schema.input.parse(toParse);
21
20
  } catch (error) {
22
- return NextResponse.json(
23
- { error: error.toString() },
24
- { status: status.BAD_REQUEST }
25
- );
21
+ return NextResponse.json({ error: error.toString() }, { status: 400 });
26
22
  }
27
23
 
28
24
  const authorizationReponse = await authorization(data);
@@ -39,7 +35,7 @@ export async function validUser(data) {
39
35
  {
40
36
  error: "Session is missing",
41
37
  },
42
- { status: INTERNAL_SERVER_ERROR }
38
+ { status: 501 }
43
39
  );
44
40
  }
45
41
 
@@ -49,7 +45,7 @@ export async function validUser(data) {
49
45
  {
50
46
  error: "Invalid user session",
51
47
  },
52
- { status: UNAUTHORIZED }
48
+ { status: 400 }
53
49
  );
54
50
  }
55
51
  }