@simitgroup/simpleapp-generator 1.6.6-o-alpha → 1.6.6-q-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 (101) hide show
  1. package/dist/buildinschemas/autoincreament.d.ts.map +1 -1
  2. package/dist/buildinschemas/autoincreament.js +17 -14
  3. package/dist/buildinschemas/autoincreament.js.map +1 -1
  4. package/dist/buildinschemas/branch.d.ts.map +1 -1
  5. package/dist/buildinschemas/branch.js +25 -24
  6. package/dist/buildinschemas/branch.js.map +1 -1
  7. package/dist/buildinschemas/changehistories.d.ts.map +1 -1
  8. package/dist/buildinschemas/changehistories.js +10 -9
  9. package/dist/buildinschemas/changehistories.js.map +1 -1
  10. package/dist/buildinschemas/customfield.d.ts.map +1 -1
  11. package/dist/buildinschemas/customfield.js +16 -15
  12. package/dist/buildinschemas/customfield.js.map +1 -1
  13. package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
  14. package/dist/buildinschemas/docnoformat.js +34 -23
  15. package/dist/buildinschemas/docnoformat.js.map +1 -1
  16. package/dist/buildinschemas/documentevent.d.ts.map +1 -1
  17. package/dist/buildinschemas/documentevent.js +36 -26
  18. package/dist/buildinschemas/documentevent.js.map +1 -1
  19. package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -1
  20. package/dist/buildinschemas/keyvaluepair.js +7 -6
  21. package/dist/buildinschemas/keyvaluepair.js.map +1 -1
  22. package/dist/buildinschemas/organization.d.ts.map +1 -1
  23. package/dist/buildinschemas/organization.js +34 -30
  24. package/dist/buildinschemas/organization.js.map +1 -1
  25. package/dist/buildinschemas/permission.d.ts.map +1 -1
  26. package/dist/buildinschemas/permission.js +16 -7
  27. package/dist/buildinschemas/permission.js.map +1 -1
  28. package/dist/buildinschemas/systemmessage.d.ts.map +1 -1
  29. package/dist/buildinschemas/systemmessage.js +35 -32
  30. package/dist/buildinschemas/systemmessage.js.map +1 -1
  31. package/dist/buildinschemas/tenant.d.ts.map +1 -1
  32. package/dist/buildinschemas/tenant.js +17 -16
  33. package/dist/buildinschemas/tenant.js.map +1 -1
  34. package/dist/buildinschemas/user.d.ts.map +1 -1
  35. package/dist/buildinschemas/user.js +34 -31
  36. package/dist/buildinschemas/user.js.map +1 -1
  37. package/dist/buildinschemas/webhook.d.ts.map +1 -1
  38. package/dist/buildinschemas/webhook.js +24 -23
  39. package/dist/buildinschemas/webhook.js.map +1 -1
  40. package/dist/framework.d.ts +2 -0
  41. package/dist/framework.d.ts.map +1 -1
  42. package/dist/framework.js +92 -57
  43. package/dist/framework.js.map +1 -1
  44. package/dist/generate.d.ts.map +1 -1
  45. package/dist/generate.js +175 -34
  46. package/dist/generate.js.map +1 -1
  47. package/dist/index.js +30 -12
  48. package/dist/index.js.map +1 -1
  49. package/dist/processors/jsonschemabuilder.js +14 -12
  50. package/dist/processors/jsonschemabuilder.js.map +1 -1
  51. package/dist/type.d.ts +44 -5
  52. package/dist/type.d.ts.map +1 -1
  53. package/dist/type.js.map +1 -1
  54. package/package.json +1 -1
  55. package/src/buildinschemas/autoincreament.ts +35 -33
  56. package/src/buildinschemas/branch.ts +47 -47
  57. package/src/buildinschemas/changehistories.ts +31 -30
  58. package/src/buildinschemas/customfield.ts +17 -16
  59. package/src/buildinschemas/docnoformat.ts +54 -43
  60. package/src/buildinschemas/documentevent.ts +42 -33
  61. package/src/buildinschemas/keyvaluepair.ts +25 -25
  62. package/src/buildinschemas/organization.ts +54 -50
  63. package/src/buildinschemas/permission.ts +34 -25
  64. package/src/buildinschemas/systemmessage.ts +39 -38
  65. package/src/buildinschemas/tenant.ts +46 -45
  66. package/src/buildinschemas/user.ts +64 -60
  67. package/src/buildinschemas/webhook.ts +62 -61
  68. package/src/framework.ts +307 -251
  69. package/src/generate.ts +608 -434
  70. package/src/index.ts +136 -118
  71. package/src/processors/jsonschemabuilder.ts +6 -4
  72. package/src/type.ts +287 -226
  73. package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +119 -0
  74. package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +228 -0
  75. package/templates/basic/nuxt/jsonschema.ts.eta +7 -0
  76. package/templates/basic/nuxt/resource-bridge.editable.service.ts.eta +40 -0
  77. package/templates/basic/nuxt/resource-bridge.service.ts.eta +165 -0
  78. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +27 -9
  79. package/templates/miniAppJsSdk/src/index.ts.eta +28 -0
  80. package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +70 -0
  81. package/templates/miniAppJsSdk/src/services/bridge.service.ts.eta +91 -0
  82. package/templates/miniAppJsSdk/src/types/service.type.ts.eta +22 -0
  83. package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +76 -0
  84. package/templates/nest/src/simpleapp/generate/jsonschemas/index.ts.eta +11 -0
  85. package/templates/nest/src/simpleapp/types/customfield.ts.eta +14 -0
  86. package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +3 -3
  87. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +0 -1
  88. package/templates/nuxt/plugins/18.simpleapp-custom-field-store.ts.eta +9 -3
  89. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +316 -341
  90. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +32 -21
  91. package/templates/nuxt/simpleapp/generate/jsonSchemas/index.ts.eta +11 -0
  92. package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/common.constant.ts.eta +16 -0
  93. package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/resource.constant.ts.eta +46 -0
  94. package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +63 -0
  95. package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge.service.ts.eta +129 -0
  96. package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/bridge.type.ts.eta +81 -0
  97. package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/resource-mapper.type.ts.eta +55 -0
  98. package/templates/nuxt/types/others.ts.eta +74 -65
  99. package/templates/nuxt/types/schema.ts.eta +225 -188
  100. package/templates/project/build.sh.eta +4 -0
  101. package/templates/nuxt/simpleapp/generate/clients/SimpleAppCustomFieldClient.ts.eta +0 -191
