@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
@@ -4,201 +4,238 @@
4
4
  * last change 2024-02-23
5
5
  * Author: Ks Tan
6
6
  */
7
- import { JSONSchema7,JSONSchema7Type,JSONSchema7Version, JSONSchema7TypeName,JSONSchema7Definition } from 'json-schema';
7
+ import {
8
+ JSONSchema7,
9
+ JSONSchema7Type,
10
+ JSONSchema7Version,
11
+ JSONSchema7TypeName,
12
+ JSONSchema7Definition,
13
+ } from "json-schema";
8
14
  export type DocumentStatus = {
9
- status:string //'CO', 'V', 'CL', 'D' and etc
10
- statusName:string
11
- readOnly:boolean
12
- actions: string[] //api name ['confirm','revert','close','void' and etc]
13
- }
14
- export enum RESTMethods {'post'='post','get'='get', 'delete'='delete','put'='put', 'patch'='patch'}
15
- export type DocumentApi = {
16
- action:string //api action name
17
- entryPoint:string //api entry point example:':id', ':id/confirm'
18
- queryPara?:string[] //what query parameter wish to accept, example: ['description','date']
19
- requiredRole?: string[] // what special user role wish to allow for this api, example: ['SuperUser']
20
- workflowSetting?: {bpmn:string} //optional property, once define code gen connect the bpmn workflow
21
- method:RESTMethods
22
- schema?:string //any schema/type name in types & apischemas
23
- responseType?:string //any schema/type name for response
24
- description:string //description of api
25
- }
26
- export enum IsolationType {"none"="none" , "tenant"="tenant","org"="org", "branch"="branch"}
27
- // export type ImportLibs = {"lib":string,"as":string}
28
- export type Formula = {
29
- jsonPath:string //example: "$.subtotal","$.details[*]"
30
- formula:string //example "jslib.getDocumentSubTotal(@F{$.details})"
31
- }
15
+ status: string; //'CO', 'V', 'CL', 'D' and etc
16
+ statusName: string;
17
+ readOnly: boolean;
18
+ actions: string[]; //api name ['confirm','revert','close','void' and etc]
19
+ };
20
+ export enum RESTMethods {
21
+ "post" = "post",
22
+ "get" = "get",
23
+ "delete" = "delete",
24
+ "put" = "put",
25
+ "patch" = "patch",
26
+ }
27
+ export type DocumentApi = {
28
+ action: string; //api action name
29
+ entryPoint: string; //api entry point example:':id', ':id/confirm'
30
+ queryPara?: string[]; //what query parameter wish to accept, example: ['description','date']
31
+ requiredRole?: string[]; // what special user role wish to allow for this api, example: ['SuperUser']
32
+ workflowSetting?: { bpmn: string }; //optional property, once define code gen connect the bpmn workflow
33
+ method: RESTMethods;
34
+ schema?: string; //any schema/type name in types & apischemas
35
+ responseType?: string; //any schema/type name for response
36
+ description: string; //description of api
37
+ };
38
+ export enum IsolationType {
39
+ "none" = "none",
40
+ "tenant" = "tenant",
41
+ "org" = "org",
42
+ "branch" = "branch",
43
+ }
44
+ // export type ImportLibs = {"lib":string,"as":string}
45
+ export type Formula = {
46
+ jsonPath: string; //example: "$.subtotal","$.details[*]"
47
+ formula: string; //example "jslib.getDocumentSubTotal(@F{$.details})"
48
+ };
32
49
  export type SchemaConfig = {
33
- isolationType: string
34
- requiredRoles?:string[]
35
- pageType?: string
36
- uniqueKey?:string
37
- uniqueKeys?:string[][]
38
- documentTitle?:string
39
- generateDocumentNumber?:boolean
40
- docNoPattern?:string
41
- documentDate?:string
42
- allStatus?:DocumentStatus[]
43
- additionalApis?:DocumentApi[]
44
- search?:string[]
45
- additionalAutoCompleteFields ?: string[]
46
- // libs?:ImportLibs[] // both process class and frontend client class will import same lib
47
- formulas?: Formula[]
48
- documentType: string
49
- documentName: string
50
- collectionName?: string
51
- foreignKeys?:MyForeignKey
52
- printFormats?: SchemaPrintFormat[]
53
- }
50
+ isolationType: string;
51
+ requiredRoles?: string[];
52
+ pageType?: string;
53
+ uniqueKey?: string;
54
+ uniqueKeys?: string[][];
55
+ documentTitle?: string;
56
+ generateDocumentNumber?: boolean;
57
+ docNoPattern?: string;
58
+ documentDate?: string;
59
+ allStatus?: DocumentStatus[];
60
+ additionalApis?: DocumentApi[];
61
+ search?: string[];
62
+ additionalAutoCompleteFields?: string[];
63
+ // libs?:ImportLibs[] // both process class and frontend client class will import same lib
64
+ formulas?: Formula[];
65
+ documentType: string;
66
+ documentName: string;
67
+ collectionName?: string;
68
+ foreignKeys?: MyForeignKey;
69
+ printFormats?: SchemaPrintFormat[];
70
+ };
54
71
 
