@simitgroup/simpleapp-generator 2.0.1-n-alpha → 2.0.1-p-alpha

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 (49) hide show
  1. package/ReleaseNote.md +11 -0
  2. package/dist/buildinschemas/autoincreament.js +1 -1
  3. package/dist/buildinschemas/docnoformat.js +1 -1
  4. package/dist/buildinschemas/docnoformat.js.map +1 -1
  5. package/dist/buildinschemas/documentevent.js +1 -1
  6. package/dist/buildinschemas/message.d.ts +3 -0
  7. package/dist/buildinschemas/message.d.ts.map +1 -0
  8. package/dist/buildinschemas/message.js +34 -0
  9. package/dist/buildinschemas/message.js.map +1 -0
  10. package/dist/buildinschemas/webhookhistory.d.ts +3 -0
  11. package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
  12. package/dist/buildinschemas/webhookhistory.js +44 -0
  13. package/dist/buildinschemas/webhookhistory.js.map +1 -0
  14. package/dist/createproject.js +138 -0
  15. package/dist/createproject.js.map +1 -0
  16. package/dist/generate-allow-changebackend.js +305 -0
  17. package/dist/generate-allow-changebackend.js.map +1 -0
  18. package/dist/index2.js +118 -0
  19. package/dist/index2.js.map +1 -0
  20. package/dist/installdependency.js +20 -0
  21. package/dist/installdependency.js.map +1 -0
  22. package/dist/installnest.js +2 -0
  23. package/dist/installnest.js.map +1 -0
  24. package/dist/installnuxt.js +2 -0
  25. package/dist/installnuxt.js.map +1 -0
  26. package/dist/processors/groupsbuilder.js +2 -0
  27. package/dist/processors/groupsbuilder.js.map +1 -0
  28. package/dist/schematype/baseschema.js +25 -0
  29. package/dist/schematype/baseschema.js.map +1 -0
  30. package/dist/schematype/default.js +2 -0
  31. package/dist/schematype/default.js.map +1 -0
  32. package/dist/schematype/index.js +12 -0
  33. package/dist/schematype/index.js.map +1 -0
  34. package/dist/schematype/primarymasterdata.js +38 -0
  35. package/dist/schematype/primarymasterdata.js.map +1 -0
  36. package/dist/schematype/simple.js +24 -0
  37. package/dist/schematype/simple.js.map +1 -0
  38. package/dist/schematype/simplemasterdata.js +31 -0
  39. package/dist/schematype/simplemasterdata.js.map +1 -0
  40. package/dist/schematype/transaction.js +74 -0
  41. package/dist/schematype/transaction.js.map +1 -0
  42. package/package.json +1 -1
  43. package/templates/nest/src/simple-app/_core/features/maintenance/maintenance.service.ts.eta +4 -4
  44. package/templates/nest/src/simple-app/_core/features/simple-app-core-features.module.ts.eta +4 -0
  45. package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +4 -3
  46. package/templates/nest/src/simple-app/_core/framework/base/simple-app.service.ts.eta +24 -11
  47. package/templates/nest/src/simple-app/cron/cron.module.ts.eta +10 -0
  48. package/templates/nest/src/simple-app/simple-app.module.ts.eta +3 -0
  49. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +25 -0
