@simitgroup/simpleapp-generator 2.0.1-y-alpha → 2.0.2-a-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 (48) hide show
  1. package/ReleaseNote.md +12 -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/basic/miniApi/resource.controller.ts.eta +3 -1
  44. package/templates/basic/nest/controller.ts.eta +1 -0
  45. package/templates/nest/src/simple-app/_core/features/document-no-format/document-no-format.service.ts.eta +19 -13
  46. package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +1 -0
  47. package/templates/nest/src/simple-app/_core/framework/simple-app.interceptor.ts.eta +1 -1
  48. package/templates/nuxt/app.vue.eta +1 -1
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,OAAO,CAAE,YAAY,CAAC,CAAA;AACvC,MAAM,EAAE,GAAG,OAAO,CAAE,IAAI,CAAC,CAA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,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
+ //# sourceMappingURL=simplemasterdata.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simplemasterdata.js","sourceRoot":"","sources":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.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,SAAS;gBAChB,UAAU,EAAC,aAAa;gBACxB,YAAY,EAAC,EAAE;gBACf,MAAM,EAAC,kBAAW,CAA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,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.1y-alpha",
3
+ "version": "2.0.2a-alpha",
4
4
  "description": "frontend nuxtjs and backend nests code generator using jsonschema",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {
@@ -6,6 +6,7 @@
6
6
  const uglyName = upperFirstCase(it.name ?? '');
7
7
  const schemaName = `SimtrainSchema.${pascalName}Dto`;
8
8
  const schemaAutoCompleteName = `SimtrainSchema.${pascalName}AutoCompleteDto`;
9
+ const partialSchemaName = `SimtrainPartialSchema.Partial${pascalName}Dto`;
9
10
 
10
11
  const serviceVariable = it.resourceName + 'Service';
11
12
 
@@ -49,6 +50,7 @@ import { <%= pascalName %>Service } from './<%= kebabName %>.service';
49
50
  import { ResourceApiListDto } from '../../dto/resource-api.schema';
50
51
  import * as SimtrainSchema from '../../../../openapi/backend-dto/dtos/Api';
51
52
  import { Filter } from 'mongodb';
53
+ import * as SimtrainPartialSchema from 'src/openapi/backend-dto/dtos/PartialType';
52
54
 
53
55
  @ApiTags('<%= titleName %>')
54
56
  @Controller('resources/<%= kebabName %>')
@@ -108,7 +110,7 @@ export class <%= pascalName %>Controller {
108
110
  <% } else if(action === 'patch') { %>
109
111
  @Patch(':id')
110
112
  @ApiOperation({ operationId: 'patch' })
111
- @ApiBody({ type: PartialType(<%= schemaName %>), required: true })
113
+ @ApiBody({ type: <%= partialSchemaName %>, required: true })
112
114
  @ApiResponse({ status: 200, description: 'Success', type: <%= schemaName %> })
113
115
  @ApiResponse({ status: 400, description: 'Bad Request' })
114
116
  @ApiResponse({ status: 404, description: 'Not Found' })
@@ -269,6 +269,7 @@ export class <%= it.typename %>Controller extends SimpleAppController<
269
269
  @Post(':id/set-<%=statusname%>')
270
270
  @ApiBody({ description: 'Document data', type: Object })
271
271
  @Roles(Role.SuperAdmin,Role.<%= `${it.typename}_${statusname}`%>)
272
+ <%~ drawMiniAppScope(statusname) %>
272
273
  async setStatus<%=capitalizeFirstLetter(statusname)%>(@AppUser() appuser: UserContext,@Param('id') id: string, @Body() data:any,){
273
274
  return await this.service.setDocumentStatus(appuser,id,data,'<%=statusname%>',)
274
275
  }
@@ -59,18 +59,23 @@ export class SimpleAppDocumentNoFormatService {
59
59
  const filter = { docNoType: doctype, active: true };
60
60
  if (id) {
61
61
  filter['_id'] = id;
62
+ } else {
63
+ // Only use default formats when no specific format ID is provided
64
+ filter['default'] = true;
62
65
  }
63
66
  //
64
67
  Object.assign(filter, appUser.getBranchFilter());
65
- const result = await this.docformat.find(filter).session(appUser.getDBSession());
68
+ const session = appUser.getDBSession()
69
+ const result = await this.docformat.find(filter)//.session(session);
66
70
  if (result && result.length > 0) {
67
71
  const d: DocumentNoFormat = result[0];
68
72
  const recordId = d._id;
69
73
  const newdocno = SimpleAppDocumentNoFormatService.previewDocNo(d);
70
74
  const newnextnumber = d.nextNumber + 1;
71
75
  const updatedata = { nextNumber: newnextnumber } as DocumentNoFormat;
72
- const updateresult = await this.docformat.findByIdAndUpdate(recordId, updatedata).session(appUser.getDBSession());
73
76
 
77
+ const options = process.env.BlockGenerateDocNumberWithSession ? {} : {session:session}
78
+ const updateresult = await this.docformat.findByIdAndUpdate(recordId, updatedata,options)
74
79
  if (updateresult) {
75
80
  const result: DocNumberFormatResult = {
76
81
  formatId: d._id,
@@ -187,9 +192,9 @@ export class SimpleAppDocumentNoFormatService {
187
192
  return await this.docformat.find<DocumentNoFormat>(filter, null, { session: appUser.getDBSession() });
188
193
  }
189
194
 
190
- async requestMultipleNumbers(appUser: UserContext, doctype: string, quantity:number, id: string = '') {
195
+ async requestMultipleNumbers(appUser: UserContext, doctype: string, quantity: number, id: string = '') {
191
196
  doctype = doctype.toUpperCase();
192
- const documentNumbers: string[] = []
197
+ const documentNumbers: string[] = [];
193
198
  const filter = { docNoType: doctype, active: true };
194
199
  if (id) {
195
200
  filter['_id'] = id;
@@ -199,18 +204,19 @@ export class SimpleAppDocumentNoFormatService {
199
204
  const result = await this.docformat.find(filter).session(appUser.getDBSession());
200
205
  if (result && result.length > 0) {
201
206
  const d: DocumentNoFormat = result[0];
202
- const recordId = d._id;
203
-
204
- for(let i=0;i<quantity;i++){
205
- d.nextNumber++
207
+ const recordId = d._id;
208
+
209
+ for (let i = 0; i < quantity; i++) {
210
+ d.nextNumber++;
206
211
  const newdocno = SimpleAppDocumentNoFormatService.previewDocNo(d);
207
- documentNumbers.push(newdocno)
212
+ documentNumbers.push(newdocno);
213
+ }
214
+ const updatedata = { nextNumber: d.nextNumber + 1 } as DocumentNoFormat;
208
215
 
209
- }
210
- const updatedata = { nextNumber: d.nextNumber+1 } as DocumentNoFormat;
211
- const updateresult = await this.docformat.findByIdAndUpdate(recordId, updatedata).session(appUser.getDBSession());
216
+ const options = process.env.BlockGenerateDocNumberWithSession ? {} : {session:appUser.getDBSession()}
217
+ const updateresult = await this.docformat.findByIdAndUpdate(recordId, updatedata,options)
212
218
 
213
- return documentNumbers
219
+ return documentNumbers;
214
220
  } else {
215
221
  throw new BadRequestException(`No active document number found for ${doctype}. Please update in Settings > Document Numbering Format`);
216
222
  }
@@ -448,6 +448,7 @@ export class UserContext extends UserContextInfo {
448
448
  branchName: '$b.branchName',
449
449
  branchId: '$b.branchId',
450
450
  imageUrl: '$b.imageUrl',
451
+ active: '$b.active'
451
452
  },
452
453
 
453
454
  groups: 1,
@@ -114,7 +114,7 @@ export class SimpleAppInterceptor implements NestInterceptor {
114
114
  await session.commitTransaction(); //.then(()=>session.endSession());
115
115
  }
116
116
  }
117
- // session.endSession()
117
+ await session.endSession()
118
118
  }),
119
119
  );
120
120
  }
@@ -56,7 +56,7 @@ onMounted(async()=>{
56
56
  if(getCurrentXorg()===''){
57
57
  goTo('picktenant')
58
58
  }else if(!currentgroup){
59
- goTo('pickgroup')
59
+ navigateTo('/pickgroup')
60
60
  }
61
61
  setGraphqlServer()
62
62
  }else{