@simitgroup/simpleapp-generator 2.0.0-k-alpha → 2.0.0-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 +9 -0
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +3 -1
- package/dist/generate.js.map +1 -1
- package/package.json +1 -1
- package/src/generate.ts +3 -1
- package/templates/basic/nest/controller.ts.eta +1 -1
- package/templates/basic/nest/service.ts.eta +3 -3
- package/templates/nest/src/simple-app/_core/features/auto-increament/auto-increament.service.ts.eta +1 -2
- package/templates/nest/src/simple-app/_core/features/cron/cron-system/cron-system.service.ts.eta +2 -2
- package/templates/nest/src/simple-app/_core/features/event/event.type.ts.eta +6 -0
- package/templates/nest/src/simple-app/_core/features/event/interface/event-after-patch.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/_core/features/event/interface/event-before-patch.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/_core/features/log/log.controller.ts.eta +3 -3
- package/templates/nest/src/simple-app/_core/features/maintenance/maintenance.controller.ts.eta +6 -6
- package/templates/nest/src/simple-app/_core/features/profile/profile.controller.ts.eta +5 -4
- package/templates/nest/src/simple-app/_core/features/profile/profile.service.ts.eta +21 -22
- package/templates/nest/src/simple-app/_core/features/queue/queue-user-context/queue-user-context.service.ts.eta +2 -2
- package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +17 -5
- package/templates/nest/src/simple-app/_core/framework/base/simple-app.service.ts.eta +18 -18
- package/templates/nest/src/simple-app/_core/framework/generator-version.ts.eta +1 -0
- package/templates/nest/src/simple-app/apis/additional-api.module.ts._eta +17 -0
- package/templates/nest/src/simple-app/apis/resource-api.module.ts.eta +2 -1
- package/templates/nest/src/simple-app/events/branch-event/branch-event.service.ts._eta +7 -7
- package/templates/nest/src/simple-app/events/organization-event/organization-event.service.ts._eta +5 -5
- package/templates/nest/src/simple-app/events/permission-event/permission-event.service.ts.eta +1 -1
- package/templates/nest/src/simple-app/events/tenant-event/tenant-event.service.ts_eta +3 -3
- package/templates/nuxt/app.vue.eta +7 -3
- package/templates/nuxt/components/image/ImageOrganization.vue._eta +39 -34
- package/templates/nuxt/composables/goTo.generate.ts.eta +56 -42
- package/templates/nuxt/composables/roles.generate.ts.eta +6 -6
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +1 -1
- package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +18 -13
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +44 -35
- package/templates/nuxt/server/api/profile/[...].ts.eta +1 -1
- package/templates/nuxt/simpleapp/generate/commons/generator-version.ts.eta +1 -0
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppRestrictedWarning.vue.eta +1 -1
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItem.vue.eta +1 -1
- package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemBadge.vue.eta +1 -1
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge.service.ts.eta +7 -2
- package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/bridge.type.ts.eta +2 -0
- package/templates/nest/src/simple-app/_core/utils/encryption.static.ts.eta +0 -73
|
@@ -30,9 +30,9 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
30
30
|
currency: ref(""),
|
|
31
31
|
country: ref(""),
|
|
32
32
|
offsetMinute: ref(0),
|
|
33
|
-
tenantInfo: ref<Tenant>(),
|
|
34
|
-
orgInfo: ref<Organization>(),
|
|
35
|
-
branchInfo: ref<Branch>(),
|
|
33
|
+
tenantInfo: ref<Tenant>({} as Tenant),
|
|
34
|
+
orgInfo: ref<Organization>({} as Organization),
|
|
35
|
+
branchInfo: ref<Branch>({} as Branch),
|
|
36
36
|
uid: ref(""),
|
|
37
37
|
email: ref(""),
|
|
38
38
|
fullName: ref(""),
|
|
@@ -71,39 +71,44 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
71
71
|
}
|
|
72
72
|
return await new PROFILEApi(undefined, apiurl, $axios)
|
|
73
73
|
.getProfile()
|
|
74
|
-
.then((
|
|
75
|
-
if (!
|
|
74
|
+
.then((tmp: AxiosResponse) => {
|
|
75
|
+
if (!tmp) {
|
|
76
76
|
return;
|
|
77
77
|
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
this.
|
|
81
|
-
this.
|
|
82
|
-
this.
|
|
83
|
-
this.
|
|
84
|
-
this.
|
|
85
|
-
this.
|
|
86
|
-
this.
|
|
87
|
-
this.
|
|
88
|
-
this.
|
|
89
|
-
this.
|
|
90
|
-
this.
|
|
91
|
-
this.
|
|
92
|
-
this.
|
|
93
|
-
this.
|
|
94
|
-
this.
|
|
95
|
-
this.
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
98
|
-
this.
|
|
99
|
-
this.
|
|
100
|
-
this.
|
|
101
|
-
this.
|
|
102
|
-
this.
|
|
103
|
-
this.
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
78
|
+
const res = tmp.data
|
|
79
|
+
|
|
80
|
+
this._id = res._id;
|
|
81
|
+
this.uName = res.uName;
|
|
82
|
+
this.sessionId = res.sessionId;
|
|
83
|
+
this.tenantId = res.tenantId;
|
|
84
|
+
this.orgId = res.orgId;
|
|
85
|
+
this.orgRecordId = res.orgRecordId;
|
|
86
|
+
this.branchId = res.branchId;
|
|
87
|
+
this.branchRecordId = res.branchRecordId;
|
|
88
|
+
this.branchCode = res.branchCode;
|
|
89
|
+
this.branchName = res.branchName;
|
|
90
|
+
this.orgCode = res.orgCode;
|
|
91
|
+
this.orgName = res.orgName;
|
|
92
|
+
this.timeZone = res.timeZone;
|
|
93
|
+
this.currency = res.currency;
|
|
94
|
+
this.country = res.country;
|
|
95
|
+
this.offsetMinute = res.offsetMinute;
|
|
96
|
+
this.tenantInfo = res?.tenantInfo;
|
|
97
|
+
this.orgInfo = res?.orgInfo;
|
|
98
|
+
this.branchInfo = res?.branchInfo;
|
|
99
|
+
this.uid = res.uid;
|
|
100
|
+
this.email = res.email;
|
|
101
|
+
this.fullName = res.fullName;
|
|
102
|
+
this.branches = res.branches;
|
|
103
|
+
this.groups = res.groups;
|
|
104
|
+
this.roles = res.roles;
|
|
105
|
+
this.time = res.time;
|
|
106
|
+
this.xOrg = res.xOrg;
|
|
107
|
+
this.invites = res.invites;
|
|
108
|
+
this.moreProps = res.moreProps;
|
|
109
|
+
// this.package = res.moreProps.package;
|
|
110
|
+
// this.appintegration.einvoice = res.appintegration.einvoice;
|
|
111
|
+
// this.appintegration.simbiz6 = res.appintegration.simbiz6;
|
|
107
112
|
let cachegroup = useCookie("currentGroup").value ?? "";
|
|
108
113
|
if (!this.groups || !this.groups.includes(cachegroup)) {
|
|
109
114
|
cachegroup = "";
|
|
@@ -267,7 +272,7 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
267
272
|
navigateTo(tourl, { external: true });
|
|
268
273
|
},
|
|
269
274
|
getUserInfo() {
|
|
270
|
-
const userinfo:
|
|
275
|
+
const userinfo: UserContextInfo & {currentGroup:string} = {
|
|
271
276
|
_id: this._id,
|
|
272
277
|
sessionId: this.sessionId,
|
|
273
278
|
tenantId: this.tenantId,
|
|
@@ -286,6 +291,10 @@ export default defineNuxtPlugin(async (nuxtApp) => {
|
|
|
286
291
|
timeZone: this.timeZone,
|
|
287
292
|
country: this.country,
|
|
288
293
|
offsetMinute: this.offsetMinute,
|
|
294
|
+
tenantInfo: this.tenantInfo,
|
|
295
|
+
orgInfo: this.orgInfo,
|
|
296
|
+
branchInfo:this.branchInfo,
|
|
297
|
+
|
|
289
298
|
fullName: this.fullName,
|
|
290
299
|
branches: this.branches ?? [],
|
|
291
300
|
invites: this.invites ?? [],
|
|
@@ -62,7 +62,7 @@ export default defineEventHandler(async (event:any) => {
|
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
if(documentLink=='avatar' ){
|
|
65
|
-
axiosConfig.url = pathJoin([useRuntimeConfig().public.
|
|
65
|
+
axiosConfig.url = pathJoin([useRuntimeConfig().public.imageUrl, documentLink]);
|
|
66
66
|
delete axiosConfig.params
|
|
67
67
|
}
|
|
68
68
|
// console.log("axiosConfig",axiosConfig)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export generatorVersion='<%=it.version%>'
|
|
@@ -26,7 +26,7 @@
|
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
28
|
<script setup lang="ts">
|
|
29
|
-
import { MiniappStatusEnum } from "~/enums
|
|
29
|
+
import { MiniappStatusEnum } from "~/enums";
|
|
30
30
|
import { MiniAppDetail } from "~/simpleapp/generate/openapi";
|
|
31
31
|
import MiniAppIntegrationItemBadge from "./MiniAppIntegrationItemBadge.vue";
|
|
32
32
|
import MiniAppIcon from "../MiniAppIcon.vue";
|
package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge.service.ts.eta
CHANGED
|
@@ -22,7 +22,12 @@ export class MiniAppBridgeService extends MiniAppBridgeResourceAccessor {
|
|
|
22
22
|
/**************************************** Bridge Handler ***************************************/
|
|
23
23
|
|
|
24
24
|
handleBridgeNavigate(message: MiniAppBridgeMessageNavigate) {
|
|
25
|
-
goTo(
|
|
25
|
+
goTo(
|
|
26
|
+
message.params.target,
|
|
27
|
+
message.params.id,
|
|
28
|
+
message.params.query,
|
|
29
|
+
message.params.options,
|
|
30
|
+
);
|
|
26
31
|
}
|
|
27
32
|
|
|
28
33
|
handleBridgeNavigateCurrentMiniApp(
|
|
@@ -40,7 +45,7 @@ export class MiniAppBridgeService extends MiniAppBridgeResourceAccessor {
|
|
|
40
45
|
targetUrl = `${targetUrl}/${message.params.target}`;
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
goTo(targetUrl, undefined, message.params.query);
|
|
48
|
+
goTo(targetUrl, undefined, message.params.query, message.params.options);
|
|
44
49
|
}
|
|
45
50
|
|
|
46
51
|
handleBridgeOpenOnScreenResourceForm(
|
|
@@ -27,6 +27,7 @@ export type MiniAppBridgeMessageNavigate = {
|
|
|
27
27
|
target: string;
|
|
28
28
|
id?: string;
|
|
29
29
|
query?: string;
|
|
30
|
+
options?: Parameters<typeof navigateTo>[1];
|
|
30
31
|
};
|
|
31
32
|
};
|
|
32
33
|
|
|
@@ -35,6 +36,7 @@ export type MiniAppBridgeMessageNavigateCurrentMiniApp = {
|
|
|
35
36
|
params: {
|
|
36
37
|
target: string;
|
|
37
38
|
query?: string;
|
|
39
|
+
options?: Parameters<typeof navigateTo>[1];
|
|
38
40
|
};
|
|
39
41
|
};
|
|
40
42
|
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
3
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
|
-
* last change 2023-10-31
|
|
5
|
-
* Author: Ks Tan
|
|
6
|
-
*
|
|
7
|
-
* this class developed for implement field level encryption, however it still half way and keep here for future enhancement
|
|
8
|
-
* it doesn't effect anything at the moment
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
import { Injectable } from '@nestjs/common';
|
|
12
|
-
import {
|
|
13
|
-
createCipheriv,
|
|
14
|
-
createDecipheriv,
|
|
15
|
-
randomBytes,
|
|
16
|
-
scrypt,
|
|
17
|
-
Cipher,
|
|
18
|
-
Decipher,
|
|
19
|
-
} from 'crypto';
|
|
20
|
-
import { promisify } from 'util';
|
|
21
|
-
|
|
22
|
-
export class Encryption {
|
|
23
|
-
private static instance: Encryption;
|
|
24
|
-
private algorithm = 'aes-256-ctr';
|
|
25
|
-
private iv = randomBytes(16);
|
|
26
|
-
private password = String(process.env.ENRYPTION_KEY);
|
|
27
|
-
|
|
28
|
-
private key: Buffer;
|
|
29
|
-
|
|
30
|
-
constructor() {
|
|
31
|
-
this.init();
|
|
32
|
-
}
|
|
33
|
-
public static getInstance(): Encryption {
|
|
34
|
-
if (!Encryption.instance) {
|
|
35
|
-
Encryption.instance = new Encryption();
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
return Encryption.instance;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
async init() {
|
|
42
|
-
// console.log('Initialized encryption class');
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
getKey = async (salt) => {
|
|
46
|
-
const key = (await promisify(scrypt)(this.password, salt, 32)) as Buffer;
|
|
47
|
-
return key;
|
|
48
|
-
};
|
|
49
|
-
|
|
50
|
-
encrypt = async (value: string) => {
|
|
51
|
-
const salt = 'salt';
|
|
52
|
-
const key = await this.getKey(salt);
|
|
53
|
-
const cipher = createCipheriv(this.algorithm, key, this.iv);
|
|
54
|
-
// console.log('Encrypting text ', value, cipher);
|
|
55
|
-
const encryptedText = Buffer.concat([
|
|
56
|
-
cipher.update(value),
|
|
57
|
-
cipher.final(),
|
|
58
|
-
]).toString('hex');
|
|
59
|
-
// console.log('encryptedText', encryptedText);
|
|
60
|
-
return encryptedText;
|
|
61
|
-
};
|
|
62
|
-
|
|
63
|
-
decrypt = async (value: string, salt: string) => {
|
|
64
|
-
const key = await this.getKey(salt);
|
|
65
|
-
const decipher = createDecipheriv('aes-256-ctr', key, this.iv);
|
|
66
|
-
const buf = Buffer.from(value);
|
|
67
|
-
const decryptedText = Buffer.concat([
|
|
68
|
-
decipher.update(buf),
|
|
69
|
-
decipher.final(),
|
|
70
|
-
]).toString('hex');
|
|
71
|
-
return decryptedText;
|
|
72
|
-
};
|
|
73
|
-
}
|