@simitgroup/simpleapp-generator 1.6.7-e-alpha → 1.6.7-g-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 (76) hide show
  1. package/ReleaseNote.md +8 -0
  2. package/dist/buildinschemas/message.d.ts +3 -0
  3. package/dist/buildinschemas/message.d.ts.map +1 -0
  4. package/dist/buildinschemas/message.js +34 -0
  5. package/dist/buildinschemas/message.js.map +1 -0
  6. package/dist/buildinschemas/webhookhistory.d.ts +3 -0
  7. package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
  8. package/dist/buildinschemas/webhookhistory.js +44 -0
  9. package/dist/buildinschemas/webhookhistory.js.map +1 -0
  10. package/dist/createproject.js +138 -0
  11. package/dist/createproject.js.map +1 -0
  12. package/dist/framework.d.ts +1 -0
  13. package/dist/framework.d.ts.map +1 -1
  14. package/dist/framework.js +7 -1
  15. package/dist/framework.js.map +1 -1
  16. package/dist/generate-allow-changebackend.js +305 -0
  17. package/dist/generate-allow-changebackend.js.map +1 -0
  18. package/dist/generate.d.ts.map +1 -1
  19. package/dist/generate.js +85 -9
  20. package/dist/generate.js.map +1 -1
  21. package/dist/index.js +9 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/index2.js +118 -0
  24. package/dist/index2.js.map +1 -0
  25. package/dist/installdependency.js +20 -0
  26. package/dist/installdependency.js.map +1 -0
  27. package/dist/installnest.js +2 -0
  28. package/dist/installnest.js.map +1 -0
  29. package/dist/installnuxt.js +2 -0
  30. package/dist/installnuxt.js.map +1 -0
  31. package/dist/processors/groupsbuilder.js +2 -0
  32. package/dist/processors/groupsbuilder.js.map +1 -0
  33. package/dist/schematype/baseschema.js +25 -0
  34. package/dist/schematype/baseschema.js.map +1 -0
  35. package/dist/schematype/default.js +2 -0
  36. package/dist/schematype/default.js.map +1 -0
  37. package/dist/schematype/index.js +12 -0
  38. package/dist/schematype/index.js.map +1 -0
  39. package/dist/schematype/primarymasterdata.js +38 -0
  40. package/dist/schematype/primarymasterdata.js.map +1 -0
  41. package/dist/schematype/simple.js +24 -0
  42. package/dist/schematype/simple.js.map +1 -0
  43. package/dist/schematype/simplemasterdata.js +31 -0
  44. package/dist/schematype/simplemasterdata.js.map +1 -0
  45. package/dist/schematype/transaction.js +74 -0
  46. package/dist/schematype/transaction.js.map +1 -0
  47. package/dist/type.d.ts +6 -0
  48. package/dist/type.d.ts.map +1 -1
  49. package/dist/type.js.map +1 -1
  50. package/package.json +1 -1
  51. package/reset-install.sh +2 -2
  52. package/src/framework.ts +7 -0
  53. package/src/generate.ts +118 -2
  54. package/src/index.ts +10 -0
  55. package/src/type.ts +6 -0
  56. package/templates/basic/miniApi/resource.controller.ts.eta +139 -0
  57. package/templates/basic/miniApi/resource.module.ts.eta +16 -0
  58. package/templates/basic/miniApi/resource.service.ts.eta +109 -0
  59. package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +3 -6
  60. package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +0 -4
  61. package/templates/basic/nest/type.ts.eta +2 -2
  62. package/templates/basic/nuxt/resource-bridge.editable.service.ts.eta +0 -8
  63. package/templates/basic/nuxt/resource-bridge.service.ts.eta +5 -5
  64. package/templates/miniApi/src/constants/api-scopes.ts.eta +76 -0
  65. package/templates/miniApi/src/modules/resource/resource.module.ts.eta +46 -0
  66. package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +1 -9
  67. package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +0 -8
  68. package/templates/nest/src/app.module.ts._eta +2 -1
  69. package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +1 -0
  70. package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +1 -1
  71. package/templates/nest/src/simpleapp/generate/workflow/workflow.apischema.ts.eta +2 -2
  72. package/templates/nest/src/simpleapp/profile/{profile.apischema.ts.eta → profile.apischema.ts._eta} +7 -7
  73. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/constants/resource.constant.ts.eta +0 -8
  74. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +0 -8
  75. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/bridge.type.ts.eta +20 -0
  76. package/templates/nuxt/simpleapp/generate/features/miniApp/bridge/types/resource-mapper.type.ts.eta +0 -8
