@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
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
var test = require('tap').test;
|
|
2
|
+
var CronExpression = require('../lib/expression');
|
|
3
|
+
|
|
4
|
+
test('It works on DST start', function(t) {
|
|
5
|
+
try {
|
|
6
|
+
var options = {
|
|
7
|
+
currentDate: '2016-03-27 02:00:01',
|
|
8
|
+
tz: 'Europe/Athens'
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
var interval, date;
|
|
12
|
+
|
|
13
|
+
interval = CronExpression.parse('0 * * * *', options);
|
|
14
|
+
t.ok(interval, 'Interval parsed');
|
|
15
|
+
|
|
16
|
+
date = interval.next();
|
|
17
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
18
|
+
t.equal(date.getHours(), 4, 'Due to DST start in Athens, 3 is skipped');
|
|
19
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
20
|
+
|
|
21
|
+
date = interval.next();
|
|
22
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
23
|
+
t.equal(date.getHours(), 5, '5 AM');
|
|
24
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
25
|
+
|
|
26
|
+
interval = CronExpression.parse('30 2 * * *', options);
|
|
27
|
+
t.ok(interval, 'Interval parsed');
|
|
28
|
+
|
|
29
|
+
date = interval.next();
|
|
30
|
+
t.equal(date.getMinutes(), 30, '30 Minutes');
|
|
31
|
+
t.equal(date.getHours(), 2, '2 AM');
|
|
32
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
33
|
+
|
|
34
|
+
date = interval.next();
|
|
35
|
+
t.equal(date.getMinutes(), 30, '30 Minutes');
|
|
36
|
+
t.equal(date.getHours(), 2, '2 AM');
|
|
37
|
+
t.equal(date.getDate(), 28, 'on the 28th');
|
|
38
|
+
|
|
39
|
+
interval = CronExpression.parse('0 3 * * *', options);
|
|
40
|
+
t.ok(interval, 'Interval parsed');
|
|
41
|
+
|
|
42
|
+
date = interval.next();
|
|
43
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
44
|
+
t.equal(date.getHours(), 4, 'Due to DST start in Athens, 3 is skipped');
|
|
45
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
46
|
+
|
|
47
|
+
date = interval.next();
|
|
48
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
49
|
+
t.equal(date.getHours(), 3, '3 on the 28th');
|
|
50
|
+
t.equal(date.getDate(), 28, 'on the 28th');
|
|
51
|
+
|
|
52
|
+
interval = CronExpression.parse('*/20 3 * * *', options);
|
|
53
|
+
t.ok(interval, 'Interval parsed');
|
|
54
|
+
|
|
55
|
+
date = interval.next();
|
|
56
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
57
|
+
t.equal(date.getHours(), 4, 'Due to DST start in Athens, 3 is skipped');
|
|
58
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
59
|
+
|
|
60
|
+
date = interval.next();
|
|
61
|
+
t.equal(date.getMinutes(), 20, '20 Minutes');
|
|
62
|
+
t.equal(date.getHours(), 4, 'Due to DST start in Athens, 3 is skipped');
|
|
63
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
64
|
+
|
|
65
|
+
date = interval.next();
|
|
66
|
+
t.equal(date.getMinutes(), 40, '20 Minutes');
|
|
67
|
+
t.equal(date.getHours(), 4, 'Due to DST start in Athens, 3 is skipped');
|
|
68
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
69
|
+
|
|
70
|
+
date = interval.next();
|
|
71
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
72
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
73
|
+
t.equal(date.getDate(), 28, 'on the 28th');
|
|
74
|
+
|
|
75
|
+
options.currentDate = '2016-03-27 00:00:01';
|
|
76
|
+
|
|
77
|
+
interval = CronExpression.parse('0 * 27 * *', options);
|
|
78
|
+
t.ok(interval, 'Interval parsed');
|
|
79
|
+
|
|
80
|
+
date = interval.next();
|
|
81
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
82
|
+
t.equal(date.getHours(), 1, '1 AM');
|
|
83
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
84
|
+
|
|
85
|
+
date = interval.next();
|
|
86
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
87
|
+
t.equal(date.getHours(), 2, '2 AM');
|
|
88
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
89
|
+
|
|
90
|
+
date = interval.next();
|
|
91
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
92
|
+
t.equal(date.getHours(), 4, '4 AM');
|
|
93
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
94
|
+
|
|
95
|
+
date = interval.next();
|
|
96
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
97
|
+
t.equal(date.getHours(), 5, '5 AM');
|
|
98
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
99
|
+
|
|
100
|
+
options.currentDate = '2016-03-27 00:00:01';
|
|
101
|
+
options.endDate = '2016-03-27 03:00:01';
|
|
102
|
+
|
|
103
|
+
interval = CronExpression.parse('0 * * * *', options);
|
|
104
|
+
t.ok(interval, 'Interval parsed');
|
|
105
|
+
|
|
106
|
+
date = interval.next();
|
|
107
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
108
|
+
t.equal(date.getHours(), 1, '1 AM');
|
|
109
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
110
|
+
|
|
111
|
+
date = interval.next();
|
|
112
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
113
|
+
t.equal(date.getHours(), 2, '2 AM');
|
|
114
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
115
|
+
|
|
116
|
+
date = interval.next();
|
|
117
|
+
t.equal(date.getMinutes(), 0, '0 Minutes');
|
|
118
|
+
t.equal(date.getHours(), 4, '4 AM');
|
|
119
|
+
t.equal(date.getDate(), 27, 'on the 27th');
|
|
120
|
+
|
|
121
|
+
// Out of the timespan range
|
|
122
|
+
t.throws(function() {
|
|
123
|
+
date = interval.next();
|
|
124
|
+
});
|
|
125
|
+
} catch (err) {
|
|
126
|
+
t.error(err, 'Interval parse error');
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
t.end();
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
test('It works on DST end', function(t) {
|
|
133
|
+
try {
|
|
134
|
+
var options = {
|
|
135
|
+
currentDate: '2016-10-30 02:00:01',
|
|
136
|
+
tz: 'Europe/Athens'
|
|
137
|
+
};
|
|
138
|
+
|
|
139
|
+
var interval, date;
|
|
140
|
+
|
|
141
|
+
interval = CronExpression.parse('0 * * * *', options);
|
|
142
|
+
t.ok(interval, 'Interval parsed');
|
|
143
|
+
|
|
144
|
+
date = interval.next();
|
|
145
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
146
|
+
t.equal(date.getDate(), 30, '30th');
|
|
147
|
+
|
|
148
|
+
date = interval.next();
|
|
149
|
+
t.equal(date.getHours(), 3, 'Due to DST end in Athens (4-->3)');
|
|
150
|
+
t.equal(date.getDate(), 30, '30th');
|
|
151
|
+
|
|
152
|
+
date = interval.next();
|
|
153
|
+
t.equal(date.getHours(), 4, '4 AM');
|
|
154
|
+
t.equal(date.getDate(), 30, '30th');
|
|
155
|
+
|
|
156
|
+
interval = CronExpression.parse('0 3 * * *', options);
|
|
157
|
+
t.ok(interval, 'Interval parsed');
|
|
158
|
+
|
|
159
|
+
date = interval.next();
|
|
160
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
161
|
+
t.equal(date.getDate(), 30, '30th');
|
|
162
|
+
|
|
163
|
+
date = interval.next();
|
|
164
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
165
|
+
t.equal(date.getDate(), 31, '31st');
|
|
166
|
+
|
|
167
|
+
interval = CronExpression.parse('*/20 3 * * *', options);
|
|
168
|
+
t.ok(interval, 'Interval parsed');
|
|
169
|
+
|
|
170
|
+
date = interval.next();
|
|
171
|
+
t.equal(date.getMinutes(), 0, '0');
|
|
172
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
173
|
+
t.equal(date.getDate(), 30, '30th');
|
|
174
|
+
|
|
175
|
+
date = interval.next();
|
|
176
|
+
t.equal(date.getMinutes(), 20, '20');
|
|
177
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
178
|
+
t.equal(date.getDate(), 30, '30th');
|
|
179
|
+
|
|
180
|
+
date = interval.next();
|
|
181
|
+
t.equal(date.getMinutes(), 40, '40');
|
|
182
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
183
|
+
t.equal(date.getDate(), 30, '30th');
|
|
184
|
+
|
|
185
|
+
date = interval.next();
|
|
186
|
+
t.equal(date.getMinutes(), 0, '0');
|
|
187
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
188
|
+
t.equal(date.getDate(), 31, '31st');
|
|
189
|
+
|
|
190
|
+
options.currentDate = '2016-10-30 00:00:01';
|
|
191
|
+
|
|
192
|
+
interval = CronExpression.parse('0 * 30 * *', options);
|
|
193
|
+
t.ok(interval, 'Interval parsed');
|
|
194
|
+
|
|
195
|
+
date = interval.next();
|
|
196
|
+
t.equal(date.getHours(), 1, '1 AM');
|
|
197
|
+
t.equal(date.getDate(), 30, '30th');
|
|
198
|
+
|
|
199
|
+
date = interval.next();
|
|
200
|
+
t.equal(date.getHours(), 2, '2 AM');
|
|
201
|
+
t.equal(date.getDate(), 30, '30th');
|
|
202
|
+
|
|
203
|
+
date = interval.next();
|
|
204
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
205
|
+
t.equal(date.getDate(), 30, '30th');
|
|
206
|
+
|
|
207
|
+
date = interval.next();
|
|
208
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
209
|
+
t.equal(date.getDate(), 30, '30th');
|
|
210
|
+
|
|
211
|
+
date = interval.next();
|
|
212
|
+
t.equal(date.getHours(), 4, '4 AM');
|
|
213
|
+
t.equal(date.getDate(), 30, '30th');
|
|
214
|
+
|
|
215
|
+
options.currentDate = '2016-10-30 00:00:01';
|
|
216
|
+
// specify the DST offset via ISO 8601 format, as 3am is repeated
|
|
217
|
+
options.endDate = '2016-10-30T03:00:01+03';
|
|
218
|
+
|
|
219
|
+
interval = CronExpression.parse('0 * * * *', options);
|
|
220
|
+
t.ok(interval, 'Interval parsed');
|
|
221
|
+
|
|
222
|
+
date = interval.next();
|
|
223
|
+
t.equal(date.getHours(), 1, '1 AM');
|
|
224
|
+
t.equal(date.getDate(), 30, '30th');
|
|
225
|
+
|
|
226
|
+
date = interval.next();
|
|
227
|
+
t.equal(date.getHours(), 2, '2 AM');
|
|
228
|
+
t.equal(date.getDate(), 30, '30th');
|
|
229
|
+
|
|
230
|
+
date = interval.next();
|
|
231
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
232
|
+
t.equal(date.getDate(), 30, '30th');
|
|
233
|
+
|
|
234
|
+
// Out of the timespan range
|
|
235
|
+
t.throws(function() {
|
|
236
|
+
date = interval.next();
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
options.endDate = '2016-10-30 04:00:01';
|
|
240
|
+
|
|
241
|
+
interval = CronExpression.parse('0 * * * *', options);
|
|
242
|
+
t.ok(interval, 'Interval parsed');
|
|
243
|
+
|
|
244
|
+
date = interval.next();
|
|
245
|
+
t.equal(date.getHours(), 1, '1 AM');
|
|
246
|
+
t.equal(date.getDate(), 30, '30th');
|
|
247
|
+
|
|
248
|
+
date = interval.next();
|
|
249
|
+
t.equal(date.getHours(), 2, '2 AM');
|
|
250
|
+
t.equal(date.getDate(), 30, '30th');
|
|
251
|
+
|
|
252
|
+
date = interval.next();
|
|
253
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
254
|
+
t.equal(date.getDate(), 30, '30th');
|
|
255
|
+
|
|
256
|
+
date = interval.next();
|
|
257
|
+
t.equal(date.getHours(), 3, '3 AM');
|
|
258
|
+
t.equal(date.getDate(), 30, '30th');
|
|
259
|
+
|
|
260
|
+
date = interval.next();
|
|
261
|
+
t.equal(date.getHours(), 4, '4 AM');
|
|
262
|
+
t.equal(date.getDate(), 30, '30th');
|
|
263
|
+
|
|
264
|
+
// Out of the timespan range
|
|
265
|
+
t.throws(function() {
|
|
266
|
+
date = interval.next();
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
options = {
|
|
270
|
+
currentDate : new Date('Sun Oct 29 2016 01:00:00 GMT+0200')
|
|
271
|
+
};
|
|
272
|
+
|
|
273
|
+
interval = CronExpression.parse('0 12 * * *', options);
|
|
274
|
+
t.ok(interval, 'Interval parsed');
|
|
275
|
+
|
|
276
|
+
date = interval.next();
|
|
277
|
+
t.equal(date.getHours(), 12, '12');
|
|
278
|
+
t.equal(date.getDate(), 29, '29th');
|
|
279
|
+
date = interval.next();
|
|
280
|
+
t.equal(date.getHours(), 12, '12');
|
|
281
|
+
t.equal(date.getDate(), 30, '30th');
|
|
282
|
+
date = interval.next();
|
|
283
|
+
t.equal(date.getHours(), 12, '12');
|
|
284
|
+
t.equal(date.getDate(), 31, '31st');
|
|
285
|
+
|
|
286
|
+
options = {
|
|
287
|
+
currentDate : new Date('Sun Oct 29 2016 02:59:00 GMT+0200')
|
|
288
|
+
};
|
|
289
|
+
|
|
290
|
+
interval = CronExpression.parse('0 12 * * *', options);
|
|
291
|
+
t.ok(interval, 'Interval parsed');
|
|
292
|
+
|
|
293
|
+
date = interval.next();
|
|
294
|
+
t.equal(date.getHours(), 12, '12');
|
|
295
|
+
t.equal(date.getDate(), 29, '29th');
|
|
296
|
+
date = interval.next();
|
|
297
|
+
t.equal(date.getHours(), 12, '12');
|
|
298
|
+
t.equal(date.getDate(), 30, '30th');
|
|
299
|
+
date = interval.next();
|
|
300
|
+
t.equal(date.getHours(), 12, '12');
|
|
301
|
+
t.equal(date.getDate(), 31, '31st');
|
|
302
|
+
|
|
303
|
+
options = {
|
|
304
|
+
currentDate : new Date('Sun Oct 29 2016 02:59:59 GMT+0200')
|
|
305
|
+
};
|
|
306
|
+
|
|
307
|
+
interval = CronExpression.parse('0 12 * * *', options);
|
|
308
|
+
t.ok(interval, 'Interval parsed');
|
|
309
|
+
|
|
310
|
+
date = interval.next();
|
|
311
|
+
t.equal(date.getHours(), 12, '12');
|
|
312
|
+
t.equal(date.getDate(), 29, '29th');
|
|
313
|
+
date = interval.next();
|
|
314
|
+
t.equal(date.getHours(), 12, '12');
|
|
315
|
+
t.equal(date.getDate(), 30, '30th');
|
|
316
|
+
date = interval.next();
|
|
317
|
+
t.equal(date.getHours(), 12, '12');
|
|
318
|
+
t.equal(date.getDate(), 31, '31st');
|
|
319
|
+
|
|
320
|
+
options = {
|
|
321
|
+
currentDate : new Date('Sun Oct 30 2016 01:00:00 GMT+0200')
|
|
322
|
+
};
|
|
323
|
+
|
|
324
|
+
interval = CronExpression.parse('0 12 * * *', options);
|
|
325
|
+
t.ok(interval, 'Interval parsed');
|
|
326
|
+
|
|
327
|
+
date = interval.next();
|
|
328
|
+
t.equal(date.getHours(), 12, '12');
|
|
329
|
+
t.equal(date.getDate(), 30, '30th');
|
|
330
|
+
date = interval.next();
|
|
331
|
+
t.equal(date.getHours(), 12, '12');
|
|
332
|
+
t.equal(date.getDate(), 31, '31st');
|
|
333
|
+
|
|
334
|
+
options = {
|
|
335
|
+
currentDate : new Date('Sun Oct 30 2016 01:59:00 GMT+0200')
|
|
336
|
+
};
|
|
337
|
+
|
|
338
|
+
interval = CronExpression.parse('0 12 * * *', options);
|
|
339
|
+
t.ok(interval, 'Interval parsed');
|
|
340
|
+
|
|
341
|
+
date = interval.next();
|
|
342
|
+
t.equal(date.getHours(), 12, '12');
|
|
343
|
+
t.equal(date.getDate(), 30, '30th');
|
|
344
|
+
date = interval.next();
|
|
345
|
+
t.equal(date.getHours(), 12, '12');
|
|
346
|
+
t.equal(date.getDate(), 31, '31st');
|
|
347
|
+
|
|
348
|
+
options = {
|
|
349
|
+
currentDate : new Date('Sun Oct 30 2016 01:59:59 GMT+0200')
|
|
350
|
+
};
|
|
351
|
+
|
|
352
|
+
interval = CronExpression.parse('0 12 * * *', options);
|
|
353
|
+
t.ok(interval, 'Interval parsed');
|
|
354
|
+
|
|
355
|
+
date = interval.next();
|
|
356
|
+
t.equal(date.getHours(), 12, '12');
|
|
357
|
+
t.equal(date.getDate(), 30, '30th');
|
|
358
|
+
date = interval.next();
|
|
359
|
+
t.equal(date.getHours(), 12, '12');
|
|
360
|
+
t.equal(date.getDate(), 31, '31st');
|
|
361
|
+
|
|
362
|
+
options = {
|
|
363
|
+
currentDate : new Date('Sun Oct 30 2016 02:59:00 GMT+0200')
|
|
364
|
+
};
|
|
365
|
+
|
|
366
|
+
interval = CronExpression.parse('0 12 * * *', options);
|
|
367
|
+
t.ok(interval, 'Interval parsed');
|
|
368
|
+
|
|
369
|
+
date = interval.next();
|
|
370
|
+
t.equal(date.getHours(), 12, '12');
|
|
371
|
+
t.equal(date.getDate(), 30, '30th');
|
|
372
|
+
date = interval.next();
|
|
373
|
+
t.equal(date.getHours(), 12, '12');
|
|
374
|
+
t.equal(date.getDate(), 31, '31st');
|
|
375
|
+
} catch (err) {
|
|
376
|
+
t.error(err, 'Interval parse error');
|
|
377
|
+
}
|
|
378
|
+
|
|
379
|
+
t.end();
|
|
380
|
+
});
|
|
381
|
+
|
|
382
|
+
test('it will work with #131 issue case', function(t) {
|
|
383
|
+
var options = {
|
|
384
|
+
tz: 'America/Sao_Paulo',
|
|
385
|
+
currentDate : new Date('Sun Oct 30 2018 02:59:00 GMT+0200')
|
|
386
|
+
};
|
|
387
|
+
|
|
388
|
+
var interval = CronExpression.parse('0 9 1 1 *', options);
|
|
389
|
+
var date = interval.next();
|
|
390
|
+
|
|
391
|
+
t.equal(date.getFullYear(), 2019);
|
|
392
|
+
t.equal(date.getDate(), 1);
|
|
393
|
+
t.equal(date.getMonth(), 0);
|
|
394
|
+
|
|
395
|
+
date = interval.prev();
|
|
396
|
+
t.equal(date.getFullYear(), 2018);
|
|
397
|
+
t.equal(date.getDate(), 1);
|
|
398
|
+
t.equal(date.getMonth(), 0);
|
|
399
|
+
|
|
400
|
+
date = interval.prev();
|
|
401
|
+
t.equal(date.getFullYear(), 2017);
|
|
402
|
+
t.equal(date.getDate(), 1);
|
|
403
|
+
t.equal(date.getMonth(), 0);
|
|
404
|
+
|
|
405
|
+
t.end();
|
|
406
|
+
});
|
|
407
|
+
|
|
408
|
+
test('it will work with #137 issue case', function(t) {
|
|
409
|
+
var options = {
|
|
410
|
+
tz: 'America/New_York',
|
|
411
|
+
currentDate : new Date('10/28/2018')
|
|
412
|
+
};
|
|
413
|
+
|
|
414
|
+
var interval = CronExpression.parse('0 12 * * 3', options);
|
|
415
|
+
var date = interval.next();
|
|
416
|
+
|
|
417
|
+
t.equal(date.getFullYear(), 2018);
|
|
418
|
+
t.equal(date.getDate(), 31);
|
|
419
|
+
t.equal(date.getMonth(), 9);
|
|
420
|
+
|
|
421
|
+
t.end();
|
|
422
|
+
});
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
export type DateType = Date | number | string
|
|
2
|
+
|
|
3
|
+
export interface CronDate {
|
|
4
|
+
addYear(): void
|
|
5
|
+
|
|
6
|
+
addMonth(): void
|
|
7
|
+
|
|
8
|
+
addDay(): void
|
|
9
|
+
|
|
10
|
+
addHour(): void
|
|
11
|
+
|
|
12
|
+
addMinute(): void
|
|
13
|
+
|
|
14
|
+
addSecond(): void
|
|
15
|
+
|
|
16
|
+
subtractYear(): void
|
|
17
|
+
|
|
18
|
+
subtractMonth(): void
|
|
19
|
+
|
|
20
|
+
subtractDay(): void
|
|
21
|
+
|
|
22
|
+
subtractHour(): void
|
|
23
|
+
|
|
24
|
+
subtractMinute(): void
|
|
25
|
+
|
|
26
|
+
subtractSecond(): void
|
|
27
|
+
|
|
28
|
+
getDate(): number
|
|
29
|
+
|
|
30
|
+
getFullYear(): number
|
|
31
|
+
|
|
32
|
+
getDay(): number
|
|
33
|
+
|
|
34
|
+
getMonth(): number
|
|
35
|
+
|
|
36
|
+
getHours(): number
|
|
37
|
+
|
|
38
|
+
getMinutes(): number
|
|
39
|
+
|
|
40
|
+
getSeconds(): number
|
|
41
|
+
|
|
42
|
+
getMilliseconds(): number
|
|
43
|
+
|
|
44
|
+
getTime(): number
|
|
45
|
+
|
|
46
|
+
getUTCDate(): number
|
|
47
|
+
|
|
48
|
+
getUTCFullYear(): number
|
|
49
|
+
|
|
50
|
+
getUTCDay(): number
|
|
51
|
+
|
|
52
|
+
getUTCMonth(): number
|
|
53
|
+
|
|
54
|
+
getUTCHours(): number
|
|
55
|
+
|
|
56
|
+
getUTCMinutes(): number
|
|
57
|
+
|
|
58
|
+
getUTCSeconds(): number
|
|
59
|
+
|
|
60
|
+
toISOString(): string
|
|
61
|
+
|
|
62
|
+
toJSON(): string
|
|
63
|
+
|
|
64
|
+
setDate(d: number): void
|
|
65
|
+
|
|
66
|
+
setFullYear(y: number): void
|
|
67
|
+
|
|
68
|
+
setDay(d: number): void
|
|
69
|
+
|
|
70
|
+
setMonth(m: number): void
|
|
71
|
+
|
|
72
|
+
setHours(h: number): void
|
|
73
|
+
|
|
74
|
+
setMinutes(m: number): void
|
|
75
|
+
|
|
76
|
+
setSeconds(s: number): void
|
|
77
|
+
|
|
78
|
+
setMilliseconds(s: number): void
|
|
79
|
+
|
|
80
|
+
getTime(): number
|
|
81
|
+
|
|
82
|
+
toString(): string
|
|
83
|
+
|
|
84
|
+
toDate(): Date
|
|
85
|
+
|
|
86
|
+
isLastDayOfMonth(): boolean
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
export interface ParserOptions<IsIterable extends boolean = false> {
|
|
90
|
+
currentDate?: DateType
|
|
91
|
+
startDate?: DateType
|
|
92
|
+
endDate?: DateType
|
|
93
|
+
utc?: boolean
|
|
94
|
+
tz?: string
|
|
95
|
+
nthDayOfWeek?: number
|
|
96
|
+
iterator?: IsIterable
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
type IteratorResultOrCronDate<IsIterable extends boolean> = IsIterable extends true
|
|
100
|
+
? IteratorResult<CronDate, CronDate>
|
|
101
|
+
: CronDate;
|
|
102
|
+
|
|
103
|
+
export interface ICronExpression<CronFields, IsIterable extends boolean> {
|
|
104
|
+
readonly fields: CronFields;
|
|
105
|
+
|
|
106
|
+
/** Find next suitable date */
|
|
107
|
+
next(): IteratorResultOrCronDate<IsIterable>
|
|
108
|
+
|
|
109
|
+
/** Find previous suitable date */
|
|
110
|
+
prev(): IteratorResultOrCronDate<IsIterable>
|
|
111
|
+
|
|
112
|
+
/** Check if next suitable date exists */
|
|
113
|
+
hasNext(): boolean
|
|
114
|
+
|
|
115
|
+
/** Check if previous suitable date exists */
|
|
116
|
+
hasPrev(): boolean
|
|
117
|
+
|
|
118
|
+
/** Iterate over expression iterator */
|
|
119
|
+
iterate(steps: number, callback?: (item: IteratorResultOrCronDate<IsIterable>, i: number) => void): IteratorResultOrCronDate<IsIterable>[]
|
|
120
|
+
|
|
121
|
+
/** Reset expression iterator state */
|
|
122
|
+
reset(resetDate?: string | number | Date): void
|
|
123
|
+
|
|
124
|
+
stringify(includeSeconds?: boolean): string
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
export interface IStringResult<CronFields> {
|
|
128
|
+
variables: Record<string, string>,
|
|
129
|
+
expressions: ICronExpression<CronFields, false>[],
|
|
130
|
+
errors: Record<string, any>,
|
|
131
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CronDate,
|
|
3
|
+
DateType,
|
|
4
|
+
ICronExpression,
|
|
5
|
+
IStringResult,
|
|
6
|
+
ParserOptions,
|
|
7
|
+
} from './common';
|
|
8
|
+
|
|
9
|
+
type BuildRangeTuple<Current extends [...number[]], Count extends number> =
|
|
10
|
+
Current["length"] extends Count
|
|
11
|
+
? Current
|
|
12
|
+
: BuildRangeTuple<[number, ...Current], Count>
|
|
13
|
+
type RangeTuple<Count extends number> = BuildRangeTuple<[], Count>
|
|
14
|
+
type BuildRange<Current extends number, End extends number, Accu extends [...number[]]> =
|
|
15
|
+
Accu["length"] extends End
|
|
16
|
+
? Current
|
|
17
|
+
: BuildRange<Current | Accu["length"], End, [number, ...Accu]>
|
|
18
|
+
type Range<StartInclusive extends number, EndExclusive extends number> = BuildRange<StartInclusive, EndExclusive, RangeTuple<StartInclusive>>
|
|
19
|
+
|
|
20
|
+
export type SixtyRange = Range<0, 30> | Range<30, 60>; // Typescript restriction on recursion depth
|
|
21
|
+
export type HourRange = Range<0, 24>;
|
|
22
|
+
export type DayOfTheMonthRange = Range<1, 32> | 'L';
|
|
23
|
+
export type MonthRange = Range<1, 13>;
|
|
24
|
+
export type DayOfTheWeekRange = Range<0, 8>;
|
|
25
|
+
|
|
26
|
+
export type CronFields = {
|
|
27
|
+
readonly second: readonly SixtyRange[];
|
|
28
|
+
readonly minute: readonly SixtyRange[];
|
|
29
|
+
readonly hour: readonly HourRange[];
|
|
30
|
+
readonly dayOfMonth: readonly DayOfTheMonthRange[];
|
|
31
|
+
readonly month: readonly MonthRange[];
|
|
32
|
+
readonly dayOfWeek: readonly DayOfTheWeekRange[];
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export {ParserOptions, CronDate, DateType}
|
|
36
|
+
export type CronExpression<IsIterable extends boolean = false> = ICronExpression<CronFields, IsIterable>
|
|
37
|
+
export type StringResult = IStringResult<CronFields>
|
|
38
|
+
|
|
39
|
+
export function parseExpression<IsIterable extends boolean = false>(expression: string, options?: ParserOptions<IsIterable>): CronExpression<IsIterable>;
|
|
40
|
+
|
|
41
|
+
export function fieldsToExpression<IsIterable extends boolean = false>(fields: CronFields, options?: ParserOptions<IsIterable>): CronExpression<IsIterable>;
|
|
42
|
+
|
|
43
|
+
export function parseFile(filePath: string, callback: (err: any, data: StringResult) => any): void;
|
|
44
|
+
|
|
45
|
+
export function parseString(data: string): StringResult;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CronDate,
|
|
3
|
+
DateType,
|
|
4
|
+
ICronExpression,
|
|
5
|
+
IStringResult,
|
|
6
|
+
ParserOptions,
|
|
7
|
+
} from '../common';
|
|
8
|
+
|
|
9
|
+
export type CronFields = {
|
|
10
|
+
readonly second: readonly number[];
|
|
11
|
+
readonly minute: readonly number[];
|
|
12
|
+
readonly hour: readonly number[];
|
|
13
|
+
readonly dayOfMonth: readonly (number | 'L')[];
|
|
14
|
+
readonly month: readonly number[];
|
|
15
|
+
readonly dayOfWeek: readonly number[];
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export {ParserOptions, CronDate, DateType}
|
|
19
|
+
export type CronExpression<IsIterable extends boolean = false> = ICronExpression<CronFields, IsIterable>
|
|
20
|
+
export type StringResult = IStringResult<CronFields>
|
|
21
|
+
|
|
22
|
+
export function parseExpression<IsIterable extends boolean = false>(expression: string, options?: ParserOptions<IsIterable>): CronExpression<IsIterable>;
|
|
23
|
+
|
|
24
|
+
export function fieldsToExpression<IsIterable extends boolean = false>(fields: CronFields, options?: ParserOptions<IsIterable>): CronExpression<IsIterable>;
|
|
25
|
+
|
|
26
|
+
export function parseFile(filePath: string, callback: (err: any, data: StringResult) => any): void;
|
|
27
|
+
|
|
28
|
+
export function parseString(data: string): StringResult;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";var t={953:function(t,e,i){var s=this&&this.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};const n=s(i(589));t.exports=Object.assign(n.default,{default:n.default,LRUCache:n.default})},589:function(t,e){Object.defineProperty(e,"__esModule",{value:true});e.LRUCache=void 0;const i=typeof performance==="object"&&performance&&typeof performance.now==="function"?performance:Date;const s=new Set;const emitWarning=(t,e,i,s)=>{typeof process==="object"&&process&&typeof process.emitWarning==="function"?process.emitWarning(t,e,i,s):console.error(`[${i}] ${e}: ${t}`)};const shouldWarn=t=>!s.has(t);const n=Symbol("type");const isPosInt=t=>t&&t===Math.floor(t)&&t>0&&isFinite(t);const getUintArray=t=>!isPosInt(t)?null:t<=Math.pow(2,8)?Uint8Array:t<=Math.pow(2,16)?Uint16Array:t<=Math.pow(2,32)?Uint32Array:t<=Number.MAX_SAFE_INTEGER?ZeroArray:null;class ZeroArray extends Array{constructor(t){super(t);this.fill(0)}}class Stack{heap;length;static#t=false;static create(t){const e=getUintArray(t);if(!e)return[];Stack.#t=true;const i=new Stack(t,e);Stack.#t=false;return i}constructor(t,e){if(!Stack.#t){throw new TypeError("instantiate Stack using Stack.create(n)")}this.heap=new e(t);this.length=0}push(t){this.heap[this.length++]=t}pop(){return this.heap[--this.length]}}class LRUCache{#e;#i;#s;#n;#h;ttl;ttlResolution;ttlAutopurge;updateAgeOnGet;updateAgeOnHas;allowStale;noDisposeOnSet;noUpdateTTL;maxEntrySize;sizeCalculation;noDeleteOnFetchRejection;noDeleteOnStaleGet;allowStaleOnFetchAbort;allowStaleOnFetchRejection;ignoreFetchAbort;#a;#o;#r;#l;#c;#f;#d;#u;#p;#g;#S;#y;#m;#z;#w;#_;#L;static unsafeExposeInternals(t){return{starts:t.#m,ttls:t.#z,sizes:t.#y,keyMap:t.#r,keyList:t.#l,valList:t.#c,next:t.#f,prev:t.#d,get head(){return t.#u},get tail(){return t.#p},free:t.#g,isBackgroundFetch:e=>t.#v(e),backgroundFetch:(e,i,s,n)=>t.#k(e,i,s,n),moveToTail:e=>t.#x(e),indexes:e=>t.#F(e),rindexes:e=>t.#A(e),isStale:e=>t.#T(e)}}get max(){return this.#e}get maxSize(){return this.#i}get calculatedSize(){return this.#o}get size(){return this.#a}get fetchMethod(){return this.#h}get dispose(){return this.#s}get disposeAfter(){return this.#n}constructor(t){const{max:e=0,ttl:i,ttlResolution:n=1,ttlAutopurge:h,updateAgeOnGet:a,updateAgeOnHas:o,allowStale:r,dispose:l,disposeAfter:c,noDisposeOnSet:f,noUpdateTTL:d,maxSize:u=0,maxEntrySize:p=0,sizeCalculation:g,fetchMethod:S,noDeleteOnFetchRejection:y,noDeleteOnStaleGet:m,allowStaleOnFetchRejection:z,allowStaleOnFetchAbort:w,ignoreFetchAbort:_}=t;if(e!==0&&!isPosInt(e)){throw new TypeError("max option must be a nonnegative integer")}const L=e?getUintArray(e):Array;if(!L){throw new Error("invalid max value: "+e)}this.#e=e;this.#i=u;this.maxEntrySize=p||this.#i;this.sizeCalculation=g;if(this.sizeCalculation){if(!this.#i&&!this.maxEntrySize){throw new TypeError("cannot set sizeCalculation without setting maxSize or maxEntrySize")}if(typeof this.sizeCalculation!=="function"){throw new TypeError("sizeCalculation set to non-function")}}if(S!==undefined&&typeof S!=="function"){throw new TypeError("fetchMethod must be a function if specified")}this.#h=S;this.#_=!!S;this.#r=new Map;this.#l=new Array(e).fill(undefined);this.#c=new Array(e).fill(undefined);this.#f=new L(e);this.#d=new L(e);this.#u=0;this.#p=0;this.#g=Stack.create(e);this.#a=0;this.#o=0;if(typeof l==="function"){this.#s=l}if(typeof c==="function"){this.#n=c;this.#S=[]}else{this.#n=undefined;this.#S=undefined}this.#w=!!this.#s;this.#L=!!this.#n;this.noDisposeOnSet=!!f;this.noUpdateTTL=!!d;this.noDeleteOnFetchRejection=!!y;this.allowStaleOnFetchRejection=!!z;this.allowStaleOnFetchAbort=!!w;this.ignoreFetchAbort=!!_;if(this.maxEntrySize!==0){if(this.#i!==0){if(!isPosInt(this.#i)){throw new TypeError("maxSize must be a positive integer if specified")}}if(!isPosInt(this.maxEntrySize)){throw new TypeError("maxEntrySize must be a positive integer if specified")}this.#b()}this.allowStale=!!r;this.noDeleteOnStaleGet=!!m;this.updateAgeOnGet=!!a;this.updateAgeOnHas=!!o;this.ttlResolution=isPosInt(n)||n===0?n:1;this.ttlAutopurge=!!h;this.ttl=i||0;if(this.ttl){if(!isPosInt(this.ttl)){throw new TypeError("ttl must be a positive integer if specified")}this.#O()}if(this.#e===0&&this.ttl===0&&this.#i===0){throw new TypeError("At least one of max, maxSize, or ttl is required")}if(!this.ttlAutopurge&&!this.#e&&!this.#i){const t="LRU_CACHE_UNBOUNDED";if(shouldWarn(t)){s.add(t);const e="TTL caching without ttlAutopurge, max, or maxSize can "+"result in unbounded memory consumption.";emitWarning(e,"UnboundedCacheWarning",t,LRUCache)}}}getRemainingTTL(t){return this.#r.has(t)?Infinity:0}#O(){const t=new ZeroArray(this.#e);const e=new ZeroArray(this.#e);this.#z=t;this.#m=e;this.#D=(s,n,h=i.now())=>{e[s]=n!==0?h:0;t[s]=n;if(n!==0&&this.ttlAutopurge){const t=setTimeout((()=>{if(this.#T(s)){this.delete(this.#l[s])}}),n+1);if(t.unref){t.unref()}}};this.#E=s=>{e[s]=t[s]!==0?i.now():0};this.#M=(i,n)=>{if(t[n]){const h=t[n];const a=e[n];i.ttl=h;i.start=a;i.now=s||getNow();i.remainingTTL=i.now+h-a}};let s=0;const getNow=()=>{const t=i.now();if(this.ttlResolution>0){s=t;const e=setTimeout((()=>s=0),this.ttlResolution);if(e.unref){e.unref()}}return t};this.getRemainingTTL=i=>{const n=this.#r.get(i);if(n===undefined){return 0}return t[n]===0||e[n]===0?Infinity:e[n]+t[n]-(s||getNow())};this.#T=i=>t[i]!==0&&e[i]!==0&&(s||getNow())-e[i]>t[i]}#E=()=>{};#M=()=>{};#D=()=>{};#T=()=>false;#b(){const t=new ZeroArray(this.#e);this.#o=0;this.#y=t;this.#C=e=>{this.#o-=t[e];t[e]=0};this.#R=(t,e,i,s)=>{if(this.#v(e)){return 0}if(!isPosInt(i)){if(s){if(typeof s!=="function"){throw new TypeError("sizeCalculation must be a function")}i=s(e,t);if(!isPosInt(i)){throw new TypeError("sizeCalculation return invalid (expect positive integer)")}}else{throw new TypeError("invalid size value (must be positive integer). "+"When maxSize or maxEntrySize is used, sizeCalculation "+"or size must be set.")}}return i};this.#W=(e,i,s)=>{t[e]=i;if(this.#i){const i=this.#i-t[e];while(this.#o>i){this.#B(true)}}this.#o+=t[e];if(s){s.entrySize=i;s.totalCalculatedSize=this.#o}}}#C=t=>{};#W=(t,e,i)=>{};#R=(t,e,i,s)=>{if(i||s){throw new TypeError("cannot set size without setting maxSize or maxEntrySize on cache")}return 0};*#F({allowStale:t=this.allowStale}={}){if(this.#a){for(let e=this.#p;true;){if(!this.#I(e)){break}if(t||!this.#T(e)){yield e}if(e===this.#u){break}else{e=this.#d[e]}}}}*#A({allowStale:t=this.allowStale}={}){if(this.#a){for(let e=this.#u;true;){if(!this.#I(e)){break}if(t||!this.#T(e)){yield e}if(e===this.#p){break}else{e=this.#f[e]}}}}#I(t){return t!==undefined&&this.#r.get(this.#l[t])===t}*entries(){for(const t of this.#F()){if(this.#c[t]!==undefined&&this.#l[t]!==undefined&&!this.#v(this.#c[t])){yield[this.#l[t],this.#c[t]]}}}*rentries(){for(const t of this.#A()){if(this.#c[t]!==undefined&&this.#l[t]!==undefined&&!this.#v(this.#c[t])){yield[this.#l[t],this.#c[t]]}}}*keys(){for(const t of this.#F()){const e=this.#l[t];if(e!==undefined&&!this.#v(this.#c[t])){yield e}}}*rkeys(){for(const t of this.#A()){const e=this.#l[t];if(e!==undefined&&!this.#v(this.#c[t])){yield e}}}*values(){for(const t of this.#F()){const e=this.#c[t];if(e!==undefined&&!this.#v(this.#c[t])){yield this.#c[t]}}}*rvalues(){for(const t of this.#A()){const e=this.#c[t];if(e!==undefined&&!this.#v(this.#c[t])){yield this.#c[t]}}}[Symbol.iterator](){return this.entries()}find(t,e={}){for(const i of this.#F()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;if(t(n,this.#l[i],this)){return this.get(this.#l[i],e)}}}forEach(t,e=this){for(const i of this.#F()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.#l[i],this)}}rforEach(t,e=this){for(const i of this.#A()){const s=this.#c[i];const n=this.#v(s)?s.__staleWhileFetching:s;if(n===undefined)continue;t.call(e,n,this.#l[i],this)}}purgeStale(){let t=false;for(const e of this.#A({allowStale:true})){if(this.#T(e)){this.delete(this.#l[e]);t=true}}return t}dump(){const t=[];for(const e of this.#F({allowStale:true})){const s=this.#l[e];const n=this.#c[e];const h=this.#v(n)?n.__staleWhileFetching:n;if(h===undefined||s===undefined)continue;const a={value:h};if(this.#z&&this.#m){a.ttl=this.#z[e];const t=i.now()-this.#m[e];a.start=Math.floor(Date.now()-t)}if(this.#y){a.size=this.#y[e]}t.unshift([s,a])}return t}load(t){this.clear();for(const[e,s]of t){if(s.start){const t=Date.now()-s.start;s.start=i.now()-t}this.set(e,s.value,s)}}set(t,e,i={}){const{ttl:s=this.ttl,start:n,noDisposeOnSet:h=this.noDisposeOnSet,sizeCalculation:a=this.sizeCalculation,status:o}=i;let{noUpdateTTL:r=this.noUpdateTTL}=i;const l=this.#R(t,e,i.size||0,a);if(this.maxEntrySize&&l>this.maxEntrySize){if(o){o.set="miss";o.maxEntrySizeExceeded=true}this.delete(t);return this}let c=this.#a===0?undefined:this.#r.get(t);if(c===undefined){c=this.#a===0?this.#p:this.#g.length!==0?this.#g.pop():this.#a===this.#e?this.#B(false):this.#a;this.#l[c]=t;this.#c[c]=e;this.#r.set(t,c);this.#f[this.#p]=c;this.#d[c]=this.#p;this.#p=c;this.#a++;this.#W(c,l,o);if(o)o.set="add";r=false}else{this.#x(c);const i=this.#c[c];if(e!==i){if(this.#_&&this.#v(i)){i.__abortController.abort(new Error("replaced"))}else if(!h){if(this.#w){this.#s?.(i,t,"set")}if(this.#L){this.#S?.push([i,t,"set"])}}this.#C(c);this.#W(c,l,o);this.#c[c]=e;if(o){o.set="replace";const t=i&&this.#v(i)?i.__staleWhileFetching:i;if(t!==undefined)o.oldValue=t}}else if(o){o.set="update"}}if(s!==0&&!this.#z){this.#O()}if(this.#z){if(!r){this.#D(c,s,n)}if(o)this.#M(o,c)}if(!h&&this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}return this}pop(){try{while(this.#a){const t=this.#c[this.#u];this.#B(true);if(this.#v(t)){if(t.__staleWhileFetching){return t.__staleWhileFetching}}else if(t!==undefined){return t}}}finally{if(this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}}}#B(t){const e=this.#u;const i=this.#l[e];const s=this.#c[e];if(this.#_&&this.#v(s)){s.__abortController.abort(new Error("evicted"))}else if(this.#w||this.#L){if(this.#w){this.#s?.(s,i,"evict")}if(this.#L){this.#S?.push([s,i,"evict"])}}this.#C(e);if(t){this.#l[e]=undefined;this.#c[e]=undefined;this.#g.push(e)}if(this.#a===1){this.#u=this.#p=0;this.#g.length=0}else{this.#u=this.#f[e]}this.#r.delete(i);this.#a--;return e}has(t,e={}){const{updateAgeOnHas:i=this.updateAgeOnHas,status:s}=e;const n=this.#r.get(t);if(n!==undefined){const t=this.#c[n];if(this.#v(t)&&t.__staleWhileFetching===undefined){return false}if(!this.#T(n)){if(i){this.#E(n)}if(s){s.has="hit";this.#M(s,n)}return true}else if(s){s.has="stale";this.#M(s,n)}}else if(s){s.has="miss"}return false}peek(t,e={}){const{allowStale:i=this.allowStale}=e;const s=this.#r.get(t);if(s!==undefined&&(i||!this.#T(s))){const t=this.#c[s];return this.#v(t)?t.__staleWhileFetching:t}}#k(t,e,i,s){const n=e===undefined?undefined:this.#c[e];if(this.#v(n)){return n}const h=new AbortController;const{signal:a}=i;a?.addEventListener("abort",(()=>h.abort(a.reason)),{signal:h.signal});const o={signal:h.signal,options:i,context:s};const cb=(s,n=false)=>{const{aborted:a}=h.signal;const l=i.ignoreFetchAbort&&s!==undefined;if(i.status){if(a&&!n){i.status.fetchAborted=true;i.status.fetchError=h.signal.reason;if(l)i.status.fetchAbortIgnored=true}else{i.status.fetchResolved=true}}if(a&&!l&&!n){return fetchFail(h.signal.reason)}const c=r;if(this.#c[e]===r){if(s===undefined){if(c.__staleWhileFetching){this.#c[e]=c.__staleWhileFetching}else{this.delete(t)}}else{if(i.status)i.status.fetchUpdated=true;this.set(t,s,o.options)}}return s};const eb=t=>{if(i.status){i.status.fetchRejected=true;i.status.fetchError=t}return fetchFail(t)};const fetchFail=s=>{const{aborted:n}=h.signal;const a=n&&i.allowStaleOnFetchAbort;const o=a||i.allowStaleOnFetchRejection;const l=o||i.noDeleteOnFetchRejection;const c=r;if(this.#c[e]===r){const i=!l||c.__staleWhileFetching===undefined;if(i){this.delete(t)}else if(!a){this.#c[e]=c.__staleWhileFetching}}if(o){if(i.status&&c.__staleWhileFetching!==undefined){i.status.returnedStale=true}return c.__staleWhileFetching}else if(c.__returned===c){throw s}};const pcall=(e,s)=>{const a=this.#h?.(t,n,o);if(a&&a instanceof Promise){a.then((t=>e(t)),s)}h.signal.addEventListener("abort",(()=>{if(!i.ignoreFetchAbort||i.allowStaleOnFetchAbort){e();if(i.allowStaleOnFetchAbort){e=t=>cb(t,true)}}}))};if(i.status)i.status.fetchDispatched=true;const r=new Promise(pcall).then(cb,eb);const l=Object.assign(r,{__abortController:h,__staleWhileFetching:n,__returned:undefined});if(e===undefined){this.set(t,l,{...o.options,status:undefined});e=this.#r.get(t)}else{this.#c[e]=l}return l}#v(t){if(!this.#_)return false;const e=t;return!!e&&e instanceof Promise&&e.hasOwnProperty("__staleWhileFetching")&&e.__abortController instanceof AbortController}async fetch(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,ttl:h=this.ttl,noDisposeOnSet:a=this.noDisposeOnSet,size:o=0,sizeCalculation:r=this.sizeCalculation,noUpdateTTL:l=this.noUpdateTTL,noDeleteOnFetchRejection:c=this.noDeleteOnFetchRejection,allowStaleOnFetchRejection:f=this.allowStaleOnFetchRejection,ignoreFetchAbort:d=this.ignoreFetchAbort,allowStaleOnFetchAbort:u=this.allowStaleOnFetchAbort,context:p,forceRefresh:g=false,status:S,signal:y}=e;if(!this.#_){if(S)S.fetch="get";return this.get(t,{allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,status:S})}const m={allowStale:i,updateAgeOnGet:s,noDeleteOnStaleGet:n,ttl:h,noDisposeOnSet:a,size:o,sizeCalculation:r,noUpdateTTL:l,noDeleteOnFetchRejection:c,allowStaleOnFetchRejection:f,allowStaleOnFetchAbort:u,ignoreFetchAbort:d,status:S,signal:y};let z=this.#r.get(t);if(z===undefined){if(S)S.fetch="miss";const e=this.#k(t,z,m,p);return e.__returned=e}else{const e=this.#c[z];if(this.#v(e)){const t=i&&e.__staleWhileFetching!==undefined;if(S){S.fetch="inflight";if(t)S.returnedStale=true}return t?e.__staleWhileFetching:e.__returned=e}const n=this.#T(z);if(!g&&!n){if(S)S.fetch="hit";this.#x(z);if(s){this.#E(z)}if(S)this.#M(S,z);return e}const h=this.#k(t,z,m,p);const a=h.__staleWhileFetching!==undefined;const o=a&&i;if(S){S.fetch=n?"stale":"refresh";if(o&&n)S.returnedStale=true}return o?h.__staleWhileFetching:h.__returned=h}}get(t,e={}){const{allowStale:i=this.allowStale,updateAgeOnGet:s=this.updateAgeOnGet,noDeleteOnStaleGet:n=this.noDeleteOnStaleGet,status:h}=e;const a=this.#r.get(t);if(a!==undefined){const e=this.#c[a];const o=this.#v(e);if(h)this.#M(h,a);if(this.#T(a)){if(h)h.get="stale";if(!o){if(!n){this.delete(t)}if(h&&i)h.returnedStale=true;return i?e:undefined}else{if(h&&i&&e.__staleWhileFetching!==undefined){h.returnedStale=true}return i?e.__staleWhileFetching:undefined}}else{if(h)h.get="hit";if(o){return e.__staleWhileFetching}this.#x(a);if(s){this.#E(a)}return e}}else if(h){h.get="miss"}}#U(t,e){this.#d[e]=t;this.#f[t]=e}#x(t){if(t!==this.#p){if(t===this.#u){this.#u=this.#f[t]}else{this.#U(this.#d[t],this.#f[t])}this.#U(this.#p,t);this.#p=t}}delete(t){let e=false;if(this.#a!==0){const i=this.#r.get(t);if(i!==undefined){e=true;if(this.#a===1){this.clear()}else{this.#C(i);const e=this.#c[i];if(this.#v(e)){e.__abortController.abort(new Error("deleted"))}else if(this.#w||this.#L){if(this.#w){this.#s?.(e,t,"delete")}if(this.#L){this.#S?.push([e,t,"delete"])}}this.#r.delete(t);this.#l[i]=undefined;this.#c[i]=undefined;if(i===this.#p){this.#p=this.#d[i]}else if(i===this.#u){this.#u=this.#f[i]}else{this.#f[this.#d[i]]=this.#f[i];this.#d[this.#f[i]]=this.#d[i]}this.#a--;this.#g.push(i)}}}if(this.#L&&this.#S?.length){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}return e}clear(){for(const t of this.#A({allowStale:true})){const e=this.#c[t];if(this.#v(e)){e.__abortController.abort(new Error("deleted"))}else{const i=this.#l[t];if(this.#w){this.#s?.(e,i,"delete")}if(this.#L){this.#S?.push([e,i,"delete"])}}}this.#r.clear();this.#c.fill(undefined);this.#l.fill(undefined);if(this.#z&&this.#m){this.#z.fill(0);this.#m.fill(0)}if(this.#y){this.#y.fill(0)}this.#u=0;this.#p=0;this.#g.length=0;this.#o=0;this.#a=0;if(this.#L&&this.#S){const t=this.#S;let e;while(e=t?.shift()){this.#n?.(...e)}}}}e.LRUCache=LRUCache;e["default"]=LRUCache}};var e={};function __nccwpck_require__(i){var s=e[i];if(s!==undefined){return s.exports}var n=e[i]={exports:{}};var h=true;try{t[i].call(n.exports,n,n.exports,__nccwpck_require__);h=false}finally{if(h)delete e[i]}return n.exports}if(typeof __nccwpck_require__!=="undefined")__nccwpck_require__.ab=__dirname+"/";var i=__nccwpck_require__(953);module.exports=i})();
|