@simitgroup/simpleapp-generator 1.1.11 → 1.1.14

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 (87) hide show
  1. package/dist/buildinschemas/autoincreament.d.ts.map +1 -1
  2. package/dist/buildinschemas/autoincreament.js +1 -2
  3. package/dist/buildinschemas/autoincreament.js.map +1 -1
  4. package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
  5. package/dist/buildinschemas/docnoformat.js +0 -1
  6. package/dist/buildinschemas/docnoformat.js.map +1 -1
  7. package/dist/buildinschemas/permission.d.ts.map +1 -1
  8. package/dist/buildinschemas/permission.js +0 -1
  9. package/dist/buildinschemas/permission.js.map +1 -1
  10. package/dist/framework.d.ts.map +1 -1
  11. package/dist/framework.js +3 -2
  12. package/dist/framework.js.map +1 -1
  13. package/dist/generate.js +5 -2
  14. package/dist/generate.js.map +1 -1
  15. package/dist/index.js +1 -1
  16. package/dist/index.js.map +1 -1
  17. package/dist/type.d.ts +0 -1
  18. package/dist/type.d.ts.map +1 -1
  19. package/dist/type.js.map +1 -1
  20. package/docs/backend.md +1 -1
  21. package/package.json +1 -1
  22. package/src/buildinschemas/autoincreament.ts +2 -3
  23. package/src/buildinschemas/docnoformat.ts +0 -1
  24. package/src/buildinschemas/permission.ts +0 -1
  25. package/src/framework.ts +3 -2
  26. package/src/generate.ts +7 -3
  27. package/src/index.ts +1 -1
  28. package/src/type.ts +1 -2
  29. package/templates/basic/nest/controller.ts.eta +19 -17
  30. package/templates/basic/nest/service.ts.eta +37 -2
  31. package/templates/basic/nuxt/pages.form.vue.eta +117 -84
  32. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +7 -4
  33. package/templates/nest/.env._eta +7 -1
  34. package/templates/nest/remoteapi/cloudapi.yaml.eta +768 -0
  35. package/templates/nest/src/app.module.ts.eta +24 -4
  36. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +23 -4
  37. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +355 -312
  38. package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +1 -1
  39. package/templates/nest/src/simpleapp/services/branch.service.ts.eta +1 -1
  40. package/templates/nest/src/simpleapp/services/docno.service.ts.eta +1 -1
  41. package/templates/nest/src/simpleapp/services/org.service.ts.eta +1 -1
  42. package/templates/nest/src/simpleapp/services/perm.service.ts.eta +1 -1
  43. package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +1 -1
  44. package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +2 -2
  45. package/templates/nest/src/workflow/bpmn/suspendcustomer.bpmn.eta +66 -0
  46. package/templates/nest/src/workflow/delegates/customer.ts._eta +8 -0
  47. package/templates/nest/src/workflow/delegates/hello.ts._eta +5 -0
  48. package/templates/nest/src/workflow/delegates/index.ts._eta +5 -0
  49. package/templates/nest/src/workflow/delegates/invoice.delegates.ts._eta +9 -0
  50. package/templates/nest/src/workflow/delegates/usertask.ts._eta +3 -0
  51. package/templates/nest/src/workflow/formschema/SimpleApproveReject.ts._eta +8 -0
  52. package/templates/nest/src/workflow/formschema/index.ts._eta +1 -0
  53. package/templates/nest/src/workflow/workflow.apischema.ts.eta +130 -0
  54. package/templates/nest/src/workflow/workflow.config.ts.eta +57 -0
  55. package/templates/nest/src/workflow/workflow.controller.ts.eta +406 -0
  56. package/templates/nest/src/workflow/workflow.delegate.ts.eta +104 -0
  57. package/templates/nest/src/workflow/workflow.delegateservice.ts._eta +46 -0
  58. package/templates/nest/src/workflow/workflow.module.ts.eta +21 -0
  59. package/templates/nest/src/workflow/workflow.service.ts.eta +438 -0
  60. package/templates/nest/src/workflow/workflow.type.ts.eta +53 -0
  61. package/templates/nuxt/assets/primevue/passthrough.ts._eta +2 -1
  62. package/templates/nuxt/components/event/EventDecision.vue.eta +1 -1
  63. package/templates/nuxt/components/event/EventNotification.vue.eta +1 -1
  64. package/templates/nuxt/components/header/HeaderBar.vue.eta +3 -1
  65. package/templates/nuxt/components/header/button/task/HeaderButtonTaskItem.vue.eta +21 -0
  66. package/templates/nuxt/components/header/button/task/HeaderButtonTaskList.vue.eta +133 -0
  67. package/templates/nuxt/components/simpleApp/SimpleAppJsonSchemaForm.vue.eta +169 -0
  68. package/templates/nuxt/composables/getOpenApi.generate.ts.eta +27 -8
  69. package/templates/nuxt/composables/workflow.generate.ts.eta +16 -0
  70. package/templates/nuxt/lang/df.ts.eta +4 -0
  71. package/templates/nuxt/pages/[xorg]/index.vue._eta +5 -3
  72. package/templates/nuxt/types/index.ts.eta +2 -1
  73. package/templates/nuxt/types/schema.ts.eta +2 -2
  74. package/templates/nuxt/types/workflow.ts.eta +20 -0
  75. package/templates/project/groups/admin.json.eta +1 -1
  76. package/templates/project/jsonschemas/customer.json._eta +13 -9
  77. package/templates/project/jsonschemas/invoice.json._eta +10 -6
  78. package/tsconfig.tsbuildinfo +1 -1
  79. package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +0 -39
  80. package/buildinschemas copy/branch.branch.jsonschema.json +0 -41
  81. package/buildinschemas copy/docnoformat.docno.jsonschema.json +0 -23
  82. package/buildinschemas copy/organization.org.jsonschema.json +0 -50
  83. package/buildinschemas copy/permission.perm.jsonschema.json +0 -23
  84. package/buildinschemas copy/permission.perm.jsonschema.try.json +0 -25
  85. package/buildinschemas copy/tenant.tenant.jsonschema.json +0 -21
  86. package/buildinschemas copy/tenant.tenant.jsonschema.try.json +0 -27
  87. package/buildinschemas copy/user.user.jsonschema.json +0 -31
