create-sprint 0.0.70 → 0.0.74

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.
@@ -1,13 +1,19 @@
1
1
  export function getInternalAuthMiddleware(language) {
2
2
  if (language === "typescript") {
3
- return `import { defineMiddleware, SprintRequest, SprintResponse, NextFunction } from "sprint-es";
3
+ return `import { z } from "sprint-es/schemas";
4
+ import { defineMiddleware, SprintRequest, SprintResponse, NextFunction } from "sprint-es";
4
5
 
5
6
  export default defineMiddleware({
6
7
  name: "adminAuth",
7
8
  priority: 10,
8
9
  include: "/admin/**",
10
+ schema: {
11
+ sprint: {
12
+ authorization: z.sprint().authorization()
13
+ }
14
+ },
9
15
  handler: (req: SprintRequest, res: SprintResponse, next: NextFunction) => {
10
- const auth = req.sprint.getAuthorization();
16
+ const auth = req.sprint.authorization;
11
17
  if (!auth) return res.status(401).json({ error: "No authorization header" });
12
18
 
13
19
  const token = auth.replace("Bearer ", "");
@@ -19,14 +25,20 @@ export default defineMiddleware({
19
25
  });
20
26
  `;
21
27
  }
22
- return `import { defineMiddleware } from "sprint-es";
28
+ return `import { z } from "sprint-es/schemas";
29
+ import { defineMiddleware } from "sprint-es";
23
30
 
24
31
  export default defineMiddleware({
25
32
  name: "adminAuth",
26
33
  priority: 10,
27
34
  include: "/admin/**",
35
+ schema: {
36
+ sprint: {
37
+ authorization: z.sprint().authorization()
38
+ }
39
+ },
28
40
  handler: (req, res, next) => {
29
- const auth = req.sprint.getAuthorization();
41
+ const auth = req.sprint.authorization;
30
42
  if (!auth) return res.status(401).json({ error: "No authorization header" });
31
43
 
32
44
  const token = auth.replace("Bearer ", "");
@@ -10,7 +10,7 @@ export function generateJWTKeys() {
10
10
  ;
11
11
  export function getTypeScriptPackageJson(name, telemetry, swagger) {
12
12
  const deps = {
13
- "sprint-es": "^0.0.56"
13
+ "sprint-es": "^0.0.73"
14
14
  };
15
15
  const devDeps = {
16
16
  "@types/node": "^22.0.0",
@@ -23,6 +23,8 @@ export function getTypeScriptPackageJson(name, telemetry, swagger) {
23
23
  deps["axios"] = "^1.6.0";
24
24
  if (swagger)
25
25
  deps["swagger-ui-express"] = "^5.0.0";
26
+ if (swagger)
27
+ devDeps["@types/swagger-ui-express"] = "^4.1.8";
26
28
  return {
27
29
  name: name === "." ? "sprint-app" : name,
28
30
  version: "0.0.1",
@@ -41,7 +43,7 @@ export function getTypeScriptPackageJson(name, telemetry, swagger) {
41
43
  ;
42
44
  export function getJavaScriptPackageJson(name, telemetry, swagger) {
43
45
  const deps = {
44
- "sprint-es": "^0.0.56"
46
+ "sprint-es": "^0.0.73"
45
47
  };
46
48
  if (telemetry === "sentry" || telemetry === "glitchtip")
47
49
  deps["@sentry/node"] = "^8.0.0";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-sprint",
3
- "version": "0.0.70",
3
+ "version": "0.0.74",
4
4
  "description": "Create a new Sprint API project",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,13 +1,19 @@
1
1
  export function getInternalAuthMiddleware(language: string) {
2
2
  if (language === "typescript") {
3
- return `import { defineMiddleware, SprintRequest, SprintResponse, NextFunction } from "sprint-es";
3
+ return `import { z } from "sprint-es/schemas";
4
+ import { defineMiddleware, SprintRequest, SprintResponse, NextFunction } from "sprint-es";
4
5
 
5
6
  export default defineMiddleware({
6
7
  name: "adminAuth",
7
8
  priority: 10,
8
9
  include: "/admin/**",
10
+ schema: {
11
+ sprint: {
12
+ authorization: z.sprint().authorization()
13
+ }
14
+ },
9
15
  handler: (req: SprintRequest, res: SprintResponse, next: NextFunction) => {
10
- const auth = req.sprint.getAuthorization();
16
+ const auth = req.sprint.authorization;
11
17
  if (!auth) return res.status(401).json({ error: "No authorization header" });
12
18
 
13
19
  const token = auth.replace("Bearer ", "");
@@ -19,14 +25,20 @@ export default defineMiddleware({
19
25
  });
20
26
  `;
21
27
  }
22
- return `import { defineMiddleware } from "sprint-es";
28
+ return `import { z } from "sprint-es/schemas";
29
+ import { defineMiddleware } from "sprint-es";
23
30
 
24
31
  export default defineMiddleware({
25
32
  name: "adminAuth",
26
33
  priority: 10,
27
34
  include: "/admin/**",
35
+ schema: {
36
+ sprint: {
37
+ authorization: z.sprint().authorization()
38
+ }
39
+ },
28
40
  handler: (req, res, next) => {
29
- const auth = req.sprint.getAuthorization();
41
+ const auth = req.sprint.authorization;
30
42
  if (!auth) return res.status(401).json({ error: "No authorization header" });
31
43
 
32
44
  const token = auth.replace("Bearer ", "");
@@ -16,7 +16,7 @@ export function generateJWTKeys(): JWTKeys {
16
16
 
17
17
  export function getTypeScriptPackageJson(name: string, telemetry: string, swagger: boolean) {
18
18
  const deps: Record<string, string> = {
19
- "sprint-es": "^0.0.56"
19
+ "sprint-es": "^0.0.73"
20
20
  };
21
21
 
22
22
  const devDeps: Record<string, string> = {
@@ -29,6 +29,7 @@ export function getTypeScriptPackageJson(name: string, telemetry: string, swagge
29
29
  else if (telemetry === "discord") deps["axios"] = "^1.6.0";
30
30
 
31
31
  if (swagger) deps["swagger-ui-express"] = "^5.0.0";
32
+ if (swagger) devDeps["@types/swagger-ui-express"] = "^4.1.8";
32
33
 
33
34
  return {
34
35
  name: name === "." ? "sprint-app" : name,
@@ -48,7 +49,7 @@ export function getTypeScriptPackageJson(name: string, telemetry: string, swagge
48
49
 
49
50
  export function getJavaScriptPackageJson(name: string, telemetry: string, swagger: boolean) {
50
51
  const deps: Record<string, string> = {
51
- "sprint-es": "^0.0.56"
52
+ "sprint-es": "^0.0.73"
52
53
  };
53
54
 
54
55
  if (telemetry === "sentry" || telemetry === "glitchtip") deps["@sentry/node"] = "^8.0.0";