55
72
  export type SchemaPrintFormat = {
56
- formatName: string
57
- formatId: string
58
- description?: string
59
- }
60
- export type MyForeignKey = {
61
- [collectionname:string]:string[]
62
- }
63
-
73
+ formatName: string;
74
+ formatId: string;
75
+ description?: string;
76
+ };
77
+ export type MyForeignKey = {
78
+ [collectionname: string]: string[];
79
+ };
80
+
64
81
  export type SchemaType = {
65
- type:string
66
- definitions?:SimpleAppJSONSchema7
67
- required?:string[]
68
-
69
- "x-simpleapp-config":SchemaConfig
70
- properties: SchemaFields
71
- }
72
-
73
-
82
+ type: string;
83
+ definitions?: SimpleAppJSONSchema7;
84
+ required?: string[];
85
+
86
+ "x-simpleapp-config": SchemaConfig;
87
+ properties: SchemaFields;
88
+ };
89
+
90
+ export type CustomFieldJsonSchemaMore = {
91
+ more?: CustomFieldJsonSchemaMoreSchema;
92
+ };
93
+
94
+ export type CustomFieldJsonSchemaMoreSchema = SimpleAppJSONSchema7 & {
95
+ properties: CustomFieldJsonSchemaMoreSchemaGroup;
96
+ };
97
+
98
+ export type CustomFieldJsonSchemaMoreSchemaGroup = {
99
+ [key: string]: SimpleAppJSONSchema7Definition;
100
+ };
101
+
74
102
  export type SchemaFields = {
75
- _id: SimpleAppJSONSchema7
76
- tenantId: SimpleAppJSONSchema7
77
- orgId: SimpleAppJSONSchema7
78
- branchId: SimpleAppJSONSchema7
79
- created: SimpleAppJSONSchema7
80
- updated: SimpleAppJSONSchema7
81
- createdBy: SimpleAppJSONSchema7
82
- updatedBy: SimpleAppJSONSchema7
83
- [key:string]:SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined
84
-
85
- }
86
-
87
-
88
-
89
- // modified from jsonschemas
90
- export type SimpleAppJSONSchema7Definition = SimpleAppJSONSchema7 | boolean;
91
- export interface SimpleAppJSONSchema7 {
92
- inputType?: string;
93
- 'x-foreignkey' ?:string
94
- $id?: string | undefined;
95
- $ref?: string | undefined;
96
- $schema?: JSONSchema7Version | undefined;
97
- $comment?: string | undefined;
98
-
99
- /**
100
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
101
- * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
102
- */
103
- $defs?: {
104
- [key: string]: JSONSchema7Definition;
105
- } | undefined;
106
-
107
- /**
108
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
109
- */
110
- type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
111
- enum?: JSONSchema7Type[] | undefined;
112
- const?: JSONSchema7Type | undefined;
113
-
114
- /**
115
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
116
- */
117
- multipleOf?: number | undefined;
118
- maximum?: number | undefined;
119
- exclusiveMaximum?: number | undefined;
120
- minimum?: number | undefined;
121
- exclusiveMinimum?: number | undefined;
122
-
123
- /**
124
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
125
- */
126
- maxLength?: number | undefined;
127
- minLength?: number | undefined;
128
- pattern?: string | undefined;
129
-
130
- /**
131
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
132
- */
133
- items?: SimpleAppJSONSchema7Definition | SimpleAppJSONSchema7Definition[] | undefined;
134
- additionalItems?: JSONSchema7Definition | undefined;
135
- maxItems?: number | undefined;
136
- minItems?: number | undefined;
137
- uniqueItems?: boolean | undefined;
138
- contains?: SimpleAppJSONSchema7Definition | undefined;
139
-
140
- /**
141
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
142
- */
143
- maxProperties?: number | undefined;
144
- minProperties?: number | undefined;
145
- required?: string[] | undefined;
146
- properties?: {
147
- [key: string]: SimpleAppJSONSchema7Definition;
148
- } | undefined;
149
- patternProperties?: {
150
- [key: string]: SimpleAppJSONSchema7Definition;
151
- } | undefined;
152
- additionalProperties?: SimpleAppJSONSchema7Definition | undefined;
153
- dependencies?: {
154
- [key: string]: SimpleAppJSONSchema7Definition | string[];
155
- } | undefined;
156
- propertyNames?: SimpleAppJSONSchema7Definition | undefined;
157
-
158
- /**
159
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
160
- */
161
- if?: SimpleAppJSONSchema7Definition | undefined;
162
- then?: SimpleAppJSONSchema7Definition | undefined;
163
- else?: SimpleAppJSONSchema7Definition | undefined;
164
-
165
- /**
166
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
167
- */
168
- allOf?: SimpleAppJSONSchema7Definition[] | undefined;
169
- anyOf?: SimpleAppJSONSchema7Definition[] | undefined;
170
- oneOf?: SimpleAppJSONSchema7Definition[] | undefined;
171
- not?: SimpleAppJSONSchema7Definition | undefined;
172
-
173
- /**
174
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
175
- */
176
- format?: string | undefined;
177
-
178
- /**
179
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
180
- */
181
- contentMediaType?: string | undefined;
182
- contentEncoding?: string | undefined;
183
-
184
- /**
185
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
186
- */
187
- definitions?: {
188
- [key: string]: JSONSchema7Definition;
189
- } | undefined;
190
-
191
- /**
192
- * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
193
- */
194
- title?: string | undefined;
195
- description?: string | undefined;
196
- default?: JSONSchema7Type | undefined;
197
- readOnly?: boolean | undefined;
198
- writeOnly?: boolean | undefined;
199
- examples?: JSONSchema7Type[] | undefined;
200
- }
103
+ _id: SimpleAppJSONSchema7;
104
+ tenantId: SimpleAppJSONSchema7;
105
+ orgId: SimpleAppJSONSchema7;
106
+ branchId: SimpleAppJSONSchema7;
107
+ created: SimpleAppJSONSchema7;
108
+ updated: SimpleAppJSONSchema7;
109
+ createdBy: SimpleAppJSONSchema7;
110
+ updatedBy: SimpleAppJSONSchema7;
111
+ [key: string]: SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined;
112
+ } & CustomFieldJsonSchemaMore;
113
+
114
+ // modified from jsonschemas
115
+ export type SimpleAppJSONSchema7Definition = SimpleAppJSONSchema7 | boolean;
116
+ export interface SimpleAppJSONSchema7 {
117
+ inputType?: string;
118
+ "x-foreignkey"?: string;
119
+ $id?: string | undefined;
120
+ $ref?: string | undefined;
121
+ $schema?: JSONSchema7Version | undefined;
122
+ $comment?: string | undefined;
123
+
124
+ /**
125
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
126
+ * @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
127
+ */
128
+ $defs?:
129
+ | {
130
+ [key: string]: JSONSchema7Definition;
131
+ }
132
+ | undefined;
133
+
134
+ /**
135
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
136
+ */
137
+ type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
138
+ enum?: JSONSchema7Type[] | undefined;
139
+ const?: JSONSchema7Type | undefined;
140
+
141
+ /**
142
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
143
+ */
144
+ multipleOf?: number | undefined;
145
+ maximum?: number | undefined;
146
+ exclusiveMaximum?: number | undefined;
147
+ minimum?: number | undefined;
148
+ exclusiveMinimum?: number | undefined;
149
+
150
+ /**
151
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
152
+ */
153
+ maxLength?: number | undefined;
154
+ minLength?: number | undefined;
155
+ pattern?: string | undefined;
201
156
 
157
+ /**
158
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
159
+ */
160
+ items?:
161
+ | SimpleAppJSONSchema7Definition
162
+ | SimpleAppJSONSchema7Definition[]
163
+ | undefined;
164
+ additionalItems?: JSONSchema7Definition | undefined;
165
+ maxItems?: number | undefined;
166
+ minItems?: number | undefined;
167
+ uniqueItems?: boolean | undefined;
168
+ contains?: SimpleAppJSONSchema7Definition | undefined;
169
+
170
+ /**
171
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
172
+ */
173
+ maxProperties?: number | undefined;
174
+ minProperties?: number | undefined;
175
+ required?: string[] | undefined;
176
+ properties?:
177
+ | {
178
+ [key: string]: SimpleAppJSONSchema7Definition;
179
+ }
180
+ | undefined;
181
+ patternProperties?:
182
+ | {
183
+ [key: string]: SimpleAppJSONSchema7Definition;
184
+ }
185
+ | undefined;
186
+ additionalProperties?: SimpleAppJSONSchema7Definition | undefined;
187
+ dependencies?:
188
+ | {
189
+ [key: string]: SimpleAppJSONSchema7Definition | string[];
190
+ }
191
+ | undefined;
192
+ propertyNames?: SimpleAppJSONSchema7Definition | undefined;
193
+
194
+ /**
195
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
196
+ */
197
+ if?: SimpleAppJSONSchema7Definition | undefined;
198
+ then?: SimpleAppJSONSchema7Definition | undefined;
199
+ else?: SimpleAppJSONSchema7Definition | undefined;
200
+
201
+ /**
202
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
203
+ */
204
+ allOf?: SimpleAppJSONSchema7Definition[] | undefined;
205
+ anyOf?: SimpleAppJSONSchema7Definition[] | undefined;
206
+ oneOf?: SimpleAppJSONSchema7Definition[] | undefined;
207
+ not?: SimpleAppJSONSchema7Definition | undefined;
208
+
209
+ /**
210
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
211
+ */
212
+ format?: string | undefined;
213
+
214
+ /**
215
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
216
+ */
217
+ contentMediaType?: string | undefined;
218
+ contentEncoding?: string | undefined;
219
+
220
+ /**
221
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
222
+ */
223
+ definitions?:
224
+ | {
225
+ [key: string]: JSONSchema7Definition;
226
+ }
227
+ | undefined;
228
+
229
+ /**
230
+ * @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
231
+ */
232
+ title?: string | undefined;
233
+ description?: string | undefined;
234
+ default?: JSONSchema7Type | undefined;
235
+ readOnly?: boolean | undefined;
236
+ writeOnly?: boolean | undefined;
237
+ examples?: JSONSchema7Type[] | undefined;
238
+ }
202
239
 
