@simitgroup/simpleapp-generator 1.6.6-e-alpha → 1.6.6-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.
- package/README copy.md +28 -28
- package/ReleaseNote.md +8 -1
- package/dist/buildinschemas/docnoformat.js +6 -6
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/documentevent.js +1 -1
- package/dist/buildinschemas/documentevent.js.map +1 -1
- package/dist/buildinschemas/organization.js +1 -1
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/tenant.js +1 -1
- package/dist/buildinschemas/tenant.js.map +1 -1
- package/dist/buildinschemas/user.js +2 -2
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/processors/jsonschemabuilder.js +1 -1
- package/dist/processors/jsonschemabuilder.js.map +1 -1
- package/dist/type.d.ts +255 -0
- package/dist/type.d.ts.map +1 -1
- package/docs/bpmn.md +4 -4
- package/docs/jsonschema.md +2 -2
- package/package.json +2 -2
- package/src/buildinschemas/docnoformat.ts +6 -6
- package/src/buildinschemas/documentevent.ts +1 -1
- package/src/buildinschemas/organization.ts +1 -1
- package/src/buildinschemas/tenant.ts +1 -1
- package/src/buildinschemas/user.ts +2 -2
- package/src/index.ts +1 -1
- package/src/processors/jsonschemabuilder.ts +1 -1
- package/src/type.ts +2 -2
- package/templates/basic/nest/controller.ts.eta +3 -2
- package/templates/basic/nest/processor.ts.eta +2 -1
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +2 -1
- package/templates/nest/.env._eta +2 -2
- package/templates/nest/src/main.ts.eta +7 -6
- package/templates/nest/src/printapi/api/configuration.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +4 -4
- package/templates/nest/src/simpleapp/generate/commons/customkeycloa.guard.ts.eta +3 -3
- package/templates/nest/src/simpleapp/generate/commons/customkeycloak.guard.ts.eta +3 -3
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +3 -3
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/processors/webhook.processor.ts.eta +2 -1
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +1 -1
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +1 -1
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +3 -3
- package/templates/nuxt/components/header/button/HeaderButtonProfile.vue.eta +3 -2
- package/templates/nuxt/components/image/ImageAvatar.vue.eta._vue +1 -1
- package/templates/nuxt/components/user/UserProfileListItem.vue.eta +1 -1
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +5 -3
- package/templates/nuxt/nuxt.config.ts._eta +2 -1
- package/templates/nuxt/types/schema.ts.eta +1 -1
- package/templates/project/jsonschemas/category.json._eta +5 -5
- package/templates/project/jsonschemas/customer.json._eta +4 -4
- package/templates/project/jsonschemas/invoice.json._eta +3 -3
- package/templates/project/jsonschemas/organization.json._eta +1 -1
- package/templates/project/jsonschemas/product.json._eta +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/dist/buildinschemas/index.js +0 -25
- package/dist/buildinschemas/index.js.map +0 -1
- package/dist/constant.d.ts.map +0 -1
- package/dist/constant.js +0 -7
- package/dist/constant.js.map +0 -1
- package/dist/framework.d.ts.map +0 -1
- package/dist/framework.js +0 -264
- package/dist/framework.js.map +0 -1
- package/dist/index.js +0 -156
- package/dist/index.js.map +0 -1
- package/dist/libs.d.ts.map +0 -1
- package/dist/libs.js +0 -15
- package/dist/libs.js.map +0 -1
- package/dist/processors/bpmnbuilder.d.ts.map +0 -1
- package/dist/processors/bpmnbuilder.js +0 -162
- package/dist/processors/bpmnbuilder.js.map +0 -1
- package/dist/resource/camunda-moodle.d.ts.map +0 -1
- package/dist/resource/camunda-moodle.js +0 -91
- package/dist/resource/camunda-moodle.js.map +0 -1
- package/dist/validation.d.ts.map +0 -1
- package/dist/validation.js +0 -2
- package/dist/validation.js.map +0 -1
package/dist/type.d.ts
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
import { JSONSchema7Type, JSONSchema7Version, JSONSchema7TypeName, JSONSchema7Definition } from 'json-schema';
|
|
2
|
+
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[];
|
|
11
|
+
isolationtype: string;
|
|
12
|
+
hasdocformat: boolean;
|
|
13
|
+
foreignkeys: MyForeignKey;
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
export declare enum Fieldtypes {
|
|
17
|
+
'string' = "string",
|
|
18
|
+
'object' = "object",
|
|
19
|
+
'array' = "array",
|
|
20
|
+
'boolean' = "boolean",
|
|
21
|
+
'integer' = "integer",
|
|
22
|
+
'number' = "number"
|
|
23
|
+
}
|
|
24
|
+
export type FieldModel = {
|
|
25
|
+
title?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
default?: any;
|
|
28
|
+
type: Fieldtypes;
|
|
29
|
+
format?: string;
|
|
30
|
+
required?: boolean;
|
|
31
|
+
example?: any;
|
|
32
|
+
};
|
|
33
|
+
export type SchemaModel = {
|
|
34
|
+
[key: string]: string | string[] | FieldModel | SchemaModel | SchemaModel[];
|
|
35
|
+
};
|
|
36
|
+
export type JsonSchemaProperties = {
|
|
37
|
+
[key: string]: JSONSchema7Definition;
|
|
38
|
+
};
|
|
39
|
+
export type MyForeignKey = {
|
|
40
|
+
[collectionname: string]: string[];
|
|
41
|
+
};
|
|
42
|
+
export type TypeForeignKeyCatalogue = {
|
|
43
|
+
[cataloguename: string]: TypeForeignKey;
|
|
44
|
+
};
|
|
45
|
+
export type TypeForeignKey = {
|
|
46
|
+
[collection: string]: string[];
|
|
47
|
+
};
|
|
48
|
+
export type ModuleObject = {
|
|
49
|
+
doctype: string;
|
|
50
|
+
docname: string;
|
|
51
|
+
pagetype: string;
|
|
52
|
+
api: DocumentApi[];
|
|
53
|
+
schema: SimpleAppJSONSchema7;
|
|
54
|
+
};
|
|
55
|
+
export type TypeGenerateDocumentVariable = {
|
|
56
|
+
name: string;
|
|
57
|
+
doctype: string;
|
|
58
|
+
models: ChildModels;
|
|
59
|
+
autocompletecode: string;
|
|
60
|
+
autocompletename: string;
|
|
61
|
+
moreAutoComplete: string[];
|
|
62
|
+
schema: SchemaModel;
|
|
63
|
+
apiSchemaName: string;
|
|
64
|
+
typename: string;
|
|
65
|
+
fullApiSchemaName: string;
|
|
66
|
+
fullTypeName: string;
|
|
67
|
+
jsonschema: SimpleAppJSONSchema7;
|
|
68
|
+
bothEndCode: string;
|
|
69
|
+
frontEndCode: string;
|
|
70
|
+
backEndCode: string;
|
|
71
|
+
controllerCode: string;
|
|
72
|
+
apiSchemaCode: string;
|
|
73
|
+
docStatusSettings: DocumentStatus[];
|
|
74
|
+
apiSettings: DocumentApi[];
|
|
75
|
+
isolationtype: string;
|
|
76
|
+
hasdocformat: boolean;
|
|
77
|
+
foreignkeys: MyForeignKey;
|
|
78
|
+
};
|
|
79
|
+
export type DocumentStatus = {
|
|
80
|
+
status: string;
|
|
81
|
+
statusName: string;
|
|
82
|
+
readOnly: boolean;
|
|
83
|
+
actions: string[];
|
|
84
|
+
};
|
|
85
|
+
export declare enum RESTMethods {
|
|
86
|
+
'post' = "post",
|
|
87
|
+
'get' = "get",
|
|
88
|
+
'delete' = "delete",
|
|
89
|
+
'put' = "put",
|
|
90
|
+
'patch' = "patch"
|
|
91
|
+
}
|
|
92
|
+
export type DocumentApi = {
|
|
93
|
+
action: string;
|
|
94
|
+
entryPoint: string;
|
|
95
|
+
queryPara?: string[];
|
|
96
|
+
requiredRole?: string[];
|
|
97
|
+
method: RESTMethods;
|
|
98
|
+
responseType?: string;
|
|
99
|
+
schema?: string;
|
|
100
|
+
description: string;
|
|
101
|
+
};
|
|
102
|
+
export declare enum IsolationType {
|
|
103
|
+
"none" = "none",
|
|
104
|
+
"tenant" = "tenant",
|
|
105
|
+
"org" = "org",
|
|
106
|
+
"branch" = "branch"
|
|
107
|
+
}
|
|
108
|
+
export type Formula = {
|
|
109
|
+
jsonPath: string;
|
|
110
|
+
formula: string;
|
|
111
|
+
};
|
|
112
|
+
export type SchemaConfig = {
|
|
113
|
+
isolationType: IsolationType;
|
|
114
|
+
requiredRoles?: string[];
|
|
115
|
+
pageType?: string;
|
|
116
|
+
uniqueKey?: string;
|
|
117
|
+
uniqueKeys?: string[][];
|
|
118
|
+
documentTitle?: string;
|
|
119
|
+
loseDataIsolation?: boolean;
|
|
120
|
+
generateDocumentNumber?: boolean;
|
|
121
|
+
docNoPattern?: string;
|
|
122
|
+
documentDate?: string;
|
|
123
|
+
allStatus?: DocumentStatus[];
|
|
124
|
+
additionalApis?: DocumentApi[];
|
|
125
|
+
additionalAutoCompleteFields?: string[];
|
|
126
|
+
search?: string[];
|
|
127
|
+
formulas?: Formula[];
|
|
128
|
+
documentType: string;
|
|
129
|
+
documentName: string;
|
|
130
|
+
collectionName?: string;
|
|
131
|
+
foreignKeys?: MyForeignKey;
|
|
132
|
+
printFormats?: SchemaPrintFormat[];
|
|
133
|
+
};
|
|
134
|
+
export type SchemaPrintFormat = {
|
|
135
|
+
formatName: string;
|
|
136
|
+
formatId: string;
|
|
137
|
+
description?: string;
|
|
138
|
+
};
|
|
139
|
+
export type SchemaFields = {
|
|
140
|
+
_id: SimpleAppJSONSchema7;
|
|
141
|
+
tenantId: SimpleAppJSONSchema7;
|
|
142
|
+
orgId: SimpleAppJSONSchema7;
|
|
143
|
+
branchId: SimpleAppJSONSchema7;
|
|
144
|
+
created: SimpleAppJSONSchema7;
|
|
145
|
+
updated: SimpleAppJSONSchema7;
|
|
146
|
+
createdBy: SimpleAppJSONSchema7;
|
|
147
|
+
updatedBy: SimpleAppJSONSchema7;
|
|
148
|
+
[key: string]: SimpleAppJSONSchema7 | SimpleAppJSONSchema7[] | undefined;
|
|
149
|
+
};
|
|
150
|
+
export type SchemaType = {
|
|
151
|
+
type: string;
|
|
152
|
+
definitions?: SimpleAppJSONSchema7;
|
|
153
|
+
required?: string[];
|
|
154
|
+
"x-simpleapp-config": SchemaConfig;
|
|
155
|
+
properties: SchemaFields;
|
|
156
|
+
};
|
|
157
|
+
export type SimpleAppJSONSchema7Definition = SimpleAppJSONSchema7 | boolean;
|
|
158
|
+
export interface SimpleAppJSONSchema7 {
|
|
159
|
+
'x-foreignkey'?: string;
|
|
160
|
+
$id?: string | undefined;
|
|
161
|
+
$ref?: string | undefined;
|
|
162
|
+
$schema?: JSONSchema7Version | undefined;
|
|
163
|
+
$comment?: string | undefined;
|
|
164
|
+
/**
|
|
165
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-00#section-8.2.4
|
|
166
|
+
* @see https://datatracker.ietf.org/doc/html/draft-bhutton-json-schema-validation-00#appendix-A
|
|
167
|
+
*/
|
|
168
|
+
$defs?: {
|
|
169
|
+
[key: string]: JSONSchema7Definition;
|
|
170
|
+
} | undefined;
|
|
171
|
+
/**
|
|
172
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.1
|
|
173
|
+
*/
|
|
174
|
+
type?: JSONSchema7TypeName | JSONSchema7TypeName[] | undefined;
|
|
175
|
+
enum?: JSONSchema7Type[] | undefined;
|
|
176
|
+
const?: JSONSchema7Type | undefined;
|
|
177
|
+
/**
|
|
178
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.2
|
|
179
|
+
*/
|
|
180
|
+
multipleOf?: number | undefined;
|
|
181
|
+
maximum?: number | undefined;
|
|
182
|
+
exclusiveMaximum?: number | undefined;
|
|
183
|
+
minimum?: number | undefined;
|
|
184
|
+
exclusiveMinimum?: number | undefined;
|
|
185
|
+
/**
|
|
186
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.3
|
|
187
|
+
*/
|
|
188
|
+
maxLength?: number | undefined;
|
|
189
|
+
minLength?: number | undefined;
|
|
190
|
+
pattern?: string | undefined;
|
|
191
|
+
/**
|
|
192
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.4
|
|
193
|
+
*/
|
|
194
|
+
items?: SimpleAppJSONSchema7Definition | SimpleAppJSONSchema7Definition[] | undefined;
|
|
195
|
+
additionalItems?: JSONSchema7Definition | undefined;
|
|
196
|
+
maxItems?: number | undefined;
|
|
197
|
+
minItems?: number | undefined;
|
|
198
|
+
uniqueItems?: boolean | undefined;
|
|
199
|
+
contains?: SimpleAppJSONSchema7Definition | undefined;
|
|
200
|
+
/**
|
|
201
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.5
|
|
202
|
+
*/
|
|
203
|
+
maxProperties?: number | undefined;
|
|
204
|
+
minProperties?: number | undefined;
|
|
205
|
+
required?: string[] | undefined;
|
|
206
|
+
properties?: {
|
|
207
|
+
[key: string]: SimpleAppJSONSchema7Definition;
|
|
208
|
+
} | undefined;
|
|
209
|
+
patternProperties?: {
|
|
210
|
+
[key: string]: SimpleAppJSONSchema7Definition;
|
|
211
|
+
} | undefined;
|
|
212
|
+
additionalProperties?: SimpleAppJSONSchema7Definition | undefined;
|
|
213
|
+
dependencies?: {
|
|
214
|
+
[key: string]: SimpleAppJSONSchema7Definition | string[];
|
|
215
|
+
} | undefined;
|
|
216
|
+
propertyNames?: SimpleAppJSONSchema7Definition | undefined;
|
|
217
|
+
/**
|
|
218
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.6
|
|
219
|
+
*/
|
|
220
|
+
if?: SimpleAppJSONSchema7Definition | undefined;
|
|
221
|
+
then?: SimpleAppJSONSchema7Definition | undefined;
|
|
222
|
+
else?: SimpleAppJSONSchema7Definition | undefined;
|
|
223
|
+
/**
|
|
224
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-6.7
|
|
225
|
+
*/
|
|
226
|
+
allOf?: SimpleAppJSONSchema7Definition[] | undefined;
|
|
227
|
+
anyOf?: SimpleAppJSONSchema7Definition[] | undefined;
|
|
228
|
+
oneOf?: SimpleAppJSONSchema7Definition[] | undefined;
|
|
229
|
+
not?: SimpleAppJSONSchema7Definition | undefined;
|
|
230
|
+
/**
|
|
231
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-7
|
|
232
|
+
*/
|
|
233
|
+
format?: string | undefined;
|
|
234
|
+
/**
|
|
235
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-8
|
|
236
|
+
*/
|
|
237
|
+
contentMediaType?: string | undefined;
|
|
238
|
+
contentEncoding?: string | undefined;
|
|
239
|
+
/**
|
|
240
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-9
|
|
241
|
+
*/
|
|
242
|
+
definitions?: {
|
|
243
|
+
[key: string]: JSONSchema7Definition;
|
|
244
|
+
} | undefined;
|
|
245
|
+
/**
|
|
246
|
+
* @see https://tools.ietf.org/html/draft-handrews-json-schema-validation-01#section-10
|
|
247
|
+
*/
|
|
248
|
+
title?: string | undefined;
|
|
249
|
+
description?: string | undefined;
|
|
250
|
+
default?: JSONSchema7Type | undefined;
|
|
251
|
+
readOnly?: boolean | undefined;
|
|
252
|
+
writeOnly?: boolean | undefined;
|
|
253
|
+
example?: JSONSchema7Type | undefined;
|
|
254
|
+
}
|
|
255
|
+
//# sourceMappingURL=type.d.ts.map
|
package/dist/type.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,OAAQ,EAAc,eAAe,EAAC,kBAAkB,EAAE,mBAAmB,EAAC,qBAAqB,EAAE,MAAM,aAAa,CAAC;AACzH,MAAM,MAAM,WAAW,GAAG;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG;QACb,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,EAAE,WAAW,CAAC;QACnB,SAAS,EAAC,MAAM,CAAC;QACjB,SAAS,EAAC,MAAM,CAAC;QACjB,gBAAgB,CAAC,EAAC,MAAM,EAAE,CAAC;QAC3B,iBAAiB,CAAC,EAAC,cAAc,EAAE,CAAC;QACpC,WAAW,CAAC,EAAC,WAAW,EAAE,CAAC;QAE3B,aAAa,EAAC,MAAM,CAAA;QACpB,YAAY,EAAC,OAAO,CAAC;QACrB,WAAW,EAAC,YAAY,CAAA;KACzB,CAAC;CACH,CAAC;AACF,oBAAY,UAAU;IACpB,QAAQ,WAAW;IACnB,QAAQ,WAAW;IACnB,OAAO,UAAU;IACjB,SAAS,YAAY;IACrB,SAAS,YAAY;IACrB,QAAQ,WAAW;CACpB;AACD,MAAM,MAAM,UAAU,GAAG;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,IAAI,EAAE,UAAU,CAAC;IAEjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"type.d.ts","sourceRoot":"","sources":["../src/type.ts"],"names":[],"mappings":"AAAA,OAAQ,EAAc,eAAe,EAAC,k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CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;IACtC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC/B,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,OAAO,CAAC,EAAE,eAAe,GAAG,SAAS,CAAC;CACzC"}
|
package/docs/bpmn.md
CHANGED
|
@@ -65,17 +65,17 @@ Use BPMN in SimpleApp Generator involve below steps:
|
|
|
65
65
|
"customerNo": {
|
|
66
66
|
"type": "string",
|
|
67
67
|
"format": "documentno",
|
|
68
|
-
"
|
|
68
|
+
"example": ["S0001"]
|
|
69
69
|
},
|
|
70
70
|
"customerName": {
|
|
71
71
|
"type": "string",
|
|
72
|
-
"
|
|
72
|
+
"example": ["Customer 1"],
|
|
73
73
|
"minLength": 3
|
|
74
74
|
},
|
|
75
75
|
"customerStatus": {
|
|
76
76
|
"type": "string",
|
|
77
77
|
"enum": ["unknown", "potential", "suspended", "existing"],
|
|
78
|
-
"
|
|
78
|
+
"example": ["unknown"]
|
|
79
79
|
},
|
|
80
80
|
"email": {
|
|
81
81
|
"type": "string",
|
|
@@ -85,7 +85,7 @@ Use BPMN in SimpleApp Generator involve below steps:
|
|
|
85
85
|
"type": "string",
|
|
86
86
|
"oneOf": [{ "format": "tel" }, { "enum": [""] }]
|
|
87
87
|
},
|
|
88
|
-
"active": { "type": "boolean", "default": true, "
|
|
88
|
+
"active": { "type": "boolean", "default": true, "example": [true] },
|
|
89
89
|
"description": { "type": "string", "format": "text" },
|
|
90
90
|
"docNoFormat": {
|
|
91
91
|
"type": "object",
|
package/docs/jsonschema.md
CHANGED
|
@@ -29,8 +29,8 @@ refer below example `product.json`:
|
|
|
29
29
|
},
|
|
30
30
|
"properties": {
|
|
31
31
|
...
|
|
32
|
-
"productCode": { "type": "string", "
|
|
33
|
-
"productName": { "type": "string", "
|
|
32
|
+
"productCode": { "type": "string", "example": ["BK-MTHP1"] },
|
|
33
|
+
"productName": { "type": "string", "example": ["Math Primary 1 Book"] },
|
|
34
34
|
"category": {
|
|
35
35
|
"type": "object",
|
|
36
36
|
"x-foreignkey": "category",
|
package/package.json
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@simitgroup/simpleapp-generator",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.6g-alpha",
|
|
4
4
|
"description": "frontend nuxtjs and backend nests code generator using jsonschema",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"scripts": {
|
|
7
|
-
"generate": "ts-node src/index.ts -c
|
|
7
|
+
"generate": "ts-node src/index.ts -c ./sampleconfig.json; pnpm exec prettier ./backend --write;pnpm exec prettier ./frontend --write",
|
|
8
8
|
"build": "npx tsc",
|
|
9
9
|
"test": "echo \"Error: no test specified\" && exit 1"
|
|
10
10
|
},
|
|
@@ -33,12 +33,12 @@ export const docnoformat:SchemaType ={
|
|
|
33
33
|
"label":{"type":"string"},
|
|
34
34
|
"branchId":{type:"integer"},
|
|
35
35
|
}},
|
|
36
|
-
docNoFormatNo: {"type": "string","
|
|
37
|
-
docNoFormatName: { "type": "string", "
|
|
38
|
-
active: {type: "boolean","
|
|
39
|
-
default:{type: "boolean","
|
|
40
|
-
docNoType: {type: "string","
|
|
41
|
-
docNoPattern: {type: "string","
|
|
36
|
+
docNoFormatNo: {"type": "string","example": ["INV"]},
|
|
37
|
+
docNoFormatName: { "type": "string", "example": ["Invoice Default Format"]},
|
|
38
|
+
active: {type: "boolean","example": [true],default:true},
|
|
39
|
+
default:{type: "boolean","example": [true],default:true},
|
|
40
|
+
docNoType: {type: "string","example": ["SI","PI"]},
|
|
41
|
+
docNoPattern: {type: "string","example": ["SI{YYMM}-<000>","PI-2023-<0000>"],"description":"{date} format as ISO8601 symbol"},
|
|
42
42
|
nextNumber:{type:"integer",default:1}
|
|
43
43
|
}
|
|
44
44
|
}
|
|
@@ -43,7 +43,7 @@ export const organization:SchemaType ={
|
|
|
43
43
|
registrationNo:{type:"string"},
|
|
44
44
|
active: {type: "boolean","default":true,},
|
|
45
45
|
description: {type: "string",format:"text",},
|
|
46
|
-
timeZone: {"type": "string","
|
|
46
|
+
timeZone: {"type": "string","example": ["Asia/Kuala_Lumpur"]},
|
|
47
47
|
offsetMinute:{"type": "number","default":0},
|
|
48
48
|
currency:{"type":"string",minimum:3,maximum:3},
|
|
49
49
|
country:{"type":"string",minimum:2,maximum:2}
|
|
@@ -22,7 +22,7 @@ export const tenant:SchemaType ={
|
|
|
22
22
|
orgId: {type:'integer',default:1,minimum:0 },
|
|
23
23
|
branchId: {type:'integer',default:1,minimum:0 },
|
|
24
24
|
tenantName: {type: "string", minLength:3},
|
|
25
|
-
active: {"type": "boolean","
|
|
25
|
+
active: {"type": "boolean","example": [true],default:true},
|
|
26
26
|
businessType:{type:"string"},
|
|
27
27
|
clientSetting: {
|
|
28
28
|
type:"object",
|
|
@@ -49,7 +49,7 @@ export const user:SchemaType ={
|
|
|
49
49
|
type: "string",
|
|
50
50
|
anyOf:[
|
|
51
51
|
{"const":""},
|
|
52
|
-
{"format": "tel","
|
|
52
|
+
{"format": "tel","example": ["0123456789"]}
|
|
53
53
|
]
|
|
54
54
|
},
|
|
55
55
|
active: {type: "boolean",default:true},
|
|
@@ -57,7 +57,7 @@ export const user:SchemaType ={
|
|
|
57
57
|
lastActivity: {type: "string",description:"capture ISO8601 last api call"},
|
|
58
58
|
completedTours: {
|
|
59
59
|
type: "array",
|
|
60
|
-
items: { "type": "string", "
|
|
60
|
+
items: { "type": "string", "example": ["mainpage"] }
|
|
61
61
|
}
|
|
62
62
|
}
|
|
63
63
|
}
|
package/src/index.ts
CHANGED
|
@@ -8,7 +8,7 @@ const Fieldtypes= require( './type')
|
|
|
8
8
|
// const generate= require( './generate')
|
|
9
9
|
|
|
10
10
|
const fs = require( 'fs')
|
|
11
|
-
const createproject =require( './createproject')
|
|
11
|
+
// const createproject =require( './createproject')
|
|
12
12
|
const ps = require( "child_process")
|
|
13
13
|
const capitalizeFirstLetter= require( './libs')
|
|
14
14
|
const {Logger, ILogObj} = require( "tslog");
|
|
@@ -290,7 +290,7 @@ const getField = (
|
|
|
290
290
|
f.title = obj.title;
|
|
291
291
|
if (obj.description) f.description = obj.description;
|
|
292
292
|
if (obj.format) f.format = obj.format;
|
|
293
|
-
if (obj.examples) f.
|
|
293
|
+
if (obj.examples) f.example = obj.examples;
|
|
294
294
|
if (obj.default) {
|
|
295
295
|
f.default = obj.default;
|
|
296
296
|
} else {
|
package/src/type.ts
CHANGED
|
@@ -31,7 +31,7 @@ export type FieldModel = {
|
|
|
31
31
|
format?: string;
|
|
32
32
|
required?: boolean;
|
|
33
33
|
example?: any;
|
|
34
|
-
|
|
34
|
+
// examples?: any;
|
|
35
35
|
};
|
|
36
36
|
|
|
37
37
|
// export type SchemaCategoryModel = {
|
|
@@ -297,5 +297,5 @@ export interface SimpleAppJSONSchema7 {
|
|
|
297
297
|
default?: JSONSchema7Type | undefined;
|
|
298
298
|
readOnly?: boolean | undefined;
|
|
299
299
|
writeOnly?: boolean | undefined;
|
|
300
|
-
|
|
300
|
+
example?: JSONSchema7Type | undefined;
|
|
301
301
|
}
|
|
@@ -77,10 +77,11 @@ export class <%= it.typename %>Controller extends SimpleAppAbstractController<
|
|
|
77
77
|
@HttpCode(200)
|
|
78
78
|
@ApiResponse({
|
|
79
79
|
status: 200,
|
|
80
|
-
description: '
|
|
80
|
+
description: 'Sample 200 response',
|
|
81
|
+
type: Object
|
|
81
82
|
})
|
|
82
83
|
@ApiResponse({ status: 500, description: 'Internal error' })
|
|
83
|
-
@ApiOperation({ operationId: 'runDefault', description:"Run default behavior like say hello" })
|
|
84
|
+
@ApiOperation({ operationId: 'runDefault', description: "Run default behavior like say hello" })
|
|
84
85
|
async runDefault(@AppUser() appuser: UserContext) {
|
|
85
86
|
return await this.service.runDefault(appuser)
|
|
86
87
|
}
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
3
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
4
|
* last change 2024-07-10
|
|
5
|
-
* Author:
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
* Last Modified By: Yong Xiang
|
|
6
7
|
*/
|
|
7
8
|
import { UserContext } from '../commons/user.context'
|
|
8
9
|
import * as sharelibs from '../sharelibs'
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
* This file was automatically generated by simpleapp generator. Every
|
|
3
3
|
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
4
4
|
* last change 2024-07-10
|
|
5
|
-
* Author:
|
|
5
|
+
* Author: Ks Tan
|
|
6
|
+
* Last Modified By: Yong Xiang
|
|
6
7
|
*/
|
|
7
8
|
import _ from 'lodash'
|
|
8
9
|
import {SchemaType,NotificationStatus} from '~/types'
|
package/templates/nest/.env._eta
CHANGED
|
@@ -4,7 +4,7 @@ LOGGER="error,warn,fatal,log"
|
|
|
4
4
|
DRYRUN=false
|
|
5
5
|
PROJECT_NAME=SimpleApp Demo1
|
|
6
6
|
PROJECT_DESCRIPTION=Try CRUD
|
|
7
|
-
|
|
7
|
+
PROJECT_VERSION=1.0.0
|
|
8
8
|
MONGO_DB_URL=<%=it.configs.mongoConnectStr%>
|
|
9
9
|
|
|
10
10
|
MONGO_DB_NAME=<%=it.configs.mongoDbName%>
|
|
@@ -14,7 +14,7 @@ HTTP_PORT=<%=it.configs.backendPort%>
|
|
|
14
14
|
BPMN_PATH=./src/simpleapp/workflows/bpmn/
|
|
15
15
|
|
|
16
16
|
X_APIKEY=
|
|
17
|
-
|
|
17
|
+
X_API_SECRET=
|
|
18
18
|
|
|
19
19
|
OAUTH2_BASEURL=<%=it.configs.oauthSetting ? it.configs.oauthSetting.oauthBaseUrl : ''%>
|
|
20
20
|
|
|
@@ -27,6 +27,7 @@ async function bootstrap() {
|
|
|
27
27
|
|
|
28
28
|
const config = new DocumentBuilder()
|
|
29
29
|
.setTitle(process.env.PROJECT_NAME)
|
|
30
|
+
.addServer(process.env.BACKEND_URL)
|
|
30
31
|
.setDescription(process.env.PROJECT_DESCRIPTION)
|
|
31
32
|
.setVersion(process.env.PROJECT_VERSION)
|
|
32
33
|
.addApiKey(
|
|
@@ -53,19 +54,19 @@ async function bootstrap() {
|
|
|
53
54
|
addApiKey(
|
|
54
55
|
{
|
|
55
56
|
in: 'header',
|
|
56
|
-
name: 'x-
|
|
57
|
+
name: 'x-api-key',
|
|
57
58
|
type: 'apiKey',
|
|
58
59
|
description: 'optional only use for specal case',
|
|
59
60
|
},
|
|
60
|
-
'x-
|
|
61
|
+
'x-api-key',
|
|
61
62
|
).addApiKey(
|
|
62
63
|
{
|
|
63
64
|
in: 'header',
|
|
64
|
-
name: 'x-
|
|
65
|
+
name: 'x-api-secret',
|
|
65
66
|
type: 'apiKey',
|
|
66
67
|
description: 'optional only use for specal case',
|
|
67
68
|
},
|
|
68
|
-
'x-
|
|
69
|
+
'x-api-secret',
|
|
69
70
|
)
|
|
70
71
|
.addApiKey(
|
|
71
72
|
{
|
|
@@ -79,8 +80,8 @@ async function bootstrap() {
|
|
|
79
80
|
|
|
80
81
|
.addSecurityRequirements('x-org')
|
|
81
82
|
.addSecurityRequirements('oauth2')
|
|
82
|
-
.addSecurityRequirements('x-
|
|
83
|
-
.addSecurityRequirements('x-
|
|
83
|
+
.addSecurityRequirements('x-api-key')
|
|
84
|
+
.addSecurityRequirements('x-api-secret')
|
|
84
85
|
.addSecurityRequirements('x-guest-accesstoken')
|
|
85
86
|
.build();
|
|
86
87
|
const document = SwaggerModule.createDocument(app, config);
|
|
@@ -10,7 +10,7 @@ export class ApiKeyValuePair {
|
|
|
10
10
|
@ApiProperty({
|
|
11
11
|
type: Object,
|
|
12
12
|
required: false,
|
|
13
|
-
|
|
13
|
+
example: [{"field1": "1"}],
|
|
14
14
|
default: '',
|
|
15
15
|
})
|
|
16
16
|
field1: any;
|
|
@@ -24,14 +24,14 @@ export class ApiSearchBody {
|
|
|
24
24
|
@ApiProperty({
|
|
25
25
|
type: Object,
|
|
26
26
|
required: false,
|
|
27
|
-
|
|
27
|
+
example: [{"field1": "1"}],
|
|
28
28
|
default: { field1: 'ok', field2: true },
|
|
29
29
|
})
|
|
30
30
|
filter?: Object;
|
|
31
31
|
@ApiProperty({
|
|
32
32
|
type: [String],
|
|
33
33
|
required: false,
|
|
34
|
-
|
|
34
|
+
example: ['["field1","field2"]'],
|
|
35
35
|
default: ['field1', 'field2'],
|
|
36
36
|
})
|
|
37
37
|
fields?: string[];
|
|
@@ -44,7 +44,7 @@ export class ApiSearchBody {
|
|
|
44
44
|
type:'string'
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
|
|
47
|
+
example: ['[[ "field1", "asc" ]]'],
|
|
48
48
|
default: [['field1', 'asc']],
|
|
49
49
|
})
|
|
50
50
|
|
|
@@ -16,10 +16,10 @@ export class CustomKeycloakGuard implements CanActivate {
|
|
|
16
16
|
const request = context.switchToHttp().getRequest();
|
|
17
17
|
|
|
18
18
|
|
|
19
|
-
//graphql no http request, exclude from capability of x-
|
|
19
|
+
//graphql no http request, exclude from capability of x-api-key
|
|
20
20
|
if(request?.headers){
|
|
21
|
-
const apiKey = request.headers['x-
|
|
22
|
-
const apiSecret = request.headers['x-
|
|
21
|
+
const apiKey = request.headers['x-api-key'];
|
|
22
|
+
const apiSecret = request.headers['x-api-secret'];
|
|
23
23
|
// validate apikey and apisecret at middleware level, reach here mean approved as robot
|
|
24
24
|
if (apiKey && apiSecret ) {
|
|
25
25
|
return true;
|
|
@@ -23,10 +23,10 @@ import {
|
|
|
23
23
|
async canActivate(context: ExecutionContext): Promise<boolean> {
|
|
24
24
|
const request = context.switchToHttp().getRequest();
|
|
25
25
|
|
|
26
|
-
//graphql no http request, exclude from capability of x-
|
|
26
|
+
//graphql no http request, exclude from capability of x-api-key
|
|
27
27
|
if (request?.headers) {
|
|
28
|
-
const apiKey = request.headers['x-
|
|
29
|
-
const apiSecret = request.headers['x-
|
|
28
|
+
const apiKey = request.headers['x-api-key'];
|
|
29
|
+
const apiSecret = request.headers['x-api-secret'];
|
|
30
30
|
// validate apikey and apisecret at middleware level, reach here mean approved as robot
|
|
31
31
|
if (apiKey && apiSecret) {
|
|
32
32
|
return true;
|
|
@@ -69,10 +69,10 @@ export class TenantMiddleware implements NestMiddleware {
|
|
|
69
69
|
|
|
70
70
|
|
|
71
71
|
//if APIKEY defined, and there is api key and secret supplied. use robot user
|
|
72
|
-
if(process.env.X_APIKEY &&req.headers['x-
|
|
72
|
+
if(process.env.X_APIKEY &&req.headers['x-api-key'] && req.headers['x-api-secret']){
|
|
73
73
|
|
|
74
|
-
if(req.headers['x-
|
|
75
|
-
req.headers['x-
|
|
74
|
+
if(req.headers['x-api-key']==process.env.X_APIKEY &&
|
|
75
|
+
req.headers['x-api-secret']==process.env.X_API_SECRET){
|
|
76
76
|
|
|
77
77
|
u.setAsStaticUser(
|
|
78
78
|
'00000000-0000-0000-0000-000000000000',
|
|
@@ -58,7 +58,7 @@ export class UserContext {
|
|
|
58
58
|
protected ssoACL: any = {};
|
|
59
59
|
protected token: string = '';
|
|
60
60
|
protected refreshtoken: string = '';
|
|
61
|
-
//guest access token obtain from header 'x-guest-accesstoken', during use x-
|
|
61
|
+
//guest access token obtain from header 'x-guest-accesstoken', during use x-api-key/x-api-secret
|
|
62
62
|
protected guestToken?: string='';
|
|
63
63
|
protected guestInfo:{uid:string,uname:string,fullname:string,email:string} = {uid:'',uname:'',fullname:'',email:''}
|
|
64
64
|
protected groups: string[] = [];
|