package/dist/index2.js ADDED
@@ -0,0 +1,118 @@
1
+ #! /usr/bin/env node
2
+ "use strict";
3
+ var _a, _b, _c, _d;
4
+ Object.defineProperty(exports, "__esModule", { value: true });
5
+ const console_1 = require("console");
6
+ const program = require("commander"); // add this line
7
+ const Fieldtypes = require('./type');
8
+ const generator = require('./generate');
9
+ const fs = require('fs');
10
+ const createproject = require('./createproject');
11
+ const { exec } = require("child_process");
12
+ const capitalizeFirstLetter = require('./libs');
13
+ const { Logger, ILogObj } = require("tslog");
14
+ const log = new Logger();
15
+ const figlet = require("figlet");
16
+ // const program = new Command();
17
+ const pj = require('../package.json');
18
+ let version = pj.version;
19
+ program
20
+ .version(version)
21
+ .description("An simpleapp CLI tool for generate frontend (vuejs) and backend(nestjs) codes")
22
+ .option("-c, --config-file <value>", 'configuration file content such as:{"definationsFolder":"./definations", "backendFolder":"./nestproject/src/docs", "frontendFolder":"./nuxt/server"}')
23
+ // .option("-s, --definations-folder <value>", "load defination files from which folder")
24
+ // .option("-b, --backend-folder <value>", "Create backend code at which folder")
25
+ // .option("-f, --frontend-folder <value>", "Create frontend code at which folder")
26
+ // .option("-i, --openapi3-yaml <value>", 'openapi3.yaml generated by backend server')
27
+ .parse(process.argv);
28
+ const options = program.opts();
29
+ console.log(figlet.textSync(`SimpleApp Generator ${version}`));
30
+ // console.log(options)
31
+ let path = '';
32
+ if (!options.configFile) {
33
+ log.error("Config file parameter is required. Example: simpleapp-generator -c ./config.json");
34
+ throw "Undefine configuration file";
35
+ }
36
+ else if (options.configFile && options.configFile[0] == '/') {
37
+ path = options.configFile;
38
+ }
39
+ else if (options.configFile) {
40
+ path = process.cwd() + '/' + options.configFile;
41
+ }
42
+ else {
43
+ log.error("undefine configuration file, use command simpleapp-generator -c <configfilename.json>");
44
+ throw console_1.error;
45
+ }
46
+ const configs = require(path);
47
+ console.log("configurations: ", configs);
48
+ const definationsFolder = (_a = configs.definationsFolder) !== null && _a !== void 0 ? _a : options.definationsFolder;
49
+ const backendFolder = (_b = configs.backendFolder) !== null && _b !== void 0 ? _b : options.backendFolder;
50
+ const frontendFolder = (_c = configs.frontendFolder) !== null && _c !== void 0 ? _c : options.frontendFolder;
51
+ const openapi3Yaml = (_d = configs.openapi3Yaml) !== null && _d !== void 0 ? _d : options.openapi3Yaml;
52
+ const runGenNext = async (callback) => {
53
+ let isnestready = false;
54
+ if (!fs.existsSync(backendFolder)) {
55
+ console.log("Nest does not exists, begin install nodejs environment tools: [pnpm, @nestjs/cli, @openapitools/openapi-generator-cli, nuxi]");
56
+ isnestready = await exec("npm install -g pnpm @nestjs/cli @openapitools/openapi-generator-cli nuxi", async (a, b, c) => {
57
+ console.log("result of environment tools:", a, b, c);
58
+ console.log(`Install new nest backend: 'nest new -p pnpm ${backendFolder}'`);
59
+ return await exec(`nest new -p pnpm ${backendFolder}`, (a, b, c) => {
60
+ console.log("new nest result", a, b, c);
61
+ return true;
62
+ });
63
+ });
64
+ }
65
+ else {
66
+ isnestready = true;
67
+ }
68
+ if (isnestready) {
69
+ if (!fs.existsSync(`${backendFolder}/.env`)) {
70
+ log.info(`initial nest configuratoin for simpleapp generator`);
71
+ await createNest(backendFolder, callback);
72
+ }
73
+ else {
74
+ log.warn(`.env file exists, skip nest initialization`);
75
+ callback();
76
+ }
77
+ }
78
+ else {
79
+ log.error('nest not ready, which shouldnot continue');
80
+ throw console_1.error;
81
+ }
82
+ };
83
+ const runGenNuxt = async (callback) => {
84
+ if (!fs.existsSync(frontendFolder)) {
85
+ log.error(`${frontendFolder} does not exists, please run "npx nuxi@latest init ${frontendFolder}"`);
86
+ }
87
+ else if (!fs.existsSync(`${frontendFolder}/.env`)) {
88
+ log.info(`initial nuxt configuratoin for simpleapp generator`);
89
+ createNuxt(frontendFolder, callback);
90
+ }
91
+ else {
92
+ log.warn(`.env file exists, skip nuxt initialization`);
93
+ callback();
94
+ }
95
+ };
96
+ const generateCode = async () => {
97
+ await runGenNext(async () => {
98
+ log.info("runGenNext (backen) done");
99
+ await runGenNuxt(async () => {
100
+ log.info("runGenNuxt (frontend) done");
101
+ generator.initialize(definationsFolder, backendFolder, frontendFolder);
102
+ exec(`cd ${frontendFolder};npx prettier --write "./pages/**/*.vue" "./simpleapp/**/*" `);
103
+ exec(`cd ${backendFolder};npx run format `);
104
+ if (openapi3Yaml != '') {
105
+ exec(`openapi-generator-cli generate -i ${openapi3Yaml} -o ${frontendFolder}/simpleapp/openapi -g typescript-axios --skip-validate-spec`, (error, stdout, stderr) => {
106
+ if (error) {
107
+ log.error(stderr);
108
+ }
109
+ });
110
+ }
111
+ });
112
+ });
113
+ };
114
+ log.info("generate code: ");
115
+ generateCode();
116
+ // pnpm exec prettier ./src/docs --write
117
+ // pnpm exec prettier ./apiclients --write
118
+ //# sourceMappingURL=index2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index2.js","sourceRoot":"","sources":["../src/index2.ts"],"names":[],"mappings":";;;;AAEA,qCAA+B;AAE/B,MAAM,OAAO,GAAI,OAAO,CAAC,WAAW,CAAC,CAAA,CAAC,gBAAgB;AACtD,MAAM,UAAU,GAAE,OAAO,CAAE,QAAQ,CAAC,CAAA;AACpC,MAAM,SAAS,GAAE,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AAC,CAAA;QACrC,MAAM,UAAU,CAAE,KAAK,IAAG,EAAE;YACzB,GAAG,CAAC,IAAI,CAAC,4BAA4B,CAAC,CAAA;YACtC,SAAS,CAAC,UAAU,CAAC,iBAAiB,EAAC,aAAa,EAAC,cAAc,CAAC,CAAA;YACpE,IAAI,CAAC,MAAM,cAAc,8DAA8D,CAAC,CAAA;YACxF,IAAI,CAAC,MAAM,aAAa,kBAAkB,CAAC,CAAA;YAC3C,IAAG,YAAY,IAAG,EAAE,EAAC;gBAEnB,IAAI,CAAC,qCAAqC,YAAY,OAAO,cAAc,6DAA6D,EAAC,CAAC,KAAK,EAAE,MAAM,EAAE,MAAM,EAAC,EAAE;oBAC9J,IAAG,KAAK,EAAC;wBACP,GAAG,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;qBACnB;gBACH,CAAC,CAAC,CAAC;aACN;QACH,CAAC,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AAEJ,CAAC,CAAA;AAED,GAAG,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAA;AAC3B,YAAY,EAAE,CAAA;AAId,yCAAyC;AACzC,4CAA4C"}
@@ -0,0 +1,20 @@
1
+ #!/bin/bash
2
+ "use strict";
3
+ npm;
4
+ install - g;
5
+ pnpm;
6
+ /cli @openapitools/openapi - generator - cli;
7
+ nuxi;
8
+ nest;
9
+ new - p;
10
+ pnpm;
11
+ $backendFolder;
12
+ npx;
13
+ nuxi;
14
+ init;
15
+ $;
16
+ {
17
+ frontendFolder;
18
+ }
19
+ ";
20
+ //# sourceMappingURL=installdependency.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installdependency.js","sourceRoot":"","sources":["../src/installdependency.ts"],"names":[],"mappings":";;AACA,GAAG,CAAA;AAAC,OAAO,GAAE,CAAC,CAAA;AAAC,IAAI,CAAA;AAAQ,0BAA0B,GAAC,SAAS,GAAC,GAAG,CAAA;AAAC,IAAI,CAAA;AACxE,IAAI,CAAA;AAAC,IAAI,AAAD,GAAE,CAAC,CAAA;AAAC,IAAI,CAAA;AAAC,cAAc,CAAA;AAC/B,GAAG,CAAA;AAAC,IAAI,CAAA;AAAQ,IAAI,CAAA;AAAC,CAAC,CAAA;AAAA;IAAC,cAAc,CAAA;CAAC;AAAA,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=installnest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installnest.js","sourceRoot":"","sources":["../src/installnest.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=installnuxt.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"installnuxt.js","sourceRoot":"","sources":["../src/installnuxt.ts"],"names":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=groupsbuilder.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"groupsbuilder.js","sourceRoot":"","sources":["../../src/processors/groupsbuilder.ts"],"names":[],"mappings":""}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.baseschema = void 0;
4
+ const type_1 = require("../type");
5
+ exports.baseschema = {
6
+ 'type': 'object',
7
+ 'x-simpleapp-config': {
8
+ isolationType: type_1.IsolationType.org,
9
+ schemaType: type_1.SupportedSchemaType.baseschema,
10
+ documentType: '',
11
+ documentName: ''
12
+ },
13
+ properties: {
14
+ _id: { type: 'string', description: "system field" },
15
+ tenantId: { type: 'integer', default: 1, description: "system field" },
16
+ orgId: { type: 'integer', default: 1, description: "system field" },
17
+ branchId: { type: 'integer', default: 1, description: "system field" },
18
+ created: { type: 'string', description: "system field" },
19
+ updated: { type: 'string', description: "system field" },
20
+ createdby: { type: 'string', description: "system field" },
21
+ updatedby: { type: 'string', description: "system field" },
22
+ },
23
+ definitions: {}
24
+ };
25
+ //# sourceMappingURL=baseschema.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseschema.js","sourceRoot":"","sources":["../../src/schematype/baseschema.ts"],"names":[],"mappings":";;;AAAA,kCAAoE;AACvD,QAAA,UAAU,GAAc;IACjC,MAAM,EAAC,QAAQ;IACf,oBAAoB,EAAC;QACnB,aAAa,EAAE,oBAAa,CAAC,GAAG;QAChC,UAAU,EAAE,0BAAmB,CAAC,UAAU;QAC1C,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,EAAE;KACjB;IACD,UAAU,EAAC;QACP,GAAG,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9C,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9D,KAAK,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC3D,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9D,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAClD,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAClD,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QACpD,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;KACvD;IACD,WAAW,EAAC,EAAE;CACf,CAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=default.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"default.js","sourceRoot":"","sources":["../../src/schematype/default.ts"],"names":[],"mappings":""}
@@ -0,0 +1,12 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transaction = exports.baseschema = exports.primarymasterdata = exports.simplemasterdata = void 0;
4
+ var simplemasterdata_1 = require("./simplemasterdata");
5
+ Object.defineProperty(exports, "simplemasterdata", { enumerable: true, get: function () { return simplemasterdata_1.simplemasterdata; } });
6
+ var primarymasterdata_1 = require("./primarymasterdata");
7
+ Object.defineProperty(exports, "primarymasterdata", { enumerable: true, get: function () { return primarymasterdata_1.primarymasterdata; } });
8
+ var baseschema_1 = require("./baseschema");
9
+ Object.defineProperty(exports, "baseschema", { enumerable: true, get: function () { return baseschema_1.baseschema; } });
10
+ var transaction_1 = require("./transaction");
11
+ Object.defineProperty(exports, "transaction", { enumerable: true, get: function () { return transaction_1.transaction; } });
12
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/schematype/index.ts"],"names":[],"mappings":";;;AAAA,uDAAmD;AAA3C,oHAAA,gBAAgB,OAAA;AACxB,yDAAqD;AAA7C,sHAAA,iBAAiB,OAAA;AACzB,2CAAuC;AAA/B,wGAAA,UAAU,OAAA;AAClB,6CAAyC;AAAjC,0GAAA,WAAW,OAAA"}
@@ -0,0 +1,38 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.primarymasterdata = void 0;
4
+ const type_1 = require("../type");
5
+ exports.primarymasterdata = {
6
+ type: "object",
7
+ "x-simpleapp-config": {
8
+ isolationType: type_1.IsolationType.org,
9
+ pageType: "crud",
10
+ generateDocumentNumber: true,
11
+ schemaType: type_1.SupportedSchemaType.primarymasterdata,
12
+ documentType: '',
13
+ documentName: '',
14
+ },
15
+ properties: {
16
+ _id: { type: 'string', description: "system field" },
17
+ tenantId: { type: 'integer', default: 1, description: "system field" },
18
+ orgId: { type: 'integer', default: 1, description: "system field" },
19
+ branchId: { type: 'integer', default: 1, description: "system field" },
20
+ created: { type: 'string', description: "system field" },
21
+ updated: { type: 'string', description: "system field" },
22
+ createdby: { type: 'string', description: "system field" },
23
+ updatedby: { type: 'string', description: "system field" },
24
+ docNoFormat: {
25
+ type: "object",
26
+ "x-foreignkey": "docnoformat",
27
+ properties: { _id: { "type": "string" }, label: { "type": "string" } },
28
+ description: "system field"
29
+ },
30
+ },
31
+ definitions: {
32
+ foreignkey: {
33
+ type: "object",
34
+ properties: { _id: { "type": "string" }, label: { "type": "string" }, code: { "type": "string" } }
35
+ }
36
+ },
37
+ };
38
+ //# sourceMappingURL=primarymasterdata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"primarymasterdata.js","sourceRoot":"","sources":["../../src/schematype/primarymasterdata.ts"],"names":[],"mappings":";;;AAAA,kCAAoE;AACvD,QAAA,iBAAiB,GAAc;IACxC,IAAI,EAAC,QAAQ;IACb,oBAAoB,EAAC;QACnB,aAAa,EAAE,oBAAa,CAAC,GAAG;QAChC,QAAQ,EAAC,MAAM;QACf,sBAAsB,EAAC,IAAI;QAC3B,UAAU,EAAE,0BAAmB,CAAC,iBAAiB;QACjD,YAAY,EAAC,EAAE;QACf,YAAY,EAAC,EAAE;KAChB;IACD,UAAU,EAAC;QACP,GAAG,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9C,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9D,KAAK,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC3D,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC,WAAW,EAAC,cAAc,EAAC;QAC9D,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAClD,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QAClD,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QACpD,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,cAAc,EAAC,aAAa;YAC5B,UAAU,EAAE,EAAC,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC;YAC/D,WAAW,EAAC,cAAc;SAC3B;KACH;IACD,WAAW,EAAC;QACX,UAAU,EAAE;YACV,IAAI,EAAC,QAAQ;YACb,UAAU,EAAE,EAAC,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,IAAI,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC;SACzF;KACF;CACF,CAAA"}
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.simpleschema = void 0;
4
+ exports.simpleschema = {
5
+ 'type': 'object',
6
+ 'x-simpleapp-config': {
7
+ isolationType: 'org',
8
+ schemaType: 'simple',
9
+ documentType: '',
10
+ documentName: '',
11
+ foreignKeys: {}
12
+ },
13
+ "properties": {
14
+ _id: { type: 'string' },
15
+ tenantId: { type: 'integer', default: 1 },
16
+ orgId: { type: 'integer', default: 1 },
17
+ branchId: { type: 'integer', default: 1 },
18
+ created: { type: 'string' },
19
+ updated: { type: 'string' },
20
+ createdby: { type: 'string' },
21
+ updatedby: { type: 'string' },
22
+ }
23
+ };
24
+ //# sourceMappingURL=simple.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simple.js","sourceRoot":"","sources":["../../src/schematype/simple.ts"],"names":[],"mappings":";;;AAAa,QAAA,YAAY,GAAG;IACxB,MAAM,EAAC,QAAQ;IACf,oBAAoB,EAAC;QACnB,aAAa,EAAE,KAAK;QACpB,UAAU,EAAE,QAAQ;QACpB,YAAY,EAAE,EAAE;QAChB,YAAY,EAAE,EAAE;QAChB,WAAW,EAAC,EAAE;KACf;IACD,YAAY,EAAC;QACT,GAAG,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACnB,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC;QACnC,KAAK,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC;QAChC,QAAQ,EAAC,EAAC,IAAI,EAAC,SAAS,EAAC,OAAO,EAAC,CAAC,EAAC;QACnC,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACvB,OAAO,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACvB,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;QACzB,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC;KAC5B;CACF,CAAA"}
@@ -0,0 +1,31 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.simplemasterdata = void 0;
4
+ const type_1 = require("../type");
5
+ exports.simplemasterdata = {
6
+ type: "object",
7
+ "x-simpleapp-config": {
8
+ isolationType: type_1.IsolationType.org,
9
+ pageType: "crud",
10
+ schemaType: type_1.SupportedSchemaType.simplemasterdata,
11
+ documentType: '',
12
+ documentName: '',
13
+ },
14
+ properties: {
15
+ _id: { type: 'string' },
16
+ tenantId: { type: 'integer', default: 1, description: "system field" },
17
+ orgId: { type: 'integer', default: 1, description: "system field" },
18
+ branchId: { type: 'integer', default: 1, description: "system field" },
19
+ created: { type: 'string', description: "system field" },
20
+ updated: { type: 'string', description: "system field" },
21
+ createdby: { type: 'string', description: "system field" },
22
+ updatedby: { type: 'string', description: "system field" },
23
+ },
24
+ definitions: {
25
+ foreignkey: {
26
+ type: "object",
27
+ properties: { _id: { "type": "string" }, label: { "type": "string" }, code: { "type": "string" } }
28
+ }
29
+ },
30
+ };
31
+ //# source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QAAQ,EAAC,EAAC;SACzF;KACF;CACF,CAAA"}
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transaction = void 0;
4
+ const type_1 = require("../type");
5
+ exports.transaction = {
6
+ type: "object",
7
+ "x-simpleapp-config": {
8
+ isolationType: type_1.IsolationType.org,
9
+ requiredRoles: [],
10
+ documentType: '',
11
+ documentName: '',
12
+ pageType: "crud",
13
+ uniqueKey: "documentNo",
14
+ documentTitle: "documentTitle",
15
+ generateDocumentNumber: true,
16
+ documentDate: "documentDate",
17
+ allStatus: [
18
+ { "status": "D", statusName: "Draft", "readOnly": true, "actions": ["confirm", "void"] },
19
+ { "status": "CO", statusName: "Confirmed", "readOnly": true, "actions": ["revert", "void"] },
20
+ { "status": "V", statusName: "Void", "readOnly": true, "actions": ["revert"] },
21
+ ],
22
+ additionalApis: [{
23
+ action: "confirm",
24
+ entrypoint: ":id/confirm",
25
+ requiredrole: [],
26
+ method: type_1.RESTMethods.post,
27
+ execute: "setDocumentStatus",
28
+ description: "confirm document and change status to CO"
29
+ }, {
30
+ action: "void",
31
+ entrypoint: ":id/void",
32
+ querypara: ["reason"],
33
+ requiredrole: [],
34
+ method: type_1.RESTMethods.post,
35
+ execute: "setDocumentStatus",
36
+ description: "confirm document and change status to V"
37
+ }, {
38
+ action: "revert",
39
+ entrypoint: ":id/revert",
40
+ requiredrole: [],
41
+ method: type_1.RESTMethods.post,
42
+ execute: "setDocumentStatus",
43
+ description: "revert document and change status to D"
44
+ }],
45
+ // simple => pure model and service(no page,api),
46
+ // default => force masterdata property,
47
+ // transaction => force masterdata property
48
+ schemaType: type_1.SupportedSchemaType.transaction,
49
+ },
50
+ properties: {
51
+ _id: { type: 'string', description: "system field" },
52
+ tenantId: { type: 'integer', default: 1, description: "system field" },
53
+ orgId: { type: 'integer', default: 1, description: "system field" },
54
+ branchId: { type: 'integer', default: 1, description: "system field" },
55
+ created: { type: 'string', description: "system field" },
56
+ updated: { type: 'string', description: "system field" },
57
+ createdby: { type: 'string', description: "system field" },
58
+ updatedby: { type: 'string', description: "system field" },
59
+ docNoFormat: {
60
+ type: "object",
61
+ "x-foreignkey": "docnoformat",
62
+ properties: { _id: { "type": "string" }, label: { "type": "string" } },
63
+ description: "system field"
64
+ },
65
+ docStatus: { type: "string", description: "system field" }
66
+ },
67
+ definitions: {
68
+ foreignkey: {
69
+ type: "object",
70
+ properties: { _id: { "type": "string" }, label: { "type": "string" }, code: { "type": "string" } }
71
+ }
72
+ },
73
+ };
74
+ //# sourceMappingURL=transaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"transaction.js","sourceRoot":"","sources":["../../src/schematype/transaction.ts"],"names":[],"mappings":";;;AAAA,kCAAgF;AACnE,QAAA,WAAW,GAAc;IAClC,IAAI,EAAC,QAAQ;IACb,oBAAoB,EAAC;QACnB,aAAa,EAAC,oBAAa,CAAC,GAAG;QAC/B,aAAa,EAAC,EAAE;QAChB,YAAY,EAAC,EAAE;QACf,YAAY,EAAC,EAAE;QACf,QAAQ,EAAC,MAAM;QACf,SAAS,EAAC,YAAY;QACtB,aAAa,EAAC,eAAe;QAC7B,sBAAsB,EAAC,IAAI;QAC3B,YAAY,EAAC,cAAc;QAC3B,SAAS,EAAC;YACR,EAAC,QAAQ,EAAC,GAAG,EAAC,UAAU,EAAC,OAAO,EAAC,UAAU,EAAC,IAAI,EAAC,SAAS,EAAC,CAAC,SAAS,EAAC,MAAM,CAAC,EAAC;YAC9E,EAAC,QAAQ,EAAC,IAAI,EAAC,UAAU,EAAC,WAAW,EAAC,UAAU,EAAC,IAAI,EAAC,SAAS,EAAC,CAAC,QAAQ,EAAC,MAAM,CAAC,EAAC;YAClF,EAAC,QAAQ,EAAC,GAAG,EAAC,UAAU,EAAC,MAAM,EAAC,UAAU,EAAC,IAAI,EAAC,SAAS,EAAC,CAAC,QAAQ,CAAC,EAAC;SACtE;QACD,cAAc,EAAC,CAAC;gBACd,MAAM,EAAC,SAA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AW,EAAC,cAAc,EAAC;QACpD,SAAS,EAAC,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;QACpD,WAAW,EAAE;YACX,IAAI,EAAE,QAAQ;YACd,cAAc,EAAC,aAAa;YAC5B,UAAU,EAAE,EAAC,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC;YAC/D,WAAW,EAAE,cAAc;SAC5B;QACD,SAAS,EAAE,EAAC,IAAI,EAAC,QAAQ,EAAC,WAAW,EAAC,cAAc,EAAC;KACrD;IACD,WAAW,EAAC;QACX,UAAU,EAAE;YACV,IAAI,EAAC,QAAQ;YACb,UAAU,EAAE,EAAC,GAAG,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,KAAK,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC,IAAI,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,EAAC;SACzF;KACF;CACF,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simitgroup/simpleapp-generator",
3
- "version": "2.0.1n-alpha",
3
+ "version": "2.0.1p-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -63,7 +63,7 @@ export class MaintenanceService {
63
63
  }
