@nocobase/plugin-workflow 0.11.1-alpha.5 → 0.12.0-alpha.2
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/client.d.ts +2 -3
- package/client.js +1 -1
- package/dist/client/index.js +7802 -0
- package/{lib → dist}/client/nodes/aggregate.d.ts +1 -5
- package/{lib → dist}/client/nodes/create.d.ts +1 -2
- package/{lib → dist}/client/nodes/destroy.d.ts +1 -1
- package/{lib → dist}/client/nodes/query.d.ts +1 -2
- package/{lib → dist}/client/nodes/request.d.ts +1 -2
- package/{lib → dist}/client/nodes/update.d.ts +1 -1
- package/{lib → dist}/client/schemas/collection.d.ts +1 -2
- package/{lib → dist}/client/triggers/collection.d.ts +6 -7
- package/{lib → dist}/index.d.ts +1 -0
- package/dist/index.js +18 -0
- package/dist/locale/en-US.js +133 -0
- package/{lib → dist}/locale/es-ES.js +51 -54
- package/dist/locale/fr-FR.js +133 -0
- package/dist/locale/ja-JP.js +91 -0
- package/dist/locale/pt-BR.js +133 -0
- package/dist/locale/ru-RU.js +91 -0
- package/dist/locale/tr-TR.js +91 -0
- package/dist/locale/zh-CN.js +216 -0
- package/dist/node_modules/cron-parser/.eslintrc.json +15 -0
- package/dist/node_modules/cron-parser/.travis.yml +7 -0
- package/dist/node_modules/cron-parser/LICENSE +21 -0
- package/dist/node_modules/cron-parser/component.json +11 -0
- package/dist/node_modules/cron-parser/index.d.ts +1 -0
- package/dist/node_modules/cron-parser/lib/date.js +252 -0
- package/dist/node_modules/cron-parser/lib/expression.js +983 -0
- package/dist/node_modules/cron-parser/lib/field_compactor.js +70 -0
- package/dist/node_modules/cron-parser/lib/field_stringify.js +38 -0
- package/dist/node_modules/cron-parser/lib/parser.js +1 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/amd/luxon.js +8489 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/cjs-browser/luxon.js +8487 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.js +8490 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/global/luxon.min.js +1 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/build/node/luxon.js +7522 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/package.json +96 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/datetime.js +2169 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/duration.js +880 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/errors.js +61 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/conversions.js +157 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/diff.js +80 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/digits.js +76 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/english.js +233 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formats.js +191 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/formatter.js +386 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/invalid.js +14 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/locale.js +482 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/regexParser.js +335 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/tokenParser.js +424 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/util.js +292 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/impl/zoneUtil.js +36 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/info.js +193 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/interval.js +602 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxon.js +26 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/luxonFilled.js +13 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/settings.js +137 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zone.js +88 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/IANAZone.js +191 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/fixedOffsetZone.js +94 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/invalidZone.js +53 -0
- package/dist/node_modules/cron-parser/node_modules/luxon/src/zones/localZone.js +63 -0
- package/dist/node_modules/cron-parser/package.json +1 -0
- package/dist/node_modules/cron-parser/test/31_of_month.js +17 -0
- package/dist/node_modules/cron-parser/test/bug.js +29 -0
- package/dist/node_modules/cron-parser/test/crondate.js +16 -0
- package/dist/node_modules/cron-parser/test/crontab.example +7 -0
- package/dist/node_modules/cron-parser/test/empty_around_comma.js +22 -0
- package/dist/node_modules/cron-parser/test/expression.js +1489 -0
- package/dist/node_modules/cron-parser/test/field_compactor.js +250 -0
- package/dist/node_modules/cron-parser/test/field_stringify.js +84 -0
- package/dist/node_modules/cron-parser/test/fields.js +32 -0
- package/dist/node_modules/cron-parser/test/increment_on_first_iteration.js +22 -0
- package/dist/node_modules/cron-parser/test/index-ts3.test-d.ts +133 -0
- package/dist/node_modules/cron-parser/test/index.test-d.ts +138 -0
- package/dist/node_modules/cron-parser/test/leap_year.js +17 -0
- package/dist/node_modules/cron-parser/test/parser.js +46 -0
- package/dist/node_modules/cron-parser/test/parser_crondate_formats.js +145 -0
- package/dist/node_modules/cron-parser/test/parser_day_of_month.js +169 -0
- package/dist/node_modules/cron-parser/test/prev_date.js +32 -0
- package/dist/node_modules/cron-parser/test/stringify.js +402 -0
- package/dist/node_modules/cron-parser/test/timezone.js +422 -0
- package/dist/node_modules/cron-parser/types/common.d.ts +131 -0
- package/dist/node_modules/cron-parser/types/index.d.ts +45 -0
- package/dist/node_modules/cron-parser/types/ts3/index.d.ts +28 -0
- package/dist/node_modules/lru-cache/index-cjs.d.ts +7 -0
- package/dist/node_modules/lru-cache/index-cjs.js +1 -0
- package/dist/node_modules/lru-cache/index.d.ts +807 -0
- package/dist/node_modules/lru-cache/index.js +1334 -0
- package/dist/node_modules/lru-cache/index.min.js +2 -0
- package/dist/node_modules/lru-cache/package.json +1 -0
- package/dist/server/Plugin.js +297 -0
- package/{src/server/Processor.ts → dist/server/Processor.js} +80 -147
- package/dist/server/actions/index.js +49 -0
- package/{src/server/actions/nodes.ts → dist/server/actions/nodes.js} +55 -81
- package/{src/server/actions/workflows.ts → dist/server/actions/workflows.js} +60 -72
- package/dist/server/collections/executions.js +37 -0
- package/dist/server/collections/flow_nodes.js +56 -0
- package/dist/server/collections/jobs.js +33 -0
- package/dist/server/collections/workflows.js +90 -0
- package/{lib → dist}/server/constants.js +5 -8
- package/dist/server/fields/expression-field.js +11 -0
- package/dist/server/fields/index.js +11 -0
- package/dist/server/functions/index.js +13 -0
- package/dist/server/index.js +41 -0
- package/dist/server/instructions/aggregate.js +37 -0
- package/dist/server/instructions/calculation.js +34 -0
- package/dist/server/instructions/condition.js +123 -0
- package/{src/server/instructions/create.ts → dist/server/instructions/create.js} +17 -17
- package/dist/server/instructions/delay.js +87 -0
- package/dist/server/instructions/destroy.js +24 -0
- package/dist/server/instructions/index.js +40 -0
- package/{src/server/instructions/loop.ts → dist/server/instructions/loop.js} +21 -43
- package/{src/server/instructions/manual/actions.ts → dist/server/instructions/manual/actions.js} +18 -44
- package/dist/server/instructions/manual/collecions/jobs.js +21 -0
- package/dist/server/instructions/manual/collecions/users.js +19 -0
- package/dist/server/instructions/manual/collecions/users_jobs.js +52 -0
- package/{src/server/instructions/manual/forms/create.ts → dist/server/instructions/manual/forms/create.js} +8 -8
- package/dist/server/instructions/manual/forms/index.js +16 -0
- package/{src/server/instructions/manual/forms/update.ts → dist/server/instructions/manual/forms/update.js} +8 -8
- package/dist/server/instructions/manual/index.js +160 -0
- package/dist/server/instructions/parallel.js +105 -0
- package/dist/server/instructions/query.js +36 -0
- package/dist/server/instructions/request.js +69 -0
- package/dist/server/instructions/sql.js +26 -0
- package/dist/server/instructions/update.js +24 -0
- package/{src/server/migrations/20221129153547-calculation-variables.ts → dist/server/migrations/20221129153547-calculation-variables.js} +20 -19
- package/dist/server/migrations/20230221032941-change-request-body-type.js +71 -0
- package/dist/server/migrations/20230221071831-calculation-expression.js +94 -0
- package/dist/server/migrations/20230221121203-condition-calculation.js +41 -0
- package/dist/server/migrations/20230221162902-jsonb-to-json.js +52 -0
- package/dist/server/migrations/20230411034722-manual-multi-form.js +252 -0
- package/dist/server/migrations/20230612021134-manual-collection-block.js +126 -0
- package/dist/server/migrations/20230710115902-manual-action-values.js +74 -0
- package/{src/server/triggers/collection.ts → dist/server/triggers/collection.js} +34 -64
- package/dist/server/triggers/index.js +27 -0
- package/{src/server/triggers/schedule.ts → dist/server/triggers/schedule.js} +108 -220
- package/dist/server/types/Execution.js +8 -0
- package/dist/server/types/FlowNode.js +8 -0
- package/dist/server/types/Job.js +8 -0
- package/dist/server/types/Workflow.js +8 -0
- package/dist/server/types/index.js +2 -0
- package/{lib → dist}/server/utils.js +6 -8
- package/package.json +26 -37
- package/server.d.ts +2 -3
- package/server.js +1 -1
- package/lib/client/AddButton.js +0 -161
- package/lib/client/Branch.js +0 -50
- package/lib/client/CanvasContent.js +0 -51
- package/lib/client/ExecutionCanvas.js +0 -218
- package/lib/client/ExecutionLink.js +0 -48
- package/lib/client/ExecutionPage.js +0 -68
- package/lib/client/ExecutionResourceProvider.js +0 -48
- package/lib/client/FlowContext.js +0 -21
- package/lib/client/WorkflowCanvas.js +0 -300
- package/lib/client/WorkflowLink.js +0 -48
- package/lib/client/WorkflowPage.js +0 -70
- package/lib/client/WorkflowProvider.js +0 -100
- package/lib/client/components/CollectionBlockInitializer.js +0 -103
- package/lib/client/components/CollectionFieldset.js +0 -198
- package/lib/client/components/Duration.js +0 -72
- package/lib/client/components/DynamicExpression.js +0 -117
- package/lib/client/components/FieldsSelect.js +0 -72
- package/lib/client/components/FilterDynamicComponent.js +0 -34
- package/lib/client/components/NodeDescription.js +0 -73
- package/lib/client/components/NullRender.js +0 -9
- package/lib/client/components/OpenDrawer.js +0 -68
- package/lib/client/components/RadioWithTooltip.js +0 -65
- package/lib/client/components/ValueBlock.js +0 -103
- package/lib/client/components/renderEngineReference.js +0 -49
- package/lib/client/constants.js +0 -126
- package/lib/client/index.js +0 -121
- package/lib/client/interfaces/expression.js +0 -38
- package/lib/client/locale/index.js +0 -42
- package/lib/client/nodes/aggregate.js +0 -353
- package/lib/client/nodes/calculation.js +0 -292
- package/lib/client/nodes/condition.js +0 -531
- package/lib/client/nodes/create.js +0 -110
- package/lib/client/nodes/delay.js +0 -47
- package/lib/client/nodes/destroy.js +0 -49
- package/lib/client/nodes/index.js +0 -550
- package/lib/client/nodes/loop.js +0 -171
- package/lib/client/nodes/manual/AssigneesSelect.js +0 -56
- package/lib/client/nodes/manual/DetailsBlockProvider.js +0 -106
- package/lib/client/nodes/manual/FormBlockInitializer.js +0 -107
- package/lib/client/nodes/manual/FormBlockProvider.js +0 -113
- package/lib/client/nodes/manual/ModeConfig.js +0 -126
- package/lib/client/nodes/manual/SchemaConfig.js +0 -468
- package/lib/client/nodes/manual/WorkflowTodo.js +0 -642
- package/lib/client/nodes/manual/WorkflowTodoBlockInitializer.js +0 -60
- package/lib/client/nodes/manual/forms/create.js +0 -111
- package/lib/client/nodes/manual/forms/custom.js +0 -428
- package/lib/client/nodes/manual/forms/update.js +0 -168
- package/lib/client/nodes/manual/index.js +0 -168
- package/lib/client/nodes/manual/utils.js +0 -31
- package/lib/client/nodes/parallel.js +0 -162
- package/lib/client/nodes/query.js +0 -112
- package/lib/client/nodes/request.js +0 -225
- package/lib/client/nodes/sql.js +0 -61
- package/lib/client/nodes/update.js +0 -127
- package/lib/client/schemas/collection.js +0 -93
- package/lib/client/schemas/executions.js +0 -190
- package/lib/client/schemas/workflows.js +0 -397
- package/lib/client/style.js +0 -350
- package/lib/client/triggers/collection.js +0 -188
- package/lib/client/triggers/index.js +0 -356
- package/lib/client/triggers/schedule/EndsByField.js +0 -71
- package/lib/client/triggers/schedule/OnField.js +0 -117
- package/lib/client/triggers/schedule/RepeatField.js +0 -155
- package/lib/client/triggers/schedule/ScheduleConfig.js +0 -251
- package/lib/client/triggers/schedule/constants.js +0 -11
- package/lib/client/triggers/schedule/index.js +0 -101
- package/lib/client/triggers/schedule/locale/Cron.zh-CN.js +0 -48
- package/lib/client/utils.js +0 -59
- package/lib/client/variable.js +0 -319
- package/lib/index.js +0 -13
- package/lib/locale/en-US.js +0 -136
- package/lib/locale/fr-FR.js +0 -136
- package/lib/locale/ja-JP.js +0 -94
- package/lib/locale/pt-BR.js +0 -136
- package/lib/locale/ru-RU.js +0 -94
- package/lib/locale/tr-TR.js +0 -94
- package/lib/locale/zh-CN.js +0 -219
- package/lib/server/Plugin.js +0 -382
- package/lib/server/Processor.js +0 -394
- package/lib/server/actions/index.js +0 -30
- package/lib/server/actions/nodes.js +0 -269
- package/lib/server/actions/workflows.js +0 -273
- package/lib/server/collections/executions.js +0 -33
- package/lib/server/collections/flow_nodes.js +0 -53
- package/lib/server/collections/jobs.js +0 -30
- package/lib/server/collections/workflows.js +0 -76
- package/lib/server/fields/expression-field.js +0 -19
- package/lib/server/fields/index.js +0 -12
- package/lib/server/functions/index.js +0 -26
- package/lib/server/index.js +0 -55
- package/lib/server/instructions/aggregate.js +0 -57
- package/lib/server/instructions/calculation.js +0 -59
- package/lib/server/instructions/condition.js +0 -150
- package/lib/server/instructions/create.js +0 -60
- package/lib/server/instructions/delay.js +0 -118
- package/lib/server/instructions/destroy.js +0 -37
- package/lib/server/instructions/index.js +0 -44
- package/lib/server/instructions/loop.js +0 -107
- package/lib/server/instructions/manual/actions.js +0 -99
- package/lib/server/instructions/manual/collecions/jobs.js +0 -21
- package/lib/server/instructions/manual/collecions/users.js +0 -19
- package/lib/server/instructions/manual/collecions/users_jobs.js +0 -46
- package/lib/server/instructions/manual/forms/create.js +0 -52
- package/lib/server/instructions/manual/forms/index.js +0 -15
- package/lib/server/instructions/manual/forms/update.js +0 -53
- package/lib/server/instructions/manual/index.js +0 -174
- package/lib/server/instructions/parallel.js +0 -128
- package/lib/server/instructions/query.js +0 -53
- package/lib/server/instructions/request.js +0 -99
- package/lib/server/instructions/sql.js +0 -34
- package/lib/server/instructions/update.js +0 -38
- package/lib/server/migrations/20221129153547-calculation-variables.js +0 -92
- package/lib/server/migrations/20230221032941-change-request-body-type.js +0 -90
- package/lib/server/migrations/20230221071831-calculation-expression.js +0 -111
- package/lib/server/migrations/20230221121203-condition-calculation.js +0 -103
- package/lib/server/migrations/20230221162902-jsonb-to-json.js +0 -64
- package/lib/server/migrations/20230411034722-manual-multi-form.js +0 -297
- package/lib/server/migrations/20230612021134-manual-collection-block.js +0 -155
- package/lib/server/migrations/20230710115902-manual-action-values.js +0 -97
- package/lib/server/triggers/collection.js +0 -175
- package/lib/server/triggers/index.js +0 -46
- package/lib/server/triggers/schedule.js +0 -582
- package/lib/server/types/Execution.js +0 -15
- package/lib/server/types/FlowNode.js +0 -15
- package/lib/server/types/Job.js +0 -15
- package/lib/server/types/Workflow.js +0 -15
- package/lib/server/types/index.js +0 -5
- package/src/client/AddButton.tsx +0 -111
- package/src/client/Branch.tsx +0 -37
- package/src/client/CanvasContent.tsx +0 -25
- package/src/client/ExecutionCanvas.tsx +0 -166
- package/src/client/ExecutionLink.tsx +0 -16
- package/src/client/ExecutionPage.tsx +0 -45
- package/src/client/ExecutionResourceProvider.tsx +0 -21
- package/src/client/FlowContext.ts +0 -7
- package/src/client/WorkflowCanvas.tsx +0 -221
- package/src/client/WorkflowLink.tsx +0 -16
- package/src/client/WorkflowPage.tsx +0 -52
- package/src/client/WorkflowProvider.tsx +0 -84
- package/src/client/components/CollectionBlockInitializer.tsx +0 -71
- package/src/client/components/CollectionFieldset.tsx +0 -152
- package/src/client/components/Duration.tsx +0 -45
- package/src/client/components/DynamicExpression.tsx +0 -57
- package/src/client/components/FieldsSelect.tsx +0 -32
- package/src/client/components/FilterDynamicComponent.tsx +0 -15
- package/src/client/components/NodeDescription.tsx +0 -51
- package/src/client/components/NullRender.tsx +0 -3
- package/src/client/components/OpenDrawer.tsx +0 -24
- package/src/client/components/RadioWithTooltip.tsx +0 -38
- package/src/client/components/ValueBlock.tsx +0 -67
- package/src/client/components/renderEngineReference.tsx +0 -30
- package/src/client/constants.tsx +0 -91
- package/src/client/index.tsx +0 -51
- package/src/client/interfaces/expression.tsx +0 -25
- package/src/client/locale/index.ts +0 -18
- package/src/client/nodes/aggregate.tsx +0 -327
- package/src/client/nodes/calculation.tsx +0 -216
- package/src/client/nodes/condition.tsx +0 -463
- package/src/client/nodes/create.tsx +0 -85
- package/src/client/nodes/delay.tsx +0 -37
- package/src/client/nodes/destroy.tsx +0 -34
- package/src/client/nodes/index.tsx +0 -500
- package/src/client/nodes/loop.tsx +0 -144
- package/src/client/nodes/manual/AssigneesSelect.tsx +0 -33
- package/src/client/nodes/manual/DetailsBlockProvider.tsx +0 -80
- package/src/client/nodes/manual/FormBlockInitializer.tsx +0 -69
- package/src/client/nodes/manual/FormBlockProvider.tsx +0 -75
- package/src/client/nodes/manual/ModeConfig.tsx +0 -84
- package/src/client/nodes/manual/SchemaConfig.tsx +0 -509
- package/src/client/nodes/manual/WorkflowTodo.tsx +0 -607
- package/src/client/nodes/manual/WorkflowTodoBlockInitializer.tsx +0 -28
- package/src/client/nodes/manual/forms/create.tsx +0 -92
- package/src/client/nodes/manual/forms/custom.tsx +0 -392
- package/src/client/nodes/manual/forms/update.tsx +0 -134
- package/src/client/nodes/manual/index.tsx +0 -162
- package/src/client/nodes/manual/utils.ts +0 -28
- package/src/client/nodes/parallel.tsx +0 -138
- package/src/client/nodes/query.tsx +0 -88
- package/src/client/nodes/request.tsx +0 -185
- package/src/client/nodes/sql.tsx +0 -37
- package/src/client/nodes/update.tsx +0 -100
- package/src/client/schemas/collection.ts +0 -75
- package/src/client/schemas/executions.tsx +0 -169
- package/src/client/schemas/workflows.ts +0 -364
- package/src/client/style.tsx +0 -350
- package/src/client/triggers/collection.tsx +0 -190
- package/src/client/triggers/index.tsx +0 -311
- package/src/client/triggers/schedule/EndsByField.tsx +0 -40
- package/src/client/triggers/schedule/OnField.tsx +0 -64
- package/src/client/triggers/schedule/RepeatField.tsx +0 -116
- package/src/client/triggers/schedule/ScheduleConfig.tsx +0 -227
- package/src/client/triggers/schedule/constants.ts +0 -4
- package/src/client/triggers/schedule/index.tsx +0 -78
- package/src/client/triggers/schedule/locale/Cron.zh-CN.ts +0 -79
- package/src/client/utils.ts +0 -36
- package/src/client/variable.tsx +0 -318
- package/src/index.ts +0 -1
- package/src/locale/en-US.ts +0 -136
- package/src/locale/es-ES.ts +0 -129
- package/src/locale/fr-FR.ts +0 -137
- package/src/locale/ja-JP.ts +0 -90
- package/src/locale/pt-BR.ts +0 -136
- package/src/locale/ru-RU.ts +0 -90
- package/src/locale/tr-TR.ts +0 -90
- package/src/locale/zh-CN.ts +0 -248
- package/src/server/Plugin.ts +0 -355
- package/src/server/__tests__/Plugin.test.ts +0 -398
- package/src/server/__tests__/Processor.test.ts +0 -474
- package/src/server/__tests__/actions/workflows.test.ts +0 -419
- package/src/server/__tests__/collections/categories.ts +0 -27
- package/src/server/__tests__/collections/comments.ts +0 -24
- package/src/server/__tests__/collections/posts.ts +0 -42
- package/src/server/__tests__/collections/replies.ts +0 -9
- package/src/server/__tests__/collections/tags.ts +0 -15
- package/src/server/__tests__/index.ts +0 -89
- package/src/server/__tests__/instructions/aggregate.test.ts +0 -294
- package/src/server/__tests__/instructions/calculation.test.ts +0 -265
- package/src/server/__tests__/instructions/condition.test.ts +0 -434
- package/src/server/__tests__/instructions/create.test.ts +0 -129
- package/src/server/__tests__/instructions/delay.test.ts +0 -182
- package/src/server/__tests__/instructions/destroy.test.ts +0 -58
- package/src/server/__tests__/instructions/loop.test.ts +0 -331
- package/src/server/__tests__/instructions/manual.test.ts +0 -1173
- package/src/server/__tests__/instructions/parallel.test.ts +0 -445
- package/src/server/__tests__/instructions/query.test.ts +0 -359
- package/src/server/__tests__/instructions/request.test.ts +0 -247
- package/src/server/__tests__/instructions/sql.test.ts +0 -162
- package/src/server/__tests__/instructions/update.test.ts +0 -189
- package/src/server/__tests__/triggers/collection.test.ts +0 -333
- package/src/server/__tests__/triggers/schedule.test.ts +0 -369
- package/src/server/actions/index.ts +0 -25
- package/src/server/collections/executions.ts +0 -35
- package/src/server/collections/flow_nodes.ts +0 -54
- package/src/server/collections/jobs.ts +0 -31
- package/src/server/collections/workflows.ts +0 -88
- package/src/server/constants.ts +0 -26
- package/src/server/fields/expression-field.ts +0 -11
- package/src/server/fields/index.ts +0 -7
- package/src/server/functions/index.ts +0 -16
- package/src/server/index.ts +0 -6
- package/src/server/instructions/aggregate.ts +0 -42
- package/src/server/instructions/calculation.ts +0 -41
- package/src/server/instructions/condition.ts +0 -172
- package/src/server/instructions/delay.ts +0 -105
- package/src/server/instructions/destroy.ts +0 -23
- package/src/server/instructions/index.ts +0 -64
- package/src/server/instructions/manual/collecions/jobs.ts +0 -17
- package/src/server/instructions/manual/collecions/users.ts +0 -15
- package/src/server/instructions/manual/collecions/users_jobs.ts +0 -50
- package/src/server/instructions/manual/forms/index.ts +0 -12
- package/src/server/instructions/manual/index.ts +0 -184
- package/src/server/instructions/parallel.ts +0 -121
- package/src/server/instructions/query.ts +0 -42
- package/src/server/instructions/request.ts +0 -88
- package/src/server/instructions/sql.ts +0 -25
- package/src/server/instructions/update.ts +0 -24
- package/src/server/migrations/20230221032941-change-request-body-type.ts +0 -76
- package/src/server/migrations/20230221071831-calculation-expression.ts +0 -102
- package/src/server/migrations/20230221121203-condition-calculation.ts +0 -82
- package/src/server/migrations/20230221162902-jsonb-to-json.ts +0 -51
- package/src/server/migrations/20230411034722-manual-multi-form.ts +0 -282
- package/src/server/migrations/20230612021134-manual-collection-block.ts +0 -138
- package/src/server/migrations/20230710115902-manual-action-values.ts +0 -78
- package/src/server/triggers/index.ts +0 -22
- package/src/server/types/Execution.ts +0 -26
- package/src/server/types/FlowNode.ts +0 -21
- package/src/server/types/Job.ts +0 -18
- package/src/server/types/Workflow.ts +0 -36
- package/src/server/types/index.ts +0 -4
- package/src/server/utils.ts +0 -17
- /package/{lib → dist}/client/AddButton.d.ts +0 -0
- /package/{lib → dist}/client/Branch.d.ts +0 -0
- /package/{lib → dist}/client/CanvasContent.d.ts +0 -0
- /package/{lib → dist}/client/ExecutionCanvas.d.ts +0 -0
- /package/{lib → dist}/client/ExecutionLink.d.ts +0 -0
- /package/{lib → dist}/client/ExecutionPage.d.ts +0 -0
- /package/{lib → dist}/client/ExecutionResourceProvider.d.ts +0 -0
- /package/{lib → dist}/client/FlowContext.d.ts +0 -0
- /package/{lib → dist}/client/WorkflowCanvas.d.ts +0 -0
- /package/{lib → dist}/client/WorkflowLink.d.ts +0 -0
- /package/{lib → dist}/client/WorkflowPage.d.ts +0 -0
- /package/{lib → dist}/client/WorkflowProvider.d.ts +0 -0
- /package/{lib → dist}/client/components/CollectionBlockInitializer.d.ts +0 -0
- /package/{lib → dist}/client/components/CollectionFieldset.d.ts +0 -0
- /package/{lib → dist}/client/components/Duration.d.ts +0 -0
- /package/{lib → dist}/client/components/DynamicExpression.d.ts +0 -0
- /package/{lib → dist}/client/components/FieldsSelect.d.ts +0 -0
- /package/{lib → dist}/client/components/FilterDynamicComponent.d.ts +0 -0
- /package/{lib → dist}/client/components/NodeDescription.d.ts +0 -0
- /package/{lib → dist}/client/components/NullRender.d.ts +0 -0
- /package/{lib → dist}/client/components/OpenDrawer.d.ts +0 -0
- /package/{lib → dist}/client/components/RadioWithTooltip.d.ts +0 -0
- /package/{lib → dist}/client/components/ValueBlock.d.ts +0 -0
- /package/{lib → dist}/client/components/renderEngineReference.d.ts +0 -0
- /package/{lib → dist}/client/constants.d.ts +0 -0
- /package/{lib → dist}/client/index.d.ts +0 -0
- /package/{lib → dist}/client/interfaces/expression.d.ts +0 -0
- /package/{lib → dist}/client/locale/index.d.ts +0 -0
- /package/{lib → dist}/client/nodes/calculation.d.ts +0 -0
- /package/{lib → dist}/client/nodes/condition.d.ts +0 -0
- /package/{lib → dist}/client/nodes/delay.d.ts +0 -0
- /package/{lib → dist}/client/nodes/index.d.ts +0 -0
- /package/{lib → dist}/client/nodes/loop.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/AssigneesSelect.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/DetailsBlockProvider.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/FormBlockInitializer.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/FormBlockProvider.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/ModeConfig.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/SchemaConfig.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/WorkflowTodo.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/WorkflowTodoBlockInitializer.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/forms/create.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/forms/custom.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/forms/update.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/index.d.ts +0 -0
- /package/{lib → dist}/client/nodes/manual/utils.d.ts +0 -0
- /package/{lib → dist}/client/nodes/parallel.d.ts +0 -0
- /package/{lib → dist}/client/nodes/sql.d.ts +0 -0
- /package/{lib → dist}/client/schemas/executions.d.ts +0 -0
- /package/{lib → dist}/client/schemas/workflows.d.ts +0 -0
- /package/{lib → dist}/client/style.d.ts +0 -0
- /package/{lib → dist}/client/triggers/index.d.ts +0 -0
- /package/{lib → dist}/client/triggers/schedule/EndsByField.d.ts +0 -0
- /package/{lib → dist}/client/triggers/schedule/OnField.d.ts +0 -0
- /package/{lib → dist}/client/triggers/schedule/RepeatField.d.ts +0 -0
- /package/{lib → dist}/client/triggers/schedule/ScheduleConfig.d.ts +0 -0
- /package/{lib → dist}/client/triggers/schedule/constants.d.ts +0 -0
- /package/{lib → dist}/client/triggers/schedule/index.d.ts +0 -0
- /package/{lib → dist}/client/triggers/schedule/locale/Cron.zh-CN.d.ts +0 -0
- /package/{lib → dist}/client/utils.d.ts +0 -0
- /package/{lib → dist}/client/variable.d.ts +0 -0
- /package/{lib → dist}/locale/en-US.d.ts +0 -0
- /package/{lib → dist}/locale/es-ES.d.ts +0 -0
- /package/{lib → dist}/locale/fr-FR.d.ts +0 -0
- /package/{lib → dist}/locale/ja-JP.d.ts +0 -0
- /package/{lib → dist}/locale/pt-BR.d.ts +0 -0
- /package/{lib → dist}/locale/ru-RU.d.ts +0 -0
- /package/{lib → dist}/locale/tr-TR.d.ts +0 -0
- /package/{lib → dist}/locale/zh-CN.d.ts +0 -0
- /package/{lib → dist}/server/Plugin.d.ts +0 -0
- /package/{lib → dist}/server/Processor.d.ts +0 -0
- /package/{lib → dist}/server/actions/index.d.ts +0 -0
- /package/{lib → dist}/server/actions/nodes.d.ts +0 -0
- /package/{lib → dist}/server/actions/workflows.d.ts +0 -0
- /package/{lib → dist}/server/collections/executions.d.ts +0 -0
- /package/{lib → dist}/server/collections/flow_nodes.d.ts +0 -0
- /package/{lib → dist}/server/collections/jobs.d.ts +0 -0
- /package/{lib → dist}/server/collections/workflows.d.ts +0 -0
- /package/{lib → dist}/server/constants.d.ts +0 -0
- /package/{lib → dist}/server/fields/expression-field.d.ts +0 -0
- /package/{lib → dist}/server/fields/index.d.ts +0 -0
- /package/{lib → dist}/server/functions/index.d.ts +0 -0
- /package/{lib → dist}/server/index.d.ts +0 -0
- /package/{lib → dist}/server/instructions/aggregate.d.ts +0 -0
- /package/{lib → dist}/server/instructions/calculation.d.ts +0 -0
- /package/{lib → dist}/server/instructions/condition.d.ts +0 -0
- /package/{lib → dist}/server/instructions/create.d.ts +0 -0
- /package/{lib → dist}/server/instructions/delay.d.ts +0 -0
- /package/{lib → dist}/server/instructions/destroy.d.ts +0 -0
- /package/{lib → dist}/server/instructions/index.d.ts +0 -0
- /package/{lib → dist}/server/instructions/loop.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/actions.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/collecions/jobs.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/collecions/users.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/collecions/users_jobs.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/forms/create.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/forms/index.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/forms/update.d.ts +0 -0
- /package/{lib → dist}/server/instructions/manual/index.d.ts +0 -0
- /package/{lib → dist}/server/instructions/parallel.d.ts +0 -0
- /package/{lib → dist}/server/instructions/query.d.ts +0 -0
- /package/{lib → dist}/server/instructions/request.d.ts +0 -0
- /package/{lib → dist}/server/instructions/sql.d.ts +0 -0
- /package/{lib → dist}/server/instructions/update.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20221129153547-calculation-variables.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230221032941-change-request-body-type.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230221071831-calculation-expression.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230221121203-condition-calculation.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230221162902-jsonb-to-json.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230411034722-manual-multi-form.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230612021134-manual-collection-block.d.ts +0 -0
- /package/{lib → dist}/server/migrations/20230710115902-manual-action-values.d.ts +0 -0
- /package/{lib → dist}/server/triggers/collection.d.ts +0 -0
- /package/{lib → dist}/server/triggers/index.d.ts +0 -0
- /package/{lib → dist}/server/triggers/schedule.d.ts +0 -0
- /package/{lib → dist}/server/types/Execution.d.ts +0 -0
- /package/{lib → dist}/server/types/FlowNode.d.ts +0 -0
- /package/{lib → dist}/server/types/Job.d.ts +0 -0
- /package/{lib → dist}/server/types/Workflow.d.ts +0 -0
- /package/{lib → dist}/server/types/index.d.ts +0 -0
- /package/{lib → dist}/server/utils.d.ts +0 -0
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
function _actions() {
|
|
8
|
-
const data = _interopRequireDefault(require("@nocobase/actions"));
|
|
9
|
-
_actions = function _actions() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function _utils() {
|
|
15
|
-
const data = require("@nocobase/utils");
|
|
16
|
-
_utils = function _utils() {
|
|
17
|
-
return data;
|
|
18
|
-
};
|
|
19
|
-
return data;
|
|
20
|
-
}
|
|
21
|
-
var _constants = require("../../constants");
|
|
22
|
-
var _jobs = _interopRequireDefault(require("./collecions/jobs"));
|
|
23
|
-
var _users = _interopRequireDefault(require("./collecions/users"));
|
|
24
|
-
var _users_jobs = _interopRequireDefault(require("./collecions/users_jobs"));
|
|
25
|
-
var _actions2 = require("./actions");
|
|
26
|
-
var _forms = _interopRequireDefault(require("./forms"));
|
|
27
|
-
const _excluded = ["mode"];
|
|
28
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
29
|
-
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
30
|
-
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
31
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
32
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
33
|
-
const MULTIPLE_ASSIGNED_MODE = {
|
|
34
|
-
SINGLE: Symbol('single'),
|
|
35
|
-
ALL: Symbol('all'),
|
|
36
|
-
ANY: Symbol('any'),
|
|
37
|
-
ALL_PERCENTAGE: Symbol('all percentage'),
|
|
38
|
-
ANY_PERCENTAGE: Symbol('any percentage')
|
|
39
|
-
};
|
|
40
|
-
const Modes = {
|
|
41
|
-
[MULTIPLE_ASSIGNED_MODE.SINGLE]: {
|
|
42
|
-
getStatus(distribution, assignees) {
|
|
43
|
-
const done = distribution.find(item => item.status !== _constants.JOB_STATUS.PENDING && item.count > 0);
|
|
44
|
-
return done ? done.status : null;
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
[MULTIPLE_ASSIGNED_MODE.ALL]: {
|
|
48
|
-
getStatus(distribution, assignees) {
|
|
49
|
-
const resolved = distribution.find(item => item.status === _constants.JOB_STATUS.RESOLVED);
|
|
50
|
-
if (resolved && resolved.count === assignees.length) {
|
|
51
|
-
return _constants.JOB_STATUS.RESOLVED;
|
|
52
|
-
}
|
|
53
|
-
const rejected = distribution.find(item => item.status < _constants.JOB_STATUS.PENDING);
|
|
54
|
-
if (rejected && rejected.count) {
|
|
55
|
-
return rejected.status;
|
|
56
|
-
}
|
|
57
|
-
return null;
|
|
58
|
-
}
|
|
59
|
-
},
|
|
60
|
-
[MULTIPLE_ASSIGNED_MODE.ANY]: {
|
|
61
|
-
getStatus(distribution, assignees) {
|
|
62
|
-
const resolved = distribution.find(item => item.status === _constants.JOB_STATUS.RESOLVED);
|
|
63
|
-
if (resolved && resolved.count) {
|
|
64
|
-
return _constants.JOB_STATUS.RESOLVED;
|
|
65
|
-
}
|
|
66
|
-
const rejectedCount = distribution.reduce((count, item) => item.status < _constants.JOB_STATUS.PENDING ? count + item.count : count, 0);
|
|
67
|
-
// NOTE: all failures are considered as rejected for now
|
|
68
|
-
if (rejectedCount === assignees.length) {
|
|
69
|
-
return _constants.JOB_STATUS.REJECTED;
|
|
70
|
-
}
|
|
71
|
-
return null;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
function getMode(mode) {
|
|
76
|
-
switch (true) {
|
|
77
|
-
case mode === 1:
|
|
78
|
-
return Modes[MULTIPLE_ASSIGNED_MODE.ALL];
|
|
79
|
-
case mode === -1:
|
|
80
|
-
return Modes[MULTIPLE_ASSIGNED_MODE.ANY];
|
|
81
|
-
case mode > 0:
|
|
82
|
-
return Modes[MULTIPLE_ASSIGNED_MODE.ALL_PERCENTAGE];
|
|
83
|
-
case mode < 0:
|
|
84
|
-
return Modes[MULTIPLE_ASSIGNED_MODE.ANY_PERCENTAGE];
|
|
85
|
-
default:
|
|
86
|
-
return Modes[MULTIPLE_ASSIGNED_MODE.SINGLE];
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
class _default {
|
|
90
|
-
constructor(plugin) {
|
|
91
|
-
this.plugin = void 0;
|
|
92
|
-
this.formTypes = new (_utils().Registry)();
|
|
93
|
-
this.plugin = plugin;
|
|
94
|
-
plugin.db.collection(_users_jobs.default);
|
|
95
|
-
plugin.db.extendCollection(_users.default);
|
|
96
|
-
plugin.db.extendCollection(_jobs.default);
|
|
97
|
-
plugin.app.resource({
|
|
98
|
-
name: 'users_jobs',
|
|
99
|
-
actions: {
|
|
100
|
-
list: {
|
|
101
|
-
filter: {
|
|
102
|
-
$or: [{
|
|
103
|
-
'workflow.enabled': true
|
|
104
|
-
}, {
|
|
105
|
-
'workflow.enabled': false,
|
|
106
|
-
status: {
|
|
107
|
-
$ne: _constants.JOB_STATUS.PENDING
|
|
108
|
-
}
|
|
109
|
-
}]
|
|
110
|
-
},
|
|
111
|
-
handler: _actions().default.list
|
|
112
|
-
},
|
|
113
|
-
submit: _actions2.submit
|
|
114
|
-
}
|
|
115
|
-
});
|
|
116
|
-
(0, _forms.default)(this);
|
|
117
|
-
}
|
|
118
|
-
run(node, prevJob, processor) {
|
|
119
|
-
return _asyncToGenerator(function* () {
|
|
120
|
-
var _prevJob$id;
|
|
121
|
-
const _node$config = node.config,
|
|
122
|
-
mode = _node$config.mode,
|
|
123
|
-
config = _objectWithoutProperties(_node$config, _excluded);
|
|
124
|
-
const assignees = [...new Set(processor.getParsedValue(config.assignees) || [])];
|
|
125
|
-
const job = yield processor.saveJob({
|
|
126
|
-
status: _constants.JOB_STATUS.PENDING,
|
|
127
|
-
result: mode ? [] : null,
|
|
128
|
-
nodeId: node.id,
|
|
129
|
-
upstreamId: (_prevJob$id = prevJob === null || prevJob === void 0 ? void 0 : prevJob.id) !== null && _prevJob$id !== void 0 ? _prevJob$id : null
|
|
130
|
-
});
|
|
131
|
-
// NOTE: batch create users jobs
|
|
132
|
-
const UserJobModel = processor.options.plugin.db.getModel('users_jobs');
|
|
133
|
-
yield UserJobModel.bulkCreate(assignees.map(userId => ({
|
|
134
|
-
userId,
|
|
135
|
-
jobId: job.id,
|
|
136
|
-
nodeId: node.id,
|
|
137
|
-
executionId: job.executionId,
|
|
138
|
-
workflowId: node.workflowId,
|
|
139
|
-
status: _constants.JOB_STATUS.PENDING
|
|
140
|
-
})), {
|
|
141
|
-
transaction: processor.transaction
|
|
142
|
-
});
|
|
143
|
-
return job;
|
|
144
|
-
})();
|
|
145
|
-
}
|
|
146
|
-
resume(node, job, processor) {
|
|
147
|
-
return _asyncToGenerator(function* () {
|
|
148
|
-
var _getMode$getStatus, _job$latestUserJob$re, _job$latestUserJob;
|
|
149
|
-
// NOTE: check all users jobs related if all done then continue as parallel
|
|
150
|
-
const _node$config2 = node.config,
|
|
151
|
-
_node$config2$assigne = _node$config2.assignees,
|
|
152
|
-
assignees = _node$config2$assigne === void 0 ? [] : _node$config2$assigne,
|
|
153
|
-
mode = _node$config2.mode;
|
|
154
|
-
const UserJobModel = processor.options.plugin.db.getModel('users_jobs');
|
|
155
|
-
const distribution = yield UserJobModel.count({
|
|
156
|
-
where: {
|
|
157
|
-
jobId: job.id
|
|
158
|
-
},
|
|
159
|
-
group: ['status'],
|
|
160
|
-
transaction: processor.transaction
|
|
161
|
-
});
|
|
162
|
-
const submitted = distribution.reduce((count, item) => item.status !== _constants.JOB_STATUS.PENDING ? count + item.count : count, 0);
|
|
163
|
-
const status = job.status || ((_getMode$getStatus = getMode(mode).getStatus(distribution, assignees)) !== null && _getMode$getStatus !== void 0 ? _getMode$getStatus : _constants.JOB_STATUS.PENDING);
|
|
164
|
-
const result = mode ? (submitted || 0) / assignees.length : (_job$latestUserJob$re = (_job$latestUserJob = job.latestUserJob) === null || _job$latestUserJob === void 0 ? void 0 : _job$latestUserJob.result) !== null && _job$latestUserJob$re !== void 0 ? _job$latestUserJob$re : job.result;
|
|
165
|
-
processor.logger.debug(`manual resume job and next status: ${status}`);
|
|
166
|
-
job.set({
|
|
167
|
-
status,
|
|
168
|
-
result
|
|
169
|
-
});
|
|
170
|
-
return job;
|
|
171
|
-
})();
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
exports.default = _default;
|
|
@@ -1,128 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = exports.PARALLEL_MODE = void 0;
|
|
7
|
-
var _constants = require("../constants");
|
|
8
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
-
const PARALLEL_MODE = {
|
|
11
|
-
ALL: 'all',
|
|
12
|
-
ANY: 'any',
|
|
13
|
-
RACE: 'race'
|
|
14
|
-
};
|
|
15
|
-
exports.PARALLEL_MODE = PARALLEL_MODE;
|
|
16
|
-
const Modes = {
|
|
17
|
-
[PARALLEL_MODE.ALL]: {
|
|
18
|
-
next(previous) {
|
|
19
|
-
return previous.status >= _constants.JOB_STATUS.PENDING;
|
|
20
|
-
},
|
|
21
|
-
getStatus(result) {
|
|
22
|
-
const failedStatus = result.find(status => status != null && status < _constants.JOB_STATUS.PENDING);
|
|
23
|
-
if (typeof failedStatus !== 'undefined') {
|
|
24
|
-
return failedStatus;
|
|
25
|
-
}
|
|
26
|
-
if (result.every(status => status != null && status === _constants.JOB_STATUS.RESOLVED)) {
|
|
27
|
-
return _constants.JOB_STATUS.RESOLVED;
|
|
28
|
-
}
|
|
29
|
-
return _constants.JOB_STATUS.PENDING;
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
[PARALLEL_MODE.ANY]: {
|
|
33
|
-
next(previous) {
|
|
34
|
-
return previous.status <= _constants.JOB_STATUS.PENDING;
|
|
35
|
-
},
|
|
36
|
-
getStatus(result) {
|
|
37
|
-
if (result.some(status => status != null && status === _constants.JOB_STATUS.RESOLVED)) {
|
|
38
|
-
return _constants.JOB_STATUS.RESOLVED;
|
|
39
|
-
}
|
|
40
|
-
if (result.some(status => status != null ? status === _constants.JOB_STATUS.PENDING : true)) {
|
|
41
|
-
return _constants.JOB_STATUS.PENDING;
|
|
42
|
-
}
|
|
43
|
-
return _constants.JOB_STATUS.FAILED;
|
|
44
|
-
}
|
|
45
|
-
},
|
|
46
|
-
[PARALLEL_MODE.RACE]: {
|
|
47
|
-
next(previous) {
|
|
48
|
-
return previous.status === _constants.JOB_STATUS.PENDING;
|
|
49
|
-
},
|
|
50
|
-
getStatus(result) {
|
|
51
|
-
if (result.some(status => status != null && status === _constants.JOB_STATUS.RESOLVED)) {
|
|
52
|
-
return _constants.JOB_STATUS.RESOLVED;
|
|
53
|
-
}
|
|
54
|
-
const failedStatus = result.find(status => status != null && status < _constants.JOB_STATUS.PENDING);
|
|
55
|
-
if (typeof failedStatus !== 'undefined') {
|
|
56
|
-
return failedStatus;
|
|
57
|
-
}
|
|
58
|
-
return _constants.JOB_STATUS.PENDING;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
};
|
|
62
|
-
var _default = {
|
|
63
|
-
run(node, prevJob, processor) {
|
|
64
|
-
return _asyncToGenerator(function* () {
|
|
65
|
-
var _prevJob$id;
|
|
66
|
-
const branches = processor.getBranches(node);
|
|
67
|
-
const job = yield processor.saveJob({
|
|
68
|
-
status: _constants.JOB_STATUS.PENDING,
|
|
69
|
-
result: Array(branches.length).fill(null),
|
|
70
|
-
nodeId: node.id,
|
|
71
|
-
upstreamId: (_prevJob$id = prevJob === null || prevJob === void 0 ? void 0 : prevJob.id) !== null && _prevJob$id !== void 0 ? _prevJob$id : null
|
|
72
|
-
});
|
|
73
|
-
// NOTE:
|
|
74
|
-
// use `reduce` but not `Promise.all` here to avoid racing manupulating db.
|
|
75
|
-
// for users, this is almost equivalent to `Promise.all`,
|
|
76
|
-
// because of the delay is not significant sensible.
|
|
77
|
-
// another benifit of this is, it could handle sequenced branches in future.
|
|
78
|
-
const _node$config$mode = node.config.mode,
|
|
79
|
-
mode = _node$config$mode === void 0 ? PARALLEL_MODE.ALL : _node$config$mode;
|
|
80
|
-
yield branches.reduce((promise, branch, i) => promise.then( /*#__PURE__*/function () {
|
|
81
|
-
var _ref = _asyncToGenerator(function* (previous) {
|
|
82
|
-
if (i && !Modes[mode].next(previous)) {
|
|
83
|
-
return previous;
|
|
84
|
-
}
|
|
85
|
-
yield processor.run(branch, job);
|
|
86
|
-
// find last job of the branch
|
|
87
|
-
return processor.findBranchLastJob(branch);
|
|
88
|
-
});
|
|
89
|
-
return function (_x) {
|
|
90
|
-
return _ref.apply(this, arguments);
|
|
91
|
-
};
|
|
92
|
-
}()), Promise.resolve());
|
|
93
|
-
return null;
|
|
94
|
-
})();
|
|
95
|
-
},
|
|
96
|
-
resume(node, branchJob, processor) {
|
|
97
|
-
return _asyncToGenerator(function* () {
|
|
98
|
-
const job = processor.findBranchParentJob(branchJob, node);
|
|
99
|
-
const result = job.result,
|
|
100
|
-
status = job.status;
|
|
101
|
-
// if parallel has been done (resolved / rejected), do not care newly executed branch jobs.
|
|
102
|
-
if (status !== _constants.JOB_STATUS.PENDING) {
|
|
103
|
-
return processor.exit();
|
|
104
|
-
}
|
|
105
|
-
// find the index of the node which start the branch
|
|
106
|
-
const jobNode = processor.nodesMap.get(branchJob.nodeId);
|
|
107
|
-
const branchStartNode = processor.findBranchStartNode(jobNode, node);
|
|
108
|
-
const branches = processor.getBranches(node);
|
|
109
|
-
const branchIndex = branches.indexOf(branchStartNode);
|
|
110
|
-
const _ref2 = node.config || {},
|
|
111
|
-
_ref2$mode = _ref2.mode,
|
|
112
|
-
mode = _ref2$mode === void 0 ? PARALLEL_MODE.ALL : _ref2$mode;
|
|
113
|
-
const newResult = [...result.slice(0, branchIndex), branchJob.status, ...result.slice(branchIndex + 1)];
|
|
114
|
-
job.set({
|
|
115
|
-
result: newResult,
|
|
116
|
-
status: Modes[mode].getStatus(newResult)
|
|
117
|
-
});
|
|
118
|
-
if (job.status === _constants.JOB_STATUS.PENDING) {
|
|
119
|
-
yield job.save({
|
|
120
|
-
transaction: processor.transaction
|
|
121
|
-
});
|
|
122
|
-
return processor.exit();
|
|
123
|
-
}
|
|
124
|
-
return job;
|
|
125
|
-
})();
|
|
126
|
-
}
|
|
127
|
-
};
|
|
128
|
-
exports.default = _default;
|
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _constants = require("../constants");
|
|
8
|
-
var _utils = require("../utils");
|
|
9
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
10
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
11
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
12
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
13
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
14
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
15
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
16
|
-
var _default = {
|
|
17
|
-
run(node, input, processor) {
|
|
18
|
-
return _asyncToGenerator(function* () {
|
|
19
|
-
const _node$config = node.config,
|
|
20
|
-
collection = _node$config.collection,
|
|
21
|
-
multiple = _node$config.multiple,
|
|
22
|
-
_node$config$params = _node$config.params,
|
|
23
|
-
params = _node$config$params === void 0 ? {} : _node$config$params,
|
|
24
|
-
_node$config$failOnEm = _node$config.failOnEmpty,
|
|
25
|
-
failOnEmpty = _node$config$failOnEm === void 0 ? false : _node$config$failOnEm;
|
|
26
|
-
const repo = node.constructor.database.getRepository(collection);
|
|
27
|
-
const options = processor.getParsedValue(params, node);
|
|
28
|
-
const appends = options.appends ? Array.from(options.appends.reduce((set, field) => {
|
|
29
|
-
set.add(field.split('.')[0]);
|
|
30
|
-
set.add(field);
|
|
31
|
-
return set;
|
|
32
|
-
}, new Set())) : options.appends;
|
|
33
|
-
const result = yield (multiple ? repo.find : repo.findOne).call(repo, _objectSpread(_objectSpread({}, options), {}, {
|
|
34
|
-
appends: appends,
|
|
35
|
-
transaction: processor.transaction
|
|
36
|
-
}));
|
|
37
|
-
if (failOnEmpty && (multiple ? !result.length : !result)) {
|
|
38
|
-
return {
|
|
39
|
-
result,
|
|
40
|
-
status: _constants.JOB_STATUS.FAILED
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
// NOTE: `toJSON()` to avoid getting undefined value from Proxied model instance (#380)
|
|
44
|
-
// e.g. Object.prototype.hasOwnProperty.call(result, 'id') // false
|
|
45
|
-
// so the properties can not be get by json-templates(object-path)
|
|
46
|
-
return {
|
|
47
|
-
result: (0, _utils.toJSON)(result),
|
|
48
|
-
status: _constants.JOB_STATUS.RESOLVED
|
|
49
|
-
};
|
|
50
|
-
})();
|
|
51
|
-
}
|
|
52
|
-
};
|
|
53
|
-
exports.default = _default;
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
function _axios() {
|
|
8
|
-
const data = _interopRequireDefault(require("axios"));
|
|
9
|
-
_axios = function _axios() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
var _constants = require("../constants");
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
16
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
17
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
18
|
-
function request(_x) {
|
|
19
|
-
return _request.apply(this, arguments);
|
|
20
|
-
}
|
|
21
|
-
function _request() {
|
|
22
|
-
_request = _asyncToGenerator(function* (config) {
|
|
23
|
-
var _config$headers, _config$params;
|
|
24
|
-
// default headers
|
|
25
|
-
const url = config.url,
|
|
26
|
-
_config$method = config.method,
|
|
27
|
-
method = _config$method === void 0 ? 'POST' : _config$method,
|
|
28
|
-
data = config.data,
|
|
29
|
-
_config$timeout = config.timeout,
|
|
30
|
-
timeout = _config$timeout === void 0 ? 5000 : _config$timeout;
|
|
31
|
-
const headers = ((_config$headers = config.headers) !== null && _config$headers !== void 0 ? _config$headers : []).reduce((result, header) => {
|
|
32
|
-
if (header.name.toLowerCase() === 'content-type') {
|
|
33
|
-
return result;
|
|
34
|
-
}
|
|
35
|
-
return Object.assign(result, {
|
|
36
|
-
[header.name]: header.value
|
|
37
|
-
});
|
|
38
|
-
}, {});
|
|
39
|
-
const params = ((_config$params = config.params) !== null && _config$params !== void 0 ? _config$params : []).reduce((result, param) => Object.assign(result, {
|
|
40
|
-
[param.name]: param.value
|
|
41
|
-
}), {});
|
|
42
|
-
// TODO(feat): only support JSON type for now, should support others in future
|
|
43
|
-
headers['Content-Type'] = 'application/json';
|
|
44
|
-
return _axios().default.request({
|
|
45
|
-
url,
|
|
46
|
-
method,
|
|
47
|
-
headers,
|
|
48
|
-
params,
|
|
49
|
-
data,
|
|
50
|
-
timeout
|
|
51
|
-
});
|
|
52
|
-
});
|
|
53
|
-
return _request.apply(this, arguments);
|
|
54
|
-
}
|
|
55
|
-
class _default {
|
|
56
|
-
constructor(plugin) {
|
|
57
|
-
this.plugin = void 0;
|
|
58
|
-
this.plugin = plugin;
|
|
59
|
-
}
|
|
60
|
-
run(node, prevJob, processor) {
|
|
61
|
-
var _this = this;
|
|
62
|
-
return _asyncToGenerator(function* () {
|
|
63
|
-
var _prevJob$id;
|
|
64
|
-
const job = yield processor.saveJob({
|
|
65
|
-
status: _constants.JOB_STATUS.PENDING,
|
|
66
|
-
nodeId: node.id,
|
|
67
|
-
upstreamId: (_prevJob$id = prevJob === null || prevJob === void 0 ? void 0 : prevJob.id) !== null && _prevJob$id !== void 0 ? _prevJob$id : null
|
|
68
|
-
});
|
|
69
|
-
const config = processor.getParsedValue(node.config, node);
|
|
70
|
-
// eslint-disable-next-line promise/catch-or-return
|
|
71
|
-
request(config).then(response => {
|
|
72
|
-
job.set({
|
|
73
|
-
status: _constants.JOB_STATUS.RESOLVED,
|
|
74
|
-
result: response.data
|
|
75
|
-
});
|
|
76
|
-
}).catch(error => {
|
|
77
|
-
job.set({
|
|
78
|
-
status: _constants.JOB_STATUS.FAILED,
|
|
79
|
-
result: error.isAxiosError ? error.toJSON() : error.message
|
|
80
|
-
});
|
|
81
|
-
}).finally(() => {
|
|
82
|
-
processor.logger.info(`request (#${node.id}) response received, status: ${job.get('status')}`);
|
|
83
|
-
_this.plugin.resume(job);
|
|
84
|
-
});
|
|
85
|
-
processor.logger.info(`request (#${node.id}) sent to "${config.url}", waiting for response...`);
|
|
86
|
-
return processor.exit();
|
|
87
|
-
})();
|
|
88
|
-
}
|
|
89
|
-
resume(node, job, processor) {
|
|
90
|
-
return _asyncToGenerator(function* () {
|
|
91
|
-
const ignoreFail = node.config.ignoreFail;
|
|
92
|
-
if (ignoreFail) {
|
|
93
|
-
job.set('status', _constants.JOB_STATUS.RESOLVED);
|
|
94
|
-
}
|
|
95
|
-
return job;
|
|
96
|
-
})();
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
exports.default = _default;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _ = require("..");
|
|
8
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
9
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
10
|
-
var _default = {
|
|
11
|
-
run(node, input, processor) {
|
|
12
|
-
return _asyncToGenerator(function* () {
|
|
13
|
-
var _node$config$sql;
|
|
14
|
-
const sequelize = node.constructor.database.sequelize;
|
|
15
|
-
const sql = processor.getParsedValue((_node$config$sql = node.config.sql) !== null && _node$config$sql !== void 0 ? _node$config$sql : '', node).trim();
|
|
16
|
-
if (!sql) {
|
|
17
|
-
return {
|
|
18
|
-
status: _.JOB_STATUS.RESOLVED
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
const result = yield sequelize.query(sql, {
|
|
22
|
-
transaction: processor.transaction
|
|
23
|
-
// plain: true,
|
|
24
|
-
// model: db.getCollection(node.config.collection).model
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
return {
|
|
28
|
-
result,
|
|
29
|
-
status: _.JOB_STATUS.RESOLVED
|
|
30
|
-
};
|
|
31
|
-
})();
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
exports.default = _default;
|
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
var _constants = require("../constants");
|
|
8
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
9
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
10
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
11
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
12
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
13
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
14
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
15
|
-
var _default = {
|
|
16
|
-
run(node, input, processor) {
|
|
17
|
-
return _asyncToGenerator(function* () {
|
|
18
|
-
var _result$length;
|
|
19
|
-
const _node$config = node.config,
|
|
20
|
-
collection = _node$config.collection,
|
|
21
|
-
_node$config$params = _node$config.params,
|
|
22
|
-
params = _node$config$params === void 0 ? {} : _node$config$params;
|
|
23
|
-
const repo = node.constructor.database.getRepository(collection);
|
|
24
|
-
const options = processor.getParsedValue(params, node);
|
|
25
|
-
const result = yield repo.update(_objectSpread(_objectSpread({}, options), {}, {
|
|
26
|
-
context: {
|
|
27
|
-
executionId: processor.execution.id
|
|
28
|
-
},
|
|
29
|
-
transaction: processor.transaction
|
|
30
|
-
}));
|
|
31
|
-
return {
|
|
32
|
-
result: (_result$length = result.length) !== null && _result$length !== void 0 ? _result$length : result,
|
|
33
|
-
status: _constants.JOB_STATUS.RESOLVED
|
|
34
|
-
};
|
|
35
|
-
})();
|
|
36
|
-
}
|
|
37
|
-
};
|
|
38
|
-
exports.default = _default;
|
|
@@ -1,92 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.default = void 0;
|
|
7
|
-
function _server() {
|
|
8
|
-
const data = require("@nocobase/server");
|
|
9
|
-
_server = function _server() {
|
|
10
|
-
return data;
|
|
11
|
-
};
|
|
12
|
-
return data;
|
|
13
|
-
}
|
|
14
|
-
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }
|
|
15
|
-
function _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "next", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, "throw", err); } _next(undefined); }); }; }
|
|
16
|
-
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
17
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
-
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
19
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
|
20
|
-
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
|
21
|
-
const VTypes = {
|
|
22
|
-
constant(operand) {
|
|
23
|
-
return operand.value;
|
|
24
|
-
},
|
|
25
|
-
$jobsMapByNodeId({
|
|
26
|
-
options
|
|
27
|
-
}) {
|
|
28
|
-
const paths = [options.nodeId, options.path].filter(Boolean);
|
|
29
|
-
return paths ? `{{$jobsMapByNodeId.${paths.join('.')}}}` : null;
|
|
30
|
-
},
|
|
31
|
-
$context({
|
|
32
|
-
options
|
|
33
|
-
}) {
|
|
34
|
-
return `{{$context.${options.path}}}`;
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
function migrateConfig(config) {
|
|
38
|
-
if (Array.isArray(config)) {
|
|
39
|
-
return config.map(item => migrateConfig(item));
|
|
40
|
-
}
|
|
41
|
-
if (typeof config !== 'object') {
|
|
42
|
-
return config;
|
|
43
|
-
}
|
|
44
|
-
if (!config) {
|
|
45
|
-
return config;
|
|
46
|
-
}
|
|
47
|
-
if (config.type && VTypes[config.type] && (config.options || config.value)) {
|
|
48
|
-
return VTypes[config.type](config);
|
|
49
|
-
}
|
|
50
|
-
return Object.keys(config).reduce((memo, key) => _objectSpread(_objectSpread({}, memo), {}, {
|
|
51
|
-
[key]: migrateConfig(config[key])
|
|
52
|
-
}), {});
|
|
53
|
-
}
|
|
54
|
-
class _default extends _server().Migration {
|
|
55
|
-
up() {
|
|
56
|
-
var _this = this;
|
|
57
|
-
return _asyncToGenerator(function* () {
|
|
58
|
-
const match = yield _this.app.version.satisfies('<=0.8.0-alpha.13');
|
|
59
|
-
if (!match) {
|
|
60
|
-
return;
|
|
61
|
-
}
|
|
62
|
-
const NodeRepo = _this.context.db.getRepository('flow_nodes');
|
|
63
|
-
yield _this.context.db.sequelize.transaction( /*#__PURE__*/function () {
|
|
64
|
-
var _ref = _asyncToGenerator(function* (transaction) {
|
|
65
|
-
const nodes = yield NodeRepo.find({
|
|
66
|
-
filter: {
|
|
67
|
-
type: {
|
|
68
|
-
$or: ['calculation', 'condition']
|
|
69
|
-
}
|
|
70
|
-
},
|
|
71
|
-
transaction
|
|
72
|
-
});
|
|
73
|
-
console.log('%d nodes need to be migrated.', nodes.length);
|
|
74
|
-
yield nodes.reduce((promise, node) => {
|
|
75
|
-
return node.update({
|
|
76
|
-
config: migrateConfig(node.config)
|
|
77
|
-
}, {
|
|
78
|
-
transaction
|
|
79
|
-
});
|
|
80
|
-
}, Promise.resolve());
|
|
81
|
-
});
|
|
82
|
-
return function (_x) {
|
|
83
|
-
return _ref.apply(this, arguments);
|
|
84
|
-
};
|
|
85
|
-
}());
|
|
86
|
-
})();
|
|
87
|
-
}
|
|
88
|
-
down() {
|
|
89
|
-
return _asyncToGenerator(function* () {})();
|
|
90
|
-
}
|
|
91
|
-
}
|
|
92
|
-
exports.default = _default;
|