@@ -4,90 +4,7 @@
4
4
  (subtype? `type="${subtype}"`:'') +' ' +
5
5
  (hidelabel? ':hidelabel="true"':'') +
6
6
  (instancepath ? `:instancepath="\`${instancepath}\`"` : '') + '/>' %>
7
- <script setup lang="ts">
8
- /**
9
- * This file was automatically generated by simpleapp everytime regenerate code.
10
- * delete file "delete-me-for-avoid-override" if you want to modify this file and
11
- * prevent regenerate code override it.
12
- * last change 2023-09-09
13
- * author: Ks Tan
14
- */
15
- import {SimpleAppInputType} from "~/types"
16
- import ConfirmPopup from 'primevue/confirmpopup';
17
- import { useConfirm } from "primevue/useconfirm";
18
- const confirm = useConfirm();
19
- const isReadOnly =ref(true)
20
- const props = defineProps<{_id?:string}>()
21
- const {$<%= it.typename %>Doc,$event } = useNuxtApp();
22
- const doc = $<%= it.typename %>Doc()
23
- const data = doc.getReactiveData();
24
- const emits = defineEmits(['afterCreate'])
25
-
26
-
27
- const fetchRecord = async (recordid:string) =>{
28
- await doc.getById(recordid)
29
- }
30
-
31
- const id = computed(() => props._id ?? '');
32
-
33
-
34
- const disabled = computed(()=>{
35
- return false
36
- })
37
-
38
- const createData = async () => {
39
- // disabled.value=true
40
-
41
- doc.create().then((res)=>{
42
- //refresh()
43
- emits('afterCreate',res.data)
44
- }).catch(err=>{
45
- console.error(err)
46
- })
47
-
48
- };
49
- const updateData = async () => {
50
- doc.update().then(()=>{
51
- // visible.value=false
52
- refresh()
53
- }).catch(err=>{
54
- console.error(err)
55
- })
56
-
57
- };
58
- const deleteData = (event:Event) => {
59
-
60
- confirm.require({
61
- target: event.currentTarget as HTMLElement,
62
- message:'Delete?',
63
- icon: 'pi pi-exclamation-triangle',
64
- acceptClass: 'p-button-danger',
65
- accept: ()=>{
66
- // disabled.value=true
67
- doc.delete(data.value._id ?? "").then((res) => {
68
- refresh();
69
- goTo(doc.getDocName())
70
- });
71
- },
72
- reject: () => {
73
- console.log("Cancel delete")
74
- }
75
- })
76
- };
77
- const newData = ()=>{
78
- goTo(doc.getDocName(),'new')
79
- }
80
- const refresh = ()=>{
81
- $event('RefreshDocumentList',{documentName:doc.getDocName()})
82
- }
83
7
 
