@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.
Files changed (42) hide show
  1. package/ReleaseNote.md +9 -0
  2. package/dist/generate.d.ts.map +1 -1
  3. package/dist/generate.js +3 -1
  4. package/dist/generate.js.map +1 -1
  5. package/package.json +1 -1
  6. package/src/generate.ts +3 -1
  7. package/templates/basic/nest/controller.ts.eta +1 -1
  8. package/templates/basic/nest/service.ts.eta +3 -3
  9. package/templates/nest/src/simple-app/_core/features/auto-increament/auto-increament.service.ts.eta +1 -2
  10. package/templates/nest/src/simple-app/_core/features/cron/cron-system/cron-system.service.ts.eta +2 -2
  11. package/templates/nest/src/simple-app/_core/features/event/event.type.ts.eta +6 -0
  12. package/templates/nest/src/simple-app/_core/features/event/interface/event-after-patch.interface.ts.eta +5 -0
  13. package/templates/nest/src/simple-app/_core/features/event/interface/event-before-patch.interface.ts.eta +5 -0
  14. package/templates/nest/src/simple-app/_core/features/log/log.controller.ts.eta +3 -3
  15. package/templates/nest/src/simple-app/_core/features/maintenance/maintenance.controller.ts.eta +6 -6
  16. package/templates/nest/src/simple-app/_core/features/profile/profile.controller.ts.eta +5 -4
  17. package/templates/nest/src/simple-app/_core/features/profile/profile.service.ts.eta +21 -22
  18. package/templates/nest/src/simple-app/_core/features/queue/queue-user-context/queue-user-context.service.ts.eta +2 -2
  19. package/templates/nest/src/simple-app/_core/features/user-context/user.context.ts.eta +17 -5
  20. package/templates/nest/src/simple-app/_core/framework/base/simple-app.service.ts.eta +18 -18
  21. package/templates/nest/src/simple-app/_core/framework/generator-version.ts.eta +1 -0
  22. package/templates/nest/src/simple-app/apis/additional-api.module.ts._eta +17 -0
  23. package/templates/nest/src/simple-app/apis/resource-api.module.ts.eta +2 -1
  24. package/templates/nest/src/simple-app/events/branch-event/branch-event.service.ts._eta +7 -7
  25. package/templates/nest/src/simple-app/events/organization-event/organization-event.service.ts._eta +5 -5
  26. package/templates/nest/src/simple-app/events/permission-event/permission-event.service.ts.eta +1 -1
  27. package/templates/nest/src/simple-app/events/tenant-event/tenant-event.service.ts_eta +3 -3
  28. package/templates/nuxt/app.vue.eta +7 -3
  29. package/templates/nuxt/components/image/ImageOrganization.vue._eta +39 -34
  30. package/templates/nuxt/composables/goTo.generate.ts.eta +56 -42
  31. package/templates/nuxt/composables/roles.generate.ts.eta +6 -6
  32. package/templates/nuxt/composables/stringHelper.generate.ts.eta +1 -1
  33. package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +18 -13
  34. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +44 -35
  35. package/templates/nuxt/server/api/profile/[...].ts.eta +1 -1
  36. package/templates/nuxt/simpleapp/generate/commons/generator-version.ts.eta +1 -0
  37. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppRestrictedWarning.vue.eta +1 -1
  38. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItem.vue.eta +1 -1
  39. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemBadge.vue.eta +1 -1
  40. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge.service.ts.eta +7 -2
  41. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/bridge.type.ts.eta +2 -0
  42. 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((res: AxiosResponse) => {
75
- if (!res) {
74
+ .then((tmp: AxiosResponse) => {
75
+ if (!tmp) {
76
76
  return;
77
77
  }
78
- this._id = res.data._id;
79
- this.uName = res.data.uName;
80
- this.sessionId = res.data.sessionId;
81
- this.tenantId = res.data.tenantId;
82
- this.orgId = res.data.orgId;
83
- this.orgRecordId = res.data.orgRecordId;
84
- this.branchId = res.data.branchId;
85
- this.branchRecordId = res.data.branchRecordId;
86
- this.branchCode = res.data.branchCode;
87
- this.branchName = res.data.branchName;
88
- this.orgCode = res.data.orgCode;
89
- this.orgName = res.data.orgName;
90
- this.timeZone = res.data.timeZone;
91
- this.currency = res.data.currency;
92
- this.country = res.data.country;
93
- this.offsetMinute = res.data.offsetMinute;
94
- this.uid = res.data.uid;
95
- this.email = res.data.email;
96
- this.fullName = res.data.fullName;
97
- this.branches = res.data.branches;
98
- this.groups = res.data.groups;
99
- this.roles = res.data.roles;
100
- this.time = res.data.time;
101
- this.xOrg = res.data.xOrg;
102
- this.invites = res.data.invites;
103
- this.moreProps = res.data.moreProps;
104
- // this.package = res.data.moreProps.package;
105
- // this.appintegration.einvoice = res.data.appintegration.einvoice;
106
- // this.appintegration.simbiz6 = res.data.appintegration.simbiz6;
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: UserProfile = {
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.avatarUrl, documentLink]);
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%>'
@@ -20,6 +20,6 @@ defineProps<{
20
20
  }>();
21
21
 
22
22
  function handleUpgradePlan() {
23
- window.open("https://simitgroup.com/simtraineco/#simtrain-price", "_blank");
23
+ window.open("https://simtrainsystem.com/#pricing", "_blank");
24
24
  }
25
25
  </script>
@@ -26,7 +26,7 @@
26
26
  </template>
27
27
 
28
28
  <script setup lang="ts">
29
- import { MiniappStatusEnum } from "~/enums/enums.generate";
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";
@@ -32,7 +32,7 @@
32
32
  </template>
33
33
 
34
34
  <script setup lang="ts">
35
- import { MiniappEnvEnum } from "~/enums/enums.generate";
35
+ import { MiniappEnvEnum } from "~/enums";
36
36
  import { Miniapp, MiniAppDetail } from "~/simpleapp/generate/openapi";
37
37
 
38
38
  const props = defineProps<{
@@ -22,7 +22,12 @@ export class MiniAppBridgeService extends MiniAppBridgeResourceAccessor {
22
22
  /**************************************** Bridge Handler ***************************************/
23
23
 
24
24
  handleBridgeNavigate(message: MiniAppBridgeMessageNavigate) {
25
- goTo(message.params.target, message.params.id, message.params.query);
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
- }