create-arkos 2.0.0-next.18 → 2.0.0-next.19
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 +1 -1
- package/templates/basic/.gitignore.hbs +2 -0
- package/templates/basic/jsconfig.json.hbs +3 -3
- package/templates/basic/package.json.hbs +28 -12
- package/templates/basic/prisma/schema/schema.prisma.hbs +2 -3
- package/templates/basic/prisma.config.ts.hbs +10 -0
- package/templates/basic/src/modules/auth/dtos/login.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth/dtos/signup.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth/dtos/update-me.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth/dtos/update-password.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-permission/auth-permission.service.ts.hbs +4 -6
- package/templates/basic/src/modules/auth-permission/dtos/create-auth-permission.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-permission/dtos/query-auth-permission.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-permission/dtos/update-auth-permission.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-role/auth-role.service.ts.hbs +4 -6
- package/templates/basic/src/modules/auth-role/dtos/create-auth-role.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-role/dtos/query-auth-role.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/auth-role/dtos/update-auth-role.dto.ts.hbs +1 -1
- package/templates/basic/src/modules/file-upload/file-upload.router.ts.hbs +1 -1
- package/templates/basic/src/modules/user/dtos/create-user.dto.ts.hbs +3 -3
- package/templates/basic/src/modules/user/dtos/update-user.dto.ts.hbs +3 -3
- package/templates/basic/src/modules/user/user.service.ts.hbs +4 -6
- package/templates/basic/src/server.ts.hbs +1 -1
- package/templates/basic/src/utils/prisma/index.ts.hbs +48 -2
- package/templates/basic/src/utils/validation/api-actions.ts.hbs +1 -1
- package/templates/basic/tsconfig.json.hbs +5 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"module": "es2022",
|
|
5
5
|
"moduleResolution": "bundler",
|
|
6
6
|
"rootDir": ".",
|
|
7
7
|
"baseUrl": ".",
|
|
@@ -20,5 +20,5 @@
|
|
|
20
20
|
}
|
|
21
21
|
},
|
|
22
22
|
"include": ["src/**/*.js", "src/**/*.jsx", "packages/**/*.js", "arkos.config.js"],
|
|
23
|
-
"exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "build", "dist", "uploads"]
|
|
23
|
+
"exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "build", "dist", "uploads", "src/generated", ".arkos"]
|
|
24
24
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "{{projectName}}",
|
|
3
3
|
"version": "1.0.0",
|
|
4
4
|
"type": "module",
|
|
5
|
-
"description": "This RESTful API was generated by create-arkos, read more about Arkos.js at www.arkosjs.com",
|
|
5
|
+
"description": "This RESTful API was generated by create-arkos, read more about Arkos.js at [www.arkosjs.com](https://www.arkosjs.com)",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"dev": "arkos dev",
|
|
8
8
|
"build": "arkos build",
|
|
@@ -14,30 +14,46 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
{{#if typescript}}
|
|
17
|
-
"typescript": "
|
|
18
|
-
"@types/node": "
|
|
19
|
-
"@types/express": "5.0.
|
|
17
|
+
"typescript": "7.0.2",
|
|
18
|
+
"@types/node": "26.1.1",
|
|
19
|
+
"@types/express": "5.0.6",
|
|
20
20
|
{{/if}}
|
|
21
21
|
"tsx-strict": "0.8.0",
|
|
22
22
|
"tsx": "4.23.1"{{#if (neq prisma.provider "none")}},
|
|
23
|
-
"prisma": "
|
|
23
|
+
"prisma": "7.9.0"
|
|
24
24
|
{{/if}}
|
|
25
25
|
},
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"arkos": "2.0.0-next.
|
|
28
|
-
"express": "
|
|
29
|
-
"@scalar/express-api-reference": "0.10.
|
|
30
|
-
"@scalar/api-reference": "1.
|
|
27
|
+
"arkos": "2.0.0-next.19",
|
|
28
|
+
"express": "5.2.1",
|
|
29
|
+
"@scalar/express-api-reference": "0.10.11",
|
|
30
|
+
"@scalar/api-reference": "1.63.0"{{#if (or (neq prisma.provider "none") validation.type)}},{{/if}}
|
|
31
31
|
{{#if (neq prisma.provider "none")}}
|
|
32
|
-
"@prisma/client": "
|
|
32
|
+
"@prisma/client": "7.9.0",
|
|
33
|
+
{{#if (eq prisma.provider "postgresql")}}
|
|
34
|
+
"@prisma/adapter-pg": "7.9.0",
|
|
35
|
+
{{/if}}
|
|
36
|
+
{{#if (eq prisma.provider "cockroachdb")}}
|
|
37
|
+
"@prisma/adapter-pg": "7.9.0",
|
|
38
|
+
{{/if}}
|
|
39
|
+
{{#if (eq prisma.provider "mysql")}}
|
|
40
|
+
"@prisma/adapter-mariadb": "7.9.0",
|
|
41
|
+
{{/if}}
|
|
42
|
+
{{#if (eq prisma.provider "sqlite")}}
|
|
43
|
+
"@prisma/adapter-better-sqlite3": "7.9.0",
|
|
44
|
+
{{/if}}
|
|
45
|
+
{{#if (eq prisma.provider "sqlserver")}}
|
|
46
|
+
"@prisma/adapter-mssql": "7.9.0",
|
|
47
|
+
{{/if}}
|
|
48
|
+
{{#if validation.type}},{{/if}}
|
|
33
49
|
{{/if}}
|
|
34
50
|
{{#if (eq validation.type "class-validator")}}
|
|
35
51
|
"reflect-metadata": "0.2.2",
|
|
36
52
|
"class-transformer": "0.5.1",
|
|
37
|
-
"class-validator": "0.
|
|
53
|
+
"class-validator": "0.15.1"
|
|
38
54
|
{{/if}}
|
|
39
55
|
{{#if (eq validation.type "zod")}}
|
|
40
|
-
"zod": "
|
|
56
|
+
"zod": "4.4.3"
|
|
41
57
|
{{/if}}
|
|
42
58
|
}
|
|
43
59
|
}
|
|
@@ -8,7 +8,7 @@ const SignupDto = z.object({
|
|
|
8
8
|
|
|
9
9
|
export default SignupDto;
|
|
10
10
|
{{#if typescript}}
|
|
11
|
-
export type
|
|
11
|
+
export type SignupDto = z.infer<typeof SignupDto>;
|
|
12
12
|
{{/if}}
|
|
13
13
|
{{/if}}
|
|
14
14
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -7,7 +7,7 @@ const UpdateMeDto = z.object({
|
|
|
7
7
|
|
|
8
8
|
export default UpdateMeDto;
|
|
9
9
|
{{#if typescript}}
|
|
10
|
-
export type
|
|
10
|
+
export type UpdateMeDto = z.infer<typeof UpdateMeDto>;
|
|
11
11
|
{{/if}}
|
|
12
12
|
{{/if}}
|
|
13
13
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -8,7 +8,7 @@ const UpdatePasswordDto = z.object({
|
|
|
8
8
|
|
|
9
9
|
export default UpdatePasswordDto;
|
|
10
10
|
{{#if typescript}}
|
|
11
|
-
export type
|
|
11
|
+
export type UpdatePasswordDto = z.infer<typeof UpdatePasswordDto>;
|
|
12
12
|
{{/if}}
|
|
13
13
|
{{/if}}
|
|
14
14
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
{{#if typescript}}
|
|
3
|
-
import { Prisma } from "@prisma/client"
|
|
1
|
+
import { ArkosPrismaService } from "arkos/services";
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
{{#if typescript}}
|
|
4
|
+
class AuthPermissionService extends ArkosPrismaService<"auth-permission"> {}
|
|
6
5
|
{{else}}
|
|
7
|
-
|
|
8
|
-
class AuthPermissionService extends BaseService {}
|
|
6
|
+
class AuthPermissionService extends ArkosPrismaService {}
|
|
9
7
|
{{/if}}
|
|
10
8
|
|
|
11
9
|
const authPermissionService = new AuthPermissionService("auth-permission");
|
|
@@ -12,7 +12,7 @@ const CreateAuthPermissionDto = z.object({
|
|
|
12
12
|
|
|
13
13
|
export default CreateAuthPermissionDto;
|
|
14
14
|
{{#if typescript}}
|
|
15
|
-
export type
|
|
15
|
+
export type CreateAuthPermissionDto = z.infer<typeof CreateAuthPermissionDto>;
|
|
16
16
|
{{/if}}
|
|
17
17
|
{{/if}}
|
|
18
18
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -18,7 +18,7 @@ const QueryAuthPermissionDto = z.object({
|
|
|
18
18
|
|
|
19
19
|
export default QueryAuthPermissionDto;
|
|
20
20
|
{{#if typescript}}
|
|
21
|
-
export type
|
|
21
|
+
export type QueryAuthPermissionDto = z.infer<typeof QueryAuthPermissionDto>;
|
|
22
22
|
{{/if}}
|
|
23
23
|
{{/if}}
|
|
24
24
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -12,7 +12,7 @@ const UpdateAuthPermissionDto = z.object({
|
|
|
12
12
|
|
|
13
13
|
export default UpdateAuthPermissionDto;
|
|
14
14
|
{{#if typescript}}
|
|
15
|
-
export type
|
|
15
|
+
export type UpdateAuthPermissionDto = z.infer<typeof UpdateAuthPermissionDto>;
|
|
16
16
|
{{/if}}
|
|
17
17
|
{{/if}}
|
|
18
18
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
{{#if typescript}}
|
|
3
|
-
import { Prisma } from "@prisma/client"
|
|
1
|
+
import { ArkosPrismaService } from "arkos/services";
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
{{#if typescript}}
|
|
4
|
+
class AuthRoleService extends ArkosPrismaService<"auth-role"> {}
|
|
6
5
|
{{else}}
|
|
7
|
-
|
|
8
|
-
class AuthRoleService extends BaseService {}
|
|
6
|
+
class AuthRoleService extends ArkosPrismaService {}
|
|
9
7
|
{{/if}}
|
|
10
8
|
|
|
11
9
|
const authRoleService = new AuthRoleService("auth-role");
|
|
@@ -15,7 +15,7 @@ const CreateAuthRoleDto = z.object({
|
|
|
15
15
|
|
|
16
16
|
export default CreateAuthRoleDto;
|
|
17
17
|
{{#if typescript}}
|
|
18
|
-
export type
|
|
18
|
+
export type CreateAuthRoleDto = z.infer<typeof CreateAuthRoleDto>;
|
|
19
19
|
{{/if}}
|
|
20
20
|
{{/if}}
|
|
21
21
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -22,7 +22,7 @@ const QueryAuthRoleDto = z.object({
|
|
|
22
22
|
|
|
23
23
|
export default QueryAuthRoleDto;
|
|
24
24
|
{{#if typescript}}
|
|
25
|
-
export type
|
|
25
|
+
export type QueryAuthRoleDto = z.infer<typeof QueryAuthRoleDto>;
|
|
26
26
|
{{/if}}
|
|
27
27
|
{{/if}}
|
|
28
28
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -17,7 +17,7 @@ const UpdateAuthRoleDto = z.object({
|
|
|
17
17
|
|
|
18
18
|
export default UpdateAuthRoleDto;
|
|
19
19
|
{{#if typescript}}
|
|
20
|
-
export type
|
|
20
|
+
export type UpdateAuthRoleDto = z.infer<typeof UpdateAuthRoleDto>;
|
|
21
21
|
{{/if}}
|
|
22
22
|
{{/if}}
|
|
23
23
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -20,9 +20,9 @@ const CreateUserDto = z.object({
|
|
|
20
20
|
role: z.string(),
|
|
21
21
|
{{else}}
|
|
22
22
|
{{#if authentication.multipleRoles}}
|
|
23
|
-
roles: z.array(z.
|
|
23
|
+
roles: z.array(z.enum(UserRole)),
|
|
24
24
|
{{else}}
|
|
25
|
-
role: z.
|
|
25
|
+
role: z.enum(UserRole),
|
|
26
26
|
{{/if}}
|
|
27
27
|
{{/if}}
|
|
28
28
|
{{else}}
|
|
@@ -40,7 +40,7 @@ const CreateUserDto = z.object({
|
|
|
40
40
|
|
|
41
41
|
export default CreateUserDto;
|
|
42
42
|
{{#if typescript}}
|
|
43
|
-
export type
|
|
43
|
+
export type CreateUserDto = z.infer<typeof CreateUserDto>;
|
|
44
44
|
{{/if}}
|
|
45
45
|
{{/if}}
|
|
46
46
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -22,9 +22,9 @@ const UpdateUserDto = z.object({
|
|
|
22
22
|
role: z.string().optional(),
|
|
23
23
|
{{else}}
|
|
24
24
|
{{#if authentication.multipleRoles}}
|
|
25
|
-
roles: z.array(z.
|
|
25
|
+
roles: z.array(z.enum(UserRole)).optional(),
|
|
26
26
|
{{else}}
|
|
27
|
-
role: z.
|
|
27
|
+
role: z.enum(UserRole).optional(),
|
|
28
28
|
{{/if}}
|
|
29
29
|
{{/if}}
|
|
30
30
|
{{else}}
|
|
@@ -46,7 +46,7 @@ const UpdateUserDto = z.object({
|
|
|
46
46
|
|
|
47
47
|
export default UpdateUserDto;
|
|
48
48
|
{{#if typescript}}
|
|
49
|
-
export type
|
|
49
|
+
export type UpdateUserDto = z.infer<typeof UpdateUserDto>;
|
|
50
50
|
{{/if}}
|
|
51
51
|
{{/if}}
|
|
52
52
|
{{#if (eq validation.type "class-validator")}}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
{{#if typescript}}
|
|
3
|
-
import { Prisma } from "@prisma/client"
|
|
1
|
+
import { ArkosPrismaService } from "arkos/services";
|
|
4
2
|
|
|
5
|
-
|
|
3
|
+
{{#if typescript}}
|
|
4
|
+
class UserService extends ArkosPrismaService<"user"> {}
|
|
6
5
|
{{else}}
|
|
7
|
-
|
|
8
|
-
class UserService extends BaseService {}
|
|
6
|
+
class UserService extends ArkosPrismaService {}
|
|
9
7
|
{{/if}}
|
|
10
8
|
|
|
11
9
|
const userService = new UserService("user");
|
|
@@ -1,5 +1,51 @@
|
|
|
1
|
-
|
|
1
|
+
{{#if (eq prisma.provider "postgresql")}}
|
|
2
|
+
import { PrismaClient } from "@/src/generated/prisma/client";
|
|
3
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
2
4
|
|
|
3
|
-
|
|
5
|
+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL{{#if typescript}} as string{{/if}} });
|
|
6
|
+
export const prisma = new PrismaClient({ adapter });
|
|
7
|
+
{{/if}}
|
|
8
|
+
{{#if (eq prisma.provider "cockroachdb")}}
|
|
9
|
+
import { PrismaClient } from "@/src/generated/prisma/client";
|
|
10
|
+
import { PrismaPg } from "@prisma/adapter-pg";
|
|
11
|
+
|
|
12
|
+
// CockroachDB uses the PostgreSQL wire protocol, so it shares the pg adapter
|
|
13
|
+
const adapter = new PrismaPg({ connectionString: process.env.DATABASE_URL{{#if typescript}} as string{{/if}} });
|
|
14
|
+
export const prisma = new PrismaClient({ adapter });
|
|
15
|
+
{{/if}}
|
|
16
|
+
{{#if (eq prisma.provider "mysql")}}
|
|
17
|
+
import { PrismaClient } from "@/src/generated/prisma/client";
|
|
18
|
+
import { PrismaMariaDb } from "@prisma/adapter-mariadb";
|
|
19
|
+
|
|
20
|
+
const dbUrl = new URL(process.env.DATABASE_URL{{#if typescript}} as string{{/if}});
|
|
21
|
+
const adapter = new PrismaMariaDb({
|
|
22
|
+
host: dbUrl.hostname,
|
|
23
|
+
port: Number(dbUrl.port) || 3306,
|
|
24
|
+
user: decodeURIComponent(dbUrl.username),
|
|
25
|
+
password: decodeURIComponent(dbUrl.password),
|
|
26
|
+
database: dbUrl.pathname.replace(/^\//, ""),
|
|
27
|
+
connectionLimit: 5,
|
|
28
|
+
});
|
|
29
|
+
export const prisma = new PrismaClient({ adapter });
|
|
30
|
+
{{/if}}
|
|
31
|
+
{{#if (eq prisma.provider "sqlite")}}
|
|
32
|
+
import { PrismaClient } from "@/src/generated/prisma/client";
|
|
33
|
+
import { PrismaBetterSqlite3 } from "@prisma/adapter-better-sqlite3";
|
|
34
|
+
|
|
35
|
+
const adapter = new PrismaBetterSqlite3({
|
|
36
|
+
url: process.env.DATABASE_URL || "file:./dev.db",
|
|
37
|
+
});
|
|
38
|
+
export const prisma = new PrismaClient({ adapter });
|
|
39
|
+
{{/if}}
|
|
40
|
+
{{#if (eq prisma.provider "sqlserver")}}
|
|
41
|
+
import { PrismaClient } from "@/src/generated/prisma/client";
|
|
42
|
+
import { PrismaMssql } from "@prisma/adapter-mssql";
|
|
43
|
+
|
|
44
|
+
const adapter = new PrismaMssql(process.env.DATABASE_URL{{#if typescript}} as string{{/if}});
|
|
45
|
+
export const prisma = new PrismaClient({ adapter });
|
|
46
|
+
{{/if}}
|
|
47
|
+
{{#if (eq prisma.provider "none")}}
|
|
48
|
+
export const prisma = null;
|
|
49
|
+
{{/if}}
|
|
4
50
|
|
|
5
51
|
export default prisma;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* A simple array of available `apiAction` field when using auto generate API (That uses
|
|
2
|
+
* A simple array of available `apiAction` field when using auto generate API (That uses ArkosPrismaService)
|
|
3
3
|
* class behind the scenes.
|
|
4
4
|
*
|
|
5
5
|
* Is worth mentioning that this will be addded into `arkos` as an util.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"compilerOptions": {
|
|
3
|
-
"target": "
|
|
4
|
-
"module": "
|
|
3
|
+
"target": "es2022",
|
|
4
|
+
"module": "es2022",
|
|
5
5
|
"moduleResolution": "bundler",
|
|
6
6
|
"rootDir": ".",
|
|
7
7
|
"baseUrl": ".",
|
|
@@ -15,11 +15,12 @@
|
|
|
15
15
|
"lib": ["es6", "dom"],
|
|
16
16
|
"noImplicitAny": true,
|
|
17
17
|
"paths": {
|
|
18
|
-
"@/*": ["./*"]
|
|
18
|
+
"@/*": ["./*"],
|
|
19
|
+
"@arkosjs/generated": ["./.arkos/index.d.ts"]
|
|
19
20
|
}
|
|
20
21
|
},
|
|
21
22
|
"include": ["src/**/*.ts", "src/**/*.js", "src/**/*.tsx", "src/**/*.jsx", "arkos.config.ts"],
|
|
22
|
-
"exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "temp", "dist", "build", "uploads"],
|
|
23
|
+
"exclude": ["node_modules", ".build", "src/**/__tests__/**", "src/**/*.test", "src/**/*.spec", "temp", "dist", "build", "uploads", "src/generated", ".arkos"],
|
|
23
24
|
"watchOptions": {
|
|
24
25
|
"excludeDirectories": ["**/node_modules", "node_modules"]
|
|
25
26
|
}
|