64
64
  }
65
65
  async runGetEnvironment(appUser: UserContext) {
66
- const res = await this.sysEnvdoc.findOne();
66
+ const res = await this.sysEnvdoc.findOne();
67
67
  return res;
68
68
  }
69
69
  async runUpdateEnvironment(appUser: UserContext, data: Environment) {
@@ -71,9 +71,9 @@ export class MaintenanceService {
71
71
  systemEnable: data.systemEnable !== undefined ? data.systemEnable : true,
72
72
  stopUntil: data.stopUntil ?? '',
73
73
  maintenanceMessage: data.maintenanceMessage ?? '',
74
- adminEmails: data.adminEmails.map((item) => item.replace(' ', '')) ?? [],
75
- billingEmails: data.billingEmails.map((item) => item.replace(' ', '')) ?? [],
76
- supportEmails: data.supportEmails.map((item) => item.replace(' ', '')) ?? [],
74
+ adminEmails: (data.adminEmails ?? []).map((item) => item.replace(' ', '')),
75
+ billingEmails: (data.billingEmails ?? []).map((item) => item.replace(' ', '')),
76
+ supportEmails: (data.supportEmails ?? []).map((item) => item.replace(' ', '')),
77
77
  taxRate: data.taxRate ?? 0.0,
78
78
  taxName: data.taxName ?? '',
79
79
  updated: new Date().toISOString(),
@@ -18,6 +18,8 @@ import { ProfileModule } from './profile/profile.module';
18
18
  import { SimpleAppUserContextModule } from './user-context/user-context.module';
19
19
  import { SimpleAppWebhookModule } from './webhook/webhook.module';
20
20
  import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
21
+ import { SimpleAppCronModule } from './cron/cron.module';
22
+
21
23
  @Module({
22
24
  imports: [
23
25
  AutoIncreamentModule,
@@ -31,6 +33,7 @@ import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
31
33
  SimpleAppWebhookModule,
32
34
  SimpleAppMiniAppModule,
33
35
  SimpleAppSoftwarePolicyModule,
36
+ SimpleAppCronModule
34
37
  ],
35
38
  controllers: [],
36
39
  providers: [],
@@ -46,6 +49,7 @@ import { AutoIncreamentModule } from './auto-increament/auto-increament.module';
46
49
  SimpleAppWebhookModule,
47
50
  SimpleAppMiniAppModule,
48
51
  SimpleAppSoftwarePolicyModule,
52
+ SimpleAppCronModule
49
53
  ],
50
54
  })
51
55
  export class SimpleAppCoreFeaturesModule {}
@@ -432,7 +432,7 @@ export class UserContext extends UserContextInfo {
432
432
  foreignField: 'orgId',
433
433
  },
434
434
  },
