@volcanicminds/backend 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@volcanicminds/backend",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "codename": "turin",
5
5
  "license": "MIT",
6
6
  "description": "The volcanic (minds) backend",
@@ -13,9 +13,9 @@
13
13
  "scripts": {
14
14
  "compile": "tsc",
15
15
  "preprod": "npm run compile",
16
- "prod": "node ./dist/index.js",
17
- "start": "ts-node ./lib/index.ts",
18
- "dev": "nodemon --exec \"ts-node\" ./lib/index.ts",
16
+ "prod": "node ./dist/server.js",
17
+ "start": "ts-node ./lib/server.ts",
18
+ "dev": "nodemon --exec \"ts-node\" ./lib/server.ts",
19
19
  "test": "jest test --config ./jest.config.js",
20
20
  "upgrade-deps": "npm-upgrade"
21
21
  },
@@ -46,7 +46,7 @@
46
46
  "type": "git",
47
47
  "url": "git+https://github.com/volcanicminds/volcanic-backend.git"
48
48
  },
49
- "homepage": "https://github.com/volcanicminds/volcanic-backend#readme",
49
+ "homepage": "https://volcanicminds.com",
50
50
  "bugs": {
51
51
  "url": "https://github.com/volcanicminds/volcanic-backend/issues"
52
52
  },
package/tsconfig.json CHANGED
@@ -5,28 +5,32 @@
5
5
  "files": true
6
6
  },
7
7
  "compilerOptions": {
8
- "target": "ESNext",
9
- "allowJs": true,
10
- "module": "CommonJS",
11
- "esModuleInterop": true,
12
- "lib": ["ES6"],
13
- "resolveJsonModule": true,
14
- "preserveConstEnums": true,
15
- "skipLibCheck": true /* Skip type checking of declaration files. */,
16
- "forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
17
- "moduleResolution": "node",
18
- "allowSyntheticDefaultImports": true,
19
- "strict": true,
8
+ "module": "commonjs",
9
+ "declaration": false,
10
+ "noImplicitAny": false,
11
+ "noUnusedLocals": false,
12
+ "removeComments": true,
13
+ "noLib": false,
14
+ "emitDecoratorMetadata": true,
15
+ "experimentalDecorators": true,
16
+ "useUnknownInCatchVariables": false,
17
+ "target": "es6",
20
18
  "sourceMap": true,
21
- "types": ["node"],
22
- "typeRoots": ["./node_modules/@types", "./types", "./lib/types"],
19
+ "allowJs": true,
23
20
  "outDir": "dist",
24
- "rootDirs": ["lib", "config", "types"],
25
- "baseUrl": ".",
21
+ "lib": ["es7"],
22
+
26
23
  "paths": {
27
- "*": ["*", "components/*"]
24
+ "@types": ["./types"]
28
25
  }
26
+ // "types": ["node"],
27
+ // "typeRoots": ["./node_modules/@types", "./types", "./lib/types"],
28
+ // "rootDirs": ["lib", "config", "types"],
29
+ // "baseUrl": ".",
30
+ // "paths": {
31
+ // "*": ["*", "components/*"]
32
+ // }
29
33
  },
30
- "include": ["./lib/*", "./lib/**/*", "./config/*", "./config/**/*", "./types/*", "./types/**/*"],
31
- "exclude": ["node_modules"]
34
+ "include": ["lib/**/*", "config/**/*", "types/**/*"],
35
+ "exclude": ["node_modules", "test/**/*"]
32
36
  }
package/types/global.d.ts CHANGED
@@ -1,66 +1,86 @@
1
- declare global {
2
- interface AuthenticatedUser {
3
- id: number
4
- name: string
5
- roles: string[]
6
- }
1
+ import { FastifyRequest, FastifyReply } from 'fastify'
7
2
 
8
- interface Role {
9
- code: string
10
- name: string
11
- description: string
12
- }
3
+ export interface AuthenticatedUser {
4
+ id: number
5
+ name: string
6
+ roles: string[]
7
+ }
13
8
 
14
- declare enum RoleKey {
15
- public = 'public',
16
- admin = 'admin',
17
- backoffice = 'backoffice'
18
- }
9
+ export interface Role {
10
+ code: string
11
+ name: string
12
+ description: string
13
+ }
19
14
 
20
- declare type Roles = {
21
- [key in RoleKey]: Role
22
- }
15
+ export declare enum RoleKey {
16
+ public = 'public',
17
+ admin = 'admin',
18
+ backoffice = 'backoffice'
19
+ }
20
+
21
+ export declare type Roles = {
22
+ [key in RoleKey]: Role
23
+ }
24
+
25
+ export interface RouteConfig {
26
+ title: string
27
+ description: string
28
+ enable: boolean
29
+ deprecated: boolean
30
+ version: string
31
+ params?: any
32
+ body?: any
33
+ response?: any
34
+ }
35
+
36
+ export interface Route {
37
+ method: string
38
+ path: string
39
+ handler: string
40
+ roles: Role[]
41
+ config?: RouteConfig
42
+ middlewares: string[]
43
+ }
23
44
 
24
- interface RouteConfig {
25
- title: string
26
- description: string
27
- enable: boolean
28
- deprecated: boolean
29
- version: string
45
+ export interface ConfiguredRoute {
46
+ enable: boolean
47
+ method: any
48
+ path: string
49
+ handler: any
50
+ file: string
51
+ func: any
52
+ base: string
53
+ middlewares: string[]
54
+ roles: Role[]
55
+ doc: {
56
+ summary?: string
57
+ description?: string
58
+ deprecated?: boolean
59
+ version?: string
30
60
  params?: any
31
61
  body?: any
32
62
  response?: any
33
63
  }
64
+ }
34
65
 
35
- interface Route {
36
- method: string
37
- path: string
38
- handler: string
39
- roles: Role[]
40
- config?: RouteConfig
41
- middlewares: string[]
66
+ declare module 'fastify' {
67
+ import { FastifyRequest } from 'fastify'
68
+ export interface FastifyRequest {
69
+ user?: AuthenticatedUser
42
70
  }
71
+ }
43
72
 
44
- interface ConfiguredRoute {
45
- enable: boolean
46
- method: any
47
- path: string
48
- handler: any
49
- file: string
50
- func: any
51
- base: string
52
- middlewares: string[]
53
- roles: Role[]
54
- doc: {
55
- summary?: string
56
- description?: string
57
- deprecated?: boolean
58
- version?: string
59
- params?: any
60
- body?: any
61
- response?: any
62
- }
63
- }
73
+ export interface FastifyRequest extends FastifyRequest {
74
+ user?: AuthenticatedUser
75
+ }
76
+
77
+ export interface FastifyReply extends FastifyReply {}
78
+
79
+ export interface global {}
80
+
81
+ declare global {
82
+ var log: any
83
+ var roles: Roles
64
84
  }
65
85
 
66
86
  export { global }