create-arkos 1.5.10-beta → 1.6.0-beta.1

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.
Files changed (27) hide show
  1. package/README.md +59 -156
  2. package/dist/utils/project-config-inquirer.js +0 -1
  3. package/dist/utils/project-config-inquirer.js.map +1 -1
  4. package/dist/utils/template-compiler.js +9 -4
  5. package/dist/utils/template-compiler.js.map +1 -1
  6. package/package.json +3 -3
  7. package/templates/basic/README.md.hbs +1 -1
  8. package/templates/basic/arkos.config.ts.hbs +4 -9
  9. package/templates/basic/package.json.hbs +2 -1
  10. package/templates/basic/src/app.ts.hbs +5 -3
  11. package/templates/basic/src/modules/auth-permission/auth-permission.policy.ts.hbs +33 -0
  12. package/templates/basic/src/modules/auth-permission/auth-permission.router.ts.hbs +14 -0
  13. package/templates/basic/src/modules/auth-role/auth-role.policy.ts.hbs +33 -0
  14. package/templates/basic/src/modules/auth-role/auth-role.router.ts.hbs +14 -0
  15. package/templates/basic/src/modules/auth-role/schemas/create-auth-role.schema.ts.hbs +1 -5
  16. package/templates/basic/src/modules/auth-role/schemas/update-auth-role.schema.ts.hbs +1 -5
  17. package/templates/basic/src/modules/file-upload/file-upload.policy.ts.hbs +33 -0
  18. package/templates/basic/src/modules/file-upload/file-upload.router.ts.hbs +13 -0
  19. package/templates/basic/src/modules/user/dtos/update-user.dto.ts.hbs +1 -5
  20. package/templates/basic/src/modules/user/schemas/update-user.schema.ts.hbs +1 -5
  21. package/templates/basic/src/modules/user/user.interceptors.ts.hbs +0 -50
  22. package/templates/basic/src/modules/user/user.policy.ts.hbs +33 -0
  23. package/templates/basic/src/modules/user/user.router.ts.hbs +14 -0
  24. package/templates/basic/src/modules/auth-permission/auth-permission.auth.ts.hbs +0 -75
  25. package/templates/basic/src/modules/auth-role/auth-role.auth.ts.hbs +0 -75
  26. package/templates/basic/src/modules/file-upload/file-upload.auth.ts.hbs +0 -83
  27. package/templates/basic/src/modules/user/user.auth.ts.hbs +0 -75
