@simitgroup/simpleapp-generator 1.6.6-p-alpha → 1.6.6-r-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 (143) hide show
  1. package/ReleaseNote.md +3 -0
  2. package/dist/buildinschemas/autoincreament.d.ts.map +1 -1
  3. package/dist/buildinschemas/autoincreament.js +17 -14
  4. package/dist/buildinschemas/autoincreament.js.map +1 -1
  5. package/dist/buildinschemas/branch.d.ts.map +1 -1
  6. package/dist/buildinschemas/branch.js +25 -24
  7. package/dist/buildinschemas/branch.js.map +1 -1
  8. package/dist/buildinschemas/changehistories.d.ts.map +1 -1
  9. package/dist/buildinschemas/changehistories.js +10 -9
  10. package/dist/buildinschemas/changehistories.js.map +1 -1
  11. package/dist/buildinschemas/customfield.d.ts.map +1 -1
  12. package/dist/buildinschemas/customfield.js +14 -24
  13. package/dist/buildinschemas/customfield.js.map +1 -1
  14. package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
  15. package/dist/buildinschemas/docnoformat.js +34 -23
  16. package/dist/buildinschemas/docnoformat.js.map +1 -1
  17. package/dist/buildinschemas/documentevent.d.ts.map +1 -1
  18. package/dist/buildinschemas/documentevent.js +36 -26
  19. package/dist/buildinschemas/documentevent.js.map +1 -1
  20. package/dist/buildinschemas/index.d.ts +1 -0
  21. package/dist/buildinschemas/index.d.ts.map +1 -1
  22. package/dist/buildinschemas/index.js +3 -1
  23. package/dist/buildinschemas/index.js.map +1 -1
  24. package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -1
  25. package/dist/buildinschemas/keyvaluepair.js +7 -6
  26. package/dist/buildinschemas/keyvaluepair.js.map +1 -1
  27. package/dist/buildinschemas/message.d.ts +3 -0
  28. package/dist/buildinschemas/message.d.ts.map +1 -0
  29. package/dist/buildinschemas/message.js +34 -0
  30. package/dist/buildinschemas/message.js.map +1 -0
  31. package/dist/buildinschemas/organization.d.ts.map +1 -1
  32. package/dist/buildinschemas/organization.js +34 -30
  33. package/dist/buildinschemas/organization.js.map +1 -1
  34. package/dist/buildinschemas/permission.d.ts.map +1 -1
  35. package/dist/buildinschemas/permission.js +16 -7
  36. package/dist/buildinschemas/permission.js.map +1 -1
  37. package/dist/buildinschemas/systemmessage.d.ts.map +1 -1
  38. package/dist/buildinschemas/systemmessage.js +35 -32
  39. package/dist/buildinschemas/systemmessage.js.map +1 -1
  40. package/dist/buildinschemas/tenant.d.ts.map +1 -1
  41. package/dist/buildinschemas/tenant.js +17 -16
  42. package/dist/buildinschemas/tenant.js.map +1 -1
  43. package/dist/buildinschemas/user.d.ts.map +1 -1
  44. package/dist/buildinschemas/user.js +34 -31
  45. package/dist/buildinschemas/user.js.map +1 -1
  46. package/dist/buildinschemas/webhook.d.ts.map +1 -1
  47. package/dist/buildinschemas/webhook.js +123 -51
  48. package/dist/buildinschemas/webhook.js.map +1 -1
  49. package/dist/buildinschemas/webhookhistory.d.ts +3 -0
  50. package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
  51. package/dist/buildinschemas/webhookhistory.js +44 -0
  52. package/dist/buildinschemas/webhookhistory.js.map +1 -0
  53. package/dist/buildinschemas/webhooklog.d.ts +3 -0
  54. package/dist/buildinschemas/webhooklog.d.ts.map +1 -0
  55. package/dist/buildinschemas/webhooklog.js +77 -0
  56. package/dist/buildinschemas/webhooklog.js.map +1 -0
  57. package/dist/createproject.js +138 -0
  58. package/dist/createproject.js.map +1 -0
  59. package/dist/framework.d.ts.map +1 -1
  60. package/dist/framework.js +5 -7
  61. package/dist/framework.js.map +1 -1
  62. package/dist/generate-allow-changebackend.js +305 -0
  63. package/dist/generate-allow-changebackend.js.map +1 -0
  64. package/dist/generate.js +19 -4
  65. package/dist/generate.js.map +1 -1
  66. package/dist/index2.js +118 -0
  67. package/dist/index2.js.map +1 -0
  68. package/dist/installdependency.js +20 -0
  69. package/dist/installdependency.js.map +1 -0
  70. package/dist/installnest.js +2 -0
  71. package/dist/installnest.js.map +1 -0
  72. package/dist/installnuxt.js +2 -0
  73. package/dist/installnuxt.js.map +1 -0
  74. package/dist/processors/groupsbuilder.js +2 -0
  75. package/dist/processors/groupsbuilder.js.map +1 -0
  76. package/dist/processors/jsonschemabuilder.js +14 -12
  77. package/dist/processors/jsonschemabuilder.js.map +1 -1
  78. package/dist/schematype/baseschema.js +25 -0
  79. package/dist/schematype/baseschema.js.map +1 -0
  80. package/dist/schematype/default.js +2 -0
  81. package/dist/schematype/default.js.map +1 -0
  82. package/dist/schematype/index.js +12 -0
  83. package/dist/schematype/index.js.map +1 -0
  84. package/dist/schematype/primarymasterdata.js +38 -0
  85. package/dist/schematype/primarymasterdata.js.map +1 -0
  86. package/dist/schematype/simple.js +24 -0
  87. package/dist/schematype/simple.js.map +1 -0
  88. package/dist/schematype/simplemasterdata.js +31 -0
  89. package/dist/schematype/simplemasterdata.js.map +1 -0
  90. package/dist/schematype/transaction.js +74 -0
  91. package/dist/schematype/transaction.js.map +1 -0
  92. package/dist/type.d.ts +39 -5
  93. package/dist/type.d.ts.map +1 -1
  94. package/dist/type.js.map +1 -1
  95. package/package.json +1 -1
  96. package/src/buildinschemas/autoincreament.ts +35 -33
  97. package/src/buildinschemas/branch.ts +47 -47
  98. package/src/buildinschemas/changehistories.ts +31 -30
  99. package/src/buildinschemas/customfield.ts +14 -24
  100. package/src/buildinschemas/docnoformat.ts +54 -43
  101. package/src/buildinschemas/documentevent.ts +42 -33
  102. package/src/buildinschemas/index.ts +1 -0
  103. package/src/buildinschemas/keyvaluepair.ts +25 -25
  104. package/src/buildinschemas/organization.ts +54 -50
  105. package/src/buildinschemas/permission.ts +34 -25
  106. package/src/buildinschemas/systemmessage.ts +39 -38
  107. package/src/buildinschemas/tenant.ts +46 -45
  108. package/src/buildinschemas/user.ts +64 -60
  109. package/src/buildinschemas/webhook.ts +131 -59
  110. package/src/buildinschemas/webhooklog.ts +75 -0
  111. package/src/framework.ts +6 -8
  112. package/src/generate.ts +19 -3
  113. package/src/processors/jsonschemabuilder.ts +6 -4
  114. package/src/type.ts +271 -215
  115. package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +9 -7
  116. package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +22 -7
  117. package/templates/basic/nuxt/jsonschema.ts.eta +7 -0
  118. package/templates/basic/nuxt/resource-bridge.editable.service.ts.eta +40 -0
  119. package/templates/basic/nuxt/resource-bridge.service.ts.eta +24 -21
  120. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +27 -9
  121. package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +2 -2
  122. package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +5 -2
  123. package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +4 -2
  124. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +143 -168
  125. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -13
  126. package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +22 -16
  127. package/templates/nest/src/simpleapp/webhooks/branch.ts._eta +37 -0
  128. package/templates/nest/src/simpleapp/webhooks/index.ts._eta +21 -0
  129. package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +4 -3
  130. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +0 -1
  131. package/templates/nuxt/plugins/18.simpleapp-custom-field-store.ts.eta +9 -3
  132. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +32 -22
  133. package/templates/nuxt/simpleapp/generate/jsonSchemas/index.ts.eta +11 -0
  134. package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/common.constant.ts.eta +1 -0
  135. package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/resource.constant.ts.eta +2 -2
  136. package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +4 -4
  137. package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge.service.ts.eta +20 -1
  138. package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/bridge.type.ts.eta +9 -0
  139. package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/resource-mapper.type.ts.eta +2 -2
  140. package/templates/project/build.sh.eta +0 -5
  141. package/templates/nest/src/simpleapp/apischemas/customfield.ts.eta +0 -21
  142. package/templates/nuxt/simpleapp/generate/clients/SimpleAppCustomFieldClient.ts.eta +0 -188
  143. /package/templates/nest/src/simpleapp/generate/processors/{webhook.processor.ts.eta → webhook.processor.ts.etaxxxx} +0 -0
