@simitgroup/simpleapp-generator 1.6.6-p-alpha → 1.6.6-r-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.
- package/ReleaseNote.md +3 -0
- package/dist/buildinschemas/autoincreament.d.ts.map +1 -1
- package/dist/buildinschemas/autoincreament.js +17 -14
- package/dist/buildinschemas/autoincreament.js.map +1 -1
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +25 -24
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/changehistories.d.ts.map +1 -1
- package/dist/buildinschemas/changehistories.js +10 -9
- package/dist/buildinschemas/changehistories.js.map +1 -1
- package/dist/buildinschemas/customfield.d.ts.map +1 -1
- package/dist/buildinschemas/customfield.js +14 -24
- package/dist/buildinschemas/customfield.js.map +1 -1
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -1
- package/dist/buildinschemas/docnoformat.js +34 -23
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/documentevent.d.ts.map +1 -1
- package/dist/buildinschemas/documentevent.js +36 -26
- package/dist/buildinschemas/documentevent.js.map +1 -1
- package/dist/buildinschemas/index.d.ts +1 -0
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +3 -1
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/keyvaluepair.d.ts.map +1 -1
- package/dist/buildinschemas/keyvaluepair.js +7 -6
- package/dist/buildinschemas/keyvaluepair.js.map +1 -1
- package/dist/buildinschemas/message.d.ts +3 -0
- package/dist/buildinschemas/message.d.ts.map +1 -0
- package/dist/buildinschemas/message.js +34 -0
- package/dist/buildinschemas/message.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +34 -30
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/permission.d.ts.map +1 -1
- package/dist/buildinschemas/permission.js +16 -7
- package/dist/buildinschemas/permission.js.map +1 -1
- package/dist/buildinschemas/systemmessage.d.ts.map +1 -1
- package/dist/buildinschemas/systemmessage.js +35 -32
- package/dist/buildinschemas/systemmessage.js.map +1 -1
- package/dist/buildinschemas/tenant.d.ts.map +1 -1
- package/dist/buildinschemas/tenant.js +17 -16
- package/dist/buildinschemas/tenant.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +34 -31
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/buildinschemas/webhook.d.ts.map +1 -1
- package/dist/buildinschemas/webhook.js +123 -51
- package/dist/buildinschemas/webhook.js.map +1 -1
- package/dist/buildinschemas/webhookhistory.d.ts +3 -0
- package/dist/buildinschemas/webhookhistory.d.ts.map +1 -0
- package/dist/buildinschemas/webhookhistory.js +44 -0
- package/dist/buildinschemas/webhookhistory.js.map +1 -0
- package/dist/buildinschemas/webhooklog.d.ts +3 -0
- package/dist/buildinschemas/webhooklog.d.ts.map +1 -0
- package/dist/buildinschemas/webhooklog.js +77 -0
- package/dist/buildinschemas/webhooklog.js.map +1 -0
- package/dist/createproject.js +138 -0
- package/dist/createproject.js.map +1 -0
- package/dist/framework.d.ts.map +1 -1
- package/dist/framework.js +5 -7
- package/dist/framework.js.map +1 -1
- package/dist/generate-allow-changebackend.js +305 -0
- package/dist/generate-allow-changebackend.js.map +1 -0
- package/dist/generate.js +19 -4
- package/dist/generate.js.map +1 -1
- package/dist/index2.js +118 -0
- package/dist/index2.js.map +1 -0
- package/dist/installdependency.js +20 -0
- package/dist/installdependency.js.map +1 -0
- package/dist/installnest.js +2 -0
- package/dist/installnest.js.map +1 -0
- package/dist/installnuxt.js +2 -0
- package/dist/installnuxt.js.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/processors/jsonschemabuilder.js +14 -12
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/schematype/baseschema.js +25 -0
- package/dist/schematype/baseschema.js.map +1 -0
- package/dist/schematype/default.js +2 -0
- package/dist/schematype/default.js.map +1 -0
- package/dist/schematype/index.js +12 -0
- package/dist/schematype/index.js.map +1 -0
- package/dist/schematype/primarymasterdata.js +38 -0
- package/dist/schematype/primarymasterdata.js.map +1 -0
- package/dist/schematype/simple.js +24 -0
- package/dist/schematype/simple.js.map +1 -0
- package/dist/schematype/simplemasterdata.js +31 -0
- package/dist/schematype/simplemasterdata.js.map +1 -0
- package/dist/schematype/transaction.js +74 -0
- package/dist/schematype/transaction.js.map +1 -0
- package/dist/type.d.ts +39 -5
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/autoincreament.ts +35 -33
- package/src/buildinschemas/branch.ts +47 -47
- package/src/buildinschemas/changehistories.ts +31 -30
- package/src/buildinschemas/customfield.ts +14 -24
- package/src/buildinschemas/docnoformat.ts +54 -43
- package/src/buildinschemas/documentevent.ts +42 -33
- package/src/buildinschemas/index.ts +1 -0
- package/src/buildinschemas/keyvaluepair.ts +25 -25
- package/src/buildinschemas/organization.ts +54 -50
- package/src/buildinschemas/permission.ts +34 -25
- package/src/buildinschemas/systemmessage.ts +39 -38
- package/src/buildinschemas/tenant.ts +46 -45
- package/src/buildinschemas/user.ts +64 -60
- package/src/buildinschemas/webhook.ts +131 -59
- package/src/buildinschemas/webhooklog.ts +75 -0
- package/src/framework.ts +6 -8
- package/src/generate.ts +19 -3
- package/src/processors/jsonschemabuilder.ts +6 -4
- package/src/type.ts +271 -215
- package/templates/basic/miniAppJsSdk/resource-bridge.service.ts.eta +9 -7
- package/templates/basic/miniAppStreamlitSdk/resource-bridge.service.ts.eta +22 -7
- package/templates/basic/nuxt/jsonschema.ts.eta +7 -0
- package/templates/basic/nuxt/resource-bridge.editable.service.ts.eta +40 -0
- package/templates/basic/nuxt/resource-bridge.service.ts.eta +24 -21
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +27 -9
- package/templates/miniAppJsSdk/src/services/bridge-resource-accessor.service.ts.eta +2 -2
- package/templates/miniAppStreamlitSdk/simtrain_eco_mini_app_streamlit_sdk/sdk.py.eta +5 -2
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +4 -2
- package/templates/nest/src/simpleapp/generate/commons/runwebhook.service.ts.eta +143 -168
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +22 -13
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +22 -16
- package/templates/nest/src/simpleapp/webhooks/branch.ts._eta +37 -0
- package/templates/nest/src/simpleapp/webhooks/index.ts._eta +21 -0
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +4 -3
- package/templates/nuxt/components/simpleApp/SimpleAppInputTable.vue.eta +0 -1
- package/templates/nuxt/plugins/18.simpleapp-custom-field-store.ts.eta +9 -3
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +32 -22
- package/templates/nuxt/simpleapp/generate/jsonSchemas/index.ts.eta +11 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/common.constant.ts.eta +1 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/constants/resource.constant.ts.eta +2 -2
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge-resource-accessor.service.ts.eta +4 -4
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/services/bridge.service.ts.eta +20 -1
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/bridge.type.ts.eta +9 -0
- package/templates/nuxt/simpleapp/generate/miniApp/bridge/types/resource-mapper.type.ts.eta +2 -2
- package/templates/project/build.sh.eta +0 -5
- package/templates/nest/src/simpleapp/apischemas/customfield.ts.eta +0 -21
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppCustomFieldClient.ts.eta +0 -188
- /package/templates/nest/src/simpleapp/generate/processors/{webhook.processor.ts.eta → webhook.processor.ts.etaxxxx} +0 -0
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
|
|
|
@@ -638,11 +654,11 @@ const generateSystemFiles = (modules: ModuleObject[], allbpmn) => {
|
|
|
638
654
|
mkdirSync(foldername, { recursive: true });
|
|
639
655
|
}
|
|
640
656
|
// const templatename = `${frameworkfolder}/${longfilename}`.replace(".eta","").replace('._eta','')
|
|
641
|
-
|
|
657
|
+
log.info("Write template:",targetfilename)
|
|
642
658
|
const txt = eta.render(longfilename, renderProperties);
|
|
643
659
|
writeFileSync(targetfilename, txt);
|
|
644
660
|
} else {
|
|
645
|
-
|
|
661
|
+
log.warn("skip: ",longfilename)
|
|
646
662
|
}
|
|
647
663
|
}
|
|
648
664
|
});
|
|
@@ -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
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
180
|
+
if (schemaconfigs?.customField?.isEnable) {
|
|
181
|
+
jsondata['more'] = {
|
|
182
|
+
type: 'object',
|
|
183
|
+
properties: {}
|
|
184
|
+
};
|
|
185
|
+
}
|
|
184
186
|
}
|
|
185
187
|
}
|
|
186
188
|
|
package/src/type.ts
CHANGED
|
@@ -1,18 +1,24 @@
|
|
|
1
|
-
import
|
|
1
|
+
import {
|
|
2
|
+
JSONSchema7,
|
|
3
|
+
JSONSchema7Type,
|
|
4
|
+
JSONSchema7Version,
|
|
5
|
+
JSONSchema7TypeName,
|
|
6
|
+
JSONSchema7Definition
|
|
7
|
+
} from 'json-schema';
|
|
2
8
|
export type ChildModels = {
|
|
3
|
-
[key: string]: {
|
|
4
|
-
type: string;
|
|
5
|
-
model: SchemaModel
|
|
6
|
-
codeField:string
|
|
7
|
-
nameField:string
|
|
8
|
-
moreAutoComplete?:string[]
|
|
9
|
-
docStatusSettings?:DocumentStatus[]
|
|
10
|
-
apiSettings?:DocumentApi[]
|
|
9
|
+
[key: string]: {
|
|
10
|
+
type: string;
|
|
11
|
+
model: SchemaModel;
|
|
12
|
+
codeField: string;
|
|
13
|
+
nameField: string;
|
|
14
|
+
moreAutoComplete?: string[];
|
|
15
|
+
docStatusSettings?: DocumentStatus[];
|
|
16
|
+
apiSettings?: DocumentApi[];
|
|
11
17
|
// requireautocomplete: boolean
|
|
12
|
-
isolationtype:string
|
|
13
|
-
hasdocformat:boolean
|
|
14
|
-
foreignkeys:MyForeignKey
|
|
15
|
-
required: string[]
|
|
18
|
+
isolationtype: string;
|
|
19
|
+
hasdocformat: boolean;
|
|
20
|
+
foreignkeys: MyForeignKey;
|
|
21
|
+
required: string[];
|
|
16
22
|
};
|
|
17
23
|
};
|
|
18
24
|
export enum Fieldtypes {
|
|
@@ -21,7 +27,7 @@ export enum Fieldtypes {
|
|
|
21
27
|
'array' = 'array',
|
|
22
28
|
'boolean' = 'boolean',
|
|
23
29
|
'integer' = 'integer',
|
|
24
|
-
'number' = 'number'
|
|
30
|
+
'number' = 'number'
|
|
25
31
|
}
|
|
26
32
|
export type FieldModel = {
|
|
27
33
|
title?: string; //display name
|
|
@@ -32,7 +38,7 @@ export type FieldModel = {
|
|
|
32
38
|
format?: string;
|
|
33
39
|
required?: boolean;
|
|
34
40
|
example?: any;
|
|
35
|
-
// examples?: any;
|
|
41
|
+
// examples?: any;
|
|
36
42
|
};
|
|
37
43
|
|
|
38
44
|
// export type SchemaCategoryModel = {
|
|
@@ -43,61 +49,62 @@ export type SchemaModel = {
|
|
|
43
49
|
[key: string]: string | string[] | FieldModel | SchemaModel | SchemaModel[];
|
|
44
50
|
};
|
|
45
51
|
|
|
46
|
-
export type JsonSchemaProperties= {
|
|
47
|
-
[key: string]: JSONSchema7Definition
|
|
52
|
+
export type JsonSchemaProperties = {
|
|
53
|
+
[key: string]: JSONSchema7Definition;
|
|
48
54
|
// JSONSchema7Definition ,JSONSchema7
|
|
49
|
-
}
|
|
55
|
+
};
|
|
50
56
|
|
|
51
57
|
//foreign key setting in current document
|
|
52
58
|
export type MyForeignKey = {
|
|
53
|
-
[collectionname:string]:string[]
|
|
54
|
-
}
|
|
55
|
-
|
|
59
|
+
[collectionname: string]: string[];
|
|
60
|
+
};
|
|
56
61
|
|
|
57
62
|
//centralize foreignkey catalogue for all document
|
|
58
63
|
export type TypeForeignKeyCatalogue = {
|
|
59
|
-
[cataloguename:string]:TypeForeignKey
|
|
60
|
-
}
|
|
61
|
-
export type TypeForeignKey={
|
|
62
|
-
[collection:string]:string[]
|
|
63
|
-
}
|
|
64
|
+
[cataloguename: string]: TypeForeignKey;
|
|
65
|
+
};
|
|
66
|
+
export type TypeForeignKey = {
|
|
67
|
+
[collection: string]: string[];
|
|
68
|
+
};
|
|
64
69
|
export type ModuleObject = {
|
|
65
|
-
doctype:string
|
|
66
|
-
docname:string
|
|
67
|
-
pagetype:string
|
|
68
|
-
api:DocumentApi[]
|
|
69
|
-
schema:SimpleAppJSONSchema7
|
|
70
|
-
}
|
|
71
|
-
export type TypeGenerateDocumentVariable ={
|
|
70
|
+
doctype: string;
|
|
71
|
+
docname: string;
|
|
72
|
+
pagetype: string;
|
|
73
|
+
api: DocumentApi[];
|
|
74
|
+
schema: SimpleAppJSONSchema7;
|
|
75
|
+
};
|
|
76
|
+
export type TypeGenerateDocumentVariable = {
|
|
72
77
|
/**
|
|
73
|
-
* Resource Name should be a readable name with camelCase.
|
|
78
|
+
* Resource Name should be a readable name with camelCase.
|
|
74
79
|
* Ex: studentSummary
|
|
75
80
|
*/
|
|
76
81
|
resourceName: string;
|
|
77
|
-
name: string
|
|
78
|
-
doctype: string
|
|
79
|
-
models: ChildModels
|
|
80
|
-
autocompletecode:string
|
|
81
|
-
autocompletename:string
|
|
82
|
-
moreAutoComplete:string[]
|
|
83
|
-
schema: SchemaModel
|
|
84
|
-
apiSchemaName: string
|
|
85
|
-
typename: string
|
|
86
|
-
fullApiSchemaName: string
|
|
87
|
-
fullTypeName:string
|
|
88
|
-
jsonschema: SimpleAppJSONSchema7
|
|
89
|
-
bothEndCode: string
|
|
90
|
-
frontEndCode: string
|
|
91
|
-
backEndCode: string
|
|
92
|
-
controllerCode:string
|
|
93
|
-
apiSchemaCode:string
|
|
94
|
-
docStatusSettings:DocumentStatus[]
|
|
95
|
-
apiSettings:DocumentApi[]
|
|
96
|
-
isolationtype:string
|
|
97
|
-
hasdocformat:boolean
|
|
98
|
-
foreignkeys: MyForeignKey
|
|
99
|
-
|
|
100
|
-
|
|
82
|
+
name: string;
|
|
83
|
+
doctype: string;
|
|
84
|
+
models: ChildModels;
|
|
85
|
+
autocompletecode: string;
|
|
86
|
+
autocompletename: string;
|
|
87
|
+
moreAutoComplete: string[];
|
|
88
|
+
schema: SchemaModel;
|
|
89
|
+
apiSchemaName: string;
|
|
90
|
+
typename: string;
|
|
91
|
+
fullApiSchemaName: string;
|
|
92
|
+
fullTypeName: string;
|
|
93
|
+
jsonschema: SimpleAppJSONSchema7;
|
|
94
|
+
bothEndCode: string;
|
|
95
|
+
frontEndCode: string;
|
|
96
|
+
backEndCode: string;
|
|
97
|
+
controllerCode: string;
|
|
98
|
+
apiSchemaCode: string;
|
|
99
|
+
docStatusSettings: DocumentStatus[];
|
|
100
|
+
apiSettings: DocumentApi[];
|
|
101
|
+
isolationtype: string;
|
|
102
|
+
hasdocformat: boolean;
|
|
103
|
+
foreignkeys: MyForeignKey;
|
|
104
|
+
customField: {
|
|
105
|
+
isEnable: boolean;
|
|
106
|
+
};
|
|
107
|
+
};
|
|
101
108
|
|
|
102
109
|
// export type DocSetting = {
|
|
103
110
|
// docName:string,
|
|
@@ -114,194 +121,243 @@ foreignkeys: MyForeignKey
|
|
|
114
121
|
// }
|
|
115
122
|
|
|
116
123
|
export type DocumentStatus = {
|
|
117
|
-
status:string
|
|
118
|
-
statusName:string
|
|
119
|
-
readOnly:boolean
|
|
120
|
-
actions: string[]
|
|
124
|
+
status: string; //'CO', 'V', 'CL', 'D' and etc
|
|
125
|
+
statusName: string;
|
|
126
|
+
readOnly: boolean;
|
|
127
|
+
actions: string[]; //api name ['confirm','revert','close','void' and etc]
|
|
128
|
+
};
|
|
129
|
+
export enum RESTMethods {
|
|
130
|
+
'post' = 'post',
|
|
131
|
+
'get' = 'get',
|
|
132
|
+
'delete' = 'delete',
|
|
133
|
+
'put' = 'put',
|
|
134
|
+
'patch' = 'patch'
|
|
121
135
|
}
|
|
122
|
-
export enum RESTMethods {'post'='post','get'='get', 'delete'='delete','put'='put', 'patch'='patch'}
|
|
123
136
|
export type DocumentApi = {
|
|
124
|
-
action:string
|
|
125
|
-
entryPoint:string
|
|
126
|
-
queryPara?:string[]
|
|
127
|
-
requiredRole?: string[]
|
|
128
|
-
method:RESTMethods
|
|
129
|
-
responseType
|
|
130
|
-
schema
|
|
131
|
-
description:string //description of api
|
|
137
|
+
action: string; //api action name
|
|
138
|
+
entryPoint: string; //api entry point example:':id', ':id/confirm'
|
|
139
|
+
queryPara?: string[]; //what query parameter wish to accept, example: ['description','date']
|
|
140
|
+
requiredRole?: string[]; // what special user role wish to allow for this api, example: ['SuperUser']
|
|
141
|
+
method: RESTMethods;
|
|
142
|
+
responseType?: string;
|
|
143
|
+
schema?: string;
|
|
144
|
+
description: string; //description of api
|
|
145
|
+
};
|
|
146
|
+
export enum IsolationType {
|
|
147
|
+
'none' = 'none',
|
|
148
|
+
'tenant' = 'tenant',
|
|
149
|
+
'org' = 'org',
|
|
150
|
+
'branch' = 'branch'
|
|
132
151
|
}
|
|
133
|
-
export enum IsolationType {"none"="none" , "tenant"="tenant","org"="org", "branch"="branch"}
|
|
134
152
|
// export type ImportLibs = {"lib":string,"as":string}
|
|
135
|
-
export type Formula =
|
|
136
|
-
jsonPath:string
|
|
137
|
-
formula:string
|
|
138
|
-
}
|
|
153
|
+
export type Formula = {
|
|
154
|
+
jsonPath: string; //example: "$.subtotal","$.details[*]"
|
|
155
|
+
formula: string; //example "jslib.getDocumentSubTotal(@F{$.details})"
|
|
156
|
+
};
|
|
139
157
|
|
|
140
158
|
export type SchemaConfig = {
|
|
141
|
-
isolationType: IsolationType
|
|
142
|
-
requiredRoles?:string[]
|
|
143
|
-
pageType?: string
|
|
144
|
-
uniqueKey?:string
|
|
145
|
-
uniqueKeys?:string[][]
|
|
146
|
-
documentTitle?:string
|
|
147
|
-
loseDataIsolation?:boolean
|
|
148
|
-
generateDocumentNumber?:boolean
|
|
149
|
-
docNoPattern?:string
|
|
150
|
-
documentDate?:string
|
|
151
|
-
allStatus?:DocumentStatus[]
|
|
152
|
-
additionalApis?:DocumentApi[]
|
|
153
|
-
additionalAutoCompleteFields
|
|
154
|
-
search?:string[]
|
|
159
|
+
isolationType: IsolationType;
|
|
160
|
+
requiredRoles?: string[];
|
|
161
|
+
pageType?: string;
|
|
162
|
+
uniqueKey?: string;
|
|
163
|
+
uniqueKeys?: string[][];
|
|
164
|
+
documentTitle?: string;
|
|
165
|
+
loseDataIsolation?: boolean;
|
|
166
|
+
generateDocumentNumber?: boolean;
|
|
167
|
+
docNoPattern?: string;
|
|
168
|
+
documentDate?: string;
|
|
169
|
+
allStatus?: DocumentStatus[];
|
|
170
|
+
additionalApis?: DocumentApi[];
|
|
171
|
+
additionalAutoCompleteFields?: string[];
|
|
172
|
+
search?: string[];
|
|
155
173
|
// libs?:ImportLibs[] // both process class and frontend client class will import same lib
|
|
156
|
-
formulas?: Formula[]
|
|
157
|
-
documentType: string
|
|
158
|
-
documentName: string
|
|
159
|
-
collectionName?: string
|
|
160
|
-
foreignKeys?:MyForeignKey
|
|
161
|
-
printFormats?: SchemaPrintFormat[]
|
|
162
|
-
|
|
174
|
+
formulas?: Formula[];
|
|
175
|
+
documentType: string;
|
|
176
|
+
documentName: string;
|
|
177
|
+
collectionName?: string;
|
|
178
|
+
foreignKeys?: MyForeignKey;
|
|
179
|
+
printFormats?: SchemaPrintFormat[];
|
|
180
|
+
/**
|
|
181
|
+
* Resource Name **MUST** use **READABLE** name.
|
|
182
|
+
*
|
|
183
|
+
* We already have dirty name in documentType and documentName.
|
|
184
|
+
*
|
|
185
|
+
* **NOT** need another.
|
|
186
|
+
*
|
|
187
|
+
* Use Camel Case. Example:
|
|
188
|
+
* - studentGroup
|
|
189
|
+
* - teacherGroup
|
|
190
|
+
* - customField
|
|
191
|
+
*/
|
|
192
|
+
resourceName: string;
|
|
193
|
+
miniApp?: {
|
|
194
|
+
/**
|
|
195
|
+
* Define API whitelist for mini app use.
|
|
196
|
+
*
|
|
197
|
+
* Ex: list, detail, create, update, patch, delete, autoComplete, getStudentSummary
|
|
198
|
+
*
|
|
199
|
+
* {
|
|
200
|
+
* list: true,
|
|
201
|
+
* detail: {}, // object for future enhance purpose
|
|
202
|
+
* }
|
|
203
|
+
*/
|
|
204
|
+
whitelist: {
|
|
205
|
+
[key: string]: true | {};
|
|
206
|
+
};
|
|
207
|
+
};
|
|
208
|
+
customField?: {
|
|
209
|
+
isEnable?: boolean;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
163
212
|
|
|
164
213
|
export type SchemaPrintFormat = {
|
|
165
|
-
formatName: string
|
|
166
|
-
formatId: string
|
|
167
|
-
description?: string
|
|
168
|
-
}
|
|
214
|
+
formatName: string;
|
|
215
|
+
formatId: string;
|
|
216
|
+
description?: string;
|
|
217
|
+
};
|
|
169
218
|
|
|
170
219
|
export type SchemaFields = {
|
|
171
|
-
_id: SimpleAppJSONSchema7
|
|
172
|
-
tenantId: SimpleAppJSONSchema7
|
|
173
|
-
orgId: SimpleAppJSONSchema7
|
|
174
|
-
branchId: SimpleAppJSONSchema7
|
|
175
|
-
created: SimpleAppJSONSchema7
|
|
176
|
-
updated: SimpleAppJSONSchema7
|
|
177
|
-
createdBy: SimpleAppJSONSchema7
|
|
178
|
-
updatedBy: SimpleAppJSONSchema7
|
|
179
|
-
[key:string]:SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined
|
|
180
|
-
|
|
181
|
-
}
|
|
182
|
-
|
|
220
|
+
_id: SimpleAppJSONSchema7;
|
|
221
|
+
tenantId: SimpleAppJSONSchema7;
|
|
222
|
+
orgId: SimpleAppJSONSchema7;
|
|
223
|
+
branchId: SimpleAppJSONSchema7;
|
|
224
|
+
created: SimpleAppJSONSchema7;
|
|
225
|
+
updated: SimpleAppJSONSchema7;
|
|
226
|
+
createdBy: SimpleAppJSONSchema7;
|
|
227
|
+
updatedBy: SimpleAppJSONSchema7;
|
|
228
|
+
[key: string]: SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined;
|
|
229
|
+
};
|
|
183
230
|
|
|
184
231
|
export type SchemaType = {
|
|
185
|
-
type:string
|
|
186
|
-
definitions?:SimpleAppJSONSchema7
|
|
187
|
-
required?:string[]
|
|
188
|
-
|
|
189
|
-
"x-simpleapp-config":SchemaConfig
|
|
190
|
-
properties: SchemaFields
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
|
|
232
|
+
type: string;
|
|
233
|
+
definitions?: SimpleAppJSONSchema7;
|
|
234
|
+
required?: string[];
|
|
194
235
|
|
|
236
|
+
'x-simpleapp-config': SchemaConfig;
|
|
237
|
+
properties: SchemaFields;
|
|
238
|
+
};
|
|
195
239
|
|
|
196
240
|
// modified from jsonschemas
|
|
197
241
|
export type SimpleAppJSONSchema7Definition = SimpleAppJSONSchema7 | boolean;
|
|
198
242
|
export interface SimpleAppJSONSchema7 {
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
$comment?: string | undefined;
|
|
243
|
+
'x-foreignkey'?: string;
|
|
244
|
+
$id?: string | undefined;
|
|
245
|
+
$ref?: string | undefined;
|
|
246
|
+
$schema?: JSONSchema7Version | undefined;
|
|
247
|
+
$comment?: string | undefined;
|
|
205
248
|
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
249
|
+
/**
|
|
250
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
251
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
252
|
+
*/
|
|
253
|
+
$defs?:
|
|
254
|
+
| {
|
|
255
|
+
[key: string]: JSONSchema7Definition;
|
|
256
|
+
}
|
|
257
|
+
| undefined;
|
|
213
258
|
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
259
|
+
/**
|
|
260
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
261
|
+
*/
|
|
262
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
263
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
264
|
+
const?: JSONSchema7Type | undefined;
|
|
220
265
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
266
|
+
/**
|
|
267
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
268
|
+
*/
|
|
269
|
+
multipleOf?: number | undefined;
|
|
270
|
+
maximum?: number | undefined;
|
|
271
|
+
exclusiveMaximum?: number | undefined;
|
|
272
|
+
minimum?: number | undefined;
|
|
273
|
+
exclusiveMinimum?: number | undefined;
|
|
229
274
|
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
275
|
+
/**
|
|
276
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
277
|
+
*/
|
|
278
|
+
maxLength?: number | undefined;
|
|
279
|
+
minLength?: number | undefined;
|
|
280
|
+
pattern?: string | undefined;
|
|
236
281
|
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
282
|
+
/**
|
|
283
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
284
|
+
*/
|
|
285
|
+
items?:
|
|
286
|
+
| SimpleAppJSONSchema7Definition
|
|
287
|
+
| SimpleAppJSONSchema7Definition[]
|
|
288
|
+
| undefined;
|
|
289
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
290
|
+
maxItems?: number | undefined;
|
|
291
|
+
minItems?: number | undefined;
|
|
292
|
+
uniqueItems?: boolean | undefined;
|
|
293
|
+
contains?: SimpleAppJSONSchema7Definition | undefined;
|
|
246
294
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
295
|
+
/**
|
|
296
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
297
|
+
*/
|
|
298
|
+
maxProperties?: number | undefined;
|
|
299
|
+
minProperties?: number | undefined;
|
|
300
|
+
required?: string[] | undefined;
|
|
301
|
+
properties?:
|
|
302
|
+
| {
|
|
254
303
|
[key: string]: SimpleAppJSONSchema7Definition;
|
|
255
|
-
|
|
256
|
-
|
|
304
|
+
}
|
|
305
|
+
| undefined;
|
|
306
|
+
patternProperties?:
|
|
307
|
+
| {
|
|
257
308
|
[key: string]: SimpleAppJSONSchema7Definition;
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
309
|
+
}
|
|
310
|
+
| undefined;
|
|
311
|
+
additionalProperties?: SimpleAppJSONSchema7Definition | undefined;
|
|
312
|
+
dependencies?:
|
|
313
|
+
| {
|
|
261
314
|
[key: string]: SimpleAppJSONSchema7Definition | string[];
|
|
262
|
-
|
|
263
|
-
|
|
315
|
+
}
|
|
316
|
+
| undefined;
|
|
317
|
+
propertyNames?: SimpleAppJSONSchema7Definition | undefined;
|
|
264
318
|
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
319
|
+
/**
|
|
320
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
321
|
+
*/
|
|
322
|
+
if?: SimpleAppJSONSchema7Definition | undefined;
|
|
323
|
+
then?: SimpleAppJSONSchema7Definition | undefined;
|
|
324
|
+
else?: SimpleAppJSONSchema7Definition | undefined;
|
|
271
325
|
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
326
|
+
/**
|
|
327
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
328
|
+
*/
|
|
329
|
+
allOf?: SimpleAppJSONSchema7Definition[] | undefined;
|
|
330
|
+
anyOf?: SimpleAppJSONSchema7Definition[] | undefined;
|
|
331
|
+
oneOf?: SimpleAppJSONSchema7Definition[] | undefined;
|
|
332
|
+
not?: SimpleAppJSONSchema7Definition | undefined;
|
|
279
333
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
334
|
+
/**
|
|
335
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
336
|
+
*/
|
|
337
|
+
format?: string | undefined;
|
|
284
338
|
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
339
|
+
/**
|
|
340
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
341
|
+
*/
|
|
342
|
+
contentMediaType?: string | undefined;
|
|
343
|
+
contentEncoding?: string | undefined;
|
|
290
344
|
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
345
|
+
/**
|
|
346
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
347
|
+
*/
|
|
348
|
+
definitions?:
|
|
349
|
+
| {
|
|
295
350
|
[key: string]: JSONSchema7Definition;
|
|
296
|
-
|
|
351
|
+
}
|
|
352
|
+
| undefined;
|
|
297
353
|
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
}
|
|
354
|
+
/**
|
|
355
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
356
|
+
*/
|
|
357
|
+
title?: string | undefined;
|
|
358
|
+
description?: string | undefined;
|
|
359
|
+
default?: JSONSchema7Type | undefined;
|
|
360
|
+
readOnly?: boolean | undefined;
|
|
361
|
+
writeOnly?: boolean | undefined;
|
|
362
|
+
examples?: JSONSchema7Type | undefined;
|
|
363
|
+
}
|
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
const apiName = it.typename.toUpperCase() + 'Api';
|
|
15
15
|
const typeActionName = pascalName + 'Actions';
|
|
16
16
|
|
|
17
|
-
const miniAppWhitelistApis = it.jsonschema['x-simpleapp-config']?.miniApp?.whitelist ||
|
|
18
|
-
const hasMiniAppWhitelistedApi = miniAppWhitelistApis.length > 0;
|
|
17
|
+
const miniAppWhitelistApis = it.jsonschema['x-simpleapp-config']?.miniApp?.whitelist || {};
|
|
18
|
+
const hasMiniAppWhitelistedApi = Object.keys(miniAppWhitelistApis).length > 0;
|
|
19
19
|
%>
|
|
20
20
|
|
|
21
21
|
import { MiniAppBridgeService } from "../bridge.service";
|
|
@@ -29,10 +29,8 @@ export class MiniApp<%= pascalName %>BridgeService {
|
|
|
29
29
|
this.bridge = bridge;
|
|
30
30
|
}
|
|
31
31
|
|
|
32
|
-
<%
|
|
33
|
-
<%
|
|
34
|
-
const action = miniAppWhitelistApis[i];
|
|
35
|
-
%>
|
|
32
|
+
<% Object.entries(miniAppWhitelistApis).forEach(([action, value]) => { %>
|
|
33
|
+
<% if (value !== true && typeof value !== 'object') { return; } %>
|
|
36
34
|
|
|
37
35
|
<% if(action === 'list') { %>
|
|
38
36
|
async list() {
|
|
@@ -65,6 +63,10 @@ export class MiniApp<%= pascalName %>BridgeService {
|
|
|
65
63
|
body: data,
|
|
66
64
|
});
|
|
67
65
|
}
|
|
66
|
+
<% } else if(action === 'current') { %>
|
|
67
|
+
async <%= action %>() {
|
|
68
|
+
return this.bridge.callApi(this.resourceName, "<%= action %>");
|
|
69
|
+
}
|
|
68
70
|
<% } else { %>
|
|
69
71
|
<% const apiSetting = it.apiSettings.find(item => item.action === action); %>
|
|
70
72
|
<% if (apiSetting) { %>
|
|
@@ -107,7 +109,7 @@ export class MiniApp<%= pascalName %>BridgeService {
|
|
|
107
109
|
}
|
|
108
110
|
<% } %>
|
|
109
111
|
<% } %>
|
|
110
|
-
<% } %>
|
|
112
|
+
<% }) %>
|
|
111
113
|
|
|
112
114
|
openOnScreenForm(id?: string) {
|
|
113
115
|
this.bridge.openOnScreenResourceForm(this.resourceName, {
|