package/README.md CHANGED
@@ -1,94 +1,53 @@
1
- # create-arkos
1
+ ![Header Image](https://www.arkosjs.com/img/arkos-readme-header.webp?v=3)
2
2
 
3
3
  <div align="center">
4
4
 
5
+ [![Socket Badge](https://badge.socket.dev/npm/package/create-arkos)](https://badge.socket.dev/npm/package/create-arkos)
5
6
  ![npm](https://img.shields.io/npm/v/create-arkos)
6
7
  ![npm](https://img.shields.io/npm/dt/create-arkos)
7
8
  ![GitHub](https://img.shields.io/github/license/uanela/arkos)
9
+ ![GitHub Repo stars](https://img.shields.io/github/stars/uanela/arkos)
8
10
 
9
11
  </div>
10
12
 
11
13
  <div align="center">
12
- <h2>Scaffold Production-Ready APIs in Seconds</h2>
13
- <p>The official CLI tool for Arkos.js - Get from zero to authenticated REST API faster than your coffee gets cold</p>
14
+ <h2>Scaffold Your Arkos Project in Seconds</h2>
15
+ <p>The official CLI scaffolding tool for Arkos.js</p>
14
16
  </div>
15
17
 
16
- ---
17
-
18
- ## Why create-arkos?
19
-
20
- Skip the hours of boilerplate setup. Get a production-ready API with authentication, validation, and auto-generated docs in **under 5 minutes**.
18
+ <div align="center">
21
19
 
22
- **Perfect for:**
20
+ **[Installation](https://www.arkosjs.com/docs/getting-started/installation)**
21
+ **[Documentation](https://arkosjs.com/docs)** •
22
+ **[Website](https://arkosjs.com)** •
23
+ **[Tutorial](https://arkosjs.com/learn)** •
24
+ **[GitHub](https://github.com/uanela/arkos)** •
25
+ **[Blog](https://www.arkosjs.com/blog)** •
26
+ **[Npm](https://www.npmjs.com/package/create-arkos)**
23
27
 
24
- - Starting new backend projects without the setup headache
25
- - Prototyping APIs that need to scale later
26
- - Teams who want consistent project structure from day one
28
+ </div>
27
29
 
28
30
  ## Quick Start
29
31
 
30
32
  ```bash
31
- # Using pnpm (recommended)
32
33
  pnpm create arkos@latest my-project
33
-
34
- # Using npm
35
- npm create arkos@latest my-project
36
-
37
- # Using yarn
38
- yarn create arkos@latest my-project
39
34
  ```
40
35
 
41
- **That's it!** Follow the interactive prompts and you'll have a running API.
42
-
43
- ## What You Get
44
-
45
- ✅ **Production-ready REST API** with Express.js
46
- ✅ **JWT authentication** configured and ready
47
- ✅ **Auto-generated Swagger docs** at `/api/docs`
48
- ✅ **Database setup** with Prisma ORM
49
- ✅ **Input validation** (Zod or class-validator)
50
- ✅ **TypeScript support** (optional)
51
- ✅ **Best practices** and security middleware
36
+ Follow the interactive prompts. Your project comes with JWT auth, customizable CRUD routes, Swagger docs at `/api/docs`, file uploads, validation, and a full security middleware stack. Understand the generated [Project Structure](https://www.arkosjs.com/docs/getting-started/project-structure).
52
37
 
53
- ## Interactive Setup Experience
54
-
55
- The CLI guides you through a friendly setup process:
38
+ ## Interactive Setup
56
39
 
57
40
  ```bash
58
- ? What is the name of your project? my-arkos-project
41
+ ? What is the name of your project? my-project
59
42
  ? Would you like to use TypeScript? Yes
60
- ? What db provider will be used for Prisma? mongodb
61
- ? Would you like to set up Validation? Yes
62
- ? Choose validation library: zod
63
- ? Would you like to set up Authentication? Yes
64
- ? Choose authentication type: dynamic
65
- ? Would you like to use authentication with Multiple Roles? Yes
66
- ? Choose default username field for login: email
43
+ ? What db provider will be used for Prisma? postgresql
44
+ ? Which Validation library would you like to use? zod
45
+ ? Which Authentication mode would you like to use? static
46
+ ? Enter the Prisma field name to use as the login username: email
47
+ ? Would you like to use Strict Routing? No
67
48
  ```
68
49
 
69
- ### Configuration Options
70
-
71
- **Database Providers:**
72
-
73
- - PostgreSQL (recommended for production)
74
- - MongoDB
75
- - MySQL
76
- - SQLite (great for prototyping)
77
- - SQL Server
78
- - CockroachDB
79
-
80
- **Validation Libraries:**
81
-
82
- - **Zod** - TypeScript-first schema validation
83
- - **class-validator** - Decorator-based validation
84
-
85
- **Authentication Types:**
86
-
87
- - **Dynamic** - Database-level auth with roles and permissions tables
88
- - **Static** - File-based configuration for simpler projects
89
- - **Define Later** - Skip for now, add when ready
90
-
91
- ## From Scaffold to Running API
50
+ ## From Zero to Running API
92
51
 
93
52
  ```bash
94
53
  # 1. Create your project
@@ -100,101 +59,49 @@ cd my-project
100
59
  # 3. Configure your database
101
60
  # Edit .env with your DATABASE_URL
102
61
 
103
- # 4. Initialize the database
62
+ # 4. Push the schema
104
63
  npx prisma db push
105
64
 
106
65
  # 5. Start building
107
66
  npm run dev
108
67
  ```
109
68
 
110
- **Your API is now running at `http://localhost:3000`** with:
69
+ Your API is now running at `http://localhost:8000` — OpenAPI at `/api/docs`.
70
+
71
+ ## Configuration Options
72
+
73
+ **Database providers:** PostgreSQL · MongoDB · MySQL · SQLite · SQL Server · CockroachDB
111
74
 
112
- - Swagger docs at `/api/docs`
113
- - Health check at `/api/health`
114
- - Authentication endpoints ready to use
75
+ **Validation:** Zod · class-validator
76
+
77
+ **Authentication types:**
78
+
79
+ - **Static** — file-based, roles defined in code via `ArkosPolicy`
80
+ - **Dynamic** — database-level, roles and permissions stored in tables
81
+ - **None** — skip for now, add when ready
115
82
 
116
83
  ## Generated Project Structure
117
84
 
118
85
  ```
119
- my-arkos-project/
86
+ my-project/
120
87
  ├── prisma/
121
- │ └── schema.prisma # Database schema
88
+ │ └── schema.prisma
122
89
  ├── src/
90
+ │ ├── modules
123
91
  │ ├── utils/
124
92
  │ │ └── prisma/
125
- │ │ └── index.ts # Prisma client
126
- ├── app.ts # Main application
127
- ├── arkos.config.ts # Framework configuration
128
- │ └── server.ts # Server entry point
129
- ├── .env # Environment variables
130
- ├── .gitignore
93
+ │ │ └── index.ts
94
+ └── app.ts
95
+ ├── .env
96
+ ├── arkos.config.ts
131
97
  ├── package.json
132
- └── tsconfig.json # TypeScript config (if selected)
133
- ```
134
-
135
- ## Environment Setup
136
-
137
- Example `.env` configurations for different databases:
138
-
139
- ```env
140
- # PostgreSQL (recommended for production)
141
- DATABASE_URL="postgresql://username:password@localhost:5432/mydb"
142
-
143
- # MongoDB
144
- DATABASE_URL="mongodb://localhost:27017/mydb"
145
-
146
- # MySQL
147
- DATABASE_URL="mysql://username:password@localhost:3306/mydb"
148
-
149
- # SQLite (great for local development)
150
- DATABASE_URL="file:./dev.db"
151
- ```
152
-
153
- ## Authentication Out of the Box
154
-
155
- ### Dynamic Authentication (Recommended)
156
-
157
- Perfect for apps that need user management and role-based access:
158
-
159
- - `auth-role` table for managing roles
160
- - `auth-permission` table for granular permissions
161
- - Multi-role support
162
- - Database-level flexibility
163
-
164
- ### Static Authentication
165
-
166
- Great for simpler projects or when roles are predefined:
167
-
168
- - Configuration file-based
169
- - Faster setup
170
- - Easy to understand and modify
171
-
172
- ## Next Steps
173
-
174
- Once your project is created:
175
-
176
- 1. **Define your data models** in `prisma/schema.prisma`
177
- 2. **Run migrations** with `npx prisma db push`
178
- 3. **Start coding** - Arkos handles the CRUD operations automatically
179
- 4. **Add custom logic** with interceptors when needed
180
-
181
- ```bash
182
- # Generate CRUD for a new model
183
- arkos generate posts -m Post
184
-
185
- # Start development
186
- npm run dev
187
-
188
- # Build for production
189
- npm run build
98
+ └── tsconfig.json
190
99
  ```
191
100
 
192
- ## Get Cutting-Edge Features
193
-
194
- Try our canary releases for the latest features:
101
+ ## Getting Nightly Updates
195
102
 
196
103
  ```bash
197
- pnpm create arkos@canary my-project
104
+ pnpm create arkos@next my-project
198
105
  ```
199
106
 
200
107
  ## Requirements
@@ -202,36 +109,32 @@ pnpm create arkos@canary my-project
202
109
  - Node.js 20 or higher
203
110
  - npm, yarn, or pnpm
204
111
 
205
- ## Learn More
206
-
207
- - **Documentation:** [arkosjs.com/docs](https://arkosjs.com/docs/intro)
208
- - **Main Framework:** [github.com/uanela/arkos](https://github.com/uanela/arkos)
209
- - **Community:** [Join our WhatsApp group](https://chat.whatsapp.com/EJ8cjb9hxau0EcOnI4fdpD)
210
- - **Examples:** [arkosjs.com/docs/examples](https://arkosjs.com/docs/examples)
211
-
212
- ## Support
112
+ ## Support & Contributing
213
113
 
114
+ - **Documentation:** [arkosjs.com/docs](https://arkosjs.com/docs)
214
115
  - **Bug Reports:** [GitHub Issues](https://github.com/uanela/arkos/issues)
215
116
  - **Feature Requests:** Open a GitHub issue
216
- - **Email:** [uanelaluiswayne@gmail.com](mailto:uanelaluiswayne@gmail.com)
117
+ - **Contact:** [uanelaluiswayne@gmail.com](mailto:uanelaluiswayne@gmail.com)
217
118
 
218
- ## License
119
+ Contributions are welcome! We appreciate all contributions, from bug fixes to new features.
219
120
 
220
- MIT License - see the [LICENSE](LICENSE) file for details.
121
+ ## License
221
122
 
222
- ---
123
+ This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.
223
124
 
224
125
  <div align="center">
225
126
 
226
- **[Documentation](https://arkosjs.com/docs/intro)** •
127
+ **[Installation](https://www.arkosjs.com/docs/getting-started/installation)** •
128
+ **[Documentation](https://arkosjs.com/docs)** •
227
129
  **[Website](https://arkosjs.com)** •
130
+ **[Tutorial](https://arkosjs.com/learn)** •
228
131
  **[GitHub](https://github.com/uanela/arkos)** •
229
- **[npm](https://www.npmjs.com/package/create-arkos)**
132
+ **[Blog](https://www.arkosjs.com/blog)**
133
+ **[Npm](https://www.npmjs.com/package/create-arkos)**
230
134
 
231
135
  Built with ❤️ by [Uanela Como](https://github.com/uanela) and contributors
232
136
 
233
- ---
234
-
235
- _From the Greek "ἀρχή" (Arkhē) - meaning "beginning" - your foundation for Express and Prisma backend development_
137
+ _The name "Arkos" comes from the Greek word "ἀρχή" (Arkhē), meaning "beginning" or "foundation", reflecting our goal of providing a solid foundation for backend development._
236
138
 
237
139
  </div>
140
+ ```
@@ -212,7 +212,6 @@ class ProjectConfigInquirer {
212
212
  };
213
213
  }
214
214
  else if (this.config.prisma.provider === "sqlite") {
215
- console.info(`Skipping multiple roles option because it is not supported with sqlite prisma provider and static authentication mode.`);
216
215
  }
217
216
  }
218
217
  async promptStrictRouting() {
@@ -1 +1 @@
1
- {"version":3,"file":"project-config-inquirer.js","sourceRoot":"","sources":["../../src/utils/project-config-inquirer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,M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,EAAE,KAAK;SACrB,CAAC;QAEF,IACE,kBAAkB,KAAK,QAAQ;YAC/B,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,EACxC;YACA,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;gBAC9C;oBACE,IAAI,EAAE,SAAS;oBACf,IAAI,EAAE,eAAe;oBACrB,OAAO,EAAE,IAAI;oBACb,OAAO,EAAE,6CAA6C,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;iBACtF;aACF,CAAC,CAAC;YAEH,IAAI,CAAC,MAAM,CAAC,cAAc,GAAG;gBAC3B,GAAG,IAAI,CAAC,MAAM,CAAC,cAAc;gBAC7B,aAAa;aACd,CAAC;SACH;aAAM,IAAI,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,KAAK,QAAQ,EAAE;YACnD,OAAO,CAAC,IAAI,CACV,wHAAwH,CACzH,CAAC;SACH;IACH,CAAC;IAEO,KAAK,CAAC,mBAAmB;QAC/B,MAAM,EAAE,aAAa,EAAE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YAC9C;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,yBAAyB,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;gBACjE,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG;YACpB,MAAM,EAAE,aAAa;SACtB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE1D,eAAe,qBAAqB,CAAC","sourcesContent":["import path from \"path\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\n\nexport interface ProjectConfig {\n projectName: string;\n argProjectName?: string;\n typescript: boolean;\n validation?: {\n type?: \"zod\" | \"class-validator\";\n };\n authentication?: {\n type?: \"static\" | \"dynamic\" | \"none\";\n usernameField?: string;\n multipleRoles: boolean;\n };\n prisma: {\n provider:\n | \"postgresql\"\n | \"mysql\"\n | \"sqlite\"\n | \"sqlserver\"\n | \"cockroachdb\"\n | \"mongodb\"\n | \"none\";\n idDatabaseType: string;\n defaultDatabaseUrl: string;\n };\n projectPath: string;\n routing?: {\n strict?: boolean;\n };\n advanced?: boolean;\n}\n\nclass ProjectConfigInquirer {\n private config: ProjectConfig;\n\n constructor() {\n this.config = {} as ProjectConfig;\n }\n\n async run() {\n await this.promptProjectName();\n await this.promptTypescript();\n await this.promptPrismaProvider();\n await this.promptValidation();\n await this.promptAuthentication();\n await this.promptStrictRouting();\n\n if (this.config.projectName === \".\") {\n this.config.projectName = path.basename(process.cwd());\n this.config.projectPath = path.resolve(process.cwd());\n } else\n this.config.projectPath = path.resolve(\n process.cwd(),\n this.config.projectName\n );\n\n if (process?.argv?.includes?.(\"--advanced\")) this.config.advanced = true;\n if (this.config.prisma.defaultDatabaseUrl)\n this.config.prisma.defaultDatabaseUrl =\n this.config.prisma.defaultDatabaseUrl.replaceAll(\n \"{{projectName}}\",\n this.config.projectName\n );\n\n return this.config;\n }\n\n private async promptProjectName() {\n let projectName = process?.argv?.[2];\n this.config.argProjectName = process?.argv?.[2];\n\n if (!projectName) {\n const result = await inquirer.prompt([\n {\n type: \"input\",\n name: \"projectName\",\n message: \"What is the name of your project?\",\n default: \"my-arkos-project\",\n validate: this.validateProjectName,\n },\n ]);\n projectName = result.projectName;\n } else {\n const validation = this.validateProjectName(projectName);\n if (validation !== true) {\n console.error(chalk.red(`\\nError: ${validation}`));\n process.exit(1);\n }\n }\n\n this.config.projectName = projectName;\n }\n\n private validateProjectName(input: string): boolean | string {\n if (input === \".\") return true;\n\n if (!input || input.length === 0) {\n return \"Project name cannot be empty\";\n }\n\n if (!/^[a-zA-Z0-9_-]+$/.test(input)) {\n return \"Project name can only contain letters, numbers, hyphens, and underscores\";\n }\n\n if (!/^[a-zA-Z0-9]/.test(input)) {\n return \"Project name must start with a letter or number\";\n }\n\n if (!/[a-zA-Z0-9]$/.test(input)) {\n return \"Project name must end with a letter or number\";\n }\n\n if (input.length > 50) {\n return \"Project name must be 50 characters or less\";\n }\n\n const reservedNames = [\"node_modules\"];\n if (reservedNames.includes(input.toLowerCase())) {\n return \"Project name cannot be a reserved name\";\n }\n\n return true;\n }\n\n private async promptTypescript() {\n const { typescript } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"typescript\",\n message: `Would you like to use ${chalk.cyan(\"TypeScript\")}?`,\n default: true,\n },\n ]);\n this.config.typescript = typescript;\n }\n\n private async promptPrismaProvider() {\n const { prismaProvider } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"prismaProvider\",\n message: `What db provider will be used for ${chalk.cyan(\"Prisma\")}?`,\n choices: [\n \"postgresql\",\n \"mongodb\",\n \"mysql\",\n \"sqlite\",\n \"sqlserver\",\n \"cockroachdb\",\n \"none\",\n ],\n },\n ]);\n\n let idDatabaseType: string;\n let defaultDatabaseUrl: string;\n\n switch (prismaProvider) {\n case \"mongodb\":\n idDatabaseType = '@id @default(auto()) @map(\"_id\") @db.ObjectId';\n defaultDatabaseUrl = `mongodb://localhost:27017/{{projectName}}`;\n break;\n case \"sqlite\":\n idDatabaseType = \"@id @default(cuid())\";\n defaultDatabaseUrl = \"file:../../file.db\";\n break;\n case \"mysql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `mysql://username:password@localhost:3306/{{projectName}}`;\n break;\n case \"postgresql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `postgresql://username:password@localhost:5432/{{projectName}}`;\n break;\n case \"sqlserver\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `sqlserver://localhost:1433;database={{projectName}};username=sa;password=password;encrypt=DANGER_PLAINTEXT`;\n break;\n case \"cockroachdb\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `postgresql://username:password@localhost:26257/{{projectName}}?sslmode=require`;\n break;\n default:\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `postgresql://username:password@localhost:5432/{{projectName}}`;\n }\n\n this.config.prisma = {\n provider: prismaProvider,\n idDatabaseType,\n defaultDatabaseUrl,\n };\n }\n\n private async promptValidation() {\n // For JS projects, class-validator is not supported — skip the choice\n const choices = this.config.typescript\n ? [\"zod\", \"class-validator\", \"none\"]\n : [\"zod\", \"none\"];\n\n const { validationType } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"validationType\",\n message: `Which ${chalk.cyan(\"Validation\")} library would you like to use?`,\n choices,\n default: \"zod\",\n },\n ]);\n\n if (validationType !== \"none\") {\n this.config.validation = {\n type: validationType as \"zod\" | \"class-validator\",\n };\n }\n // validation stays undefined when \"none\" is chosen — matches original behaviour\n }\n\n private async promptAuthentication() {\n if (this.config.prisma.provider === \"none\") {\n console.info(`Skipping authentication setup as it requires prisma.`);\n return;\n }\n\n const { authenticationType } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"authenticationType\",\n message: `Which ${chalk.cyan(\"Authentication\")} mode would you like to use?`,\n choices: [\"static\", \"dynamic\", \"none\"],\n default: \"static\",\n },\n ]);\n\n if (authenticationType === \"none\") {\n this.config.authentication = { type: \"none\", multipleRoles: false };\n return;\n }\n\n const { usernameField } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"usernameField\",\n message: \"Enter the Prisma field name to use as the login username:\",\n default: \"email\",\n validate: (input: string) => {\n if (!input || input.length === 0) return \"Field name cannot be empty\";\n if (!/^[a-z][a-zA-Z0-9]*$/.test(input))\n return \"Must be a valid Prisma field name (camelCase, starts with lowercase, letters and numbers only)\";\n return true;\n },\n },\n ]);\n\n this.config.authentication = {\n type: authenticationType as \"static\" | \"dynamic\",\n usernameField,\n multipleRoles: false,\n };\n\n if (\n authenticationType !== \"static\" &&\n this.config.prisma.provider !== \"sqlite\"\n ) {\n const { multipleRoles } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"multipleRoles\",\n default: true,\n message: `Would you like to use authentication with ${chalk.cyan(\"Multiple Roles\")}?`,\n },\n ]);\n\n this.config.authentication = {\n ...this.config.authentication,\n multipleRoles,\n };\n } else if (this.config.prisma.provider === \"sqlite\") {\n console.info(\n `Skipping multiple roles option because it is not supported with sqlite prisma provider and static authentication mode.`\n );\n }\n }\n\n private async promptStrictRouting() {\n const { strictRouting } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"strictRouting\",\n message: `Would you like to use ${chalk.cyan(\"Strict Routing\")}?`,\n default: false,\n },\n ]);\n this.config.routing = {\n strict: strictRouting,\n };\n }\n}\n\nconst projectConfigInquirer = new ProjectConfigInquirer();\n\nexport default projectConfigInquirer;\n"]}
1
+ {"version":3,"file":"project-config-inquirer.js","sourceRoot":"","sources":["../../src/utils/project-config-inquirer.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,QAAQ,MAAM,UAAU,CAAC;AAChC,OAAO,KAAK,MAAM,OAAO,CAAC;AAiC1B,MAAM,qBAAqB;IACjB,MAAM,CAAgB;IAE9B;QACE,IAAI,CAAC,MAAM,GAAG,EAAmB,CAAC;IACpC,CAAC;IAED,KAAK,CAAC,GAAG;QACP,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC/B,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9B,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAClC,MAAM,IAAI,CAAC,gBAAgB,EAAE,CAAC;QAC9B,MAAM,IAAI,CAAC,oBAAoB,EAAE,CAAC;QAClC,MAAM,IAAI,CAAC,mBAAmB,EAAE,CAAC;QAEjC,IAAI,IAAI,CAAC,MAAM,CAAC,WAAW,KAAK,GAAG,EAAE;YACnC,IAAI,CAAC,MAAM,CAAC,WAAW,GAAG,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;YACvD,IAAI,CAAC,MA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AE,GAAG,MAAM,QAAQ,CAAC,MAAM,CAAC;YAC9C;gBACE,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,eAAe;gBACrB,OAAO,EAAE,yBAAyB,KAAK,CAAC,IAAI,CAAC,gBAAgB,CAAC,GAAG;gBACjE,OAAO,EAAE,KAAK;aACf;SACF,CAAC,CAAC;QACH,IAAI,CAAC,MAAM,CAAC,OAAO,GAAG;YACpB,MAAM,EAAE,aAAa;SACtB,CAAC;IACJ,CAAC;CACF;AAED,MAAM,qBAAqB,GAAG,IAAI,qBAAqB,EAAE,CAAC;AAE1D,eAAe,qBAAqB,CAAC","sourcesContent":["import path from \"path\";\nimport inquirer from \"inquirer\";\nimport chalk from \"chalk\";\n\nexport interface ProjectConfig {\n projectName: string;\n argProjectName?: string;\n typescript: boolean;\n validation?: {\n type?: \"zod\" | \"class-validator\";\n };\n authentication?: {\n type?: \"static\" | \"dynamic\" | \"none\";\n usernameField?: string;\n multipleRoles: boolean;\n };\n prisma: {\n provider:\n | \"postgresql\"\n | \"mysql\"\n | \"sqlite\"\n | \"sqlserver\"\n | \"cockroachdb\"\n | \"mongodb\"\n | \"none\";\n idDatabaseType: string;\n defaultDatabaseUrl: string;\n };\n projectPath: string;\n routing?: {\n strict?: boolean;\n };\n advanced?: boolean;\n}\n\nclass ProjectConfigInquirer {\n private config: ProjectConfig;\n\n constructor() {\n this.config = {} as ProjectConfig;\n }\n\n async run() {\n await this.promptProjectName();\n await this.promptTypescript();\n await this.promptPrismaProvider();\n await this.promptValidation();\n await this.promptAuthentication();\n await this.promptStrictRouting();\n\n if (this.config.projectName === \".\") {\n this.config.projectName = path.basename(process.cwd());\n this.config.projectPath = path.resolve(process.cwd());\n } else\n this.config.projectPath = path.resolve(\n process.cwd(),\n this.config.projectName\n );\n\n if (process?.argv?.includes?.(\"--advanced\")) this.config.advanced = true;\n if (this.config.prisma.defaultDatabaseUrl)\n this.config.prisma.defaultDatabaseUrl =\n this.config.prisma.defaultDatabaseUrl.replaceAll(\n \"{{projectName}}\",\n this.config.projectName\n );\n\n return this.config;\n }\n\n private async promptProjectName() {\n let projectName = process?.argv?.[2];\n this.config.argProjectName = process?.argv?.[2];\n\n if (!projectName) {\n const result = await inquirer.prompt([\n {\n type: \"input\",\n name: \"projectName\",\n message: \"What is the name of your project?\",\n default: \"my-arkos-project\",\n validate: this.validateProjectName,\n },\n ]);\n projectName = result.projectName;\n } else {\n const validation = this.validateProjectName(projectName);\n if (validation !== true) {\n console.error(chalk.red(`\\nError: ${validation}`));\n process.exit(1);\n }\n }\n\n this.config.projectName = projectName;\n }\n\n private validateProjectName(input: string): boolean | string {\n if (input === \".\") return true;\n\n if (!input || input.length === 0) {\n return \"Project name cannot be empty\";\n }\n\n if (!/^[a-zA-Z0-9_-]+$/.test(input)) {\n return \"Project name can only contain letters, numbers, hyphens, and underscores\";\n }\n\n if (!/^[a-zA-Z0-9]/.test(input)) {\n return \"Project name must start with a letter or number\";\n }\n\n if (!/[a-zA-Z0-9]$/.test(input)) {\n return \"Project name must end with a letter or number\";\n }\n\n if (input.length > 50) {\n return \"Project name must be 50 characters or less\";\n }\n\n const reservedNames = [\"node_modules\"];\n if (reservedNames.includes(input.toLowerCase())) {\n return \"Project name cannot be a reserved name\";\n }\n\n return true;\n }\n\n private async promptTypescript() {\n const { typescript } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"typescript\",\n message: `Would you like to use ${chalk.cyan(\"TypeScript\")}?`,\n default: true,\n },\n ]);\n this.config.typescript = typescript;\n }\n\n private async promptPrismaProvider() {\n const { prismaProvider } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"prismaProvider\",\n message: `What db provider will be used for ${chalk.cyan(\"Prisma\")}?`,\n choices: [\n \"postgresql\",\n \"mongodb\",\n \"mysql\",\n \"sqlite\",\n \"sqlserver\",\n \"cockroachdb\",\n \"none\",\n ],\n },\n ]);\n\n let idDatabaseType: string;\n let defaultDatabaseUrl: string;\n\n switch (prismaProvider) {\n case \"mongodb\":\n idDatabaseType = '@id @default(auto()) @map(\"_id\") @db.ObjectId';\n defaultDatabaseUrl = `mongodb://localhost:27017/{{projectName}}`;\n break;\n case \"sqlite\":\n idDatabaseType = \"@id @default(cuid())\";\n defaultDatabaseUrl = \"file:../../file.db\";\n break;\n case \"mysql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `mysql://username:password@localhost:3306/{{projectName}}`;\n break;\n case \"postgresql\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `postgresql://username:password@localhost:5432/{{projectName}}`;\n break;\n case \"sqlserver\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `sqlserver://localhost:1433;database={{projectName}};username=sa;password=password;encrypt=DANGER_PLAINTEXT`;\n break;\n case \"cockroachdb\":\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `postgresql://username:password@localhost:26257/{{projectName}}?sslmode=require`;\n break;\n default:\n idDatabaseType = \"@id @default(uuid())\";\n defaultDatabaseUrl = `postgresql://username:password@localhost:5432/{{projectName}}`;\n }\n\n this.config.prisma = {\n provider: prismaProvider,\n idDatabaseType,\n defaultDatabaseUrl,\n };\n }\n\n private async promptValidation() {\n // For JS projects, class-validator is not supported — skip the choice\n const choices = this.config.typescript\n ? [\"zod\", \"class-validator\", \"none\"]\n : [\"zod\", \"none\"];\n\n const { validationType } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"validationType\",\n message: `Which ${chalk.cyan(\"Validation\")} library would you like to use?`,\n choices,\n default: \"zod\",\n },\n ]);\n\n if (validationType !== \"none\") {\n this.config.validation = {\n type: validationType as \"zod\" | \"class-validator\",\n };\n }\n // validation stays undefined when \"none\" is chosen — matches original behaviour\n }\n\n private async promptAuthentication() {\n if (this.config.prisma.provider === \"none\") {\n console.info(`Skipping authentication setup as it requires prisma.`);\n return;\n }\n\n const { authenticationType } = await inquirer.prompt([\n {\n type: \"list\",\n name: \"authenticationType\",\n message: `Which ${chalk.cyan(\"Authentication\")} mode would you like to use?`,\n choices: [\"static\", \"dynamic\", \"none\"],\n default: \"static\",\n },\n ]);\n\n if (authenticationType === \"none\") {\n this.config.authentication = { type: \"none\", multipleRoles: false };\n return;\n }\n\n const { usernameField } = await inquirer.prompt([\n {\n type: \"input\",\n name: \"usernameField\",\n message: \"Enter the Prisma field name to use as the login username:\",\n default: \"email\",\n validate: (input: string) => {\n if (!input || input.length === 0) return \"Field name cannot be empty\";\n if (!/^[a-z][a-zA-Z0-9]*$/.test(input))\n return \"Must be a valid Prisma field name (camelCase, starts with lowercase, letters and numbers only)\";\n return true;\n },\n },\n ]);\n\n this.config.authentication = {\n type: authenticationType as \"static\" | \"dynamic\",\n usernameField,\n multipleRoles: false,\n };\n\n if (\n authenticationType !== \"static\" &&\n this.config.prisma.provider !== \"sqlite\"\n ) {\n const { multipleRoles } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"multipleRoles\",\n default: true,\n message: `Would you like to use authentication with ${chalk.cyan(\"Multiple Roles\")}?`,\n },\n ]);\n\n this.config.authentication = {\n ...this.config.authentication,\n multipleRoles,\n };\n } else if (this.config.prisma.provider === \"sqlite\") {\n // console.info(\n // `Skipping multiple roles option because it is not supported with sqlite prisma provider and static authentication mode.`\n // );\n }\n }\n\n private async promptStrictRouting() {\n const { strictRouting } = await inquirer.prompt([\n {\n type: \"confirm\",\n name: \"strictRouting\",\n message: `Would you like to use ${chalk.cyan(\"Strict Routing\")}?`,\n default: false,\n },\n ]);\n this.config.routing = {\n strict: strictRouting,\n };\n }\n}\n\nconst projectConfigInquirer = new ProjectConfigInquirer();\n\nexport default projectConfigInquirer;\n"]}
@@ -50,12 +50,16 @@ class TemplateCompiler {
50
50
  "auth.query.ts.hbs",
51
51
  ];
52
52
  const authPermissionModuleComponents = [
53
- "auth-permission.auth.ts.hbs",
53
+ "auth-permission.router.ts.hbs",
54
+ "auth-permission.policy.ts.hbs",
55
+ "auth-permission.query.ts.hbs",
54
56
  "auth-permission.query.ts.hbs",
55
57
  "auth-permission.service.ts.hbs",
56
58
  ];
57
59
  const authRoleModuleComponents = [
58
- "auth-role.auth.ts.hbs",
60
+ "auth-role.router.ts.hbs",
61
+ "auth-role.policy.ts.hbs",
62
+ "auth-role.query.ts.hbs",
59
63
  "auth-role.query.ts.hbs",
60
64
  "auth-role.service.ts.hbs",
61
65
  ];
@@ -63,12 +67,13 @@ class TemplateCompiler {
63
67
  "user.interceptors.ts.hbs",
64
68
  "user.query.ts.hbs",
65
69
  "user.service.ts.hbs",
66
- "user.auth.ts.hbs",
70
+ "user.router.ts.hbs",
71
+ "user.policy.ts.hbs",
67
72
  ];
68
73
  if (config.prisma?.provider === "none")
69
74
  files.push(...authSharedPrismaFiles, ...dynamicAuthPrismaFiles, "schema.prisma.hbs", ...sharedAuthZodSchemaFiles, ...dynamicAuthZodSchemaFiles, ...sharedAuthClassValidatorDtoFiles, ...dynamicAuthClassValidatorDtoFiles, ...userModuleComponents, ...authModuleComponents, ...authPermissionModuleComponents, ...authRoleModuleComponents, ...userZodSchemaFiles, ...userClassValidatorDtoFiles, "file-upload.auth.ts.hbs", "index.ts.hbs");
70
75
  if (!config.authentication?.type || config.authentication?.type === "none")
71
- files.push(...authSharedPrismaFiles, ...dynamicAuthPrismaFiles, ...sharedAuthZodSchemaFiles, ...dynamicAuthZodSchemaFiles, ...sharedAuthClassValidatorDtoFiles, ...dynamicAuthClassValidatorDtoFiles, ...userModuleComponents, ...authModuleComponents, ...authPermissionModuleComponents, ...authRoleModuleComponents, ...userZodSchemaFiles, ...userClassValidatorDtoFiles, "file-upload.auth.ts.hbs");
76
+ files.push(...authSharedPrismaFiles, ...dynamicAuthPrismaFiles, ...sharedAuthZodSchemaFiles, ...dynamicAuthZodSchemaFiles, ...sharedAuthClassValidatorDtoFiles, ...dynamicAuthClassValidatorDtoFiles, ...userModuleComponents, ...authModuleComponents, ...authPermissionModuleComponents, ...authRoleModuleComponents, ...userZodSchemaFiles, ...userClassValidatorDtoFiles, "file-upload.router.ts.hbs", "file-upload.policy.ts.hbs");
72
77
  if (config.authentication?.type === "static")
73
78
  files.push(...dynamicAuthPrismaFiles, ...dynamicAuthZodSchemaFiles, ...dynamicAuthClassValidatorDtoFiles, ...authPermissionModuleComponents, ...authRoleModuleComponents);
74
79
  if (config.validation?.type !== "zod")
@@ -1 +1 @@
1
- {"version":3,"file":"template-compiler.js","sourceRoot":"","sources":["../../src/utils/template-compiler.ts"],"names":[],"mappings":"AACA,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,MAAM,IAAI,CAAC;AACpB,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,MAAM,gBAAgB;IACpB,KAAK,CAAC,iCAAiC,CAAC,MAAqB;QAC3D,OAAO,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;IACjC,CAAC;IAED,gBAAgB,CAAC,MAAqB;QACpC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,qBAAqB,GAAG,CAAC,iBAAiB,CAAC,CAAC;QAElD,MAAM,sBAAsB,GAAG;YAC7B,4BAA4B;YAC5B,sBAAsB;YACtB,sBAAsB;SACvB,CAAC;QAEF,MAAM,wBAAwB,GAAG;YAC/B,qBAAqB;YACrB,sBAAsB;YACtB,+BAA+B;YAC/B,yBAAyB;SAC1B,CAAC;QAEF,MAAM,yBAAyB,GAAG;YAChC,sCAAsC;YACtC,sCAAsC;YACtC,gCAAgC;YAChC,gCAAgC;SACjC,CAAC;QAEF,MAAM,kBAAkB,GAAG;YACzB,2BAA2B;YAC3B,2BAA2B;SAC5B,CAAC;QAEF,MAAM,0BAA0B,GAAG;YACjC,wBAAwB;YACxB,wBAAwB;SACzB,CAAC;QAEF,MAAM,gCAAgC,GAAG;YACvC,kBAAkB;YAClB,mBAAmB;YACnB,4BAA4B;YAC5B,sBAAsB;SACvB,CAAC;QAEF,MAAM,iCAAiC,GAAG;YACxC,mCAAmC;YACnC,mCAAmC;YACnC,6BAA6B;YAC7B,6BAA6B;SAC9B,CA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,CAAC;QAED,gBAAgB,CAAC,YAAY,CAAC,CAAC;IACjC,CAAC;CACF;AAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,eAAe,gBAAgB,CAAC","sourcesContent":["import { ProjectConfig } from \"./project-config-inquirer\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport handlebars from \"handlebars\";\n\nclass TemplateCompiler {\n async canCompileAuthenticationTemplates(config: ProjectConfig) {\n return !!config.authentication;\n }\n\n filesToBeSkipped(config: ProjectConfig) {\n const files: string[] = [];\n const authSharedPrismaFiles = [\"user.prisma.hbs\"];\n\n const dynamicAuthPrismaFiles = [\n \"auth-permission.prisma.hbs\",\n \"auth-role.prisma.hbs\",\n \"user-role.prisma.hbs\",\n ];\n\n const sharedAuthZodSchemaFiles = [\n \"login.schema.ts.hbs\",\n \"signup.schema.ts.hbs\",\n \"update-password.schema.ts.hbs\",\n \"update-me.schema.ts.hbs\",\n ];\n\n const dynamicAuthZodSchemaFiles = [\n \"create-auth-permission.schema.ts.hbs\",\n \"update-auth-permission.schema.ts.hbs\",\n \"create-auth-role.schema.ts.hbs\",\n \"update-auth-role.schema.ts.hbs\",\n ];\n\n const userZodSchemaFiles = [\n \"create-user.schema.ts.hbs\",\n \"update-user.schema.ts.hbs\",\n ];\n\n const userClassValidatorDtoFiles = [\n \"create-user.dto.ts.hbs\",\n \"update-user.dto.ts.hbs\",\n ];\n\n const sharedAuthClassValidatorDtoFiles = [\n \"login.dto.ts.hbs\",\n \"signup.dto.ts.hbs\",\n \"update-password.dto.ts.hbs\",\n \"update-me.dto.ts.hbs\",\n ];\n\n const dynamicAuthClassValidatorDtoFiles = [\n \"create-auth-permission.dto.ts.hbs\",\n \"update-auth-permission.dto.ts.hbs\",\n \"create-auth-role.dto.ts.hbs\",\n \"update-auth-role.dto.ts.hbs\",\n ];\n\n const authModuleComponents = [\n \"auth.interceptors.ts.hbs\",\n \"auth.query.ts.hbs\",\n ];\n\n const authPermissionModuleComponents = [\n \"auth-permission.auth.ts.hbs\",\n \"auth-permission.query.ts.hbs\",\n \"auth-permission.service.ts.hbs\",\n ];\n\n const authRoleModuleComponents = [\n \"auth-role.auth.ts.hbs\",\n \"auth-role.query.ts.hbs\",\n \"auth-role.service.ts.hbs\",\n ];\n\n const userModuleComponents = [\n \"user.interceptors.ts.hbs\",\n \"user.query.ts.hbs\",\n \"user.service.ts.hbs\",\n \"user.auth.ts.hbs\",\n ];\n\n if (config.prisma?.provider === \"none\")\n files.push(\n ...authSharedPrismaFiles,\n ...dynamicAuthPrismaFiles,\n \"schema.prisma.hbs\",\n ...sharedAuthZodSchemaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...sharedAuthClassValidatorDtoFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...userModuleComponents,\n ...authModuleComponents,\n ...authPermissionModuleComponents,\n ...authRoleModuleComponents,\n ...userZodSchemaFiles,\n ...userClassValidatorDtoFiles,\n \"file-upload.auth.ts.hbs\",\n \"index.ts.hbs\"\n );\n\n if (!config.authentication?.type || config.authentication?.type === \"none\")\n files.push(\n ...authSharedPrismaFiles,\n ...dynamicAuthPrismaFiles,\n ...sharedAuthZodSchemaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...sharedAuthClassValidatorDtoFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...userModuleComponents,\n ...authModuleComponents,\n ...authPermissionModuleComponents,\n ...authRoleModuleComponents,\n ...userZodSchemaFiles,\n ...userClassValidatorDtoFiles,\n \"file-upload.auth.ts.hbs\"\n );\n\n if (config.authentication?.type === \"static\")\n files.push(\n ...dynamicAuthPrismaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...authPermissionModuleComponents,\n ...authRoleModuleComponents\n );\n\n if (config.validation?.type !== \"zod\")\n files.push(\n ...sharedAuthZodSchemaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...userZodSchemaFiles,\n \"api-actions.hbs.ts\"\n );\n\n // Ignore class-validator related files when validation is zod\n if (config.validation?.type !== \"class-validator\")\n files.push(\n ...sharedAuthClassValidatorDtoFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...userClassValidatorDtoFiles\n );\n\n // Ignoring typescript related files when typescript false\n if (!config.typescript) files.push(...[\"tsconfig.json.hbs\"]);\n\n // Ignoring javascript related files when typescript true\n if (config?.typescript) files.push(...[\"jsconfig.json.hbs\"]);\n\n return files;\n }\n /**\n * Compiles the Arkos.js project with handlebars templates\n *\n * @param templatesDir {string} templates location\n * @param config {ProjectConfig} the project configuration\n * @returns void\n * */\n async compile(templatesDir: string, config: ProjectConfig) {\n const outputDir = config.projectPath;\n const isTypescript = config.typescript;\n const filesToBeSkipped = this.filesToBeSkipped(config);\n\n function processTemplates(dir: string, relativeDir = \"\") {\n fs.readdirSync(dir, { withFileTypes: true }).forEach(async (dirent) => {\n if (\n filesToBeSkipped.includes(dirent.name) ||\n dirent.name === \"__tests__\" ||\n dirent.name?.includes(\".test.ts\")\n )\n return;\n\n const fullPath = path.join(dir, dirent.name);\n const relativePath = path.join(relativeDir, dirent.name);\n\n if (dirent.isDirectory()) {\n processTemplates(fullPath, relativePath);\n } else if (dirent.name.endsWith(\".hbs\")) {\n const templatePath = fullPath;\n const template = handlebars.compile(\n fs.readFileSync(templatePath, \"utf8\")\n );\n\n let arkosCurrentVersion = \"{{arkosCurrentVersion}}\";\n\n const content = template({ ...config, arkosCurrentVersion });\n const ext = isTypescript ? \".ts\" : \".js\";\n\n let outputPath = path.join(\n outputDir,\n relativePath.replace(\".hbs\", \"\")\n );\n if (dirent.name.endsWith(\".ts.hbs\"))\n outputPath = path.join(\n outputDir,\n relativePath.replace(\".ts.hbs\", ext)\n );\n\n fs.mkdirSync(path.dirname(outputPath), { recursive: true });\n fs.writeFileSync(outputPath, content);\n }\n });\n }\n\n processTemplates(templatesDir);\n }\n}\n\nconst templateCompiler = new TemplateCompiler();\n\nexport default templateCompiler;\n"]}
1
+ {"version":3,"file":"template-compi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gB,CAAC","sourcesContent":["import { ProjectConfig } from \"./project-config-inquirer\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport handlebars from \"handlebars\";\n\nclass TemplateCompiler {\n async canCompileAuthenticationTemplates(config: ProjectConfig) {\n return !!config.authentication;\n }\n\n filesToBeSkipped(config: ProjectConfig) {\n const files: string[] = [];\n const authSharedPrismaFiles = [\"user.prisma.hbs\"];\n\n const dynamicAuthPrismaFiles = [\n \"auth-permission.prisma.hbs\",\n \"auth-role.prisma.hbs\",\n \"user-role.prisma.hbs\",\n ];\n\n const sharedAuthZodSchemaFiles = [\n \"login.schema.ts.hbs\",\n \"signup.schema.ts.hbs\",\n \"update-password.schema.ts.hbs\",\n \"update-me.schema.ts.hbs\",\n ];\n\n const dynamicAuthZodSchemaFiles = [\n \"create-auth-permission.schema.ts.hbs\",\n \"update-auth-permission.schema.ts.hbs\",\n \"create-auth-role.schema.ts.hbs\",\n \"update-auth-role.schema.ts.hbs\",\n ];\n\n const userZodSchemaFiles = [\n \"create-user.schema.ts.hbs\",\n \"update-user.schema.ts.hbs\",\n ];\n\n const userClassValidatorDtoFiles = [\n \"create-user.dto.ts.hbs\",\n \"update-user.dto.ts.hbs\",\n ];\n\n const sharedAuthClassValidatorDtoFiles = [\n \"login.dto.ts.hbs\",\n \"signup.dto.ts.hbs\",\n \"update-password.dto.ts.hbs\",\n \"update-me.dto.ts.hbs\",\n ];\n\n const dynamicAuthClassValidatorDtoFiles = [\n \"create-auth-permission.dto.ts.hbs\",\n \"update-auth-permission.dto.ts.hbs\",\n \"create-auth-role.dto.ts.hbs\",\n \"update-auth-role.dto.ts.hbs\",\n ];\n\n const authModuleComponents = [\n \"auth.interceptors.ts.hbs\",\n \"auth.query.ts.hbs\",\n ];\n\n const authPermissionModuleComponents = [\n \"auth-permission.router.ts.hbs\",\n \"auth-permission.policy.ts.hbs\",\n \"auth-permission.query.ts.hbs\",\n\n \"auth-permission.query.ts.hbs\",\n \"auth-permission.service.ts.hbs\",\n ];\n\n const authRoleModuleComponents = [\n \"auth-role.router.ts.hbs\",\n \"auth-role.policy.ts.hbs\",\n \"auth-role.query.ts.hbs\",\n\n \"auth-role.query.ts.hbs\",\n \"auth-role.service.ts.hbs\",\n ];\n\n const userModuleComponents = [\n \"user.interceptors.ts.hbs\",\n \"user.query.ts.hbs\",\n \"user.service.ts.hbs\",\n \"user.router.ts.hbs\",\n \"user.policy.ts.hbs\",\n ];\n\n if (config.prisma?.provider === \"none\")\n files.push(\n ...authSharedPrismaFiles,\n ...dynamicAuthPrismaFiles,\n \"schema.prisma.hbs\",\n ...sharedAuthZodSchemaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...sharedAuthClassValidatorDtoFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...userModuleComponents,\n ...authModuleComponents,\n ...authPermissionModuleComponents,\n ...authRoleModuleComponents,\n ...userZodSchemaFiles,\n ...userClassValidatorDtoFiles,\n \"file-upload.auth.ts.hbs\",\n \"index.ts.hbs\"\n );\n\n if (!config.authentication?.type || config.authentication?.type === \"none\")\n files.push(\n ...authSharedPrismaFiles,\n ...dynamicAuthPrismaFiles,\n ...sharedAuthZodSchemaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...sharedAuthClassValidatorDtoFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...userModuleComponents,\n ...authModuleComponents,\n ...authPermissionModuleComponents,\n ...authRoleModuleComponents,\n ...userZodSchemaFiles,\n ...userClassValidatorDtoFiles,\n \"file-upload.router.ts.hbs\",\n \"file-upload.policy.ts.hbs\"\n );\n\n if (config.authentication?.type === \"static\")\n files.push(\n ...dynamicAuthPrismaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...authPermissionModuleComponents,\n ...authRoleModuleComponents\n );\n\n if (config.validation?.type !== \"zod\")\n files.push(\n ...sharedAuthZodSchemaFiles,\n ...dynamicAuthZodSchemaFiles,\n ...userZodSchemaFiles,\n \"api-actions.hbs.ts\"\n );\n\n // Ignore class-validator related files when validation is zod\n if (config.validation?.type !== \"class-validator\")\n files.push(\n ...sharedAuthClassValidatorDtoFiles,\n ...dynamicAuthClassValidatorDtoFiles,\n ...userClassValidatorDtoFiles\n );\n\n // Ignoring typescript related files when typescript false\n if (!config.typescript) files.push(...[\"tsconfig.json.hbs\"]);\n\n // Ignoring javascript related files when typescript true\n if (config?.typescript) files.push(...[\"jsconfig.json.hbs\"]);\n\n return files;\n }\n /**\n * Compiles the Arkos.js project with handlebars templates\n *\n * @param templatesDir {string} templates location\n * @param config {ProjectConfig} the project configuration\n * @returns void\n * */\n async compile(templatesDir: string, config: ProjectConfig) {\n const outputDir = config.projectPath;\n const isTypescript = config.typescript;\n const filesToBeSkipped = this.filesToBeSkipped(config);\n\n function processTemplates(dir: string, relativeDir = \"\") {\n fs.readdirSync(dir, { withFileTypes: true }).forEach(async (dirent) => {\n if (\n filesToBeSkipped.includes(dirent.name) ||\n dirent.name === \"__tests__\" ||\n dirent.name?.includes(\".test.ts\")\n )\n return;\n\n const fullPath = path.join(dir, dirent.name);\n const relativePath = path.join(relativeDir, dirent.name);\n\n if (dirent.isDirectory()) {\n processTemplates(fullPath, relativePath);\n } else if (dirent.name.endsWith(\".hbs\")) {\n const templatePath = fullPath;\n const template = handlebars.compile(\n fs.readFileSync(templatePath, \"utf8\")\n );\n\n let arkosCurrentVersion = \"{{arkosCurrentVersion}}\";\n\n const content = template({ ...config, arkosCurrentVersion });\n const ext = isTypescript ? \".ts\" : \".js\";\n\n let outputPath = path.join(\n outputDir,\n relativePath.replace(\".hbs\", \"\")\n );\n if (dirent.name.endsWith(\".ts.hbs\"))\n outputPath = path.join(\n outputDir,\n relativePath.replace(\".ts.hbs\", ext)\n );\n\n fs.mkdirSync(path.dirname(outputPath), { recursive: true });\n fs.writeFileSync(outputPath, content);\n }\n });\n }\n\n processTemplates(templatesDir);\n }\n}\n\nconst templateCompiler = new TemplateCompiler();\n\nexport default templateCompiler;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "create-arkos",
3
- "version": "1.5.10-beta",
3
+ "version": "1.6.0-beta.1",
4
4
  "type": "module",
5
5
  "description": "CLI for creating Arkos.js projects, see docs at www.arkosjs.com",
6
6
  "bin": {
@@ -26,7 +26,7 @@
26
26
  "bugs": {
27
27
  "url": "https://github.com/uanela/arkos/issues"
28
28
  },
29
- "homepage": "https://www.arkosjs.com/docs/cli/create-arkos",
29
+ "homepage": "https://www.arkosjs.com/docs/tooling/create-arkos",
30
30
  "files": ["dist", "templates", "cli.js", "README.md"],
31
31
  "devDependencies": {
32
32
  "@types/inquirer": "8.1.0",
@@ -42,7 +42,7 @@
42
42
  "@clack/prompts": "0.11.0",
43
43
  "@inquirer/prompts": "7.6.0",
44
44
  "chalk": "5.4.1",
45
- "handlebars": "4.7.8",
45
+ "handlebars": "^4.7.9",
46
46
  "inquirer": "8.2.6"
47
47
  }
48
48
  }
@@ -1,4 +1,4 @@
1
- This is a [Arkos.js](https://arkosjs.com) project scaffolded with [`create-arkos`](https://arkosjs.com/docs/cli/create-arkos).
1
+ This is a [Arkos.js](https://arkosjs.com) project scaffolded with [`create-arkos`](https://arkosjs.com/docs/tooling/cli/overviewcreate-arkos).
2
2
 
3
3
  ## Getting Started
4
4
 
@@ -1,11 +1,6 @@
1
- {{#if typescript}}
2
- import { ArkosConfig } from 'arkos'
1
+ import { defineConfig } from "arkos/config"
3
2
 
4
- const config: ArkosConfig = {
5
- {{else}}
6
- /** @type {import('arkos').ArkosConfig} */
7
- const config = {
8
- {{/if}}
3
+ const arkosConfig = defineConfig({
9
4
  {{#if (neq authentication.type "none")}}
10
5
  authentication: {
11
6
  mode: '{{authentication.type}}',
@@ -49,6 +44,6 @@ const config = {
49
44
  },
50
45
  },
51
46
  {{/if}}
52
- }
47
+ })
53
48
 
54
- export default config
49
+ export default arkosConfig
@@ -24,9 +24,10 @@
24
24
  {{/if}}
25
25
  },
26
26
  "dependencies": {
27
- "arkos": "1.5.10-beta",
27
+ "arkos": "1.6.0-beta",
28
28
  "express": "4.22.1",
29
29
  "@scalar/express-api-reference": "0.8.35",
30
+ "@scalar/api-reference": "1.50.0",
30
31
  {{#if (neq prisma.provider "none")}}
31
32
  "@prisma/client": "6.19.2"{{#if validation.type}},{{/if}}
32
33
  {{/if}}
@@ -1,5 +1,7 @@
1
1
  import arkos from 'arkos';
2
2
 
3
- arkos.init({
4
- use: [], // pass your additional middlewares/routers here
5
- });
3
+ const app = arkos()
4
+
5
+ app.set("trust proxy", 1)
6
+
7
+ app.listen()
@@ -0,0 +1,33 @@
1
+ import { ArkosPolicy } from "arkos";
2
+
3
+ const authPermissionPolicy = ArkosPolicy("auth-permission")
4
+ .rule("Create", {
5
+ {{#if (eq authentication.type "static")}}
6
+ roles: [],
7
+ {{/if}}
8
+ name: "Create Auth Permission",
9
+ description: "Permission to create new auth permission records",
10
+ })
11
+ .rule("View", {
12
+ {{#if (eq authentication.type "static")}}
13
+ roles: [],
14
+ {{/if}}
15
+ name: "View Auth Permission",
16
+ description: "Permission to view auth permission records",
17
+ })
18
+ .rule("Update", {
19
+ {{#if (eq authentication.type "static")}}
20
+ roles: [],
21
+ {{/if}}
22
+ name: "Update Auth Permission",
23
+ description: "Permission to update existing auth permission records",
24
+ })
25
+ .rule("Delete", {
26
+ {{#if (eq authentication.type "static")}}
27
+ roles: [],
28
+ {{/if}}
29
+ name: "Delete Auth Permission",
30
+ description: "Permission to delete auth permission records",
31
+ });
32
+
33
+ export default authPermissionPolicy;
@@ -0,0 +1,14 @@
1
+ import { ArkosRouter{{#if typescript}}, RouterConfig{{/if}} } from "arkos";
2
+ import authPermissionPolicy from "@/src/modules/auth-permission/auth-permission.policy";
3
+
4
+ export const config{{#if typescript}}: RouterConfig{{/if}} = {
5
+ createOne: { authentication: authPermissionPolicy.Create },
6
+ findMany: { authentication: authPermissionPolicy.View },
7
+ findOne: { authentication: authPermissionPolicy.View },
8
+ updateOne: { authentication: authPermissionPolicy.Update },
9
+ deleteOne: { authentication: authPermissionPolicy.Delete },
10
+ };
11
+
12
+ const authPermissionRouter = ArkosRouter({ openapi: { tags: ["Auth Permissions"] } });
13
+
14
+ export default authPermissionRouter;
@@ -0,0 +1,33 @@
1
+ import { ArkosPolicy } from "arkos";
2
+
3
+ const authRolePolicy = ArkosPolicy("auth-role")
4
+ .rule("Create", {
5
+ {{#if (eq authentication.type "static")}}
6
+ roles: [],
7
+ {{/if}}
8
+ name: "Create Auth Role",
9
+ description: "Permission to create new auth role records",
10
+ })
11
+ .rule("View", {
12
+ {{#if (eq authentication.type "static")}}
13
+ roles: [],
14
+ {{/if}}
15
+ name: "View Auth Role",
16
+ description: "Permission to view auth role records",
17
+ })
18
+ .rule("Update", {
19
+ {{#if (eq authentication.type "static")}}
20
+ roles: [],
21
+ {{/if}}
22
+ name: "Update Auth Role",
23
+ description: "Permission to update existing auth role records",
24
+ })
25
+ .rule("Delete", {
26
+ {{#if (eq authentication.type "static")}}
27
+ roles: [],
28
+ {{/if}}
29
+ name: "Delete Auth Role",
30
+ description: "Permission to delete auth role records",
31
+ });
32
+
33
+ export default authRolePolicy;
@@ -0,0 +1,14 @@
1
+ import { ArkosRouter{{#if typescript}}, RouterConfig{{/if}} } from "arkos";
2
+ import authRolePolicy from "@/src/modules/auth-role/auth-role.policy";
3
+
4
+ export const config{{#if typescript}}: RouterConfig{{/if}} = {
5
+ createOne: { authentication: authRolePolicy.Create },
6
+ findMany: { authentication: authRolePolicy.View },
7
+ findOne: { authentication: authRolePolicy.View },
8
+ updateOne: { authentication: authRolePolicy.Update },
9
+ deleteOne: { authentication: authRolePolicy.Delete },
10
+ };
11
+
12
+ const authRoleRouter = ArkosRouter({ openapi: { tags: ["Auth Roles"] } });
13
+
14
+ export default authRoleRouter;
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- {{#if typescript}}
3
- import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission.schema"
4
- {{else}}
5
- import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission.schema.js"
6
- {{/if}}
2
+ import CreateAuthPermissionSchema from "@/src/modules/auth-permission/schemas/create-auth-permission.schema"
7
3
 
8
4
  const CreateAuthRoleSchema = z.object({
9
5
  name: z.string().min(1, 'Role name is required'),
@@ -1,9 +1,5 @@
1
1
  import { z } from 'zod';
2
- {{#if typescript}}
3
- import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission.schema"
4
- {{else}}
5
- import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission.schema.js"
6
- {{/if}}
2
+ import CreateAuthPermissionSchema from "@/src/modules/auth-permission/schemas/create-auth-permission.schema"
7
3
 
8
4
  const UpdateAuthRoleSchema = z.object({
9
5
  name: z.string().min(1, "Role name is required"),
@@ -0,0 +1,33 @@
1
+ import { ArkosPolicy } from "arkos";
2
+
3
+ const fileUploadPolicy = ArkosPolicy("file-upload")
4
+ .rule("Create", {
5
+ {{#if (eq authentication.type "static")}}
6
+ roles: [],
7
+ {{/if}}
8
+ name: "Upload File",
9
+ description: "Permission to upload new files",
10
+ })
11
+ .rule("View", {
12
+ {{#if (eq authentication.type "static")}}
13
+ roles: [],
14
+ {{/if}}
15
+ name: "View File",
16
+ description: "Permission to view uploaded files",
17
+ })
18
+ .rule("Update", {
19
+ {{#if (eq authentication.type "static")}}
20
+ roles: [],
21
+ {{/if}}
22
+ name: "Update File",
23
+ description: "Permission to update file metadata",
24
+ })
25
+ .rule("Delete", {
26
+ {{#if (eq authentication.type "static")}}
27
+ roles: [],
28
+ {{/if}}
29
+ name: "Delete File",
30
+ description: "Permission to delete uploaded files",
31
+ });
32
+
33
+ export default fileUploadPolicy;
@@ -0,0 +1,13 @@
1
+ import { ArkosRouter{{#if typescript}}, RouterConfig{{/if}} } from "arkos";
2
+ import fileUploadPolicy from "@/src/modules/file-upload/file-upload.policy";
3
+
4
+ export const config{{#if typescript}}: RouterConfig<"file-upload">{{/if}} = {
5
+ findFile: { authentication: fileUploadPolicy.View },
6
+ uploadFile: { authentication: fileUploadPolicy.Create },
7
+ updateFile: { authentication: fileUploadPolicy.Update },
8
+ deleteFile: { authentication: fileUploadPolicy.Delete },
9
+ };
10
+
11
+ const fileUploadRouter = ArkosRouter({ openapi: { tags: ["File Uploads"] } });
12
+
13
+ export default fileUploadRouter;
@@ -11,11 +11,7 @@ import {
11
11
  IsEnum
12
12
  } from 'class-validator'
13
13
  import { Type } from 'class-transformer'
14
- {{#if typescript}}
15
- import apiActions from "../../../utils/validation/api-actions"
16
- {{else}}
17
- import apiActions from "../../../utils/validation/api-actions.js"
18
- {{/if}}
14
+ import apiActions from "@/src/utils/validation/api-actions"
19
15
  {{#if (eq authentication.type "static")}}
20
16
  {{#if (neq prisma.provider "sqlite")}}
21
17
  import { UserRole } from "@prisma/client"
@@ -1,9 +1,5 @@
1
1
  import { z } from "zod"
2
- {{#if typescript}}
3
- import apiActions from "../../../utils/validation/api-actions"
4
- {{else}}
5
- import apiActions from "../../../utils/validation/api-actions.js"
6
- {{/if}}
2
+ import apiActions from "@/src/utils/validation/api-actions"
7
3
  {{#if (eq authentication.type "static")}}
8
4
  {{#if (neq prisma.provider "sqlite")}}
9
5
  import { UserRole } from "@prisma/client"
@@ -1,4 +1,3 @@
1
- {{#if typescript}}
2
1
  export const beforeCreateOne = [];
3
2
 
4
3
  export const afterCreateOne = [];
@@ -46,52 +45,3 @@ export const beforeDeleteMany = [];
46
45
  export const afterDeleteMany = [];
47
46
 
48
47
  export const onDeleteManyError = [];
49
- {{else}}
50
- export const beforeCreateOne = [];
51
-
52
- export const afterCreateOne = [];
53
-
54
- export const onCreateOneError = [];
55
-
56
- export const beforeFindOne = [];
57
-
58
- export const afterFindOne = [];
59
-
60
- export const onFindOneError = [];
61
-
62
- export const beforeFindMany = [];
63
-
64
- export const afterFindMany = [];
65
-
66
- export const onFindManyError = [];
67
-
68
- export const beforeUpdateOne = [];
69
-
70
- export const afterUpdateOne = [];
71
-
72
- export const onUpdateOneError = [];
73
-
74
- export const beforeDeleteOne = [];
75
-
76
- export const afterDeleteOne = [];
77
-
78
- export const onDeleteOneError = [];
79
-
80
- export const beforeCreateMany = [];
81
-
82
- export const afterCreateMany = [];
83
-
84
- export const onCreateManyError = [];
85
-
86
- export const beforeUpdateMany = [];
87
-
88
- export const afterUpdateMany = [];
89
-
90
- export const onUpdateManyError = [];
91
-
92
- export const beforeDeleteMany = [];
93
-
94
- export const afterDeleteMany = [];
95
-
96
- export const onDeleteManyError = [];
97
- {{/if}}
@@ -0,0 +1,33 @@
1
+ import { ArkosPolicy } from "arkos";
2
+
3
+ const userPolicy = ArkosPolicy("user")
4
+ .rule("Create", {
5
+ {{#if (eq authentication.type "static")}}
6
+ roles: [],
7
+ {{/if}}
8
+ name: "Create User",
9
+ description: "Permission to create new user records",
10
+ })
11
+ .rule("View", {
12
+ {{#if (eq authentication.type "static")}}
13
+ roles: [],
14
+ {{/if}}
15
+ name: "View User",
16
+ description: "Permission to view user records",
17
+ })
18
+ .rule("Update", {
19
+ {{#if (eq authentication.type "static")}}
20
+ roles: [],
21
+ {{/if}}
22
+ name: "Update User",
23
+ description: "Permission to update existing user records",
24
+ })
25
+ .rule("Delete", {
26
+ {{#if (eq authentication.type "static")}}
27
+ roles: [],
28
+ {{/if}}
29
+ name: "Delete User",
30
+ description: "Permission to delete user records",
31
+ });
32
+
33
+ export default userPolicy;
@@ -0,0 +1,14 @@
1
+ import { ArkosRouter{{#if typescript}}, RouterConfig{{/if}} } from "arkos";
2
+ import userPolicy from "@/src/modules/user/user.policy";
3
+
4
+ export const config{{#if typescript}}: RouterConfig{{/if}} = {
5
+ createOne: { authentication: userPolicy.Create },
6
+ findMany: { authentication: userPolicy.View },
7
+ findOne: { authentication: userPolicy.View },
8
+ updateOne: { authentication: userPolicy.Update },
9
+ deleteOne: { authentication: userPolicy.Delete },
10
+ };
11
+
12
+ const userRouter = ArkosRouter({ openapi: { tags: ["Users"] } });
13
+
14
+ export default userRouter;
@@ -1,75 +0,0 @@
1
- {{#if typescript}}
2
- import { AuthConfigs } from "arkos/auth";
3
- {{/if}}
4
- import { authService } from "arkos/services";
5
-
6
- export const authPermissionAccessControl = {
7
- Create: {
8
- roles: [],
9
- name: "Create Auth Permission",
10
- description: "Permission to create new auth permission records",
11
- },
12
- Update: {
13
- roles: [],
14
- name: "Update Auth Permission",
15
- description: "Permission to update existing auth permission records",
16
- },
17
- Delete: {
18
- roles: [],
19
- name: "Delete Auth Permission",
20
- description: "Permission to delete auth permission records",
21
- },
22
- View: {
23
- roles: [],
24
- name: "View Auth Permission",
25
- description: "Permission to view auth permission records",
26
- },
27
- }{{#if typescript}} as const satisfies AuthConfigs["accessControl"]{{/if}};
28
-
29
- {{#if advanced}}
30
- {{#if typescript}}
31
- type AuthPermissionPermissionName = `can${keyof typeof authPermissionAccessControl & string}`;
32
-
33
- {{/if}}
34
- export const authPermissionPermissions = Object.keys(authPermissionAccessControl).reduce(
35
- (acc, key) => {
36
- acc[`can${key}`{{#if typescript}} as AuthPermissionPermissionName{{/if}}] = authService.permission(
37
- key,
38
- "auth-permission",
39
- authPermissionAccessControl
40
- );
41
- return acc;
42
- },
43
- {}{{#if typescript}} as Record<AuthPermissionPermissionName, ReturnType<typeof authService.permission>>{{/if}}
44
- ){{#if typescript}} as {
45
- [K in keyof typeof authPermissionAccessControl as `can${K & string}`]: ReturnType<
46
- typeof authService.permission
47
- >;
48
- }{{/if}};
49
- {{else}}
50
- export const authPermissionPermissions = {
51
- canCreate: authService.permission("Create", "auth-permission"),
52
- canUpdate: authService.permission("Update", "auth-permission"),
53
- canDelete: authService.permission("Delete", "auth-permission"),
54
- canView: authService.permission("View", "auth-permission"),
55
- };
56
- {{/if}}
57
-
58
- export const authPermissionAuthenticationControl = {
59
- Create: true,
60
- Update: true,
61
- Delete: true,
62
- View: true,
63
- };
64
-
65
- {{#if typescript}}
66
- const authPermissionAuthConfigs: AuthConfigs = {
67
- {{else}}
68
- /** @type {import('arkos/auth').AuthConfigs} */
69
- const authPermissionAuthConfigs = {
70
- {{/if}}
71
- authenticationControl: authPermissionAuthenticationControl,
72
- accessControl: authPermissionAccessControl,
73
- };
74
-
75
- export default authPermissionAuthConfigs;
@@ -1,75 +0,0 @@
1
- {{#if typescript}}
2
- import { AuthConfigs } from "arkos/auth";
3
- {{/if}}
4
- import { authService } from "arkos/services";
5
-
6
- export const authRoleAccessControl = {
7
- Create: {
8
- roles: [],
9
- name: "Create Role Permission",
10
- description: "Permission to create new auth permission records",
11
- },
12
- Update: {
13
- roles: [],
14
- name: "Update Role Permission",
15
- description: "Permission to update existing auth permission records",
16
- },
17
- Delete: {
18
- roles: [],
19
- name: "Delete Role Permission",
20
- description: "Permission to delete auth permission records",
21
- },
22
- View: {
23
- roles: [],
24
- name: "View Role Permission",
25
- description: "Permission to view auth permission records",
26
- },
27
- }{{#if typescript}} as const satisfies AuthConfigs["accessControl"]{{/if}};
28
-
29
- {{#if advanced}}
30
- {{#if typescript}}
31
- type AuthRolePermissionName = `can${keyof typeof authRoleAccessControl & string}`;
32
-
33
- {{/if}}
34
- export const authRolePermissions = Object.keys(authRoleAccessControl).reduce(
35
- (acc, key) => {
36
- acc[`can${key}`{{#if typescript}} as AuthRolePermissionName{{/if}}] = authService.permission(
37
- key,
38
- "auth-role",
39
- authRoleAccessControl
40
- );
41
- return acc;
42
- },
43
- {}{{#if typescript}} as Record<AuthRolePermissionName, ReturnType<typeof authService.permission>>{{/if}}
44
- ){{#if typescript}} as {
45
- [K in keyof typeof authRoleAccessControl as `can${K & string}`]: ReturnType<
46
- typeof authService.permission
47
- >;
48
- }{{/if}};
49
- {{else}}
50
- export const authRolePermissions = {
51
- canCreate: authService.permission("Create", "auth-role"),
52
- canUpdate: authService.permission("Update", "auth-role"),
53
- canDelete: authService.permission("Delete", "auth-role"),
54
- canView: authService.permission("View", "auth-role"),
55
- };
56
- {{/if}}
57
-
58
- export const authRoleAuthenticationControl = {
59
- Create: true,
60
- Update: true,
61
- Delete: true,
62
- View: true,
63
- };
64
-
65
- {{#if typescript}}
66
- const authRoleAuthConfigs: AuthConfigs = {
67
- {{else}}
68
- /** @type {import('arkos/auth').AuthConfigs} */
69
- const authRoleAuthConfigs = {
70
- {{/if}}
71
- authenticationControl: authRoleAuthenticationControl,
72
- accessControl: authRoleAccessControl,
73
- };
74
-
75
- export default authRoleAuthConfigs;
@@ -1,83 +0,0 @@
1
- {{#if typescript}}
2
- import { AuthConfigs } from "arkos/auth";
3
- {{/if}}
4
- import { authService } from "arkos/services";
5
-
6
- export const fileUploadAccessControl = {
7
- Create: {
8
- {{#if (eq authentication.type "static")}}
9
- roles: [],
10
- {{/if}}
11
- name: "Upload File",
12
- description: "Permission to upload file"
13
- },
14
- Update: {
15
- {{#if (eq authentication.type "static")}}
16
- roles: [],
17
- {{/if}}
18
- name: "Update File",
19
- description: "Permission to update file"
20
- },
21
- Delete: {
22
- {{#if (eq authentication.type "static")}}
23
- roles: [],
24
- {{/if}}
25
- name: "Delete File",
26
- description: "Permission to delete file"
27
- },
28
- View: {
29
- {{#if (eq authentication.type "static")}}
30
- roles: [],
31
- {{/if}}
32
- name: "View File",
33
- description: "Permission to view file"
34
- },
35
- }{{#if typescript}} as const satisfies AuthConfigs["accessControl"]{{/if}};
36
-
37
- {{#if advanced}}
38
- {{#if typescript}}
39
- type FileUploadPermissionName = `can${keyof typeof fileUploadAccessControl & string}`;
40
-
41
- {{/if}}
42
- export const fileUploadPermissions = Object.keys(fileUploadAccessControl).reduce(
43
- (acc, key) => {
44
- acc[`can${key}`{{#if typescript}} as FileUploadPermissionName{{/if}}] = authService.permission(
45
- key,
46
- "file-upload",
47
- fileUploadAccessControl
48
- );
49
- return acc;
50
- },
51
- {}{{#if typescript}} as Record<FileUploadPermissionName, ReturnType<typeof authService.permission>>{{/if}}
52
- ){{#if typescript}} as {
53
- [K in keyof typeof fileUploadAccessControl as `can${K & string}`]: ReturnType<
54
- typeof authService.permission
55
- >;
56
- }{{/if}};
57
- {{else}}
58
- export const fileUploadPermissions = {
59
- canCreate: authService.permission("Create", "file-upload"),
60
- canUpdate: authService.permission("Update", "file-upload"),
61
- canDelete: authService.permission("Delete", "file-upload"),
62
- canView: authService.permission("View", "file-upload"),
63
- };
64
- {{/if}}
65
-
66
- export const fileUploadAuthenticationControl = {
67
- Create: true,
68
- Update: true,
69
- Delete: true,
70
- View: true,
71
- };
72
-
73
- {{#if typescript}}
74
- const fileUploadAuthConfigs: AuthConfigs = {
75
- {{else}}
76
- /** @type {import('arkos/auth').AuthConfigs} */
77
- const fileUploadAuthConfigs = {
78
- {{/if}}
79
- authenticationControl: fileUploadAuthenticationControl,
80
- accessControl: fileUploadAccessControl,
81
- };
82
-
83
- export default fileUploadAuthConfigs;
@@ -1,75 +0,0 @@
1
- {{#if typescript}}
2
- import { AuthConfigs } from "arkos/auth";
3
- {{/if}}
4
- import { authService } from "arkos/services";
5
-
6
- export const userAccessControl = {
7
- Create: {
8
- roles: [],
9
- name: "Create User",
10
- description: "Permission to create new user records",
11
- },
12
- Update: {
13
- roles: [],
14
- name: "Update User",
15
- description: "Permission to update existing user records",
16
- },
17
- Delete: {
18
- roles: [],
19
- name: "Delete User",
20
- description: "Permission to delete user records",
21
- },
22
- View: {
23
- roles: [],
24
- name: "View User",
25
- description: "Permission to view user records",
26
- },
27
- }{{#if typescript}} as const satisfies AuthConfigs["accessControl"]{{/if}};
28
-
29
- {{#if advanced}}
30
- {{#if typescript}}
31
- type UserPermissionName = `can${keyof typeof userAccessControl & string}`;
32
-
33
- {{/if}}
34
- export const userPermissions = Object.keys(userAccessControl).reduce(
35
- (acc, key) => {
36
- acc[`can${key}`{{#if typescript}} as UserPermissionName{{/if}}] = authService.permission(
37
- key,
38
- "user",
39
- userAccessControl
40
- );
41
- return acc;
42
- },
43
- {}{{#if typescript}} as Record<UserPermissionName, ReturnType<typeof authService.permission>>{{/if}}
44
- ){{#if typescript}} as {
45
- [K in keyof typeof userAccessControl as `can${K & string}`]: ReturnType<
46
- typeof authService.permission
47
- >;
48
- }{{/if}};
49
- {{else}}
50
- export const userPermissions = {
51
- canCreate: authService.permission("Create", "user"),
52
- canUpdate: authService.permission("Update", "user"),
53
- canDelete: authService.permission("Delete", "user"),
54
- canView: authService.permission("View", "user"),
55
- };
56
- {{/if}}
57
-
58
- export const userAuthenticationControl = {
59
- Create: true,
60
- Update: true,
61
- Delete: true,
62
- View: true,
63
- };
64
-
65
- {{#if typescript}}
66
- const userAuthConfigs: AuthConfigs = {
67
- {{else}}
68
- /** @type {import('arkos/auth').AuthConfigs} */
69
- const userAuthConfigs = {
70
- {{/if}}
71
- authenticationControl: userAuthenticationControl,
72
- accessControl: userAccessControl,
73
- };
74
-
75
- export default userAuthConfigs;