@simitgroup/simpleapp-generator 1.5.0-alpha → 1.6.0-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 (142) hide show
  1. package/README.md +3 -1
  2. package/dist/buildinschemas/branch.d.ts.map +1 -1
  3. package/dist/buildinschemas/branch.js +10 -0
  4. package/dist/buildinschemas/branch.js.map +1 -1
  5. package/dist/buildinschemas/index.d.ts +2 -0
  6. package/dist/buildinschemas/index.d.ts.map +1 -1
  7. package/dist/buildinschemas/index.js +5 -1
  8. package/dist/buildinschemas/index.js.map +1 -1
  9. package/dist/buildinschemas/keyvaluepair.d.ts +3 -0
  10. package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -0
  11. package/dist/buildinschemas/keyvaluepair.js +28 -0
  12. package/dist/buildinschemas/keyvaluepair.js.map +1 -0
  13. package/dist/buildinschemas/message.d.ts +3 -0
  14. package/dist/buildinschemas/message.d.ts.map +1 -0
  15. package/dist/buildinschemas/message.js +34 -0
  16. package/dist/buildinschemas/message.js.map +1 -0
  17. package/dist/buildinschemas/organization.d.ts.map +1 -1
  18. package/dist/buildinschemas/organization.js +18 -1
  19. package/dist/buildinschemas/organization.js.map +1 -1
  20. package/dist/buildinschemas/systemmessage.d.ts +3 -0
  21. package/dist/buildinschemas/systemmessage.d.ts.map +1 -0
  22. package/dist/buildinschemas/systemmessage.js +43 -0
  23. package/dist/buildinschemas/systemmessage.js.map +1 -0
  24. package/dist/framework.d.ts.map +1 -1
  25. package/dist/framework.js +3 -2
  26. package/dist/framework.js.map +1 -1
  27. package/dist/generate.d.ts.map +1 -1
  28. package/dist/generate.js +37 -9
  29. package/dist/generate.js.map +1 -1
  30. package/dist/processors/bpmnbuilder.d.ts.map +1 -1
  31. package/dist/processors/bpmnbuilder.js +23 -32
  32. package/dist/processors/bpmnbuilder.js.map +1 -1
  33. package/dist/processors/jrxmlbuilder.d.ts +3 -0
  34. package/dist/processors/jrxmlbuilder.d.ts.map +1 -0
  35. package/dist/processors/jrxmlbuilder.js +57 -0
  36. package/dist/processors/jrxmlbuilder.js.map +1 -0
  37. package/dist/type.d.ts +6 -0
  38. package/dist/type.d.ts.map +1 -1
  39. package/package.json +1 -1
  40. package/src/buildinschemas/branch.ts +10 -0
  41. package/src/buildinschemas/index.ts +2 -0
  42. package/src/buildinschemas/keyvaluepair.ts +26 -0
  43. package/src/buildinschemas/organization.ts +18 -1
  44. package/src/buildinschemas/systemmessage.ts +42 -0
  45. package/src/framework.ts +3 -2
  46. package/src/generate.ts +41 -13
  47. package/src/processors/bpmnbuilder.ts +34 -38
  48. package/src/processors/jrxmlbuilder.ts +38 -0
  49. package/src/type.ts +7 -1
  50. package/templates/basic/nest/apischema.ts.eta +1 -1
  51. package/templates/basic/nest/controller.ts.eta +37 -19
  52. package/templates/basic/nest/resolver.ts.eta +1 -1
  53. package/templates/basic/nest/service.ts.eta +22 -4
  54. package/templates/basic/nest/type.ts.eta +2 -2
  55. package/templates/basic/nuxt/pages.form.vue.eta +1 -1
  56. package/templates/basic/nuxt/pages.mobile.landing.vue.eta +4 -61
  57. package/templates/nest/src/app.module.ts.eta +2 -0
  58. package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +15 -0
  59. package/templates/nest/src/cloudapi/cloudapi.service.ts._eta +15 -0
  60. package/templates/nest/src/printapi/api/.gitignore.eta +4 -0
  61. package/templates/nest/src/printapi/api/.npmignore.eta +1 -0
  62. package/templates/nest/src/printapi/api/.openapi-generator/FILES.eta +8 -0
  63. package/templates/nest/src/printapi/api/.openapi-generator/VERSION.eta +1 -0
  64. package/templates/nest/src/printapi/api/.openapi-generator-ignore.eta +23 -0
  65. package/templates/nest/src/printapi/api/api.ts.eta +223 -0
  66. package/templates/nest/src/printapi/api/base.ts.eta +86 -0
  67. package/templates/nest/src/printapi/api/common.ts.eta +150 -0
  68. package/templates/nest/src/printapi/api/configuration.ts.eta +110 -0
  69. package/templates/nest/src/printapi/api/git_push.sh.eta +57 -0
  70. package/templates/nest/src/printapi/api/index.ts.eta +18 -0
  71. package/templates/nest/src/printapi/api/openapitools.json.eta +7 -0
  72. package/templates/nest/src/printapi/printapi.module.ts.eta +15 -0
  73. package/templates/nest/src/printapi/printapi.service.ts.eta +42 -0
  74. package/templates/nest/src/simpleapp/apischemas/index.ts._eta +25 -0
  75. package/templates/nest/src/simpleapp/generate/commons/robotuser.service.ts.eta +112 -0
  76. package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +7 -0
  77. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +8 -5
  78. package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +73 -0
  79. package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +104 -0
  80. package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +77 -0
  81. package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +115 -0
  82. package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +71 -0
  83. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +29 -9
  84. package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +49 -0
  85. package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +52 -0
  86. package/templates/nest/src/simpleapp/generate/types/index.ts.eta +0 -1
  87. package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +191 -0
  88. package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +208 -6
  89. package/templates/nest/src/simpleapp/generate/workflow/workflow.config.ts.eta +1 -1
  90. package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +2 -2
  91. package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +33 -28
  92. package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +107 -20
  93. package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +4 -4
  94. package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +43 -0
  95. package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +70 -0
  96. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +10 -3
  97. package/templates/nest/src/simpleapp/types/index.ts._eta +11 -0
  98. package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts.eta +31 -0
  99. package/templates/nuxt/assets/primevue/passthrough.ts._eta +1 -1
  100. package/templates/nuxt/components/button/ButtonAction.vue._eta +11 -5
  101. package/templates/nuxt/components/form/{FormBranch.vue.eta → FormBranch.vue._eta} +1 -1
  102. package/templates/nuxt/components/image/ImageAvatar.vue.eta.vue +38 -0
  103. package/templates/nuxt/components/image/ImageOrganization.vue.eta.vue +40 -0
  104. package/templates/nuxt/components/image/ImageToBase64Uploader.vue.eta.vue +147 -0
  105. package/templates/nuxt/components/list/ListItem.vue.eta +24 -0
  106. package/templates/nuxt/components/list/ListMessages.vue.eta +89 -0
  107. package/templates/nuxt/components/simpleApp/SimpleAppAutocomplete.vue.eta +1 -1
  108. package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +93 -7
  109. package/templates/nuxt/components/text/TextBold.vue._eta +13 -0
  110. package/templates/nuxt/composables/getUserStore.generate.ts.eta +11 -2
  111. package/templates/nuxt/composables/graphquery.generate.ts.eta +7 -7
  112. package/templates/nuxt/composables/hotvalue.generate.ts.eta +30 -0
  113. package/templates/nuxt/composables/pusher.ts._eta +13 -0
  114. package/templates/nuxt/composables/stringHelper.generate.ts.eta +2 -3
  115. package/templates/nuxt/composables/sysmessage.generate.ts.eta +20 -0
  116. package/templates/nuxt/composables/workflow.generate.ts.eta +9 -4
  117. package/templates/nuxt/layouts/mobile.vue._eta +31 -42
  118. package/templates/nuxt/nuxt.config.ts._eta +2 -2
  119. package/templates/nuxt/othermodules.d.ts.eta +449 -0
  120. package/templates/nuxt/pages/[xorg]/mobile/organization/[id].vue._eta +40 -0
  121. package/templates/nuxt/pages/[xorg]/mobile/organization/{index.vue.eta → index.vue.aetaz} +16 -13
  122. package/templates/nuxt/pages/[xorg]/organization.vue.eta +21 -15
  123. package/templates/nuxt/plugins/40.pusher.ts.eta +18 -0
  124. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +7 -1
  125. package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +4 -1
  126. package/templates/nuxt/types/schema.ts.eta +8 -1
  127. package/templates/nuxt/types/simpleappinput.ts.eta +3 -5
  128. package/templates/printformats/template.jrxml._eta +27 -0
  129. package/templates/project/groups/admin.json.eta +6 -1
  130. package/templates/project/jsonschemas/branch.json._eta +113 -0
  131. package/templates/project/jsonschemas/invoice.json._eta +5 -1
  132. package/templates/project/jsonschemas/organization.json._eta +111 -0
  133. package/templates/project/lang/default._json +70 -150
  134. package/templates/workflow/next/listener.ts.eta +6 -3
  135. package/tsconfig.tsbuildinfo +1 -1
  136. package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts._eta +0 -26
  137. /package/templates/nest/src/simpleapp/services/{autoinc.service.ts.eta → autoinc.service.ts.etaxx} +0 -0
  138. /package/templates/nest/src/simpleapp/services/{branch.service.ts.eta → branch.service.ts.etaxxx} +0 -0
  139. /package/templates/nest/src/simpleapp/services/{docno.service.ts.eta → docno.service.ts.etaxxx} +0 -0
  140. /package/templates/nest/src/simpleapp/services/{org.service.ts.eta → org.service.ts.etaxxx} +0 -0
  141. /package/templates/nest/src/simpleapp/services/{perm.service.ts.eta → perm.service.ts.etaxxx} +0 -0
  142. /package/templates/nest/src/simpleapp/services/{tenant.service.ts.eta → tenant.service.ts.etaxxx} +0 -0
