@zajno/common 2.8.7 → 2.8.8
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/cjs/structures/promiseCache/cache.js +286 -0
- package/cjs/structures/promiseCache/cache.js.map +1 -0
- package/cjs/structures/promiseCache/core.js +301 -0
- package/cjs/structures/promiseCache/core.js.map +1 -0
- package/cjs/structures/promiseCache/index.js +7 -0
- package/cjs/structures/promiseCache/index.js.map +1 -0
- package/cjs/structures/promiseCache/types.js +15 -0
- package/cjs/structures/promiseCache/types.js.map +1 -0
- package/esm/structures/promiseCache/cache.js +282 -0
- package/esm/structures/promiseCache/cache.js.map +1 -0
- package/esm/structures/promiseCache/core.js +297 -0
- package/esm/structures/promiseCache/core.js.map +1 -0
- package/esm/structures/promiseCache/index.js +4 -0
- package/esm/structures/promiseCache/index.js.map +1 -0
- package/esm/structures/promiseCache/types.js +12 -0
- package/esm/structures/promiseCache/types.js.map +1 -0
- package/package.json +7 -1
- package/tsconfig.cjs.tsbuildinfo +1 -1
- package/tsconfig.esm.tsbuildinfo +1 -1
- package/tsconfig.types.tsbuildinfo +1 -1
- package/types/structures/promiseCache/cache.d.ts +95 -0
- package/types/structures/promiseCache/core.d.ts +157 -0
- package/types/structures/promiseCache/index.d.ts +3 -0
- package/types/structures/promiseCache/types.d.ts +55 -0
- package/cjs/structures/promiseCache.js +0 -399
- package/cjs/structures/promiseCache.js.map +0 -1
- package/esm/structures/promiseCache.js +0 -395
- package/esm/structures/promiseCache.js.map +0 -1
- package/types/structures/promiseCache.d.ts +0 -206
package/tsconfig.cjs.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/api/builder.ts","../src/api/call.config.ts","../src/api/call.ts","../src/api/call.types.ts","../src/api/config.ts","../src/api/endpoint.ts","../src/api/endpoint.types.ts","../src/api/error.ts","../src/api/hooks.ts","../src/api/index.ts","../src/api/interceptor.ts","../src/api/logging.ts","../src/api/methods.ts","../src/api/statuscodes.ts","../src/api/extensions/contenttype.ts","../src/api/extensions/endpointhooks.ts","../src/api/extensions/formdata.ts","../src/api/extensions/index.ts","../src/api/extensions/validation.ts","../src/async/arrays.ts","../src/async/index.ts","../src/async/manualpromise.ts","../src/async/misc.ts","../src/async/timeout.ts","../src/dates/calc.ts","../src/dates/calendarindex.ts","../src/dates/convert.ts","../src/dates/datex.ts","../src/dates/decompose.ts","../src/dates/format.ts","../src/dates/index.ts","../src/dates/parse.ts","../src/dates/period.ts","../src/dates/shift.ts","../src/dates/types.ts","../src/dates/tz.ts","../src/dates/yeardate.ts","../src/fields/filter.ts","../src/fields/index.ts","../src/fields/skip.ts","../src/fields/transfer.ts","../src/fields/update.ts","../src/functions/assert.ts","../src/functions/debounce.ts","../src/functions/disposer.symbols.ts","../src/functions/disposer.ts","../src/functions/index.ts","../src/functions/safe.ts","../src/lazy/extensions.ts","../src/lazy/index.ts","../src/lazy/lazy.ts","../src/lazy/light.ts","../src/lazy/promise.ts","../src/lazy/types.ts","../src/localization/localizationmanager.ts","../src/localization/localizedvalidationerrors.ts","../src/localization/abstractions.ts","../src/localization/index.ts","../src/localization/defaults/validationerrorslocalization.ts","../src/localization/defaults/defaultshape.ts","../src/logger/batch.ts","../src/logger/console.ts","../src/logger/empty.ts","../src/logger/index.ts","../src/logger/loggable.ts","../src/logger/manager.ts","../src/logger/named.ts","../src/logger/provider.ts","../src/logger/proxy.ts","../src/logger/types.ts","../src/logger/buffered/base.ts","../src/logger/buffered/buffered.logger.ts","../src/logger/buffered/buffered.memory.ts","../src/logger/buffered/index.ts","../src/logger/buffered/file/buffered.file.ts","../src/logger/buffered/file/index.ts","../src/math/arrays.ts","../src/math/calc.ts","../src/math/distribution.ts","../src/math/index.ts","../src/math/object/helpers.ts","../src/math/object/index.ts","../src/math/object/math.composite.ts","../src/math/object/math.ts","../src/math/object/ops.composite.ts","../src/math/object/ops.ts","../src/math/object/types.ts","../src/models/entitywithstatus.ts","../src/models/file.ts","../src/models/loading.ts","../src/models/logicmodel.ts","../src/models/model.ts","../src/models/valuescollector.ts","../src/models/types.ts","../src/models/wrappers.ts","../src/observing/debouncedevent.ts","../src/observing/event.late.ts","../src/observing/event.ts","../src/observing/progresstracker.ts","../src/observing/timeout.ts","../src/observing/timer.ts","../src/observing/transition.ts","../src/storage/index.ts","../src/storage/types.ts","../src/storage/wrappers.ts","../src/structures/expire.ts","../src/structures/extendobject.ts","../src/structures/linkedlist.ts","../src/structures/nameof.ts","../src/structures/pool.ts","../src/structures/
|
|
1
|
+
{"root":["../src/api/builder.ts","../src/api/call.config.ts","../src/api/call.ts","../src/api/call.types.ts","../src/api/config.ts","../src/api/endpoint.ts","../src/api/endpoint.types.ts","../src/api/error.ts","../src/api/hooks.ts","../src/api/index.ts","../src/api/interceptor.ts","../src/api/logging.ts","../src/api/methods.ts","../src/api/statuscodes.ts","../src/api/extensions/contenttype.ts","../src/api/extensions/endpointhooks.ts","../src/api/extensions/formdata.ts","../src/api/extensions/index.ts","../src/api/extensions/validation.ts","../src/async/arrays.ts","../src/async/index.ts","../src/async/manualpromise.ts","../src/async/misc.ts","../src/async/timeout.ts","../src/dates/calc.ts","../src/dates/calendarindex.ts","../src/dates/convert.ts","../src/dates/datex.ts","../src/dates/decompose.ts","../src/dates/format.ts","../src/dates/index.ts","../src/dates/parse.ts","../src/dates/period.ts","../src/dates/shift.ts","../src/dates/types.ts","../src/dates/tz.ts","../src/dates/yeardate.ts","../src/fields/filter.ts","../src/fields/index.ts","../src/fields/skip.ts","../src/fields/transfer.ts","../src/fields/update.ts","../src/functions/assert.ts","../src/functions/debounce.ts","../src/functions/disposer.symbols.ts","../src/functions/disposer.ts","../src/functions/index.ts","../src/functions/safe.ts","../src/lazy/extensions.ts","../src/lazy/index.ts","../src/lazy/lazy.ts","../src/lazy/light.ts","../src/lazy/promise.ts","../src/lazy/types.ts","../src/localization/localizationmanager.ts","../src/localization/localizedvalidationerrors.ts","../src/localization/abstractions.ts","../src/localization/index.ts","../src/localization/defaults/validationerrorslocalization.ts","../src/localization/defaults/defaultshape.ts","../src/logger/batch.ts","../src/logger/console.ts","../src/logger/empty.ts","../src/logger/index.ts","../src/logger/loggable.ts","../src/logger/manager.ts","../src/logger/named.ts","../src/logger/provider.ts","../src/logger/proxy.ts","../src/logger/types.ts","../src/logger/buffered/base.ts","../src/logger/buffered/buffered.logger.ts","../src/logger/buffered/buffered.memory.ts","../src/logger/buffered/index.ts","../src/logger/buffered/file/buffered.file.ts","../src/logger/buffered/file/index.ts","../src/math/arrays.ts","../src/math/calc.ts","../src/math/distribution.ts","../src/math/index.ts","../src/math/object/helpers.ts","../src/math/object/index.ts","../src/math/object/math.composite.ts","../src/math/object/math.ts","../src/math/object/ops.composite.ts","../src/math/object/ops.ts","../src/math/object/types.ts","../src/models/entitywithstatus.ts","../src/models/file.ts","../src/models/loading.ts","../src/models/logicmodel.ts","../src/models/model.ts","../src/models/valuescollector.ts","../src/models/types.ts","../src/models/wrappers.ts","../src/observing/debouncedevent.ts","../src/observing/event.late.ts","../src/observing/event.ts","../src/observing/progresstracker.ts","../src/observing/timeout.ts","../src/observing/timer.ts","../src/observing/transition.ts","../src/storage/index.ts","../src/storage/types.ts","../src/storage/wrappers.ts","../src/structures/expire.ts","../src/structures/extendobject.ts","../src/structures/linkedlist.ts","../src/structures/nameof.ts","../src/structures/pool.ts","../src/structures/promiseextended.ts","../src/structures/promiseproxy.ts","../src/structures/singleton.ts","../src/structures/subscribersmap.ts","../src/structures/tempocache.ts","../src/structures/helpers/enum.ts","../src/structures/helpers/name.ts","../src/structures/path/builder.helpers.ts","../src/structures/path/builder.ts","../src/structures/path/index.ts","../src/structures/path/types.helpers.ts","../src/structures/path/types.ts","../src/structures/path/utils/combineurls.ts","../src/structures/path/utils/index.ts","../src/structures/path/utils/indextrim.ts","../src/structures/path/utils/optionals.ts","../src/structures/promisecache/cache.ts","../src/structures/promisecache/core.ts","../src/structures/promisecache/index.ts","../src/structures/promisecache/types.ts","../src/structures/queue/parallel.ts","../src/structures/queue/tasks.ts","../src/types/arrays.ts","../src/types/comparator.ts","../src/types/deep.ts","../src/types/functions.ts","../src/types/getter.ts","../src/types/ident.ts","../src/types/index.ts","../src/types/isplainobject.ts","../src/types/misc.ts","../src/validation/validationerrors.ts","../src/validation/creditcard.ts","../src/validation/emails.ts","../src/validation/helpers.ts","../src/validation/index.ts","../src/validation/throwers.ts","../src/validation/types.ts","../src/validation/validationerror.ts","../src/validation/validators.ts","../src/validation/wrappers.ts"],"version":"5.7.3"}
|
package/tsconfig.esm.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/api/builder.ts","../src/api/call.config.ts","../src/api/call.ts","../src/api/call.types.ts","../src/api/config.ts","../src/api/endpoint.ts","../src/api/endpoint.types.ts","../src/api/error.ts","../src/api/hooks.ts","../src/api/index.ts","../src/api/interceptor.ts","../src/api/logging.ts","../src/api/methods.ts","../src/api/statuscodes.ts","../src/api/extensions/contenttype.ts","../src/api/extensions/endpointhooks.ts","../src/api/extensions/formdata.ts","../src/api/extensions/index.ts","../src/api/extensions/validation.ts","../src/async/arrays.ts","../src/async/index.ts","../src/async/manualpromise.ts","../src/async/misc.ts","../src/async/timeout.ts","../src/dates/calc.ts","../src/dates/calendarindex.ts","../src/dates/convert.ts","../src/dates/datex.ts","../src/dates/decompose.ts","../src/dates/format.ts","../src/dates/index.ts","../src/dates/parse.ts","../src/dates/period.ts","../src/dates/shift.ts","../src/dates/types.ts","../src/dates/tz.ts","../src/dates/yeardate.ts","../src/fields/filter.ts","../src/fields/index.ts","../src/fields/skip.ts","../src/fields/transfer.ts","../src/fields/update.ts","../src/functions/assert.ts","../src/functions/debounce.ts","../src/functions/disposer.symbols.ts","../src/functions/disposer.ts","../src/functions/index.ts","../src/functions/safe.ts","../src/lazy/extensions.ts","../src/lazy/index.ts","../src/lazy/lazy.ts","../src/lazy/light.ts","../src/lazy/promise.ts","../src/lazy/types.ts","../src/localization/localizationmanager.ts","../src/localization/localizedvalidationerrors.ts","../src/localization/abstractions.ts","../src/localization/index.ts","../src/localization/defaults/validationerrorslocalization.ts","../src/localization/defaults/defaultshape.ts","../src/logger/batch.ts","../src/logger/console.ts","../src/logger/empty.ts","../src/logger/index.ts","../src/logger/loggable.ts","../src/logger/manager.ts","../src/logger/named.ts","../src/logger/provider.ts","../src/logger/proxy.ts","../src/logger/types.ts","../src/logger/buffered/base.ts","../src/logger/buffered/buffered.logger.ts","../src/logger/buffered/buffered.memory.ts","../src/logger/buffered/index.ts","../src/logger/buffered/file/buffered.file.ts","../src/logger/buffered/file/index.ts","../src/math/arrays.ts","../src/math/calc.ts","../src/math/distribution.ts","../src/math/index.ts","../src/math/object/helpers.ts","../src/math/object/index.ts","../src/math/object/math.composite.ts","../src/math/object/math.ts","../src/math/object/ops.composite.ts","../src/math/object/ops.ts","../src/math/object/types.ts","../src/models/entitywithstatus.ts","../src/models/file.ts","../src/models/loading.ts","../src/models/logicmodel.ts","../src/models/model.ts","../src/models/valuescollector.ts","../src/models/types.ts","../src/models/wrappers.ts","../src/observing/debouncedevent.ts","../src/observing/event.late.ts","../src/observing/event.ts","../src/observing/progresstracker.ts","../src/observing/timeout.ts","../src/observing/timer.ts","../src/observing/transition.ts","../src/storage/index.ts","../src/storage/types.ts","../src/storage/wrappers.ts","../src/structures/expire.ts","../src/structures/extendobject.ts","../src/structures/linkedlist.ts","../src/structures/nameof.ts","../src/structures/pool.ts","../src/structures/
|
|
1
|
+
{"root":["../src/api/builder.ts","../src/api/call.config.ts","../src/api/call.ts","../src/api/call.types.ts","../src/api/config.ts","../src/api/endpoint.ts","../src/api/endpoint.types.ts","../src/api/error.ts","../src/api/hooks.ts","../src/api/index.ts","../src/api/interceptor.ts","../src/api/logging.ts","../src/api/methods.ts","../src/api/statuscodes.ts","../src/api/extensions/contenttype.ts","../src/api/extensions/endpointhooks.ts","../src/api/extensions/formdata.ts","../src/api/extensions/index.ts","../src/api/extensions/validation.ts","../src/async/arrays.ts","../src/async/index.ts","../src/async/manualpromise.ts","../src/async/misc.ts","../src/async/timeout.ts","../src/dates/calc.ts","../src/dates/calendarindex.ts","../src/dates/convert.ts","../src/dates/datex.ts","../src/dates/decompose.ts","../src/dates/format.ts","../src/dates/index.ts","../src/dates/parse.ts","../src/dates/period.ts","../src/dates/shift.ts","../src/dates/types.ts","../src/dates/tz.ts","../src/dates/yeardate.ts","../src/fields/filter.ts","../src/fields/index.ts","../src/fields/skip.ts","../src/fields/transfer.ts","../src/fields/update.ts","../src/functions/assert.ts","../src/functions/debounce.ts","../src/functions/disposer.symbols.ts","../src/functions/disposer.ts","../src/functions/index.ts","../src/functions/safe.ts","../src/lazy/extensions.ts","../src/lazy/index.ts","../src/lazy/lazy.ts","../src/lazy/light.ts","../src/lazy/promise.ts","../src/lazy/types.ts","../src/localization/localizationmanager.ts","../src/localization/localizedvalidationerrors.ts","../src/localization/abstractions.ts","../src/localization/index.ts","../src/localization/defaults/validationerrorslocalization.ts","../src/localization/defaults/defaultshape.ts","../src/logger/batch.ts","../src/logger/console.ts","../src/logger/empty.ts","../src/logger/index.ts","../src/logger/loggable.ts","../src/logger/manager.ts","../src/logger/named.ts","../src/logger/provider.ts","../src/logger/proxy.ts","../src/logger/types.ts","../src/logger/buffered/base.ts","../src/logger/buffered/buffered.logger.ts","../src/logger/buffered/buffered.memory.ts","../src/logger/buffered/index.ts","../src/logger/buffered/file/buffered.file.ts","../src/logger/buffered/file/index.ts","../src/math/arrays.ts","../src/math/calc.ts","../src/math/distribution.ts","../src/math/index.ts","../src/math/object/helpers.ts","../src/math/object/index.ts","../src/math/object/math.composite.ts","../src/math/object/math.ts","../src/math/object/ops.composite.ts","../src/math/object/ops.ts","../src/math/object/types.ts","../src/models/entitywithstatus.ts","../src/models/file.ts","../src/models/loading.ts","../src/models/logicmodel.ts","../src/models/model.ts","../src/models/valuescollector.ts","../src/models/types.ts","../src/models/wrappers.ts","../src/observing/debouncedevent.ts","../src/observing/event.late.ts","../src/observing/event.ts","../src/observing/progresstracker.ts","../src/observing/timeout.ts","../src/observing/timer.ts","../src/observing/transition.ts","../src/storage/index.ts","../src/storage/types.ts","../src/storage/wrappers.ts","../src/structures/expire.ts","../src/structures/extendobject.ts","../src/structures/linkedlist.ts","../src/structures/nameof.ts","../src/structures/pool.ts","../src/structures/promiseextended.ts","../src/structures/promiseproxy.ts","../src/structures/singleton.ts","../src/structures/subscribersmap.ts","../src/structures/tempocache.ts","../src/structures/helpers/enum.ts","../src/structures/helpers/name.ts","../src/structures/path/builder.helpers.ts","../src/structures/path/builder.ts","../src/structures/path/index.ts","../src/structures/path/types.helpers.ts","../src/structures/path/types.ts","../src/structures/path/utils/combineurls.ts","../src/structures/path/utils/index.ts","../src/structures/path/utils/indextrim.ts","../src/structures/path/utils/optionals.ts","../src/structures/promisecache/cache.ts","../src/structures/promisecache/core.ts","../src/structures/promisecache/index.ts","../src/structures/promisecache/types.ts","../src/structures/queue/parallel.ts","../src/structures/queue/tasks.ts","../src/types/arrays.ts","../src/types/comparator.ts","../src/types/deep.ts","../src/types/functions.ts","../src/types/getter.ts","../src/types/ident.ts","../src/types/index.ts","../src/types/isplainobject.ts","../src/types/misc.ts","../src/validation/validationerrors.ts","../src/validation/creditcard.ts","../src/validation/emails.ts","../src/validation/helpers.ts","../src/validation/index.ts","../src/validation/throwers.ts","../src/validation/types.ts","../src/validation/validationerror.ts","../src/validation/validators.ts","../src/validation/wrappers.ts"],"version":"5.7.3"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../src/api/builder.ts","../src/api/call.config.ts","../src/api/call.ts","../src/api/call.types.ts","../src/api/config.ts","../src/api/endpoint.ts","../src/api/endpoint.types.ts","../src/api/error.ts","../src/api/hooks.ts","../src/api/index.ts","../src/api/interceptor.ts","../src/api/logging.ts","../src/api/methods.ts","../src/api/statuscodes.ts","../src/api/extensions/contenttype.ts","../src/api/extensions/endpointhooks.ts","../src/api/extensions/formdata.ts","../src/api/extensions/index.ts","../src/api/extensions/validation.ts","../src/async/arrays.ts","../src/async/index.ts","../src/async/manualpromise.ts","../src/async/misc.ts","../src/async/timeout.ts","../src/dates/calc.ts","../src/dates/calendarindex.ts","../src/dates/convert.ts","../src/dates/datex.ts","../src/dates/decompose.ts","../src/dates/format.ts","../src/dates/index.ts","../src/dates/parse.ts","../src/dates/period.ts","../src/dates/shift.ts","../src/dates/types.ts","../src/dates/tz.ts","../src/dates/yeardate.ts","../src/fields/filter.ts","../src/fields/index.ts","../src/fields/skip.ts","../src/fields/transfer.ts","../src/fields/update.ts","../src/functions/assert.ts","../src/functions/debounce.ts","../src/functions/disposer.symbols.ts","../src/functions/disposer.ts","../src/functions/index.ts","../src/functions/safe.ts","../src/lazy/extensions.ts","../src/lazy/index.ts","../src/lazy/lazy.ts","../src/lazy/light.ts","../src/lazy/promise.ts","../src/lazy/types.ts","../src/localization/localizationmanager.ts","../src/localization/localizedvalidationerrors.ts","../src/localization/abstractions.ts","../src/localization/index.ts","../src/localization/defaults/validationerrorslocalization.ts","../src/localization/defaults/defaultshape.ts","../src/logger/batch.ts","../src/logger/console.ts","../src/logger/empty.ts","../src/logger/index.ts","../src/logger/loggable.ts","../src/logger/manager.ts","../src/logger/named.ts","../src/logger/provider.ts","../src/logger/proxy.ts","../src/logger/types.ts","../src/logger/buffered/base.ts","../src/logger/buffered/buffered.logger.ts","../src/logger/buffered/buffered.memory.ts","../src/logger/buffered/index.ts","../src/logger/buffered/file/buffered.file.ts","../src/logger/buffered/file/index.ts","../src/math/arrays.ts","../src/math/calc.ts","../src/math/distribution.ts","../src/math/index.ts","../src/math/object/helpers.ts","../src/math/object/index.ts","../src/math/object/math.composite.ts","../src/math/object/math.ts","../src/math/object/ops.composite.ts","../src/math/object/ops.ts","../src/math/object/types.ts","../src/models/entitywithstatus.ts","../src/models/file.ts","../src/models/loading.ts","../src/models/logicmodel.ts","../src/models/model.ts","../src/models/valuescollector.ts","../src/models/types.ts","../src/models/wrappers.ts","../src/observing/debouncedevent.ts","../src/observing/event.late.ts","../src/observing/event.ts","../src/observing/progresstracker.ts","../src/observing/timeout.ts","../src/observing/timer.ts","../src/observing/transition.ts","../src/storage/index.ts","../src/storage/types.ts","../src/storage/wrappers.ts","../src/structures/expire.ts","../src/structures/extendobject.ts","../src/structures/linkedlist.ts","../src/structures/nameof.ts","../src/structures/pool.ts","../src/structures/
|
|
1
|
+
{"root":["../src/api/builder.ts","../src/api/call.config.ts","../src/api/call.ts","../src/api/call.types.ts","../src/api/config.ts","../src/api/endpoint.ts","../src/api/endpoint.types.ts","../src/api/error.ts","../src/api/hooks.ts","../src/api/index.ts","../src/api/interceptor.ts","../src/api/logging.ts","../src/api/methods.ts","../src/api/statuscodes.ts","../src/api/extensions/contenttype.ts","../src/api/extensions/endpointhooks.ts","../src/api/extensions/formdata.ts","../src/api/extensions/index.ts","../src/api/extensions/validation.ts","../src/async/arrays.ts","../src/async/index.ts","../src/async/manualpromise.ts","../src/async/misc.ts","../src/async/timeout.ts","../src/dates/calc.ts","../src/dates/calendarindex.ts","../src/dates/convert.ts","../src/dates/datex.ts","../src/dates/decompose.ts","../src/dates/format.ts","../src/dates/index.ts","../src/dates/parse.ts","../src/dates/period.ts","../src/dates/shift.ts","../src/dates/types.ts","../src/dates/tz.ts","../src/dates/yeardate.ts","../src/fields/filter.ts","../src/fields/index.ts","../src/fields/skip.ts","../src/fields/transfer.ts","../src/fields/update.ts","../src/functions/assert.ts","../src/functions/debounce.ts","../src/functions/disposer.symbols.ts","../src/functions/disposer.ts","../src/functions/index.ts","../src/functions/safe.ts","../src/lazy/extensions.ts","../src/lazy/index.ts","../src/lazy/lazy.ts","../src/lazy/light.ts","../src/lazy/promise.ts","../src/lazy/types.ts","../src/localization/localizationmanager.ts","../src/localization/localizedvalidationerrors.ts","../src/localization/abstractions.ts","../src/localization/index.ts","../src/localization/defaults/validationerrorslocalization.ts","../src/localization/defaults/defaultshape.ts","../src/logger/batch.ts","../src/logger/console.ts","../src/logger/empty.ts","../src/logger/index.ts","../src/logger/loggable.ts","../src/logger/manager.ts","../src/logger/named.ts","../src/logger/provider.ts","../src/logger/proxy.ts","../src/logger/types.ts","../src/logger/buffered/base.ts","../src/logger/buffered/buffered.logger.ts","../src/logger/buffered/buffered.memory.ts","../src/logger/buffered/index.ts","../src/logger/buffered/file/buffered.file.ts","../src/logger/buffered/file/index.ts","../src/math/arrays.ts","../src/math/calc.ts","../src/math/distribution.ts","../src/math/index.ts","../src/math/object/helpers.ts","../src/math/object/index.ts","../src/math/object/math.composite.ts","../src/math/object/math.ts","../src/math/object/ops.composite.ts","../src/math/object/ops.ts","../src/math/object/types.ts","../src/models/entitywithstatus.ts","../src/models/file.ts","../src/models/loading.ts","../src/models/logicmodel.ts","../src/models/model.ts","../src/models/valuescollector.ts","../src/models/types.ts","../src/models/wrappers.ts","../src/observing/debouncedevent.ts","../src/observing/event.late.ts","../src/observing/event.ts","../src/observing/progresstracker.ts","../src/observing/timeout.ts","../src/observing/timer.ts","../src/observing/transition.ts","../src/storage/index.ts","../src/storage/types.ts","../src/storage/wrappers.ts","../src/structures/expire.ts","../src/structures/extendobject.ts","../src/structures/linkedlist.ts","../src/structures/nameof.ts","../src/structures/pool.ts","../src/structures/promiseextended.ts","../src/structures/promiseproxy.ts","../src/structures/singleton.ts","../src/structures/subscribersmap.ts","../src/structures/tempocache.ts","../src/structures/helpers/enum.ts","../src/structures/helpers/name.ts","../src/structures/path/builder.helpers.ts","../src/structures/path/builder.ts","../src/structures/path/index.ts","../src/structures/path/types.helpers.ts","../src/structures/path/types.ts","../src/structures/path/utils/combineurls.ts","../src/structures/path/utils/index.ts","../src/structures/path/utils/indextrim.ts","../src/structures/path/utils/optionals.ts","../src/structures/promisecache/cache.ts","../src/structures/promisecache/core.ts","../src/structures/promisecache/index.ts","../src/structures/promisecache/types.ts","../src/structures/queue/parallel.ts","../src/structures/queue/tasks.ts","../src/types/arrays.ts","../src/types/comparator.ts","../src/types/deep.ts","../src/types/functions.ts","../src/types/getter.ts","../src/types/ident.ts","../src/types/index.ts","../src/types/isplainobject.ts","../src/types/misc.ts","../src/validation/validationerrors.ts","../src/validation/creditcard.ts","../src/validation/emails.ts","../src/validation/helpers.ts","../src/validation/index.ts","../src/validation/throwers.ts","../src/validation/types.ts","../src/validation/validationerror.ts","../src/validation/validators.ts","../src/validation/wrappers.ts"],"version":"5.7.3"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { PromiseCacheCore } from './core.js';
|
|
2
|
+
import type { ErrorCallback, InvalidationConfig } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* Caches items by a key (string or another type) which are resolved by an async fetcher (`Promise`).
|
|
5
|
+
*
|
|
6
|
+
* Supports:
|
|
7
|
+
* - custom key adapter and parser for non-string keys.
|
|
8
|
+
* - direct manual cache manipulation.
|
|
9
|
+
* - batching of fetches.
|
|
10
|
+
* - auto-invalidation of cached items (time-based, callback-based, max items).
|
|
11
|
+
* - error tracking per key.
|
|
12
|
+
*/
|
|
13
|
+
export declare class PromiseCache<T, K = string> extends PromiseCacheCore<T, K> {
|
|
14
|
+
private readonly fetcher;
|
|
15
|
+
private _batch;
|
|
16
|
+
private _invalidationConfig;
|
|
17
|
+
private _onError;
|
|
18
|
+
/**
|
|
19
|
+
* Creates an instance of PromiseCache.
|
|
20
|
+
* @param fetcher Function to fetch data by key.
|
|
21
|
+
* @param keyAdapter Optional function to adapt non-string keys to strings.
|
|
22
|
+
* @param keyParser Optional function to parse string keys back to their original type.
|
|
23
|
+
*/
|
|
24
|
+
constructor(fetcher: (id: K) => Promise<T>, keyAdapter?: K extends string ? null : (k: K) => string, keyParser?: K extends string ? null : (id: string) => K);
|
|
25
|
+
/**
|
|
26
|
+
* Provide a fetcher function that takes multiple ids and returns multiple results at once. Will be called with a slight delay to allow multiple ids to be collected.
|
|
27
|
+
*
|
|
28
|
+
* Warning: resolved array should have the same order as the input array.
|
|
29
|
+
*
|
|
30
|
+
* When provided, effectively replaces the main fetcher; but in case of fail, fallbacks to the main fetcher.
|
|
31
|
+
*/
|
|
32
|
+
useBatching(fetcher: (ids: K[]) => Promise<T[]>, delay?: number): this;
|
|
33
|
+
/**
|
|
34
|
+
* Enables auto-invalidation of cached items by time.
|
|
35
|
+
*
|
|
36
|
+
* This is a convenience wrapper around {@link useInvalidation}.
|
|
37
|
+
*
|
|
38
|
+
* @param ms Time in milliseconds after which the item will be considered invalid. If null, auto-invalidation is disabled.
|
|
39
|
+
* @param keepInstance If true, the cached item will not be removed during invalidation, but the old instance is kept. Defaults to false.
|
|
40
|
+
*/
|
|
41
|
+
useInvalidationTime(ms: number | null, keepInstance?: boolean): this;
|
|
42
|
+
/**
|
|
43
|
+
* Configures advanced invalidation policy.
|
|
44
|
+
*
|
|
45
|
+
* The config object is stored as-is (not destructured), so getter-based fields will be re-evaluated on each access.
|
|
46
|
+
* This allows consumers to provide dynamic invalidation policies.
|
|
47
|
+
*
|
|
48
|
+
* @param config The invalidation configuration. See {@link InvalidationConfig} for details.
|
|
49
|
+
*/
|
|
50
|
+
useInvalidation(config: InvalidationConfig<T> | null): this;
|
|
51
|
+
/**
|
|
52
|
+
* Sets an error callback that is called when a fetcher fails.
|
|
53
|
+
*
|
|
54
|
+
* @param callback The callback to call on error. Receives the original key and the raw error.
|
|
55
|
+
*/
|
|
56
|
+
useOnError(callback: ErrorCallback<K> | null): this;
|
|
57
|
+
/**
|
|
58
|
+
* Returns a promise that resolves to the cached value of the item if loaded already, otherwise starts fetching and the promise will be resolved to the final value.
|
|
59
|
+
*
|
|
60
|
+
* Consequent calls will return the same promise until it resolves.
|
|
61
|
+
*
|
|
62
|
+
* @param id The id of the item.
|
|
63
|
+
* @returns A promise that resolves to the result, whether it's cached or freshly fetched.
|
|
64
|
+
*/
|
|
65
|
+
get(id: K): Promise<T | null>;
|
|
66
|
+
/** Clears the cache and resets the loading state. */
|
|
67
|
+
clear(): void;
|
|
68
|
+
protected _getCurrent(id: K): {
|
|
69
|
+
item: T | null | undefined;
|
|
70
|
+
key: string;
|
|
71
|
+
isInvalid: boolean;
|
|
72
|
+
};
|
|
73
|
+
protected getIsInvalidated(key: string): boolean;
|
|
74
|
+
/** @override Stores the result for the specified key, enforcing max items. */
|
|
75
|
+
protected storeResult(key: string, res: T | null): void;
|
|
76
|
+
/**
|
|
77
|
+
* Fetches the item asynchronously.
|
|
78
|
+
* @param id The id of the item.
|
|
79
|
+
* @param key The cache key.
|
|
80
|
+
* @returns A promise that resolves to the fetched item.
|
|
81
|
+
*/
|
|
82
|
+
protected _doFetchAsync(id: K, key: string): Promise<T | null>;
|
|
83
|
+
/** Performs a fetch operation in batch mode if available, otherwise uses the regular fetch. Throws on error. */
|
|
84
|
+
protected tryFetchInBatch(id: K): Promise<T | null>;
|
|
85
|
+
/** Handles a fetch error: stores it, logs it, and calls the onError callback. */
|
|
86
|
+
private _handleError;
|
|
87
|
+
/**
|
|
88
|
+
* Enforces the max items limit by removing items to make room.
|
|
89
|
+
* Strategy: first removes invalid items, then oldest valid items.
|
|
90
|
+
* Items currently being fetched (in-flight) are not evicted.
|
|
91
|
+
*
|
|
92
|
+
* @param incomingKey The key of the item about to be stored (excluded from eviction).
|
|
93
|
+
*/
|
|
94
|
+
private _enforceMaxItems;
|
|
95
|
+
}
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import { Loggable } from '../../logger/loggable.js';
|
|
2
|
+
import type { IMapModel, IValueModel } from '../../models/types.js';
|
|
3
|
+
import type { DeferredGetter } from './types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Core base class for PromiseCache. Provides basic cache operations, hooks, and `pure_create*` methods.
|
|
6
|
+
*
|
|
7
|
+
* This class handles:
|
|
8
|
+
* - item storage and retrieval
|
|
9
|
+
* - loading state tracking
|
|
10
|
+
* - promise caching
|
|
11
|
+
* - error storage
|
|
12
|
+
* - timestamps for cached items
|
|
13
|
+
* - direct cache manipulation (invalidate, updateValueDirectly, clear)
|
|
14
|
+
* - keys iteration
|
|
15
|
+
*
|
|
16
|
+
* Subclasses are expected to implement fetching logic, invalidation policies, etc.
|
|
17
|
+
*/
|
|
18
|
+
export declare abstract class PromiseCacheCore<T, K = string> extends Loggable {
|
|
19
|
+
protected readonly keyAdapter?: ((k: K) => string) | null | undefined;
|
|
20
|
+
protected readonly keyParser?: ((id: string) => K) | null | undefined;
|
|
21
|
+
/** Stores resolved items in map by id. */
|
|
22
|
+
protected readonly _itemsCache: IMapModel<string, T | null | undefined>;
|
|
23
|
+
/** Stores items loading state (loading or not) in map by id. */
|
|
24
|
+
protected readonly _itemsStatus: IMapModel<string, boolean>;
|
|
25
|
+
/** Stores items loading count. */
|
|
26
|
+
protected readonly _loadingCount: IValueModel<number>;
|
|
27
|
+
/** Stores items Promises state (if still loading) in map by id. */
|
|
28
|
+
protected readonly _fetchCache: IMapModel<string, Promise<T | null>>;
|
|
29
|
+
/** Stores last errors by key. Observable-friendly via IMapModel. */
|
|
30
|
+
protected readonly _errorsMap: IMapModel<string, unknown>;
|
|
31
|
+
/** Stores items resolve timestamps (for expiration) in map by id. */
|
|
32
|
+
protected readonly _timestamps: Map<string, number>;
|
|
33
|
+
protected _version: number;
|
|
34
|
+
constructor(keyAdapter?: ((k: K) => string) | null | undefined, keyParser?: ((id: string) => K) | null | undefined);
|
|
35
|
+
/** Returns the number of items currently being fetched. */
|
|
36
|
+
get loadingCount(): number;
|
|
37
|
+
/** Returns the number of cached items (resolved values). */
|
|
38
|
+
get cachedCount(): number;
|
|
39
|
+
/** Returns the number of in-flight promises (items currently being fetched). */
|
|
40
|
+
get promisesCount(): number;
|
|
41
|
+
/** Returns the number of cached items that are currently invalid (expired). */
|
|
42
|
+
get invalidCount(): number;
|
|
43
|
+
/**
|
|
44
|
+
* @pure @const
|
|
45
|
+
* Creates a model for tracking the loading state. Override to inject own instance, e.g. for observability.
|
|
46
|
+
*
|
|
47
|
+
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
48
|
+
*/
|
|
49
|
+
protected pure_createLoadingCount(): IValueModel<number>;
|
|
50
|
+
/**
|
|
51
|
+
* @pure @const
|
|
52
|
+
* Creates a map for caching resolved items by id. Override to inject own instance, e.g. for observability.
|
|
53
|
+
*
|
|
54
|
+
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
55
|
+
*/
|
|
56
|
+
protected pure_createItemsCache(): IMapModel<string, T | null | undefined>;
|
|
57
|
+
/**
|
|
58
|
+
* @pure @const
|
|
59
|
+
* Creates a map for tracking the loading state of items by id. Override to inject own instance, e.g. for observability.
|
|
60
|
+
*
|
|
61
|
+
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
62
|
+
*/
|
|
63
|
+
protected pure_createItemsStatus(): IMapModel<string, boolean>;
|
|
64
|
+
/**
|
|
65
|
+
* @pure @const
|
|
66
|
+
* Creates a map for caching promises of items by id. Override to inject own instance, e.g. for observability.
|
|
67
|
+
*
|
|
68
|
+
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
69
|
+
*/
|
|
70
|
+
protected pure_createFetchCache(): IMapModel<string, Promise<T | null>>;
|
|
71
|
+
/**
|
|
72
|
+
* @pure @const
|
|
73
|
+
* Creates a map for storing last errors by key. Override to inject own instance, e.g. for observability.
|
|
74
|
+
*
|
|
75
|
+
* Warning: as name indicates, this should be "pure"/"const" function, i.e. should not reference `this`/`super`.
|
|
76
|
+
*/
|
|
77
|
+
protected pure_createErrorsMap(): IMapModel<string, unknown>;
|
|
78
|
+
protected _pk(k: K): string;
|
|
79
|
+
protected getLoggerName(name: string | undefined): string;
|
|
80
|
+
/**
|
|
81
|
+
* Returns a {@link DeferredGetter} object for a specified key.
|
|
82
|
+
*
|
|
83
|
+
* This can be used to access the current value, promise, loading state, and last error of the item.
|
|
84
|
+
*/
|
|
85
|
+
getDeferred(key: K): DeferredGetter<T>;
|
|
86
|
+
/**
|
|
87
|
+
* Returns the loading state of an item.
|
|
88
|
+
*
|
|
89
|
+
* @returns true if loading, false if loading completed, undefined if loading was not started yet.
|
|
90
|
+
*/
|
|
91
|
+
getIsLoading(id: K): boolean | undefined;
|
|
92
|
+
/**
|
|
93
|
+
* Returns whether the cached item for the specified key is valid (not expired and not invalidated by callback).
|
|
94
|
+
*
|
|
95
|
+
* @returns `true` if the item is cached and valid, `false` if the item is invalidated or not cached.
|
|
96
|
+
*/
|
|
97
|
+
getIsValid(id: K): boolean;
|
|
98
|
+
/**
|
|
99
|
+
* Returns the last error that occurred during fetching for the specified key.
|
|
100
|
+
*
|
|
101
|
+
* @returns The raw error, or null if no error.
|
|
102
|
+
*/
|
|
103
|
+
getLastError(id: K): unknown;
|
|
104
|
+
/** Returns the current cached value, optionally triggering a fetch. */
|
|
105
|
+
getCurrent(id: K, initiateFetch?: boolean): T | null | undefined;
|
|
106
|
+
/** Returns a promise that resolves to the cached or freshly fetched value. */
|
|
107
|
+
abstract get(id: K): Promise<T | null>;
|
|
108
|
+
/** Returns true if the item is cached or fetching was initiated. Does not initiate fetching. */
|
|
109
|
+
hasKey(id: K): boolean;
|
|
110
|
+
/** Returns an iterator over the keys of the cached items. */
|
|
111
|
+
keys(iterate: true): MapIterator<string>;
|
|
112
|
+
/** Returns an array of the keys of the cached items. */
|
|
113
|
+
keys(): string[];
|
|
114
|
+
/** Returns an iterator over the parsed keys of the cached items. */
|
|
115
|
+
keysParsed(iterate: true): Generator<K> | null;
|
|
116
|
+
/** Returns an array of the parsed keys of the cached items. */
|
|
117
|
+
keysParsed(): K[] | null;
|
|
118
|
+
/** Instantly invalidates the cached item for the specified id, like it was never fetched/accessed. */
|
|
119
|
+
invalidate(id: K): void;
|
|
120
|
+
/** Updates the cached value for the specified id directly, like it was fetched already. */
|
|
121
|
+
updateValueDirectly(id: K, value: T | null): void;
|
|
122
|
+
/**
|
|
123
|
+
* Iterates over all cached items and removes those that are invalid (expired).
|
|
124
|
+
*
|
|
125
|
+
* @returns The number of items that were removed.
|
|
126
|
+
*/
|
|
127
|
+
sanitize(): number;
|
|
128
|
+
/** Clears the cache and resets the loading state. */
|
|
129
|
+
clear(): void;
|
|
130
|
+
/** Returns the current cached value for the specified key, without triggering a fetch. */
|
|
131
|
+
protected abstract _getCurrent(id: K): {
|
|
132
|
+
item: T | null | undefined;
|
|
133
|
+
key: string;
|
|
134
|
+
isInvalid: boolean;
|
|
135
|
+
};
|
|
136
|
+
/**
|
|
137
|
+
* Checks if the cached item for the specified key is invalidated (expired).
|
|
138
|
+
* Override to implement custom invalidation logic.
|
|
139
|
+
*/
|
|
140
|
+
protected abstract getIsInvalidated(key: string): boolean;
|
|
141
|
+
/** @internal updates all caches states at once. */
|
|
142
|
+
protected _set(key: string, item: T | null | undefined, promise: Promise<T> | undefined, isLoading: boolean | undefined): void;
|
|
143
|
+
/** Updates the loading status for the specified key. Override to add a hook. */
|
|
144
|
+
protected setStatus(key: string, status: boolean): void;
|
|
145
|
+
/** Updates the promise for the specified key. Override to add a hook. */
|
|
146
|
+
protected setPromise(key: string, promise: Promise<T | null>): void;
|
|
147
|
+
/** Stores the result for the specified key. Override to add a hook. */
|
|
148
|
+
protected storeResult(key: string, res: T | null): void;
|
|
149
|
+
/** Hooks into the fetch process before it starts. */
|
|
150
|
+
protected onBeforeFetch(_key: string): void;
|
|
151
|
+
/** Hooks into the fetch process after it completes. */
|
|
152
|
+
protected onFetchComplete(key: string): void;
|
|
153
|
+
/** Hooks into the result preparation process, before it's stored into the cache. */
|
|
154
|
+
protected prepareResult(res: T | null): T | null;
|
|
155
|
+
/** @internal Helper to set or delete a value in a map. */
|
|
156
|
+
protected static _setMapX<T>(key: string, map: IMapModel<string, T>, val: T): void;
|
|
157
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/** Represents a state of a cached item. Holds a references to an actual state. */
|
|
2
|
+
export type DeferredGetter<T> = {
|
|
3
|
+
/** Get current resolved value, if any, or initiates fetching. */
|
|
4
|
+
readonly current: T | null | undefined;
|
|
5
|
+
/** Returns a promise that resolves to the current or fetching value. */
|
|
6
|
+
readonly promise: Promise<T | null>;
|
|
7
|
+
/** Returns true if the item is currently being fetched. Returns undefined if fetching has not started yet. */
|
|
8
|
+
readonly isLoading: boolean | undefined;
|
|
9
|
+
/** Returns the last error that occurred during fetching, or null if no error occurred. */
|
|
10
|
+
readonly error: unknown;
|
|
11
|
+
};
|
|
12
|
+
export declare namespace DeferredGetter {
|
|
13
|
+
/** Empty resolved value. */
|
|
14
|
+
const Empty: {
|
|
15
|
+
readonly current: null;
|
|
16
|
+
readonly promise: Promise<null>;
|
|
17
|
+
readonly isLoading: boolean;
|
|
18
|
+
readonly error: null;
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Callback for deciding if a cached item is invalid by key, value, and cached timestamp.
|
|
23
|
+
*
|
|
24
|
+
* @param key The cache key (string).
|
|
25
|
+
* @param value The cached value.
|
|
26
|
+
* @param cachedAt The timestamp (ms) when the item was cached.
|
|
27
|
+
* @returns `true` if the item should be considered invalid.
|
|
28
|
+
*/
|
|
29
|
+
export type InvalidationCallback<T> = (key: string, value: T | null | undefined, cachedAt: number) => boolean;
|
|
30
|
+
/** Callback for handling errors during fetching. */
|
|
31
|
+
export type ErrorCallback<K> = (key: K, error: unknown) => void;
|
|
32
|
+
/**
|
|
33
|
+
* Configuration for cache invalidation policy.
|
|
34
|
+
*
|
|
35
|
+
* All fields are optional and readonly so consumers can provide dynamic data via getters.
|
|
36
|
+
* The object is stored as-is (not destructured), so getter-based fields will be re-evaluated on each access.
|
|
37
|
+
*/
|
|
38
|
+
export interface InvalidationConfig<T> {
|
|
39
|
+
/** Default expiration time in milliseconds for cached items. If null/undefined, time-based expiration is disabled. */
|
|
40
|
+
readonly expirationMs?: number | null;
|
|
41
|
+
/**
|
|
42
|
+
* Optional callback that decides if an item is invalid by key, cached value, and cached timestamp.
|
|
43
|
+
* Called in addition to time-based expiration.
|
|
44
|
+
*/
|
|
45
|
+
readonly invalidationCheck?: InvalidationCallback<T> | null;
|
|
46
|
+
/**
|
|
47
|
+
* Maximum number of items to hold in cache. When exceeded, invalid items are cleaned up first,
|
|
48
|
+
* then oldest valid items are removed to make room.
|
|
49
|
+
*
|
|
50
|
+
* Note: items currently being fetched (in-flight) are not evicted.
|
|
51
|
+
*/
|
|
52
|
+
readonly maxItems?: number | null;
|
|
53
|
+
/** If true, the cached item will not be removed during invalidation, but the old instance is kept. */
|
|
54
|
+
readonly keepInstance?: boolean;
|
|
55
|
+
}
|