435
- { $unwind: '$org' },
435
+ { $unwind: { path: '$org', preserveNullAndEmptyArrays: true } },
436
436
  ],
437
437
  },
438
438
  },
@@ -447,6 +447,7 @@ export class UserContext extends UserContextInfo {
447
447
  branchCode: '$b.branchCode',
448
448
  branchName: '$b.branchName',
449
449
  branchId: '$b.branchId',
450
+ imageUrl: '$b.imageUrl',
450
451
  },
451
452
 
452
453
  groups: 1,
@@ -761,12 +762,12 @@ export class UserContext extends UserContextInfo {
761
762
  const result = await res.save({ session: this.dbsession });
762
763
  this.logger.log(result, 'accept invitation 1');
763
764
  // Set permission of all user under this.user_id
764
- const updateresult = await this.permModel.updateMany({ uid: '', user_id: res._id }, { uid: this.getUid() }).session(this.dbsession);
765
+ const updateresult = await this.permModel.updateMany({ uid: '', userId: res._id }, { uid: this.getUid() }).session(this.dbsession);
765
766
  this.logger.log(updateresult, 'update all permission');
766
767
  return true;
767
768
  } else {
768
769
  await this.userModel.deleteOne({ _id: id }).session(this.dbsession);
769
- await this.permModel.deleteMany({ uid: '', user_id: res._id }).session(this.dbsession);
770
+ await this.permModel.deleteMany({ uid: '', userId: res._id }).session(this.dbsession);
770
771
  return true;
771
772
  }
