@simitgroup/simpleapp-generator 1.0.32 → 1.0.35
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/.vscode/settings.json +3 -0
- package/README.md +185 -16
- package/buildinschemas copy/autoincreament.autoinc.jsonschema.json +39 -0
- package/buildinschemas copy/branch.branch.jsonschema.json +41 -0
- package/buildinschemas copy/docnoformat.docno.jsonschema.json +41 -0
- package/buildinschemas copy/organization.org.jsonschema.json +50 -0
- package/buildinschemas copy/permission.perm.jsonschema.json +23 -0
- package/buildinschemas copy/permission.perm.jsonschema.try.json +25 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.json +21 -0
- package/buildinschemas copy/tenant.tenant.jsonschema.try.json +27 -0
- package/buildinschemas copy/user.user.jsonschema.json +31 -0
- package/dist/buildinschemas/autoincreament.d.ts +3 -0
- package/dist/buildinschemas/autoincreament.d.ts.map +1 -0
- package/dist/buildinschemas/autoincreament.js +36 -0
- package/dist/buildinschemas/autoincreament.js.map +1 -0
- package/dist/buildinschemas/branch.d.ts +3 -0
- package/dist/buildinschemas/branch.d.ts.map +1 -0
- package/dist/buildinschemas/branch.js +41 -0
- package/dist/buildinschemas/branch.js.map +1 -0
- package/dist/buildinschemas/docnoformat.d.ts +3 -0
- package/dist/buildinschemas/docnoformat.d.ts.map +1 -0
- package/dist/buildinschemas/docnoformat.js +60 -0
- package/dist/buildinschemas/docnoformat.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +8 -0
- package/dist/buildinschemas/index.d.ts.map +1 -0
- package/dist/buildinschemas/index.js +18 -0
- package/dist/buildinschemas/index.js.map +1 -0
- package/dist/buildinschemas/organization.d.ts +3 -0
- package/dist/buildinschemas/organization.d.ts.map +1 -0
- package/dist/buildinschemas/organization.js +34 -0
- package/dist/buildinschemas/organization.js.map +1 -0
- package/dist/buildinschemas/permission.d.ts +3 -0
- package/dist/buildinschemas/permission.d.ts.map +1 -0
- package/dist/buildinschemas/permission.js +34 -0
- package/dist/buildinschemas/permission.js.map +1 -0
- package/dist/buildinschemas/tenant.d.ts +3 -0
- package/dist/buildinschemas/tenant.d.ts.map +1 -0
- package/dist/buildinschemas/tenant.js +41 -0
- package/dist/buildinschemas/tenant.js.map +1 -0
- package/dist/buildinschemas/user.d.ts +3 -0
- package/dist/buildinschemas/user.d.ts.map +1 -0
- package/dist/buildinschemas/user.js +31 -0
- package/dist/buildinschemas/user.js.map +1 -0
- package/dist/constant.d.ts +4 -0
- package/dist/constant.d.ts.map +1 -0
- package/dist/constant.js +2 -1
- package/dist/constant.js.map +1 -1
- package/dist/framework.d.ts +10 -0
- package/dist/framework.d.ts.map +1 -0
- package/dist/framework.js +120 -68
- 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.d.ts +2 -0
- package/dist/generate.d.ts.map +1 -0
- package/dist/generate.js +310 -230
- package/dist/generate.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +84 -20
- package/dist/index.js.map +1 -1
- package/dist/libs.d.ts +2 -0
- package/dist/libs.d.ts.map +1 -0
- package/dist/processors/groupsbuilder.js +2 -0
- package/dist/processors/groupsbuilder.js.map +1 -0
- package/dist/processors/jsonschemabuilder.d.ts +4 -0
- package/dist/processors/jsonschemabuilder.d.ts.map +1 -0
- package/dist/processors/jsonschemabuilder.js +146 -172
- 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/storage.d.ts +3 -0
- package/dist/storage.d.ts.map +1 -0
- package/dist/storage.js +2 -2
- package/dist/storage.js.map +1 -1
- package/dist/type.d.ts +164 -0
- package/dist/type.d.ts.map +1 -0
- package/dist/type.js +16 -1
- package/dist/type.js.map +1 -1
- package/dist/validation.d.ts +1 -0
- package/dist/validation.d.ts.map +1 -0
- package/documentation/designconcept.bpmn +349 -0
- package/documentation/documentation.png +0 -0
- package/documentation/infra.drawio +141 -0
- package/documentation/infra.png +0 -0
- package/documentation/management.drawio +57 -0
- package/documentation/stack.drawio +106 -0
- package/package.json +3 -1
- package/src/buildinschemas/autoincreament.ts +34 -0
- package/src/buildinschemas/branch.ts +39 -0
- package/src/buildinschemas/docnoformat.ts +58 -0
- package/src/buildinschemas/index.ts +7 -0
- package/src/buildinschemas/organization.ts +31 -0
- package/src/buildinschemas/permission.ts +31 -0
- package/src/buildinschemas/tenant.ts +38 -0
- package/src/buildinschemas/user.ts +28 -0
- package/src/constant.ts +2 -1
- package/src/framework.ts +126 -67
- package/src/generate.ts +327 -266
- package/src/generate.ts.backup +339 -0
- package/src/index.ts +93 -18
- package/src/processors/jsonschemabuilder.ts +199 -226
- package/src/processors/jsonschemabuilder.ts-old +383 -0
- package/src/storage.ts +1 -1
- package/src/type.ts +94 -27
- package/templates/basic/nest/controller.ts.eta +255 -0
- package/templates/basic/nest/default.ts.eta +42 -0
- package/templates/basic/{model.eta → nest/model.ts.eta} +18 -5
- package/templates/basic/nest/processor.ts.eta +129 -0
- package/templates/basic/nest/service.ts.eta +64 -0
- package/templates/basic/{type.eta → nest/type.ts.eta} +3 -3
- package/templates/basic/nuxt/default.ts.eta +42 -0
- package/templates/basic/{pageindex.vue.eta → nuxt/pages.crud.vue.eta} +85 -22
- package/templates/basic/nuxt/simpleapp.doc.ts.eta +11 -0
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +212 -0
- package/templates/nest/.env.eta +31 -0
- package/templates/nest/.gitignore.eta +40 -0
- package/templates/nest/src/app.controller.ts.eta +19 -0
- package/templates/nest/src/app.module.ts.eta +77 -0
- package/templates/nest/src/app.service.ts.eta +9 -0
- package/templates/nest/src/main.ts.eta +58 -0
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +16 -0
- package/templates/nest/src/simpleapp/generate/commons/decorators/appuser.decorator.ts.eta +8 -0
- package/templates/nest/src/simpleapp/generate/commons/dicts/foreignkeys.ts.eta +1 -0
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +101 -0
- package/templates/nest/src/simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta +39 -0
- package/templates/nest/src/simpleapp/generate/commons/interceptors/response.interceptor.ts.eta +38 -0
- package/templates/nest/src/simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta +88 -0
- package/templates/nest/{Workflow.eta → src/simpleapp/generate/commons/providers/workflow.provider.ts.etax} +20 -14
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.decorator.ts.eta +6 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.enum.ts.eta +28 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.group.ts.eta +10 -0
- package/templates/nest/src/simpleapp/generate/commons/roles/roles.guard.ts.eta +34 -0
- package/templates/nest/src/simpleapp/generate/commons/user.context.ts.eta +391 -0
- package/templates/nest/src/simpleapp/generate/controllers/simpleapp.controller.ts.eta +71 -0
- package/templates/nest/src/simpleapp/generate/models/perm.model.ts.eta +53 -0
- package/templates/nest/src/simpleapp/generate/models/tenant.model.ts.eta +45 -0
- package/templates/nest/src/simpleapp/generate/models/user.model.ts.eta +57 -0
- package/templates/nest/src/simpleapp/generate/processors/simpleapp.processor.ts.eta +624 -0
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +19 -0
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts.eta +74 -0
- package/templates/nest/src/simpleapp/profile/profile.controller.ts.eta +110 -0
- package/templates/nest/src/simpleapp/profile/profile.service.ts.eta +195 -0
- package/templates/nest/src/simpleapp/profile/profile.types.ts.eta +18 -0
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.eta +89 -0
- package/templates/nest/src/simpleapp/services/branch.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/services/docno.service.ts.eta +93 -0
- package/templates/nest/src/simpleapp/services/org.service.ts.eta +67 -0
- package/templates/nest/src/simpleapp/services/perm.service.ts.eta +102 -0
- package/templates/nest/src/simpleapp/services/tenant.service.ts.eta +69 -0
- package/templates/nest/src/simpleapp/services/user.service.ts.eta +66 -0
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +43 -0
- package/templates/nuxt/.env.eta +21 -0
- package/templates/nuxt/.gitignore.eta +28 -0
- package/templates/nuxt/app.vue.eta +5 -2
- package/templates/nuxt/assets/css/tailwind.css.eta +35 -0
- package/templates/nuxt/components/CrudNestedDoc.vue.eta +164 -0
- package/templates/nuxt/components/CrudSimple.vue.eta +179 -0
- package/templates/nuxt/{components.debugdocdata.vue.eta → components/DebugDocumentData.vue.eta} +4 -1
- package/templates/nuxt/{components.eventmonitor.vue.eta → components/EventMonitor.vue.eta} +27 -27
- package/templates/nuxt/components/Invitation.vue.eta +50 -0
- package/templates/nuxt/components/Menus.vue.eta +58 -0
- package/templates/nuxt/components/PermissionInfo.vue.eta +92 -0
- package/templates/nuxt/components/SimpleAppAutocomplete.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppAutocompletemulti.vue.eta +73 -0
- package/templates/nuxt/components/SimpleAppCalendar.vue.eta +55 -0
- package/templates/nuxt/components/SimpleAppCheckbox.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppChip.vue.eta +28 -0
- package/templates/nuxt/components/SimpleAppColor.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppDatatable.vue.eta +20 -0
- package/templates/nuxt/components/SimpleAppDocumentNo.vue.eta +90 -0
- package/templates/nuxt/components/SimpleAppDynamicInput.vue.eta +29 -0
- package/templates/nuxt/components/SimpleAppEditor.vue.eta +31 -0
- package/templates/nuxt/components/SimpleAppForm.vue.eta +131 -0
- package/templates/nuxt/components/SimpleAppInputTable.vue.eta +104 -0
- package/templates/nuxt/components/SimpleAppList.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppListmulti.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppNumber.vue.eta +32 -0
- package/templates/nuxt/components/SimpleAppPassword.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppRadio.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppRating.vue.eta +41 -0
- package/templates/nuxt/components/SimpleAppSelect.vue.eta +38 -0
- package/templates/nuxt/components/SimpleAppSelectmulti.vue.eta +39 -0
- package/templates/nuxt/components/SimpleAppSlider.vue.eta +42 -0
- package/templates/nuxt/components/SimpleAppSwitch.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppText.vue.eta +50 -0
- package/templates/nuxt/components/SimpleAppTextarea.vue.eta +30 -0
- package/templates/nuxt/components/SimpleAppValue.vue.eta +86 -0
- package/templates/nuxt/components/SimpleFieldContainer.vue.eta +102 -0
- package/templates/nuxt/components/XorgPicker.vue.eta +66 -0
- package/templates/nuxt/components/helper.ts.eta +90 -0
- package/templates/nuxt/components/type.ts.eta +32 -0
- package/templates/nuxt/composables/docformat.generate.ts.eta +5 -0
- package/templates/nuxt/{composables.getautocomplete.ts.eta → composables/getAutocomplete.generate.ts.eta} +4 -5
- package/templates/nuxt/{composables.getmenus.ts.eta → composables/getMenus.generate.ts.eta} +22 -7
- package/templates/nuxt/composables/getOpenApi.generate.ts.eta +6 -0
- package/templates/nuxt/composables/getTenant.generate.ts.eta +4 -0
- package/templates/nuxt/composables/getUserStore.generate.ts.eta +22 -0
- package/templates/nuxt/composables/logout.generate.ts.eta +22 -0
- package/templates/nuxt/composables/roles.generate.ts.eta +48 -0
- package/templates/nuxt/composables/stringHelper.generate.ts.eta +5 -0
- package/templates/nuxt/{layouts.default.vue.eta → layouts/default.vue.eta} +2 -0
- package/templates/nuxt/middleware/10.acl.global.ts.eta +38 -0
- package/templates/nuxt/nuxt.config.ts.eta +12 -2
- package/templates/nuxt/pages/[xorg]/branch/index.vue.eta +102 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/[id].vue.eta +17 -0
- package/templates/nuxt/pages/[xorg]/docnoformat/index.vue.eta +269 -0
- package/templates/nuxt/pages/[xorg]/index.vue.eta +36 -0
- package/templates/nuxt/pages/[xorg]/organization/index.vue.eta +148 -0
- package/templates/nuxt/pages/[xorg]/permission/index.vue.eta +280 -0
- package/templates/nuxt/pages/[xorg]/tenant/index.vue.eta +93 -0
- package/templates/nuxt/pages/[xorg]/user/index.vue.eta +468 -0
- package/templates/nuxt/pages/index.vue.eta +191 -0
- package/templates/nuxt/pages/login.vue.eta +21 -0
- package/templates/nuxt/plugins/10.simpleapp-event.ts.eta +53 -0
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +155 -0
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +23 -0
- package/templates/nuxt/{server.api.ts.eta → server/api/[xorg]/[...].ts.eta} +5 -2
- package/templates/nuxt/server/api/auth/[...].ts.eta +68 -0
- package/templates/nuxt/{server.api.auth.logout.ts.eta → server/api/auth/logout.ts.eta} +1 -3
- package/templates/nuxt/server/api/profile/[...].ts.eta +150 -0
- package/templates/nuxt/server/api/profile/index.ts.eta +103 -0
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +187 -0
- package/templates/nuxt/simpleapp/generate/commons/documents.ts.eta +6 -0
- package/templates/nuxt/simpleapp/generate/commons/events.ts.eta +5 -0
- package/templates/nuxt/simpleapp/generate/commons/groups.ts.eta +11 -0
- package/templates/nuxt/simpleapp/generate/commons/roles.ts.eta +21 -0
- package/templates/nuxt/types/index.ts.eta +65 -0
- package/templates/project/README.md +11 -0
- package/templates/project/build.sh.eta +17 -0
- package/templates/project/config.json.eta +2 -0
- package/templates/project/generate.ts.eta +10 -0
- package/templates/project/schemas/category.ts.eta +26 -0
- package/templates/project/schemas/index.ts.eta +5 -0
- package/templates/project/schemas/product.ts.eta +59 -0
- package/templates/project/shares/hello.ts.eta +1 -0
- package/templates/project/shares/index.ts.eta +2 -0
- package/tsconfig.json +9 -2
- package/tsconfig.tsbuildinfo +1 -0
- package/definations/category.cat.jsonschema.json +0 -55
- package/definations/level.lvl.jsonschema.json +0 -48
- package/definations/product.prd.jsonschema.json +0 -46
- package/templates/basic/controller.eta +0 -152
- package/templates/basic/module.eta +0 -22
- package/templates/basic/service.eta +0 -62
- package/templates/basic/simpleappclient.eta +0 -120
- package/templates/nest/SimpleAppController.eta +0 -69
- package/templates/nest/SimpleAppService.eta +0 -366
- package/templates/nest/TenantMiddleware.eta +0 -34
- package/templates/nest/UserProvider.eta +0 -127
- package/templates/nest/app.controller.eta +0 -12
- package/templates/nest/app.module.eta +0 -64
- package/templates/nest/app.service.eta +0 -8
- package/templates/nest/inputvalidation-exception.eta +0 -6
- package/templates/nest/nest.env.eta +0 -28
- package/templates/nest/nest.main.eta +0 -31
- package/templates/nuxt/components.crudsimple.vue.eta +0 -124
- package/templates/nuxt/components.menus.vue.eta +0 -35
- package/templates/nuxt/env.eta +0 -17
- package/templates/nuxt/pages.[xorg].index.vue.eta +0 -20
- package/templates/nuxt/pages.index.vue.eta +0 -72
- package/templates/nuxt/pages.login.vue.eta +0 -20
- package/templates/nuxt/plugins.simpleapp.ts.eta +0 -88
- package/templates/nuxt/server.api.auth[...].ts.eta +0 -233
- package/templates/nuxt/tailwind.css.eta +0 -49
- /package/templates/basic/{apischema.eta → nest/apischema.ts.eta} +0 -0
- /package/templates/basic/{jsonschema.eta → nest/jsonschema.ts.eta} +0 -0
- /package/templates/basic/{pageindexwithid.vue.eta → nuxt/pages.[id].vue.eta} +0 -0
- /package/templates/nest/{oauth2-redirect.eta → public_html/oauth2-redirect.html.eta} +0 -0
|
@@ -0,0 +1,383 @@
|
|
|
1
|
+
// import { ExceptionsHandler } from '@nestjs/core/exceptions/exceptions-handler';
|
|
2
|
+
import { JSONSchema7, JSONSchema7Definition,JSONSchema7Array,JSONSchema7TypeName } from 'json-schema';
|
|
3
|
+
import * as js7 from 'json-schema';
|
|
4
|
+
import { capitalizeFirstLetter } from '../libs';
|
|
5
|
+
import {JsonSchemaProperties,MyForeignKey} from "../type"
|
|
6
|
+
import { Logger, ILogObj } from "tslog";
|
|
7
|
+
import $RefParser from "@apidevtools/json-schema-ref-parser";
|
|
8
|
+
import {foreignkeys} from '../storage'
|
|
9
|
+
// import { ConflictException } from '@nestjs/common';
|
|
10
|
+
import {
|
|
11
|
+
FieldModel,
|
|
12
|
+
Fieldtypes,
|
|
13
|
+
ChildModels,
|
|
14
|
+
SchemaModel,
|
|
15
|
+
TypeForeignKey,
|
|
16
|
+
TypeForeignKeyCatalogue,
|
|
17
|
+
DocSetting,ApiSetting,DocStatusSetting,
|
|
18
|
+
|
|
19
|
+
} from '../type';
|
|
20
|
+
import { json } from 'stream/consumers';
|
|
21
|
+
const log: Logger<ILogObj> = new Logger();
|
|
22
|
+
|
|
23
|
+
const X_DOCUMENT_NO='x-document-no'
|
|
24
|
+
const X_DOCUMENT_LABEL='x-document-label'
|
|
25
|
+
const X_AUTOCOMPLETE_FIELD='x-autocomplete-field'
|
|
26
|
+
const X_DOCUMENT_NAME='x-document-name'
|
|
27
|
+
const X_DOCUMENT_TYPE='x-document-type'
|
|
28
|
+
const X_COLLECTION_NAME='x-document-collection'
|
|
29
|
+
const X_DOCUMENT_STATUS='x-document-status'
|
|
30
|
+
const X_DOCUMENT_API='x-document-api'
|
|
31
|
+
const X_IGNORE_AUTOCOMPLETE='x-ignore-autocomplete'
|
|
32
|
+
const FOREIGNKEY_PROPERTY='x-foreignkey'
|
|
33
|
+
|
|
34
|
+
const FORMAT_TEL='tel'
|
|
35
|
+
const FORMAT_DOCNO='documentno'
|
|
36
|
+
const X_ISOLATION_TYPE='x-isolation-type'
|
|
37
|
+
|
|
38
|
+
let docSetting:DocSetting={} as DocSetting
|
|
39
|
+
|
|
40
|
+
let hasdocformat = false
|
|
41
|
+
let allmodels: ChildModels = {};
|
|
42
|
+
let fullschema={}
|
|
43
|
+
// let fieldAutoCompleteCode=''
|
|
44
|
+
// let fieldAutoCompleteName=''
|
|
45
|
+
let moreAutoComplete:string[]=[]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
const newDocSetting=(doctype:string,docname:string):DocSetting=>{
|
|
49
|
+
return {
|
|
50
|
+
docName:docname, //done
|
|
51
|
+
docType:doctype, //done
|
|
52
|
+
colDocNo:'', //done
|
|
53
|
+
colDocLabel:'', //done
|
|
54
|
+
collectionName:docname, //done
|
|
55
|
+
autocompleteFields:[],
|
|
56
|
+
docStatusSettings:[],
|
|
57
|
+
apiSettings:[],
|
|
58
|
+
requireautocomplete:true,
|
|
59
|
+
isolationtype:"org",
|
|
60
|
+
foreignkeys:{}
|
|
61
|
+
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
export const readJsonSchemaBuilder = async (
|
|
65
|
+
doctype: string,
|
|
66
|
+
docname: string,
|
|
67
|
+
orijsondata:JSONSchema7,
|
|
68
|
+
allforeignkeys:TypeForeignKeyCatalogue
|
|
69
|
+
) => {
|
|
70
|
+
docSetting=newDocSetting(doctype,docname)
|
|
71
|
+
hasdocformat=false
|
|
72
|
+
// fieldAutoCompleteCode=''
|
|
73
|
+
// fieldAutoCompleteName=''
|
|
74
|
+
moreAutoComplete=[]
|
|
75
|
+
allmodels = {};
|
|
76
|
+
|
|
77
|
+
const validateddata: JSONSchema7 = { ...orijsondata };
|
|
78
|
+
let schema: SchemaModel | SchemaModel[];
|
|
79
|
+
const tmpjsondata = await $RefParser.dereference(orijsondata).then((schema)=>{
|
|
80
|
+
// console.log("schema",doctype, schema['properties']['category']? schema['properties']['category']:'')
|
|
81
|
+
return schema
|
|
82
|
+
})
|
|
83
|
+
const jsondata:JSONSchema7 = {...tmpjsondata} as JSONSchema7
|
|
84
|
+
|
|
85
|
+
|
|
86
|
+
if (jsondata && jsondata.type == 'object') {
|
|
87
|
+
//no _id then need add
|
|
88
|
+
// console.log(jsondata)
|
|
89
|
+
schema = processObject(doctype,docname, jsondata)
|
|
90
|
+
// console.log("schema",schema)
|
|
91
|
+
} else if (jsondata.type == 'array') {
|
|
92
|
+
throw(`unsupport array type for ${docname}.${doctype}`)
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if(docSetting.colDocNo=='' && docSetting.requireautocomplete) {
|
|
96
|
+
log.error(`you shall define 1 field with property:'${X_DOCUMENT_NO}'`)
|
|
97
|
+
throw "missing field property"
|
|
98
|
+
}
|
|
99
|
+
if(docSetting.colDocLabel=='' && docSetting.requireautocomplete) {
|
|
100
|
+
log.error(`you shall define 1 field with property: '${X_DOCUMENT_LABEL}'}`)
|
|
101
|
+
throw "missing field property"
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return Promise.resolve(allmodels);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
|
|
108
|
+
const processObject = (doctype: string,
|
|
109
|
+
docname: string,
|
|
110
|
+
jsondata:JSONSchema7,) =>{
|
|
111
|
+
if(!jsondata['properties']){
|
|
112
|
+
throw ("Invalid json schema {doctype}.{docname}, no 'properties' defined")
|
|
113
|
+
}
|
|
114
|
+
log.info("processObject document type",doctype,docname)
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
//ensure some field exists, also override it
|
|
118
|
+
jsondata.properties['_id'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
119
|
+
jsondata.properties['doctype'] = {type: 'string', default:doctype, examples: [doctype],description: 'Control value, dont edit it',};
|
|
120
|
+
jsondata.properties['created'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
121
|
+
jsondata.properties['updated'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
122
|
+
jsondata.properties['createdby'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
123
|
+
jsondata.properties['updatedby'] = {type: 'string',description: 'Control value, dont edit it',};
|
|
124
|
+
|
|
125
|
+
if(doctype !='tenant'){
|
|
126
|
+
jsondata.properties['tenantId'] = {type: 'number',description: 'Control value, dont edit it',};
|
|
127
|
+
}
|
|
128
|
+
if(doctype !='org'){
|
|
129
|
+
jsondata.properties['orgId'] = {type: 'number',description: 'Control value, dont edit it',};
|
|
130
|
+
}
|
|
131
|
+
if(doctype !='branch'){
|
|
132
|
+
jsondata.properties['branchId'] = {type: 'number',description: 'Control value, dont edit it',};
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if(jsondata[X_ISOLATION_TYPE] && ['none','tenant','org','branch'].includes(jsondata[X_ISOLATION_TYPE]) ){
|
|
136
|
+
docSetting.isolationtype=jsondata[X_ISOLATION_TYPE]
|
|
137
|
+
}
|
|
138
|
+
if(jsondata[X_IGNORE_AUTOCOMPLETE] && jsondata[X_IGNORE_AUTOCOMPLETE]==true){
|
|
139
|
+
docSetting.requireautocomplete=false
|
|
140
|
+
}
|
|
141
|
+
if(jsondata[X_DOCUMENT_API] && Array.isArray(jsondata[X_DOCUMENT_API])){
|
|
142
|
+
// log.warn("x-document-api exists:")
|
|
143
|
+
// log.warn(jsondata[X_DOCUMENT_API])
|
|
144
|
+
for(let i=0; i<jsondata[X_DOCUMENT_API].length;i++){
|
|
145
|
+
|
|
146
|
+
const tmp:ApiSetting =jsondata[X_DOCUMENT_API][i]
|
|
147
|
+
// console.log(i,jsondata[X_DOCUMENT_API]['action'])
|
|
148
|
+
if(!tmp.action){
|
|
149
|
+
const errmsg = "x-document-api defined but undefine property 'action'"
|
|
150
|
+
log.error(errmsg)
|
|
151
|
+
|
|
152
|
+
throw errmsg
|
|
153
|
+
}
|
|
154
|
+
if(!tmp.method){
|
|
155
|
+
const errmsg = "x-document-api defined but undefine property 'method'"
|
|
156
|
+
log.error(errmsg)
|
|
157
|
+
throw errmsg
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
let isexists = false
|
|
161
|
+
for(let i =0; i< docSetting.apiSettings.length ; i++){
|
|
162
|
+
const apiobj = docSetting.apiSettings[i]
|
|
163
|
+
// log.info(docname," validate:tmp["+tmp['action']+"]==apiobj["+apiobj['action'] +"]&&tmp["+ tmp['method']+"] == apiobj["+apiobj['method']+"]")
|
|
164
|
+
if(tmp['action']==apiobj['action'] && tmp['method'] == apiobj['method']){
|
|
165
|
+
//skip
|
|
166
|
+
isexists=true
|
|
167
|
+
break;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
if(!isexists){
|
|
171
|
+
docSetting.apiSettings.push(tmp)
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
// log.warn("docSetting.apiSettings",docSetting.apiSettings)
|
|
176
|
+
if(jsondata[X_DOCUMENT_STATUS] && Array.isArray(jsondata[X_DOCUMENT_STATUS])){
|
|
177
|
+
for(let i=0; i<jsondata[X_DOCUMENT_STATUS].length;i++){
|
|
178
|
+
const tmp:DocStatusSetting =jsondata[X_DOCUMENT_STATUS][i]
|
|
179
|
+
if(tmp.statusCode ===undefined){
|
|
180
|
+
const errmsg = "x-document-status defined but undefine property 'statusCode'"
|
|
181
|
+
log.error(errmsg)
|
|
182
|
+
throw errmsg
|
|
183
|
+
}
|
|
184
|
+
if(!tmp.statusName ===undefined){
|
|
185
|
+
const errmsg = "x-document-status defined but undefine property 'statusName'"
|
|
186
|
+
log.error(errmsg)
|
|
187
|
+
throw errmsg
|
|
188
|
+
}
|
|
189
|
+
docSetting.docStatusSettings.push(tmp)
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// moreAutoComplete:docSetting.autocompleteFields,
|
|
194
|
+
// docStatusSettings:docSetting.docStatusSettings,
|
|
195
|
+
// apiSettings:docSetting.apiSettings,
|
|
196
|
+
// SchemaModel | SchemaModel[]
|
|
197
|
+
let data = genSchema(
|
|
198
|
+
capitalizeFirstLetter(docname),
|
|
199
|
+
'object',
|
|
200
|
+
jsondata.properties,
|
|
201
|
+
jsondata['required'] ?? [],
|
|
202
|
+
'$'
|
|
203
|
+
);
|
|
204
|
+
|
|
205
|
+
return data
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const genSchema = (docname: string,schematype: string,jsondata: JsonSchemaProperties,
|
|
209
|
+
requiredlist: string[] | undefined,parentpath:string): SchemaModel => {
|
|
210
|
+
const newmodel: SchemaModel = {};
|
|
211
|
+
const props = Object.getOwnPropertyNames(jsondata ??{});
|
|
212
|
+
// console.log('==== jsondata', jsondata);
|
|
213
|
+
console.log("requiredlist:::::",docname,"::::",requiredlist)
|
|
214
|
+
for (let i = 0; i < props.length; i++) {
|
|
215
|
+
const key = props[i];
|
|
216
|
+
|
|
217
|
+
//below is Object.assign use for force datatype compatibility
|
|
218
|
+
const obj:JSONSchema7={}
|
|
219
|
+
Object.assign(obj,jsondata[key]);
|
|
220
|
+
const objectitem:JSONSchema7= {} as JSONSchema7
|
|
221
|
+
Object.assign(objectitem,obj.items);
|
|
222
|
+
|
|
223
|
+
let isrequired = false
|
|
224
|
+
if(requiredlist && requiredlist.includes(key)){
|
|
225
|
+
isrequired=true
|
|
226
|
+
}
|
|
227
|
+
const newName: string = docname + capitalizeFirstLetter(key);
|
|
228
|
+
// log.info("property is:",key,newName,obj)
|
|
229
|
+
if(obj[X_DOCUMENT_NO]){
|
|
230
|
+
docSetting.colDocNo=key
|
|
231
|
+
if(obj['format'] && obj['format']==FORMAT_DOCNO){
|
|
232
|
+
hasdocformat=true
|
|
233
|
+
}else{
|
|
234
|
+
hasdocformat=false
|
|
235
|
+
obj.minLength=obj.minLength??1
|
|
236
|
+
jsondata[key]['minLength']=obj.minLength
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
}
|
|
240
|
+
if(obj[X_DOCUMENT_LABEL]){
|
|
241
|
+
docSetting.colDocLabel=key
|
|
242
|
+
obj.minLength=obj.minLength??1
|
|
243
|
+
jsondata[key]['minLength']=obj.minLength
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
//this field reserved for X_DOCUMENT_NO only
|
|
247
|
+
|
|
248
|
+
|
|
249
|
+
|
|
250
|
+
// if(obj[X_COLLECTION_NAME]){
|
|
251
|
+
// docSetting.collectionName=key
|
|
252
|
+
// }
|
|
253
|
+
|
|
254
|
+
|
|
255
|
+
if(obj[X_AUTOCOMPLETE_FIELD]){
|
|
256
|
+
docSetting.autocompleteFields.push(key)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
|
|
260
|
+
// if(obj.format && obj.format==FORMAT_TEL){
|
|
261
|
+
// obj.pattern=obj.pattern ?? '/^\d{7,15}$/gm'
|
|
262
|
+
// }
|
|
263
|
+
// if (obj.type == 'object' && obj.items ){
|
|
264
|
+
// console.log("Refer to another object",docname,': ',key,obj,obj.items)
|
|
265
|
+
|
|
266
|
+
// obj,obj.items
|
|
267
|
+
//foreignkeys
|
|
268
|
+
//FOREIGNKEY_PROPERTY
|
|
269
|
+
// newmodel[key] = 'Object';
|
|
270
|
+
// }
|
|
271
|
+
// else
|
|
272
|
+
if(obj[FOREIGNKEY_PROPERTY]){
|
|
273
|
+
// console.warn("FOREIGNKEY_PROPERTY exists",FOREIGNKEY_PROPERTY,obj[FOREIGNKEY_PROPERTY])
|
|
274
|
+
const masterdatacollection = obj[FOREIGNKEY_PROPERTY]
|
|
275
|
+
const clientdatacollection = docname.toLowerCase()
|
|
276
|
+
const foreignkeyidentity= key
|
|
277
|
+
const foreignkeypath = (obj.type=='object') ?`${parentpath}.${key}._id`:`${parentpath}.${key}`
|
|
278
|
+
|
|
279
|
+
if(docSetting.foreignkeys[masterdatacollection]){
|
|
280
|
+
docSetting.foreignkeys[masterdatacollection].push(foreignkeypath)
|
|
281
|
+
}else{
|
|
282
|
+
docSetting.foreignkeys[masterdatacollection]=[foreignkeypath]
|
|
283
|
+
}
|
|
284
|
+
if(!foreignkeys[masterdatacollection]){
|
|
285
|
+
let tmp:TypeForeignKey = {} as TypeForeignKey
|
|
286
|
+
tmp[clientdatacollection]=[foreignkeyidentity]
|
|
287
|
+
foreignkeys[masterdatacollection] = tmp
|
|
288
|
+
}
|
|
289
|
+
else if(!foreignkeys[masterdatacollection][clientdatacollection]){
|
|
290
|
+
foreignkeys[masterdatacollection][clientdatacollection]=[foreignkeyidentity]
|
|
291
|
+
}else{
|
|
292
|
+
foreignkeys[masterdatacollection][clientdatacollection].push(foreignkeyidentity)
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
if (obj.type == 'object') {
|
|
298
|
+
|
|
299
|
+
genSchema(newName, obj.type, obj.properties, obj.required,`${parentpath}.${key}`);
|
|
300
|
+
newmodel[key] = newName;
|
|
301
|
+
} else if (obj.type == 'array' && obj.items && objectitem?.type == 'object') {
|
|
302
|
+
const childprops = objectitem?.properties
|
|
303
|
+
if(!childprops['created']){
|
|
304
|
+
childprops['created']={type:'string',description:'iso8601 dataempty mean new record'}
|
|
305
|
+
}
|
|
306
|
+
if(!childprops['updated']){
|
|
307
|
+
childprops['updated']={type:'string',description:'iso8601 or empty'}
|
|
308
|
+
}
|
|
309
|
+
if(!childprops['createdby']){
|
|
310
|
+
childprops['createdby']={type:'string'}
|
|
311
|
+
}
|
|
312
|
+
if(!childprops['updatedby']){
|
|
313
|
+
childprops['updatedby']={type:'string'}
|
|
314
|
+
}
|
|
315
|
+
if(!childprops['_id']){
|
|
316
|
+
childprops['_id']={type:'string'}
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
genSchema(newName, obj.type, objectitem?.properties, obj.items['required'],`${parentpath}.${key}[*]`);
|
|
320
|
+
newmodel[key] = [newName];
|
|
321
|
+
} else if (obj.type == 'array' && objectitem?.type != 'object') {
|
|
322
|
+
//array need submodel
|
|
323
|
+
// genSchema(newName, obj.type, obj.items.properties);
|
|
324
|
+
const objecttype:string = objectitem.type?.toString() ?? 'string'
|
|
325
|
+
newmodel[key] = [objecttype];
|
|
326
|
+
} else {
|
|
327
|
+
newmodel[key] = getField(key, obj, isrequired);
|
|
328
|
+
// console.log(key,'--------newmodel',obj, newmodel[key]);
|
|
329
|
+
}
|
|
330
|
+
}
|
|
331
|
+
allmodels[docname] = {
|
|
332
|
+
type: schematype,
|
|
333
|
+
model: newmodel,
|
|
334
|
+
codeField: docSetting.colDocNo ,
|
|
335
|
+
nameField: docSetting.colDocLabel,
|
|
336
|
+
moreAutoComplete:docSetting.autocompleteFields,
|
|
337
|
+
docStatusSettings:docSetting.docStatusSettings,
|
|
338
|
+
apiSettings:docSetting.apiSettings,
|
|
339
|
+
requireautocomplete:docSetting.requireautocomplete,
|
|
340
|
+
isolationtype:docSetting.isolationtype,
|
|
341
|
+
hasdocformat:hasdocformat,
|
|
342
|
+
foreignkeys: docSetting.foreignkeys
|
|
343
|
+
};
|
|
344
|
+
// console.warn("-------------apiSettings-----",docname,"::::",docSetting.apiSettings)
|
|
345
|
+
return newmodel;
|
|
346
|
+
};
|
|
347
|
+
|
|
348
|
+
const getField = (
|
|
349
|
+
fieldname: string,
|
|
350
|
+
obj: JSONSchema7,
|
|
351
|
+
isrequired: boolean | undefined,
|
|
352
|
+
): FieldModel => {
|
|
353
|
+
let datatype: Fieldtypes = obj.type as Fieldtypes
|
|
354
|
+
// console.log(datatype)
|
|
355
|
+
//Fieldtypes.string;
|
|
356
|
+
let format = obj.format;
|
|
357
|
+
if (obj.type == 'integer') {
|
|
358
|
+
datatype = Fieldtypes.number;
|
|
359
|
+
format = 'integer';
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
const f: FieldModel = {
|
|
363
|
+
type: datatype,
|
|
364
|
+
// oritype: obj.type,
|
|
365
|
+
required: isrequired,
|
|
366
|
+
};
|
|
367
|
+
|
|
368
|
+
if (obj.title) f.title = obj.title;
|
|
369
|
+
if (obj.description) f.description = obj.description;
|
|
370
|
+
if (obj.format) f.format = obj.format;
|
|
371
|
+
if (obj.examples) f.examples = obj.examples;
|
|
372
|
+
if (obj.default) {
|
|
373
|
+
f.default = obj.default;
|
|
374
|
+
} else {
|
|
375
|
+
if (f.type == 'string') f.default = '';
|
|
376
|
+
else if (f.type == 'number' || f.type == 'integer') f.default = 0;
|
|
377
|
+
else if (f.type == 'boolean') f.default = false;
|
|
378
|
+
else if (f.type == 'array') f.default = [];
|
|
379
|
+
else f.default = {};
|
|
380
|
+
}
|
|
381
|
+
return f;
|
|
382
|
+
};
|
|
383
|
+
|
package/src/storage.ts
CHANGED
package/src/type.ts
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { allforeignkeys } from './storage';
|
|
2
|
+
import { JSONSchema7, JSONSchema7Definition,JSONSchema7Object } from 'json-schema';
|
|
2
3
|
export type ChildModels = {
|
|
3
4
|
[key: string]: {
|
|
4
5
|
type: string;
|
|
5
6
|
model: SchemaModel,
|
|
6
7
|
codeField:string,
|
|
7
8
|
nameField:string,
|
|
8
|
-
moreAutoComplete
|
|
9
|
-
docStatusSettings
|
|
10
|
-
apiSettings
|
|
11
|
-
requireautocomplete: boolean
|
|
9
|
+
moreAutoComplete?:string[],
|
|
10
|
+
docStatusSettings?:DocumentStatus[],
|
|
11
|
+
apiSettings?:DocumentApi[],
|
|
12
|
+
// requireautocomplete: boolean
|
|
12
13
|
isolationtype:string
|
|
14
|
+
hasdocformat:boolean,
|
|
15
|
+
foreignkeys:MyForeignKey
|
|
13
16
|
};
|
|
14
17
|
};
|
|
15
18
|
export enum Fieldtypes {
|
|
@@ -45,6 +48,13 @@ export type JsonSchemaProperties= {
|
|
|
45
48
|
// JSONSchema7Definition ,JSONSchema7
|
|
46
49
|
}
|
|
47
50
|
|
|
51
|
+
//foreign key setting in current document
|
|
52
|
+
export type MyForeignKey = {
|
|
53
|
+
[collectionname:string]:string[]
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
//centralize foreignkey catalogue for all document
|
|
48
58
|
export type TypeForeignKeyCatalogue = {
|
|
49
59
|
[cataloguename:string]:TypeForeignKey
|
|
50
60
|
}
|
|
@@ -54,6 +64,8 @@ export type TypeForeignKey={
|
|
|
54
64
|
export type ModuleObject = {
|
|
55
65
|
doctype:string
|
|
56
66
|
docname:string
|
|
67
|
+
pagetype:string
|
|
68
|
+
api:DocumentApi[]
|
|
57
69
|
}
|
|
58
70
|
export type TypeGenerateDocumentVariable ={
|
|
59
71
|
name: string
|
|
@@ -73,28 +85,14 @@ frontEndCode: string
|
|
|
73
85
|
backEndCode: string
|
|
74
86
|
controllerCode:string
|
|
75
87
|
apiSchemaCode:string
|
|
76
|
-
docStatusSettings:
|
|
77
|
-
apiSettings:
|
|
78
|
-
requireautocomplete:boolean,
|
|
88
|
+
docStatusSettings:DocumentStatus[],
|
|
89
|
+
apiSettings:DocumentApi[],
|
|
79
90
|
isolationtype:string
|
|
80
|
-
|
|
91
|
+
hasdocformat:boolean,
|
|
92
|
+
foreignkeys: MyForeignKey
|
|
81
93
|
|
|
82
|
-
export type DocStatusSetting = {
|
|
83
|
-
statusCode:string,
|
|
84
|
-
statusName:string,
|
|
85
|
-
allowApi:string[],
|
|
86
|
-
readonly?:boolean,
|
|
87
|
-
description?:''
|
|
88
94
|
}
|
|
89
95
|
|
|
90
|
-
export type ApiSetting = {
|
|
91
|
-
method:string,
|
|
92
|
-
action:string,
|
|
93
|
-
setDocStatus?:'',
|
|
94
|
-
description?:'',
|
|
95
|
-
bpmnApi?:'',
|
|
96
|
-
data?:any
|
|
97
|
-
}
|
|
98
96
|
export type DocSetting = {
|
|
99
97
|
docName:string,
|
|
100
98
|
docType:string,
|
|
@@ -102,8 +100,77 @@ export type DocSetting = {
|
|
|
102
100
|
colDocLabel:string,
|
|
103
101
|
collectionName:string,
|
|
104
102
|
autocompleteFields:string[],
|
|
105
|
-
docStatusSettings:
|
|
106
|
-
apiSettings:
|
|
107
|
-
requireautocomplete:boolean
|
|
103
|
+
docStatusSettings:DocumentStatus[],
|
|
104
|
+
apiSettings:DocumentApi[],
|
|
105
|
+
// requireautocomplete:boolean
|
|
108
106
|
isolationtype:string
|
|
109
|
-
|
|
107
|
+
foreignkeys: MyForeignKey
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
export type DocumentStatus = {
|
|
111
|
+
status:string //'CO', 'V', 'CL', 'D' and etc
|
|
112
|
+
statusName:string
|
|
113
|
+
readOnly:boolean
|
|
114
|
+
actions: string[] //api name ['confirm','revert','close','void' and etc]
|
|
115
|
+
}
|
|
116
|
+
export enum RESTMethods {'post'='post','get'='get', 'delete'='delete','put'='put', 'patch'='patch'}
|
|
117
|
+
export type DocumentApi = {
|
|
118
|
+
action:string //api action name
|
|
119
|
+
entrypoint:string //api entry point example:':id', ':id/confirm'
|
|
120
|
+
querypara?:string[] //what query parameter wish to accept, example: ['description','date']
|
|
121
|
+
requiredrole?: string[] // what special user role wish to allow for this api, example: ['SuperUser']
|
|
122
|
+
method:RESTMethods
|
|
123
|
+
execute:string, //what service class method name to execute, example: 'ping','getDocumentName'
|
|
124
|
+
description:string //description of api
|
|
125
|
+
}
|
|
126
|
+
export enum IsolationType {"none"="none" , "tenant"="tenant","org"="org", "branch"="branch"}
|
|
127
|
+
export type ImportLibs = {"lib":string,"as":string}
|
|
128
|
+
export type Formula = {
|
|
129
|
+
"jsonpath":string //example: "$.subtotal","$.details[*]"
|
|
130
|
+
"formula":string //example "jslib.getDocumentSubTotal(@F{$.details})"
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export type SchemaConfig = {
|
|
134
|
+
isolationType: IsolationType
|
|
135
|
+
requiredRoles?:string[]
|
|
136
|
+
pageType?: string
|
|
137
|
+
uniqueKey?:string
|
|
138
|
+
documentTitle?:string
|
|
139
|
+
generateDocumentNumber?:boolean
|
|
140
|
+
documentDate?:string
|
|
141
|
+
allStatus?:DocumentStatus[]
|
|
142
|
+
additionalApis?:DocumentApi[]
|
|
143
|
+
additionalAutoCompleteFields ?: string[]
|
|
144
|
+
libs?:ImportLibs[] // both process class and frontend client class will import same lib
|
|
145
|
+
formulas?: Formula[]
|
|
146
|
+
documentType: string
|
|
147
|
+
documentName: string
|
|
148
|
+
collectionName?: string
|
|
149
|
+
foreignKeys?:MyForeignKey,
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// export type DefaultSchemaDefinitions = {
|
|
153
|
+
// [key:string]:JSONSchema7Object
|
|
154
|
+
// }
|
|
155
|
+
export type ForeignKeyProperty = {'x-foreignkey' ?:string}
|
|
156
|
+
export type SchemaFields = {
|
|
157
|
+
_id: JSONSchema7
|
|
158
|
+
tenantId: JSONSchema7 & ForeignKeyProperty
|
|
159
|
+
orgId: JSONSchema7 & ForeignKeyProperty
|
|
160
|
+
branchId: JSONSchema7 & ForeignKeyProperty
|
|
161
|
+
created: JSONSchema7
|
|
162
|
+
updated: JSONSchema7
|
|
163
|
+
createdby: JSONSchema7
|
|
164
|
+
updatedby: JSONSchema7
|
|
165
|
+
[key:string]:JSONSchema7 & ForeignKeyProperty
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export type AdditionalSchemaType = {
|
|
169
|
+
"x-simpleapp-config":SchemaConfig
|
|
170
|
+
properties: SchemaFields
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export type SchemaType = JSONSchema7 & AdditionalSchemaType
|
|
174
|
+
|
|
175
|
+
|
|
176
|
+
|