@@ -7,8 +7,8 @@
7
7
  const apiName = it.typename.toUpperCase() + 'Api';
8
8
  const typeActionName = pascalName + 'Actions';
9
9
 
10
- const miniAppWhitelistApis = it.jsonschema['x-simpleapp-config']?.miniApp?.whitelist || [];
11
- const hasMiniAppWhitelistedApi = miniAppWhitelistApis.length > 0;
10
+ const miniAppWhitelistApis = it.jsonschema['x-simpleapp-config']?.miniApp?.whitelist || {};
11
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
12
12
  %>
13
13
 
14
14
  from streamlit_javascript import st_javascript
@@ -22,10 +22,9 @@ import json
22
22
  class <%= pascalName %>:
23
23
  _resource_name = "<%= it.resourceName %>"
24
24
 
25
- <% for (let i = 0; i < miniAppWhitelistApis.length; i++) { %>
26
- <%
27
- const action = miniAppWhitelistApis[i];
28
- %>
25
+ <% Object.entries(miniAppWhitelistApis).forEach(([action, value]) => { %>
26
+ <% if (value !== true && typeof value !== 'object') { return; } %>
27
+
29
28
 
30
29
  <% if(action === 'list') { %>
31
30
 
@@ -137,6 +136,22 @@ class <%= pascalName %>:
137
136
  resource=self._resource_name, action=action, options=options
138
137
  ),
139
138
  )
139
+ <% } else if(action === 'current') { %>
140
+
141
+ def <%= action %>(self, options: Optional[ApiOption] = {}):
142
+ action = "<%= action %>"
143
+ request_key = Helper.get_api_key(
144
+ "request", resource=self._resource_name, action=action, options=options
145
+ )
146
+
147
+ st_javascript(
148
+ f"window.parent.callApi('{self._resource_name}', '{action}')",
149
+ key=request_key,
150
+ on_change=lambda: Helper.set_api_response(
151
+ resource=self._resource_name, action=action, options=options
152
+ ),
153
+ )
154
+
140
155
  <% } else { %>
141
156
  <% const apiSetting = it.apiSettings.find(item => item.action === action); %>
142
157
  <% if (apiSetting) { %>
@@ -191,7 +206,7 @@ class <%= pascalName %>:
191
206
  )
192
207
  <% } %>
193
208
  <% } %>
