@simitgroup/simpleapp-generator 1.6.6-p-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 (90) 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 +14 -24
  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.map +1 -1
  41. package/dist/framework.js +2 -4
  42. package/dist/framework.js.map +1 -1
  43. package/dist/generate.js +17 -2
  44. package/dist/generate.js.map +1 -1
  45. package/dist/processors/jsonschemabuilder.js +14 -12
  46. package/dist/processors/jsonschemabuilder.js.map +1 -1
  47. package/dist/type.d.ts +39 -5
  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/src/buildinschemas/autoincreament.ts +35 -33
  52. package/src/buildinschemas/branch.ts +47 -47
  53. package/src/buildinschemas/changehistories.ts +31 -30
  54. package/src/buildinschemas/customfield.ts +14 -24
  55. package/src/buildinschemas/docnoformat.ts +54 -43
  56. package/src/buildinschemas/documentevent.ts +42 -33
  57. package/src/buildinschemas/keyvaluepair.ts +25 -25
  58. package/src/buildinschemas/organization.ts +54 -50
  59. package/src/buildinschemas/permission.ts +34 -25
  60. package/src/buildinschemas/systemmessage.ts +39 -38
  61. package/src/buildinschemas/tenant.ts +46 -45
  62. package/src/buildinschemas/user.ts +64 -60
  63. package/src/buildinschemas/webhook.ts +62 -61
  64. package/src/framework.ts +2 -4
  65. package/src/generate.ts +17 -1
  66. package/src/processors/jsonschemabuilder.ts +6 -4
  67. package/src/type.ts +271 -215
  68. package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +9 -7
  69. package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +22 -7
  70. package/templates/basic/nuxt/jsonschema.ts.eta +7 -0
  71. package/templates/basic/nuxt/resource-bridge.editable.service.ts.eta +40 -0
  72. package/templates/basic/nuxt/resource-bridge.service.ts.eta +24 -21
  73. package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +27 -9
  74. package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +2 -2
  75. package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +5 -2
  76. package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +4 -3
  77. package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +0 -1
  78. package/templates/nuxt/plugins/18.simpleapp-custom-field-store.ts.eta +9 -3
  79. package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +316 -341
  80. package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +32 -22
  81. package/templates/nuxt/simpleapp/generate/jsonSchemas/index.ts.eta +11 -0
  82. package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/common.constant.ts.eta +1 -0
  83. package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/resource.constant.ts.eta +2 -2
  84. package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +4 -4
  85. package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge.service.ts.eta +20 -1
  86. package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/bridge.type.ts.eta +9 -0
  87. package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/resource-mapper.type.ts.eta +2 -2
  88. package/templates/project/build.sh.eta +0 -5
  89. package/templates/nest/src/simpleapp/apischemas/customfield.ts.eta +0 -21
  90. package/templates/nuxt/simpleapp/generate/clients/SimpleAppCustomFieldClient.ts.eta +0 -188
@@ -1,47 +1,48 @@
1
- import {SchemaType,RESTMethods,IsolationType} from '../type'
1
+ import { SchemaType, RESTMethods, IsolationType } from '../type';
2
2
 