203
240
  // ==================== Start Custom Field ====================
204
241
 
@@ -17,6 +17,10 @@ elif [ $type == 'backend' ]; then
17
17
  elif [ $type == 'updatebackend' ]; then
18
18
  simpleapp-generator -c config.json -g updatebackend
19
19
  cp -a ./sharelibs backend/src/simpleapp/generate
20
+ elif [ $type == 'updateMiniAppJsSdk' ]; then
21
+ simpleapp-generator -c config.json -g updateMiniAppJsSdk
22
+ elif [ $type == 'updateMiniAppStreamlitSdk' ]; then
23
+ simpleapp-generator -c config.json -g updateMiniAppStreamlitSdk
20
24
  fi
21
25
 
22
26
 
@@ -1,191 +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 { isEmpty } from "lodash";
7
- import {
8
- CustomFieldItemJsonSchema,
9
- CustomFieldJsonSchema,
10
- SimpleAppJSONSchema7,
11
- } from "~/types";
12
-
13
- export type CustomFieldMoreDataGroup = {
14
- [key: string]: CustomFieldMoreDataGroupItem;
15
- };
16
-
17
- export type CustomFieldMoreDataGroupItem = {
18
- [key: string]: any;
19
- };
20
-
21
- export class SimpleAppCustomFieldClient {
22
- private _defaultReturn = {
23
- schema: {
24
- type: "object",
25
- properties: {},
26
- },
27
- };
28
-
29
- constructor() {}
30
-
31
- processCustomField(collectionName: string) {
32
- // console.log(collectionName, "trigger processCustomField");
33
- const { $customFieldStore } = useNuxtApp();
34
- if (!$customFieldStore.data || isEmpty($customFieldStore.data)) {
35
- // Not Found Any Custom Field
36
- return this._defaultReturn;
37
- }
38
-
39
- const customField = $customFieldStore.findByCollectionName(collectionName);
40
- if (!customField) {
41
- // Not Found Custom Field In Current collectionName
42
- return this._defaultReturn;
43
- }
44
-
45
- const schema = this._processCustomFieldMoreProperties(
46
- collectionName,
47
- customField.form.schema as CustomFieldItemJsonSchema,
48
- );
49
-
50
- return { schema };
51
- }
52
-
53
- private _processCustomFieldMoreProperties(
54
- collectionName: string,
55
- customFieldJsonSchemaString: CustomFieldItemJsonSchema | undefined,
56
- ) {
57
- const customFieldJsonSchema = this._processCustomFieldProperties(
58
- customFieldJsonSchemaString,
59
- );
60
- const pluginJsonSchema =
61
- this._processPluginCustomFieldProperties(collectionName);
62
- return {
63
- type: "object",
64
- properties: {
65
- ...customFieldJsonSchema,
66
- ...pluginJsonSchema,
67
- },
68
- };
69
- }
70
-
71
- private _processPluginCustomFieldProperties(collectionName: string) {
72
- const schema: CustomFieldJsonSchema["properties"] = {};
73
- const { $appPluginsStore } = useNuxtApp();
74
- const pluginForms = $appPluginsStore.getForm(collectionName);
75
- if (!pluginForms || pluginForms.length <= 0) {
76
- return schema;
77
- }
78
-
79
- for (let i = 0; i < pluginForms.length; i++) {
80
- const pluginItem = pluginForms[i];
81
- const { pluginCode, jsonSchema } = pluginItem;
82
-
83
- schema[pluginCode] = jsonSchema as CustomFieldItemJsonSchema;
84
- }
85
-
86
- return schema;
87
- }
88
-
89
- private _processCustomFieldProperties(
90
- customFieldJsonSchemaString: CustomFieldItemJsonSchema | undefined,
91
- ) {
92
- if (!customFieldJsonSchemaString) {
93
- return this._defaultReturn;
94
- }
95
-
96
- return {
97
- default: {
98
- title: "Custom Field",
99
- ...customFieldJsonSchemaString,
100
- },
101
- };
102
- }
103
-
104
- processCustomFieldData(
105
- moreSchema: CustomFieldJsonSchema | undefined,
106
- isNew: boolean,
107
- resourceData: CustomFieldMoreDataGroup | undefined,
108
- ) {
109
- const data: Record<string, any> = {};
110
- if (!moreSchema || !moreSchema?.properties) {
111
- return data;
112
- }
113
-
114
- for (const [groupName, groupItem] of Object.entries(
115
- moreSchema.properties,
116
- )) {
117
- let groupData: Record<string, any> = {};
118
- if (groupItem.properties) {
119
- groupData = this._processGroupItemData(
120
- groupItem.properties,
121
- isNew,
122
- resourceData?.[groupName],
123
- );
124
- }
125
-
126
- data[groupName] = groupData;
127
- }
128
-
129
- return data;
130
- }
131
-
132
- private _processGroupItemData(
133
- groupItemProp: SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined,
134
- isNew: boolean,
135
- resourceData: CustomFieldMoreDataGroupItem | undefined,
136
- ) {
137
- const data: Record<string, any> = {};
138
-
139
- if (!groupItemProp) {
140
- return data;
141
- }
142
-
143
- for (const [fieldName, fieldItem] of Object.entries(groupItemProp)) {
144
- let value;
145
- if (isNew) {
146
- // New Record
147
- value = this._getFieldDefaultValue(fieldItem);
148
- } else {
149
- // Fetch By Id
150
- if (resourceData?.[fieldName]) {
151
- // DB got this field
152
- value = resourceData?.[fieldName];
153
- } else {
154
- // DB don't have this field
155
- value = this._getDefaultValueByType(fieldItem);
156
- console.log(fieldName, value);
157
- }
158
- }
159
-
160
- data[fieldName] = value;
161
- }
162
-
163
- return data;
164
- }
165
-
166
- private _getFieldDefaultValue(fieldItem: SimpleAppJSONSchema7) {
167
- return fieldItem.default !== undefined
168
- ? fieldItem.default
169
- : this._getDefaultValueByType(fieldItem);
170
- }
171
-
172
- private _getDefaultValueByType(fieldItem: SimpleAppJSONSchema7) {
173
- if (fieldItem.type === "string") {
174
- return "";
175
- }
176
-
177
- if (fieldItem.type === "number") {
178
- return 0;
179
- }
180
-
181
- if (fieldItem.type === "object") {
182
- return {};
183
- }
184
-
185
- if (fieldItem.type === "array") {
186
- return [];
187
- }
188
-
189
- return "";
190
- }
191
- }