@@ -13,10 +13,13 @@ import {
13
13
  NotificationStatus,
14
14
  SchemaType,
15
15
  FormActions,
16
+ DynamicObject,
16
17
  } from "~/types";
17
18
  import { getValidateService } from "~/simpleapp/generate/sharelibs/validate";
18
- import { SimpleAppCustomFieldClient } from "./SimpleAppCustomFieldClient";
19
19
  import { WatchHandle } from "vue";
20
+ import { CustomFieldService } from "../features/customField/services/CustomFieldService";
21
+ import { CustomFieldDataMode } from "../features/customField/types/common";
22
+ import { CustomFieldDataModeEnum } from "../features/customField/enums/common";
20
23
 
21
24
  // import { useToast, } from 'primevue/usetoast';
22
25
  // import type { ToastMessageOptions } from 'primevue/toast';
@@ -50,8 +53,10 @@ export class SimpleAppClient<
50
53
  protected errorlist = ref({});
51
54
  protected completeformula = true;
52
55
  protected axios;
53
- private _customFieldClient = new SimpleAppCustomFieldClient();
56
+
57
+ // FLAG::CUSTOM_FIELD
54
58
  protected _customFieldWatch: WatchHandle | null = null;
59
+ private _customFieldService = new CustomFieldService();
55
60
 
56
61
  constructor(apiobj: TApi, doctype: string, docname: string) {
57
62
  this.docapi = apiobj;
@@ -76,24 +81,29 @@ export class SimpleAppClient<
76
81
  return false;
77
82
  } //if there is readonly attribute in data, will override it at processor and client