@@ -31,6 +31,8 @@ import {
31
31
  HttpExceptionOptions,
32
32
  } from '@nestjs/common/exceptions';
33
33
  import { UserContext } from '../commons/user.context';
34
+ import {CloudApiService} from 'src/cloudapi/cloudapi.service'
35
+ import { PrintApiService } from 'src/printapi/printapi.service';
34
36
  import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
35
37
  import {
36
38
  IsolationType,
@@ -43,6 +45,10 @@ import {
43
45
  export class SimpleAppService<T extends { _id?: string }> {
44
46
  @Inject(EventEmitter2)
45
47
  protected eventEmitter: EventEmitter2;
48
+ @Inject(CloudApiService)
49
+ protected cloudapi: CloudApiService;
50
+ @Inject(PrintApiService)
51
+ protected printapi: PrintApiService;
46
52
  protected hooks: DefaultHooks<T> = {};
47
53
  protected logger = new Logger();
48
54
  protected strictIsolation = true;
@@ -79,6 +85,7 @@ export class SimpleAppService<T extends { _id?: string }> {
79
85
  this.documentType = doctype.toUpperCase();
80
86
  this.documentName = docname;
81
87
  this.doc = newdoc;
88
+
82
89
  this.isolationtype = isolationtype;
83
90
  if (this.hooks.init) this.hooks.init();
84
91
  // this.tenantdoc = tenantdoc
@@ -188,12 +195,15 @@ export class SimpleAppService<T extends { _id?: string }> {
188
195
  * @param filters
189
196
  * @returns
190
197
  */
191
- private async searchNoIsolation(appuser: UserContext, filters: Object) {
198
+ private async searchNoIsolation(
199
+ appuser: UserContext,
200
+ filters: FilterQuery<T>,
201
+ ) {
192
202
  try {
193
203
  if (this.hooks.beforeSearch)
194
204
  await this.hooks.beforeSearch(appuser, filters);
195
205
  const products = await this.doc.find(filters);
196
- const productlist = products.map((p: T) => {
206
+ const productlist = products.map((p) => {
197
207
  return p;
198
208
  });
199
209
  if (this.hooks.afterSearch)
@@ -235,7 +245,7 @@ export class SimpleAppService<T extends { _id?: string }> {
235
245
  this.polishIsolationFilter(isolationFilter);
236
246
 
237
247
  // console.log("initial search",filters)
238
- const newfilters = { ...filters, ...isolationFilter };
248
+ const newfilters: FilterQuery<T> = { ...filters, ...isolationFilter };
239
249
 
240
250
  if (this.hooks.beforeSearch)
241
251
  await this.hooks.beforeSearch(appuser, newfilters);
@@ -262,7 +272,8 @@ export class SimpleAppService<T extends { _id?: string }> {
262
272
  async findById(appuser: UserContext, id: string) {
263
273
  if (this.hooks.beforeFetchRecord)
264
274
  await this.hooks.beforeFetchRecord(appuser, id);
265
- const data = await this.search(appuser, { _id: id });
275
+
276
+ const data = await this.search(appuser, { _id: id as any });
266
277
  if (this.hooks.afterFetchRecord)
267
278
  await this.hooks.afterFetchRecord(appuser, data[0]);
268
279
 
@@ -561,8 +572,8 @@ export class SimpleAppService<T extends { _id?: string }> {
561
572
  });
562
573
  appuser.addUpdatedRecordId(this.documentName, data._id);
563
574
  if (this.hooks.afterUpdate)
564
- await this.hooks.afterUpdate(appuser, id, result);
565
- return result // await this.findById(appuser, id);
575
+ await this.hooks.afterUpdate(appuser, id, existingdata, result);
576
+ return result; // await this.findById(appuser, id);
566
577
  } catch (err) {
567
578
  this.logger.error(err);
568
579
  throw new InternalServerErrorException(err.message);
@@ -614,8 +625,8 @@ export class SimpleAppService<T extends { _id?: string }> {
614
625
  appuser.addUpdatedRecordId(this.documentName, data._id);
615
626
 
616
627
  if (this.hooks.afterUpdate)
617
- await this.hooks.afterUpdate(appuser, id, result);
618
- return result //await this.findById(appuser, id);
628
+ await this.hooks.afterUpdate(appuser, id, existingdata, result);
629
+ return result; //await this.findById(appuser, id);
619
630
  } catch (err) {
620
631
  throw new InternalServerErrorException(err.message);
621
632
  }
@@ -745,7 +756,11 @@ export class SimpleAppService<T extends { _id?: string }> {
745
756
  this.logger.debug(result, 'genNewDocNo');
746
757
  data[this.documentIdentityCode] = result;
747
758
  }
748
-
759
+ async runDefault(appuser: UserContext): Promise<unknown> {
760
+ return (
761
+ 'Hello this is ' + this.getDocumentType() + ': ' + this.getDocumentName()
762
+ );
763
+ }
749
764
  async identifyForeignKeys(appuser: UserContext, data: T) {
750
765
  /**
751
766
  * 1. looping schemas identify what foreign key exists
@@ -851,4 +866,9 @@ export class SimpleAppService<T extends { _id?: string }> {
851
866
  }
852
867
  }
853
868
  }
869
+
870
+ async print(appuser: UserContext, id: string, formatid: string) {
871
+ const pdfresult = await this.printapi.getBase64Pdf(appuser, formatid, id);
872
+ return pdfresult;
873
+ }
854
874
  }
@@ -0,0 +1,49 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2024-02-23
5
+ * Author: Ks Tan
6
+ */
7
+ import { UserContext } from '../commons/user.context';
8
+ import * as sharelibs from '../sharelibs';
9
+ import { Injectable,Inject } from '@nestjs/common';
10
+ import { InjectModel } from '@nestjs/mongoose';
11
+ import * as jsonpath from 'jsonpath';
12
+ import { Model } from 'mongoose';
13
+ import { SystemmessageJsonSchema } from '../jsonschemas/sysmsg.jsonschema';
14
+ import { SimpleAppService } from './simpleapp.processor';
15
+ import { IsolationType } from '../types';
16
+ import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
17
+ import { Systemmessage } from '../types/sysmsg.type';
18
+ import { DefaultSystemmessage } from '../defaults/sysmsg.default';
19
+
20
+ @Injectable()
21
+ export class SystemmessageProcessor extends SimpleAppService<Systemmessage> {
22
+ protected documentIdentityCode = '';
23
+ protected documentIdentityLabel = 'messageTitle';
24
+
25
+ protected foreignkeys = {};
26
+ constructor(mydoc: Model<Systemmessage>) {
27
+ super('SYSMSG', 'systemmessage', mydoc, IsolationType.tenant);
28
+ this.setSchema(SystemmessageJsonSchema);
29
+ this.setData(DefaultSystemmessage(crypto.randomUUID()));
30
+ }
31
+
32
+ reCalculateValue(data: Systemmessage) {
33
+ //console.log('trigger new recalculate')
34
+ const jsopbj = new jsonpath['JSONPath']();
35
+ }
36
+
37
+ /***************************** additional execute *****************************************/
38
+ async runDefault(appuser: UserContext) {
39
+ return await this.search(appuser, { uid: appuser.getUid() });
40
+ }
41
+ async runReadmsg(appuser:UserContext,id:string){
42
+ const data = await this.findById(appuser, id);
43
+ data.read=true
44
+ await await this.findIdThenUpdate(appuser,id,data)
45
+ return data
46
+ }
47
+
48
+
49
+ }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2024-02-23
5
+ * Author: Ks Tan
6
+ */
7
+ import { UserContext } from '../commons/user.context';
8
+ import * as sharelibs from '../sharelibs';
9
+ import { Injectable,Inject } from '@nestjs/common';
10
+ import { InjectModel } from '@nestjs/mongoose';
11
+ import * as jsonpath from 'jsonpath';
12
+ import { Model } from 'mongoose';
13
+ import { TenantJsonSchema } from '../jsonschemas/tenant.jsonschema';
14
+ import { SimpleAppService } from './simpleapp.processor';
15
+ import { IsolationType ,TenantHooks} from '../types';
16
+ import { DocNumberFormatGenerator } from '../commons/docnogenerator.service';
17
+ import { TenantOwner, Tenant } from '../types/tenant.type';
18
+ import { DefaultTenantOwner, DefaultTenant } from '../defaults/tenant.default';
19
+ import { AutoincreamentService } from '../../services/autoinc.service';
20
+ @Injectable()
21
+ export class TenantProcessor extends SimpleAppService<Tenant> {
22
+ @Inject(AutoincreamentService)
23
+ protected increament: AutoincreamentService;
24
+
25
+ protected documentIdentityCode = 'tenantId';
26
+ protected documentIdentityLabel = 'tenantName';
27
+ protected hooks : TenantHooks = {
28
+ beforeCreate: async (appuser: UserContext, data: Tenant) => await this.tenantBeforeCreate(appuser,data),
29
+ };
30
+
31
+ protected foreignkeys = { user: ['$.owner._id'] };
32
+ constructor(mydoc: Model<Tenant>) {
33
+ super('TENANT', 'tenant', mydoc, IsolationType.none);
34
+ this.setSchema(TenantJsonSchema);
35
+ this.setData(DefaultTenant(crypto.randomUUID()));
36
+ }
37
+
38
+ reCalculateValue(data: Tenant) {
39
+ //console.log('trigger new recalculate')
40
+ const jsopbj = new jsonpath['JSONPath']();
41
+ }
42
+
43
+ /***************************** additional execute *****************************************/
44
+ async tenantBeforeCreate(appuser:UserContext,data:Tenant){
45
+ const searchresult = await this.increament.runGenerateNextNo(
46
+ appuser,
47
+ 'tenant',
48
+ 'tenantId',
49
+ );
50
+ data.tenantId = searchresult.nextno;
51
+ }
52
+ }
@@ -4,5 +4,4 @@ export * from './<%= d['doctype']%>.type'
4
4
  <%}%>
5
5
  export * from './simpleapp.type'
6
6
  export * from './workflow.type'
7
-
8
7
  export * from '../../types';
@@ -0,0 +1,191 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2024-02-23
5
+ * Author: Ks Tan
6
+ */
7
+ import { JSONSchema7,JSONSchema7Type,JSONSchema7Version, JSONSchema7TypeName,JSONSchema7Definition } from 'json-schema';
8
+ export type DocumentStatus = {
9
+ status:string //'CO', 'V', 'CL', 'D' and etc
10
+ statusName:string
11
+ readOnly:boolean
12
+ actions: string[] //api name ['confirm','revert','close','void' and etc]
13
+ }
14
+ export enum RESTMethods {'post'='post','get'='get', 'delete'='delete','put'='put', 'patch'='patch'}
15
+ export type DocumentApi = {
16
+ action:string //api action name
17
+ entryPoint:string //api entry point example:':id', ':id/confirm'
18
+ queryPara?:string[] //what query parameter wish to accept, example: ['description','date']
19
+ requiredRole?: string[] // what special user role wish to allow for this api, example: ['SuperUser']
20
+ workflowSetting?: {bpmn:string} //optional property, once define code gen connect the bpmn workflow
21
+ method:RESTMethods
22
+ schema?:string //any schema/type name in types & apischemas
23
+ responseType?:string //any schema/type name for response
24
+ description:string //description of api
25
+ }
26
+ export enum IsolationType {"none"="none" , "tenant"="tenant","org"="org", "branch"="branch"}
27
+ // export type ImportLibs = {"lib":string,"as":string}
28
+ export type Formula = {
29
+ jsonPath:string //example: "$.subtotal","$.details[*]"
30
+ formula:string //example "jslib.getDocumentSubTotal(@F{$.details})"
31
+ }
32
+ export type SchemaConfig = {
33
+ isolationType: IsolationType
34
+ requiredRoles?:string[]
35
+ pageType?: string
36
+ uniqueKey?:string
37
+ uniqueKeys?:string[][]
38
+ documentTitle?:string
39
+ generateDocumentNumber?:boolean
40
+ documentDate?:string
41
+ allStatus?:DocumentStatus[]
42
+ additionalApis?:DocumentApi[]
43
+ additionalAutoCompleteFields ?: string[]
44
+ // libs?:ImportLibs[] // both process class and frontend client class will import same lib
45
+ formulas?: Formula[]
46
+ documentType: string
47
+ documentName: string
48
+ collectionName?: string
49
+ foreignKeys?:MyForeignKey,
50
+ }
51
+ export type MyForeignKey = {
52
+ [collectionname:string]:string[]
53
+ }
54
+
55
+ export type SchemaType = {
56
+ type:string
57
+ definitions?:SimpleAppJSONSchema7
58
+ required?:string[]
59
+
60
+ "x-simpleapp-config":SchemaConfig
61
+ properties: SchemaFields
62
+ }
63
+
64
+
65
+ export type SchemaFields = {
66
+ _id: SimpleAppJSONSchema7
67
+ tenantId: SimpleAppJSONSchema7
68
+ orgId: SimpleAppJSONSchema7
69
+ branchId: SimpleAppJSONSchema7
70
+ created: SimpleAppJSONSchema7
71
+ updated: SimpleAppJSONSchema7
72
+ createdBy: SimpleAppJSONSchema7
73
+ updatedBy: SimpleAppJSONSchema7
74
+ [key:string]:SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined
75
+
76
+ }
77
+
78
+
79
+
80
+ // modified from jsonschemas
81
+ export type SimpleAppJSONSchema7Definition = SimpleAppJSONSchema7 | boolean;
82
+ export interface SimpleAppJSONSchema7 {
83
+
84
+ 'x-foreignkey' ?:string
85
+ $id?: string | undefined;
86
+ $ref?: string | undefined;
87
+ $schema?: JSONSchema7Version | undefined;
88
+ $comment?: string | undefined;
89
+
90
+ /**
91
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
92
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
93
+ */
94
+ $defs?: {
95
+ [key: string]: JSONSchema7Definition;
96
+ } | undefined;
97
+
98
+ /**
99
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
100
+ */
101
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
102
+ enum?: JSONSchema7Type[] | undefined;
103
+ const?: JSONSchema7Type | undefined;
104
+
105
+ /**
106
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
107
+ */
108
+ multipleOf?: number | undefined;
109
+ maximum?: number | undefined;
110
+ exclusiveMaximum?: number | undefined;
111
+ minimum?: number | undefined;
112
+ exclusiveMinimum?: number | undefined;
113
+
114
+ /**
115
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
116
+ */
117
+ maxLength?: number | undefined;
118
+ minLength?: number | undefined;
119
+ pattern?: string | undefined;
120
+
121
+ /**
122
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
123
+ */
124
+ items?: SimpleAppJSONSchema7Definition | SimpleAppJSONSchema7Definition[] | undefined;
125
+ additionalItems?: JSONSchema7Definition | undefined;
126
+ maxItems?: number | undefined;
127
+ minItems?: number | undefined;
128
+ uniqueItems?: boolean | undefined;
129
+ contains?: SimpleAppJSONSchema7Definition | undefined;
130
+
131
+ /**
132
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
133
+ */
134
+ maxProperties?: number | undefined;
135
+ minProperties?: number | undefined;
136
+ required?: string[] | undefined;
137
+ properties?: {
138
+ [key: string]: SimpleAppJSONSchema7Definition;
139
+ } | undefined;
140
+ patternProperties?: {
141
+ [key: string]: SimpleAppJSONSchema7Definition;
142
+ } | undefined;
143
+ additionalProperties?: SimpleAppJSONSchema7Definition | undefined;
144
+ dependencies?: {
145
+ [key: string]: SimpleAppJSONSchema7Definition | string[];
146
+ } | undefined;
147
+ propertyNames?: SimpleAppJSONSchema7Definition | undefined;
148
+
149
+ /**
150
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
151
+ */
152
+ if?: SimpleAppJSONSchema7Definition | undefined;
153
+ then?: SimpleAppJSONSchema7Definition | undefined;
154
+ else?: SimpleAppJSONSchema7Definition | undefined;
155
+
156
+ /**
157
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
158
+ */
159
+ allOf?: SimpleAppJSONSchema7Definition[] | undefined;
160
+ anyOf?: SimpleAppJSONSchema7Definition[] | undefined;
161
+ oneOf?: SimpleAppJSONSchema7Definition[] | undefined;
162
+ not?: SimpleAppJSONSchema7Definition | undefined;
163
+
164
+ /**
165
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
166
+ */
167
+ format?: string | undefined;
168
+
169
+ /**
170
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
171
+ */
172
+ contentMediaType?: string | undefined;
173
+ contentEncoding?: string | undefined;
174
+
175
+ /**
176
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
177
+ */
178
+ definitions?: {
179
+ [key: string]: JSONSchema7Definition;
180
+ } | undefined;
181
+
182
+ /**
183
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
184
+ */
185
+ title?: string | undefined;
186
+ description?: string | undefined;
187
+ default?: JSONSchema7Type | undefined;
188
+ readOnly?: boolean | undefined;
189
+ writeOnly?: boolean | undefined;
190
+ examples?: JSONSchema7Type | undefined;
191
+ }
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * This file was automatically generated by simpleapp generator. Every
3
3
  * MODIFICATION OVERRIDE BY GENERATEOR
4
- * last change 2024-01-25
4
+ * last change 2024-04-18
5
5
  * Author: Ks Tan
6
6
  */
7
- import { UserContext } from '../commons/user.context'
8
-
7
+ import { UserContext } from '../commons/user.context';
8
+ import { JSONSchema7,JSONSchema7Type,JSONSchema7Version, JSONSchema7TypeName,JSONSchema7Definition } from 'json-schema';
9
9
 
10
10
  export type ModifiedCollection = {
11
11
  [key: string]: string[];
@@ -43,9 +43,18 @@ export type DefaultHooks<T> = {
43
43
  afterValidation?: (appuser: UserContext, data: T) => Promise<void>;
44
44
  beforeCreate?: (appuser: UserContext, data: T) => Promise<void>;
45
45
  afterCreate?: (appuser: UserContext, data: T) => Promise<void>;
46
- beforeUpdate?: (appuser: UserContext, id: string, data: T, existingdata:T) => Promise<void>;
47
- afterUpdate?: (appuser: UserContext, id: string, data: T) => Promise<void>;
48
- beforeDelete?: (appuser: UserContext, id: string,deletedata:T) => Promise<void>;
46
+ beforeUpdate?: (
47
+ appuser: UserContext,
48
+ id: string,
49
+ data: T,
50
+ existingdata: T,
51
+ ) => Promise<void>;
52
+ afterUpdate?: (appuser: UserContext, id: string, prevdata: T,newdata:T) => Promise<void>;
53
+ beforeDelete?: (
54
+ appuser: UserContext,
55
+ id: string,
56
+ deletedata: T,
57
+ ) => Promise<void>;
49
58
  afterDelete?: (
50
59
  appuser: UserContext,
51
60
  result: DeleteResultType<T>,
@@ -88,3 +97,196 @@ export type DeleteResultType<T> = {
88
97
  deletedCount: number;
89
98
  };
90
99
  };
100
+
101
+
102
+ export type DocumentStatus = {
103
+ status:string //'CO', 'V', 'CL', 'D' and etc
104
+ statusName:string
105
+ readOnly:boolean
106
+ actions: string[] //api name ['confirm','revert','close','void' and etc]
107
+ }
108
+ export enum RESTMethods {'post'='post','get'='get', 'delete'='delete','put'='put', 'patch'='patch'}
109
+ export type DocumentApi = {
110
+ action:string //api action name
111
+ entryPoint:string //api entry point example:':id', ':id/confirm'
112
+ queryPara?:string[] //what query parameter wish to accept, example: ['description','date']
113
+ requiredRole?: string[] // what special user role wish to allow for this api, example: ['SuperUser']
114
+ workflowSetting?: {bpmn:string} //optional property, once define code gen connect the bpmn workflow
115
+ method:RESTMethods
116
+ schema?:string //any schema/type name in types & apischemas
117
+ responseType?:string //any schema/type name for response
118
+ description:string //description of api
119
+ }
120
+ //export enum IsolationType {"none"="none" , "tenant"="tenant","org"="org", "branch"="branch"}
121
+ // export type ImportLibs = {"lib":string,"as":string}
122
+ export type Formula = {
123
+ jsonPath:string //example: "$.subtotal","$.details[*]"
124
+ formula:string //example "jslib.getDocumentSubTotal(@F{$.details})"
125
+ }
126
+ export type SchemaConfig = {
127
+ isolationType: IsolationType
128
+ requiredRoles?:string[]
129
+ pageType?: string
130
+ uniqueKey?:string
131
+ uniqueKeys?:string[][]
132
+ documentTitle?:string
133
+ generateDocumentNumber?:boolean
134
+ documentDate?:string
135
+ allStatus?:DocumentStatus[]
136
+ additionalApis?:DocumentApi[]
137
+ additionalAutoCompleteFields ?: string[]
138
+ // libs?:ImportLibs[] // both process class and frontend client class will import same lib
139
+ formulas?: Formula[]
140
+ documentType: string
141
+ documentName: string
142
+ collectionName?: string
143
+ foreignKeys?:MyForeignKey
144
+ printFormats?: SchemaPrintFormat[]
145
+ }
146
+ export type SchemaPrintFormat = {
147
+ formatName: string
148
+ formatId: string
149
+ description?: string
150
+ }
151
+
152
+ export type MyForeignKey = {
153
+ [collectionname:string]:string[]
154
+ }
155
+
156
+ export type SchemaType = {
157
+ type:string
158
+ definitions?:SimpleAppJSONSchema7
159
+ required?:string[]
160
+
161
+ "x-simpleapp-config":SchemaConfig
162
+ properties: SchemaFields
163
+ }
164
+
165
+
166
+ export type SchemaFields = {
167
+ _id: SimpleAppJSONSchema7
168
+ tenantId: SimpleAppJSONSchema7
169
+ orgId: SimpleAppJSONSchema7
170
+ branchId: SimpleAppJSONSchema7
171
+ created: SimpleAppJSONSchema7
172
+ updated: SimpleAppJSONSchema7
173
+ createdBy: SimpleAppJSONSchema7
174
+ updatedBy: SimpleAppJSONSchema7
175
+ [key:string]:SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined
176
+
177
+ }
178
+
179
+
180
+
181
+ // modified from jsonschemas
182
+ export type SimpleAppJSONSchema7Definition = SimpleAppJSONSchema7 | boolean;
183
+ export interface SimpleAppJSONSchema7 {
184
+
185
+ 'x-foreignkey' ?:string
186
+ $id?: string | undefined;
187
+ $ref?: string | undefined;
188
+ $schema?: JSONSchema7Version | undefined;
189
+ $comment?: string | undefined;
190
+
191
+ /**
192
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
193
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
194
+ */
195
+ $defs?: {
196
+ [key: string]: JSONSchema7Definition;
197
+ } | undefined;
198
+
199
+ /**
200
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
201
+ */
202
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
203
+ enum?: JSONSchema7Type[] | undefined;
204
+ const?: JSONSchema7Type | undefined;
205
+
206
+ /**
207
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
208
+ */
209
+ multipleOf?: number | undefined;
210
+ maximum?: number | undefined;
211
+ exclusiveMaximum?: number | undefined;
212
+ minimum?: number | undefined;
213
+ exclusiveMinimum?: number | undefined;
214
+
215
+ /**
216
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
217
+ */
218
+ maxLength?: number | undefined;
219
+ minLength?: number | undefined;
220
+ pattern?: string | undefined;
221
+
222
+ /**
223
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
224
+ */
225
+ items?: SimpleAppJSONSchema7Definition | SimpleAppJSONSchema7Definition[] | undefined;
226
+ additionalItems?: JSONSchema7Definition | undefined;
227
+ maxItems?: number | undefined;
228
+ minItems?: number | undefined;
229
+ uniqueItems?: boolean | undefined;
230
+ contains?: SimpleAppJSONSchema7Definition | undefined;
231
+
232
+ /**
233
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
234
+ */
235
+ maxProperties?: number | undefined;
236
+ minProperties?: number | undefined;
237
+ required?: string[] | undefined;
238
+ properties?: {
239
+ [key: string]: SimpleAppJSONSchema7Definition;
240
+ } | undefined;
241
+ patternProperties?: {
242
+ [key: string]: SimpleAppJSONSchema7Definition;
243
+ } | undefined;
244
+ additionalProperties?: SimpleAppJSONSchema7Definition | undefined;
245
+ dependencies?: {
246
+ [key: string]: SimpleAppJSONSchema7Definition | string[];
247
+ } | undefined;
248
+ propertyNames?: SimpleAppJSONSchema7Definition | undefined;
249
+
250
+ /**
251
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
252
+ */
253
+ if?: SimpleAppJSONSchema7Definition | undefined;
254
+ then?: SimpleAppJSONSchema7Definition | undefined;
255
+ else?: SimpleAppJSONSchema7Definition | undefined;
256
+
257
+ /**
258
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
259
+ */
260
+ allOf?: SimpleAppJSONSchema7Definition[] | undefined;
261
+ anyOf?: SimpleAppJSONSchema7Definition[] | undefined;
262
+ oneOf?: SimpleAppJSONSchema7Definition[] | undefined;
263
+ not?: SimpleAppJSONSchema7Definition | undefined;
264
+
265
+ /**
266
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
267
+ */
268
+ format?: string | undefined;
269
+
270
+ /**
271
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
272
+ */
273
+ contentMediaType?: string | undefined;
274
+ contentEncoding?: string | undefined;
275
+
276
+ /**
277
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
278
+ */
279
+ definitions?: {
280
+ [key: string]: JSONSchema7Definition;
281
+ } | undefined;
282
+
283
+ /**
284
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
285
+ */
286
+ title?: string | undefined;
287
+ description?: string | undefined;
288
+ default?: JSONSchema7Type | undefined;
289
+ readOnly?: boolean | undefined;
290
+ writeOnly?: boolean | undefined;
291
+ examples?: JSONSchema7Type | undefined;
292
+ }
@@ -20,7 +20,7 @@ let _this: WorkflowConfig; //we need another variable to access WorkflowConfig
20
20
  class MyDataStore extends DataStore {
21
21
  constructor(bpmnserver) {
22
22
  super(bpmnserver);
23
- console.log('this.dbConfiguration ', this.db);
23
+ //console.log('this.dbConfiguration ', this.db);
24
24
  }
25
25
  }
26
26
 
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * This file was automatically generated by simpleapp generator. Every
3
3
  * MODIFICATION OVERRIDE BY GENERATEOR
4
- * last change 2024-04-15
4
+ * last change 2024-04-21
5
5
  * Author: Ks Tan
6
6
  */
7
7
  import {
@@ -72,7 +72,7 @@ export class WorkflowController {
72
72
  @AppUser() appuser: UserContext,
73
73
  @Param() uid: string,
74
74
  ) {
75
- return await this.workflowService.getActorUserTask(appuser, uid);
75
+ return await this.workflowService.getActorUserTask(appuser);
76
76
  }
77
77
 
78
78
  /**