@zajno/common 2.0.3 → 2.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.d.ts +0 -0
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.d.ts.map +0 -0
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.js +0 -0
- package/{lib/abstractions → abstractions}/controllers/IPluggableController.js.map +0 -0
- package/{lib/async → async}/arrays.d.ts +0 -0
- package/{lib/async → async}/arrays.d.ts.map +0 -0
- package/{lib/async → async}/arrays.extend.d.ts +0 -0
- package/{lib/async → async}/arrays.extend.d.ts.map +0 -0
- package/{lib/async → async}/arrays.extend.js +0 -0
- package/{lib/async → async}/arrays.extend.js.map +0 -0
- package/{lib/async → async}/arrays.js +0 -0
- package/{lib/async → async}/arrays.js.map +0 -0
- package/{lib/async → async}/misc.d.ts +0 -0
- package/{lib/async → async}/misc.d.ts.map +0 -0
- package/{lib/async → async}/misc.js +0 -0
- package/{lib/async → async}/misc.js.map +0 -0
- package/{lib/async → async}/timeout.d.ts +0 -0
- package/{lib/async → async}/timeout.d.ts.map +0 -0
- package/{lib/async → async}/timeout.js +0 -0
- package/{lib/async → async}/timeout.js.map +0 -0
- package/{lib/controllers → controllers}/PluggableController.d.ts +0 -0
- package/{lib/controllers → controllers}/PluggableController.d.ts.map +0 -0
- package/{lib/controllers → controllers}/PluggableController.js +0 -0
- package/{lib/controllers → controllers}/PluggableController.js.map +0 -0
- package/{lib/dates → dates}/calc.d.ts +0 -0
- package/{lib/dates → dates}/calc.d.ts.map +0 -0
- package/{lib/dates → dates}/calc.js +0 -0
- package/{lib/dates → dates}/calc.js.map +0 -0
- package/{lib/dates → dates}/convert.d.ts +0 -0
- package/{lib/dates → dates}/convert.d.ts.map +0 -0
- package/{lib/dates → dates}/convert.js +0 -0
- package/{lib/dates → dates}/convert.js.map +0 -0
- package/{lib/dates → dates}/datex.d.ts +0 -0
- package/{lib/dates → dates}/datex.d.ts.map +0 -0
- package/{lib/dates → dates}/datex.js +0 -0
- package/{lib/dates → dates}/datex.js.map +0 -0
- package/{lib/dates → dates}/format.d.ts +0 -0
- package/{lib/dates → dates}/format.d.ts.map +0 -0
- package/{lib/dates → dates}/format.js +0 -0
- package/{lib/dates → dates}/format.js.map +0 -0
- package/{lib/dates → dates}/index.d.ts +0 -0
- package/{lib/dates → dates}/index.d.ts.map +0 -0
- package/{lib/dates → dates}/index.js +0 -0
- package/{lib/dates → dates}/index.js.map +0 -0
- package/{lib/dates → dates}/parse.d.ts +0 -0
- package/{lib/dates → dates}/parse.d.ts.map +0 -0
- package/{lib/dates → dates}/parse.js +0 -0
- package/{lib/dates → dates}/parse.js.map +0 -0
- package/{lib/dates → dates}/period.d.ts +0 -0
- package/{lib/dates → dates}/period.d.ts.map +0 -0
- package/{lib/dates → dates}/period.js +0 -0
- package/{lib/dates → dates}/period.js.map +0 -0
- package/{lib/dates → dates}/shift.d.ts +0 -0
- package/{lib/dates → dates}/shift.d.ts.map +0 -0
- package/{lib/dates → dates}/shift.js +0 -0
- package/{lib/dates → dates}/shift.js.map +0 -0
- package/{lib/dates → dates}/types.d.ts +0 -0
- package/{lib/dates → dates}/types.d.ts.map +0 -0
- package/{lib/dates → dates}/types.js +0 -0
- package/{lib/dates → dates}/types.js.map +0 -0
- package/{lib/dates → dates}/yearDate.d.ts +0 -0
- package/{lib/dates → dates}/yearDate.d.ts.map +0 -0
- package/{lib/dates → dates}/yearDate.js +0 -0
- package/{lib/dates → dates}/yearDate.js.map +0 -0
- package/{lib/fields → fields}/filter.d.ts +0 -0
- package/{lib/fields → fields}/filter.d.ts.map +0 -0
- package/{lib/fields → fields}/filter.js +0 -0
- package/{lib/fields → fields}/filter.js.map +0 -0
- package/{lib/fields → fields}/index.d.ts +0 -0
- package/{lib/fields → fields}/index.d.ts.map +0 -0
- package/{lib/fields → fields}/index.js +0 -0
- package/{lib/fields → fields}/index.js.map +0 -0
- package/{lib/fields → fields}/transfer.d.ts +0 -0
- package/{lib/fields → fields}/transfer.d.ts.map +0 -0
- package/{lib/fields → fields}/transfer.js +0 -0
- package/{lib/fields → fields}/transfer.js.map +0 -0
- package/{lib/fields → fields}/update.d.ts +0 -0
- package/{lib/fields → fields}/update.d.ts.map +0 -0
- package/{lib/fields → fields}/update.js +0 -0
- package/{lib/fields → fields}/update.js.map +0 -0
- package/{lib/functions → functions}/assert.d.ts +0 -0
- package/{lib/functions → functions}/assert.d.ts.map +0 -0
- package/{lib/functions → functions}/assert.js +0 -0
- package/{lib/functions → functions}/assert.js.map +0 -0
- package/{lib/functions → functions}/disposer.d.ts +0 -0
- package/{lib/functions → functions}/disposer.d.ts.map +0 -0
- package/{lib/functions → functions}/disposer.js +0 -0
- package/{lib/functions → functions}/disposer.js.map +0 -0
- package/{lib/functions → functions}/safeCall.d.ts +0 -0
- package/{lib/functions → functions}/safeCall.d.ts.map +0 -0
- package/{lib/functions → functions}/safeCall.js +0 -0
- package/{lib/functions → functions}/safeCall.js.map +0 -0
- package/{lib/functions → functions}/throttle.d.ts +0 -0
- package/{lib/functions → functions}/throttle.d.ts.map +0 -0
- package/{lib/functions → functions}/throttle.js +0 -0
- package/{lib/functions → functions}/throttle.js.map +0 -0
- package/{lib/lazy → lazy}/light.d.ts +0 -0
- package/{lib/lazy → lazy}/light.d.ts.map +0 -0
- package/{lib/lazy → lazy}/light.js +0 -0
- package/{lib/lazy → lazy}/light.js.map +0 -0
- package/{lib/lazy → lazy}/promise.d.ts +0 -0
- package/{lib/lazy → lazy}/promise.d.ts.map +0 -0
- package/{lib/lazy → lazy}/promise.js +0 -0
- package/{lib/lazy → lazy}/promise.js.map +0 -0
- package/{lib/lazy → lazy}/singleton.d.ts +0 -0
- package/{lib/lazy → lazy}/singleton.d.ts.map +0 -0
- package/{lib/lazy → lazy}/singleton.js +0 -0
- package/{lib/lazy → lazy}/singleton.js.map +0 -0
- package/{lib/logger → logger}/abstractions.d.ts +0 -0
- package/{lib/logger → logger}/abstractions.d.ts.map +0 -0
- package/{lib/logger → logger}/abstractions.js +0 -0
- package/{lib/logger → logger}/abstractions.js.map +0 -0
- package/{lib/logger → logger}/batch.d.ts +0 -0
- package/{lib/logger → logger}/batch.d.ts.map +0 -0
- package/{lib/logger → logger}/batch.js +0 -0
- package/{lib/logger → logger}/batch.js.map +0 -0
- package/{lib/logger → logger}/console.d.ts +0 -0
- package/{lib/logger → logger}/console.d.ts.map +0 -0
- package/{lib/logger → logger}/console.js +0 -0
- package/{lib/logger → logger}/console.js.map +0 -0
- package/{lib/logger → logger}/file.d.ts +0 -0
- package/{lib/logger → logger}/file.d.ts.map +0 -0
- package/{lib/logger → logger}/file.js +0 -0
- package/{lib/logger → logger}/file.js.map +0 -0
- package/{lib/logger → logger}/index.d.ts +0 -0
- package/{lib/logger → logger}/index.d.ts.map +0 -0
- package/{lib/logger → logger}/index.js +0 -0
- package/{lib/logger → logger}/index.js.map +0 -0
- package/{lib/logger → logger}/named.d.ts +0 -0
- package/{lib/logger → logger}/named.d.ts.map +0 -0
- package/{lib/logger → logger}/named.js +0 -0
- package/{lib/logger → logger}/named.js.map +0 -0
- package/{lib/logger → logger}/proxy.d.ts +0 -0
- package/{lib/logger → logger}/proxy.d.ts.map +0 -0
- package/{lib/logger → logger}/proxy.js +0 -0
- package/{lib/logger → logger}/proxy.js.map +0 -0
- package/{lib/math → math}/arrays.d.ts +0 -0
- package/{lib/math → math}/arrays.d.ts.map +0 -0
- package/{lib/math → math}/arrays.js +0 -0
- package/{lib/math → math}/arrays.js.map +0 -0
- package/{lib/math → math}/calc.d.ts +0 -0
- package/{lib/math → math}/calc.d.ts.map +0 -0
- package/{lib/math → math}/calc.js +0 -0
- package/{lib/math → math}/calc.js.map +0 -0
- package/{lib/math → math}/distribution.d.ts +0 -0
- package/{lib/math → math}/distribution.d.ts.map +0 -0
- package/{lib/math → math}/distribution.js +0 -0
- package/{lib/math → math}/distribution.js.map +0 -0
- package/{lib/math → math}/index.d.ts +0 -0
- package/{lib/math → math}/index.d.ts.map +0 -0
- package/{lib/math → math}/index.js +0 -0
- package/{lib/math → math}/index.js.map +0 -0
- package/{lib/models → models}/EntityWithStatus.d.ts +0 -0
- package/{lib/models → models}/EntityWithStatus.d.ts.map +0 -0
- package/{lib/models → models}/EntityWithStatus.js +0 -0
- package/{lib/models → models}/EntityWithStatus.js.map +0 -0
- package/{lib/models → models}/File.d.ts +0 -0
- package/{lib/models → models}/File.d.ts.map +0 -0
- package/{lib/models → models}/File.js +0 -0
- package/{lib/models → models}/File.js.map +0 -0
- package/models/Model.d.ts +12 -0
- package/models/Model.d.ts.map +1 -0
- package/models/Model.js +23 -0
- package/models/Model.js.map +1 -0
- package/models/ValuesCollector.d.ts +26 -0
- package/models/ValuesCollector.d.ts.map +1 -0
- package/models/ValuesCollector.js +51 -0
- package/models/ValuesCollector.js.map +1 -0
- package/models/types.d.ts +19 -0
- package/models/types.d.ts.map +1 -0
- package/models/types.js +3 -0
- package/models/types.js.map +1 -0
- package/models/wrappers.d.ts +12 -0
- package/models/wrappers.d.ts.map +1 -0
- package/models/wrappers.js +43 -0
- package/models/wrappers.js.map +1 -0
- package/{lib/observing → observing}/event.d.ts +0 -0
- package/{lib/observing → observing}/event.d.ts.map +0 -0
- package/{lib/observing → observing}/event.js +0 -0
- package/{lib/observing → observing}/event.js.map +0 -0
- package/{lib/observing → observing}/progressTracker.d.ts +0 -0
- package/{lib/observing → observing}/progressTracker.d.ts.map +0 -0
- package/{lib/observing → observing}/progressTracker.js +0 -0
- package/{lib/observing → observing}/progressTracker.js.map +0 -0
- package/{lib/observing → observing}/throttledEvent.d.ts +0 -0
- package/{lib/observing → observing}/throttledEvent.d.ts.map +0 -0
- package/{lib/observing → observing}/throttledEvent.js +0 -0
- package/{lib/observing → observing}/throttledEvent.js.map +0 -0
- package/{lib/observing → observing}/timer.d.ts +0 -0
- package/{lib/observing → observing}/timer.d.ts.map +0 -0
- package/{lib/observing → observing}/timer.js +0 -0
- package/{lib/observing → observing}/timer.js.map +0 -0
- package/package.json +8 -11
- package/{lib/storage → storage}/abstractions.d.ts +0 -0
- package/{lib/storage → storage}/abstractions.d.ts.map +0 -0
- package/{lib/storage → storage}/abstractions.js +0 -0
- package/{lib/storage → storage}/abstractions.js.map +0 -0
- package/{lib/storage → storage}/asyncWrapper.d.ts +0 -0
- package/{lib/storage → storage}/asyncWrapper.d.ts.map +0 -0
- package/{lib/storage → storage}/asyncWrapper.js +0 -0
- package/{lib/storage → storage}/asyncWrapper.js.map +0 -0
- package/{lib/storage → storage}/index.d.ts +0 -0
- package/{lib/storage → storage}/index.d.ts.map +0 -0
- package/{lib/storage → storage}/index.js +0 -0
- package/{lib/storage → storage}/index.js.map +0 -0
- package/{lib/storage → storage}/keyStorage.d.ts +0 -0
- package/{lib/storage → storage}/keyStorage.d.ts.map +0 -0
- package/{lib/storage → storage}/keyStorage.js +0 -0
- package/{lib/storage → storage}/keyStorage.js.map +0 -0
- package/{lib/structures → structures}/helpers/enum.d.ts +0 -0
- package/{lib/structures → structures}/helpers/enum.d.ts.map +0 -0
- package/{lib/structures → structures}/helpers/enum.js +0 -0
- package/{lib/structures → structures}/helpers/enum.js.map +0 -0
- package/{lib/structures → structures}/helpers/name.d.ts +0 -0
- package/{lib/structures → structures}/helpers/name.d.ts.map +0 -0
- package/{lib/structures → structures}/helpers/name.js +0 -0
- package/{lib/structures → structures}/helpers/name.js.map +0 -0
- package/{lib/structures → structures}/linkedList.d.ts +0 -0
- package/{lib/structures → structures}/linkedList.d.ts.map +0 -0
- package/{lib/structures → structures}/linkedList.js +0 -0
- package/{lib/structures → structures}/linkedList.js.map +0 -0
- package/{lib/structures → structures}/pool.d.ts +0 -0
- package/{lib/structures → structures}/pool.d.ts.map +0 -0
- package/{lib/structures → structures}/pool.js +0 -0
- package/{lib/structures → structures}/pool.js.map +0 -0
- package/{lib/structures → structures}/queue/parallel.d.ts +0 -0
- package/{lib/structures → structures}/queue/parallel.d.ts.map +0 -0
- package/{lib/structures → structures}/queue/parallel.js +0 -0
- package/{lib/structures → structures}/queue/parallel.js.map +0 -0
- package/{lib/structures → structures}/queue/tasks.d.ts +0 -0
- package/{lib/structures → structures}/queue/tasks.d.ts.map +0 -0
- package/{lib/structures → structures}/queue/tasks.js +0 -0
- package/{lib/structures → structures}/queue/tasks.js.map +0 -0
- package/{lib/structures → structures}/tempoCache.d.ts +0 -0
- package/{lib/structures → structures}/tempoCache.d.ts.map +0 -0
- package/{lib/structures → structures}/tempoCache.js +0 -0
- package/{lib/structures → structures}/tempoCache.js.map +0 -0
- package/{lib/types → types}/comparator.d.ts +0 -0
- package/{lib/types → types}/comparator.d.ts.map +0 -0
- package/{lib/types → types}/comparator.js +0 -0
- package/{lib/types → types}/comparator.js.map +0 -0
- package/{lib/types → types}/deep.d.ts +0 -0
- package/{lib/types → types}/deep.d.ts.map +0 -0
- package/{lib/types → types}/deep.js +0 -0
- package/{lib/types → types}/deep.js.map +0 -0
- package/{lib/types → types}/functions.d.ts +0 -0
- package/{lib/types → types}/functions.d.ts.map +0 -0
- package/{lib/types → types}/functions.js +0 -0
- package/{lib/types → types}/functions.js.map +0 -0
- package/{lib/types → types}/getter.d.ts +0 -0
- package/{lib/types → types}/getter.d.ts.map +1 -1
- package/{lib/types → types}/getter.js +0 -3
- package/types/getter.js.map +1 -0
- package/{lib/types → types}/ident.d.ts +0 -0
- package/{lib/types → types}/ident.d.ts.map +0 -0
- package/{lib/types → types}/ident.js +0 -0
- package/{lib/types → types}/ident.js.map +0 -0
- package/{lib/types → types}/index.d.ts +3 -0
- package/{lib/types → types}/index.d.ts.map +1 -1
- package/{lib/types → types}/index.js +0 -0
- package/{lib/types → types}/index.js.map +0 -0
- package/{lib/validation → validation}/ValidationErrors.d.ts +0 -0
- package/{lib/validation → validation}/ValidationErrors.d.ts.map +0 -0
- package/{lib/validation → validation}/ValidationErrors.js +0 -0
- package/{lib/validation → validation}/ValidationErrors.js.map +0 -0
- package/{lib/validation → validation}/creditCard.d.ts +0 -0
- package/{lib/validation → validation}/creditCard.d.ts.map +0 -0
- package/{lib/validation → validation}/creditCard.js +0 -0
- package/{lib/validation → validation}/creditCard.js.map +0 -0
- package/{lib/validation → validation}/emails.d.ts +0 -0
- package/{lib/validation → validation}/emails.d.ts.map +0 -0
- package/{lib/validation → validation}/emails.js +0 -0
- package/{lib/validation → validation}/emails.js.map +0 -0
- package/{lib/validation → validation}/helpers.d.ts +0 -0
- package/{lib/validation → validation}/helpers.d.ts.map +0 -0
- package/{lib/validation → validation}/helpers.js +0 -0
- package/{lib/validation → validation}/helpers.js.map +0 -0
- package/{lib/validation → validation}/index.d.ts +0 -0
- package/{lib/validation → validation}/index.d.ts.map +0 -0
- package/{lib/validation → validation}/index.js +0 -0
- package/{lib/validation → validation}/index.js.map +0 -0
- package/{lib/validation → validation}/types.d.ts +0 -0
- package/{lib/validation → validation}/types.d.ts.map +0 -0
- package/{lib/validation → validation}/types.js +0 -0
- package/{lib/validation → validation}/types.js.map +0 -0
- package/{lib/validation → validation}/validators.d.ts +0 -0
- package/{lib/validation → validation}/validators.d.ts.map +0 -0
- package/{lib/validation → validation}/validators.js +0 -0
- package/{lib/validation → validation}/validators.js.map +0 -0
- package/{lib/validation → validation}/wrappers.d.ts +0 -0
- package/{lib/validation → validation}/wrappers.d.ts.map +0 -0
- package/{lib/validation → validation}/wrappers.js +0 -0
- package/{lib/validation → validation}/wrappers.js.map +0 -0
- package/.eslintignore +0 -5
- package/.eslintrc.js +0 -9
- package/.github/workflows/CI.yml +0 -48
- package/.gitignore +0 -13
- package/.nvmrc +0 -1
- package/coverage/clover.xml +0 -1280
- package/coverage/coverage-final.json +0 -43
- package/coverage/lcov-report/CommonModel.ts.html +0 -215
- package/coverage/lcov-report/FlagModel.ts.html +0 -290
- package/coverage/lcov-report/MultiSelectModel.ts.html +0 -614
- package/coverage/lcov-report/NumberModel.ts.html +0 -230
- package/coverage/lcov-report/SelectModel.ts.html +0 -503
- package/coverage/lcov-report/Validatable.ts.html +0 -386
- package/coverage/lcov-report/__tests__/helpers/expect.ts.html +0 -94
- package/coverage/lcov-report/__tests__/helpers/index.html +0 -131
- package/coverage/lcov-report/__tests__/helpers/main.ts.html +0 -121
- package/coverage/lcov-report/async/arrays.ts.html +0 -199
- package/coverage/lcov-report/async/index.html +0 -131
- package/coverage/lcov-report/async/timeout.ts.html +0 -337
- package/coverage/lcov-report/base.css +0 -224
- package/coverage/lcov-report/block-navigation.js +0 -87
- package/coverage/lcov-report/dates/calc.ts.html +0 -301
- package/coverage/lcov-report/dates/convert.ts.html +0 -658
- package/coverage/lcov-report/dates/datex.ts.html +0 -211
- package/coverage/lcov-report/dates/format.ts.html +0 -403
- package/coverage/lcov-report/dates/index.html +0 -251
- package/coverage/lcov-report/dates/index.ts.html +0 -112
- package/coverage/lcov-report/dates/parse.ts.html +0 -157
- package/coverage/lcov-report/dates/period.ts.html +0 -154
- package/coverage/lcov-report/dates/shift.ts.html +0 -355
- package/coverage/lcov-report/dates/types.ts.html +0 -181
- package/coverage/lcov-report/dates/yearDate.ts.html +0 -193
- package/coverage/lcov-report/disposer.ts.html +0 -376
- package/coverage/lcov-report/enumHelper.ts.html +0 -454
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/fields/index.html +0 -116
- package/coverage/lcov-report/fields/update.ts.html +0 -457
- package/coverage/lcov-report/functions/disposer.ts.html +0 -376
- package/coverage/lcov-report/functions/index.html +0 -116
- package/coverage/lcov-report/functions/safeCall.ts.html +0 -103
- package/coverage/lcov-report/index.html +0 -311
- package/coverage/lcov-report/lazy/index.html +0 -131
- package/coverage/lcov-report/lazy/light.ts.html +0 -172
- package/coverage/lcov-report/lazy/promise.ts.html +0 -241
- package/coverage/lcov-report/lazy/singleton.ts.html +0 -181
- package/coverage/lcov-report/logger/batch.ts.html +0 -112
- package/coverage/lcov-report/logger/console.ts.html +0 -241
- package/coverage/lcov-report/logger/index.html +0 -176
- package/coverage/lcov-report/logger/index.ts.html +0 -298
- package/coverage/lcov-report/logger/named.ts.html +0 -226
- package/coverage/lcov-report/logger/proxy.ts.html +0 -172
- package/coverage/lcov-report/math/arrays.ts.html +0 -907
- package/coverage/lcov-report/math/calc.ts.html +0 -292
- package/coverage/lcov-report/math/distribution.ts.html +0 -145
- package/coverage/lcov-report/math/index.html +0 -161
- package/coverage/lcov-report/math/index.ts.html +0 -166
- package/coverage/lcov-report/observing/event.ts.html +0 -358
- package/coverage/lcov-report/observing/index.html +0 -116
- package/coverage/lcov-report/observing/transition.ts.html +0 -634
- package/coverage/lcov-report/parallel.ts.html +0 -550
- package/coverage/lcov-report/prettify.css +0 -1
- package/coverage/lcov-report/prettify.js +0 -2
- package/coverage/lcov-report/queue/index.html +0 -116
- package/coverage/lcov-report/queue/parallel.ts.html +0 -499
- package/coverage/lcov-report/queue/tasks.ts.html +0 -358
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +0 -196
- package/coverage/lcov-report/src/__tests__/helpers/expect.ts.html +0 -94
- package/coverage/lcov-report/src/__tests__/helpers/index.html +0 -131
- package/coverage/lcov-report/src/__tests__/helpers/main.ts.html +0 -121
- package/coverage/lcov-report/src/async/arrays.ts.html +0 -199
- package/coverage/lcov-report/src/async/index.html +0 -131
- package/coverage/lcov-report/src/async/timeout.ts.html +0 -337
- package/coverage/lcov-report/src/cache.ts.html +0 -628
- package/coverage/lcov-report/src/dates/calc.ts.html +0 -301
- package/coverage/lcov-report/src/dates/convert.ts.html +0 -658
- package/coverage/lcov-report/src/dates/datex.ts.html +0 -211
- package/coverage/lcov-report/src/dates/format.ts.html +0 -403
- package/coverage/lcov-report/src/dates/index.html +0 -251
- package/coverage/lcov-report/src/dates/index.ts.html +0 -112
- package/coverage/lcov-report/src/dates/parse.ts.html +0 -157
- package/coverage/lcov-report/src/dates/period.ts.html +0 -154
- package/coverage/lcov-report/src/dates/shift.ts.html +0 -355
- package/coverage/lcov-report/src/dates/types.ts.html +0 -181
- package/coverage/lcov-report/src/dates/yearDate.ts.html +0 -193
- package/coverage/lcov-report/src/disposer.ts.html +0 -376
- package/coverage/lcov-report/src/enumHelper.ts.html +0 -454
- package/coverage/lcov-report/src/event.ts.html +0 -361
- package/coverage/lcov-report/src/fields/index.html +0 -116
- package/coverage/lcov-report/src/fields/update.ts.html +0 -457
- package/coverage/lcov-report/src/functions.ts.html +0 -127
- package/coverage/lcov-report/src/index.html +0 -251
- package/coverage/lcov-report/src/lazy/index.html +0 -161
- package/coverage/lcov-report/src/lazy/lazy.ts.html +0 -181
- package/coverage/lcov-report/src/lazy/light.ts.html +0 -172
- package/coverage/lcov-report/src/lazy/observable.ts.html +0 -196
- package/coverage/lcov-report/src/lazy/promise.ts.html +0 -241
- package/coverage/lcov-report/src/lazy/singleton.ts.html +0 -181
- package/coverage/lcov-report/src/lazy.light.ts.html +0 -172
- package/coverage/lcov-report/src/logger/batch.ts.html +0 -112
- package/coverage/lcov-report/src/logger/console.ts.html +0 -241
- package/coverage/lcov-report/src/logger/index.html +0 -176
- package/coverage/lcov-report/src/logger/index.ts.html +0 -298
- package/coverage/lcov-report/src/logger/named.ts.html +0 -226
- package/coverage/lcov-report/src/logger/proxy.ts.html +0 -172
- package/coverage/lcov-report/src/math/arrays.ts.html +0 -868
- package/coverage/lcov-report/src/math/calc.ts.html +0 -292
- package/coverage/lcov-report/src/math/distribution.ts.html +0 -145
- package/coverage/lcov-report/src/math/index.html +0 -161
- package/coverage/lcov-report/src/math/index.ts.html +0 -166
- package/coverage/lcov-report/src/observers.ts.html +0 -368
- package/coverage/lcov-report/src/observersMap.ts.html +0 -400
- package/coverage/lcov-report/src/observingCache.ts.html +0 -565
- package/coverage/lcov-report/src/queue/index.html +0 -131
- package/coverage/lcov-report/src/queue/parallel.ts.html +0 -511
- package/coverage/lcov-report/src/queue/tasks.ts.html +0 -358
- package/coverage/lcov-report/src/tempoCache.ts.html +0 -139
- package/coverage/lcov-report/src/transitionObserver.ts.html +0 -634
- package/coverage/lcov-report/src/types/comparator.ts.html +0 -103
- package/coverage/lcov-report/src/types/getter.ts.html +0 -127
- package/coverage/lcov-report/src/types/index.html +0 -146
- package/coverage/lcov-report/src/types/index.ts.html +0 -112
- package/coverage/lcov-report/src/types.ts.html +0 -175
- package/coverage/lcov-report/src/validation/ValidationErrors.ts.html +0 -163
- package/coverage/lcov-report/src/validation/creditCard.ts.html +0 -160
- package/coverage/lcov-report/src/validation/helpers.ts.html +0 -226
- package/coverage/lcov-report/src/validation/index.html +0 -206
- package/coverage/lcov-report/src/validation/index.ts.html +0 -112
- package/coverage/lcov-report/src/validation/types.ts.html +0 -139
- package/coverage/lcov-report/src/validation/validators.ts.html +0 -250
- package/coverage/lcov-report/src/validation/wrappers.ts.html +0 -163
- package/coverage/lcov-report/src/viewModels/CommonModel.ts.html +0 -220
- package/coverage/lcov-report/src/viewModels/FlagModel.ts.html +0 -295
- package/coverage/lcov-report/src/viewModels/LoadingModel.ts.html +0 -241
- package/coverage/lcov-report/src/viewModels/MultiSelectModel.ts.html +0 -619
- package/coverage/lcov-report/src/viewModels/NumberModel.ts.html +0 -235
- package/coverage/lcov-report/src/viewModels/SelectModel.ts.html +0 -541
- package/coverage/lcov-report/src/viewModels/TextModel.ts.html +0 -466
- package/coverage/lcov-report/src/viewModels/Validatable.ts.html +0 -391
- package/coverage/lcov-report/src/viewModels/index.html +0 -236
- package/coverage/lcov-report/src/viewModels/wrappers.ts.html +0 -232
- package/coverage/lcov-report/structures/helpers/enum.ts.html +0 -454
- package/coverage/lcov-report/structures/helpers/index.html +0 -116
- package/coverage/lcov-report/structures/index.html +0 -116
- package/coverage/lcov-report/structures/promiseCache.ts.html +0 -628
- package/coverage/lcov-report/structures/queue/index.html +0 -131
- package/coverage/lcov-report/structures/queue/parallel.ts.html +0 -511
- package/coverage/lcov-report/structures/queue/tasks.ts.html +0 -358
- package/coverage/lcov-report/structures/subscribersMap.ts.html +0 -400
- package/coverage/lcov-report/structures/subscribersPromiseCache.ts.html +0 -562
- package/coverage/lcov-report/structures/tempoCache.ts.html +0 -139
- package/coverage/lcov-report/tasks.ts.html +0 -355
- package/coverage/lcov-report/tempoCache.ts.html +0 -134
- package/coverage/lcov-report/timer.ts.html +0 -200
- package/coverage/lcov-report/types/comparator.ts.html +0 -103
- package/coverage/lcov-report/types/getter.ts.html +0 -127
- package/coverage/lcov-report/types/index.html +0 -146
- package/coverage/lcov-report/types/index.ts.html +0 -136
- package/coverage/lcov-report/update.ts.html +0 -374
- package/coverage/lcov-report/validation/ValidationErrors.ts.html +0 -163
- package/coverage/lcov-report/validation/creditCard.ts.html +0 -160
- package/coverage/lcov-report/validation/helpers.ts.html +0 -226
- package/coverage/lcov-report/validation/index.html +0 -206
- package/coverage/lcov-report/validation/index.ts.html +0 -112
- package/coverage/lcov-report/validation/types.ts.html +0 -139
- package/coverage/lcov-report/validation/validators.ts.html +0 -250
- package/coverage/lcov-report/validation/wrappers.ts.html +0 -163
- package/coverage/lcov-report/viewModels/CommonModel.ts.html +0 -215
- package/coverage/lcov-report/viewModels/FlagModel.ts.html +0 -290
- package/coverage/lcov-report/viewModels/LoadingModel.ts.html +0 -244
- package/coverage/lcov-report/viewModels/MultiSelectModel.ts.html +0 -614
- package/coverage/lcov-report/viewModels/NumberModel.ts.html +0 -230
- package/coverage/lcov-report/viewModels/SelectModel.ts.html +0 -536
- package/coverage/lcov-report/viewModels/TextModel.ts.html +0 -461
- package/coverage/lcov-report/viewModels/Validatable.ts.html +0 -386
- package/coverage/lcov-report/viewModels/index.html +0 -116
- package/coverage/lcov.info +0 -2763
- package/global-test-setup.js +0 -3
- package/jest.config.js +0 -10
- package/lib/types/getter.js.map +0 -1
- package/src/.DS_Store +0 -0
- package/src/__tests__/helpers/expect.ts +0 -3
- package/src/__tests__/helpers/main.ts +0 -12
- package/src/abstractions/controllers/IPluggableController.ts +0 -7
- package/src/async/__tests__/timeout.test.ts +0 -74
- package/src/async/arrays.extend.ts +0 -17
- package/src/async/arrays.ts +0 -38
- package/src/async/misc.ts +0 -26
- package/src/async/timeout.ts +0 -84
- package/src/controllers/PluggableController.ts +0 -35
- package/src/dates/__tests__/dates.test.ts +0 -1314
- package/src/dates/calc.ts +0 -72
- package/src/dates/convert.ts +0 -191
- package/src/dates/datex.ts +0 -42
- package/src/dates/format.ts +0 -106
- package/src/dates/index.ts +0 -9
- package/src/dates/parse.ts +0 -24
- package/src/dates/period.ts +0 -23
- package/src/dates/shift.ts +0 -90
- package/src/dates/types.ts +0 -32
- package/src/dates/yearDate.ts +0 -36
- package/src/fields/__tests__/fields.update.test.ts +0 -73
- package/src/fields/filter.ts +0 -27
- package/src/fields/index.ts +0 -4
- package/src/fields/transfer.ts +0 -85
- package/src/fields/update.ts +0 -124
- package/src/functions/assert.ts +0 -19
- package/src/functions/disposer.ts +0 -97
- package/src/functions/safeCall.ts +0 -6
- package/src/functions/throttle.ts +0 -96
- package/src/lazy/__tests__/lazy.test.ts +0 -48
- package/src/lazy/light.ts +0 -29
- package/src/lazy/promise.ts +0 -52
- package/src/lazy/singleton.ts +0 -32
- package/src/logger/__tests__/logger.test.ts +0 -206
- package/src/logger/abstractions.ts +0 -13
- package/src/logger/batch.ts +0 -9
- package/src/logger/console.ts +0 -52
- package/src/logger/file.ts +0 -66
- package/src/logger/index.ts +0 -71
- package/src/logger/named.ts +0 -47
- package/src/logger/proxy.ts +0 -29
- package/src/math/__tests__/arrays.test.ts +0 -196
- package/src/math/__tests__/calc.test.ts +0 -67
- package/src/math/__tests__/distribution.test.ts +0 -25
- package/src/math/__tests__/index.test.ts +0 -20
- package/src/math/arrays.ts +0 -274
- package/src/math/calc.ts +0 -69
- package/src/math/distribution.ts +0 -20
- package/src/math/index.ts +0 -27
- package/src/models/EntityWithStatus.ts +0 -58
- package/src/models/File.ts +0 -14
- package/src/observing/event.ts +0 -91
- package/src/observing/progressTracker.ts +0 -90
- package/src/observing/throttledEvent.ts +0 -20
- package/src/observing/timer.ts +0 -40
- package/src/storage/abstractions.ts +0 -18
- package/src/storage/asyncWrapper.ts +0 -24
- package/src/storage/index.ts +0 -2
- package/src/storage/keyStorage.ts +0 -40
- package/src/structures/__tests__/enumHelper.test.ts +0 -85
- package/src/structures/__tests__/tempoCache.test.ts +0 -31
- package/src/structures/helpers/enum.ts +0 -123
- package/src/structures/helpers/name.ts +0 -58
- package/src/structures/linkedList.ts +0 -129
- package/src/structures/pool.ts +0 -47
- package/src/structures/queue/__tests__/parallel.test.ts +0 -58
- package/src/structures/queue/__tests__/tasks.test.ts +0 -87
- package/src/structures/queue/parallel.ts +0 -142
- package/src/structures/queue/tasks.ts +0 -91
- package/src/structures/tempoCache.ts +0 -18
- package/src/types/comparator.ts +0 -6
- package/src/types/deep.ts +0 -18
- package/src/types/functions.ts +0 -8
- package/src/types/getter.ts +0 -14
- package/src/types/ident.ts +0 -8
- package/src/types/index.ts +0 -17
- package/src/validation/ValidationErrors.ts +0 -26
- package/src/validation/__tests__/index.test.ts +0 -8
- package/src/validation/__tests__/validator.test.ts +0 -107
- package/src/validation/creditCard.ts +0 -25
- package/src/validation/emails.ts +0 -5
- package/src/validation/helpers.ts +0 -47
- package/src/validation/index.ts +0 -9
- package/src/validation/types.ts +0 -18
- package/src/validation/validators.ts +0 -55
- package/src/validation/wrappers.ts +0 -26
- package/tsconfig.build.json +0 -10
- package/tsconfig.json +0 -32
- package/yarn-error.log +0 -3709
- package/yarn.lock +0 -3446
package/src/structures/pool.ts
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { safeCall } from '../functions/safeCall';
|
|
2
|
-
import type { IDisposable } from '../functions/disposer';
|
|
3
|
-
|
|
4
|
-
export class Pool<T> {
|
|
5
|
-
|
|
6
|
-
private readonly _container: T[] = [];
|
|
7
|
-
|
|
8
|
-
constructor(readonly factory: () => T) { }
|
|
9
|
-
|
|
10
|
-
public get(): T {
|
|
11
|
-
if (this._container.length > 0) {
|
|
12
|
-
return this._container.pop();
|
|
13
|
-
} else {
|
|
14
|
-
return this.factory();
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
public release(e: T | T[]): void {
|
|
19
|
-
if (Array.isArray(e)) {
|
|
20
|
-
this._container.push(...e);
|
|
21
|
-
} else if (e) {
|
|
22
|
-
this._container.push(e);
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export class PoolDisposable<T extends IDisposable> extends Pool<T> {
|
|
28
|
-
|
|
29
|
-
constructor(factory: () => T, readonly initializer: (item: T) => void = null) {
|
|
30
|
-
super(factory);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
public get(): T {
|
|
34
|
-
const res = super.get();
|
|
35
|
-
safeCall(this.initializer, res);
|
|
36
|
-
return res;
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
public release(e: T | T[]): void {
|
|
40
|
-
if (Array.isArray(e)) {
|
|
41
|
-
e.forEach(ee => ee.dispose());
|
|
42
|
-
} else if (e) {
|
|
43
|
-
e.dispose();
|
|
44
|
-
}
|
|
45
|
-
return super.release(e);
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import 'jest-extended';
|
|
2
|
-
import { ParallelQueue } from '../parallel';
|
|
3
|
-
import { setTimeoutAsync } from '../../../async/timeout';
|
|
4
|
-
import { setMode } from '../../../logger';
|
|
5
|
-
|
|
6
|
-
const createLoader = () => jest.fn(() => setTimeoutAsync(100));
|
|
7
|
-
|
|
8
|
-
setMode('console');
|
|
9
|
-
|
|
10
|
-
describe('ParallelQueue', () => {
|
|
11
|
-
it('runs', async () => {
|
|
12
|
-
|
|
13
|
-
const q = new ParallelQueue()
|
|
14
|
-
.withLogger('test');
|
|
15
|
-
|
|
16
|
-
expect(q.inProgress).toBeFalsy();
|
|
17
|
-
|
|
18
|
-
const f1 = createLoader();
|
|
19
|
-
const f2 = createLoader();
|
|
20
|
-
q.enqueue(f1);
|
|
21
|
-
q.enqueue(f2);
|
|
22
|
-
|
|
23
|
-
expect(f1).not.toHaveBeenCalled();
|
|
24
|
-
expect(f2).not.toHaveBeenCalled();
|
|
25
|
-
|
|
26
|
-
const res = q.start();
|
|
27
|
-
expect(q.inProgress).toBeTruthy();
|
|
28
|
-
|
|
29
|
-
expect(q.currentPriority).toBe(0);
|
|
30
|
-
|
|
31
|
-
const f3 = createLoader();
|
|
32
|
-
const f4 = createLoader();
|
|
33
|
-
|
|
34
|
-
q.enqueue(f3);
|
|
35
|
-
|
|
36
|
-
q.enqueue(f4, 1);
|
|
37
|
-
|
|
38
|
-
await expect(q.start()).resolves.toBeUndefined();
|
|
39
|
-
|
|
40
|
-
await expect(res).resolves.toBe(true);
|
|
41
|
-
|
|
42
|
-
expect(q.inProgress).toBeFalsy();
|
|
43
|
-
expect(q.currentPriority).toBe(1);
|
|
44
|
-
|
|
45
|
-
expect(f1).toHaveBeenCalledBefore(f2);
|
|
46
|
-
expect(f2).toHaveBeenCalledAfter(f1);
|
|
47
|
-
expect(f3).toHaveBeenCalledAfter(f2);
|
|
48
|
-
expect(f4).toHaveBeenCalledAfter(f3);
|
|
49
|
-
|
|
50
|
-
const f5 = createLoader();
|
|
51
|
-
|
|
52
|
-
q.enqueue(f5);
|
|
53
|
-
|
|
54
|
-
await setTimeoutAsync(100);
|
|
55
|
-
|
|
56
|
-
expect(f5).toHaveBeenCalledAfter(f4);
|
|
57
|
-
});
|
|
58
|
-
});
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { TasksQueue } from '../tasks';
|
|
2
|
-
import { setTimeoutAsync } from '../../../async/timeout';
|
|
3
|
-
import { safeCall } from '../../../functions/safeCall';
|
|
4
|
-
import 'jest-extended';
|
|
5
|
-
|
|
6
|
-
describe('TasksQueue', () => {
|
|
7
|
-
|
|
8
|
-
const createFactory = <T>(res: T, cb?: () => void) => {
|
|
9
|
-
return async () => {
|
|
10
|
-
await setTimeoutAsync(50);
|
|
11
|
-
safeCall(cb);
|
|
12
|
-
return res;
|
|
13
|
-
};
|
|
14
|
-
};
|
|
15
|
-
|
|
16
|
-
it('correctly initializes', async () => {
|
|
17
|
-
const fnZero = async () => {
|
|
18
|
-
return new TasksQueue(0);
|
|
19
|
-
};
|
|
20
|
-
const fnNegative = async () => {
|
|
21
|
-
return new TasksQueue(-12);
|
|
22
|
-
};
|
|
23
|
-
const fnPositive = async () => {
|
|
24
|
-
return new TasksQueue(12);
|
|
25
|
-
};
|
|
26
|
-
|
|
27
|
-
await expect(fnZero()).rejects.toThrow();
|
|
28
|
-
await expect(fnNegative()).rejects.toThrow();
|
|
29
|
-
await expect(fnPositive()).resolves.not.toBeNull();
|
|
30
|
-
|
|
31
|
-
const failEnqueue = async () => {
|
|
32
|
-
const q = new TasksQueue<number>(123);
|
|
33
|
-
q.enqueue(null as any);
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
await expect(failEnqueue()).rejects.toThrow();
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
it('runs without limit', async () => {
|
|
40
|
-
const queue = new TasksQueue(5);
|
|
41
|
-
|
|
42
|
-
expect(queue.isFull).toBeFalsy();
|
|
43
|
-
expect(queue.running).toBe(0);
|
|
44
|
-
|
|
45
|
-
const val1 = 123;
|
|
46
|
-
|
|
47
|
-
const res1 = queue.enqueue(createFactory(val1));
|
|
48
|
-
|
|
49
|
-
expect(queue.isFull).toBeFalsy();
|
|
50
|
-
expect(queue.running).toBe(1);
|
|
51
|
-
|
|
52
|
-
await expect(res1).resolves.toBe(val1);
|
|
53
|
-
});
|
|
54
|
-
|
|
55
|
-
it('runs with limit 1', async () => {
|
|
56
|
-
const queue = new TasksQueue(1);
|
|
57
|
-
|
|
58
|
-
const val1 = 123;
|
|
59
|
-
const cb1 = jest.fn();
|
|
60
|
-
const res1 = queue.enqueue(createFactory(val1, cb1));
|
|
61
|
-
|
|
62
|
-
const val2 = 321;
|
|
63
|
-
const cb2 = jest.fn();
|
|
64
|
-
const res2 = queue.enqueue(createFactory(val2, cb2));
|
|
65
|
-
|
|
66
|
-
const val3 = 111;
|
|
67
|
-
const cb3 = jest.fn();
|
|
68
|
-
const res3 = queue.enqueue(createFactory(val3, cb3));
|
|
69
|
-
|
|
70
|
-
expect(queue.isFull).toBeTruthy();
|
|
71
|
-
expect(queue.running).toBe(1);
|
|
72
|
-
|
|
73
|
-
await expect(res1).resolves.toBe(val1);
|
|
74
|
-
expect(queue.running).toBe(1);
|
|
75
|
-
|
|
76
|
-
await expect(res2).resolves.toBe(val2);
|
|
77
|
-
|
|
78
|
-
expect(queue.running).toBe(1);
|
|
79
|
-
await expect(res3).resolves.toBe(val3);
|
|
80
|
-
|
|
81
|
-
expect(queue.running).toBe(0);
|
|
82
|
-
|
|
83
|
-
expect(cb1).toHaveBeenCalledBefore(cb2);
|
|
84
|
-
expect(cb2).toHaveBeenCalledBefore(cb3);
|
|
85
|
-
expect(cb3).toHaveBeenCalled();
|
|
86
|
-
});
|
|
87
|
-
});
|
|
@@ -1,142 +0,0 @@
|
|
|
1
|
-
import { createLogger, ILogger } from '../../logger';
|
|
2
|
-
import { Event } from '../../observing/event';
|
|
3
|
-
|
|
4
|
-
export type QueueItem = () => void | Promise<void>;
|
|
5
|
-
|
|
6
|
-
type Queue = QueueItem[];
|
|
7
|
-
|
|
8
|
-
export class ParallelQueue {
|
|
9
|
-
|
|
10
|
-
private readonly _queues: Record<number, Queue> = { };
|
|
11
|
-
|
|
12
|
-
private _inProgress: boolean = null;
|
|
13
|
-
private _currentIndex = 0;
|
|
14
|
-
private _maxIndex = 0;
|
|
15
|
-
|
|
16
|
-
private _logger: ILogger = null;
|
|
17
|
-
|
|
18
|
-
private readonly _beforePriorityRun = new Event<number>();
|
|
19
|
-
private readonly _afterPriorityRun = new Event<number>();
|
|
20
|
-
private readonly _finished = new Event();
|
|
21
|
-
|
|
22
|
-
public get currentPriority() { return this._currentIndex; }
|
|
23
|
-
public get inProgress() { return this._inProgress; }
|
|
24
|
-
|
|
25
|
-
public get beforePriorityRun() { return this._beforePriorityRun.expose(); }
|
|
26
|
-
public get afterPriorityRun() { return this._afterPriorityRun.expose(); }
|
|
27
|
-
|
|
28
|
-
public get finished() { return this._finished.expose(); }
|
|
29
|
-
|
|
30
|
-
public withLogger(name?: string) {
|
|
31
|
-
this._logger = createLogger(`[Queue:${name || '?'}]`);
|
|
32
|
-
return this;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/** @returns A callback that will try to cancel queued item */
|
|
36
|
-
public enqueue(cb: QueueItem, priority?: number): () => void {
|
|
37
|
-
const p = Math.round(priority || 0);
|
|
38
|
-
|
|
39
|
-
// if it's started and the priority has been processing already
|
|
40
|
-
// or it has just finished
|
|
41
|
-
if (this._inProgress && p < this._currentIndex || this._inProgress === false) {
|
|
42
|
-
// just start the loader
|
|
43
|
-
this._executeLoader(cb, p, 1000);
|
|
44
|
-
return () => false;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
// Enqueue for future execution
|
|
48
|
-
const q = this.getQueue(p);
|
|
49
|
-
q.push(cb);
|
|
50
|
-
this._maxIndex = Math.max(this._maxIndex, p);
|
|
51
|
-
|
|
52
|
-
// Return callback for removing the item from the queue
|
|
53
|
-
return () => {
|
|
54
|
-
// The processing has started and this queue has been passed already
|
|
55
|
-
if (this._inProgress != null && this._currentIndex >= p) {
|
|
56
|
-
return false;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
// find and remove the item
|
|
60
|
-
const i = q.findIndex(qi => qi === cb);
|
|
61
|
-
if (i >= 0) {
|
|
62
|
-
q.splice(i, 1);
|
|
63
|
-
// return true if we're sure that the item hasn't been executed yet
|
|
64
|
-
return true;
|
|
65
|
-
}
|
|
66
|
-
return false;
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
public async start() {
|
|
71
|
-
if (this._inProgress) {
|
|
72
|
-
return undefined;
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
this._inProgress = true;
|
|
76
|
-
try {
|
|
77
|
-
await this.tryStartQueue();
|
|
78
|
-
} catch (err) {
|
|
79
|
-
this._logger?.warn('Failed to process queue:', err);
|
|
80
|
-
return false;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return true;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
private getQueue(priority: number = 0) {
|
|
87
|
-
let q = this._queues[priority];
|
|
88
|
-
if (!q) {
|
|
89
|
-
q = [];
|
|
90
|
-
this._queues[priority] = q;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
return q;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
private async tryStartQueue() {
|
|
97
|
-
let current: QueueItem[] = null;
|
|
98
|
-
let iterations = 0;
|
|
99
|
-
|
|
100
|
-
await this._beforePriorityRun.triggerAsync(this._currentIndex);
|
|
101
|
-
|
|
102
|
-
while ((current = this._queues[this._currentIndex])?.length) {
|
|
103
|
-
if (iterations++ > 5) {
|
|
104
|
-
break;
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
this._logger?.log('Processing priority =', this._currentIndex, '; count =', current.length);
|
|
108
|
-
|
|
109
|
-
const items = current.slice();
|
|
110
|
-
current.length = 0;
|
|
111
|
-
|
|
112
|
-
await Promise.all(items.map((loader, index) => this._executeLoader(loader, this._currentIndex, index)));
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
if (!current?.length && iterations === 0) {
|
|
116
|
-
this._logger?.log('Skipping priority =', this._currentIndex, '; no items');
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
await this._afterPriorityRun.triggerAsync(this._currentIndex);
|
|
120
|
-
|
|
121
|
-
const next = this._currentIndex + 1;
|
|
122
|
-
if (next > this._maxIndex) {
|
|
123
|
-
// looks like we've finished!
|
|
124
|
-
this._inProgress = false;
|
|
125
|
-
this._logger?.log('Finished processing at index =', this._currentIndex);
|
|
126
|
-
this._finished.trigger();
|
|
127
|
-
return;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
++this._currentIndex;
|
|
131
|
-
await this.tryStartQueue();
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
private _executeLoader = async (l: QueueItem, priority: number, index?: number) => {
|
|
135
|
-
try {
|
|
136
|
-
await l();
|
|
137
|
-
} catch (err) {
|
|
138
|
-
this._logger?.warn('Failed to process queue item at priority =', priority, ' at index =', index || '?');
|
|
139
|
-
this._logger?.error(err);
|
|
140
|
-
}
|
|
141
|
-
};
|
|
142
|
-
}
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import type { ILogger } from '../../logger';
|
|
2
|
-
|
|
3
|
-
type Factory<T> = () => Promise<T>;
|
|
4
|
-
|
|
5
|
-
type QueueItem<T> = {
|
|
6
|
-
factory: Factory<T>;
|
|
7
|
-
finish?: (res: Promise<T>) => Promise<T>;
|
|
8
|
-
name?: string;
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export class TasksQueue<T> {
|
|
12
|
-
|
|
13
|
-
private readonly _items: QueueItem<T>[] = [];
|
|
14
|
-
private _running = 0;
|
|
15
|
-
private _logger: ILogger | null = null;
|
|
16
|
-
|
|
17
|
-
constructor(readonly limit: number) {
|
|
18
|
-
if (!limit || limit < 0) {
|
|
19
|
-
throw new Error('TasksQueue: limit should be a positive number');
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
public get isFull() { return this._running >= this.limit; }
|
|
24
|
-
public get running() { return this._running; }
|
|
25
|
-
|
|
26
|
-
addLogger(logger: ILogger) {
|
|
27
|
-
this._logger = logger;
|
|
28
|
-
return this;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
public enqueue(factory: Factory<T>, name?: string): Promise<T> {
|
|
32
|
-
if (typeof factory !== 'function') {
|
|
33
|
-
throw new Error('Invalid arg: factory not a function');
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
if (this.isFull) {
|
|
37
|
-
|
|
38
|
-
const item: QueueItem<T> = {
|
|
39
|
-
factory,
|
|
40
|
-
finish: undefined,
|
|
41
|
-
name,
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
const waitPromise = new Promise<T>((resolve, reject) => {
|
|
45
|
-
item.finish = async (res) => {
|
|
46
|
-
try {
|
|
47
|
-
const rr = await res;
|
|
48
|
-
resolve(rr);
|
|
49
|
-
return rr;
|
|
50
|
-
} catch (err) {
|
|
51
|
-
reject(err);
|
|
52
|
-
throw err;
|
|
53
|
-
}
|
|
54
|
-
};
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
this._items.push(item);
|
|
58
|
-
return waitPromise;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return this._runFactory(factory);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
private _runFactory = async (factory: Factory<T>, name?: string): Promise<T> => {
|
|
65
|
-
this._running++;
|
|
66
|
-
try {
|
|
67
|
-
const result = await factory();
|
|
68
|
-
return result;
|
|
69
|
-
} catch (err) {
|
|
70
|
-
this._logger?.warn(`Factory "${name || factory.name || '<unknown>'}" thrown. Rethrowing...`);
|
|
71
|
-
throw err;
|
|
72
|
-
} finally {
|
|
73
|
-
this._running--;
|
|
74
|
-
this._tryRunNext();
|
|
75
|
-
}
|
|
76
|
-
};
|
|
77
|
-
|
|
78
|
-
private _tryRunNext = async () => {
|
|
79
|
-
if (!this._items.length || this.isFull) {
|
|
80
|
-
return;
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
const next = this._items.shift();
|
|
84
|
-
if (!next || !next.finish || !next.factory) {
|
|
85
|
-
return;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
await next.finish(this._runFactory(next.factory));
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export class TempoCache<T> {
|
|
3
|
-
|
|
4
|
-
private _expiringAt: number = 0; // already expired
|
|
5
|
-
private _current: T = undefined;
|
|
6
|
-
|
|
7
|
-
constructor(readonly factory: () => T, readonly lifetimeMs: number) { }
|
|
8
|
-
|
|
9
|
-
public get isExpired() { return Date.now() >= this._expiringAt; }
|
|
10
|
-
|
|
11
|
-
public get current() {
|
|
12
|
-
if (this.isExpired) {
|
|
13
|
-
this._current = this.factory();
|
|
14
|
-
this._expiringAt = Date.now() + this.lifetimeMs;
|
|
15
|
-
}
|
|
16
|
-
return this._current;
|
|
17
|
-
}
|
|
18
|
-
}
|
package/src/types/comparator.ts
DELETED
package/src/types/deep.ts
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
type Primitive = number | string | Symbol | boolean | null | undefined | bigint;
|
|
3
|
-
|
|
4
|
-
export type DeepReadonly<T> = T extends (Function | Primitive)
|
|
5
|
-
? T
|
|
6
|
-
: (
|
|
7
|
-
T extends Object
|
|
8
|
-
? { readonly [P in keyof T]: DeepReadonly<T[P]>; }
|
|
9
|
-
: T
|
|
10
|
-
);
|
|
11
|
-
|
|
12
|
-
export type DeepPartial<T> = T extends (Function | Primitive)
|
|
13
|
-
? T
|
|
14
|
-
: (
|
|
15
|
-
T extends Object
|
|
16
|
-
? { [P in keyof T]?: DeepPartial<T[P]>; }
|
|
17
|
-
: T
|
|
18
|
-
);
|
package/src/types/functions.ts
DELETED
package/src/types/getter.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
export type Getter<T> = (() => T) | T | null;
|
|
3
|
-
|
|
4
|
-
export namespace Getter {
|
|
5
|
-
export function getValue<T>(getter: Getter<T>): T {
|
|
6
|
-
if (getter == null) {
|
|
7
|
-
return undefined;
|
|
8
|
-
}
|
|
9
|
-
if (typeof getter === 'function') {
|
|
10
|
-
return (getter as () => T)();
|
|
11
|
-
}
|
|
12
|
-
return getter;
|
|
13
|
-
}
|
|
14
|
-
}
|
package/src/types/ident.ts
DELETED
package/src/types/index.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
export * from './deep';
|
|
2
|
-
export * from './getter';
|
|
3
|
-
export * from './comparator';
|
|
4
|
-
|
|
5
|
-
export type Predicate<T> = (value: T) => boolean;
|
|
6
|
-
|
|
7
|
-
export type TypedKeys<T extends Object, K> = {
|
|
8
|
-
[P in keyof T]: T[P] extends K ? P : never
|
|
9
|
-
}[keyof T];
|
|
10
|
-
|
|
11
|
-
export type ArrayTail<T> = T extends [any, ...infer P] ? [...P] : T;
|
|
12
|
-
|
|
13
|
-
export type NestedPick<T, K extends any[]> = K extends Array<never> // empty arr
|
|
14
|
-
? T
|
|
15
|
-
: {
|
|
16
|
-
[P in K[0]]: P extends keyof T ? NestedPick<T[P], ArrayTail<K>> : never;
|
|
17
|
-
};
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import EnumHelper from '../structures/helpers/enum';
|
|
2
|
-
|
|
3
|
-
export enum ValidationErrors {
|
|
4
|
-
None = 0,
|
|
5
|
-
ShouldBeNonEmpty,
|
|
6
|
-
ShouldBeEqualTo,
|
|
7
|
-
InvalidNameFormat,
|
|
8
|
-
InvalidEmailFormat,
|
|
9
|
-
InvalidPasswordFormat,
|
|
10
|
-
OnlyEnglishLetters,
|
|
11
|
-
InvalidPhoneFormat,
|
|
12
|
-
InvalidCreditCardFormat,
|
|
13
|
-
InvalidCreditCardExpiryDateFormat,
|
|
14
|
-
InvalidCreditCardCvvFormat,
|
|
15
|
-
OnlyDigit,
|
|
16
|
-
|
|
17
|
-
EmailIsInUse,
|
|
18
|
-
FirstName,
|
|
19
|
-
LastName,
|
|
20
|
-
Website,
|
|
21
|
-
Linkedin,
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export namespace ValidationErrors {
|
|
25
|
-
export const Helper = new EnumHelper<ValidationErrors>(ValidationErrors);
|
|
26
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import * as validation from '..';
|
|
2
|
-
import { ValidationErrors } from '../ValidationErrors';
|
|
3
|
-
import { faker } from '@faker-js/faker';
|
|
4
|
-
import fc from 'fast-check';
|
|
5
|
-
import { toArbitrary } from '../../__tests__/helpers/main';
|
|
6
|
-
|
|
7
|
-
describe('validation websites', () => {
|
|
8
|
-
it('test', () => {
|
|
9
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => faker.internet.url());
|
|
10
|
-
|
|
11
|
-
fc.assert(
|
|
12
|
-
fc.property(_url, (url) => {
|
|
13
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.None);
|
|
14
|
-
}),
|
|
15
|
-
);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('test domain name', () => {
|
|
19
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => faker.internet.domainName());
|
|
20
|
-
|
|
21
|
-
fc.assert(
|
|
22
|
-
fc.property(_url, (url) => {
|
|
23
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.None);
|
|
24
|
-
}),
|
|
25
|
-
);
|
|
26
|
-
});
|
|
27
|
-
|
|
28
|
-
it('test hard domain name', () => {
|
|
29
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => `${ faker.internet.domainWord() }.${ faker.internet.domainName() }`);
|
|
30
|
-
|
|
31
|
-
fc.assert(
|
|
32
|
-
fc.property(_url, (url) => {
|
|
33
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.None);
|
|
34
|
-
}),
|
|
35
|
-
);
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
it('test domainWord', () => {
|
|
39
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => faker.internet.domainWord());
|
|
40
|
-
|
|
41
|
-
fc.assert(
|
|
42
|
-
fc.property(_url, (url) => {
|
|
43
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.Website);
|
|
44
|
-
}),
|
|
45
|
-
);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
it('test domainWord with dot', () => {
|
|
49
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => `${ faker.internet.domainWord() }.`);
|
|
50
|
-
|
|
51
|
-
fc.assert(
|
|
52
|
-
fc.property(_url, (url) => {
|
|
53
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.Website);
|
|
54
|
-
}),
|
|
55
|
-
);
|
|
56
|
-
});
|
|
57
|
-
|
|
58
|
-
it('test email', () => {
|
|
59
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => faker.internet.email());
|
|
60
|
-
|
|
61
|
-
fc.assert(
|
|
62
|
-
fc.property(_url, (url) => {
|
|
63
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.Website);
|
|
64
|
-
}),
|
|
65
|
-
);
|
|
66
|
-
});
|
|
67
|
-
|
|
68
|
-
it('test ip', () => {
|
|
69
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => faker.internet.ip());
|
|
70
|
-
|
|
71
|
-
fc.assert(
|
|
72
|
-
fc.property(_url, (url) => {
|
|
73
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.Website);
|
|
74
|
-
}),
|
|
75
|
-
);
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it('test website with directory path', () => {
|
|
79
|
-
const _url: fc.Arbitrary<string> = toArbitrary(() => faker.image.imageUrl());
|
|
80
|
-
|
|
81
|
-
fc.assert(
|
|
82
|
-
fc.property(_url, (url) => {
|
|
83
|
-
expect(validation.Validators.website(url)).toEqual(ValidationErrors.None);
|
|
84
|
-
}),
|
|
85
|
-
);
|
|
86
|
-
});
|
|
87
|
-
|
|
88
|
-
it('long valid website with two dots', () => {
|
|
89
|
-
expect(validation.Validators.website('ivanivanivanivanivanivanivanivan.zajno.comcomcomcomcomcomcom')).toEqual(ValidationErrors.None);
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
it('valid website with directory path', () => {
|
|
93
|
-
expect(validation.Validators.website('http://www.regexbuddy.com/index.html?source=library')).toEqual(ValidationErrors.None);
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it('valid website with many dashes', () => {
|
|
97
|
-
expect(validation.Validators.website('https://www.test-test-test-test.com')).toEqual(ValidationErrors.None);
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
it('valid website with short domain', () => {
|
|
101
|
-
expect(validation.Validators.website('https://t.me')).toEqual(ValidationErrors.None);
|
|
102
|
-
});
|
|
103
|
-
|
|
104
|
-
it('test url with few dashes in a row', () => {
|
|
105
|
-
expect(validation.Validators.website('https://dashedurl-------.com')).toEqual(ValidationErrors.Website);
|
|
106
|
-
});
|
|
107
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
const regexp = /^\D*3[47]/;
|
|
2
|
-
|
|
3
|
-
const types: { [digit: number]: string } = {
|
|
4
|
-
0: 'credit-card-alt',
|
|
5
|
-
3: 'cc-amex',
|
|
6
|
-
4: 'cc-visa',
|
|
7
|
-
5: 'cc-mastercard',
|
|
8
|
-
6: 'cc-discover',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
function getDigitsCount(val: string): number {
|
|
12
|
-
return regexp.test(val) ? 15 : 16; // 15 digits if Amex
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
function getType(cardNumber: string) {
|
|
16
|
-
const val = cardNumber + '';
|
|
17
|
-
const firstDigit = +(val && val[0]) || 0;
|
|
18
|
-
return types[firstDigit] || types[0];
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
export default {
|
|
22
|
-
DEFAULT: types[0],
|
|
23
|
-
getDigitsCount,
|
|
24
|
-
getType,
|
|
25
|
-
};
|