very-express 0.5.11 → 0.5.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,4 @@
1
+ // {{headerComment}}
1
2
  export class _ControllerFactory {
2
3
 
3
4
  constructor() {}
@@ -1,6 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
-
4
2
  import { Request, Response, NextFunction } from "express";
5
3
  import { JsonWebTokenError } from "jsonwebtoken";
6
4
  import * as jwt from "../_plugins/auth/jwt.gen";
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import dotenv from "dotenv";
4
3
  import { Algorithm } from "jsonwebtoken";
5
4
 
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import jwt from "jsonwebtoken";
4
3
  import ms from "ms";
5
4
  import JWTKeyStore from "./JWTKeyStore.gen";
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import { UserModel, UserDocument } from "./../../_models/UserModel.gen";
4
3
  import { User } from "./../../_types/User.gen";
5
4
  import profileMapping, { IProfile } from "./profileMapping.gen";
@@ -15,7 +14,7 @@ export default async function oauthVerify(accessToken: string, refreshToken: str
15
14
  // find user by authProfiles.authId or email
16
15
  const existingUser = await UserModel.findOne<UserDocument>({
17
16
  email: authUser.email,
18
- $or: authUser.authProfiles?.map((p) => {
17
+ $or: authUser.authProfiles?.map((p:any) => {
19
18
  return { "authProfiles.authId": p.authId };
20
19
  }),
21
20
  });
@@ -60,7 +59,7 @@ async function processExistingUser( authUser: User, existingUser: UserDocument):
60
59
  }
61
60
 
62
61
  // B.1. check current provider exist in authProfiles
63
- const providerExists = userProfiles.length > 0 && userProfiles.find((p) => {
62
+ const providerExists = userProfiles.length > 0 && userProfiles.find((p:any) => {
64
63
  return (p.provider === authProfile.provider) && (p.authId === authProfile.authId);
65
64
  });
66
65
 
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import { Profile } from "passport";
4
3
  import { User } from "./../../_types/User.gen";
5
4
 
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import { generateToken } from "./../auth/jwt.gen";
4
3
  import { UserDocument } from "./../../_models/UserModel.gen";
5
4
 
@@ -4,19 +4,19 @@ MONGODB_URI=mongodb://localhost:27017/veryExpressDB
4
4
  LOGIN_SUCCESS_REDIRECT_PATH=/logincallback
5
5
  LOGIN_FAILED_REDIRECT_PATH=/logincallback
6
6
 
7
+ # OAUTH
7
8
  OAUTH_GOOGLE_CLIENTID=
8
9
  OAUTH_GOOGLE_CLIENTSECRET=
9
-
10
10
  OAUTH_GITHUB_CLIENTID=
11
11
  OAUTH_GITHUB_CLIENTSECRET=
12
-
12
+ # OAUTH_MICROSOFT_CLIENTID=
13
+ # OAUTH_MICROSOFT_CLIENTSECRET=
13
14
  # OAUTH_APPLE_CLIENTID=
14
15
  # OAUTH_APPLE_CLIENTSECRET=
15
16
 
17
+ # JWT token
16
18
  ACCESS_TOKEN_EXPIRE_TIME='5m'
17
19
  REFRESH_TOKEN_EXPIRE_TIME='15m'
18
-
19
20
  SESSION_COOKIE_SECRET='my-session-cookie-secret'
20
-
21
21
  JWT_ALGORITHM='HS256'
22
22
  JWT_SECRET0='my-secret-key0'
@@ -1,3 +1,4 @@
1
+ // {{headerComment}}
1
2
  export type accessAction = "create" | "read" | "update" | "delete";
2
3
  export const accessActionArr: accessAction[] = ["create", "read", "update", "delete"];
3
4
 
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import path from "path";
4
3
  import ms from "ms";
5
4
  import { Router } from "express";
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import mongoose from "mongoose";
4
3
  import { Request, Response, NextFunction } from "express";
5
4
  import vex from "./../_utils/index.gen";
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import { Request, Response } from "express";
4
3
  import vex from "./../_utils/index.gen";
5
4
  import { VexResponseError } from "../_utils/response.gen";
@@ -1,5 +1,4 @@
1
1
  // {{headerComment}}
2
-
3
2
  import jsYaml from "js-yaml";
4
3
  import fs from "fs";
5
4
  import { Request } from "express";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "very-express",
3
- "version": "0.5.11",
3
+ "version": "0.5.13",
4
4
  "description": "based on json schema and openapi, generate Express RestApi server with mongoDb ",
5
5
  "author": "Justin26l",
6
6
  "license": "MIT",
package/tsconfig.json CHANGED
@@ -98,7 +98,7 @@
98
98
  // "exactOptionalPropertyTypes": true, /* Interpret optional property types as written, rather than adding 'undefined'. */
99
99
  // "noImplicitReturns": true, /* Enable error reporting for codepaths that do not explicitly return in a function. */
100
100
  // "noFallthroughCasesInSwitch": true, /* Enable error reporting for fallthrough cases in switch statements. */
101
- // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an index. */
101
+ // "noUncheckedIndexedAccess": true, /* Add 'undefined' to a type when accessed using an lo */
102
102
  // "noImplicitOverride": true, /* Ensure overriding members in derived classes are marked with an override modifier. */
103
103
  // "noPropertyAccessFromIndexSignature": true, /* Enforces using indexed accessors for keys declared using an indexed type. */
104
104
  // "allowUnusedLabels": true, /* Disable error reporting for unused labels. */
package/vex.config.json CHANGED
@@ -1,36 +1,36 @@
1
- {
2
- "jsonSchemaDir": "./output/jsonSchema",
3
- "rootDir": "./output",
4
- "srcDir": "./output/src",
5
- "openapiDir": "./output/src/openapi",
6
- "sysDir": "output/src/system",
7
- "app": {
8
- "enableSwagger": true,
9
- "useUserSchema": true,
10
- "useObjectID": true,
11
- "allowApiCreateUpdate_id": false,
12
- "useStatefulRedisAuth": true
13
- },
14
- "sso": {
15
- "useHttpOnlyCookieToken": true,
16
- "oauthProviders": {
17
- "google": true,
18
- "github": true
19
- }
20
- },
21
- "useRBAC": {
22
- "roles": [
23
- "visitor",
24
- "member",
25
- "admin"
26
- ],
27
- "default": "visitor",
28
- "schemaIncluded": [
29
- "User"
30
- ]
31
- },
32
- "generator": {
33
- "commitBeforeGenerate": false,
34
- "disableVersionLabel": false
35
- }
1
+ {
2
+ "jsonSchemaDir": "./output/jsonSchema",
3
+ "rootDir": "./output",
4
+ "srcDir": "./output/src",
5
+ "openapiDir": "./output/src/openapi",
6
+ "sysDir": "output/src/system",
7
+ "app": {
8
+ "enableSwagger": true,
9
+ "useUserSchema": true,
10
+ "useObjectID": true,
11
+ "allowApiCreateUpdate_id": false,
12
+ "useStatefulRedisAuth": true
13
+ },
14
+ "sso": {
15
+ "useHttpOnlyCookieToken": true,
16
+ "oauthProviders": {
17
+ "google": true,
18
+ "github": true
19
+ }
20
+ },
21
+ "useRBAC": {
22
+ "roles": [
23
+ "visitor",
24
+ "member",
25
+ "admin"
26
+ ],
27
+ "default": "visitor",
28
+ "schemaIncluded": [
29
+ "User"
30
+ ]
31
+ },
32
+ "generator": {
33
+ "commitBeforeGenerate": false,
34
+ "disableVersionLabel": false
35
+ }
36
36
  }