beech-api 3.9.0-beta.9-rc → 3.9.80
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/LICENSE +21 -21
- package/README.md +1717 -1649
- package/index.js +2 -2
- package/package.json +92 -84
- package/packages/cli/beech +9 -10
- package/packages/cli/bin/beech-app.js +390 -390
- package/packages/cli/bin/beech-service.js +263 -170
- package/packages/cli/core/auth/Credentials.js +174 -174
- package/packages/cli/core/auth/Passport.js +664 -664
- package/packages/cli/core/auth/_Request.js +12 -12
- package/packages/cli/core/configure/_gitignore +16 -15
- package/packages/cli/core/configure/_sequelizerc +9 -9
- package/packages/cli/core/configure/app.config-basic.js +55 -55
- package/packages/cli/core/configure/app.config-sequelize.js +88 -88
- package/packages/cli/core/configure/beech.config.js +9 -9
- package/packages/cli/core/configure/global.config-basic.js +8 -8
- package/packages/cli/core/configure/global.config-sequelize.js +8 -8
- package/packages/cli/core/configure/jest.config.js +6 -6
- package/packages/cli/core/configure/jsconfig.json +8 -7
- package/packages/cli/core/configure/passport.config.js +97 -97
- package/packages/cli/core/databases/mysql.js +94 -95
- package/packages/cli/core/databases/sequelize.js +187 -188
- package/packages/cli/core/databases/test.js +250 -255
- package/packages/cli/core/file-walk/file-walk.js +35 -35
- package/packages/cli/core/generator/_endpoints +15 -15
- package/packages/cli/core/generator/_endpoints_basic +42 -42
- package/packages/cli/core/generator/_help +29 -19
- package/packages/cli/core/generator/_help_create +10 -10
- package/packages/cli/core/generator/_help_service +10 -10
- package/packages/cli/core/generator/_helpers +9 -9
- package/packages/cli/core/generator/_helpers_basic +166 -22
- package/packages/cli/core/generator/_models +6 -6
- package/packages/cli/core/generator/_models_basic +13 -13
- package/packages/cli/core/generator/_package +23 -19
- package/packages/cli/core/generator/_scheduler +32 -32
- package/packages/cli/core/generator/_spec +29 -29
- package/packages/cli/core/generator/index.js +1229 -992
- package/packages/cli/core/helpers/2fa.js +106 -106
- package/packages/cli/core/helpers/math.js +115 -115
- package/packages/cli/core/helpers/poolEntity.js +103 -103
- package/packages/cli/core/index.js +264 -266
- package/packages/cli/core/middleware/express/duplicateRequest.js +16 -16
- package/packages/cli/core/middleware/express/jwtCheckAllow.js +85 -85
- package/packages/cli/core/middleware/express/rateLimit.js +29 -29
- package/packages/cli/core/middleware/express/slowDown.js +2 -2
- package/packages/cli/core/middleware/index.js +6 -6
- package/packages/cli/core/middleware/origin/guard/advance.js +75 -75
- package/packages/cli/core/middleware/origin/whitelist/cors.js +94 -94
- package/packages/cli/core/services/http.express.js +481 -481
- package/packages/cli/core/test/check-node.js +21 -21
- package/packages/cli/core/test/utils.js +7 -7
- package/packages/cli/entry +10 -0
- package/packages/lib/index.js +6 -6
- package/packages/lib/src/endpoint.js +947 -885
- package/packages/lib/src/guard.js +60 -60
- package/packages/lib/src/salt.js +3 -3
- package/packages/lib/src/schema.js +96 -96
- package/packages/lib/src/specificExpress.js +7 -7
- package/packages/lib/src/user.js +271 -271
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
requests: (req, res, next) => {
|
|
3
|
-
console.log(res.statusCode);
|
|
4
|
-
console.log(req.url, req.method);
|
|
5
|
-
return res.status(404).json({
|
|
6
|
-
code: 404,
|
|
7
|
-
status: "404_NOT_FOUND",
|
|
8
|
-
error: "Passport config file not found.",
|
|
9
|
-
});
|
|
10
|
-
next();
|
|
11
|
-
},
|
|
12
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
requests: (req, res, next) => {
|
|
3
|
+
console.log(res.statusCode);
|
|
4
|
+
console.log(req.url, req.method);
|
|
5
|
+
return res.status(404).json({
|
|
6
|
+
code: 404,
|
|
7
|
+
status: "404_NOT_FOUND",
|
|
8
|
+
error: "Passport config file not found.",
|
|
9
|
+
});
|
|
10
|
+
next();
|
|
11
|
+
},
|
|
12
|
+
};
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
# default
|
|
2
|
-
.git
|
|
3
|
-
.vscode
|
|
4
|
-
__tests__
|
|
5
|
-
beech
|
|
6
|
-
node_modules
|
|
7
|
-
package-lock.json
|
|
8
|
-
yarn.lock
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
# default
|
|
2
|
+
.git
|
|
3
|
+
.vscode
|
|
4
|
+
__tests__
|
|
5
|
+
beech
|
|
6
|
+
node_modules
|
|
7
|
+
package-lock.json
|
|
8
|
+
yarn.lock
|
|
9
|
+
dist*
|
|
10
|
+
|
|
11
|
+
# config
|
|
12
|
+
app.config.js
|
|
13
|
+
passport.config.js
|
|
14
|
+
|
|
15
|
+
# sequelize-cli
|
|
16
|
+
databases
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
// .sequelizec
|
|
2
|
-
|
|
3
|
-
const path = require('path');
|
|
4
|
-
|
|
5
|
-
module.exports = {
|
|
6
|
-
'config': path.resolve('databases/config', 'database.json'),
|
|
7
|
-
'models-path': path.resolve('databases', 'models'),
|
|
8
|
-
'seeders-path': path.resolve('databases', 'seeders'),
|
|
9
|
-
'migrations-path': path.resolve('databases', 'migrations')
|
|
1
|
+
// .sequelizec
|
|
2
|
+
|
|
3
|
+
const path = require('path');
|
|
4
|
+
|
|
5
|
+
module.exports = {
|
|
6
|
+
'config': path.resolve('databases/config', 'database.json'),
|
|
7
|
+
'models-path': path.resolve('databases', 'models'),
|
|
8
|
+
'seeders-path': path.resolve('databases', 'seeders'),
|
|
9
|
+
'migrations-path': path.resolve('databases', 'migrations')
|
|
10
10
|
};
|
|
@@ -1,56 +1,56 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
/**
|
|
3
|
-
* Service configuration
|
|
4
|
-
*
|
|
5
|
-
* @exports app_port : Listening for start service
|
|
6
|
-
* @exports app_host : Server http localhost
|
|
7
|
-
* @exports client_host : Production http client host
|
|
8
|
-
* @exports app_key : App key for request with endpoints
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
main_config: {
|
|
12
|
-
app_port: 9000,
|
|
13
|
-
app_host: "localhost",
|
|
14
|
-
client_host: "http://0.0.0.0:9000",
|
|
15
|
-
app_key: [ "2cc118cd91b52ff99e3c005ddced76fb" ]
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
// Job Scheduler it's work when enabled. You can enable scheduler by run CMD `$ beech skd init`.
|
|
19
|
-
scheduler: true,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Database configuration (mutiple connection) currenty support for MySQL
|
|
23
|
-
*
|
|
24
|
-
* @exports name : The Connection name
|
|
25
|
-
* @exports host : The Host address
|
|
26
|
-
* @exports username : The Host username connection (Hash needed)
|
|
27
|
-
* @exports password : Host The password connection (Hash needed)
|
|
28
|
-
* @exports database : The database name
|
|
29
|
-
* @exports port : The sql port (default 3306)
|
|
30
|
-
* @exports charset : The character encoding
|
|
31
|
-
* @exports is_connect : The sql connection flag (boolean)
|
|
32
|
-
*
|
|
33
|
-
*/
|
|
34
|
-
database_config: [
|
|
35
|
-
{
|
|
36
|
-
name: "default_db",
|
|
37
|
-
host: "localhost",
|
|
38
|
-
username: "DB_USERNAME_HASH",
|
|
39
|
-
password: "DB_PASSWORD_HASH",
|
|
40
|
-
database: "example1_db",
|
|
41
|
-
port: "3306",
|
|
42
|
-
charset: "utf8",
|
|
43
|
-
is_connect: false,
|
|
44
|
-
},
|
|
45
|
-
{
|
|
46
|
-
name: "second_db",
|
|
47
|
-
host: "localhost",
|
|
48
|
-
username: "DB_USERNAME_HASH",
|
|
49
|
-
password: "DB_PASSWORD_HASH",
|
|
50
|
-
database: "example2_db",
|
|
51
|
-
port: "3306",
|
|
52
|
-
charset: "utf8",
|
|
53
|
-
is_connect: false,
|
|
54
|
-
}
|
|
55
|
-
]
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Service configuration
|
|
4
|
+
*
|
|
5
|
+
* @exports app_port : Listening for start service
|
|
6
|
+
* @exports app_host : Server http localhost
|
|
7
|
+
* @exports client_host : Production http client host
|
|
8
|
+
* @exports app_key : App key for request with endpoints
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
main_config: {
|
|
12
|
+
app_port: 9000,
|
|
13
|
+
app_host: "localhost",
|
|
14
|
+
client_host: "http://0.0.0.0:9000",
|
|
15
|
+
app_key: [ "2cc118cd91b52ff99e3c005ddced76fb" ]
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
// Job Scheduler it's work when enabled. You can enable scheduler by run CMD `$ beech skd init`.
|
|
19
|
+
scheduler: true,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Database configuration (mutiple connection) currenty support for MySQL
|
|
23
|
+
*
|
|
24
|
+
* @exports name : The Connection name
|
|
25
|
+
* @exports host : The Host address
|
|
26
|
+
* @exports username : The Host username connection (Hash needed)
|
|
27
|
+
* @exports password : Host The password connection (Hash needed)
|
|
28
|
+
* @exports database : The database name
|
|
29
|
+
* @exports port : The sql port (default 3306)
|
|
30
|
+
* @exports charset : The character encoding
|
|
31
|
+
* @exports is_connect : The sql connection flag (boolean)
|
|
32
|
+
*
|
|
33
|
+
*/
|
|
34
|
+
database_config: [
|
|
35
|
+
{
|
|
36
|
+
name: "default_db",
|
|
37
|
+
host: "localhost",
|
|
38
|
+
username: "DB_USERNAME_HASH",
|
|
39
|
+
password: "DB_PASSWORD_HASH",
|
|
40
|
+
database: "example1_db",
|
|
41
|
+
port: "3306",
|
|
42
|
+
charset: "utf8",
|
|
43
|
+
is_connect: false,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: "second_db",
|
|
47
|
+
host: "localhost",
|
|
48
|
+
username: "DB_USERNAME_HASH",
|
|
49
|
+
password: "DB_PASSWORD_HASH",
|
|
50
|
+
database: "example2_db",
|
|
51
|
+
port: "3306",
|
|
52
|
+
charset: "utf8",
|
|
53
|
+
is_connect: false,
|
|
54
|
+
}
|
|
55
|
+
]
|
|
56
56
|
};
|
|
@@ -1,89 +1,89 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
/**
|
|
3
|
-
* Service configuration
|
|
4
|
-
*
|
|
5
|
-
* @exports app_port : Listening for start service
|
|
6
|
-
* @exports app_host : Server http localhost
|
|
7
|
-
* @exports client_host : Production http client host
|
|
8
|
-
* @exports app_key : App key for request with endpoints
|
|
9
|
-
*
|
|
10
|
-
*/
|
|
11
|
-
main_config: {
|
|
12
|
-
app_port: 9000,
|
|
13
|
-
app_host: "localhost",
|
|
14
|
-
client_host: "http://0.0.0.0:9000",
|
|
15
|
-
app_key: [ "2cc118cd91b52ff99e3c005ddced76fb" ]
|
|
16
|
-
},
|
|
17
|
-
|
|
18
|
-
// Job Scheduler it's work when enabled. You can enable scheduler by run CMD `$ beech skd init`.
|
|
19
|
-
scheduler: true,
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* The Database configuration (mutiple connection) currenty support for MySQL, SQLite, MariaDB, PostgreSQL and Microsoft SQL Server
|
|
23
|
-
*
|
|
24
|
-
* Basic parameter following:
|
|
25
|
-
* @exports dialect The engine SQL connection one of 'mysql' | 'sqlite' | 'mariadb' | 'postgres' | 'mssql'
|
|
26
|
-
* The Dialect need of the following:
|
|
27
|
-
* - $ npm install --save pg pg-hstore # Postgres
|
|
28
|
-
* - $ npm install --save mysql2 (MySQL suppport version ^5.7, Learn more : https://sequelize.org/releases/#mysql-support-table)
|
|
29
|
-
* - $ npm install --save mariadb
|
|
30
|
-
* - $ npm install --save sqlite3 (Need NodeJS ^12.x)
|
|
31
|
-
* - $ npm install --save tedious # Microsoft SQL Server (Need NodeJS v14.x)
|
|
32
|
-
* @exports name The Connection name
|
|
33
|
-
* @exports host The Host address
|
|
34
|
-
* @exports username The Host username connection (Hash needed)
|
|
35
|
-
* @exports password Host The password connection (Hash needed)
|
|
36
|
-
* @exports database The database name
|
|
37
|
-
* @exports port The sql port (default port by dialect mysql:3306, marialdb:3306, postgres:5432 and mssql:1433)
|
|
38
|
-
* @exports define The character encoding and optional. See more: https://sequelize.org/docs/v6/other-topics/dialect-specific-things/
|
|
39
|
-
* @exports is_connect The sql connection flag (boolean)
|
|
40
|
-
*
|
|
41
|
-
* learn more of parameter:
|
|
42
|
-
*
|
|
43
|
-
*/
|
|
44
|
-
database_config: [
|
|
45
|
-
{
|
|
46
|
-
dialect: "mysql",
|
|
47
|
-
name: "default_db",
|
|
48
|
-
host: "localhost",
|
|
49
|
-
username: "DB_USERNAME_HASH",
|
|
50
|
-
password: "DB_PASSWORD_HASH",
|
|
51
|
-
database: "example1_db",
|
|
52
|
-
port: "3306",
|
|
53
|
-
define: {
|
|
54
|
-
charset: "utf8",
|
|
55
|
-
dialectOptions: {
|
|
56
|
-
collate: "utf8_general_ci"
|
|
57
|
-
},
|
|
58
|
-
},
|
|
59
|
-
is_connect: false,
|
|
60
|
-
},
|
|
61
|
-
{
|
|
62
|
-
dialect: "sqlite",
|
|
63
|
-
name: "second_db",
|
|
64
|
-
storage: "usr/sqliteDB/mydatabase.sqlite", // or ":memory:"
|
|
65
|
-
is_connect: false,
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
dialect: "mssql",
|
|
69
|
-
name: "thirdth_db",
|
|
70
|
-
host: "localhost",
|
|
71
|
-
username: "DB_USERNAME_HASH",
|
|
72
|
-
password: "DB_PASSWORD_HASH",
|
|
73
|
-
database: "example3_db",
|
|
74
|
-
port: "1433",
|
|
75
|
-
define: {
|
|
76
|
-
charset: "utf8",
|
|
77
|
-
dialectOptions: {
|
|
78
|
-
collate: "utf8_general_ci"
|
|
79
|
-
},
|
|
80
|
-
},
|
|
81
|
-
dialectOptions: { // ssl
|
|
82
|
-
options: {
|
|
83
|
-
encrypt: false,
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
is_connect: false,
|
|
87
|
-
},
|
|
88
|
-
]
|
|
1
|
+
module.exports = {
|
|
2
|
+
/**
|
|
3
|
+
* Service configuration
|
|
4
|
+
*
|
|
5
|
+
* @exports app_port : Listening for start service
|
|
6
|
+
* @exports app_host : Server http localhost
|
|
7
|
+
* @exports client_host : Production http client host
|
|
8
|
+
* @exports app_key : App key for request with endpoints
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
main_config: {
|
|
12
|
+
app_port: 9000,
|
|
13
|
+
app_host: "localhost",
|
|
14
|
+
client_host: "http://0.0.0.0:9000",
|
|
15
|
+
app_key: [ "2cc118cd91b52ff99e3c005ddced76fb" ]
|
|
16
|
+
},
|
|
17
|
+
|
|
18
|
+
// Job Scheduler it's work when enabled. You can enable scheduler by run CMD `$ beech skd init`.
|
|
19
|
+
scheduler: true,
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* The Database configuration (mutiple connection) currenty support for MySQL, SQLite, MariaDB, PostgreSQL and Microsoft SQL Server
|
|
23
|
+
*
|
|
24
|
+
* Basic parameter following:
|
|
25
|
+
* @exports dialect The engine SQL connection one of 'mysql' | 'sqlite' | 'mariadb' | 'postgres' | 'mssql'
|
|
26
|
+
* The Dialect need of the following:
|
|
27
|
+
* - $ npm install --save pg pg-hstore # Postgres
|
|
28
|
+
* - $ npm install --save mysql2 (MySQL suppport version ^5.7, Learn more : https://sequelize.org/releases/#mysql-support-table)
|
|
29
|
+
* - $ npm install --save mariadb
|
|
30
|
+
* - $ npm install --save sqlite3 (Need NodeJS ^12.x)
|
|
31
|
+
* - $ npm install --save tedious # Microsoft SQL Server (Need NodeJS v14.x)
|
|
32
|
+
* @exports name The Connection name
|
|
33
|
+
* @exports host The Host address
|
|
34
|
+
* @exports username The Host username connection (Hash needed)
|
|
35
|
+
* @exports password Host The password connection (Hash needed)
|
|
36
|
+
* @exports database The database name
|
|
37
|
+
* @exports port The sql port (default port by dialect mysql:3306, marialdb:3306, postgres:5432 and mssql:1433)
|
|
38
|
+
* @exports define The character encoding and optional. See more: https://sequelize.org/docs/v6/other-topics/dialect-specific-things/
|
|
39
|
+
* @exports is_connect The sql connection flag (boolean)
|
|
40
|
+
*
|
|
41
|
+
* learn more of parameter:
|
|
42
|
+
*
|
|
43
|
+
*/
|
|
44
|
+
database_config: [
|
|
45
|
+
{
|
|
46
|
+
dialect: "mysql",
|
|
47
|
+
name: "default_db",
|
|
48
|
+
host: "localhost",
|
|
49
|
+
username: "DB_USERNAME_HASH",
|
|
50
|
+
password: "DB_PASSWORD_HASH",
|
|
51
|
+
database: "example1_db",
|
|
52
|
+
port: "3306",
|
|
53
|
+
define: {
|
|
54
|
+
charset: "utf8",
|
|
55
|
+
dialectOptions: {
|
|
56
|
+
collate: "utf8_general_ci"
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
is_connect: false,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
dialect: "sqlite",
|
|
63
|
+
name: "second_db",
|
|
64
|
+
storage: "usr/sqliteDB/mydatabase.sqlite", // or ":memory:"
|
|
65
|
+
is_connect: false,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
dialect: "mssql",
|
|
69
|
+
name: "thirdth_db",
|
|
70
|
+
host: "localhost",
|
|
71
|
+
username: "DB_USERNAME_HASH",
|
|
72
|
+
password: "DB_PASSWORD_HASH",
|
|
73
|
+
database: "example3_db",
|
|
74
|
+
port: "1433",
|
|
75
|
+
define: {
|
|
76
|
+
charset: "utf8",
|
|
77
|
+
dialectOptions: {
|
|
78
|
+
collate: "utf8_general_ci"
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
dialectOptions: { // ssl
|
|
82
|
+
options: {
|
|
83
|
+
encrypt: false,
|
|
84
|
+
}
|
|
85
|
+
},
|
|
86
|
+
is_connect: false,
|
|
87
|
+
},
|
|
88
|
+
]
|
|
89
89
|
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
defineConfig: {
|
|
3
|
-
base: "/",
|
|
4
|
-
server: {
|
|
5
|
-
origin: ["*"],
|
|
6
|
-
originSensitive: false,
|
|
7
|
-
},
|
|
8
|
-
},
|
|
9
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
defineConfig: {
|
|
3
|
+
base: "/",
|
|
4
|
+
server: {
|
|
5
|
+
origin: ["*"],
|
|
6
|
+
originSensitive: false,
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module.exports.init = () => {
|
|
2
|
-
// Pool base config
|
|
3
|
-
global.pool_base = "basic"; // one of "basic" | "sequelize"
|
|
4
|
-
|
|
5
|
-
// Example declare global varables library, config and anything
|
|
6
|
-
global.App = "myApp";
|
|
7
|
-
|
|
8
|
-
// Anything global config for you ...
|
|
1
|
+
module.exports.init = () => {
|
|
2
|
+
// Pool base config
|
|
3
|
+
global.pool_base = "basic"; // one of "basic" | "sequelize"
|
|
4
|
+
|
|
5
|
+
// Example declare global varables library, config and anything
|
|
6
|
+
global.App = "myApp";
|
|
7
|
+
|
|
8
|
+
// Anything global config for you ...
|
|
9
9
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
module.exports.init = () => {
|
|
2
|
-
// Pool base config
|
|
3
|
-
global.pool_base = "sequelize"; // one of "basic" | "sequelize"
|
|
4
|
-
|
|
5
|
-
// Example declare global varables library, config and anything
|
|
6
|
-
global.App = "myApp";
|
|
7
|
-
|
|
8
|
-
// Anything global config for you ...
|
|
1
|
+
module.exports.init = () => {
|
|
2
|
+
// Pool base config
|
|
3
|
+
global.pool_base = "sequelize"; // one of "basic" | "sequelize"
|
|
4
|
+
|
|
5
|
+
// Example declare global varables library, config and anything
|
|
6
|
+
global.App = "myApp";
|
|
7
|
+
|
|
8
|
+
// Anything global config for you ...
|
|
9
9
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const fs = require("fs");
|
|
2
|
-
const packages = require("./node_modules/beech-api/package.json");
|
|
3
|
-
|
|
4
|
-
module.exports = {
|
|
5
|
-
setupFilesAfterEnv: [(fs.existsSync(packages.jest.prdFile)) ? packages.jest.prdFile : packages.jest.devFile],
|
|
6
|
-
verbose: true
|
|
1
|
+
const fs = require("fs");
|
|
2
|
+
const packages = require("./node_modules/beech-api/package.json");
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
setupFilesAfterEnv: [(fs.existsSync(packages.jest.prdFile)) ? packages.jest.prdFile : packages.jest.devFile],
|
|
6
|
+
verbose: true
|
|
7
7
|
};
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"
|
|
4
|
-
"
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
{
|
|
2
|
+
"compilerOptions": {
|
|
3
|
+
"ignoreDeprecations": "6.0", // Ignore deprecation warnings for TypeScript 6.0 and above
|
|
4
|
+
"baseUrl": ".",
|
|
5
|
+
"paths": {
|
|
6
|
+
"@/*": ["./src/*"]
|
|
7
|
+
}
|
|
8
|
+
}
|
|
8
9
|
}
|
|
@@ -1,97 +1,97 @@
|
|
|
1
|
-
module.exports = {
|
|
2
|
-
// Allow for using jwt
|
|
3
|
-
jwt_allow: true,
|
|
4
|
-
|
|
5
|
-
// Custom authenticaiton endpoint, default `/authentication`
|
|
6
|
-
auth_endpoint: "",
|
|
7
|
-
|
|
8
|
-
// Assign your jwt secret key
|
|
9
|
-
secret: "your_jwt_secret",
|
|
10
|
-
|
|
11
|
-
// Set token expiry time (seconds), default expired in 24 hr.
|
|
12
|
-
token_expired: 86400,
|
|
13
|
-
|
|
14
|
-
// Allow for using global jwt broken role
|
|
15
|
-
jwt_broken_role: [
|
|
16
|
-
// { role: [1, 2, 9] },
|
|
17
|
-
],
|
|
18
|
-
|
|
19
|
-
model: {
|
|
20
|
-
// Main sql connection name. You must make sure connection name like inside `app.config.js` file and choose one connection name.
|
|
21
|
-
name: "default_db",
|
|
22
|
-
// The user table name for store your authenticate, (default table `users`)
|
|
23
|
-
table: "",
|
|
24
|
-
// The fields for authenticate, default fields: (`username` and `password`)
|
|
25
|
-
username_field: "",
|
|
26
|
-
password_field: "",
|
|
27
|
-
// JWT playload data, You can add it. Example: ["name", "email", ...]
|
|
28
|
-
fields: [],
|
|
29
|
-
// Other fields add for authentication.
|
|
30
|
-
guard: {
|
|
31
|
-
// Basic guard field, Example: ["pin", "email", "2fa"]
|
|
32
|
-
guard_field: [],
|
|
33
|
-
// Advanced guard jwt request (needed some logical from front-end)
|
|
34
|
-
advanced_guard: {
|
|
35
|
-
allow: false,
|
|
36
|
-
entity: "", // default entity `timing`
|
|
37
|
-
secret: "top_secret",
|
|
38
|
-
time_expired: {
|
|
39
|
-
minutes: 1, // should length [0-60]
|
|
40
|
-
seconds: 0, // should length [0-60]
|
|
41
|
-
},
|
|
42
|
-
},
|
|
43
|
-
},
|
|
44
|
-
},
|
|
45
|
-
|
|
46
|
-
// Allow for using request with app_key entity (Every request must be using the app_key entity in headers)
|
|
47
|
-
app_key_allow: true,
|
|
48
|
-
|
|
49
|
-
// Official strategy
|
|
50
|
-
strategy: {
|
|
51
|
-
/**
|
|
52
|
-
* The Client Id and Client Secret needed to authenticate with Google can be set up from the Google Developers Console (https://console.developers.google.com/)
|
|
53
|
-
* You may also need to enable Google API in the developer console, otherwise user profile data may not be fetched.
|
|
54
|
-
* Now Google supports authentication with oAuth 2.0.
|
|
55
|
-
*
|
|
56
|
-
*/
|
|
57
|
-
google: {
|
|
58
|
-
// Allow for using google strategy
|
|
59
|
-
allow: false,
|
|
60
|
-
// Authen profile store fields available: `google_id`, `name`, `email`, `photos`, `locate`
|
|
61
|
-
local_profile_fields: {
|
|
62
|
-
google_id: "google_id", // Google ID field, default field name: `google_id`
|
|
63
|
-
},
|
|
64
|
-
// Google development Credentials OAuth 2.0 Client IDs
|
|
65
|
-
client_id: "GOOGLE_CLIENT_ID",
|
|
66
|
-
client_secret: "GOOGLE_CLIENT_SECRET",
|
|
67
|
-
// Callback endpoint default `/google/callback`
|
|
68
|
-
callbackURL: "",
|
|
69
|
-
// Failure redirect to your route
|
|
70
|
-
failureRedirect: "/login",
|
|
71
|
-
},
|
|
72
|
-
|
|
73
|
-
/**
|
|
74
|
-
* The Facebook strategy allows users to log in to a web application using their Facebook account. Internally, Facebook authentication works using OAuth 2.0.
|
|
75
|
-
* Support for Facebook is implemented by the passport-facebook (https://github.com/jaredhanson/passport-facebook) module.
|
|
76
|
-
*
|
|
77
|
-
* In order to use Facebook authentication, you must first create an app at Facebook Developers. (https://developers.facebook.com/apps) When created, an app is assigned an App ID and App Secret.
|
|
78
|
-
* Your application must also implement a redirect URL, to which Facebook will redirect users after they have approved access for your application.
|
|
79
|
-
*
|
|
80
|
-
*/
|
|
81
|
-
facebook: {
|
|
82
|
-
// Allow for using facebook strategy
|
|
83
|
-
allow: false,
|
|
84
|
-
// Authen profile store fields available: `facebook_id`, `name`, `email`, `photos`, `locate`
|
|
85
|
-
local_profile_fields: {
|
|
86
|
-
facebook_id: "facebook_id", // Facebook ID field, default field name: `facebook_id`
|
|
87
|
-
},
|
|
88
|
-
// Facebook development Credentials OAuth 2.0
|
|
89
|
-
app_id: "FACEBOOK_APP_ID",
|
|
90
|
-
app_secret: "FACEBOOK_APP_SECRET",
|
|
91
|
-
// Callback endpoint default `/facebook/callback`
|
|
92
|
-
callbackURL: "",
|
|
93
|
-
// Failure redirect to your route
|
|
94
|
-
failureRedirect: "/login",
|
|
95
|
-
},
|
|
96
|
-
},
|
|
97
|
-
};
|
|
1
|
+
module.exports = {
|
|
2
|
+
// Allow for using jwt
|
|
3
|
+
jwt_allow: true,
|
|
4
|
+
|
|
5
|
+
// Custom authenticaiton endpoint, default `/authentication`
|
|
6
|
+
auth_endpoint: "",
|
|
7
|
+
|
|
8
|
+
// Assign your jwt secret key
|
|
9
|
+
secret: "your_jwt_secret",
|
|
10
|
+
|
|
11
|
+
// Set token expiry time (seconds), default expired in 24 hr.
|
|
12
|
+
token_expired: 86400,
|
|
13
|
+
|
|
14
|
+
// Allow for using global jwt broken role
|
|
15
|
+
jwt_broken_role: [
|
|
16
|
+
// { role: [1, 2, 9] },
|
|
17
|
+
],
|
|
18
|
+
|
|
19
|
+
model: {
|
|
20
|
+
// Main sql connection name. You must make sure connection name like inside `app.config.js` file and choose one connection name.
|
|
21
|
+
name: "default_db",
|
|
22
|
+
// The user table name for store your authenticate, (default table `users`)
|
|
23
|
+
table: "",
|
|
24
|
+
// The fields for authenticate, default fields: (`username` and `password`)
|
|
25
|
+
username_field: "",
|
|
26
|
+
password_field: "",
|
|
27
|
+
// JWT playload data, You can add it. Example: ["name", "email", ...]
|
|
28
|
+
fields: [],
|
|
29
|
+
// Other fields add for authentication.
|
|
30
|
+
guard: {
|
|
31
|
+
// Basic guard field, Example: ["pin", "email", "2fa"]
|
|
32
|
+
guard_field: [],
|
|
33
|
+
// Advanced guard jwt request (needed some logical from front-end)
|
|
34
|
+
advanced_guard: {
|
|
35
|
+
allow: false,
|
|
36
|
+
entity: "", // default entity `timing`
|
|
37
|
+
secret: "top_secret",
|
|
38
|
+
time_expired: {
|
|
39
|
+
minutes: 1, // should length [0-60]
|
|
40
|
+
seconds: 0, // should length [0-60]
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
|
|
46
|
+
// Allow for using request with app_key entity (Every request must be using the app_key entity in headers)
|
|
47
|
+
app_key_allow: true,
|
|
48
|
+
|
|
49
|
+
// Official strategy
|
|
50
|
+
strategy: {
|
|
51
|
+
/**
|
|
52
|
+
* The Client Id and Client Secret needed to authenticate with Google can be set up from the Google Developers Console (https://console.developers.google.com/)
|
|
53
|
+
* You may also need to enable Google API in the developer console, otherwise user profile data may not be fetched.
|
|
54
|
+
* Now Google supports authentication with oAuth 2.0.
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
google: {
|
|
58
|
+
// Allow for using google strategy
|
|
59
|
+
allow: false,
|
|
60
|
+
// Authen profile store fields available: `google_id`, `name`, `email`, `photos`, `locate`
|
|
61
|
+
local_profile_fields: {
|
|
62
|
+
google_id: "google_id", // Google ID field, default field name: `google_id`
|
|
63
|
+
},
|
|
64
|
+
// Google development Credentials OAuth 2.0 Client IDs
|
|
65
|
+
client_id: "GOOGLE_CLIENT_ID",
|
|
66
|
+
client_secret: "GOOGLE_CLIENT_SECRET",
|
|
67
|
+
// Callback endpoint default `/google/callback`
|
|
68
|
+
callbackURL: "",
|
|
69
|
+
// Failure redirect to your route
|
|
70
|
+
failureRedirect: "/login",
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* The Facebook strategy allows users to log in to a web application using their Facebook account. Internally, Facebook authentication works using OAuth 2.0.
|
|
75
|
+
* Support for Facebook is implemented by the passport-facebook (https://github.com/jaredhanson/passport-facebook) module.
|
|
76
|
+
*
|
|
77
|
+
* In order to use Facebook authentication, you must first create an app at Facebook Developers. (https://developers.facebook.com/apps) When created, an app is assigned an App ID and App Secret.
|
|
78
|
+
* Your application must also implement a redirect URL, to which Facebook will redirect users after they have approved access for your application.
|
|
79
|
+
*
|
|
80
|
+
*/
|
|
81
|
+
facebook: {
|
|
82
|
+
// Allow for using facebook strategy
|
|
83
|
+
allow: false,
|
|
84
|
+
// Authen profile store fields available: `facebook_id`, `name`, `email`, `photos`, `locate`
|
|
85
|
+
local_profile_fields: {
|
|
86
|
+
facebook_id: "facebook_id", // Facebook ID field, default field name: `facebook_id`
|
|
87
|
+
},
|
|
88
|
+
// Facebook development Credentials OAuth 2.0
|
|
89
|
+
app_id: "FACEBOOK_APP_ID",
|
|
90
|
+
app_secret: "FACEBOOK_APP_SECRET",
|
|
91
|
+
// Callback endpoint default `/facebook/callback`
|
|
92
|
+
callbackURL: "",
|
|
93
|
+
// Failure redirect to your route
|
|
94
|
+
failureRedirect: "/login",
|
|
95
|
+
},
|
|
96
|
+
},
|
|
97
|
+
};
|