create-arkos 0.0.24-beta → 0.0.26-beta

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 (23) hide show
  1. package/dist/utils/template-compiler.js +10 -0
  2. package/dist/utils/template-compiler.js.map +1 -1
  3. package/package.json +1 -1
  4. package/templates/basic/package.json.hbs +1 -1
  5. package/templates/basic/prisma/schema/user.prisma.hbs +11 -10
  6. package/templates/basic/src/modules/auth/auth.query.ts.hbs +3 -0
  7. package/templates/basic/src/modules/auth/dtos/update-password.dto.ts.hbs +14 -0
  8. package/templates/basic/src/modules/auth/schemas/login.schema.ts.hbs +4 -0
  9. package/templates/basic/src/modules/auth/schemas/signup.schema.ts.hbs +4 -0
  10. package/templates/basic/src/modules/auth/schemas/update-password.schema.ts.hbs +15 -0
  11. package/templates/basic/src/modules/auth-permission/dtos/create-auth-permission.dto.ts.hbs +39 -0
  12. package/templates/basic/src/modules/auth-permission/dtos/update-auth-permission.dto.ts.hbs +29 -0
  13. package/templates/basic/src/modules/auth-permission/schemas/create-auth-permission.ts.hbs +28 -0
  14. package/templates/basic/src/modules/auth-permission/schemas/update-auth-permission.ts.hbs +25 -0
  15. package/templates/basic/src/modules/auth-role/dtos/create-auth-role.dto.ts.hbs +46 -0
  16. package/templates/basic/src/modules/auth-role/dtos/update-auth-role.dto.ts.hbs +55 -0
  17. package/templates/basic/src/modules/auth-role/schemas/create-auth-role.schema.ts.hbs +18 -0
  18. package/templates/basic/src/modules/auth-role/schemas/update-auth-role.schema.ts.hbs +18 -0
  19. package/templates/basic/src/modules/user/dtos/create-user.dto.ts.hbs +0 -1
  20. package/templates/basic/src/modules/user/dtos/update-user.dto.ts.hbs +6 -2
  21. package/templates/basic/src/modules/user/schemas/create-user.schema.ts.hbs +4 -1
  22. package/templates/basic/src/modules/user/schemas/update-user.schema.ts.hbs +8 -0
  23. package/templates/basic/src/modules/user/user.query.ts.hbs +3 -0
@@ -29,11 +29,21 @@ class TemplateCompiler {
29
29
  "login.schema.ts.hbs",
30
30
  "signup.schema.ts.hbs",
31
31
  "update-password.schema.ts.hbs",
32
+ "update-me.schema.ts.hbs",
33
+ "create-auth-permission.schema.ts.hbs",
34
+ "update-auth-permission.schema.ts.hbs",
35
+ "create-auth-role.schema.ts.hbs",
36
+ "update-auth-role.schema.ts.hbs",
32
37
  ];
33
38
  const classValidatorAuthDtoFiles = [
34
39
  "login.dto.ts.hbs",
35
40
  "signup.dto.ts.hbs",
36
41
  "update-password.dto.ts.hbs",
42
+ "update-me.dto.ts.hbs",
43
+ "create-auth-permission.dto.ts.hbs",
44
+ "update-auth-permission.dto.ts.hbs",
45
+ "create-auth-role.dto.ts.hbs",
46
+ "update-auth-role.dto.ts.hbs",
37
47
  ];
