@simitgroup/simpleapp-generator 1.6.6-y-alpha → 1.6.7-a-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 (84) hide show
  1. package/ReleaseNote.md +37 -9
  2. package/dist/framework.js +1 -1
  3. package/dist/framework.js.map +1 -1
  4. package/dist/generate.js +4 -4
  5. package/dist/generate.js.map +1 -1
  6. package/package.json +1 -1
  7. package/publish.sh +1 -0
  8. package/src/framework.ts +2 -2
  9. package/src/generate.ts +4 -4
  10. package/templates/basic/nuxt/resource-bridge.service.ts.eta +11 -2
  11. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +3 -3
  12. package/templates/nest/src/simpleapp/services/webhook.service.ts._eta +1 -1
  13. package/templates/nuxt/plugins/19.simpleapp-mini-app-store.ts.eta +379 -0
  14. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +3 -3
  15. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormField.vue.eta +100 -0
  16. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormFieldInput.vue.eta +121 -0
  17. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldFormSection.vue.eta +40 -0
  18. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldMenuItem.vue.eta +37 -0
  19. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldMenuItemBadge.vue.eta +25 -0
  20. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormField.vue.eta +96 -0
  21. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormFieldInput.vue.eta +150 -0
  22. package/templates/nuxt/simpleapp/generate/features/customField/components/CustomFieldViewFormSection.vue.eta +38 -0
  23. package/templates/nuxt/simpleapp/generate/features/customField/composables/useCustomFieldDocList.ts.eta +48 -0
  24. package/templates/nuxt/simpleapp/generate/features/customField/enums/common.ts.eta +4 -0
  25. package/templates/nuxt/simpleapp/generate/features/customField/services/CustomFieldService.ts.eta +231 -0
  26. package/templates/nuxt/simpleapp/generate/features/customField/types/common.ts.eta +16 -0
  27. package/templates/nuxt/simpleapp/generate/features/customField/types/page.ts.eta +5 -0
  28. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppMenuButton.vue.eta +104 -0
  29. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPageIcon.vue.eta +20 -0
  30. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPageIframe.vue.eta +79 -0
  31. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppPermissionWrapper.vue.eta +17 -0
  32. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppRestrictedWarning.vue.eta +25 -0
  33. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingLayout.vue.eta +29 -0
  34. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppSettingPage.vue.eta +69 -0
  35. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/MiniAppWrapper.vue.eta +39 -0
  36. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItem.vue.eta +48 -0
  37. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemBadge.vue.eta +31 -0
  38. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationItemGroup.vue.eta +34 -0
  39. package/templates/nuxt/simpleapp/generate/features/miniApp/app/components/integration/MiniAppIntegrationPage.vue.eta +156 -0
  40. package/templates/nuxt/simpleapp/generate/features/miniApp/app/types/miniApp.ts.eta +25 -0
  41. package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/services/bridge-resource-accessor.service.ts.eta +3 -1
  42. package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/services/bridge.service.ts.eta +7 -4
  43. package/dist/buildinschemas/message.d.ts +0 -3
  44. package/dist/buildinschemas/message.d.ts.map +0 -1
  45. package/dist/buildinschemas/message.js +0 -34
  46. package/dist/buildinschemas/message.js.map +0 -1
  47. package/dist/buildinschemas/webhookhistory.d.ts +0 -3
  48. package/dist/buildinschemas/webhookhistory.d.ts.map +0 -1
  49. package/dist/buildinschemas/webhookhistory.js +0 -44
  50. package/dist/buildinschemas/webhookhistory.js.map +0 -1
  51. package/dist/createproject.js +0 -138
  52. package/dist/createproject.js.map +0 -1
  53. package/dist/generate-allow-changebackend.js +0 -305
  54. package/dist/generate-allow-changebackend.js.map +0 -1
  55. package/dist/index2.js +0 -118
  56. package/dist/index2.js.map +0 -1
  57. package/dist/installdependency.js +0 -20
  58. package/dist/installdependency.js.map +0 -1
  59. package/dist/installnest.js +0 -2
  60. package/dist/installnest.js.map +0 -1
  61. package/dist/installnuxt.js +0 -2
  62. package/dist/installnuxt.js.map +0 -1
  63. package/dist/processors/groupsbuilder.js +0 -2
  64. package/dist/processors/groupsbuilder.js.map +0 -1
  65. package/dist/schematype/baseschema.js +0 -25
  66. package/dist/schematype/baseschema.js.map +0 -1
  67. package/dist/schematype/default.js +0 -2
  68. package/dist/schematype/default.js.map +0 -1
  69. package/dist/schematype/index.js +0 -12
  70. package/dist/schematype/index.js.map +0 -1
  71. package/dist/schematype/primarymasterdata.js +0 -38
  72. package/dist/schematype/primarymasterdata.js.map +0 -1
  73. package/dist/schematype/simple.js +0 -24
  74. package/dist/schematype/simple.js.map +0 -1
  75. package/dist/schematype/simplemasterdata.js +0 -31
  76. package/dist/schematype/simplemasterdata.js.map +0 -1
  77. package/dist/schematype/transaction.js +0 -74
  78. package/dist/schematype/transaction.js.map +0 -1
  79. package/templates/nest/src/simpleapp/types/customfield.ts.eta +0 -14
  80. package/templates/nuxt/plugins/19.app-plugins.ts.eta +0 -422
  81. /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/constants/common.constant.ts.eta +0 -0
  82. /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/constants/resource.constant.ts.eta +0 -0
  83. /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/types/bridge.type.ts.eta +0 -0
  84. /package/templates/nuxt/simpleapp/generate/{miniApp → features/miniApp}/bridge/types/resource-mapper.type.ts.eta +0 -0
