very-express 0.3.3 → 0.3.4
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.
|
@@ -34,7 +34,9 @@ const utils_1 = require("../utils");
|
|
|
34
34
|
const roleSetupFile_1 = require("../preprocess/roleSetupFile");
|
|
35
35
|
function compile(options) {
|
|
36
36
|
var _a;
|
|
37
|
-
|
|
37
|
+
if (!options.compilerOptions.useRBAC) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
38
40
|
(0, roleSetupFile_1.roleSetupFile)({
|
|
39
41
|
collectionList: options.collectionList,
|
|
40
42
|
roleSetupDir: options.roleSourceDir,
|
|
@@ -7,6 +7,9 @@ exports.compile = void 0;
|
|
|
7
7
|
const logger_1 = __importDefault(require("../utils/logger"));
|
|
8
8
|
const utils_1 = require("../utils");
|
|
9
9
|
function compile(options) {
|
|
10
|
+
if (!options.compilerOptions.app.useUserSchema) {
|
|
11
|
+
return;
|
|
12
|
+
}
|
|
10
13
|
logger_1.default.process("UserSchmea");
|
|
11
14
|
const schemaOutPath = `${options.compilerOptions.jsonSchemaDir}/User.json`;
|
|
12
15
|
const templateSchema = (0, utils_1.loadJson)(`${__dirname}/../templates/jsonSchema/User.json`);
|
package/dist/index.js
CHANGED
|
@@ -38,6 +38,7 @@ const controllerGen = __importStar(require("./generators/controllers.generator")
|
|
|
38
38
|
const routeGen = __importStar(require("./generators/routes/routes.generator"));
|
|
39
39
|
const serverGen = __importStar(require("./generators/server.generator"));
|
|
40
40
|
const jsonschemaFormat_1 = require("./preprocess/jsonschemaFormat");
|
|
41
|
+
const roleSetupFile_1 = require("./preprocess/roleSetupFile");
|
|
41
42
|
function generate(options) {
|
|
42
43
|
const openapiFile = "/openapi.gen.yaml";
|
|
43
44
|
const roleSourceDir = `${options.rootDir}/roles`;
|
|
@@ -78,11 +79,8 @@ function generate(options) {
|
|
|
78
79
|
utils.copyDir(`${__dirname}/templates/services`, dir.serviceDir, options, true);
|
|
79
80
|
utils.copyDir(`${__dirname}/templates/plugins`, dir.pluginDir, options, true);
|
|
80
81
|
utils.copyDir(`${__dirname}/templates/roles`, dir.roleDir, options, true);
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
compilerOptions: options || utils.defaultCompilerOptions,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
82
|
+
userSchemaGen.compile({ compilerOptions: options || utils.defaultCompilerOptions });
|
|
83
|
+
(0, roleSetupFile_1.roleSchemaFormat)({ compilerOptions: options || utils.defaultCompilerOptions });
|
|
86
84
|
const files = fs_1.default.readdirSync(options.jsonSchemaDir);
|
|
87
85
|
files.forEach((schemaFileName) => {
|
|
88
86
|
const schemaPath = `${options.jsonSchemaDir}/${schemaFileName}`;
|
|
@@ -9,6 +9,9 @@ const utils_1 = require("../utils");
|
|
|
9
9
|
const logger_1 = __importDefault(require("../utils/logger"));
|
|
10
10
|
function roleSetupFile(options) {
|
|
11
11
|
var _a;
|
|
12
|
+
if (!options.compilerOptions.useRBAC) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
12
15
|
const actionArray = ["create", "search", "read", "update", "delete"];
|
|
13
16
|
(_a = options.compilerOptions.useRBAC) === null || _a === void 0 ? void 0 : _a.roles.forEach((role) => {
|
|
14
17
|
logger_1.default.process(`Role Setting File : ${role}`);
|
|
@@ -28,6 +31,9 @@ function roleSetupFile(options) {
|
|
|
28
31
|
exports.roleSetupFile = roleSetupFile;
|
|
29
32
|
function roleSchemaFormat(options) {
|
|
30
33
|
var _a;
|
|
34
|
+
if (!options.compilerOptions.useRBAC) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
31
37
|
(_a = options.compilerOptions.useRBAC) === null || _a === void 0 ? void 0 : _a.schemaIncluded.forEach((file) => {
|
|
32
38
|
var _a, _b;
|
|
33
39
|
logger_1.default.process(`Schema Role Format : ${file}.json`);
|