38
48
  const zodUserSchemaFiles = [
39
49
  "create-user.schema.ts.hbs",
@@ -1 +1 @@
1
- {"version":3,"file":"template-compiler.js","sourceRoot":"","sources":["../../src/utils/template-compiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AACA,gDAAwB;AACxB,4CAAoB;AACpB,4DAAoC;AACpC,uDAA6D;AAE7D,MAAM,gBAAgB;IACd,iCAAiC,CAAC,MAAqB;;YAC3D,OAAO,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;QACjC,CAAC;KAAA;IAED,gBAAgB,CAAC,MAAqB;;QACpC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,kBAAkB,GAAG;YACzB,qBAAqB;YACrB,sBAAsB;YACtB,+BAA+B;SAChC,CAAC;QAEF,MAAM,0BAA0B,GAAG;YACjC,kBAAkB;YAClB,mBAAmB;YACnB,4BAA4B;SAC7B,CAAC;QAEF,MAAM,kBAAkB,GAAG;YACzB,2BAA2B;YAC3B,2BAA2B;SAC5B,CAAC;QAEF,MAAM,6BAA6B,GAAG;YACpC,wBAAwB;YACxB,wBAAwB;SACzB,CAAC;QAEF,MAAM,cAAc,GAAG;YACrB,yBAAyB;YACzB,mBAAmB;YACnB,qBAAq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M,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;4BACjC,UAAU,GAAG,cAAI,CAAC,IAAI,CACpB,SAAS,EACT,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CACrC,CAAC;wBAEJ,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;wBAC5D,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;qBACvC;gBACH,CAAC,CAAA,CAAC,CAAC;YACL,CAAC;YAED,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACjC,CAAC;KAAA;CACF;AAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,kBAAe,gBAAgB,CAAC","sourcesContent":["import { ProjectConfig } from \"./project-config-inquirer\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport handlebars from \"handlebars\";\nimport { getNpmPackageVersion } from \"./helpers/npm.helpers\";\n\nclass TemplateCompiler {\n async canCompileAuthenticationTemplates(config: ProjectConfig) {\n return !!config.authentication;\n }\n\n filesToBeSkipped(config: ProjectConfig) {\n const files: string[] = [];\n const zodAuthSchemaFiles = [\n \"login.schema.ts.hbs\",\n \"signup.schema.ts.hbs\",\n \"update-password.schema.ts.hbs\",\n ];\n\n const classValidatorAuthDtoFiles = [\n \"login.dto.ts.hbs\",\n \"signup.dto.ts.hbs\",\n \"update-password.dto.ts.hbs\",\n ];\n\n const zodUserSchemaFiles = [\n \"create-user.schema.ts.hbs\",\n \"update-user.schema.ts.hbs\",\n ];\n\n const classValidatorUserSchemaFiles = [\n \"create-user.dto.ts.hbs\",\n \"update-user.dto.ts.hbs\",\n ];\n\n const userComponents = [\n \"user.middlewares.ts.hbs\",\n \"user.query.ts.hbs\",\n \"user.service.ts.hbs\",\n \"user.prisma.hbs\",\n ];\n\n const authComponents = [\n \"auth.middlewares.ts.hbs\",\n \"auth.query.ts.hbs\",\n \"auth-role.prisma.hbs\",\n \"auth-permission.prisma.hbs\",\n \"user-role.prisma.hbs\",\n ];\n\n // Ignoring auth relation files when auth is set to define later\n if (config.authentication?.type === \"define later\")\n files.push(\n ...userComponents,\n ...authComponents,\n ...zodAuthSchemaFiles,\n ...classValidatorAuthDtoFiles,\n ...zodUserSchemaFiles,\n ...classValidatorUserSchemaFiles\n );\n\n // Ignoring prisma models required only on dynamic authentication\n if (\n config.authentication?.type === \"static\" ||\n config.authentication?.type === \"define later\"\n )\n files.push(\n ...[\n \"auth-role.prisma.hbs\",\n \"auth-permission.prisma.hbs\",\n \"user-role.prisma.hbs\",\n ]\n );\n\n // Ignore zod related files when validation is class-validator\n if (config.validation.type !== \"zod\")\n files.push(...zodUserSchemaFiles, ...zodAuthSchemaFiles);\n\n // Ignore class-validator related files when validation is zod\n if (config.validation.type !== \"class-validator\")\n files.push(\n ...classValidatorUserSchemaFiles,\n ...classValidatorAuthDtoFiles\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 (filesToBeSkipped.includes(dirent.name)) 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 = getNpmPackageVersion(\"arkos\");\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-compiler.js","sourceRoot":"","sources":["../../src/utils/template-compiler.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAuJA,gDAAwB;AACxB,4CAAoB;AACpB,4DAAoC;AACpC,uDAA6D;AAE7D,MAAM,gBAAgB;IACd,iCAAiC,CAAC,MAAqB;;YAC3D,OAAO,CAAC,CAAC,MAAM,CAAC,cAAc,CAAC;QACjC,CAAC;KAAA;IAED,gBAAgB,CAAC,MAAqB;;QACpC,MAAM,KAAK,GAAa,EAAE,CAAC;QAC3B,MAAM,kBAAkB,GAAG;YACzB,qBAAqB;YACrB,sBAAsB;YACtB,+BAA+B;YAC/B,yBAAyB;YACzB,sCAAsC;YACtC,sCAAsC;YACtC,gCAAgC;YAChC,gCAAgC;SACjC,CAAC;QAEF,MAAM,0BAA0B,GAAG;YACjC,kBAAkB;YAClB,mBAAmB;YACnB,4BAA4B;YAC5B,sBAAsB;YACtB,mCAAmC;YACnC,mCAAmC;YACnC,6BAA6B;YAC7B,6BAA6B;SAC9B,CAAC;QAEF,MAAM,kBAAkB,GAAG;YACzB,2BAA2B;YAC3B,2BAA2B;SAC5B,CAAC;QAEF,MAAM,6BAA6B,GAAG;YACpC,wBAAwB;YACxB,wBAAwB;SACzB,CAAC;QAEF,MAAM,cAAc,GAAG;YACrB,yBAAyB;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ACjC,CAAC;wBACF,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC;4BACjC,UAAU,GAAG,cAAI,CAAC,IAAI,CACpB,SAAS,EACT,YAAY,CAAC,OAAO,CAAC,SAAS,EAAE,GAAG,CAAC,CACrC,CAAC;wBAEJ,YAAE,CAAC,SAAS,CAAC,cAAI,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;wBAC5D,YAAE,CAAC,aAAa,CAAC,UAAU,EAAE,OAAO,CAAC,CAAC;qBACvC;gBACH,CAAC,CAAA,CAAC,CAAC;YACL,CAAC;YAED,gBAAgB,CAAC,YAAY,CAAC,CAAC;QACjC,CAAC;KAAA;CACF;AAED,MAAM,gBAAgB,GAAG,IAAI,gBAAgB,EAAE,CAAC;AAEhD,kBAAe,gBAAgB,CAAC","sourcesContent":["// import { ProjectConfig } from \"./project-config-inquirer\";\n// import path from \"path\";\n// import fs from \"fs\";\n// import handlebars from \"handlebars\";\n// import { getNpmPackageVersion } from \"./helpers/npm.helpers\";\n\n// class TemplateCompiler {\n// async canCompileAuthenticationTemplates(config: ProjectConfig) {\n// return !!config.authentication;\n// }\n\n// filesToBeSkipped(config: ProjectConfig) {\n// const files: string[] = [];\n// const zodAuthSchemaFiles = [\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 classValidatorAuthDtoFiles = [\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 zodUserSchemaFiles = [\n// \"create-user.schema.ts.hbs\",\n// \"update-user.schema.ts.hbs\",\n// ];\n\n// const classValidatorUserSchemaFiles = [\n// \"create-user.dto.ts.hbs\",\n// \"update-user.dto.ts.hbs\",\n// ];\n\n// const userComponents = [\n// \"user.middlewares.ts.hbs\",\n// \"user.query.ts.hbs\",\n// \"user.service.ts.hbs\",\n// \"user.prisma.hbs\",\n// ];\n\n// const authComponents = [\n// \"auth.middlewares.ts.hbs\",\n// \"auth.query.ts.hbs\",\n// \"auth-role.prisma.hbs\",\n// \"auth-permission.prisma.hbs\",\n// \"user-role.prisma.hbs\",\n// ];\n\n// // Ignoring auth relation files when auth is set to define later\n// if (config.authentication?.type === \"define later\")\n// files.push(\n// ...userComponents,\n// ...authComponents,\n// ...zodAuthSchemaFiles,\n// ...classValidatorAuthDtoFiles,\n// ...zodUserSchemaFiles,\n// ...classValidatorUserSchemaFiles\n// );\n\n// // Ignoring prisma models required only on dynamic authentication\n// if (\n// config.authentication?.type === \"static\" ||\n// config.authentication?.type === \"define later\"\n// )\n// files.push(\n// ...[\n// \"auth-role.prisma.hbs\",\n// \"auth-permission.prisma.hbs\",\n// \"user-role.prisma.hbs\",\n// ]\n// );\n\n// // Ignore zod related files when validation is class-validator\n// if (config.validation.type !== \"zod\")\n// files.push(...zodUserSchemaFiles, ...zodAuthSchemaFiles);\n\n// // Ignore class-validator related files when validation is zod\n// if (config.validation.type !== \"class-validator\")\n// files.push(\n// ...classValidatorUserSchemaFiles,\n// ...classValidatorAuthDtoFiles\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 (filesToBeSkipped.includes(dirent.name)) 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 = getNpmPackageVersion(\"arkos\");\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\n// const templateCompiler = new TemplateCompiler();\n\n// export default templateCompiler;\nimport { ProjectConfig } from \"./project-config-inquirer\";\nimport path from \"path\";\nimport fs from \"fs\";\nimport handlebars from \"handlebars\";\nimport { getNpmPackageVersion } from \"./helpers/npm.helpers\";\n\nclass TemplateCompiler {\n async canCompileAuthenticationTemplates(config: ProjectConfig) {\n return !!config.authentication;\n }\n\n filesToBeSkipped(config: ProjectConfig) {\n const files: string[] = [];\n const zodAuthSchemaFiles = [\n \"login.schema.ts.hbs\",\n \"signup.schema.ts.hbs\",\n \"update-password.schema.ts.hbs\",\n \"update-me.schema.ts.hbs\",\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 classValidatorAuthDtoFiles = [\n \"login.dto.ts.hbs\",\n \"signup.dto.ts.hbs\",\n \"update-password.dto.ts.hbs\",\n \"update-me.dto.ts.hbs\",\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 zodUserSchemaFiles = [\n \"create-user.schema.ts.hbs\",\n \"update-user.schema.ts.hbs\",\n ];\n\n const classValidatorUserSchemaFiles = [\n \"create-user.dto.ts.hbs\",\n \"update-user.dto.ts.hbs\",\n ];\n\n const userComponents = [\n \"user.middlewares.ts.hbs\",\n \"user.query.ts.hbs\",\n \"user.service.ts.hbs\",\n \"user.prisma.hbs\",\n ];\n\n const authComponents = [\n \"auth.middlewares.ts.hbs\",\n \"auth.query.ts.hbs\",\n \"auth-role.prisma.hbs\",\n \"auth-permission.prisma.hbs\",\n \"user-role.prisma.hbs\",\n ];\n\n // Ignoring auth relation files when auth is set to define later\n if (config.authentication?.type === \"define later\")\n files.push(\n ...userComponents,\n ...authComponents,\n ...zodAuthSchemaFiles,\n ...classValidatorAuthDtoFiles,\n ...zodUserSchemaFiles,\n ...classValidatorUserSchemaFiles\n );\n\n // Ignoring prisma models required only on dynamic authentication\n if (\n config.authentication?.type === \"static\" ||\n config.authentication?.type === \"define later\"\n )\n files.push(\n ...[\n \"auth-role.prisma.hbs\",\n \"auth-permission.prisma.hbs\",\n \"user-role.prisma.hbs\",\n ]\n );\n\n // Ignore zod related files when validation is class-validator\n if (config.validation.type !== \"zod\")\n files.push(...zodUserSchemaFiles, ...zodAuthSchemaFiles);\n\n // Ignore class-validator related files when validation is zod\n if (config.validation.type !== \"class-validator\")\n files.push(\n ...classValidatorUserSchemaFiles,\n ...classValidatorAuthDtoFiles\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 (filesToBeSkipped.includes(dirent.name)) 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 = getNpmPackageVersion(\"arkos\");\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": "0.0.24-beta",
3
+ "version": "0.0.26-beta",
4
4
  "description": "CLI for creating Arkos.js projects, see docs at www.arkosjs.com",
5
5
  "bin": {
6
6
  "create-arkos": "./dist/index.js"
@@ -38,7 +38,7 @@
38
38
  "reflect-metadata": "^0.2.2",
39
39
  "class-transformer": "^0.5.1",
40
40
  "class-validator": "^0.14.1",
41
- "class-validator-jsonschema": "^5.0.2",
41
+ "class-validator-jsonschema": "^5.0.2"
42
42
  {{/if}}
43
43
  {{#if (eq validation.type "zod")}}
44
44
  "zod": "^3.24.2",
@@ -9,25 +9,26 @@ model User {
9
9
  deletedSelfAccountAt DateTime?
10
10
  isActive Boolean @default(true)
11
11
  {{#if authentication.multipleRoles}}
12
- {{#if (eq prisma.provider "sqlite")}}
12
+ {{#if (eq prisma.provider "sqlite")}}
13
+ {{#if (eq authentication.type "static")}}
13
14
  role String @default("User") // Roles examples: Admin, User
14
- {{else}}
15
+ {{else}}
15
16
  roles UserRole[]
16
- {{/if}}
17
+ {{/if}}
18
+ {{/if}}
17
19
  {{else}}
18
- {{#if (eq authentication.type "dynamic")}}
20
+ {{#if (eq authentication.type "dynamic")}}
19
21
  role UserRole?
20
- {{else}}
21
- {{#if (eq prisma.provider "sqlite")}}
22
+ {{else}}
23
+ {{#if (eq prisma.provider "sqlite")}}
22
24
  role String @default("User") // Roles examples: Admin, User
23
- {{else}}
25
+ {{else}}
24
26
  role UserRole @default(User)
25
- {{/if}}
26
- {{/if}}
27
+ {{/if}}
28
+ {{/if}}
27
29
  {{/if}}
28
30
  createdAt DateTime @default(now())
29
31
  updatedAt DateTime @updatedAt
30
-
31
32
  // other fields for your application
32
33
  }
33
34
 
@@ -4,6 +4,9 @@ import { AuthPrismaQueryOptions } from 'arkos/prisma';
4
4
 
5
5
  const authQueryOptions: AuthPrismaQueryOptions<typeof prisma.user> = {
6
6
  {{else}}
7
+ /**
8
+ * @type {import("arkos/prisma").PrismaQueryOptions<typeof import('../../utils/prisma').prisma.user>}
9
+ */
7
10
  const authQueryOptions = {
8
11
  {{/if}}
9
12
  getMe: {
@@ -0,0 +1,14 @@
1
+ import { IsString, MinLength, Matches, IsNotEmpty } from 'class-validator'
2
+ import "reflect-metadata"
3
+
4
+ export default class UpdatePasswordDto {
5
+ @IsString()
6
+ @IsNotEmpty()
7
+ currentPassword: string
8
+
9
+ @IsString()
10
+ @MinLength(8, { message: 'Password must be at least 8 characters long' })
11
+ @Matches(/[a-z]/, { message: 'Password must contain at least one lowercase letter' })
12
+ @Matches(/[A-Z]/, { message: 'Password must contain at least one uppercase letter' })
13
+ newPassword: string
14
+ }
@@ -9,3 +9,7 @@ const LoginSchema = z.object({
9
9
  })
10
10
 
11
11
  export default LoginSchema
12
+
13
+ {{#if typescript}}
14
+ export type LoginSchemaType = z.infer<typeof LoginSchema>
15
+ {{/if}}
@@ -10,3 +10,7 @@ const SignupSchema = z.object({
10
10
  })
11
11
 
12
12
  export default SignupSchema
13
+
14
+ {{#if typescript}}
15
+ export type SignupSchemaType = z.infer<typeof SignupSchema>
16
+ {{/if}}
@@ -0,0 +1,15 @@
1
+ import { z } from "zod"
2
+
3
+ const UpdatePasswordSchema = z.object({
4
+ currentPassword: z.string(),
5
+ newPassword: z.string()
6
+ .min(8, "Password must be at least 8 characters long")
7
+ .regex(/[a-z]/, "Password must contain at least one lowercase letter")
8
+ .regex(/[A-Z]/, "Password must contain at least one uppercase letter"),
9
+ })
10
+
11
+ export default UpdatePasswordSchema
12
+
13
+ {{#if typescript}}
14
+ export type UpdatePasswordSchemaType = z.infer<typeof UpdatePasswordSchema>
15
+ {{/if}}
@@ -0,0 +1,39 @@
1
+ import { IsString, IsNotEmpty, IsOptional, IsEnum, ValidateNested } from 'class-validator';
2
+ import { Type, Transform } from 'class-transformer';
3
+ import 'reflect-metadata'
4
+ {{#if (eq prisma.provider "sqlite")}}
5
+
6
+ export enum AuthPermissionAction {
7
+ View = 'View',
8
+ Create = 'Create',
9
+ Update = 'Update',
10
+ Delete = 'Delete'
11
+ }
12
+ {{else}}
13
+ import { AuthPermissionAction } from "@prisma/client"
14
+ {{/if}}
15
+
16
+ class RoleConnectDto {
17
+ @IsString()
18
+ @IsNotEmpty({ message: 'Role ID is required' })
19
+ id: string;
20
+ }
21
+
22
+ export default class CreateAuthPermissionDto {
23
+ @IsString()
24
+ @IsNotEmpty({ message: 'Resource is required' })
25
+ resource: string;
26
+
27
+ @IsEnum(AuthPermissionAction)
28
+ @Transform(({ value }) => value || AuthPermissionAction.View)
29
+ action: AuthPermissionAction = AuthPermissionAction.View;
30
+
31
+ @ValidateNested()
32
+ @Type(() => RoleConnectDto)
33
+ role: RoleConnectDto;
34
+
35
+ @IsOptional()
36
+ @IsString()
37
+ @Transform(({ value }) => value || "Allows to create a permission for a given role.")
38
+ description?: string = "Allows to create a permission for a given role.";
39
+ }
@@ -0,0 +1,29 @@
1
+ import { IsString, IsOptional, IsEnum } from 'class-validator';
2
+ import { Transform } from 'class-transformer';
3
+ import 'reflect-metadata'
4
+ {{#if (eq prisma.provider "sqlite")}}
5
+
6
+ export enum AuthPermissionAction {
7
+ View = 'View',
8
+ Create = 'Create',
9
+ Update = 'Update',
10
+ Delete = 'Delete'
11
+ }
12
+ {{else}}
13
+ import { AuthPermissionAction } from "@prisma/client"
14
+ {{/if}}
15
+
16
+ export default class UpdateAuthPermissionDto {
17
+ @IsOptional()
18
+ @IsString()
19
+ resource?: string;
20
+
21
+ @IsOptional()
22
+ @IsEnum(AuthPermissionAction)
23
+ @Transform(({ value }) => value || AuthPermissionAction.View)
24
+ action?: AuthPermissionAction = AuthPermissionAction.View;
25
+
26
+ @IsOptional()
27
+ @IsString()
28
+ description?: string;
29
+ }
@@ -0,0 +1,28 @@
1
+ import { z } from 'zod';
2
+ {{#if (eq prisma.provider "sqlite")}}
3
+
4
+ export const AuthPermissionActionEnum = z.enum([
5
+ 'View',
6
+ 'Create',
7
+ 'Update',
8
+ 'Delete'
9
+ ]);
10
+ {{else}}
11
+ import { AuthPermissionAction } from "@prisma/client"
12
+ export const AuthPermissionActionEnum = z.nativeEnum(AuthPermissionAction);
13
+ {{/if}}
14
+
15
+ const CreateAuthPermissionSchema = z.object({
16
+ resource: z.string().min(1, 'Resource is required'),
17
+ action: AuthPermissionActionEnum.default('View'),
18
+ role: z.object({
19
+ id: z.string().min(1, 'Role ID is required'),
20
+ }),
21
+ description: z.string().optional().default("Allows to create a permission for a given role."),
22
+ });
23
+
24
+ export default CreateAuthPermissionSchema
25
+
26
+ {{#if typescript}}
27
+ export type CreateAuthPermissionSchemaType = z.infer<typeof CreateAuthPermissionSchema>;
28
+ {{/if}}
@@ -0,0 +1,25 @@
1
+ import { z } from 'zod';
2
+ {{#if (eq prisma.provider "sqlite")}}
3
+
4
+ export const AuthPermissionActionEnum = z.enum([
5
+ 'View',
6
+ 'Create',
7
+ 'Update',
8
+ 'Delete'
9
+ ]);
10
+ {{else}}
11
+ import { AuthPermissionAction } from "@prisma/client"
12
+ export const AuthPermissionActionEnum = z.nativeEnum(AuthPermissionAction);
13
+ {{/if}}
14
+
15
+ const UpdateAuthPermissionSchema = z.object({
16
+ resource: z.string().optional(),
17
+ action: AuthPermissionActionEnum.default('View'),
18
+ description: z.string().optional(),
19
+ });
20
+
21
+ export default UpdateAuthPermissionSchema
22
+
23
+ {{#if typescript}}
24
+ export type UpdateAuthPermissionSchemaType = z.infer<typeof UpdateAuthPermissionSchema>;
25
+ {{/if}}
@@ -0,0 +1,46 @@
1
+ import { IsString, IsNotEmpty, IsOptional, IsArray, ValidateNested, IsEnum } from 'class-validator';
2
+ import { Type, Transform } from 'class-transformer';
3
+ import 'reflect-metadata'
4
+ {{#if (eq prisma.provider "sqlite")}}
5
+
6
+ export enum AuthPermissionAction {
7
+ View = 'View',
8
+ Create = 'Create',
9
+ Update = 'Update',
10
+ Delete = 'Delete'
11
+ }
12
+ {{else}}
13
+ import { AuthPermissionAction } from "@prisma/client"
14
+ {{/if}}
15
+
16
+ class CreatePermissionForRoleDto {
17
+ @IsString()
18
+ @IsNotEmpty({ message: 'Resource is required' })
19
+ resource: string;
20
+
21
+ @IsEnum(AuthPermissionAction)
22
+ @Transform(({ value }) => value || AuthPermissionAction.View)
23
+ action: AuthPermissionAction = AuthPermissionAction.View;
24
+
25
+ @IsOptional()
26
+ @IsString()
27
+ @Transform(({ value }) => value || "Allows to create a permission for a given role.")
28
+ description?: string = "Allows to create a permission for a given role.";
29
+ }
30
+
31
+ export default class CreateAuthRoleDto {
32
+ @IsString()
33
+ @IsNotEmpty({ message: 'Role name is required' })
34
+ name: string;
35
+
36
+ @IsOptional()
37
+ @IsString()
38
+ description?: string;
39
+
40
+ @IsOptional()
41
+ @IsArray()
42
+ @ValidateNested({ each: true })
43
+ @Type(() => CreatePermissionForRoleDto)
44
+ @Transform(({ value }) => value || [])
45
+ permissions?: CreatePermissionForRoleDto[] = [];
46
+ }
@@ -0,0 +1,55 @@
1
+ import { IsString, IsNotEmpty, IsOptional, IsArray, ValidateNested, IsEnum } from 'class-validator';
2
+ import { Type, Transform } from 'class-transformer';
3
+ import 'reflect-metadata'
4
+ {{#if (eq prisma.provider "sqlite")}}
5
+
6
+ export enum AuthPermissionAction {
7
+ View = 'View',
8
+ Create = 'Create',
9
+ Update = 'Update',
10
+ Delete = 'Delete'
11
+ }
12
+ {{else}}
13
+ import { AuthPermissionAction } from "@prisma/client"
14
+ {{/if}}
15
+
16
+ export enum ApiAction {
17
+ connect = 'connect',
18
+ delete = 'delete'
19
+ }
20
+
21
+ class UpdatePermissionForRoleDto {
22
+ @IsString()
23
+ @IsNotEmpty({ message: 'Resource is required' })
24
+ resource: string;
25
+
26
+ @IsEnum(AuthPermissionAction)
27
+ @Transform(({ value }) => value || AuthPermissionAction.View)
28
+ action: AuthPermissionAction = AuthPermissionAction.View;
29
+
30
+ @IsOptional()
31
+ @IsString()
32
+ @Transform(({ value }) => value || "Allows to create a permission for a given role.")
33
+ description?: string = "Allows to create a permission for a given role.";
34
+
35
+ @IsEnum(ApiAction)
36
+ @IsOptional()
37
+ apiAction: ApiAction;
38
+ }
39
+
40
+ export default class UpdateAuthRoleDto {
41
+ @IsString()
42
+ @IsNotEmpty({ message: 'Role name is required' })
43
+ name: string;
44
+
45
+ @IsOptional()
46
+ @IsString()
47
+ description?: string;
48
+
49
+ @IsOptional()
50
+ @IsArray()
51
+ @ValidateNested({ each: true })
52
+ @Type(() => UpdatePermissionForRoleDto)
53
+ @Transform(({ value }) => value || [])
54
+ permissions?: UpdatePermissionForRoleDto[] = [];
55
+ }
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ {{#if typescript}}
3
+ import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission"
4
+ {{else}}
5
+ import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission.js"
6
+ {{/if}}
7
+
8
+ const CreateAuthRoleSchema = z.object({
9
+ name: z.string().min(1, 'Role name is required'),
10
+ description: z.string().optional(),
11
+ permissions: z.array(CreatePermissionSchema.omit({ role: true })).optional().default([]),
12
+ });
13
+
14
+ export default CreateAuthRoleSchema
15
+
16
+ {{#if typescript}}
17
+ export type CreateAuthRoleSchemaType = z.infer<typeof CreateAuthRoleSchema>;
18
+ {{/if}}
@@ -0,0 +1,18 @@
1
+ import { z } from 'zod';
2
+ {{#if typescript}}
3
+ import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission"
4
+ {{else}}
5
+ import CreateAuthPermissionSchema from "../../auth-permission/schemas/create-auth-permission.js"
6
+ {{/if}}
7
+
8
+ const UpdateAuthRoleSchema = z.object({
9
+ name: z.string().min(1, 'Role name is required'),
10
+ description: z.string().optional(),
11
+ permissions: z.array(CreatePermissionSchema.omit({ role: true }).merge({ apiAction: z.enum(['connect', 'delete']).optional() })).optional().default([]),
12
+ });
13
+
14
+ export default UpdateAuthRoleSchema
15
+
16
+ {{#if typescript}}
17
+ export type UpdateAuthRoleSchemaType = z.infer<typeof UpdateAuthRoleSchema>;
18
+ {{/if}}
@@ -11,7 +11,6 @@ import {
11
11
  Type,
12
12
  IsEnum
13
13
  } from 'class-validator'
14
- import apiActions from "../../../utils/validation/api-actions"
15
14
  {{#if (eq authentication.type "static")}}
16
15
  {{#if (neq prisma.provider "sqlite")}}
17
16
  import { UserRole } from "@prisma/client"
@@ -11,11 +11,15 @@ import {
11
11
  Type,
12
12
  IsEnum
13
13
  } from 'class-validator'
14
+ {{#if typescript}}
14
15
  import apiActions from "../../../utils/validation/api-actions"
16
+ {{else}}
17
+ import apiActions from "../../../utils/validation/api-actions.js"
18
+ {{/if}}
15
19
  {{#if (eq authentication.type "static")}}
16
- {{#if (neq prisma.provider "sqlite")}}
20
+ {{#if (neq prisma.provider "sqlite")}}
17
21
  import { UserRole } from "@prisma/client"
18
- {{/if}}
22
+ {{/if}}
19
23
  {{/if}}
20
24
 
21
25
  {{#if (eq authentication.type "dynamic")}}
@@ -1,5 +1,4 @@
1
1
  import { z } from "zod"
2
- import apiActions from "../../../utils/validation/api-actions"
3
2
  {{#if (eq authentication.type "static")}}
4
3
  {{#if (neq prisma.provider "sqlite")}}
5
4
  import { UserRole } from "@prisma/client"
@@ -44,3 +43,7 @@ const CreateUserSchema = z.object({
44
43
  })
45
44
 
46
45
  export default CreateUserSchema
46
+
47
+ {{#if typescript}}
48
+ export type CreateUserSchemaType = z.infer<typeof CreateUserSchema>
49
+ {{/if}}
@@ -1,5 +1,9 @@
1
1
  import { z } from "zod"
2
+ {{#if typescript}}
2
3
  import apiActions from "../../../utils/validation/api-actions"
4
+ {{else}}
5
+ import apiActions from "../../../utils/validation/api-actions.js"
6
+ {{/if}}
3
7
  {{#if (eq authentication.type "static")}}
4
8
  {{#if (neq prisma.provider "sqlite")}}
5
9
  import { UserRole } from "@prisma/client"
@@ -44,3 +48,7 @@ const UpdateUserSchema = z.object({
44
48
  })
45
49
 
46
50
  export default UpdateUserSchema
51
+
52
+ {{#if typescript}}
53
+ export type UpdateUserSchemaType = z.infer<typeof UpdateUserSchema>
54
+ {{/if}}
@@ -4,6 +4,9 @@ import { PrismaQueryOptions } from 'arkos/prisma';
4
4
 
5
5
  const userQueryOptions: PrismaQueryOptions<typeof prisma.user> = {
6
6
  {{else}}
7
+ /**
8
+ * @type {import("arkos/prisma").PrismaQueryOptions<typeof import('../../utils/prisma').prisma.user>}
9
+ */
7
10
  const userQueryOptions = {
8
11
  {{/if}}
9
12
  global: {},