772
773
  } else {
@@ -357,7 +357,6 @@ export class SimpleAppService<T extends SchemaFields> {
357
357
  }
358
358
  }
359
359
 
360
-
361
360
  /**
362
361
  * create many from array, for performance reason it submit all item in 1 go, so it won't implement hooks
363
362
  * @param appuser
@@ -377,7 +376,7 @@ export class SimpleAppService<T extends SchemaFields> {
377
376
  }
378
377
  const dbsession = appuser.getDBSession();
379
378
  if (dbsession && !dbsession.inTransaction()) {
380
- dbsession.startTransaction({readConcern:{level:"snapshot"},writeConcern:{w:"majority"}, readPreference: 'primary' });
379
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
381
380
  }
382
381
 
383
382
  try {
@@ -404,7 +403,7 @@ export class SimpleAppService<T extends SchemaFields> {
404
403
  }
405
404
  const dbsession = appuser.getDBSession();
406
405
  if (dbsession && !dbsession.inTransaction() && !noStartTransaction) {
407
- dbsession.startTransaction({readConcern:{level:"snapshot"},writeConcern:{w:"majority"}, readPreference: 'primary' });
406
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
408
407
  }
409
408
 
410
409
  this.logger.debug('this.withDocNumberFormat :' + this.withDocNumberFormat + ' && ' + '!data[this.documentIdentityCode] ==' + !data[this.documentIdentityCode]);
@@ -550,7 +549,7 @@ export class SimpleAppService<T extends SchemaFields> {
550
549
  }
551
550
  const dbsession = appuser.getDBSession();
552
551
  if (dbsession && !dbsession.inTransaction()) {
553
- dbsession.startTransaction({readConcern:{level:"snapshot"},writeConcern:{w:"majority"}, readPreference: 'primary' });
552
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
554
553
  }
555
554
 
556
555
  let dependency;
@@ -560,8 +559,7 @@ export class SimpleAppService<T extends SchemaFields> {
560
559
 
561
560
  // if (this.hooks.beforeDelete) await this.hooks.beforeDelete(appuser, id, deletedata);
562
561
  this.logger.debug('delete record', this.documentName, id);
563
- dependency = await this.getRelatedRecords(appuser, id);
564
- //console.log('dependency', dependency);
562
+ await this.identifyForeignKeys(appuser,deletedata)
565
563
  if (!dependency) {
566
564
  const filterIsolation = this.getIsolationFilter(appuser);
567
565
  this.polishIsolationFilter(filterIsolation);
@@ -629,7 +627,7 @@ export class SimpleAppService<T extends SchemaFields> {
629
627
 
630
628
  const dbsession = appuser.getDBSession();
631
629
  if (dbsession && !dbsession.inTransaction() && !noStartTransaction) {
632
- dbsession.startTransaction({readConcern:{level:"snapshot"},writeConcern:{w:"majority"}, readPreference: 'primary' });
630
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
633
631
  }
634
632
  // try {
635
633
  Object.assign(data, appuser.getUpdateFilter());
@@ -688,7 +686,7 @@ export class SimpleAppService<T extends SchemaFields> {
688
686
 
689
687
  const dbsession = appuser.getDBSession();
690
688
  if (dbsession && !dbsession.inTransaction()) {
691
- dbsession.startTransaction({readConcern:{level:"snapshot"},writeConcern:{w:"majority"}, readPreference: 'primary' });
689
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
692
690
  }
693
691
  // try {
694
692
  // Object.assign(data, appuser.getUpdateFilter());
@@ -744,7 +742,7 @@ export class SimpleAppService<T extends SchemaFields> {
744
742
  await this.runEvent(appuser, this.setHookName('beforePatch'), { id: id, patchData: data, prevData: existingdata }, false);
745
743
  const dbsession = appuser.getDBSession();
746
744
  if (dbsession && !dbsession.inTransaction()) {
747
- dbsession.startTransaction({readConcern:{level:"snapshot"},writeConcern:{w:"majority"}, readPreference: 'primary' });
745
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
748
746
  }
749
747
  // try {
750
748
  Object.assign(data, appuser.getUpdateFilter());
@@ -782,7 +780,22 @@ export class SimpleAppService<T extends SchemaFields> {
782
780
  throw new InternalServerErrorException(err.message);
783
781
  }
784
782
  };
785
-
783
+ async deleteMany(appUser:UserContext, filter: FilterQuery<T>){
784
+ const dbsession = appUser.getDBSession();
785
+ if (dbsession && !dbsession.inTransaction()) {
786
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
787
+ }
788
+ const searchResult = await this.search(appUser,filter,[])
789
+ const ids = searchResult.map(row=>row._id)
790
+ const result = await this.doc.deleteMany({_id: {$in: ids}})
791
+ console.log(`Delete ${this.documentName} ids`, ids,result)
792
+ for(const id of ids){
793
+ appUser.addDeletedRecordId(this.documentName,id)
794
+ }
795
+ return result
796
+ //updateMany(isolationFilter, { $set: patch }, { session: dbsession });
797
+
798
+ }
786
799
  async patchMany<T>(appuser: UserContext, data: PatchManyRequest<T>) {
787
800
  // filter = {
788
801
  // _id: '7eb2661a-6ea6-406e-b868-2e8b19c4658b',
@@ -799,7 +812,7 @@ export class SimpleAppService<T extends SchemaFields> {
799
812
  // Get DB Session
800
813
  const dbsession = appuser.getDBSession();
801
814
  if (dbsession && !dbsession.inTransaction()) {
802
- dbsession.startTransaction({readConcern:{level:"snapshot"},writeConcern:{w:"majority"}, readPreference: 'primary' });
815
+ dbsession.startTransaction({ readConcern: { level: 'snapshot' }, writeConcern: { w: 'majority' }, readPreference: 'primary' });
803
816
  }
804
817
 
805
818
  const result = await this.doc.updateMany(isolationFilter, { $set: patch }, { session: dbsession });
@@ -0,0 +1,10 @@
1
+ import { Module } from '@nestjs/common';
2
+ @Module({
3
+ imports: [],
4
+ controllers: [],
5
+ providers: [
6
+
7
+ ],
8
+ exports: [],
9
+ })
10
+ export class CronModule {}