3
- export const tenant:SchemaType ={
4
- type: "object",
5
- "x-simpleapp-config":{
6
- isolationType:IsolationType.none,
7
- requiredRoles:["SuperAdmin"],
8
- pageType:'crud',
9
- uniqueKey:'tenantId',
10
- documentTitle:'tenantName',
11
- documentName:'tenant',
12
- documentType:'tenant',
13
- },
14
- required:["tenantId","tenantName","owner"],
15
- properties: {
16
- _id:{type:'string'},
17
- created:{type:'string'},
18
- updated:{type:'string'},
19
- createdBy:{type:'string'},
20
- updatedBy:{type:'string'},
21
- tenantId: {type:'integer',default:1,minimum:0 },
22
- orgId: {type:'integer',default:1,minimum:0 },
23
- branchId: {type:'integer',default:1,minimum:0 },
24
- tenantName: {type: "string", minLength:3},
25
- active: {"type": "boolean","examples": [true],default:true},
26
- businessType:{type:"string"},
27
- clientSetting: {
28
- type:"object",
29
- properties:{
30
- auditTrail:{type:"boolean",default:false},
31
- webhook:{type:"boolean",default:false},
32
- support:{type:"boolean",default:false}
33
- }
34
- },
35
- description: {"type": "string"},
36
- owner: {
37
- type: "object",
38
- "x-foreignkey":"user",
39
- required :["_id","label","uid"],
40
- properties:{
41
- _id: {type:'string'},
42
- label: {type:'string'},
43
- uid: {type:'string'},
44
- }
45
- }
3
+ export const tenant: SchemaType = {
4
+ type: 'object',
5
+ 'x-simpleapp-config': {
6
+ isolationType: IsolationType.none,
7
+ requiredRoles: ['SuperAdmin'],
8
+ pageType: 'crud',
9
+ uniqueKey: 'tenantId',
10
+ documentTitle: 'tenantName',
11
+ documentName: 'tenant',
12
+ documentType: 'tenant',
13
+ resourceName: 'tenant'
14
+ },
15
+ required: ['tenantId', 'tenantName', 'owner'],
16
+ properties: {
17
+ _id: { type: 'string' },
18
+ created: { type: 'string' },
19
+ updated: { type: 'string' },
20
+ createdBy: { type: 'string' },
21
+ updatedBy: { type: 'string' },
22
+ tenantId: { type: 'integer', default: 1, minimum: 0 },
23
+ orgId: { type: 'integer', default: 1, minimum: 0 },
24
+ branchId: { type: 'integer', default: 1, minimum: 0 },
25
+ tenantName: { type: 'string', minLength: 3 },
26
+ active: { type: 'boolean', examples: [true], default: true },
27
+ businessType: { type: 'string' },
28
+ clientSetting: {
29
+ type: 'object',
30
+ properties: {
31
+ auditTrail: { type: 'boolean', default: false },
32
+ webhook: { type: 'boolean', default: false },
33
+ support: { type: 'boolean', default: false }
34
+ }
35
+ },
36
+ description: { type: 'string' },
37
+ owner: {
38
+ type: 'object',
39
+ 'x-foreignkey': 'user',
40
+ required: ['_id', 'label', 'uid'],
41
+ properties: {
42
+ _id: { type: 'string' },
43
+ label: { type: 'string' },
44
+ uid: { type: 'string' }
45
+ }
46
46
  }
47
- }
47
+ }
48
+ };
@@ -1,63 +1,67 @@
1
- import {SchemaType,RESTMethods,IsolationType} from '../type'
1
+ import { SchemaType, RESTMethods, IsolationType } from '../type';
2
2
 
3
- export const user:SchemaType ={
4
- type: "object",
5
- "x-simpleapp-config":{
6
- documentType:'user',
7
- documentName:'user',
8
- pageType:'crud',
9
- loseDataIsolation:true,
10
- isolationType:IsolationType.tenant,
11
- uniqueKey:'email',
12
- documentTitle:'fullname',
13
- requiredRoles:["SuperUser"],
14
- additionalAutoCompleteFields:['uid'],
15
- additionalApis:[
16
- {"action":"getPermission",
17
- "entryPoint":":id/permission",
18
- "requiredRole":[],
19
- "method":RESTMethods.get,
20
- "responseType":"[UserPermission]",
21
- "description":"Get user permissoin"
22
- },
23
- {"action":"updatePermission",
24
- "entryPoint":":id/permission",
25
- "requiredRole":[],
26
- "method":RESTMethods.put,
27
- "schema":"[UserPermission]",
28
- "description":"set user permissoin"
29
- }
30
- ]
3
+ export const user: SchemaType = {
4
+ type: 'object',
5
+ 'x-simpleapp-config': {
6
+ documentType: 'user',
7
+ documentName: 'user',
8
+ pageType: 'crud',
9
+ loseDataIsolation: true,
10
+ isolationType: IsolationType.tenant,
11
+ uniqueKey: 'email',
12
+ documentTitle: 'fullname',
13
+ requiredRoles: ['SuperUser'],
14
+ additionalAutoCompleteFields: ['uid'],
15
+ additionalApis: [
16
+ {
17
+ action: 'getPermission',
18
+ entryPoint: ':id/permission',
19
+ requiredRole: [],
20
+ method: RESTMethods.get,
21
+ responseType: '[UserPermission]',
22
+ description: 'Get user permissoin'
31
23
  },
32
- properties: {
33
- _id:{type:'string'},
34
- created:{type:'string'},
35
- updated:{type:'string'},
36
- createdBy:{type:'string'},
37
- updatedBy:{type:'string'},
38
- tenantId: {type:'integer',default:1,minimum:0 },
39
- orgId: {type:'integer',default:1,minimum:0 },
40
- branchId: {type:'integer',default:1,minimum:0 },
41
- uid: {
42
- type: "string",
43
- oneOf:[{"format":"uuid"},{const:""}],
44
- description:"sso unique id, such as keycloak sub id, empty during invitation",
45
- },
46
- fullName: {type: "string",minLength:3},
47
- email: {type: "string",minLength:10,format: "email"},
48
- mobileNo: {
49
- type: "string",
50
- anyOf:[
51
- {"const":""},
52
- {"format": "tel","examples": ["0123456789"]}
53
- ]
54
- },
55
- active: {type: "boolean",default:true},
56
- description: {type:"string"},
57
- lastActivity: {type: "string",description:"capture ISO8601 last api call"},
58
- completedTours: {
59
- type: "array",
60
- items: { "type": "string", "examples": ["mainpage"] }
61
- }
24
+ {
25
+ action: 'updatePermission',
26
+ entryPoint: ':id/permission',
27
+ requiredRole: [],
28
+ method: RESTMethods.put,
29
+ schema: '[UserPermission]',
30
+ description: 'set user permissoin'
62
31
  }
63
- }
32
+ ],
33
+ resourceName: 'user'
34
+ },
35
+ properties: {
36
+ _id: { type: 'string' },
37
+ created: { type: 'string' },
38
+ updated: { type: 'string' },
39
+ createdBy: { type: 'string' },
40
+ updatedBy: { type: 'string' },
41
+ tenantId: { type: 'integer', default: 1, minimum: 0 },
42
+ orgId: { type: 'integer', default: 1, minimum: 0 },
43
+ branchId: { type: 'integer', default: 1, minimum: 0 },
44
+ uid: {
45
+ type: 'string',
46
+ oneOf: [{ format: 'uuid' }, { const: '' }],
47
+ description:
48
+ 'sso unique id, such as keycloak sub id, empty during invitation'
49
+ },
50
+ fullName: { type: 'string', minLength: 3 },
51
+ email: { type: 'string', minLength: 10, format: 'email' },
52
+ mobileNo: {
53
+ type: 'string',
54
+ anyOf: [{ const: '' }, { format: 'tel', examples: ['0123456789'] }]
55
+ },
56
+ active: { type: 'boolean', default: true },
57
+ description: { type: 'string' },
58
+ lastActivity: {
59
+ type: 'string',
60
+ description: 'capture ISO8601 last api call'
61
+ },
62
+ completedTours: {
63
+ type: 'array',
64
+ items: { type: 'string', examples: ['mainpage'] }
65
+ }
66
+ }
67
+ };
@@ -1,65 +1,66 @@
1
- import {SchemaType,RESTMethods,IsolationType} from '../type'
1
+ import { SchemaType, RESTMethods, IsolationType } from '../type';
2
2
 
3
- export const webhook:SchemaType = {
4
- type: "object",
5
- "x-simpleapp-config":{
6
- documentType:'webhook',
7
- documentName:'webhook',
8
- isolationType:IsolationType.tenant,
9
- uniqueKey:'title',
10
- documentTitle:'title'
11
- },
12
- required:["title","url"],
13
- properties: {
14
- _id:{type:'string'},
15
- created:{type:'string'},
16
- updated:{type:'string'},
17
- createdBy:{type:'string'},
18
- updatedBy:{type:'string'},
19
- tenantId: {type:'integer',default:1,minimum:0 },
20
- orgId: {type:'integer',default:1,minimum:0 },
21
- branchId: {type:'integer',default:1,minimum:0 },
22
- title:{type:"string",minLength:3,},
23
- url: {type: "string", format:'uri'},
24
- serverSubscriptionId :{type:"string"},
25
- serverSubscriptionSecret :{type:"string"},
26
- requestMethod:{
27
- type: "string",
28
- enum:['post','get','patch','put','delete','head'],
29
- },
30
- authentication:{
31
- type:"string",
32
- enum:['none','basic'],
33
- description:"apikey authentication use none + headers props"
34
- },
35
- basicAuth:{
36
- type:"object",
37
- properties:{
38
- user:{type:"string"},
39
- password:{type:"string"}
3
+ export const webhook: SchemaType = {
4
+ type: 'object',
5
+ 'x-simpleapp-config': {
6
+ documentType: 'webhook',
7
+ documentName: 'webhook',
8
+ isolationType: IsolationType.tenant,
9
+ uniqueKey: 'title',
10
+ documentTitle: 'title',
11
+ resourceName: 'webhook'
12
+ },
13
+ required: ['title', 'url'],
14
+ properties: {
15
+ _id: { type: 'string' },
16
+ created: { type: 'string' },
17
+ updated: { type: 'string' },
18
+ createdBy: { type: 'string' },
19
+ updatedBy: { type: 'string' },
20
+ tenantId: { type: 'integer', default: 1, minimum: 0 },
21
+ orgId: { type: 'integer', default: 1, minimum: 0 },
22
+ branchId: { type: 'integer', default: 1, minimum: 0 },
23
+ title: { type: 'string', minLength: 3 },
24
+ url: { type: 'string', format: 'uri' },
25
+ serverSubscriptionId: { type: 'string' },
26
+ serverSubscriptionSecret: { type: 'string' },
27
+ requestMethod: {
28
+ type: 'string',
29
+ enum: ['post', 'get', 'patch', 'put', 'delete', 'head']
30
+ },
31
+ authentication: {
32
+ type: 'string',
33
+ enum: ['none', 'basic'],
34
+ description: 'apikey authentication use none + headers props'
35
+ },
36
+ basicAuth: {
37
+ type: 'object',
38
+ properties: {
39
+ user: { type: 'string' },
40
+ password: { type: 'string' }
41
+ }
42
+ },
43
+ headers: {
44
+ type: 'array',
45
+ items: {
46
+ type: 'object',
47
+ description: 'http headers',
48
+ properties: {
49
+ name: { type: 'string' },
50
+ value: { type: 'string' }
40
51
  }
41
- },
42
- headers: {
43
- type: "array",
44
- items:{
45
- type:"object",
46
- description:"http headers",
47
- properties:{
48
- name:{type:'string'},
49
- value:{type:'string'}
50
- }
51
- }
52
- },
52
+ }
53
+ },
53
54
 
54
- description: {type: "string",format:"text"},
55
- body:{type:"string",format:"text",minLength:3},
56
- active: {type: "boolean", default:true},
57
- eventTypes:{
58
- type:"array",
59
- minItems:1,
60
- items:{
61
- type:"string"
62
- }}
55
+ description: { type: 'string', format: 'text' },
56
+ body: { type: 'string', format: 'text', minLength: 3 },
57
+ active: { type: 'boolean', default: true },
58
+ eventTypes: {
59
+ type: 'array',
60
+ minItems: 1,
61
+ items: {
62
+ type: 'string'
63
+ }
63
64
  }
64
- }
65
-
65
+ }
66
+ };
package/src/framework.ts CHANGED
@@ -288,9 +288,7 @@ export const prettyMiniAppJsSdk = () => {
288
288
  );
289
289
  };
290
290
  export const prettyMiniAppStreamlitSdk = () => {
291
- // exec(
292
- // `npx prettier --write ${config.miniAppSdkFolder.streamlit}/simtrain_eco_mini_app_streamlit_sdk/**/* --ignore-path .my-empty-ignore`
293
- // );
291
+ exec(`sh ${config.miniAppSdkFolder.streamlit}/format.sh`);
294
292
  };
295
293
 
296
294
  export const prettyNuxt = () => {
@@ -300,7 +298,7 @@ export const prettyNuxt = () => {
300
298
  `cd ${config.frontendFolder};npx prettier --write "./pages/**/*.vue" "./components/**/*.vue" "./generate/*/*.ts" `
301
299
  );
302
300
  exec(
303
- `npx prettier --write ${config.frontendFolder}/simpleapp/generate/clients/*.ts ${config.frontendFolder}/simpleapp/generate/miniApp/**/*.ts`
301
+ `npx prettier --write ${config.frontendFolder}/simpleapp/generate/clients/*.ts ${config.frontendFolder}/simpleapp/generate/jsonSchemas/*.ts ${config.frontendFolder}/simpleapp/generate/miniApp/**/*.ts`
304
302
  );
305
303
  };
306
304
 
package/src/generate.ts CHANGED
@@ -230,7 +230,11 @@ const generateSchema = (
230
230
  apiSettings: currentmodel.apiSettings ?? [],
231
231
  isolationtype: currentmodel.isolationtype,
232
232
  hasdocformat: currentmodel.hasdocformat,
233
- foreignkeys: currentmodel.foreignkeys ?? {}
233
+ foreignkeys: currentmodel.foreignkeys ?? {},
234
+ customField: {
235
+ isEnable:
236
+ jsonschemas[docname][X_SIMPLEAPP_CONFIG]?.customField?.isEnable ?? false
237
+ }
234
238
  };
235
239
 
236
240
  const templatefolder = `${constants.templatedir}/${rendertype}`;
@@ -427,6 +431,18 @@ const generateSchema = (
427
431
  validate: (targetfile: string, isexists: boolean) => {
428
432
  return true;
429
433
  }
434
+ },
435
+ 'resource-bridge.editable.service.ts.eta': {
436
+ to: 'simpleapp/generate/miniApp/bridge/services/editable/resources',
437
+ as: `${_.kebabCase(resourceName)}-bridge.editable.service.ts`,
438
+ validate: (targetfile: string, isexists: boolean) => !isexists
439
+ },
440
+ 'jsonschema.ts.eta': {
441
+ to: 'simpleapp/generate/jsonSchemas',
442
+ as: `${doctype}.jsonschema.ts`,
443
+ validate: (targetfile: string, isexists: boolean) => {
444
+ return true;
445
+ }
430
446
  }
431
447
  };
432
448
 
@@ -177,10 +177,12 @@ const genSchema = async (
177
177
 
178
178
  if (schematype === 'object' && !_.isEmpty(jsondata) && _.isEmpty(parentObj)) {
179
179
  if (!parentObj[FOREIGNKEY_PROPERTY]) {
180
- jsondata['more'] = {
181
- type: 'object',
182
- properties: {}
183
- };
180
+ if (schemaconfigs?.customField?.isEnable) {
181
+ jsondata['more'] = {
182
+ type: 'object',
183
+ properties: {}
184
+ };
185
+ }
184
186
  }
185
187
  }
186
188