@@ -0,0 +1,46 @@
1
+ <%
2
+ const getMiniAppInfo = (module) => {
3
+ const schema = module.schema;
4
+ const simpleAppConfig = schema['x-simpleapp-config'];
5
+ const miniAppWhitelistApis = simpleAppConfig?.miniApp?.whitelist || {};
6
+ const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
7
+ const resourcePascalName = upperFirstCase(simpleAppConfig.resourceName);
8
+ const resourceKebabName = camelToKebab(simpleAppConfig.resourceName);
9
+
10
+ return {
11
+ hasMiniAppWhitelistedApi,
12
+ resourceName: simpleAppConfig.resourceName,
13
+ resourcePascalName,
14
+ resourceKebabName
15
+ }
16
+ }
17
+
18
+ const modules = it.modules.sort((a, b) => a.docname.localeCompare(b.docname, undefined, { sensitivity: 'base' }));
19
+ %>
20
+
21
+ import { Module } from '@nestjs/common';
22
+ <% modules.forEach(module => { %>
23
+ <%
24
+ const { hasMiniAppWhitelistedApi, resourcePascalName, resourceKebabName } = getMiniAppInfo(module);
25
+ %>
26
+ <% if(hasMiniAppWhitelistedApi) { %>
27
+ import { <%= resourcePascalName %>Module } from './resources/<%= resourceKebabName %>/<%= resourceKebabName %>.module';
28
+ <% } %>
29
+ <% }); %>
30
+
31
+ @Module({
32
+ imports: [
33
+ <% modules.forEach(module => { %>
34
+ <%
35
+ const { hasMiniAppWhitelistedApi, resourcePascalName } = getMiniAppInfo(module);
36
+ %>
37
+ <% if(hasMiniAppWhitelistedApi) { %>
38
+ <%= resourcePascalName %>Module,
39
+ <% } %>
40
+ <% }); %>
41
+ ],
42
+ controllers: [],
43
+ providers: [],
44
+ exports: []
45
+ })
46
+ export class ResourceModule {}
@@ -6,15 +6,7 @@
6
6
  */
7
7
 
8
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) => {
9
+ const getMiniAppInfo = (module) => {
18
10
  const config = module.schema['x-simpleapp-config'];
19
11
  const resourceName = config?.resourceName ?? config.documentName;
20
12
 
@@ -1,12 +1,4 @@
1
1
  <%
2
- const upperFirstCase = (value) => {
3
- return value.charAt(0).toUpperCase() + value.slice(1);
4
- }
5
-
6
- const camelToKebab = (value) => {
7
- return value.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase();
8
- }
9
-
10
2
  const camelToSnake = (value) => {
11
3
  return value.replace(/([a-z])([A-Z])/g, "$1_$2").toLowerCase();
12
4
  }
@@ -38,7 +38,7 @@ import { UserMongoSchema } from './simpleapp/generate/models/user.model';
38
38
  import { PermissionMongoSchema } from './simpleapp/generate/models/perm.model';
39
39
  import { ApiEventMongoSchema } from './simpleapp/generate/models/apievent.model';
40
40
  import { EventEmitterModule } from '@nestjs/event-emitter';
41
-
41
+ import { WebhookMongoSchema } from './simpleapp/generate/models/webhook.model';
42
42
 
43
43
 
44
44
 
@@ -90,6 +90,7 @@ import { EventEmitterModule } from '@nestjs/event-emitter';
90
90
  { name: 'User', schema: UserMongoSchema },
91
91
  { name: 'Permission', schema: PermissionMongoSchema },
92
92
  { name: 'ApiEvent', schema: ApiEventMongoSchema },
93
+ { name: 'Webhook', schema: WebhookMongoSchema },
93
94
  ]),
94
95
  ],
95
96
  controllers: [AppController],
@@ -42,6 +42,7 @@ export class RunWebhookService {
42
42
  $resourceName: documentName,
43
43
  $actionName: actionName,
44
44
  $url: process.env.APP_URL ?? 'http://localhost:8080',
45
+ $apiUrl: process.env.BACKEND_URL ?? "",
45
46
  };
46
47
 
47
48
  //same resource,actionName may have multiple webhook, run 1 by 1