78
83
  setData = (data: any) => {
79
- // this.data.value = data;
80
- // TODO: TS ERROR
81
- data.more = this._customFieldClient.processCustomFieldData(
82
- // @ts-ignore
83
- this.schema.properties?.["more"],
84
- data.createdBy == "",
85
- data.more,
86
- );
87
-
88
84
  Object.assign(this.data.value, data);
89
85
  };
90
86
 
91
- async processCustomField() {
92
- const resp = this._customFieldClient.processCustomField(this.doctype);
93
- // TODO: TS ERROR
94
- // @ts-ignore
95
- this.schema.properties.more = resp.schema;
96
- this.setData(this.data.value);
87
+ prepareCustomFieldJsonSchema() {
88
+ const resp = this._customFieldService.prepareCustomFieldJsonSchema(
89
+ this.docname,
90
+ );
91
+ this.schema.properties.more = resp;
92
+ }
93
+
94
+ prepareCustomFieldData<T extends DynamicObject>(
95
+ mode: CustomFieldDataMode,
96
+ data: T,
97
+ ) {
98
+ const customFieldData = this._customFieldService.prepareCustomFieldData(
99
+ this.docname,
100
+ mode,
101
+ this.schema.properties?.more,
102
+ data.more,
103
+ );
104
+
105
+ (data as any).more = customFieldData;
106
+ return data;
97
107
  }
98
108
 
99
109
  async getById(id?: string) {
@@ -102,10 +112,11 @@ export class SimpleAppClient<
102
112
  return await this.docapi
103
113
  .runFindOne(id, this.axios)
104
114
  .then((res: AxiosResponse) => {
105
- // if(this.event){this.event('info:getById',res.data)}
106
- // this.data.value = {} as TData;
107
- // Object.assign(this.data.value, res.data);
108
- this.setData(res.data);
115
+ const dataWithCustomField = this.prepareCustomFieldData(
116
+ CustomFieldDataModeEnum.EXISTING,
117
+ res.data,
118
+ );
119
+ this.setData(dataWithCustomField);
109
120
  this.setWatchChange();
110
121
  setTimeout(() => {
111
122
  this.ready = true;
@@ -0,0 +1,11 @@
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
+
8
+ <%for(let i=0; i<it.modules.length;i++){ %>
9
+ <% const d = it.modules[i] %>
10
+ export * from './<%= d['doctype']%>.jsonschema'
11
+ <%}%>
@@ -0,0 +1,16 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2025-06-18
5
+ * Author: --
6
+ */
7
+
8
+ export enum MINI_APP_BRIDGE_MESSAGES {
9
+ NAVIGATE = "NAVIGATE",
10
+ NAVIGATE_CURRENT_MINI_APP = "NAVIGATE_CURRENT_MINI_APP",
11
+ OPEN_ON_SCREEN_RESOURCE_FORM = "OPEN_ON_SCREEN_RESOURCE_FORM",
12
+ API = "API",
13
+ API_RESPONSE = "API_RESPONSE",
14
+ INIT = "INIT",
15
+ INIT_RESPONSE = "INIT_RESPONSE",
16
+ }
@@ -0,0 +1,46 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
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 getMiniAppInfo = (module) => {
18
+ const config = module.schema['x-simpleapp-config'];
19
+ const resourceName = config?.resourceName ?? config.documentName;
20
+
21
+ const pascalName = upperFirstCase(resourceName);
22
+ const kebabName = camelToKebab(resourceName);
23
+
24
+ const miniAppWhitelistApis = config?.miniApp?.whitelist || {};
25
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
26
+
27
+ return {
28
+ resourceName,
29
+ pascalName,
30
+ kebabName,
31
+ hasMiniAppWhitelistedApi,
32
+ miniAppWhitelistApis,
33
+ }
34
+ }
35
+ %>
36
+
37
+ export const MINI_APP_API_RESOURCES = [
38
+ <% for (let i = 0; i < it.modules.length; i++) { %>
39
+ <%
40
+ const { resourceName, pascalName, hasMiniAppWhitelistedApi } = getMiniAppInfo(it.modules[i]);
41
+ %>
42
+ <% if(hasMiniAppWhitelistedApi) { %>
43
+ "<%= resourceName %>",
44
+ <% } %>
45
+ <% } %>
46
+ ];
@@ -0,0 +1,63 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
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 getMiniAppInfo = (module) => {
18
+ const config = module.schema['x-simpleapp-config'];
19
+ const resourceName = config?.resourceName ?? config.documentName;
20
+
21
+ const pascalName = upperFirstCase(resourceName);
22
+ const kebabName = camelToKebab(resourceName);
23
+
24
+ const miniAppWhitelistApis = config?.miniApp?.whitelist || {};
25
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
26
+
27
+ return {
28
+ resourceName,
29
+ pascalName,
30
+ kebabName,
31
+ hasMiniAppWhitelistedApi,
32
+ miniAppWhitelistApis,
33
+ }
34
+ }
35
+ %>
36
+
37
+ import { MiniAppResourceMap } from "../types/resource-mapper.type";
38
+ <% for (let i = 0; i < it.modules.length; i++) { %>
39
+ <%
40
+ const { pascalName, kebabName, hasMiniAppWhitelistedApi } = getMiniAppInfo(it.modules[i]);
41
+ %>
42
+ <% if(hasMiniAppWhitelistedApi) { %>
43
+ import { MiniApp<%= pascalName %>BridgeEditableService } from "./editable/resources/<%= kebabName %>-bridge.editable.service";
44
+ <% } %>
45
+ <% } %>
46
+
47
+ export class MiniAppBridgeResourceAccessor {
48
+ protected instances: Partial<MiniAppResourceMap> = {};
49
+
50
+ <% for (let i = 0; i < it.modules.length; i++) { %>
51
+ <%
52
+ const { resourceName, pascalName, kebabName, hasMiniAppWhitelistedApi } = getMiniAppInfo(it.modules[i]);
53
+ %>
54
+ <% if(hasMiniAppWhitelistedApi) { %>
55
+ get <%= resourceName %>() {
56
+ if (!this.instances.<%= resourceName %>) {
57
+ this.instances.<%= resourceName %> = new MiniApp<%= pascalName %>BridgeEditableService();
58
+ }
59
+ return this.instances.<%= resourceName %>;
60
+ }
61
+ <% } %>
62
+ <% } %>
63
+ }
@@ -0,0 +1,129 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2025-06-18
5
+ * Author: --
6
+ */
7
+
8
+ import { SimpleAppDocumentType } from "~/types";
9
+ import {
10
+ MiniAppBridgeMessageApi,
11
+ MiniAppBridgeMessageNavigate,
12
+ MiniAppBridgeMessageNavigateCurrentMiniApp,
13
+ MiniAppBridgeMessageOpenOnScreenResourceForm,
14
+ } from "../types/bridge.type";
15
+ import { AxiosError } from "axios";
16
+ import { MINI_APP_BRIDGE_MESSAGES } from "../constants/common.constant";
17
+ import { MiniAppResourceMap } from "../types/resource-mapper.type";
18
+ import { MiniAppBridgeResourceAccessor } from "./bridge-resource-accessor.service";
19
+ import { MINI_APP_API_RESOURCES } from "../constants/resource.constant";
20
+
21
+ export class MiniAppBridgeService extends MiniAppBridgeResourceAccessor {
22
+ /**************************************** Bridge Handler ***************************************/
23
+
24
+ handleBridgeNavigate(message: MiniAppBridgeMessageNavigate) {
25
+ goTo(message.params.target, message.params.id, message.params.query);
26
+ }
27
+
28
+ handleBridgeNavigateCurrentMiniApp(
29
+ message: MiniAppBridgeMessageNavigateCurrentMiniApp,
30
+ pluginCode: string,
31
+ ) {
32
+ const target = message.params.target;
33
+ const { $appPluginsStore } = useNuxtApp();
34
+ let targetUrl = "";
35
+ if (target === "setting") {
36
+ targetUrl = $appPluginsStore.getPluginSettingPath(pluginCode);
37
+ } else {
38
+ targetUrl = $appPluginsStore.getPluginPageUrlPath(pluginCode, "");
39
+ targetUrl = targetUrl.replace(/^\/|\/$/g, "");
40
+ targetUrl = `${targetUrl}/${message.params.target}`;
41
+ }
42
+
43
+ goTo(targetUrl, undefined, message.params.query);
44
+ }
45
+
46
+ handleBridgeOpenOnScreenResourceForm(
47
+ message: MiniAppBridgeMessageOpenOnScreenResourceForm,
48
+ ) {
49
+ if (message.params.resource.id) {
50
+ onScreenEditDocument(
51
+ message.params.resource.name as SimpleAppDocumentType,
52
+ message.params.resource.id,
53
+ );
54
+ return;
55
+ }
56
+
57
+ onScreenAddDocument(message.params.resource.name as SimpleAppDocumentType, {
58
+ paras: message.params.data,
59
+ });
60
+ return;
61
+ }
62
+
63
+ async handleBridgeApi(
64
+ messageEvent: MessageEvent,
65
+ message: MiniAppBridgeMessageApi<any>,
66
+ ) {
67
+ try {
68
+ const data = await this.handleBridgeCallApi(message);
69
+
70
+ messageEvent.source?.postMessage(
71
+ {
72
+ type: MINI_APP_BRIDGE_MESSAGES.API_RESPONSE,
73
+ success: true,
74
+ requestId: message.requestId,
75
+ data,
76
+ },
77
+ {
78
+ targetOrigin: messageEvent.origin,
79
+ },
80
+ );
81
+ } catch (e) {
82
+ const err = e as AxiosError;
83
+
84
+ messageEvent.source?.postMessage(
85
+ {
86
+ type: MINI_APP_BRIDGE_MESSAGES.API_RESPONSE,
87
+ success: false,
88
+ requestId: message.requestId,
89
+ error: {
90
+ code: err.code,
91
+ message: err.message,
92
+ status: err.status,
93
+ response: err.response
94
+ ? {
95
+ data: err.response?.data
96
+ ? {
97
+ data: (err.response.data as any)?.data ?? "",
98
+ error: (err.response.data as any)?.error ?? "",
99
+ message: (err.response.data as any)?.message ?? "",
100
+ statusCode:
101
+ (err.response.data as any)?.statusCode ?? "",
102
+ statusMessage:
103
+ (err.response.data as any)?.statusMessage ?? "",
104
+ }
105
+ : {},
106
+ status: err.response.status,
107
+ statusText: err.response.statusText,
108
+ }
109
+ : {},
110
+ },
111
+ },
112
+ {
113
+ targetOrigin: messageEvent.origin,
114
+ },
115
+ );
116
+ }
117
+ }
118
+
119
+ private async handleBridgeCallApi(message: MiniAppBridgeMessageApi<any>) {
120
+ const resourceName = message.params.resource.name;
121
+
122
+ if (!MINI_APP_API_RESOURCES.includes(resourceName)) {
123
+ throw new Error(`Unknown resource name: ${resourceName}`);
124
+ }
125
+
126
+ const bridge = this[resourceName as keyof MiniAppResourceMap];
127
+ return await bridge.handleApi(message);
128
+ }
129
+ }
@@ -0,0 +1,81 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
4
+ * last change 2025-06-18
5
+ * Author: --
6
+ */
7
+
8
+ import { MINI_APP_BRIDGE_MESSAGES } from "../constants/common.constant";
9
+
10
+ export type MiniAppResource = {
11
+ name: string;
12
+ id?: string;
13
+ };
14
+
15
+ /************************************* Bridge Message Type *************************************/
16
+
17
+ export type MiniAppBridgeMessage<TAction> =
18
+ | MiniAppBridgeMessageNavigate
19
+ | MiniAppBridgeMessageNavigateCurrentMiniApp
20
+ | MiniAppBridgeMessageOpenOnScreenResourceForm
21
+ | MiniAppBridgeMessageApi<TAction>
22
+ | MiniAppBridgeMessageInitResponse;
23
+
24
+ export type MiniAppBridgeMessageNavigate = {
25
+ type: typeof MINI_APP_BRIDGE_MESSAGES.NAVIGATE;
26
+ params: {
27
+ target: string;
28
+ id?: string;
29
+ query?: string;
30
+ };
31
+ };
32
+
33
+ export type MiniAppBridgeMessageNavigateCurrentMiniApp = {
34
+ type: typeof MINI_APP_BRIDGE_MESSAGES.NAVIGATE_CURRENT_MINI_APP;
35
+ params: {
36
+ target: string;
37
+ query?: string;
38
+ };
39
+ };
40
+
41
+ export type MiniAppBridgeMessageOpenOnScreenResourceForm = {
42
+ type: typeof MINI_APP_BRIDGE_MESSAGES.OPEN_ON_SCREEN_RESOURCE_FORM;
43
+ params: {
44
+ resource: MiniAppResource;
45
+ data?: any;
46
+ };
47
+ };
48
+
49
+ export type MiniAppBridgeMessageApi<TActions> = {
50
+ type: typeof MINI_APP_BRIDGE_MESSAGES.API;
51
+ requestId: string;
52
+ params: {
53
+ action: TActions;
54
+ resource: MiniAppResource;
55
+ /**
56
+ * For auto complete filter
57
+ */
58
+ query?: string;
59
+ /**
60
+ * For :id/:code/xxx
61
+ */
62
+ queryParams?: {
63
+ [key: string]: any;
64
+ };
65
+ body?: {
66
+ [key: string]: any;
67
+ };
68
+ };
69
+ };
70
+
71
+ export type MiniAppBridgeMessageApiResponse<TData> = {
72
+ type: typeof MINI_APP_BRIDGE_MESSAGES.API_RESPONSE;
73
+ requestId: string;
74
+ success: boolean;
75
+ data?: TData;
76
+ error?: any;
77
+ };
78
+
79
+ export type MiniAppBridgeMessageInitResponse = {
80
+ type: typeof MINI_APP_BRIDGE_MESSAGES.INIT_RESPONSE;
81
+ };
@@ -0,0 +1,55 @@
1
+ /**
2
+ * This file was automatically generated by simpleapp generator. Every
3
+ * MODIFICATION OVERRIDE BY GENERATEOR
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 getMiniAppInfo = (module) => {
18
+ const config = module.schema['x-simpleapp-config'];
19
+ const resourceName = config?.resourceName ?? config.documentName;
20
+
21
+ const pascalName = upperFirstCase(resourceName);
22
+ const kebabName = camelToKebab(resourceName);
23
+
24
+ const miniAppWhitelistApis = config?.miniApp?.whitelist || {};
25
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
26
+
27
+ return {
28
+ resourceName,
29
+ pascalName,
30
+ kebabName,
31
+ hasMiniAppWhitelistedApi,
32
+ miniAppWhitelistApis,
33
+ }
34
+ }
35
+ %>
36
+
37
+ <% for (let i = 0; i < it.modules.length; i++) { %>
38
+ <%
39
+ const { pascalName, kebabName, hasMiniAppWhitelistedApi } = getMiniAppInfo(it.modules[i]);
40
+ %>
41
+ <% if(hasMiniAppWhitelistedApi) { %>
42
+ import { MiniApp<%= pascalName %>BridgeService } from "../services/resources/<%= kebabName %>-bridge.service";
43
+ <% } %>
44
+ <% } %>
45
+
46
+ export type MiniAppResourceMap = {
47
+ <% for (let i = 0; i < it.modules.length; i++) { %>
48
+ <%
49
+ const { resourceName, pascalName, hasMiniAppWhitelistedApi } = getMiniAppInfo(it.modules[i]);
50
+ %>
51
+ <% if(hasMiniAppWhitelistedApi) { %>
52
+ <%= resourceName %>: MiniApp<%= pascalName %>BridgeService;
53
+ <% } %>
54
+ <% } %>
55
+ };
@@ -4,69 +4,78 @@
4
4
  * last change 2024-04-14
5
5
  * Author: Ks Tan
6
6
  */
7
- import {SimpleAppClient} from '~/simpleapp/generate/clients/SimpleAppClient'
8
- import { SimpleAppDocumentType } from './documentlist';
9
- export type NameValue={
10
- name:string;
11
- value:number
12
- }
13
- export type ForeignKey = {
14
- _id: string;
15
- label: string;
16
- code?: string
17
- [key:string]: any
18
- };
19
- export type TextSearchBody = {
20
- keyword: string;
21
- fields?: string[];
22
- sorts?: string[][];
23
- lookup?: Record<string, string>;
24
- };
7
+ import { SimpleAppClient } from "~/simpleapp/generate/clients/SimpleAppClient";
8
+ import { SimpleAppDocumentType } from "./documentlist";
25
9
 
26
- export type DocumentMetaData = {
27
- docName:string
28
- docType:string
29
- page: string
30
- isolationType:string
31
- documentDate:string
32
- docNumber:boolean
33
- webhook:string[]|undefined
34
- docClass: SimpleAppClient<any,any>
35
- viewer?: Function
36
- }
37
- export type MenuData = {
38
- label: string
39
- icon?: string
40
- command?:Function
41
- items?: MenuData[]
42
- isolationType?:string
43
- url?:string
44
- }
45
- export type RecentlyValue = {
46
- docName:string
47
- label:string
48
- branchId:number
49
- time:string
50
- }
51
- export type DocNoFormat ={
52
- docNoFormatName: string
53
- docNoFormatNo:string
54
- docNoPattern:string
55
- active: boolean
56
- sample:string
57
- }
58
-
59
-
60
- export type RendererSetting ={
61
- documentName:SimpleAppDocumentType,
62
- [key:string]:any
63
- }
64
- export type SearchBody = {
65
-
66
- filter?:object;
67
-
68
- fields?: any[];
69
-
70
- sorts?: any[];
71
- lookup?: {[key:string]:string};
72
- }
10
+ export type NameValue = {
11
+ name: string;
12
+ value: number;
13
+ };
14
+
15
+ export type ForeignKey = {
16
+ _id: string;
17
+ label: string;
18
+ code?: string;
19
+ [key: string]: any;
20
+ };
21
+
22
+ export type TextSearchBody = {
23
+ keyword: string;
24
+ fields?: string[];
25
+ sorts?: string[][];
26
+ lookup?: Record<string, string>;
27
+ };
28
+
29
+ export type DocumentMetaData = {
30
+ docName: string;
31
+ docType: string;
32
+ page: string;
33
+ isolationType: string;
34
+ documentDate: string;
35
+ docNumber: boolean;
36
+ webhook: string[] | undefined;
37
+ docClass: SimpleAppClient<any, any>;
38
+ viewer?: Function;
39
+ };
40
+
41
+ export type MenuData = {
42
+ label: string;
43
+ icon?: string;
44
+ command?: Function;
45
+ items?: MenuData[];
46
+ isolationType?: string;
47
+ url?: string;
48
+ };
49
+
50
+ export type RecentlyValue = {
51
+ docName: string;
52
+ label: string;
53
+ branchId: number;
54
+ time: string;
55
+ };
56
+
57
+ export type DocNoFormat = {
58
+ docNoFormatName: string;
59
+ docNoFormatNo: string;
60
+ docNoPattern: string;
61
+ active: boolean;
62
+ sample: string;
63
+ };
64
+
65
+ export type RendererSetting = {
66
+ documentName: SimpleAppDocumentType;
67
+ [key: string]: any;
68
+ };
69
+
70
+ export type SearchBody = {
71
+ filter?: object;
72
+
73
+ fields?: any[];
74
+
75
+ sorts?: any[];
76
+ lookup?: { [key: string]: string };
77
+ };
78
+
79
+ export type DynamicObject = {
80
+ [key: string]: any;
81
+ };