194
- <% } %>
209
+ <% }) %>
195
210
 
196
211
  def response(self, action: str, options: Optional[ApiOption] = {}):
197
212
  return Helper.get_api_response(
@@ -0,0 +1,7 @@
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
+ export const <%= it.typename%>JsonSchema = <%~ JSON.stringify(it.jsonschema) %>
@@ -0,0 +1,40 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator.
3
+ * you may change it, it won't override
4
+ * last change 2025-06-18
5
+ * Author: --
6
+ */
7
+
8
+ <%
9
+ const upperFirstCase = (value) => {
10
+ return value.charAt(0).toUpperCase() + value.slice(1);
11
+ }
12
+
13
+ const camelToKebab = (value) => {
14
+ return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
15
+ }
16
+
17
+ const pascalName = upperFirstCase(it.resourceName);
18
+ const kebabName = camelToKebab(it.resourceName);
19
+ const apiName = it.typename.toUpperCase() + 'Api';
20
+ const typeActionName = 'MiniApp' + pascalName + 'Actions';
21
+
22
+ const miniAppWhitelistApis = it.jsonschema['x-simpleapp-config']?.miniApp?.whitelist || {};
23
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
24
+ %>
25
+
26
+ import { MiniApp<%= pascalName %>BridgeService } from "../../../services/resources/<%= kebabName %>-bridge.service";
27
+ import type { <%= typeActionName %> } from "../../../services/resources/<%= kebabName %>-bridge.service";
28
+ import { MiniAppBridgeMessageApi } from "../../../types/bridge.type";
29
+
30
+ export class MiniApp<%= pascalName %>BridgeEditableService extends MiniApp<%= pascalName %>BridgeService {
31
+ <% Object.entries(miniAppWhitelistApis).forEach(([action, value]) => { %>
32
+ <% if (value !== true && typeof value !== 'object') { return; } %>
33
+
34
+ <% if(action === 'current') { %>
35
+ protected override async handleCurrent(message: MiniAppBridgeMessageApi<<%= typeActionName %>>): Promise<any> {
36
+ return {};
37
+ }
38
+ <% } %>
39
+ <% }) %>
40
+ }
@@ -12,18 +12,18 @@
12
12
 
13
13
  const pascalName = upperFirstCase(it.resourceName);
14
14
  const apiName = it.typename.toUpperCase() + 'Api';
15
- const typeActionName = pascalName + 'Actions';
15
+ const typeActionName = 'MiniApp' + pascalName + 'Actions';
16
16
 
17
- const miniAppWhitelistApis = it.jsonschema['x-simpleapp-config']?.miniApp?.whitelist || [];
18
- const hasMiniAppWhitelistedApi = miniAppWhitelistApis.length > 0;
17
+ const miniAppWhitelistApis = it.jsonschema['x-simpleapp-config']?.miniApp?.whitelist || {};
18
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
19
19
  %>
20
20
 
21
21
  import { <%= apiName %> } from "~/simpleapp/generate/openapi";
22
22
  import { MiniAppBridgeMessageApi } from "../../types/bridge.type";
23
23
 
24
- const actions = <%~ JSON.stringify(miniAppWhitelistApis, null, 2) %> as const;
24
+ const actions = <%~ JSON.stringify(Object.keys(miniAppWhitelistApis), null, 2) %> as const;
25
25
 
26
- type <%= typeActionName %> = (typeof actions)[number];
26
+ export type <%= typeActionName %> = (typeof actions)[number];
27
27
 
28
28
  export class MiniApp<%= pascalName %>BridgeService {
29
29
  protected api!: <%= apiName %>;
@@ -53,13 +53,14 @@ export class MiniApp<%= pascalName %>BridgeService {
53
53
  > {
54
54
  <% if(hasMiniAppWhitelistedApi) { %>
55
55
  return {
56
- <% for (let i = 0; i < miniAppWhitelistApis.length; i++) { %>
56
+ <% Object.entries(miniAppWhitelistApis).forEach(([action, value]) => { %>
57
+ <% if (value !== true && typeof value !== 'object') { return; } %>
58
+
57
59
  <%
58
- const action = miniAppWhitelistApis[i];
59
60
  const handlerName = "handle" + upperFirstCase(action);
60
61
  %>
61
62
  <%= action %>: this.<%= handlerName %>.bind(this),
62
- <% } %>
63
+ <% }) %>
63
64
  };
64
65
  <% } else { %>
65
66
  throw new Error(`ERR_NOT_SUPPORTED`);
@@ -68,27 +69,25 @@ export class MiniApp<%= pascalName %>BridgeService {
68
69
 
69
70
  /****************************************** API Action *****************************************/
70
71
 
71
- <% for (let i = 0; i < miniAppWhitelistApis.length; i++) { %>
72
- <%
73
- const action = miniAppWhitelistApis[i];
74
- %>
72
+ <% Object.entries(miniAppWhitelistApis).forEach(([action, value]) => { %>
73
+ <% if (value !== true && typeof value !== 'object') { return; } %>
75
74
 
76
75
  <% if(action === 'list') { %>
77
- private async handleList(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
76
+ protected async handleList(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
78
77
  return (await this.api!.runSearch({})).data;
79
78
  }
80
79
  <% } else if(action === 'detail') { %>
81
- private async handleDetail(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
80
+ protected async handleDetail(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
82
81
  if (!message.params.resource.id) throw new Error("ERR_MISSING_ID");
83
82
  return (await this.api!.runFindOne(message.params.resource.id)).data;
84
83
  }
85
84
  <% } else if(action === 'create') { %>
86
- private async handleCreate(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
85
+ protected async handleCreate(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
87
86
  if (!message.params.body) throw new Error("ERR_MISSING_BODY");
88
87
  return (await this.api!.runCreate(message.params.body as any)).data;
89
88
  }
90
89
  <% } else if(action === 'update') { %>
91
- private async handleUpdate(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
90
+ protected async handleUpdate(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
92
91
  if (!message.params.resource.id) throw new Error("ERR_MISSING_ID");
93
92
  if (!message.params.body) throw new Error("ERR_MISSING_BODY");
94
93
 
@@ -101,7 +100,7 @@ export class MiniApp<%= pascalName %>BridgeService {
101
100
  ).data;
102
101
  }
103
102
  <% } else if(action === 'patch') { %>
104
- private async handlePatch(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
103
+ protected async handlePatch(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
105
104
  if (!message.params.resource.id) throw new Error("ERR_MISSING_ID");
106
105
  if (!message.params.body) throw new Error("ERR_MISSING_BODY");
107
106
 
@@ -114,17 +113,21 @@ export class MiniApp<%= pascalName %>BridgeService {
114
113
  ).data;
115
114
  }
116
115
  <% } else if(action === 'delete') { %>
117
- private async handleDelete(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
116
+ protected async handleDelete(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
118
117
  if (!message.params.resource.id) throw new Error("ERR_MISSING_ID");
119
118
 
120
119
  return (await this.api!.runDelete(message.params.resource.id)).data;
121
120
  }
122
121
  <% } else if(action === 'autoComplete') { %>
123
- private async handleAutoComplete(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
122
+ protected async handleAutoComplete(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
124
123
  return (await this.api!.autoComplete(message.params.query ?? "", {})).data;
125
124
  }
125
+ <% } else if(action === 'current') { %>
126
+ protected async handleCurrent(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
127
+ return {};
128
+ }
126
129
  <% } else { %>
127
- private async handle<%= upperFirstCase(action) %>(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
130
+ protected async handle<%= upperFirstCase(action) %>(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
128
131
  <% const apiSetting = it.apiSettings.find(item => item.action === action); %>
129
132
  <% if (apiSetting) { %>
130
133
  const queryParams = message.params?.queryParams;
@@ -158,5 +161,5 @@ export class MiniApp<%= pascalName %>BridgeService {
158
161
  <% } %>
159
162
  }
160
163
  <% } %>
161
- <% } %>
164
+ <% }) %>
162
165
  }
@@ -20,8 +20,9 @@ import {AxiosResponse} from 'axios'
20
20
  import * as <%=libs[l].importAs %> from '<%=libs[l].importFrom %>'
21
21
  <%}%>
22
22
  <%}%>
23
- // import { JSONSchema7 } from 'json-schema';
24
23
  import * as openapi from '../openapi';
24
+ import { CustomFieldDataModeEnum } from "../features/customField/enums/common";
25
+
25
26
 
26
27
  export type {
27
28
  <%= it.typename%> ,
@@ -57,10 +58,14 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
57
58
  const apiobj = getDocumentApi('<%=it.name %>')
58
59
  super(apiobj,'<%= it.doctype %>','<%=it.name %>')
59
60
  this.event=$event
60
- this.listen=$listen
61
- this.setNew();
62
-
63
- this.processCustomField();
61
+ this.listen=$listen
62
+
63
+ <% if(it.customField.isEnable) { %>
64
+ // FLAG::CUSTOM_FIELD
65
+ this.prepareCustomFieldJsonSchema();
66
+ <% } %>
67
+
68
+ this.setNew();
64
69
  }
65
70
 
66
71
  override setWatchChange = ()=>{
@@ -72,13 +77,15 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
72
77
  }
73
78
  },{deep:true})
74
79
 
75
- <% if(!['Plugins', 'Plugininstallations', 'Customfield'].includes(capitalizeFirstLetter(it.name))) { %>
80
+
81
+ <% if(it.customField.isEnable) { %>
82
+ // FLAG::CUSTOM_FIELD
76
83
  const { $customFieldStore, $appPluginsStore } = useNuxtApp();
77
84
  if (!this._customFieldWatch) {
78
85
  this._customFieldWatch = watch(
79
86
  [() => $customFieldStore.data, () => $appPluginsStore.installedPlugins],
80
87
  ([newCustomField, newPlugins], [oldCustomField, oldPlugins]) => {
81
- this.processCustomField();
88
+ this.prepareCustomFieldJsonSchema();
82
89
  },
83
90
  { immediate: false, deep: true },
84
91
  );
@@ -88,8 +95,19 @@ export class <%= capitalizeFirstLetter(it.name)%>Client extends SimpleAppClient<
88
95
  }
89
96
 
90
97
  override setNew = ()=>{
91
- const newdata = Default<%= it.typename%>(randomUUID())
92
- this.setData(newdata)
98
+ const defaultData = Default<%= it.typename%>(randomUUID())
99
+
100
+ <% if(it.customField.isEnable) { %>
101
+ // FLAG::CUSTOM_FIELD
102
+ const data = this.prepareCustomFieldData(
103
+ CustomFieldDataModeEnum.DEFAULT,
104
+ defaultData,
105
+ );
106
+ <% } else { %>
107
+ const data = defaultData;
108
+ <% } %>
109
+
110
+ this.setData(data);
93
111
  this.setWatchChange()
94
112
  return true
95
113
  }
@@ -21,8 +21,8 @@
21
21
  const pascalName = upperFirstCase(resourceName);
22
22
  const kebabName = camelToKebab(resourceName);
23
23
 
24
- const miniAppWhitelistApis = config?.miniApp?.whitelist || [];
25
- const hasMiniAppWhitelistedApi = miniAppWhitelistApis.length > 0;
24
+ const miniAppWhitelistApis = config?.miniApp?.whitelist || {};
25
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
26
26
 
27
27
  return {
28
28
  resourceName,
@@ -19,8 +19,8 @@
19
19
  const kebabName = camelToKebab(resourceName);
20
20
  const snakeName = camelToSnake(resourceName);
21
21
 
22
- const miniAppWhitelistApis = config?.miniApp?.whitelist || [];
23
- const hasMiniAppWhitelistedApi = miniAppWhitelistApis.length > 0;
22
+ const miniAppWhitelistApis = config?.miniApp?.whitelist || {};
23
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
24
24
 
25
25
  return {
26
26
  resourceName,
@@ -34,6 +34,7 @@
34
34
  %>
35
35
 
36
36
  from .services.ui import UI
37
+ from .services.current import Current
37
38
  from .services.resources.student import Student
38
39
  from .services.init_message_bridge import InitMessageBridge
39
40
  from .services.helper import Helper as SimtrainSdkHelper
@@ -58,6 +59,8 @@ class SimtrainEcoMiniAppStreamlitSdk:
58
59
 
59
60
  self.ui = UI()
60
61
 
62
+ self.current = Current()
63
+
61
64
  self.helper = SimtrainSdkHelper
62
65
 
63
66
  # ========================== Import Resource ==========================
@@ -13,6 +13,7 @@ import { Model } from 'mongoose';
13
13
  import { Permission } from '../../types/perm.type';
14
14
  import { User } from '../../types/user.type';
15
15
  import { Appintegration } from '../../types/appintegration.type';
16
+ import { Webhook } from '../../types/Webhook.type';
16
17
  import { UserContext } from '../user.context';
17
18
 
18
19
  @Injectable()
@@ -27,6 +28,7 @@ export class TenantMiddleware implements NestMiddleware {
27
28
  @InjectModel('User') private readonly userModel: Model<User>,
28
29
  @InjectModel('Permission') private readonly permModel: Model<Permission>,
29
30
  @InjectModel('Appintegration') private readonly appModel: Model<Appintegration>,
31
+ @InjectModel('Webhook') private readonly webhookModel: Model<Webhook>,
30
32
  ) {}
31
33
 
32
34
  requireXOrg(baseurl: string): boolean {
@@ -53,7 +55,7 @@ export class TenantMiddleware implements NestMiddleware {
53
55
 
54
56
  if (req.baseUrl == '/graphql') {
55
57
  if (tokenStr) {
56
- await user.setCurrentUserInfo(tokenStr, xOrg);
58
+ await user.setCurrentUserInfo(tokenStr, xOrg,this.webhookModel);
57
59
  }
58
60
  req['sessionuser'] = user;
59
61
  next();
@@ -88,7 +90,7 @@ export class TenantMiddleware implements NestMiddleware {
88
90
  }
89
91
 
90
92
  try {
91
- await user.setCurrentUserInfo(tokenStr, xOrg);
93
+ await user.setCurrentUserInfo(tokenStr, xOrg,this.webhookModel);
92
94
  if (user.getId() == '' && this.requireXOrg(req.baseUrl)) {
93
95
  this.logger.log('Access deny for user:', req.baseUrl);
94
96
  return res.status(401).send('Access deny for user');