rhythia-api 69.0.0 → 71.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.
- package/api/getProfile.ts +1 -2
- package/handleApi.ts +0 -3
- package/package.json +2 -5
- package/utils/requestUtils.ts +3 -7
- package/vercel.json +13 -0
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";
|
|
@@ -51,7 +50,7 @@ export async function handler(
|
|
|
51
50
|
{
|
|
52
51
|
error: "User not found",
|
|
53
52
|
},
|
|
54
|
-
{ status:
|
|
53
|
+
{ status: 404 }
|
|
55
54
|
);
|
|
56
55
|
}
|
|
57
56
|
|
package/handleApi.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "rhythia-api",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "71.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",
|
package/utils/requestUtils.ts
CHANGED
|
@@ -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:
|
|
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:
|
|
48
|
+
{ status: 400 }
|
|
53
49
|
);
|
|
54
50
|
}
|
|
55
51
|
}
|
package/vercel.json
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
{
|
|
2
|
+
"headers": [
|
|
3
|
+
{
|
|
4
|
+
"source": "/api/(.*)",
|
|
5
|
+
"headers": [
|
|
6
|
+
{ "key": "Access-Control-Allow-Credentials", "value": "true" },
|
|
7
|
+
{ "key": "Access-Control-Allow-Origin", "value": "*" },
|
|
8
|
+
{ "key": "Access-Control-Allow-Methods", "value": "GET,OPTIONS,PATCH,DELETE,POST,PUT" },
|
|
9
|
+
{ "key": "Access-Control-Allow-Headers", "value": "X-CSRF-Token, X-Requested-With, Accept, Accept-Version, Content-Length, Content-MD5, Content-Type, Date, X-Api-Version" }
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
]
|
|
13
|
+
}
|