@@ -927,4 +927,4 @@ type UserInfo = {
927
927
  type UserTenant = User & {
928
928
  tenantName: string;
929
929
  permissions: Permission[];
930
- };
930
+ };
@@ -23,9 +23,9 @@ export class WorkflowSettingApiSchema {
23
23
  callBackUrl: string;
24
24
  @ApiProperty({ type: 'string', required: false, description: 'optional' })
25
25
  assignee: string;
26
- @ApiProperty({ type: ['string'], required: false, description: 'optional' })
26
+ @ApiProperty({ type: ()=>['string'], required: false, description: 'optional' })
27
27
  candidateUsers: string;
28
- @ApiProperty({ type: ['string'], required: false, description: 'optional' })
28
+ @ApiProperty({ type: ()=>['string'], required: false, description: 'optional' })
29
29
  candidateGroups: string;
30
30
  }
31
31
  export class WorkflowDataApiSchema {
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * This file was automatically generated by simpleapp generator. Every
3
- * MODIFICATION OVERRIDE BY GENERATEOR
3
+ * --remove-this-line-to-prevent-override--
4
4
  * last change 2024-02-23
5
5
  * Author: Ks Tan
6
6
  */
@@ -10,21 +10,21 @@ export class RegTenantApiSchema {
10
10
  @ApiProperty({
11
11
  type: 'string',
12
12
  required: true,
13
- example: ['my company 1'],
13
+ examples: ['my company 1'],
14
14
  default: '',
15
15
  })
16
16
  tenantName: string;
17
17
  @ApiProperty({
18
18
  type: 'string',
19
19
  required: true,
20
- example: ['Asia/Kuala_Lumpur'],
20
+ examples: ['Asia/Kuala_Lumpur'],
21
21
  default: '',
22
22
  })
23
23
  timeZone: string;
24
24
  @ApiProperty({
25
25
  type: Number,
26
26
  required: true,
27
- example: [0,-460],
27
+ examples: [0,-460],
28
28
 
29
29
  })
30
30
  utcOffset: number;
@@ -82,13 +82,13 @@ export class MyProfileApiSchema {
82
82
  'fullName': string;
83
83
  @ApiProperty({type: 'number'})
84
84
  'group': string;
85
- @ApiProperty({type: ['string']})
85
+ @ApiProperty({type: ()=>['string']})
86
86
  'roles': string[];
87
87
 
88
88
 
89
- @ApiProperty({type: [MyProfileApiSchemaBranches]})
89
+ @ApiProperty({type: ()=>[MyProfileApiSchemaBranches]})
90
90
  'branches': ProfileUserBranch[]
91
- @ApiProperty({type: [MyProfileApiSchemaInvites]})
91
+ @ApiProperty({type:()=> [MyProfileApiSchemaInvites]})
92
92
  'invites': ProfileUserInvites[];
93
93
  @ApiProperty({type: 'string'})
94
94
  'time': string;
@@ -6,14 +6,6 @@
6
6
  */
7
7
 
8
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
9
  const getMiniAppInfo = (module) => {
18
10
  const config = module.schema['x-simpleapp-config'];
19
11
  const resourceName = config?.resourceName ?? config.documentName;
@@ -6,14 +6,6 @@
6
6
  */
7
7
 
8
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
9
  const getMiniAppInfo = (module) => {
18
10
  const config = module.schema['x-simpleapp-config'];
19
11
  const resourceName = config?.resourceName ?? config.documentName;
@@ -79,3 +79,23 @@ export type MiniAppBridgeMessageApiResponse<TData> = {
79
79
  export type MiniAppBridgeMessageInitResponse = {
80
80
  type: typeof MINI_APP_BRIDGE_MESSAGES.INIT_RESPONSE;
81
81
  };
82
+
83
+ export type MiniAppApiListParam = {
84
+ fields?: string[];
85
+
86
+ /**
87
+ * Same as Mongo DB filter
88
+ */
89
+ filters?: {
90
+ [key: string]: any;
91
+ };
92
+
93
+ /**
94
+ * Same as Mongo DB sort
95
+ */
96
+ sorts?:
97
+ | {
98
+ [key: string]: any;
99
+ }
100
+ | string[][];
101
+ };
@@ -6,14 +6,6 @@
6
6
  */
7
7
 
8
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
9
  const getMiniAppInfo = (module) => {
18
10
  const config = module.schema['x-simpleapp-config'];
19
11
  const resourceName = config?.resourceName ?? config.documentName;