@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.
- package/ReleaseNote.md +3 -0
- package/dist/buildinschemas/autoincreament.d.ts.map +1 -1
- package/dist/buildinschemas/autoincreament.js +17 -14
- package/dist/buildinschemas/autoincreament.js.map +1 -1
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +25 -24
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/changehistories.d.ts.map +1 -1
- package/dist/buildinschemas/changehistories.js +10 -9
- package/dist/buildinschemas/changehistories.js.map +1 -1
- package/dist/buildinschemas/customfield.d.ts.map +1 -1
- package/dist/buildinschemas/customfield.js +14 -24
- package/dist/buildinschemas/customfield.js.map +1 -1
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
- package/dist/buildinschemas/docnoformat.js +34 -23
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/documentevent.d.ts.map +1 -1
- package/dist/buildinschemas/documentevent.js +36 -26
- package/dist/buildinschemas/documentevent.js.map +1 -1
- package/dist/buildinschemas/index.d.ts +1 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +3 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -1
- package/dist/buildinschemas/keyvaluepair.js +7 -6
- package/dist/buildinschemas/keyvaluepair.js.map +1 -1
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +34 -30
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/permission.d.ts.map +1 -1
- package/dist/buildinschemas/permission.js +16 -7
- package/dist/buildinschemas/permission.js.map +1 -1
- package/dist/buildinschemas/systemmessage.d.ts.map +1 -1
- package/dist/buildinschemas/systemmessage.js +35 -32
- package/dist/buildinschemas/systemmessage.js.map +1 -1
- package/dist/buildinschemas/tenant.d.ts.map +1 -1
- package/dist/buildinschemas/tenant.js +17 -16
- package/dist/buildinschemas/tenant.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +34 -31
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/buildinschemas/webhook.d.ts.map +1 -1
- package/dist/buildinschemas/webhook.js +123 -51
- package/dist/buildinschemas/webhook.js.map +1 -1
- package/dist/buildinschemas/webhookhistory.d.ts +3 -0
- package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
- package/dist/buildinschemas/webhookhistory.js +44 -0
- package/dist/buildinschemas/webhookhistory.js.map +1 -0
- package/dist/buildinschemas/webhooklog.d.ts +3 -0
- package/dist/buildinschemas/webhooklog.d.ts.map +1 -0
- package/dist/buildinschemas/webhooklog.js +77 -0
- package/dist/buildinschemas/webhooklog.js.map +1 -0
- package/dist/createproject.js +138 -0
- package/dist/createproject.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +5 -7
- package/dist/framework.js.map +1 -1
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/generate.js +19 -4
- package/dist/generate.js.map +1 -1
- package/dist/index2.js +118 -0
- package/dist/index2.js.map +1 -0
- package/dist/installdependency.js +20 -0
- package/dist/installdependency.js.map +1 -0
- package/dist/installnest.js +2 -0
- package/dist/installnest.js.map +1 -0
- package/dist/installnuxt.js +2 -0
- package/dist/installnuxt.js.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/processors/jsonschemabuilder.js +14 -12
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/dist/type.d.ts +39 -5
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/autoincreament.ts +35 -33
- package/src/buildinschemas/branch.ts +47 -47
- package/src/buildinschemas/changehistories.ts +31 -30
- package/src/buildinschemas/customfield.ts +14 -24
- package/src/buildinschemas/docnoformat.ts +54 -43
- package/src/buildinschemas/documentevent.ts +42 -33
- package/src/buildinschemas/index.ts +1 -0
- package/src/buildinschemas/keyvaluepair.ts +25 -25
- package/src/buildinschemas/organization.ts +54 -50
- package/src/buildinschemas/permission.ts +34 -25
- package/src/buildinschemas/systemmessage.ts +39 -38
- package/src/buildinschemas/tenant.ts +46 -45
- package/src/buildinschemas/user.ts +64 -60
- package/src/buildinschemas/webhook.ts +131 -59
- package/src/buildinschemas/webhooklog.ts +75 -0
- package/src/framework.ts +6 -8
- package/src/generate.ts +19 -3
- package/src/processors/jsonschemabuilder.ts +6 -4
- package/src/type.ts +271 -215
- package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +9 -7
- package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +22 -7
- package/templates/basic/nuxt/jsonschema.ts.eta +7 -0
- package/templates/basic/nuxt/resource-bridge.editable.service.ts.eta +40 -0
- package/templates/basic/nuxt/resource-bridge.service.ts.eta +24 -21
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +27 -9
- package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +2 -2
- package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +5 -2
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +4 -2
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +143 -168
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -13
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +22 -16
- package/templates/nest/src/simpleapp/webhooks/branch.ts._eta +37 -0
- package/templates/nest/src/simpleapp/webhooks/index.ts._eta +21 -0
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +4 -3
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +0 -1
- package/templates/nuxt/plugins/18.simpleapp-custom-field-store.ts.eta +9 -3
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +32 -22
- package/templates/nuxt/simpleapp/generate/jsonSchemas/index.ts.eta +11 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/common.constant.ts.eta +1 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/resource.constant.ts.eta +2 -2
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +4 -4
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge.service.ts.eta +20 -1
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/bridge.type.ts.eta +9 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/resource-mapper.type.ts.eta +2 -2
- package/templates/project/build.sh.eta +0 -5
- package/templates/nest/src/simpleapp/apischemas/customfield.ts.eta +0 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppCustomFieldClient.ts.eta +0 -188
- /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
|
-
<%
|
|
26
|
-
<%
|
|
27
|
-
|
|
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,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
|
-
<%
|
|
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
|
-
<%
|
|
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
|
-
|
|
76
|
+
protected async handleList(message: MiniAppBridgeMessageApi<<%= typeActionName %>>) {
|
|
78
77
|
return (await this.api!.runSearch({})).data;
|
|
79
78
|
}
|
|
80
79
|
<% } else if(action === 'detail') { %>
|
|
81
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
62
|
-
|
|
63
|
-
|
|
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
|
-
|
|
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.
|
|
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
|
|
92
|
-
|
|
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');
|