@simitgroup/simpleapp-generator 2.0.1-l-alpha → 2.0.1-m-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 +6 -0
- package/package.json +1 -1
- package/templates/nest/src/simple-app/_core/features/maintenance/maintenance.service.ts.eta +4 -4
- package/templates/nest/src/simple-app/_core/features/maintenance/schemas/environment.ts.eta +1 -1
- package/templates/nest/src/simple-app/_core/framework/simple-app.middleware.ts.eta +9 -4
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +28 -3
- package/templates/nuxt/plugins/18.simpleapp-custom-field-store.ts.eta +3 -1
- package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +4 -1
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +2 -1
package/ReleaseNote.md
CHANGED
package/package.json
CHANGED
|
@@ -63,19 +63,19 @@ export class MaintenanceService {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
async runGetEnvironment(appUser: UserContext) {
|
|
66
|
-
const res = await this.sysEnvdoc.findOne();
|
|
66
|
+
const res = await this.sysEnvdoc.findOne();
|
|
67
67
|
return res;
|
|
68
68
|
}
|
|
69
69
|
async runUpdateEnvironment(appUser: UserContext, data: Environment) {
|
|
70
70
|
const finalData: Environment = {
|
|
71
|
-
systemEnable: data.systemEnable
|
|
71
|
+
systemEnable: data.systemEnable !== undefined ? data.systemEnable : true,
|
|
72
72
|
stopUntil: data.stopUntil ?? '',
|
|
73
73
|
maintenanceMessage: data.maintenanceMessage ?? '',
|
|
74
74
|
adminEmails: data.adminEmails.map((item) => item.replace(' ', '')) ?? [],
|
|
75
75
|
billingEmails: data.billingEmails.map((item) => item.replace(' ', '')) ?? [],
|
|
76
76
|
supportEmails: data.supportEmails.map((item) => item.replace(' ', '')) ?? [],
|
|
77
|
-
taxRate: data.taxRate ?? 0.
|
|
78
|
-
taxName: data.taxName?? '',
|
|
77
|
+
taxRate: data.taxRate ?? 0.0,
|
|
78
|
+
taxName: data.taxName ?? '',
|
|
79
79
|
updated: new Date().toISOString(),
|
|
80
80
|
updatedBy: appUser.getUid(),
|
|
81
81
|
};
|
|
@@ -50,6 +50,11 @@ export class SimpleAppMiddleware implements NestMiddleware {
|
|
|
50
50
|
return true;
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
getMaintenanceMessage (env:Environment){
|
|
54
|
+
return {
|
|
55
|
+
message: env.maintenanceMessage
|
|
56
|
+
}
|
|
57
|
+
}
|
|
53
58
|
async use(req: Request, res: Response, next: NextFunction) {
|
|
54
59
|
if (req.baseUrl == '/oauth2-redirect.html') {
|
|
55
60
|
next();
|
|
@@ -66,7 +71,7 @@ export class SimpleAppMiddleware implements NestMiddleware {
|
|
|
66
71
|
tokenStr = tokenStr.replace('Bearer ', '');
|
|
67
72
|
const xOrg = req.get('x-org') ?? this.defaultXOrg;
|
|
68
73
|
|
|
69
|
-
const user = new UserContext(this.userModel, this.permModel, this.miniAppInstallationModel,envs[0]);
|
|
74
|
+
const user = new UserContext(this.userModel, this.permModel, this.miniAppInstallationModel, envs[0]);
|
|
70
75
|
|
|
71
76
|
if (req.baseUrl == '/graphql') {
|
|
72
77
|
if (tokenStr) {
|
|
@@ -74,7 +79,7 @@ export class SimpleAppMiddleware implements NestMiddleware {
|
|
|
74
79
|
}
|
|
75
80
|
|
|
76
81
|
if (maintenanceMode && !user.isRealmAdmin()) {
|
|
77
|
-
throw new ServiceUnavailableException(
|
|
82
|
+
throw new ServiceUnavailableException(this.getMaintenanceMessage(envs[0]));
|
|
78
83
|
}
|
|
79
84
|
|
|
80
85
|
req['sessionuser'] = user;
|
|
@@ -91,7 +96,7 @@ export class SimpleAppMiddleware implements NestMiddleware {
|
|
|
91
96
|
|
|
92
97
|
req['sessionuser'] = user;
|
|
93
98
|
if (maintenanceMode) {
|
|
94
|
-
throw new ServiceUnavailableException(
|
|
99
|
+
throw new ServiceUnavailableException(this.getMaintenanceMessage(envs[0]));
|
|
95
100
|
}
|
|
96
101
|
next();
|
|
97
102
|
return;
|
|
@@ -131,7 +136,7 @@ export class SimpleAppMiddleware implements NestMiddleware {
|
|
|
131
136
|
await user.setCurrentUserInfo(tokenStr, xOrg, this.webhookModel);
|
|
132
137
|
|
|
133
138
|
if (maintenanceMode && !user.isRealmAdmin()) {
|
|
134
|
-
throw new ServiceUnavailableException(
|
|
139
|
+
throw new ServiceUnavailableException(this.getMaintenanceMessage(envs[0]));
|
|
135
140
|
}
|
|
136
141
|
|
|
137
142
|
user.detectMiniAppSdkRequest(req);
|
|
@@ -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
|
|
4
|
+
* last change 2025-10-25
|
|
5
5
|
* Author: Ks Tan
|
|
6
6
|
*/
|
|
7
7
|
import DialogService from 'primevue/dialogservice';
|
|
@@ -34,15 +34,40 @@ export default defineNuxtPlugin( async(nuxtApp) => {
|
|
|
34
34
|
// console.log("error catch",error)
|
|
35
35
|
|
|
36
36
|
if(error?.code && error.code == 'ERR_BAD_REQUEST'){
|
|
37
|
-
// console.log("error.code",error.response.status, error)
|
|
38
37
|
if(error.response && error.response.status==403){
|
|
39
38
|
console.warn("error status 403, redirect to external link /" )
|
|
40
39
|
navigateTo('/',{external:true})
|
|
41
40
|
}else{
|
|
42
41
|
console.error("axios ERR_BAD_REQUEST",error)
|
|
42
|
+
let errorMsg=''
|
|
43
|
+
let errorCode=0
|
|
44
|
+
let moreMsg = ''
|
|
45
|
+
if(error.response?.data?.data?.message){
|
|
46
|
+
errorCode = error.response.data.data.status
|
|
47
|
+
moreMsg = error.response.data.data.message
|
|
48
|
+
errorMsg = error.response.data.data.name
|
|
49
|
+
}else if(error.response?.data){
|
|
50
|
+
errorCode = error.response.data.statusCode
|
|
51
|
+
moreMsg = error.response.data.statusMessage
|
|
52
|
+
errorMsg = error.response.data.message
|
|
53
|
+
}else{
|
|
54
|
+
errorCode = error.status
|
|
55
|
+
moreMsg = error.message
|
|
56
|
+
errorMsg = error.name
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const errorData = {
|
|
60
|
+
statusCode:errorCode,
|
|
61
|
+
statusMessage:errorMsg,
|
|
62
|
+
message: moreMsg ,
|
|
63
|
+
fatal:true
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
// console.log(error.response)
|
|
67
|
+
throw createError(errorData)
|
|
43
68
|
}
|
|
44
69
|
}
|
|
45
|
-
else if(error.code){
|
|
70
|
+
else if(error.code){
|
|
46
71
|
throw createError({
|
|
47
72
|
statusCode:error.code,
|
|
48
73
|
statusMessage:error.message,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
1
2
|
import { ShallowRef } from "vue";
|
|
2
3
|
import { Customfield, CUSTOMFIELDApi } from "~/simpleapp/generate/openapi";
|
|
3
4
|
|
|
@@ -18,7 +19,8 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
18
19
|
actions: {
|
|
19
20
|
async fetchList() {
|
|
20
21
|
const config = getAxiosConfig();
|
|
21
|
-
const
|
|
22
|
+
const axiosObj:AxiosInstance = useNuxtApp().$axios
|
|
23
|
+
const api = new CUSTOMFIELDApi(config,config.basePath,axiosObj);
|
|
22
24
|
const resp = await api.runSearch({
|
|
23
25
|
filter: {},
|
|
24
26
|
fields: ["_id", "collectionName", "form", "list"],
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AxiosInstance } from 'axios';
|
|
1
2
|
/**
|
|
2
3
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
4
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
@@ -61,7 +62,9 @@ export default defineNuxtPlugin(async () => {
|
|
|
61
62
|
},
|
|
62
63
|
getMiniAppManager : ()=>{
|
|
63
64
|
const config = getAxiosConfig();
|
|
64
|
-
|
|
65
|
+
|
|
66
|
+
const axiosObj:AxiosInstance = useNuxtApp().$axios
|
|
67
|
+
const miniAppManager = new MINIAPPMANAGERApi(config,config.basePath,axiosObj);
|
|
65
68
|
return miniAppManager
|
|
66
69
|
},
|
|
67
70
|
showMiniAppMoreMenuButton: (state) => {
|
|
@@ -147,10 +147,11 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
147
147
|
}
|
|
148
148
|
}
|
|
149
149
|
const { $axios } = useNuxtApp();
|
|
150
|
-
try {
|
|
150
|
+
try {
|
|
151
151
|
const pingresult = await new PROFILEApi(
|
|
152
152
|
undefined,
|
|
153
153
|
apiurl,
|
|
154
|
+
axios
|
|
154
155
|
).getSession();
|
|
155
156
|
if (pingresult.status < 300) return Promise.resolve("ok");
|
|
156
157
|
else return Promise.reject("relogin");
|