84
-
85
- if (id.value && id.value != 'new') {
86
- fetchRecord(id.value);
87
- }else{
88
- isReadOnly.value=false
89
- }
90
- </script>
91
8
  <template>
92
9
 
93
10
  <SimpleAppForm #default="o" :document="doc" :readonly="isReadOnly">
@@ -110,7 +27,13 @@ if (id.value && id.value != 'new') {
110
27
  <Button class="btn-primary" :disabled="disabled" @click="updateData" type="button" v-if="canPerform(doc.getDocName(),'update') && !doc.isNew()">Update</Button>
111
28
  <Button class="btn-danger" :disabled="disabled" @click="deleteData($event)" type="button" v-if="canPerform(doc.getDocName(),'delete') && !doc.isNew()">Delete</Button>
112
29
 
113
-
30
+ <!-- special api start-->
31
+ <%for(let i=0;i<it.apiSettings.length;i++){%>
32
+ <% let api = it.apiSettings[i] %>
33
+ <Button class="btn-warn" :disabled="disabled" type="button" v-if="canPerform(doc.getDocName(), 'update') && !doc.isNew()"
34
+ @click="run<%=capitalizeFirstLetter(api.action)%>" >{{t('<%=api.action%>')}}</Button>
35
+ <%}%>
36
+ <!-- special api end -->
114
37
  <ProgressSpinner v-if="disabled==true" style="width: 2rem; height: 2rem" ></ProgressSpinner>
115
38
  <ConfirmPopup></ConfirmPopup>
116
39
  </div>
@@ -230,3 +153,113 @@ if (id.value && id.value != 'new') {
230
153
  </SimpleAppForm>
231
154
  <DebugDocumentData v-model="data" :label="doc.getDocName()"/>
232
155
  </template>
156
+
157
+
158
+ <script setup lang="ts">
159
+ /**
160
+ * This file was automatically generated by simpleapp everytime regenerate code.
161
+ * delete file "delete-me-for-avoid-override" if you want to modify this file and
162
+ * prevent regenerate code override it.
163
+ * last change 2023-09-09
164
+ * author: Ks Tan
165
+ */
166
+ import {SimpleAppInputType} from "~/types"
167
+ import ConfirmPopup from 'primevue/confirmpopup';
168
+ import { useConfirm } from "primevue/useconfirm";
169
+ const confirm = useConfirm();
170
+ const isReadOnly =ref(true)
171
+ const props = defineProps<{_id?:string}>()
172
+ const {$<%= it.typename %>Doc,$event } = useNuxtApp();
173
+ const doc = $<%= it.typename %>Doc()
174
+ const data = doc.getReactiveData();
175
+ const emits = defineEmits(['afterCreate'])
176
+
177
+
178
+ const fetchRecord = async (recordid:string) =>{
179
+ await doc.getById(recordid)
180
+ }
181
+
182
+ const id = computed(() => props._id ?? '');
183
+
184
+
185
+ const disabled = computed(()=>{
186
+ return false
187
+ })
188
+
189
+ const createData = async () => {
190
+ // disabled.value=true
191
+
192
+ doc.create().then((res)=>{
193
+ //refresh()
194
+ emits('afterCreate',res.data)
195
+ }).catch(err=>{
196
+ console.error(err)
197
+ })
198
+
199
+ };
200
+ const updateData = async () => {
201
+ doc.update().then(()=>{
202
+ // visible.value=false
203
+ refresh()
204
+ }).catch(err=>{
205
+ console.error(err)
206
+ })
207
+
208
+ };
209
+ const deleteData = (event:Event) => {
210
+
211
+ confirm.require({
212
+ target: event.currentTarget as HTMLElement,
213
+ message:'Delete?',
214
+ icon: 'pi pi-exclamation-triangle',
215
+ acceptClass: 'p-button-danger',
216
+ accept: ()=>{
217
+ // disabled.value=true
218
+ doc.delete(data.value._id ?? "").then((res) => {
219
+ refresh();
220
+ goTo(doc.getDocName())
221
+ });
222
+ },
223
+ reject: () => {
224
+ console.log("Cancel delete")
225
+ }
226
+ })
227
+ };
228
+ const newData = ()=>{
229
+ goTo(doc.getDocName(),'new')
230
+ }
231
+ const refresh = ()=>{
232
+ $event('RefreshDocumentList',{documentName:doc.getDocName()})
233
+ }
234
+
235
+
236
+ if (id.value && id.value != 'new') {
237
+ fetchRecord(id.value);
238
+ }else{
239
+ isReadOnly.value=false
240
+ }
241
+
242
+ <%for(let i=0;i<it.apiSettings.length;i++){%>
243
+ <% let api = it.apiSettings[i] %>
244
+ const run<%=capitalizeFirstLetter(api.action)%> = async () =>{
245
+
246
+ const data = {
247
+ id: id.value
248
+ }
249
+ const result = await doc.run<%=capitalizeFirstLetter(api.action)%>(
250
+ <% if(api.entryPoint && api.entryPoint.includes(':')) {%>
251
+ <%let subpath = api.entryPoint.split('/')%>
252
+ <% for(let a=0;a<subpath.length;a++){%>
253
+ <%const partstr = subpath[a]%>
254
+ <%if(partstr.includes(':')){%>
255
+ <% const paraname = partstr.replace(':','') %>
256
+ <%= paraname=='id' ? 'id.value' : paraname %>,
257
+ <%}%>
258
+ <%}%>
259
+ <%}%>
260
+ data
261
+ )
262
+
263
+ }
264
+ <%}%>
265
+ </script>
@@ -105,7 +105,7 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
105
105
 
106
106
  <%for(let i=0;i<it.apiSettings.length;i++){%>
107
107
  <% let api = it.apiSettings[i] %>
108
- async <%=api.action%>(<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
108
+ async run<%=capitalizeFirstLetter(api.action)%>(<% if(api.entryPoint && api.entryPoint.includes(':')) {%>
109
109
  <%let subpath = api.entryPoint.split('/')%>
110
110
  <% for(let a=0;a<subpath.length;a++){%>
111
111
  <%const partstr = subpath[a]%>
@@ -114,9 +114,11 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
114
114
  <%=paraname%>: string,
115
115
  <%}%>
116
116
  <%}%>
117
- <%}%>){
117
+ <%}%>
118
+ <% if(['post','put','patch'].includes(api.method)){ %>data:any<%}%>
119
+ ){
118
120
  //const recordid: string = this.data.value._id ?? '';
119
- return await this.docapi.<%=api.action%>(
121
+ return await this.docapi.run<%=capitalizeFirstLetter(api.action)%>(
120
122
  <% if(api.entryPoint && api.entryPoint.includes(':')) {%>
121
123
  <%let subpath = api.entryPoint.split('/')%>
122
124
  <% for(let a=0;a<subpath.length;a++){%>
@@ -125,8 +127,9 @@ export class <%= it.typename%>Client extends SimpleAppClient<<%= it.typename%>,<
125
127
  <% const paraname = partstr.replace(':','') %>
126
128
  <%=paraname%>,
127
129
  <%}%>
128
- <%}%>
130
+ <%}%>
129
131
  <%}%>
132
+ <% if(['post','put','patch'].includes(api.method)){ %>data<%}%>
130
133
  )
131
134
  .then((res: AxiosResponse) => {
132
135
  if(this.event){this.event('info:<%=api.action%>',res.data)}
@@ -3,7 +3,9 @@ DRYRUN=false
3
3
  PROJECT_NAME=SimpleApp Demo1
4
4
  PROJECT_DESCRIPTION=Try CRUD
5
5
  PROJECT_Version=1.0.0
6
- MONGODB_URL=<%=it.configs.mongoConnectStr%>
6
+ MONGO_DB_URL=<%=it.configs.mongoConnectStr%>
7
+
8
+ MONGO_DB_NAME=<%=it.configs.mongoDbName%>
7
9
 
8
10
  HTTP_PORT=<%=it.configs.backendPort%>
9
11
 
@@ -11,6 +13,8 @@ BPMN_HOST=<%=it.configs.bpmnsetting.bpmnHost%>
11
13
 
12
14
  BPMN_PORT=<%=it.configs.bpmnsetting.bpmnPort%>
13
15
 
16
+ BPMN_PATH=./src/workflow/bpmn/
17
+
14
18
  BPMN_API_KEY=<%=it.configs.bpmnsetting.bpmnApiKey%>
15
19
 
16
20
  OAUTH2_BASEURL=<%=it.configs.oauthSetting.oauthBaseUrl%>
@@ -27,6 +31,8 @@ OAUTH2_ADMINROLE = <%=it.configs.oauthSetting.adminRole%>
27
31
 
28
32
  AUTH_SECRET_KEY=<%=it.configs.oauthSetting.oauthAuthSecretKey%>
29
33
 
34
+ BACKEND_URL=http://localhost:<%=it.configs.backendPort%>
35
+
30
36
  AUTH_ORIGIN=http://localhost:8080
31
37
 
32
38
  ADMIN_EMAIL=