@@ -1,422 +0,0 @@
1
- /**
2
- * This file was automatically generated by simpleapp generator. Every
3
- * MODIFICATION OVERRIDE BY GENERATEOR
4
- * last change 2025-06-09
5
- */
6
- import { defineNuxtPlugin } from "#app";
7
- import _ from "lodash";
8
- import { PlugininstallationsDoc } from "~/simpleapp/docs/PlugininstallationsDoc";
9
- import { PluginsDoc } from "~/simpleapp/docs/PluginsDoc";
10
- import {
11
- type Plugins,
12
- type PluginDetail,
13
- PLUGINMANAGERApi,
14
- PluginDetailActionAccess,
15
- } from "~/simpleapp/generate/openapi";
16
- import type {
17
- PluginBlockWithPluginId,
18
- PluginFormWithPluginId,
19
- PluginMenuItem,
20
- } from "~/types/app-plugins.type";
21
- import { PluginFrameworkCompatibility } from "~/types/app-plugins.type";
22
-
23
- export default defineNuxtPlugin(async () => {
24
- /**
25
- * App plugin directory
26
- */
27
- const PLUGIN_PAGE_PATH_PREFIX = "app-plugins";
28
-
29
- /**
30
- * To totally block plugin if plugin's framework compability lower than this.
31
- * To support backward compatibility, with deprecation notice,
32
- * if plugin's framework compability higher than this, but lower than MIN_FRAMEWORK_COMPATIBLE_VERSION.
33
- */
34
- const MIN_FRAMEWORK_VERSION = "1.0";
35
-
36
- /**
37
- * The minimum version that is compatible with the current framework.
38
- */
39
- const MIN_FRAMEWORK_COMPATIBLE_VERSION = "1.0";
40
-
41
- const config = getAxiosConfig();
42
-
43
- const pluginManager = new PLUGINMANAGERApi(config);
44
-
45
- const useAppPluginsStore = defineStore("app-plugins", {
46
- state: () => ({
47
- actionAccess: {} as PluginDetailActionAccess,
48
-
49
- /**
50
- * Store all installed plugins
51
- */
52
- installedPlugins: [] as PluginDetail[],
53
-
54
- /**
55
- * Is fetching installed plugins
56
- */
57
- isFetchingInstalledPlugins: true,
58
- }),
59
- getters: {
60
- getForm: (state) => (formCode: string) => {
61
- return state.installedPlugins.flatMap((plugin) => {
62
- return plugin.integration.forms
63
- .filter((form) => form.code == formCode)
64
- .map((form) => {
65
- return {
66
- ...form,
67
- pluginCode: plugin.code,
68
- } as PluginFormWithPluginId;
69
- });
70
- });
71
- },
72
-
73
- getBlock:
74
- (state) =>
75
- (pluginCode: string, blockCode: string): PluginBlockWithPluginId => {
76
- const plugin = state.installedPlugins.find(
77
- (plugin) => plugin.code === pluginCode,
78
- );
79
- if (!plugin) {
80
- throw new Error(
81
- `[app-plugins] Plugin with ${pluginCode} not found`,
82
- );
83
- }
84
- const block = plugin.integration.blocks.find(
85
- (block) => block.code === blockCode,
86
- );
87
- if (!block) {
88
- throw new Error(`[app-plugins] Block with ${blockCode} not found`);
89
- }
90
-
91
- return {
92
- ...block,
93
- pluginCode: plugin.code,
94
- };
95
- },
96
-
97
- getDocumentBlocks:
98
- (state) =>
99
- (document: string): PluginBlockWithPluginId[] => {
100
- return state.installedPlugins.flatMap((plugin) => {
101
- return plugin.integration.blocks
102
- .filter((block) => block.targetDocuments.includes(document))
103
- .map((block) => {
104
- return {
105
- ...block,
106
- pluginCode: plugin.code,
107
- };
108
- });
109
- });
110
- },
111
-
112
- isHavePluginFeature: (state) => {
113
- if (state.isFetchingInstalledPlugins) {
114
- // if still fetching, return true 1st, else will immediate show restricted warning
115
- return true;
116
- }
117
-
118
- return state.actionAccess.isHavePluginFeature ?? false;
119
- },
120
-
121
- isShowPluginMoreMenuButton: (state) => {
122
- const filtered = state.installedPlugins.filter(
123
- (item) =>
124
- item.integration?.pages?.length > 0 ||
125
- (item.integration?.settings?.jsonSchema &&
126
- Object.keys(item.integration.settings.jsonSchema).length > 0),
127
- );
128
-
129
- return _.isEmpty(filtered) ? false : true;
130
- },
131
-
132
- isCanInstall: (state) => state.actionAccess.isAllowInstall,
133
- isCanUninstall: (state) => state.actionAccess.isAllowUninstall,
134
- isCanUpdateSetting: (state) => state.actionAccess.isAllowUpdateSetting,
135
- isHasPluginFeature: (state) => state.actionAccess.isHavePluginFeature,
136
- },
137
-
138
- actions: {
139
- getMenuItems() {
140
- return this.installedPlugins.flatMap((plugin) => {
141
- const pages = plugin.integration.pages.filter((page) => {
142
- return this.checkIsAllowAccessPluginPage(plugin.code, page.code);
143
- });
144
-
145
- if (this.isCanUpdateSetting) {
146
- if (
147
- plugin.integration.settings?.jsonSchema &&
148
- !_.isEmpty(plugin.integration.settings.jsonSchema)
149
- ) {
150
- pages.push({
151
- code: "setting",
152
- title: t("appPlugin.setting"),
153
- description: "",
154
- sourceType: "",
155
- source: "",
156
- requiredPermissions: [],
157
- iconType: "class",
158
- icon: "pi pi-cog",
159
- });
160
- }
161
- }
162
-
163
- // Only return plugin if pages not empty
164
- if (_.isEmpty(pages)) {
165
- return [];
166
- }
167
-
168
- return {
169
- _id: plugin._id,
170
- code: plugin.code,
171
- name: plugin.name,
172
- logo: plugin.logo,
173
- pages,
174
- };
175
- });
176
- },
177
-
178
- // ============================ Load Function ============================
179
- /**
180
- * Load all installed plugins and store in store
181
- */
182
- async loadInstalledPlugins() {
183
- this.isFetchingInstalledPlugins = true;
184
-
185
- const resp = await pluginManager
186
- .runGetInstalledPlugins()
187
- .then((res) => {
188
- return res.data;
189
- })
190
- .catch((res: any) => {
191
- return Promise.reject(res);
192
- });
193
-
194
- this.installedPlugins = resp.installedlugins;
195
- this.actionAccess = resp.actionAccess;
196
-
197
- this.isFetchingInstalledPlugins = false;
198
- },
199
-
200
- /**
201
- * Load plugin detail
202
- * Use in integrations/[pageCode]
203
- * @param pluginCode
204
- * @returns
205
- */
206
- async loadPluginDetail(pluginCode: string) {
207
- return await pluginManager
208
- .runGetPluginDetail(pluginCode)
209
- .then((res) => {
210
- return res.data;
211
- })
212
- .catch((res: any) => {
213
- return Promise.reject(res);
214
- });
215
- },
216
-
217
- /**
218
- * Load Categorized Plugins
219
- * Use in integrations
220
- * @returns
221
- */
222
- async loadCategorizedPlugins() {
223
- return await pluginManager
224
- .runGetCategorizedPlugins()
225
- .then((res) => {
226
- return res.data;
227
- })
228
- .catch((res: any) => {
229
- return Promise.reject(res);
230
- });
231
- },
232
-
233
- // ================================ Permission ===============================
234
-
235
- getActionAccess(
236
- type: "install" | "uninstall" | "updateSetting" | "plan",
237
- ) {
238
- switch (type) {
239
- case "install":
240
- return {
241
- isAllow: this.isCanInstall,
242
- reason: "insufficientInstallPermission",
243
- };
244
-
245
- case "uninstall":
246
- return {
247
- isAllow: this.isCanUninstall,
248
- reason: "insufficientUninstallPermission",
249
- };
250
-
251
- case "updateSetting":
252
- return {
253
- isAllow: this.isCanUpdateSetting,
254
- reason: "insufficientChangeSettingPermission",
255
- };
256
-
257
- case "plan":
258
- return {
259
- isAllow: this.isHasPluginFeature,
260
- reason: "packageTypeRestricted",
261
- };
262
- }
263
- },
264
-
265
- // ============================ Path & Navigation ============================
266
-
267
- getPluginSettingPath(pluginCode: string) {
268
- return `${PLUGIN_PAGE_PATH_PREFIX}/${pluginCode}/setting`;
269
- },
270
-
271
- getPluginPageUrlPath(pluginCode: string, pageCode: string): string {
272
- const page = pageCode === "index" ? "" : "/" + pageCode;
273
- return `${PLUGIN_PAGE_PATH_PREFIX}/${pluginCode}/app${page}`;
274
- },
275
-
276
- getPluginPageUrl(
277
- pluginCode: string,
278
- pageCode: string,
279
- querystr?: string,
280
- ): string {
281
- const path = this.getPluginPageUrlPath(pluginCode, pageCode);
282
- return getDocumentUrl(path, "", querystr);
283
- },
284
-
285
- getPluginSettingPageUrl(pluginCode: string, querystr?: string): string {
286
- const path = this.getPluginSettingPath(pluginCode);
287
- return getDocumentUrl(path, "", querystr);
288
- },
289
-
290
- navigateToPluginInstall(pluginCode: string) {
291
- goTo(`integrations/${pluginCode}`);
292
- },
293
-
294
- navigateToPluginPage(pluginCode: string, pageCode: string) {
295
- if (pageCode === "setting") {
296
- goTo(this.getPluginSettingPath(pluginCode));
297
- } else {
298
- goTo(this.getPluginPageUrlPath(pluginCode, pageCode));
299
- }
300
- },
301
-
302
- // ============================ Validation ============================
303
-
304
- checkIsPluginInstalled(pluginCode: string) {
305
- const plugin = this.installedPlugins.find(
306
- (item) => item.code === pluginCode,
307
- );
308
-
309
- return plugin ? true : false;
310
- },
311
-
312
- checkIsAllowAccessPluginPage(pluginCode: string, pageCode: string) {
313
- const plugin = this.installedPlugins.find(
314
- (item) => item.code === pluginCode,
315
- );
316
- if (!plugin) {
317
- return false;
318
- }
319
-
320
- const page = plugin.integration.pages.find(
321
- (item) => item.code === pageCode,
322
- );
323
- if (!page) {
324
- return false;
325
- }
326
-
327
- if (checkHasHighPrivilege()) {
328
- return true;
329
- }
330
-
331
- const userRoles = getUserProfile().roles;
332
-
333
- if (page.requiredPermissions && !_.isEmpty(page.requiredPermissions)) {
334
- return page.requiredPermissions.some((permission) =>
335
- userRoles.includes(permission),
336
- );
337
- }
338
- return true;
339
- },
340
-
341
- getPageInfo(plugin: Plugins, pageCode: string) {
342
- return plugin.integration.pages.find((item) => item.code === pageCode);
343
- },
344
-
345
- checkPluginFrameworkCompatibility: (
346
- plugin: Plugins,
347
- ): PluginFrameworkCompatibility => {
348
- if (plugin.frameworkCompatibility < MIN_FRAMEWORK_VERSION) {
349
- return PluginFrameworkCompatibility.DEPRECATED;
350
- }
351
-
352
- if (plugin.frameworkCompatibility < MIN_FRAMEWORK_COMPATIBLE_VERSION) {
353
- return PluginFrameworkCompatibility.TO_BE_DEPRECATED;
354
- }
355
-
356
- return PluginFrameworkCompatibility.COMPATIBLE;
357
- },
358
-
359
- // ============================ Plugin Action ============================
360
-
361
- async installPlugin(pluginCode: string) {
362
- const pluginInstallation = await pluginManager
363
- .runInstallPlugin(pluginCode)
364
- .then((res) => {
365
- return res.data;
366
- })
367
- .catch((res: any) => {
368
- return Promise.reject(res);
369
- });
370
-
371
- this.loadInstalledPlugins();
372
-
373
- return pluginInstallation;
374
- },
375
-
376
- async uninstallPlugin(pluginCode: string) {
377
- const pluginInstallation = await pluginManager
378
- .runUninstallPlugin(pluginCode)
379
- .then((res) => {
380
- return res.data;
381
- })
382
- .catch((res: any) => {
383
- return Promise.reject(res);
384
- });
385
-
386
- this.loadInstalledPlugins();
387
-
388
- return pluginInstallation;
389
- },
390
-
391
- async updatePluginSetting(
392
- pluginCode: string,
393
- data: { [key: string]: any },
394
- ) {
395
- const pluginInstallation = await pluginManager
396
- .runUpdatePluginSetting(pluginCode, data)
397
- .then((res) => {
398
- return res.data;
399
- })
400
- .catch((res: any) => {
401
- return Promise.reject(res);
402
- });
403
-
404
- this.loadInstalledPlugins();
405
-
406
- return pluginInstallation;
407
- },
408
-
409
- openPluginSetting(pluginCode: string | undefined) {
410
- if (pluginCode && pluginCode != "") {
411
- goTo(`app-plugins/${pluginCode}/setting`);
412
- }
413
- },
414
- },
415
- });
416
-
417
- return {
418
- provide: {
419
- appPluginsStore: useAppPluginsStore(),
420
- },
421
- };
422
- });