@simitgroup/simpleapp-generator 1.6.7-o-alpha → 2.0.0-a-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ReleaseNote.md +4 -0
- package/dist/buildinschemas/autoincreament.js +1 -1
- package/dist/buildinschemas/branch.d.ts.map +1 -1
- package/dist/buildinschemas/branch.js +2 -0
- package/dist/buildinschemas/branch.js.map +1 -1
- package/dist/buildinschemas/docnoformat.js +1 -1
- package/dist/buildinschemas/docnoformat.js.map +1 -1
- package/dist/buildinschemas/documentevent.js +1 -1
- package/dist/buildinschemas/documentnoformat.d.ts +3 -0
- package/dist/buildinschemas/documentnoformat.d.ts.map +1 -0
- package/dist/buildinschemas/documentnoformat.js +58 -0
- package/dist/buildinschemas/documentnoformat.js.map +1 -0
- package/dist/buildinschemas/index.d.ts +0 -5
- package/dist/buildinschemas/index.d.ts.map +1 -1
- package/dist/buildinschemas/index.js +5 -11
- package/dist/buildinschemas/index.js.map +1 -1
- package/dist/buildinschemas/organization.d.ts.map +1 -1
- package/dist/buildinschemas/organization.js +3 -19
- package/dist/buildinschemas/organization.js.map +1 -1
- package/dist/buildinschemas/user.d.ts.map +1 -1
- package/dist/buildinschemas/user.js +5 -2
- package/dist/buildinschemas/user.js.map +1 -1
- package/dist/generate.d.ts.map +1 -1
- package/dist/generate.js +118 -23
- package/dist/generate.js.map +1 -1
- package/dist/type.d.ts +6 -0
- package/dist/type.d.ts.map +1 -1
- package/dist/type.js.map +1 -1
- package/package.json +1 -1
- package/src/buildinschemas/{autoincreament.ts → autoincreament.ts.backup} +1 -1
- package/src/buildinschemas/branch.ts +2 -0
- package/src/buildinschemas/{documentevent.ts → documentevent.ts.backup} +1 -1
- package/src/buildinschemas/{docnoformat.ts → documentnoformat.ts.backup} +3 -3
- package/src/buildinschemas/index.ts +4 -5
- package/src/buildinschemas/organization.ts +3 -19
- package/src/buildinschemas/user.ts +5 -2
- package/src/generate.ts +128 -28
- package/src/type.ts +6 -1
- package/templates/basic/nest/api.controller.ts.eta +153 -0
- package/templates/basic/nest/api.module.ts.eta +32 -0
- package/templates/basic/nest/api.resolver.ts.eta +94 -0
- package/templates/basic/nest/api.schema.ts.eta +20 -0
- package/templates/basic/nest/api.service.ts.eta +85 -0
- package/templates/basic/nest/controller.ts.eta +18 -119
- package/templates/basic/nest/default.ts.eta +16 -10
- package/templates/basic/nest/enum.ts.eta +16 -0
- package/templates/basic/nest/model.ts.eta +6 -28
- package/templates/basic/nest/module.ts.eta +25 -0
- package/templates/basic/nest/resolver.ts.eta +12 -56
- package/templates/basic/nest/schema.ts.eta +133 -0
- package/templates/basic/nest/service.ts.eta +82 -73
- package/templates/basic/nest/service.ts.eta-backup +50 -0
- package/templates/basic/nuxt/default.ts.eta +10 -8
- package/templates/basic/nuxt/pages.[id].vue.eta +2 -2
- package/templates/basic/nuxt/pages.form.vue.eta +2 -2
- package/templates/basic/nuxt/pages.viewer.vue.eta +2 -2
- package/templates/basic/nuxt/simpleapp.doc.ts.eta +1 -1
- package/templates/basic/nuxt/simpleapp.generate.client.ts.eta +7 -5
- package/templates/nest/src/app.module.ts._eta +53 -69
- package/templates/nest/src/main.ts._eta +1 -1
- package/templates/nest/src/simple-app/.core/features/auth/api-key/api-key.service.ts.eta +29 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/api-key.type.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/validators/interface.ts.eta +7 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/validators/mini-api-key.validator.ts.eta +30 -0
- package/templates/nest/src/simple-app/.core/features/auth/api-key/validators/static-api-key.validator.ts.eta +27 -0
- package/templates/nest/src/simple-app/.core/features/auth/auth.module.ts.eta +9 -0
- package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.enum.ts.eta +7 -7
- package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.guard.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.model.ts.eta +10 -0
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.module.ts.eta +18 -0
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.schema.ts.eta +119 -0
- package/templates/nest/src/simple-app/.core/features/auto-increament/auto-increament.service.ts.eta +65 -0
- package/templates/nest/src/simple-app/.core/features/cron/base/cron.base.ts.eta +13 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron-system/cron-system.module.ts.eta +17 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron-system/cron-system.service.ts.eta +37 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron-system/schemas/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/cron/cron.module.ts.eta +10 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.controller.ts.eta +31 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.model.ts.eta +15 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.module.ts.eta +12 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.schema.ts.eta +162 -0
- package/templates/nest/src/simple-app/.core/features/document-no-format/document-no-format.service.ts.eta +189 -0
- package/templates/nest/src/simple-app/.core/features/event/event.module.ts.eta +9 -0
- package/templates/nest/src/simple-app/.core/features/event/event.type.ts.eta +23 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-create.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-delete.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-set-status.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-after-update.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-create.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-delete.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-set-status.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/event-before-update.interface.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/event/interface/index.ts.eta +8 -0
- package/templates/nest/src/simple-app/.core/features/foreign-key/foreign-key.module.ts.eta +16 -0
- package/templates/nest/src/simple-app/.core/features/log/log.module.ts.eta +20 -0
- package/templates/nest/src/simple-app/.core/features/log/log.service.ts.eta +68 -0
- package/templates/nest/src/simple-app/.core/features/log/schemas/api-event.schema.ts.eta +57 -0
- package/templates/nest/src/simple-app/.core/features/log/schemas/document-event.schema.ts.eta +87 -0
- package/templates/nest/src/simple-app/.core/features/log/schemas/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/maintenance.controller.ts.eta +84 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/maintenance.module.ts.eta +19 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/maintenance.service.ts.eta +86 -0
- package/templates/nest/src/simple-app/.core/features/maintenance/schemas/environment.ts.eta +23 -0
- package/templates/nest/src/{simpleapp/maintenance/apischemas → simple-app/.core/features/maintenance/schemas}/index.ts.eta +1 -1
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal-bridge.service.ts.eta.eta +31 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal-env-development.service.ts.eta +124 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal-env-production.service.ts.eta +50 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal.controller.ts.eta +41 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal.schema.ts.eta +18 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/developer-portal.service.ts.eta +94 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/dto/developer-portal-create-app.dto.ts.eta +22 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/developer-portal/dto/developer-portal-publish-app.dto.ts.eta +0 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/dto/imports.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/dto/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/dto/mini-app.ts.eta +55 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-bridge.service.ts.eta +162 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-env-development.service.ts.eta +140 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-env-production.service.ts.eta +125 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager-policy.service.ts.eta +43 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.controller.ts.eta +81 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.enum.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.error.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.processor.ts.eta +309 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-manager/mini-app-manager.service.ts.eta +346 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-scope/mini-app-scope.decorator.ts.eta +5 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-scope/mini-app-scope.guard.ts.eta +43 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app-scope/mini-app-scope.service.ts.eta +101 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/mini-app.module.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/types/miniApp.ts.eta +23 -0
- package/templates/nest/src/simple-app/.core/features/mini-app/utils/mini-app.util.ts.eta +26 -0
- package/templates/nest/src/simple-app/.core/features/policy/policy.module.ts.eta +12 -0
- package/templates/nest/src/simple-app/.core/features/policy/policy.service.ts.eta +45 -0
- package/templates/nest/src/{simpleapp/profile/profile.controller.ts._eta → simple-app/.core/features/profile/profile.controller.ts.eta} +37 -83
- package/templates/nest/src/simple-app/.core/features/profile/profile.module.ts.eta +22 -0
- package/templates/nest/src/simple-app/.core/features/profile/profile.schema.ts.eta +165 -0
- package/templates/nest/src/{simpleapp/profile/profile.service.ts._eta → simple-app/.core/features/profile/profile.service.ts.eta} +36 -48
- package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.consumer.ts.eta +196 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue-base/queue-base.producer.ts.eta +147 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue-user-context/queue-user-context.service.ts.eta +35 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue.module.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/queue/queue.type.ts.eta +75 -0
- package/templates/nest/src/simple-app/.core/features/simple-app-core-features.module.ts.eta +51 -0
- package/templates/nest/src/{simpleapp/generate/commons/robotuser.service.ts.eta → simple-app/.core/features/user-context/robot-user.service.ts.eta} +27 -16
- package/templates/nest/src/simple-app/.core/features/user-context/user-context.module.ts.eta +24 -0
- package/templates/nest/src/simple-app/.core/features/user-context/user-context.type.ts.eta +15 -0
- package/templates/nest/src/{simpleapp/generate/commons → simple-app/.core/features/user-context}/user.context.ts.eta +469 -449
- package/templates/nest/src/{simpleapp/generate/commons/runwebhook.service.ts.eta → simple-app/.core/features/webhook/run-webhook.service.ts.eta} +7 -11
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/index.ts.eta +2 -0
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook-log.schema.ts.eta +116 -0
- package/templates/nest/src/simple-app/.core/features/webhook/schemas/webhook.schema.ts.eta +177 -0
- package/templates/nest/src/simple-app/.core/features/webhook/webhook.module.ts.eta +20 -0
- package/templates/nest/src/{simpleapp/generate/controllers/simpleapp.controller.ts.eta → simple-app/.core/framework/base/simple-app.controller.ts.eta} +13 -35
- package/templates/nest/src/{simpleapp/generate/processors/simpleapp.processor.ts.eta → simple-app/.core/framework/base/simple-app.service.ts.eta} +239 -139
- package/templates/nest/src/simple-app/.core/framework/custom-exception.ts.eta +26 -0
- package/templates/nest/src/simple-app/.core/framework/framework.module.ts.eta +12 -0
- package/templates/nest/src/simple-app/.core/framework/schemas/index.ts.eta +3 -0
- package/templates/nest/src/simple-app/.core/framework/schemas/others.schema.ts.eta +153 -0
- package/templates/nest/src/simple-app/.core/framework/schemas/simple-app.schema.ts.eta +172 -0
- package/templates/nest/src/{simpleapp/generate/commons/interceptors/response.interceptor.ts.eta → simple-app/.core/framework/simple-app.interceptor.ts.eta} +12 -22
- package/templates/nest/src/{simpleapp/generate/commons/middlewares/tenant.middleware.ts.eta → simple-app/.core/framework/simple-app.middleware.ts.eta} +28 -26
- package/templates/nest/src/simple-app/.core/readme.md.eta +3 -0
- package/templates/nest/src/simple-app/.core/resources/core-resources.module.ts.eta +38 -0
- package/templates/nest/src/simple-app/.core/simple-app-core.module.ts.eta +18 -0
- package/templates/nest/src/simple-app/.core/utils/dayjs.ts.eta +47 -0
- package/templates/nest/src/simple-app/.core/utils/locale-tool.ts.eta +11 -0
- package/templates/nest/src/simple-app/.core/utils/string-utils.ts.eta +1 -0
- package/templates/nest/src/simple-app/.resources/readme.md.eta +3 -0
- package/templates/nest/src/simple-app/.resources/resources.module.ts.eta +36 -0
- package/templates/nest/src/simple-app/apis/readme.md.eta +9 -0
- package/templates/nest/src/simple-app/apis/resource-api.module.ts.eta +37 -0
- package/templates/nest/src/simple-app/events/branch-event/branch-event.module.ts._eta +20 -0
- package/templates/nest/src/simple-app/events/branch-event/branch-event.service.ts._eta +43 -0
- package/templates/nest/src/simple-app/events/branch-event/branch-event.type.ts._eta +7 -0
- package/templates/nest/src/simple-app/events/events.module.ts._eta +17 -0
- package/templates/nest/src/simple-app/events/organization-event/organization-event.module.ts._eta +13 -0
- package/templates/nest/src/simple-app/events/organization-event/organization-event.service.ts._eta +52 -0
- package/templates/nest/src/simple-app/events/organization-event/organization-event.type.ts._eta +1 -0
- package/templates/nest/src/simple-app/events/permission-event/permission-event.module.ts.eta +11 -0
- package/templates/nest/src/simple-app/events/permission-event/permission-event.service.ts.eta +33 -0
- package/templates/nest/src/simple-app/events/permission-event/permission-event.type.ts.eta +1 -0
- package/templates/nest/src/simple-app/events/readme.md.eta +76 -0
- package/templates/nest/src/simple-app/events/tenant-event/tenant-event.module.ts_eta +12 -0
- package/templates/nest/src/simple-app/events/tenant-event/tenant-event.service.ts_eta +30 -0
- package/templates/nest/src/simple-app/events/tenant-event/tenant-event.type.ts_eta +1 -0
- package/templates/nest/src/{simpleapp/additional.module.ts._eta → simple-app/features/features.module.ts._eta} +8 -7
- package/templates/nest/src/{printapi/printapi.module.ts.eta → simple-app/features/print/print.module.ts.eta} +4 -4
- package/templates/nest/src/{printapi/printapi.service.ts.eta → simple-app/features/print/print.service.ts.eta} +7 -7
- package/templates/nest/src/simple-app/features/readme.md._eta +6 -0
- package/templates/nest/src/simple-app/simple-app.module.ts.eta +32 -0
- package/templates/nuxt/.env._eta +2 -0
- package/templates/nuxt/app.vue.eta +15 -7
- package/templates/nuxt/components/header/HeaderSelectBranch.vue.eta +2 -1
- package/templates/nuxt/components/image/ImageAvatar.vue._eta +63 -0
- package/templates/nuxt/components/image/ImageOrganization.vue._eta +77 -0
- package/templates/nuxt/components/simpleApp/SimpleAppForm.vue.eta +1 -1
- package/templates/nuxt/components/simpleApp/SimpleAppFormToolBar.vue._eta +95 -20
- package/templates/nuxt/components/user/UserButtonCreateTenant.vue._eta +20 -21
- package/templates/nuxt/components/user/UserTenantPicker.vue._eta +1 -1
- package/templates/nuxt/composables/docformat.generate.ts.eta +4 -2
- package/templates/nuxt/enums/enums.generate.ts.eta +1 -1
- package/templates/nuxt/middleware/30.acl.global.ts.eta +6 -6
- package/templates/nuxt/nuxt.config.ts._eta +1 -0
- package/templates/nuxt/pages/login.vue._eta +21 -15
- package/templates/nuxt/pages/profile.vue._eta +24 -32
- package/templates/nuxt/plugins/20.simpleapp-userstore.ts.eta +31 -24
- package/templates/nuxt/plugins/50.simpleapp-client.ts.eta +2 -2
- package/templates/nuxt/providers/my-provider.ts.eta +5 -6
- package/templates/nuxt/simpleapp/generate/clients/SimpleAppClient.ts.eta +1 -0
- package/templates/nuxt/simpleapp/generate/defaults/index.ts.eta +1 -1
- package/templates/nuxt/simpleapp/generate/types/index.ts.eta +1 -1
- package/templates/nuxt/types/schema.ts.eta +1 -0
- package/templates/nuxt/types/user.ts.eta +39 -38
- package/templates/project/build.sh.eta +2 -2
- package/templates/basic/nest/apischema.ts.eta +0 -96
- package/templates/basic/nest/processor.ts.eta +0 -86
- package/templates/nest/src/cloudapi/cloudapi.module.ts._eta +0 -15
- package/templates/nest/src/cloudapi/cloudapi.service.ts._eta +0 -15
- package/templates/nest/src/enums/enums.generate.ts.eta +0 -23
- package/templates/nest/src/simpleapp/apischemas/index.ts._eta +0 -85
- package/templates/nest/src/simpleapp/generate/apischemas/index.ts.eta +0 -15
- package/templates/nest/src/simpleapp/generate/apischemas/simpleapp.apischema.ts.eta +0 -62
- package/templates/nest/src/simpleapp/generate/commons/audittrail.service.ts.eta +0 -52
- package/templates/nest/src/simpleapp/generate/commons/customkeycloa.guard.ts.eta +0 -45
- package/templates/nest/src/simpleapp/generate/commons/docnogenerator.service.ts.eta +0 -129
- package/templates/nest/src/simpleapp/generate/commons/providers/workflow.provider.ts.etax +0 -87
- package/templates/nest/src/simpleapp/generate/jsonschemas/index.ts.eta +0 -11
- package/templates/nest/src/simpleapp/generate/models/apievent.model.ts.eta +0 -27
- package/templates/nest/src/simpleapp/generate/processors/autoinc.processor.ts.eta +0 -88
- package/templates/nest/src/simpleapp/generate/processors/branch.processor.ts.eta +0 -110
- package/templates/nest/src/simpleapp/generate/processors/docno.processor.ts.eta +0 -77
- package/templates/nest/src/simpleapp/generate/processors/org.processor.ts.eta +0 -110
- package/templates/nest/src/simpleapp/generate/processors/perm.processor.ts.eta +0 -71
- package/templates/nest/src/simpleapp/generate/processors/sysmsg.processor.ts.eta +0 -49
- package/templates/nest/src/simpleapp/generate/processors/tenant.processor.ts.eta +0 -52
- package/templates/nest/src/simpleapp/generate/processors/webhooklog.processor.ts.eta +0 -45
- package/templates/nest/src/simpleapp/generate/types/index.ts.eta +0 -7
- package/templates/nest/src/simpleapp/generate/types/schema.type.ts.eta +0 -193
- package/templates/nest/src/simpleapp/generate/types/simpleapp.type.ts.eta +0 -299
- package/templates/nest/src/simpleapp/generate/types/workflow.type.ts.eta +0 -15
- package/templates/nest/src/simpleapp/generate/workflow/formschema/SimpleApproveReject.ts.eta +0 -8
- package/templates/nest/src/simpleapp/generate/workflow/formschema/index.ts.eta +0 -7
- package/templates/nest/src/simpleapp/generate/workflow/workflow.apischema.ts.eta +0 -136
- package/templates/nest/src/simpleapp/generate/workflow/workflow.config.ts.eta +0 -79
- package/templates/nest/src/simpleapp/generate/workflow/workflow.controller.ts.eta +0 -414
- package/templates/nest/src/simpleapp/generate/workflow/workflow.delegate.ts.eta +0 -201
- package/templates/nest/src/simpleapp/generate/workflow/workflow.service.ts.eta +0 -641
- package/templates/nest/src/simpleapp/generate/workflow/workflow.type.ts.eta +0 -98
- package/templates/nest/src/simpleapp/generate/workflow/workflow.userservice.ts.eta +0 -83
- package/templates/nest/src/simpleapp/maintenance/apischemas/environment.ts.eta +0 -11
- package/templates/nest/src/simpleapp/maintenance/maintenance.controller.ts.eta +0 -72
- package/templates/nest/src/simpleapp/maintenance/maintenance.service.ts.eta +0 -88
- package/templates/nest/src/simpleapp/maintenance/models/environment.model.ts.eta +0 -16
- package/templates/nest/src/simpleapp/profile/profile.apischema.ts._eta +0 -95
- package/templates/nest/src/simpleapp/resolvers/readme.md.eta +0 -1
- package/templates/nest/src/simpleapp/services/autoinc.service.ts.etaxx +0 -59
- package/templates/nest/src/simpleapp/services/branch.service.ts.etaxxx +0 -83
- package/templates/nest/src/simpleapp/services/docno.service.ts.etaxxx +0 -59
- package/templates/nest/src/simpleapp/services/org.service.ts.etaxxx +0 -37
- package/templates/nest/src/simpleapp/services/perm.service.ts.etaxxx +0 -56
- package/templates/nest/src/simpleapp/services/sysmsg.service.ts._etaxxx +0 -43
- package/templates/nest/src/simpleapp/services/tenant.service.ts.etaxxx +0 -38
- package/templates/nest/src/simpleapp/services/user.service.ts.eta.old +0 -118
- package/templates/nest/src/simpleapp/services/userresolver.service.ts._eta +0 -67
- package/templates/nest/src/simpleapp/services/webhook.service.ts._eta +0 -37
- package/templates/nest/src/simpleapp/simpleapp.module.ts.eta +0 -85
- package/templates/nest/src/simpleapp/types/index.ts._eta +0 -45
- package/templates/nest/src/simpleapp/webhooks/branch.ts._eta +0 -44
- package/templates/nest/src/simpleapp/webhooks/index.ts._eta +0 -21
- package/templates/nest/src/simpleapp/workflows/bpmn/readme.md._eta +0 -1
- package/templates/nest/src/simpleapp/workflows/listeners/simpleapp.listener.ts.eta +0 -31
- package/templates/nest/src/simpleapp/workflows/readme.md._eta +0 -1
- package/templates/nuxt/components/image/ImageAvatar.vue.eta +0 -56
- package/templates/nuxt/components/image/ImageOrganization.vue.eta +0 -66
- /package/src/buildinschemas/{webhook.ts → webhook.ts.backup} +0 -0
- /package/src/buildinschemas/{webhooklog.ts → webhooklog.ts.backup} +0 -0
- /package/templates/basic/nest/{type.ts.eta → type.ts.eta-backup} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/customkeycloak.guard.ts.eta → simple-app/.core/features/auth/keycloak/keycloak.guard.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.decorator.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/roles → simple-app/.core/features/auth/role-guard}/roles.group.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/dicts/documents.ts.eta → simple-app/.core/features/document-no-format/document.dict.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/dicts/foreignkeys.ts.eta → simple-app/.core/features/foreign-key/foreignkeys.dict.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/maintenance/dbupdate → simple-app/.core/features/maintenance/db-update}/1.00.00/index.ts._eta +0 -0
- /package/templates/nest/src/{simpleapp/maintenance/dbupdate → simple-app/.core/features/maintenance/db-update}/index.ts._eta +0 -0
- /package/templates/nest/src/{simpleapp/maintenance/apischemas/dbupdate.ts.eta → simple-app/.core/features/maintenance/schemas/db-update.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/profile/profile.types.ts.eta → simple-app/.core/features/profile/profile.types.ts.eta-backup} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/decorators → simple-app/.core/features/user-context}/appuser.decorator.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons/exceptions/SimpleAppExceptionFilter.ts.eta → simple-app/.core/framework/exception-filter.ts.eta} +0 -0
- /package/templates/nest/src/{simpleapp/generate/commons → simple-app/.core/utils}/encryption.static.ts.eta +0 -0
- /package/templates/nest/src/{simpleapp → simple-app}/.gitignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.gitignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.npmignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.openapi-generator/FILES.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.openapi-generator/VERSION.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/.openapi-generator-ignore.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/api.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/base.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/common.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/configuration.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/git_push.sh.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/index.ts.eta +0 -0
- /package/templates/nest/src/{printapi → simple-app/features/print}/api/openapitools.json.eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/hello.ts._eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/index.ts.eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/money.ts.eta +0 -0
- /package/templates/project/{sharelibs → share-libs}/validate.ts.eta +0 -0
|
@@ -1,641 +0,0 @@
|
|
|
1
|
-
import { error } from 'console';
|
|
2
|
-
/**
|
|
3
|
-
* This file was automatically generated by simpleapp generator. Every
|
|
4
|
-
* MODIFICATION OVERRIDE BY GENERATEOR
|
|
5
|
-
* last change 2024-04-21
|
|
6
|
-
* Author: Ks Tan
|
|
7
|
-
*/
|
|
8
|
-
import { WorkflowConfig } from './workflow.config';
|
|
9
|
-
import {
|
|
10
|
-
BadRequestException,
|
|
11
|
-
Injectable,
|
|
12
|
-
InternalServerErrorException,
|
|
13
|
-
Logger,
|
|
14
|
-
NotFoundException,
|
|
15
|
-
} from '@nestjs/common';
|
|
16
|
-
import {
|
|
17
|
-
WorkflowSettingApiSchema,
|
|
18
|
-
WorkflowDataApiSchema,
|
|
19
|
-
WorkflowProcess,
|
|
20
|
-
WorkflowTask,
|
|
21
|
-
UserTaskActors,
|
|
22
|
-
UserTaskType,
|
|
23
|
-
ServiceTaskData,
|
|
24
|
-
UserTaskData,
|
|
25
|
-
UserTaskEventType,
|
|
26
|
-
ServiceTaskEventType,
|
|
27
|
-
} from './workflow.type';
|
|
28
|
-
import { EventEmitter2, OnEvent } from '@nestjs/event-emitter';
|
|
29
|
-
import {
|
|
30
|
-
BPMNServer,
|
|
31
|
-
Logger as bpmnlogger,
|
|
32
|
-
BPMN_TYPE,
|
|
33
|
-
EXECUTION_EVENT,
|
|
34
|
-
ILogger,
|
|
35
|
-
} from 'bpmn-server';
|
|
36
|
-
// import { configuration } from './configuration';
|
|
37
|
-
import { UserContext } from '../commons/user.context';
|
|
38
|
-
import { WorkflowName } from '../types';
|
|
39
|
-
// import { UserResolverService } from '../../services/userresolver.service';
|
|
40
|
-
|
|
41
|
-
//import * as formschemas from '../../workflow/formschema';
|
|
42
|
-
export {
|
|
43
|
-
WorkflowSettingApiSchema,
|
|
44
|
-
WorkflowDataApiSchema,
|
|
45
|
-
} from './workflow.type';
|
|
46
|
-
import { SimpleAppRobotUserService } from 'src/simpleapp/generate/commons/robotuser.service';
|
|
47
|
-
@Injectable()
|
|
48
|
-
export class WorkflowService {
|
|
49
|
-
protected bpmnServer: BPMNServer;
|
|
50
|
-
private readonly logger = new Logger();
|
|
51
|
-
constructor(
|
|
52
|
-
private workflowconfig: WorkflowConfig,
|
|
53
|
-
private eventEmitter: EventEmitter2,
|
|
54
|
-
// private userResolverService: UserResolverService,
|
|
55
|
-
private robotUserService: SimpleAppRobotUserService,
|
|
56
|
-
) {
|
|
57
|
-
const config = this.workflowconfig.getConfig();
|
|
58
|
-
class HiddenLogger implements ILogger {
|
|
59
|
-
setOptions() {}
|
|
60
|
-
clear() {}
|
|
61
|
-
get() {
|
|
62
|
-
return [] as any[];
|
|
63
|
-
}
|
|
64
|
-
debug() {}
|
|
65
|
-
warn() {}
|
|
66
|
-
info() {}
|
|
67
|
-
reportError(err: any) {
|
|
68
|
-
// console.log('report Error:', err);
|
|
69
|
-
}
|
|
70
|
-
async save(filename: any) {}
|
|
71
|
-
log() {}
|
|
72
|
-
error(err: any) {
|
|
73
|
-
// console.log('Error:', err);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
this.bpmnServer = new BPMNServer(config, new HiddenLogger());
|
|
77
|
-
this.bpmnServer.listener.on(
|
|
78
|
-
'all',
|
|
79
|
-
async (event) => await this.applyEventListener(event),
|
|
80
|
-
);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
/**
|
|
84
|
-
* get all workflow userTask for specific uid (uuid)
|
|
85
|
-
* @param appuser
|
|
86
|
-
* @returns array of usertask
|
|
87
|
-
*/
|
|
88
|
-
async getActorUserTask(appuser: UserContext) {
|
|
89
|
-
const tmp: any[] = await this.bpmnServer.dataStore.findItems({
|
|
90
|
-
'items.status': 'wait',
|
|
91
|
-
'data.tenantId': appuser.getTenantId(),
|
|
92
|
-
//filter uid properties base on function
|
|
93
|
-
$or: [
|
|
94
|
-
{ 'items.assignee': appuser.getUid() },
|
|
95
|
-
{ 'items.candidateUsers': appuser.getId() },
|
|
96
|
-
{ 'items.candidateGroups': appuser.getGroups() },
|
|
97
|
-
],
|
|
98
|
-
});
|
|
99
|
-
const result: UserTaskType[] = tmp.map((proc) => {
|
|
100
|
-
const subitem: UserTaskType = {
|
|
101
|
-
id: proc.instanceId,
|
|
102
|
-
taskId: proc.id,
|
|
103
|
-
elementId: proc.elementId,
|
|
104
|
-
name: proc.name,
|
|
105
|
-
processName: proc.processName,
|
|
106
|
-
assignee: proc.assignee,
|
|
107
|
-
candidateUsers: proc.candidateUsers,
|
|
108
|
-
candidateGroups: proc.candidateGroups,
|
|
109
|
-
data: proc.data,
|
|
110
|
-
vars: proc.vars,
|
|
111
|
-
startedAt: proc.startedAt,
|
|
112
|
-
followUpDate: proc.followUpDate,
|
|
113
|
-
dueDate: proc.dueDate,
|
|
114
|
-
priority: proc.priority,
|
|
115
|
-
type: proc.type,
|
|
116
|
-
userId: proc.userId,
|
|
117
|
-
};
|
|
118
|
-
return subitem;
|
|
119
|
-
});
|
|
120
|
-
return result;
|
|
121
|
-
// throw new BadRequestException(`getActorUserTask is not supported yet`)
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* get all workflow userTask for my uid (uuid)
|
|
125
|
-
* @param appuser
|
|
126
|
-
* @returns array of usertask
|
|
127
|
-
*/
|
|
128
|
-
async getMyUserTask(appuser: UserContext) {
|
|
129
|
-
return await this.getActorUserTask(appuser);
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
/**
|
|
133
|
-
* !! waiting founder
|
|
134
|
-
* deveploper method
|
|
135
|
-
* create new process definitions
|
|
136
|
-
*/
|
|
137
|
-
async newWorkflowDefinitions(
|
|
138
|
-
appuser: UserContext,
|
|
139
|
-
workflowName: WorkflowName,
|
|
140
|
-
xml: string,
|
|
141
|
-
) {
|
|
142
|
-
throw new BadRequestException(
|
|
143
|
-
`newWorkflowDefinitions "${workflowName}" is not supported yet`,
|
|
144
|
-
);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
async getWorkflowDefinitions(appuser: UserContext) {
|
|
148
|
-
throw new BadRequestException(
|
|
149
|
-
`getWorkflowDefinitions is not supported yet`,
|
|
150
|
-
);
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
async readWorkflowDefinition(
|
|
154
|
-
appuser: UserContext,
|
|
155
|
-
workflowname: WorkflowName,
|
|
156
|
-
) {
|
|
157
|
-
throw new BadRequestException(
|
|
158
|
-
`readWorkflowDefinition is not supported yet`,
|
|
159
|
-
);
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
async deleteWorkflowDefinition(
|
|
163
|
-
appuser: UserContext,
|
|
164
|
-
workflowname: WorkflowName,
|
|
165
|
-
) {
|
|
166
|
-
throw new BadRequestException(
|
|
167
|
-
`deleteWorkflowDefinition is not supported yet`,
|
|
168
|
-
);
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
async updateWorkflowDefinition(
|
|
172
|
-
appuser: UserContext,
|
|
173
|
-
workflowname: WorkflowName,
|
|
174
|
-
xml: string,
|
|
175
|
-
) {
|
|
176
|
-
throw new BadRequestException(
|
|
177
|
-
`updateWorkflowDefinition is not supported yet`,
|
|
178
|
-
);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
/**
|
|
182
|
-
* admin workflow service, obtain all active workflows and it's pending task from all tenant
|
|
183
|
-
* status: done
|
|
184
|
-
* @param appuser
|
|
185
|
-
* @returns array of workflow process and it's waiting task
|
|
186
|
-
*/
|
|
187
|
-
async getAllActiveProcesses(appuser: UserContext) {
|
|
188
|
-
const alldata = await this.bpmnServer.dataStore.findInstances(
|
|
189
|
-
{ status: 'running' },
|
|
190
|
-
'summary',
|
|
191
|
-
);
|
|
192
|
-
const result = this.workflowProcessArrayMaping(alldata);
|
|
193
|
-
return result;
|
|
194
|
-
}
|
|
195
|
-
|
|
196
|
-
/**
|
|
197
|
-
* delete a workflow process from database
|
|
198
|
-
* @param appuser
|
|
199
|
-
* @param id
|
|
200
|
-
* @returns
|
|
201
|
-
*/
|
|
202
|
-
async deleteWorkflowById(appuser: UserContext, id: string) {
|
|
203
|
-
if (await this.getWorkflowById(appuser, id)) {
|
|
204
|
-
const result = await this.bpmnServer.dataStore.deleteInstances({
|
|
205
|
-
id: id,
|
|
206
|
-
});
|
|
207
|
-
return {
|
|
208
|
-
status: 'ok',
|
|
209
|
-
deletedCount: result['deletedCount'],
|
|
210
|
-
};
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
/**
|
|
215
|
-
* invoke workflow process to next step
|
|
216
|
-
* @param appuser
|
|
217
|
-
* @param id
|
|
218
|
-
* @param taskId
|
|
219
|
-
* @param data
|
|
220
|
-
* @returns
|
|
221
|
-
*/
|
|
222
|
-
async invokeWorkflowUserTask(
|
|
223
|
-
appuser: UserContext,
|
|
224
|
-
taskId: string,
|
|
225
|
-
data: any,
|
|
226
|
-
) {
|
|
227
|
-
try {
|
|
228
|
-
const response = await this.bpmnServer.engine.invoke(
|
|
229
|
-
{ 'items.id': taskId, 'items.status': 'wait' },
|
|
230
|
-
data,
|
|
231
|
-
appuser.getUid(),
|
|
232
|
-
{ appuser: appuser },
|
|
233
|
-
);
|
|
234
|
-
return {
|
|
235
|
-
parentKeys: Object.keys(response),
|
|
236
|
-
parentId: response.id,
|
|
237
|
-
data: response.instance.data,
|
|
238
|
-
// parentId:response,
|
|
239
|
-
input: response.item.input,
|
|
240
|
-
vars: response.item.vars,
|
|
241
|
-
id: response.item.id,
|
|
242
|
-
status: response.item.status,
|
|
243
|
-
};
|
|
244
|
-
} catch (e) {
|
|
245
|
-
throw new NotFoundException(e);
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
/**
|
|
250
|
-
* !! waiting founder
|
|
251
|
-
* use in adhoc situation override bpmn assignee/candidateUsers/Groups with data
|
|
252
|
-
* status: draft
|
|
253
|
-
* @param appuser
|
|
254
|
-
* @param id
|
|
255
|
-
* @param taskId
|
|
256
|
-
* @param data
|
|
257
|
-
*/
|
|
258
|
-
async updateWorkflowUserTask(
|
|
259
|
-
appuser: UserContext,
|
|
260
|
-
id: string,
|
|
261
|
-
taskId: string,
|
|
262
|
-
assignmentdata: UserTaskActors,
|
|
263
|
-
) {
|
|
264
|
-
try {
|
|
265
|
-
const result = await this.bpmnServer.dataStore.findInstance(
|
|
266
|
-
{ id: id },
|
|
267
|
-
{},
|
|
268
|
-
);
|
|
269
|
-
|
|
270
|
-
const usertask = result.items.find((item) => item.id == taskId);
|
|
271
|
-
if (usertask) {
|
|
272
|
-
const result = await this.bpmnServer.engine.assign(
|
|
273
|
-
{ id: id, 'items.id': taskId },
|
|
274
|
-
{ newData: 1 }, //some data want to put in
|
|
275
|
-
assignmentdata,
|
|
276
|
-
appuser.getUid(),
|
|
277
|
-
{}, //options
|
|
278
|
-
);
|
|
279
|
-
return 'OK'; //Object.keys(result)
|
|
280
|
-
} else {
|
|
281
|
-
throw new NotFoundException(`user task id:${taskId} not found`);
|
|
282
|
-
}
|
|
283
|
-
} catch (e) {
|
|
284
|
-
throw new NotFoundException(e);
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
// throw new BadRequestException(`updateWorkflowUserTask is not supported yet`)
|
|
288
|
-
}
|
|
289
|
-
|
|
290
|
-
/**
|
|
291
|
-
*
|
|
292
|
-
* @param appuser search all workflow in current tenant
|
|
293
|
-
* @param filter
|
|
294
|
-
* @returns
|
|
295
|
-
*/
|
|
296
|
-
async searchRunningWorkflowProcesses(appuser: UserContext, filter: any) {
|
|
297
|
-
// filter['data.tenantId']= appuser.getTenantId() //tmp disabled waiting
|
|
298
|
-
filter['status'] = 'running';
|
|
299
|
-
return await this.searchWorkflowProcesses(appuser, filter);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
/**
|
|
303
|
-
*
|
|
304
|
-
* @param appuser search all workflow in current tenant
|
|
305
|
-
* @param filter
|
|
306
|
-
* @returns
|
|
307
|
-
*/
|
|
308
|
-
async searchWorkflowProcesses(appuser: UserContext, filter: any) {
|
|
309
|
-
filter['data.tenantId'] = appuser.getTenantId(); //tmp disabled waiting
|
|
310
|
-
const alldata = await this.bpmnServer.dataStore.findInstances(
|
|
311
|
-
filter,
|
|
312
|
-
'summary',
|
|
313
|
-
);
|
|
314
|
-
const result = this.workflowProcessArrayMaping(alldata);
|
|
315
|
-
return result;
|
|
316
|
-
}
|
|
317
|
-
|
|
318
|
-
async getPendingProcess(appuser: UserContext) {
|
|
319
|
-
const tmp: any[] = await this.bpmnServer.dataStore.findItems({
|
|
320
|
-
'items.status': 'wait',
|
|
321
|
-
});
|
|
322
|
-
|
|
323
|
-
const result = tmp.map((proc) => ({
|
|
324
|
-
id: proc.instanceId,
|
|
325
|
-
assignee: proc.assignee,
|
|
326
|
-
candidateUsers: proc.candidateUsers,
|
|
327
|
-
candidateGroups: proc.candidateGroups,
|
|
328
|
-
data: proc.data,
|
|
329
|
-
processName: proc.processName,
|
|
330
|
-
startedAt: proc.startedAt,
|
|
331
|
-
type: proc.type,
|
|
332
|
-
taskName: proc.name,
|
|
333
|
-
userId: proc.userId,
|
|
334
|
-
}));
|
|
335
|
-
return result;
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
/**
|
|
339
|
-
* initialise new workflow process, also listening event 'workflow.start'
|
|
340
|
-
* status: done
|
|
341
|
-
* @param appuser
|
|
342
|
-
* @param workflowName
|
|
343
|
-
* @param data
|
|
344
|
-
* @returns workflowsummary
|
|
345
|
-
*/
|
|
346
|
-
@OnEvent('workflow.start')
|
|
347
|
-
async startWorkflow(
|
|
348
|
-
appuser: UserContext,
|
|
349
|
-
workflowName: WorkflowName,
|
|
350
|
-
data?: any,
|
|
351
|
-
) {
|
|
352
|
-
//run as event, it wont have transaction
|
|
353
|
-
appuser.setDBSession(undefined);
|
|
354
|
-
|
|
355
|
-
if (!data) data = {};
|
|
356
|
-
|
|
357
|
-
//sometimes data is Mongoose object instead of pure data, need serialize and deserialize to remove that
|
|
358
|
-
data = JSON.parse(JSON.stringify(data));
|
|
359
|
-
|
|
360
|
-
try {
|
|
361
|
-
// console.log('startWorkflow started: ', workflowName);
|
|
362
|
-
|
|
363
|
-
data.tenantId = appuser.getTenantId();
|
|
364
|
-
data.orgId = appuser.getOrgId();
|
|
365
|
-
data.branchId = appuser.getBranchId();
|
|
366
|
-
|
|
367
|
-
const result = await this.bpmnServer.engine.start(
|
|
368
|
-
workflowName,
|
|
369
|
-
data,
|
|
370
|
-
undefined,
|
|
371
|
-
appuser.getUid(),
|
|
372
|
-
{
|
|
373
|
-
appuser: appuser,
|
|
374
|
-
},
|
|
375
|
-
);
|
|
376
|
-
|
|
377
|
-
// console.log("startWorkflowstartWorkflowstartWorkflow",result)
|
|
378
|
-
return {
|
|
379
|
-
id: result.id,
|
|
380
|
-
name: result.name,
|
|
381
|
-
status: result.status,
|
|
382
|
-
userId: result.userName,
|
|
383
|
-
startedAt: result.item.startedAt,
|
|
384
|
-
};
|
|
385
|
-
} catch (e) {
|
|
386
|
-
throw new BadRequestException(e, JSON.stringify(data));
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
/**
|
|
391
|
-
* read single process full property
|
|
392
|
-
* @param appuser
|
|
393
|
-
* @param id
|
|
394
|
-
* @returns
|
|
395
|
-
*/
|
|
396
|
-
async getWorkflowById(appuser: UserContext, id: string) {
|
|
397
|
-
try {
|
|
398
|
-
const data = await this.bpmnServer.dataStore.findInstance({ id: id }, {}); // .findInstances({id:id},'full')
|
|
399
|
-
const result = this.workflowProcessMaping(data);
|
|
400
|
-
return result;
|
|
401
|
-
} catch (e) {
|
|
402
|
-
throw new NotFoundException(e);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
async getPendingWorkflows(appuser: UserContext) {
|
|
406
|
-
const tmp: any[] = await this.bpmnServer.dataStore.findItems({
|
|
407
|
-
'items.status': 'wait',
|
|
408
|
-
});
|
|
409
|
-
|
|
410
|
-
const result = tmp.map((proc) => ({
|
|
411
|
-
id: proc.instanceId,
|
|
412
|
-
assignee: proc.assignee,
|
|
413
|
-
candidateUsers: proc.candidateUsers,
|
|
414
|
-
candidateGroups: proc.candidateGroups,
|
|
415
|
-
data: proc.data,
|
|
416
|
-
processName: proc.processName,
|
|
417
|
-
startedAt: proc.startedAt,
|
|
418
|
-
type: proc.type,
|
|
419
|
-
taskName: proc.name,
|
|
420
|
-
userId: proc.userId,
|
|
421
|
-
}));
|
|
422
|
-
return result;
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
/**
|
|
426
|
-
* obtain specific bpmn task camunda:formKey
|
|
427
|
-
* @param appuser
|
|
428
|
-
* @param processName
|
|
429
|
-
* @param elementId
|
|
430
|
-
* @returns properties
|
|
431
|
-
*/
|
|
432
|
-
async getWorkflowUserTaskFormKey(
|
|
433
|
-
appuser,
|
|
434
|
-
processName: string,
|
|
435
|
-
elementId: string,
|
|
436
|
-
) {
|
|
437
|
-
try {
|
|
438
|
-
let definition = await this.bpmnServer.definitions.load(processName);
|
|
439
|
-
let node = definition.getNodeById(elementId);
|
|
440
|
-
if (node) {
|
|
441
|
-
const formKey = node.def.formKey;
|
|
442
|
-
let schema: string = node.def.formKey;
|
|
443
|
-
|
|
444
|
-
if (schema) {
|
|
445
|
-
return {
|
|
446
|
-
processName: processName,
|
|
447
|
-
elementId: elementId,
|
|
448
|
-
schema: schema,
|
|
449
|
-
};
|
|
450
|
-
} else {
|
|
451
|
-
return {
|
|
452
|
-
processName: processName,
|
|
453
|
-
elementId: elementId,
|
|
454
|
-
schema: 'default',
|
|
455
|
-
};
|
|
456
|
-
//throw new InternalServerErrorException(
|
|
457
|
-
// `Cannot resolve schema from invalid formKey '${schema}', example: 'jsonschema://SimpleApproveReject' or 'custom://your-custom-key'`,
|
|
458
|
-
//);
|
|
459
|
-
}
|
|
460
|
-
} else {
|
|
461
|
-
throw new NotFoundException(
|
|
462
|
-
`Element ${elementId} not found in process ${processName}`,
|
|
463
|
-
);
|
|
464
|
-
}
|
|
465
|
-
} catch (e) {
|
|
466
|
-
throw new InternalServerErrorException(e);
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
|
|
470
|
-
// helper
|
|
471
|
-
workflowProcessArrayMaping(alldata: any[]) {
|
|
472
|
-
const result = alldata.map((data) => this.workflowProcessMaping(data));
|
|
473
|
-
return result;
|
|
474
|
-
}
|
|
475
|
-
workflowProcessMaping(data: any) {
|
|
476
|
-
const result: WorkflowProcess = {
|
|
477
|
-
id: data.id,
|
|
478
|
-
name: data.name,
|
|
479
|
-
status: data.status,
|
|
480
|
-
startedAt: data.startedAt,
|
|
481
|
-
items: data.items
|
|
482
|
-
.filter((item) => item.type != 'bpmn:SequenceFlow')
|
|
483
|
-
.map((item) => ({
|
|
484
|
-
taskId: item.id,
|
|
485
|
-
name: item.name,
|
|
486
|
-
status: item.status,
|
|
487
|
-
assignee: item.assignee,
|
|
488
|
-
candidateUsers: item.candidateUsers,
|
|
489
|
-
candidateGroups: item.candidateGroups,
|
|
490
|
-
type: item.type,
|
|
491
|
-
})),
|
|
492
|
-
};
|
|
493
|
-
return result;
|
|
494
|
-
}
|
|
495
|
-
|
|
496
|
-
/**
|
|
497
|
-
* listen all events in bpmn-server engine, inclduded task and execution instances
|
|
498
|
-
* @param event bpmn-server event instance
|
|
499
|
-
*/
|
|
500
|
-
async applyEventListener(event) {
|
|
501
|
-
// console.log("Workflow", event.context.instance.name,", ID:",event.context.item.element.id,
|
|
502
|
-
// ", Type: " ,event.context.item.element.type, ", name: ", event.context.item.element.name, ", event type: ", event.event)
|
|
503
|
-
if (event.context.item) {
|
|
504
|
-
const workflowName: string = event.context.instance.name;
|
|
505
|
-
const eventType: EXECUTION_EVENT = event.event;
|
|
506
|
-
const elementType: BPMN_TYPE = event.context.item.element.type;
|
|
507
|
-
const elementId: string = event.context.item.element.id;
|
|
508
|
-
const elementName: string = event.context.item.element.name;
|
|
509
|
-
const elementProps = event.context.item.element.def;
|
|
510
|
-
// const usertaskinput = event.context.item.input ?? null;
|
|
511
|
-
const data = event.context.instance.data;
|
|
512
|
-
const appuser = this.robotUserService.prepareAppUser(data);
|
|
513
|
-
const vars = {};
|
|
514
|
-
Object.assign(vars, event.context.item.input);
|
|
515
|
-
event.context.item.input = {};
|
|
516
|
-
const options = event.context.options;
|
|
517
|
-
switch (elementType) {
|
|
518
|
-
case BPMN_TYPE.UserTask:
|
|
519
|
-
let usertaskeventtype: UserTaskEventType;
|
|
520
|
-
if (eventType == EXECUTION_EVENT.node_start)
|
|
521
|
-
usertaskeventtype = 'start';
|
|
522
|
-
else if (eventType == EXECUTION_EVENT.node_assign)
|
|
523
|
-
usertaskeventtype = 'assign';
|
|
524
|
-
else if (eventType == EXECUTION_EVENT.node_end)
|
|
525
|
-
usertaskeventtype = 'end';
|
|
526
|
-
else if (eventType == EXECUTION_EVENT.transform_input)
|
|
527
|
-
usertaskeventtype = 'invoked';
|
|
528
|
-
else if (eventType == EXECUTION_EVENT.node_wait)
|
|
529
|
-
usertaskeventtype = 'wait';
|
|
530
|
-
// console.log("event-------=================================",eventType,usertaskeventtype)
|
|
531
|
-
const assignee = event.context.item.assignee;
|
|
532
|
-
const candidateUsers = event.context.item.candidateUsers;
|
|
533
|
-
const candidateGroups = event.context.item.candidateGroups;
|
|
534
|
-
|
|
535
|
-
if (usertaskeventtype) {
|
|
536
|
-
('');
|
|
537
|
-
const props: UserTaskData = {
|
|
538
|
-
workflowName: workflowName,
|
|
539
|
-
eventType: usertaskeventtype,
|
|
540
|
-
elementType: 'bpmn:UserTask',
|
|
541
|
-
elementId: elementId,
|
|
542
|
-
elementName: elementName,
|
|
543
|
-
elementProps: {
|
|
544
|
-
startedAt: event.context.item.startedAt,
|
|
545
|
-
assignee: assignee,
|
|
546
|
-
candidateGroups: candidateGroups,
|
|
547
|
-
candidateUsers: candidateUsers,
|
|
548
|
-
dueDate: event.context.item.dueDate,
|
|
549
|
-
followUpDate: event.context.item.followUpDate,
|
|
550
|
-
priority: event.context.item.priority,
|
|
551
|
-
formKey: elementProps.formKey,
|
|
552
|
-
},
|
|
553
|
-
data: data,
|
|
554
|
-
vars: vars,
|
|
555
|
-
options: options,
|
|
556
|
-
};
|
|
557
|
-
|
|
558
|
-
//send notification
|
|
559
|
-
this.eventEmitter.emit(
|
|
560
|
-
`${workflowName}.${elementId}.${usertaskeventtype}`,
|
|
561
|
-
appuser,
|
|
562
|
-
|
|
563
|
-
props,
|
|
564
|
-
);
|
|
565
|
-
}
|
|
566
|
-
|
|
567
|
-
break;
|
|
568
|
-
case BPMN_TYPE.ServiceTask:
|
|
569
|
-
let servicetaskeventtype: ServiceTaskEventType;
|
|
570
|
-
if (eventType == EXECUTION_EVENT.node_start)
|
|
571
|
-
servicetaskeventtype = 'start';
|
|
572
|
-
else if (eventType == EXECUTION_EVENT.node_end)
|
|
573
|
-
servicetaskeventtype = 'end';
|
|
574
|
-
if (servicetaskeventtype) {
|
|
575
|
-
const props: ServiceTaskData = {
|
|
576
|
-
workflowName: workflowName,
|
|
577
|
-
eventType: servicetaskeventtype,
|
|
578
|
-
elementType: 'bpmn:ServiceTask',
|
|
579
|
-
elementId: elementId,
|
|
580
|
-
elementName: elementName,
|
|
581
|
-
data: data,
|
|
582
|
-
vars: vars,
|
|
583
|
-
options: options,
|
|
584
|
-
};
|
|
585
|
-
this.eventEmitter.emit(
|
|
586
|
-
`${workflowName}.${elementId}.${servicetaskeventtype}`,
|
|
587
|
-
// appuser,
|
|
588
|
-
props,
|
|
589
|
-
);
|
|
590
|
-
}
|
|
591
|
-
break;
|
|
592
|
-
default: //do nothing at the moment
|
|
593
|
-
break;
|
|
594
|
-
}
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
|
|
598
|
-
// async userResolver(
|
|
599
|
-
// appuser: UserContext,
|
|
600
|
-
// userids: string | string[] | undefined,
|
|
601
|
-
// data: any,
|
|
602
|
-
// ) {
|
|
603
|
-
// if (!userids) return undefined;
|
|
604
|
-
// if (typeof userids == 'string') userids = [userids];
|
|
605
|
-
// if (!Array.isArray(userids)) return undefined;
|
|
606
|
-
// const newids: string[] = [];
|
|
607
|
-
// for (let i = 0; i < userids.length; i++) {
|
|
608
|
-
// let uid = userids[i].trim();
|
|
609
|
-
// if (
|
|
610
|
-
// uid.substring(0, 1) == '@' &&
|
|
611
|
-
// uid.includes('[') &&
|
|
612
|
-
// uid.includes(']')
|
|
613
|
-
// ) {
|
|
614
|
-
// const regextype = /(?<=\@)(.*?)(?=\[)/;
|
|
615
|
-
// const regexvalue = /(?<=\[)(.*?)(?=\])/;
|
|
616
|
-
|
|
617
|
-
// const usertype = uid.match(regextype)[0].trim();
|
|
618
|
-
// const typevalue = uid.match(regexvalue)[0].trim();
|
|
619
|
-
// let idvalue = '';
|
|
620
|
-
// if (typevalue.substring(0, 6) == '$data.') {
|
|
621
|
-
// const fieldpath = typevalue.replace('$data.', '');
|
|
622
|
-
// idvalue = this.readFieldFromData(fieldpath, data);
|
|
623
|
-
// }
|
|
624
|
-
|
|
625
|
-
// uid = await this.userResolverService.resolve(
|
|
626
|
-
// appuser,
|
|
627
|
-
// usertype,
|
|
628
|
-
// idvalue,
|
|
629
|
-
// data,
|
|
630
|
-
// );
|
|
631
|
-
// }
|
|
632
|
-
// if (uid) newids.push(uid);
|
|
633
|
-
// }
|
|
634
|
-
|
|
635
|
-
// return newids;
|
|
636
|
-
// }
|
|
637
|
-
|
|
638
|
-
// readFieldFromData(path: string, data: any) {
|
|
639
|
-
// return path.split('.').reduce((o, i) => o[i], data);
|
|
640
|
-
// }
|
|
641
|
-
}
|