@venizia/ignis-helpers 0.0.1-3 → 0.0.1-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/dist/common/constants/app.d.ts +21 -0
- package/dist/common/constants/app.d.ts.map +1 -0
- package/dist/common/constants/app.js +36 -0
- package/dist/common/constants/app.js.map +1 -0
- package/dist/common/constants/http.d.ts +56 -0
- package/dist/common/constants/http.d.ts.map +1 -0
- package/dist/common/constants/http.js +60 -0
- package/dist/common/constants/http.js.map +1 -0
- package/dist/common/constants/index.d.ts +4 -0
- package/dist/common/constants/index.d.ts.map +1 -0
- package/dist/common/constants/index.js +20 -0
- package/dist/common/constants/index.js.map +1 -0
- package/dist/common/constants/mime.d.ts +9 -0
- package/dist/common/constants/mime.d.ts.map +1 -0
- package/dist/common/constants/mime.js +11 -0
- package/dist/common/constants/mime.js.map +1 -0
- package/dist/common/index.d.ts +3 -0
- package/dist/common/index.d.ts.map +1 -0
- package/dist/common/index.js +19 -0
- package/dist/common/index.js.map +1 -0
- package/dist/common/types.d.ts +81 -0
- package/dist/common/types.d.ts.map +1 -0
- package/dist/common/types.js +12 -0
- package/dist/common/types.js.map +1 -0
- package/dist/helpers/base.d.ts +13 -0
- package/dist/helpers/base.d.ts.map +1 -0
- package/dist/helpers/base.js +19 -0
- package/dist/helpers/base.js.map +1 -0
- package/dist/helpers/cron/cron.helper.d.ts +31 -0
- package/dist/helpers/cron/cron.helper.d.ts.map +1 -0
- package/dist/helpers/cron/cron.helper.js +70 -0
- package/dist/helpers/cron/cron.helper.js.map +1 -0
- package/dist/helpers/cron/index.d.ts +2 -0
- package/dist/helpers/cron/index.d.ts.map +1 -0
- package/dist/helpers/cron/index.js +18 -0
- package/dist/helpers/cron/index.js.map +1 -0
- package/dist/helpers/crypto/algorithms/aes.algorithm.d.ts +21 -0
- package/dist/helpers/crypto/algorithms/aes.algorithm.d.ts.map +1 -0
- package/dist/helpers/crypto/algorithms/aes.algorithm.js +103 -0
- package/dist/helpers/crypto/algorithms/aes.algorithm.js.map +1 -0
- package/dist/helpers/crypto/algorithms/base.algorithm.d.ts +23 -0
- package/dist/helpers/crypto/algorithms/base.algorithm.d.ts.map +1 -0
- package/dist/helpers/crypto/algorithms/base.algorithm.js +41 -0
- package/dist/helpers/crypto/algorithms/base.algorithm.js.map +1 -0
- package/dist/helpers/crypto/algorithms/index.d.ts +4 -0
- package/dist/helpers/crypto/algorithms/index.d.ts.map +1 -0
- package/dist/helpers/crypto/algorithms/index.js +20 -0
- package/dist/helpers/crypto/algorithms/index.js.map +1 -0
- package/dist/helpers/crypto/algorithms/rsa.algorithm.d.ts +27 -0
- package/dist/helpers/crypto/algorithms/rsa.algorithm.d.ts.map +1 -0
- package/dist/helpers/crypto/algorithms/rsa.algorithm.js +63 -0
- package/dist/helpers/crypto/algorithms/rsa.algorithm.js.map +1 -0
- package/dist/helpers/crypto/common/constants.d.ts +3 -0
- package/dist/helpers/crypto/common/constants.d.ts.map +1 -0
- package/dist/helpers/crypto/common/constants.js +6 -0
- package/dist/helpers/crypto/common/constants.js.map +1 -0
- package/dist/helpers/crypto/common/index.d.ts +3 -0
- package/dist/helpers/crypto/common/index.d.ts.map +1 -0
- package/dist/helpers/crypto/common/index.js +19 -0
- package/dist/helpers/crypto/common/index.js.map +1 -0
- package/dist/helpers/crypto/common/types.d.ts +6 -0
- package/dist/helpers/crypto/common/types.d.ts.map +1 -0
- package/dist/helpers/crypto/common/types.js +3 -0
- package/dist/helpers/crypto/common/types.js.map +1 -0
- package/dist/helpers/crypto/index.d.ts +3 -0
- package/dist/helpers/crypto/index.d.ts.map +1 -0
- package/dist/helpers/crypto/index.js +19 -0
- package/dist/helpers/crypto/index.js.map +1 -0
- package/dist/helpers/env/app-env.d.ts +29 -0
- package/dist/helpers/env/app-env.d.ts.map +1 -0
- package/dist/helpers/env/app-env.js +58 -0
- package/dist/helpers/env/app-env.js.map +1 -0
- package/dist/helpers/env/index.d.ts +3 -0
- package/dist/helpers/env/index.d.ts.map +1 -0
- package/dist/helpers/env/index.js +19 -0
- package/dist/helpers/env/index.js.map +1 -0
- package/dist/helpers/env/types.d.ts +5 -0
- package/dist/helpers/env/types.d.ts.map +1 -0
- package/dist/helpers/env/types.js +3 -0
- package/dist/helpers/env/types.js.map +1 -0
- package/dist/helpers/error/app-error.d.ts +9 -0
- package/dist/helpers/error/app-error.d.ts.map +1 -0
- package/dist/helpers/error/app-error.js +20 -0
- package/dist/helpers/error/app-error.js.map +1 -0
- package/dist/helpers/error/index.d.ts +3 -0
- package/dist/helpers/error/index.d.ts.map +1 -0
- package/dist/helpers/error/index.js +19 -0
- package/dist/helpers/error/index.js.map +1 -0
- package/dist/helpers/error/types.d.ts +9 -0
- package/dist/helpers/error/types.d.ts.map +1 -0
- package/dist/helpers/error/types.js +22 -0
- package/dist/helpers/error/types.js.map +1 -0
- package/dist/helpers/index.d.ts +15 -0
- package/dist/helpers/index.d.ts.map +1 -0
- package/dist/helpers/index.js +31 -0
- package/dist/helpers/index.js.map +1 -0
- package/dist/helpers/inversion/common/index.d.ts +3 -0
- package/dist/helpers/inversion/common/index.d.ts.map +1 -0
- package/dist/helpers/inversion/common/index.js +19 -0
- package/dist/helpers/inversion/common/index.js.map +1 -0
- package/dist/helpers/inversion/common/keys.d.ts +12 -0
- package/dist/helpers/inversion/common/keys.d.ts.map +1 -0
- package/dist/helpers/inversion/common/keys.js +16 -0
- package/dist/helpers/inversion/common/keys.js.map +1 -0
- package/dist/helpers/inversion/common/types.d.ts +28 -0
- package/dist/helpers/inversion/common/types.d.ts.map +1 -0
- package/dist/helpers/inversion/common/types.js +12 -0
- package/dist/helpers/inversion/common/types.js.map +1 -0
- package/dist/helpers/inversion/container.d.ts +10 -0
- package/dist/helpers/inversion/container.d.ts.map +1 -0
- package/dist/helpers/inversion/container.js +18 -0
- package/dist/helpers/inversion/container.js.map +1 -0
- package/dist/helpers/inversion/index.d.ts +5 -0
- package/dist/helpers/inversion/index.d.ts.map +1 -0
- package/dist/helpers/inversion/index.js +26 -0
- package/dist/helpers/inversion/index.js.map +1 -0
- package/dist/helpers/inversion/registry.d.ts +73 -0
- package/dist/helpers/inversion/registry.d.ts.map +1 -0
- package/dist/helpers/inversion/registry.js +107 -0
- package/dist/helpers/inversion/registry.js.map +1 -0
- package/dist/helpers/logger/application-logger.d.ts +22 -0
- package/dist/helpers/logger/application-logger.d.ts.map +1 -0
- package/dist/helpers/logger/application-logger.js +87 -0
- package/dist/helpers/logger/application-logger.js.map +1 -0
- package/dist/helpers/logger/default-logger.d.ts +34 -0
- package/dist/helpers/logger/default-logger.d.ts.map +1 -0
- package/dist/helpers/logger/default-logger.js +118 -0
- package/dist/helpers/logger/default-logger.js.map +1 -0
- package/dist/helpers/logger/factory.d.ts +5 -0
- package/dist/helpers/logger/factory.d.ts.map +1 -0
- package/dist/helpers/logger/factory.js +13 -0
- package/dist/helpers/logger/factory.js.map +1 -0
- package/dist/helpers/logger/index.d.ts +6 -0
- package/dist/helpers/logger/index.d.ts.map +1 -0
- package/dist/helpers/logger/index.js +22 -0
- package/dist/helpers/logger/index.js.map +1 -0
- package/dist/helpers/logger/transports/dgram.transport.d.ts +29 -0
- package/dist/helpers/logger/transports/dgram.transport.d.ts.map +1 -0
- package/dist/helpers/logger/transports/dgram.transport.js +69 -0
- package/dist/helpers/logger/transports/dgram.transport.js.map +1 -0
- package/dist/helpers/logger/transports/index.d.ts +2 -0
- package/dist/helpers/logger/transports/index.d.ts.map +1 -0
- package/dist/helpers/logger/transports/index.js +18 -0
- package/dist/helpers/logger/transports/index.js.map +1 -0
- package/dist/helpers/logger/types.d.ts +16 -0
- package/dist/helpers/logger/types.d.ts.map +1 -0
- package/dist/helpers/logger/types.js +30 -0
- package/dist/helpers/logger/types.js.map +1 -0
- package/dist/helpers/network/http-request/base-network-request.helper.d.ts +42 -0
- package/dist/helpers/network/http-request/base-network-request.helper.d.ts.map +1 -0
- package/dist/helpers/network/http-request/base-network-request.helper.js +98 -0
- package/dist/helpers/network/http-request/base-network-request.helper.js.map +1 -0
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.d.ts +19 -0
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.d.ts.map +1 -0
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.js +44 -0
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.js.map +1 -0
- package/dist/helpers/network/http-request/fetcher/base-fetcher.d.ts +35 -0
- package/dist/helpers/network/http-request/fetcher/base-fetcher.d.ts.map +1 -0
- package/dist/helpers/network/http-request/fetcher/base-fetcher.js +54 -0
- package/dist/helpers/network/http-request/fetcher/base-fetcher.js.map +1 -0
- package/dist/helpers/network/http-request/fetcher/index.d.ts +4 -0
- package/dist/helpers/network/http-request/fetcher/index.d.ts.map +1 -0
- package/dist/helpers/network/http-request/fetcher/index.js +20 -0
- package/dist/helpers/network/http-request/fetcher/index.js.map +1 -0
- package/dist/helpers/network/http-request/fetcher/node-fetcher.d.ts +15 -0
- package/dist/helpers/network/http-request/fetcher/node-fetcher.d.ts.map +1 -0
- package/dist/helpers/network/http-request/fetcher/node-fetcher.js +57 -0
- package/dist/helpers/network/http-request/fetcher/node-fetcher.js.map +1 -0
- package/dist/helpers/network/http-request/index.d.ts +3 -0
- package/dist/helpers/network/http-request/index.d.ts.map +1 -0
- package/dist/helpers/network/http-request/index.js +19 -0
- package/dist/helpers/network/http-request/index.js.map +1 -0
- package/dist/helpers/network/http-request/types.d.ts +5 -0
- package/dist/helpers/network/http-request/types.d.ts.map +1 -0
- package/dist/helpers/network/http-request/types.js +3 -0
- package/dist/helpers/network/http-request/types.js.map +1 -0
- package/dist/helpers/network/index.d.ts +4 -0
- package/dist/helpers/network/index.d.ts.map +1 -0
- package/dist/helpers/network/index.js +20 -0
- package/dist/helpers/network/index.js.map +1 -0
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.d.ts +66 -0
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.d.ts.map +1 -0
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.js +134 -0
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.js.map +1 -0
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.d.ts +108 -0
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.d.ts.map +1 -0
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.js +149 -0
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.js.map +1 -0
- package/dist/helpers/network/tcp-socket/index.d.ts +7 -0
- package/dist/helpers/network/tcp-socket/index.d.ts.map +1 -0
- package/dist/helpers/network/tcp-socket/index.js +23 -0
- package/dist/helpers/network/tcp-socket/index.js.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tcp-client.helper.d.ts +7 -0
- package/dist/helpers/network/tcp-socket/network-tcp-client.helper.d.ts.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tcp-client.helper.js +20 -0
- package/dist/helpers/network/tcp-socket/network-tcp-client.helper.js.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tcp-server.helper.d.ts +7 -0
- package/dist/helpers/network/tcp-socket/network-tcp-server.helper.d.ts.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tcp-server.helper.js +19 -0
- package/dist/helpers/network/tcp-socket/network-tcp-server.helper.js.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.d.ts +7 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.d.ts.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.js +20 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.js.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.d.ts +7 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.d.ts.map +1 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.js +19 -0
- package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.js.map +1 -0
- package/dist/helpers/network/udp-socket/index.d.ts +2 -0
- package/dist/helpers/network/udp-socket/index.d.ts.map +1 -0
- package/dist/helpers/network/udp-socket/index.js +18 -0
- package/dist/helpers/network/udp-socket/index.js.map +1 -0
- package/dist/helpers/network/udp-socket/network-udp-client.helper.d.ts +76 -0
- package/dist/helpers/network/udp-socket/network-udp-client.helper.d.ts.map +1 -0
- package/dist/helpers/network/udp-socket/network-udp-client.helper.js +102 -0
- package/dist/helpers/network/udp-socket/network-udp-client.helper.js.map +1 -0
- package/dist/helpers/queue/bullmq/helper.d.ts +34 -0
- package/dist/helpers/queue/bullmq/helper.d.ts.map +1 -0
- package/dist/helpers/queue/bullmq/helper.js +92 -0
- package/dist/helpers/queue/bullmq/helper.js.map +1 -0
- package/dist/helpers/queue/bullmq/index.d.ts +2 -0
- package/dist/helpers/queue/bullmq/index.d.ts.map +1 -0
- package/dist/helpers/queue/bullmq/index.js +18 -0
- package/dist/helpers/queue/bullmq/index.js.map +1 -0
- package/dist/helpers/queue/common/index.d.ts +2 -0
- package/dist/helpers/queue/common/index.d.ts.map +1 -0
- package/dist/helpers/queue/common/index.js +18 -0
- package/dist/helpers/queue/common/index.js.map +1 -0
- package/dist/helpers/queue/common/types.d.ts +2 -0
- package/dist/helpers/queue/common/types.d.ts.map +1 -0
- package/dist/helpers/queue/common/types.js +3 -0
- package/dist/helpers/queue/common/types.js.map +1 -0
- package/dist/helpers/queue/index.d.ts +5 -0
- package/dist/helpers/queue/index.d.ts.map +1 -0
- package/dist/helpers/queue/index.js +21 -0
- package/dist/helpers/queue/index.js.map +1 -0
- package/dist/helpers/queue/internal/helper.d.ts +69 -0
- package/dist/helpers/queue/internal/helper.d.ts.map +1 -0
- package/dist/helpers/queue/internal/helper.js +231 -0
- package/dist/helpers/queue/internal/helper.js.map +1 -0
- package/dist/helpers/queue/internal/index.d.ts +2 -0
- package/dist/helpers/queue/internal/index.d.ts.map +1 -0
- package/dist/helpers/queue/internal/index.js +18 -0
- package/dist/helpers/queue/internal/index.js.map +1 -0
- package/dist/helpers/queue/mqtt/helper.d.ts +35 -0
- package/dist/helpers/queue/mqtt/helper.d.ts.map +1 -0
- package/dist/helpers/queue/mqtt/helper.js +91 -0
- package/dist/helpers/queue/mqtt/helper.js.map +1 -0
- package/dist/helpers/queue/mqtt/index.d.ts +2 -0
- package/dist/helpers/queue/mqtt/index.d.ts.map +1 -0
- package/dist/helpers/queue/mqtt/index.js +18 -0
- package/dist/helpers/queue/mqtt/index.js.map +1 -0
- package/dist/helpers/redis/cluster.helper.d.ts +8 -0
- package/dist/helpers/redis/cluster.helper.d.ts.map +1 -0
- package/dist/helpers/redis/cluster.helper.js +27 -0
- package/dist/helpers/redis/cluster.helper.js.map +1 -0
- package/dist/helpers/redis/default.helper.d.ts +135 -0
- package/dist/helpers/redis/default.helper.d.ts.map +1 -0
- package/dist/helpers/redis/default.helper.js +307 -0
- package/dist/helpers/redis/default.helper.js.map +1 -0
- package/dist/helpers/redis/index.d.ts +5 -0
- package/dist/helpers/redis/index.d.ts.map +1 -0
- package/dist/helpers/redis/index.js +21 -0
- package/dist/helpers/redis/index.js.map +1 -0
- package/dist/helpers/redis/single.helper.d.ts +8 -0
- package/dist/helpers/redis/single.helper.d.ts.map +1 -0
- package/dist/helpers/redis/single.helper.js +43 -0
- package/dist/helpers/redis/single.helper.js.map +1 -0
- package/dist/helpers/redis/types.d.ts +43 -0
- package/dist/helpers/redis/types.d.ts.map +1 -0
- package/dist/helpers/redis/types.js +3 -0
- package/dist/helpers/redis/types.js.map +1 -0
- package/dist/helpers/socket-io/client/helper.d.ts +26 -0
- package/dist/helpers/socket-io/client/helper.d.ts.map +1 -0
- package/dist/helpers/socket-io/client/helper.js +93 -0
- package/dist/helpers/socket-io/client/helper.js.map +1 -0
- package/dist/helpers/socket-io/client/index.d.ts +2 -0
- package/dist/helpers/socket-io/client/index.d.ts.map +1 -0
- package/dist/helpers/socket-io/client/index.js +18 -0
- package/dist/helpers/socket-io/client/index.js.map +1 -0
- package/dist/helpers/socket-io/common/constants.d.ts +13 -0
- package/dist/helpers/socket-io/common/constants.d.ts.map +1 -0
- package/dist/helpers/socket-io/common/constants.js +17 -0
- package/dist/helpers/socket-io/common/constants.js.map +1 -0
- package/dist/helpers/socket-io/common/index.d.ts +3 -0
- package/dist/helpers/socket-io/common/index.d.ts.map +1 -0
- package/dist/helpers/socket-io/common/index.js +19 -0
- package/dist/helpers/socket-io/common/index.js.map +1 -0
- package/dist/helpers/socket-io/common/types.d.ts +41 -0
- package/dist/helpers/socket-io/common/types.d.ts.map +1 -0
- package/dist/helpers/socket-io/common/types.js +3 -0
- package/dist/helpers/socket-io/common/types.js.map +1 -0
- package/dist/helpers/socket-io/index.d.ts +4 -0
- package/dist/helpers/socket-io/index.d.ts.map +1 -0
- package/dist/helpers/socket-io/index.js +20 -0
- package/dist/helpers/socket-io/index.js.map +1 -0
- package/dist/helpers/socket-io/server/helper.d.ts +60 -0
- package/dist/helpers/socket-io/server/helper.d.ts.map +1 -0
- package/dist/helpers/socket-io/server/helper.js +327 -0
- package/dist/helpers/socket-io/server/helper.js.map +1 -0
- package/dist/helpers/socket-io/server/index.d.ts +2 -0
- package/dist/helpers/socket-io/server/index.d.ts.map +1 -0
- package/dist/helpers/socket-io/server/index.js +18 -0
- package/dist/helpers/socket-io/server/index.js.map +1 -0
- package/dist/helpers/storage/in-memory/helper.d.ts +16 -0
- package/dist/helpers/storage/in-memory/helper.d.ts.map +1 -0
- package/dist/helpers/storage/in-memory/helper.js +35 -0
- package/dist/helpers/storage/in-memory/helper.js.map +1 -0
- package/dist/helpers/storage/in-memory/index.d.ts +2 -0
- package/dist/helpers/storage/in-memory/index.d.ts.map +1 -0
- package/dist/helpers/storage/in-memory/index.js +18 -0
- package/dist/helpers/storage/in-memory/index.js.map +1 -0
- package/dist/helpers/storage/index.d.ts +3 -0
- package/dist/helpers/storage/index.d.ts.map +1 -0
- package/dist/helpers/storage/index.js +19 -0
- package/dist/helpers/storage/index.js.map +1 -0
- package/dist/helpers/storage/minio/helper.d.ts +67 -0
- package/dist/helpers/storage/minio/helper.d.ts.map +1 -0
- package/dist/helpers/storage/minio/helper.js +154 -0
- package/dist/helpers/storage/minio/helper.js.map +1 -0
- package/dist/helpers/storage/minio/index.d.ts +2 -0
- package/dist/helpers/storage/minio/index.d.ts.map +1 -0
- package/dist/helpers/storage/minio/index.js +18 -0
- package/dist/helpers/storage/minio/index.js.map +1 -0
- package/dist/helpers/testing/base-test-plan.d.ts +29 -0
- package/dist/helpers/testing/base-test-plan.d.ts.map +1 -0
- package/dist/helpers/testing/base-test-plan.js +69 -0
- package/dist/helpers/testing/base-test-plan.js.map +1 -0
- package/dist/helpers/testing/common/constants.d.ts +7 -0
- package/dist/helpers/testing/common/constants.d.ts.map +1 -0
- package/dist/helpers/testing/common/constants.js +10 -0
- package/dist/helpers/testing/common/constants.js.map +1 -0
- package/dist/helpers/testing/common/index.d.ts +3 -0
- package/dist/helpers/testing/common/index.d.ts.map +1 -0
- package/dist/helpers/testing/common/index.js +19 -0
- package/dist/helpers/testing/common/index.js.map +1 -0
- package/dist/helpers/testing/common/types.d.ts +54 -0
- package/dist/helpers/testing/common/types.d.ts.map +1 -0
- package/dist/helpers/testing/common/types.js +3 -0
- package/dist/helpers/testing/common/types.js.map +1 -0
- package/dist/helpers/testing/describe.d.ts +16 -0
- package/dist/helpers/testing/describe.d.ts.map +1 -0
- package/dist/helpers/testing/describe.js +47 -0
- package/dist/helpers/testing/describe.js.map +1 -0
- package/dist/helpers/testing/index.d.ts +7 -0
- package/dist/helpers/testing/index.d.ts.map +1 -0
- package/dist/helpers/testing/index.js +23 -0
- package/dist/helpers/testing/index.js.map +1 -0
- package/dist/helpers/testing/test-case.d.ts +21 -0
- package/dist/helpers/testing/test-case.d.ts.map +1 -0
- package/dist/helpers/testing/test-case.js +42 -0
- package/dist/helpers/testing/test-case.js.map +1 -0
- package/dist/helpers/testing/test-handler.d.ts +27 -0
- package/dist/helpers/testing/test-handler.d.ts.map +1 -0
- package/dist/helpers/testing/test-handler.js +54 -0
- package/dist/helpers/testing/test-handler.js.map +1 -0
- package/dist/helpers/testing/test-plan.d.ts +6 -0
- package/dist/helpers/testing/test-plan.d.ts.map +1 -0
- package/dist/helpers/testing/test-plan.js +11 -0
- package/dist/helpers/testing/test-plan.js.map +1 -0
- package/dist/helpers/worker-thread/base.d.ts +73 -0
- package/dist/helpers/worker-thread/base.d.ts.map +1 -0
- package/dist/helpers/worker-thread/base.js +130 -0
- package/dist/helpers/worker-thread/base.js.map +1 -0
- package/dist/helpers/worker-thread/index.d.ts +5 -0
- package/dist/helpers/worker-thread/index.d.ts.map +1 -0
- package/dist/helpers/worker-thread/index.js +21 -0
- package/dist/helpers/worker-thread/index.js.map +1 -0
- package/dist/helpers/worker-thread/types.d.ts +51 -0
- package/dist/helpers/worker-thread/types.d.ts.map +1 -0
- package/dist/helpers/worker-thread/types.js +3 -0
- package/dist/helpers/worker-thread/types.js.map +1 -0
- package/dist/helpers/worker-thread/worker-bus.d.ts +63 -0
- package/dist/helpers/worker-thread/worker-bus.d.ts.map +1 -0
- package/dist/helpers/worker-thread/worker-bus.js +72 -0
- package/dist/helpers/worker-thread/worker-bus.js.map +1 -0
- package/dist/helpers/worker-thread/worker-pool.d.ts +27 -0
- package/dist/helpers/worker-thread/worker-pool.d.ts.map +1 -0
- package/dist/helpers/worker-thread/worker-pool.js +66 -0
- package/dist/helpers/worker-thread/worker-pool.js.map +1 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +21 -0
- package/dist/index.js.map +1 -0
- package/dist/utilities/crypto.utility.d.ts +7 -0
- package/dist/utilities/crypto.utility.d.ts.map +1 -0
- package/dist/utilities/crypto.utility.js +26 -0
- package/dist/utilities/crypto.utility.js.map +1 -0
- package/dist/utilities/date.utility.d.ts +18 -0
- package/dist/utilities/date.utility.d.ts.map +1 -0
- package/dist/utilities/date.utility.js +59 -0
- package/dist/utilities/date.utility.js.map +1 -0
- package/dist/utilities/index.d.ts +8 -0
- package/dist/utilities/index.d.ts.map +1 -0
- package/dist/utilities/index.js +24 -0
- package/dist/utilities/index.js.map +1 -0
- package/dist/utilities/module.utility.d.ts +5 -0
- package/dist/utilities/module.utility.d.ts.map +1 -0
- package/dist/utilities/module.utility.js +21 -0
- package/dist/utilities/module.utility.js.map +1 -0
- package/dist/utilities/parse.utility.d.ts +34 -0
- package/dist/utilities/parse.utility.d.ts.map +1 -0
- package/dist/utilities/parse.utility.js +216 -0
- package/dist/utilities/parse.utility.js.map +1 -0
- package/dist/utilities/performance.utility.d.ts +15 -0
- package/dist/utilities/performance.utility.d.ts.map +1 -0
- package/dist/utilities/performance.utility.js +39 -0
- package/dist/utilities/performance.utility.js.map +1 -0
- package/dist/utilities/promise.utility.d.ts +40 -0
- package/dist/utilities/promise.utility.d.ts.map +1 -0
- package/dist/utilities/promise.utility.js +73 -0
- package/dist/utilities/promise.utility.js.map +1 -0
- package/dist/utilities/request.utility.d.ts +32 -0
- package/dist/utilities/request.utility.d.ts.map +1 -0
- package/dist/utilities/request.utility.js +60 -0
- package/dist/utilities/request.utility.js.map +1 -0
- package/package.json +21 -4
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseArrayToMapWithKey = exports.parseArrayToRecordWithKey = exports.getNumberValue = exports.toStringDecimal = exports.toBoolean = exports.float = exports.int = exports.isFloat = exports.isInt = exports.keysToCamel = exports.toCamel = exports.getUID = void 0;
|
|
7
|
+
const get_1 = __importDefault(require("lodash/get"));
|
|
8
|
+
const round_1 = __importDefault(require("lodash/round"));
|
|
9
|
+
const error_1 = require("../helpers/error");
|
|
10
|
+
// -------------------------------------------------------------------------
|
|
11
|
+
const INTL_0_DIGITS_FORMATER = new Intl.NumberFormat('en-US', {
|
|
12
|
+
maximumFractionDigits: 0,
|
|
13
|
+
minimumFractionDigits: 0,
|
|
14
|
+
});
|
|
15
|
+
const INTL_2_DIGITS_FORMATER = new Intl.NumberFormat('en-US', {
|
|
16
|
+
maximumFractionDigits: 2,
|
|
17
|
+
minimumFractionDigits: 2,
|
|
18
|
+
});
|
|
19
|
+
// -------------------------------------------------------------------------
|
|
20
|
+
const getUID = () => Math.random().toString(36).slice(2).toUpperCase();
|
|
21
|
+
exports.getUID = getUID;
|
|
22
|
+
// -------------------------------------------------------------------------
|
|
23
|
+
const toCamel = (s) => {
|
|
24
|
+
return s.replace(/([-_][a-z])/gi, (sub) => {
|
|
25
|
+
return sub.toUpperCase().replace('-', '').replace('_', '');
|
|
26
|
+
});
|
|
27
|
+
};
|
|
28
|
+
exports.toCamel = toCamel;
|
|
29
|
+
// -------------------------------------------------------------------------
|
|
30
|
+
const keysToCamel = (object) => {
|
|
31
|
+
const n = {};
|
|
32
|
+
const keys = Object.keys(object);
|
|
33
|
+
for (const key of keys) {
|
|
34
|
+
const value = (0, get_1.default)(object, key);
|
|
35
|
+
let valueType = typeof value;
|
|
36
|
+
if (Array.isArray(value)) {
|
|
37
|
+
valueType = 'array';
|
|
38
|
+
}
|
|
39
|
+
else if (value instanceof Date) {
|
|
40
|
+
valueType = 'date';
|
|
41
|
+
}
|
|
42
|
+
switch (valueType) {
|
|
43
|
+
case 'object': {
|
|
44
|
+
if (!value) {
|
|
45
|
+
n[(0, exports.toCamel)(key)] = value;
|
|
46
|
+
break;
|
|
47
|
+
}
|
|
48
|
+
n[(0, exports.toCamel)(key)] = (0, exports.keysToCamel)(value);
|
|
49
|
+
break;
|
|
50
|
+
}
|
|
51
|
+
/* case 'array': {
|
|
52
|
+
n[toCamel(key)] = value;
|
|
53
|
+
break;
|
|
54
|
+
} */
|
|
55
|
+
default: {
|
|
56
|
+
n[(0, exports.toCamel)(key)] = value;
|
|
57
|
+
break;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
return n;
|
|
62
|
+
};
|
|
63
|
+
exports.keysToCamel = keysToCamel;
|
|
64
|
+
// -------------------------------------------------------------------------
|
|
65
|
+
const isInt = (n) => {
|
|
66
|
+
if (isNaN(n)) {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
return Number.isInteger(n) || Math.floor(Number(n)) === n || Number(n) % 1 === 0;
|
|
70
|
+
};
|
|
71
|
+
exports.isInt = isInt;
|
|
72
|
+
// -------------------------------------------------------------------------
|
|
73
|
+
const isFloat = (input) => {
|
|
74
|
+
if (isNaN(input)) {
|
|
75
|
+
return false;
|
|
76
|
+
}
|
|
77
|
+
return Number(input) === input || Number(input) % 1 !== 0;
|
|
78
|
+
};
|
|
79
|
+
exports.isFloat = isFloat;
|
|
80
|
+
// -------------------------------------------------------------------------
|
|
81
|
+
const int = (input) => {
|
|
82
|
+
if (!input || isNaN(input)) {
|
|
83
|
+
return 0;
|
|
84
|
+
}
|
|
85
|
+
const normalized = input?.toString()?.replace(/,/g, '');
|
|
86
|
+
return Number.parseInt(normalized, 10) ?? 0;
|
|
87
|
+
};
|
|
88
|
+
exports.int = int;
|
|
89
|
+
// -------------------------------------------------------------------------
|
|
90
|
+
const float = (input, digit = 2) => {
|
|
91
|
+
if (!input || isNaN(input)) {
|
|
92
|
+
return 0;
|
|
93
|
+
}
|
|
94
|
+
const normalized = input?.toString()?.replace(/,/g, '');
|
|
95
|
+
return (0, round_1.default)(Number.parseFloat(normalized), digit);
|
|
96
|
+
};
|
|
97
|
+
exports.float = float;
|
|
98
|
+
// -------------------------------------------------------------------------
|
|
99
|
+
const toBoolean = (input) => {
|
|
100
|
+
return ((input !== '' &&
|
|
101
|
+
input !== 'false' &&
|
|
102
|
+
input !== '0' &&
|
|
103
|
+
input !== false &&
|
|
104
|
+
input !== 0 &&
|
|
105
|
+
input !== null &&
|
|
106
|
+
input !== undefined) ??
|
|
107
|
+
Boolean(input));
|
|
108
|
+
};
|
|
109
|
+
exports.toBoolean = toBoolean;
|
|
110
|
+
// -------------------------------------------------------------------------
|
|
111
|
+
const toStringDecimal = (input, digit = 2, options = { useLocaleFormat: true }) => {
|
|
112
|
+
const { useLocaleFormat } = options;
|
|
113
|
+
if (isNaN(input)) {
|
|
114
|
+
return 0;
|
|
115
|
+
}
|
|
116
|
+
let number = 0;
|
|
117
|
+
if ((0, exports.isInt)(input)) {
|
|
118
|
+
number = (0, exports.int)(input);
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
number = (0, exports.float)(input, digit);
|
|
122
|
+
}
|
|
123
|
+
if (!useLocaleFormat) {
|
|
124
|
+
return number.toFixed(digit);
|
|
125
|
+
}
|
|
126
|
+
if (Number.isInteger(number)) {
|
|
127
|
+
return INTL_0_DIGITS_FORMATER.format(number);
|
|
128
|
+
}
|
|
129
|
+
if (digit === 2) {
|
|
130
|
+
return INTL_2_DIGITS_FORMATER.format(number);
|
|
131
|
+
}
|
|
132
|
+
const formater = new Intl.NumberFormat('en-US', {
|
|
133
|
+
maximumFractionDigits: digit,
|
|
134
|
+
minimumFractionDigits: digit,
|
|
135
|
+
});
|
|
136
|
+
return formater.format(number);
|
|
137
|
+
};
|
|
138
|
+
exports.toStringDecimal = toStringDecimal;
|
|
139
|
+
// -------------------------------------------------------------------------
|
|
140
|
+
const getNumberValue = (input, method = 'int') => {
|
|
141
|
+
if (!input) {
|
|
142
|
+
return 0;
|
|
143
|
+
}
|
|
144
|
+
let raw;
|
|
145
|
+
switch (typeof input) {
|
|
146
|
+
case 'string': {
|
|
147
|
+
raw = input.replace(/,|\./gi, '');
|
|
148
|
+
break;
|
|
149
|
+
}
|
|
150
|
+
default: {
|
|
151
|
+
raw = input;
|
|
152
|
+
break;
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
switch (method) {
|
|
156
|
+
case 'int': {
|
|
157
|
+
return (0, exports.int)(raw);
|
|
158
|
+
}
|
|
159
|
+
default: {
|
|
160
|
+
return (0, exports.float)(raw);
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
};
|
|
164
|
+
exports.getNumberValue = getNumberValue;
|
|
165
|
+
// ---------------------------------------------------------
|
|
166
|
+
/**
|
|
167
|
+
* Returns an object with the key as the value of the `keyMap` and the value as the object itself.
|
|
168
|
+
*
|
|
169
|
+
* @param arr - The input array
|
|
170
|
+
* @param keyMap - The property key to use as the key in the resulting object
|
|
171
|
+
*
|
|
172
|
+
* Note: In case of duplicate keys, the last element will be used.
|
|
173
|
+
*/
|
|
174
|
+
const parseArrayToRecordWithKey = (opts) => {
|
|
175
|
+
const { arr, keyMap } = opts;
|
|
176
|
+
const resultRecord = {};
|
|
177
|
+
if (!arr.length) {
|
|
178
|
+
return resultRecord;
|
|
179
|
+
}
|
|
180
|
+
arr.forEach(element => {
|
|
181
|
+
if (!(keyMap in element)) {
|
|
182
|
+
throw (0, error_1.getError)({
|
|
183
|
+
message: 'Invalid keyMap',
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
resultRecord[element[keyMap]] = element;
|
|
187
|
+
});
|
|
188
|
+
return resultRecord;
|
|
189
|
+
};
|
|
190
|
+
exports.parseArrayToRecordWithKey = parseArrayToRecordWithKey;
|
|
191
|
+
// ---------------------------------------------------------
|
|
192
|
+
/**
|
|
193
|
+
* Return a map with the key as the value of the `keyMap` and the value as the object itself.
|
|
194
|
+
*
|
|
195
|
+
* @param arr - The input array
|
|
196
|
+
* @param keyMap - The property key to use as the key in the resulting object
|
|
197
|
+
*
|
|
198
|
+
* Note: In case of duplicate keys, the last element will be used.
|
|
199
|
+
*/
|
|
200
|
+
const parseArrayToMapWithKey = (arr, keyMap) => {
|
|
201
|
+
const resultMap = new Map();
|
|
202
|
+
if (!arr.length) {
|
|
203
|
+
return resultMap;
|
|
204
|
+
}
|
|
205
|
+
arr.forEach(element => {
|
|
206
|
+
if (!(keyMap in element)) {
|
|
207
|
+
throw (0, error_1.getError)({
|
|
208
|
+
message: 'Invalid keyMap',
|
|
209
|
+
});
|
|
210
|
+
}
|
|
211
|
+
resultMap.set(element[keyMap], element);
|
|
212
|
+
});
|
|
213
|
+
return resultMap;
|
|
214
|
+
};
|
|
215
|
+
exports.parseArrayToMapWithKey = parseArrayToMapWithKey;
|
|
216
|
+
//# sourceMappingURL=parse.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.utility.js","sourceRoot":"","sources":["../../src/utilities/parse.utility.ts"],"names":[],"mappings":";;;;;;AAAA,qDAA6B;AAC7B,yDAAiC;AACjC,2CAA2C;AAE3C,4EAA4E;AAC5E,MAAM,sBAAsB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;IAC5D,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,CAAC;CACzB,CAAC,CAAC;AAEH,MAAM,sBAAsB,GAAG,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE;IAC5D,qBAAqB,EAAE,CAAC;IACxB,qBAAqB,EAAE,CAAC;CACzB,CAAC,CAAC;AAEH,4EAA4E;AACrE,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,CAAC;AAAjE,QAAA,MAAM,UAA2D;AAE9E,4EAA4E;AACrE,MAAM,OAAO,GAAG,CAAC,CAAS,EAAE,EAAE;IACnC,OAAO,CAAC,CAAC,OAAO,CAAC,eAAe,EAAE,CAAC,GAAW,EAAE,EAAE;QAChD,OAAO,GAAG,CAAC,WAAW,EAAE,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;IAC7D,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAJW,QAAA,OAAO,WAIlB;AAEF,4EAA4E;AACrE,MAAM,WAAW,GAAG,CAAC,MAAc,EAAE,EAAE;IAC5C,MAAM,CAAC,GAAQ,EAAE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AI,OAAO,CAAC,EAAE,CAAC;YACzB,MAAM,IAAA,gBAAQ,EAAC;gBACb,OAAO,EAAE,gBAAgB;aAC1B,CAAC,CAAC;QACL,CAAC;QACD,YAAY,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,GAAG,OAAO,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,OAAO,YAAY,CAAC;AACtB,CAAC,CAAC;AAzBW,QAAA,yBAAyB,6BAyBpC;AAEF,4DAA4D;AAC5D;;;;;;;GAOG;AACI,MAAM,sBAAsB,GAAG,CACpC,GAAQ,EACR,MAAS,EACK,EAAE;IAChB,MAAM,SAAS,GAAG,IAAI,GAAG,EAAW,CAAC;IAErC,IAAI,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,GAAG,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;QACpB,IAAI,CAAC,CAAC,MAAM,IAAI,OAAO,CAAC,EAAE,CAAC;YACzB,MAAM,IAAA,gBAAQ,EAAC;gBACb,OAAO,EAAE,gBAAgB;aAC1B,CAAC,CAAC;QACL,CAAC;QACD,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;IAC1C,CAAC,CAAC,CAAC;IAEH,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AApBW,QAAA,sBAAsB,0BAoBjC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ApplicationLogger } from '../helpers/logger';
|
|
2
|
+
export declare const getPerformanceCheckpoint: () => number;
|
|
3
|
+
export declare const getExecutedPerformance: (opts: {
|
|
4
|
+
from: number;
|
|
5
|
+
digit?: number;
|
|
6
|
+
}) => number;
|
|
7
|
+
export declare const executeWithPerformanceMeasure: <R = any>(opts: {
|
|
8
|
+
logger?: ApplicationLogger;
|
|
9
|
+
level?: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
args?: any;
|
|
12
|
+
scope: string;
|
|
13
|
+
task: Function;
|
|
14
|
+
}) => Promise<R>;
|
|
15
|
+
//# sourceMappingURL=performance.utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance.utility.d.ts","sourceRoot":"","sources":["../../src/utilities/performance.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAKrD,eAAO,MAAM,wBAAwB,cAEpC,CAAC;AAEF,eAAO,MAAM,sBAAsB,GAAI,MAAM;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,WAE5E,CAAC;AAEF,eAAO,MAAM,6BAA6B,GAAI,CAAC,GAAG,GAAG,EAAE,MAAM;IAC3D,MAAM,CAAC,EAAE,iBAAiB,CAAC;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,GAAG,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,QAAQ,CAAC;CAChB,eAoCA,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executeWithPerformanceMeasure = exports.getExecutedPerformance = exports.getPerformanceCheckpoint = void 0;
|
|
4
|
+
const parse_utility_1 = require("./parse.utility");
|
|
5
|
+
const DEFAULT_PERFORMANCE_DECIMAL = 6;
|
|
6
|
+
const getPerformanceCheckpoint = () => {
|
|
7
|
+
return performance.now();
|
|
8
|
+
};
|
|
9
|
+
exports.getPerformanceCheckpoint = getPerformanceCheckpoint;
|
|
10
|
+
const getExecutedPerformance = (opts) => {
|
|
11
|
+
return (0, parse_utility_1.float)(performance.now() - opts.from, opts.digit ?? DEFAULT_PERFORMANCE_DECIMAL);
|
|
12
|
+
};
|
|
13
|
+
exports.getExecutedPerformance = getExecutedPerformance;
|
|
14
|
+
const executeWithPerformanceMeasure = (opts) => {
|
|
15
|
+
return new Promise((resolve, reject) => {
|
|
16
|
+
const t = performance.now();
|
|
17
|
+
const { logger = console, level = 'debug', scope, description = 'Executing', args, task, } = opts;
|
|
18
|
+
if (args) {
|
|
19
|
+
logger?.[level]('[%s] START | %s... | Args: %j', scope, description, args);
|
|
20
|
+
}
|
|
21
|
+
else {
|
|
22
|
+
logger?.[level]('[%s] START | %s ...', scope, description);
|
|
23
|
+
}
|
|
24
|
+
Promise.resolve(task())
|
|
25
|
+
.then(resolve)
|
|
26
|
+
.catch(reject)
|
|
27
|
+
.finally(() => {
|
|
28
|
+
const took = performance.now() - t;
|
|
29
|
+
if (args) {
|
|
30
|
+
logger?.[level]('[%s] DONE | %s | Args: %j | Took: %s (ms)', scope, description, args, took);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
logger?.[level]('[%s] DONE | %s | Took: %s (ms)', scope, description, took);
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
});
|
|
37
|
+
};
|
|
38
|
+
exports.executeWithPerformanceMeasure = executeWithPerformanceMeasure;
|
|
39
|
+
//# sourceMappingURL=performance.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"performance.utility.js","sourceRoot":"","sources":["../../src/utilities/performance.utility.ts"],"names":[],"mappings":";;;AACA,mDAAwC;AAExC,MAAM,2BAA2B,GAAG,CAAC,CAAC;AAE/B,MAAM,wBAAwB,GAAG,GAAG,EAAE;IAC3C,OAAO,WAAW,CAAC,GAAG,EAAE,CAAC;AAC3B,CAAC,CAAC;AAFW,QAAA,wBAAwB,4BAEnC;AAEK,MAAM,sBAAsB,GAAG,CAAC,IAAsC,EAAE,EAAE;IAC/E,OAAO,IAAA,qBAAK,EAAC,WAAW,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,IAAI,2BAA2B,CAAC,CAAC;AACzF,CAAC,CAA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|
+
type TTask<T> = () => Promise<T>;
|
|
3
|
+
/**
|
|
4
|
+
* Execute all tasks with limit number of asyncronous tasks.
|
|
5
|
+
* Whenever 1 task's resolved next task will be executed.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* With 20 tasks need to execute with limit is 5 tasks asyncronous
|
|
9
|
+
* ```
|
|
10
|
+
* const tasks = <Array of 20 functions which return promises>
|
|
11
|
+
* await executePromiseWithLimit({
|
|
12
|
+
* tasks,
|
|
13
|
+
* limit: 5,
|
|
14
|
+
onTaskDone: (opts: { result: any }) => {
|
|
15
|
+
// Do something on task done
|
|
16
|
+
},
|
|
17
|
+
* })
|
|
18
|
+
* ```
|
|
19
|
+
*/
|
|
20
|
+
export declare const executePromiseWithLimit: <T>(opts: {
|
|
21
|
+
tasks: Array<TTask<T>>;
|
|
22
|
+
limit: number;
|
|
23
|
+
onTaskDone?: <R>(opts: {
|
|
24
|
+
result: R;
|
|
25
|
+
}) => ValueOrPromise<void>;
|
|
26
|
+
}) => Promise<Awaited<T>[]>;
|
|
27
|
+
/**
|
|
28
|
+
* Transform a value or promise with a function
|
|
29
|
+
*/
|
|
30
|
+
export declare function transformValueOrPromise<T, V>(valueOrPromise: ValueOrPromise<T>, transformer: (value: T) => ValueOrPromise<V>): Promise<V>;
|
|
31
|
+
/**
|
|
32
|
+
* Check if a value is a promise
|
|
33
|
+
*/
|
|
34
|
+
export declare function isPromiseLike<T>(value: T | PromiseLike<T>): value is PromiseLike<T>;
|
|
35
|
+
/**
|
|
36
|
+
* Try to get the value synchronously, throw if it's a promise
|
|
37
|
+
*/
|
|
38
|
+
export declare function getDeepProperty<T, V>(obj: T, path: string): V;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=promise.utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.utility.d.ts","sourceRoot":"","sources":["../../src/utilities/promise.utility.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C,KAAK,KAAK,CAAC,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC;AAEjC;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,uBAAuB,GAAU,CAAC,EAAE,MAAM;IACrD,KAAK,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE;QAAE,MAAM,EAAE,CAAC,CAAA;KAAE,KAAK,cAAc,CAAC,IAAI,CAAC,CAAC;CAC/D,0BAuBA,CAAC;AAEF;;GAEG;AACH,wBAAsB,uBAAuB,CAAC,CAAC,EAAE,CAAC,EAChD,cAAc,EAAE,cAAc,CAAC,CAAC,CAAC,EACjC,WAAW,EAAE,CAAC,KAAK,EAAE,CAAC,KAAK,cAAc,CAAC,CAAC,CAAC,GAC3C,OAAO,CAAC,CAAC,CAAC,CAGZ;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,IAAI,WAAW,CAAC,CAAC,CAAC,CAMnF;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,CAAC,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,CAAC,CAY7D"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.executePromiseWithLimit = void 0;
|
|
4
|
+
exports.transformValueOrPromise = transformValueOrPromise;
|
|
5
|
+
exports.isPromiseLike = isPromiseLike;
|
|
6
|
+
exports.getDeepProperty = getDeepProperty;
|
|
7
|
+
/**
|
|
8
|
+
* Execute all tasks with limit number of asyncronous tasks.
|
|
9
|
+
* Whenever 1 task's resolved next task will be executed.
|
|
10
|
+
*
|
|
11
|
+
* @example
|
|
12
|
+
* With 20 tasks need to execute with limit is 5 tasks asyncronous
|
|
13
|
+
* ```
|
|
14
|
+
* const tasks = <Array of 20 functions which return promises>
|
|
15
|
+
* await executePromiseWithLimit({
|
|
16
|
+
* tasks,
|
|
17
|
+
* limit: 5,
|
|
18
|
+
onTaskDone: (opts: { result: any }) => {
|
|
19
|
+
// Do something on task done
|
|
20
|
+
},
|
|
21
|
+
* })
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
const executePromiseWithLimit = async (opts) => {
|
|
25
|
+
const { tasks, limit, onTaskDone } = opts;
|
|
26
|
+
const results = [];
|
|
27
|
+
const executing = new Set();
|
|
28
|
+
for (const task of tasks) {
|
|
29
|
+
const promise = task().then(result => {
|
|
30
|
+
executing.delete(promise);
|
|
31
|
+
return result;
|
|
32
|
+
});
|
|
33
|
+
executing.add(promise);
|
|
34
|
+
results.push(promise);
|
|
35
|
+
if (executing.size >= limit) {
|
|
36
|
+
const done = await Promise.race(executing);
|
|
37
|
+
onTaskDone?.({ result: done });
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
await Promise.all(executing);
|
|
41
|
+
return Promise.all(results);
|
|
42
|
+
};
|
|
43
|
+
exports.executePromiseWithLimit = executePromiseWithLimit;
|
|
44
|
+
/**
|
|
45
|
+
* Transform a value or promise with a function
|
|
46
|
+
*/
|
|
47
|
+
async function transformValueOrPromise(valueOrPromise, transformer) {
|
|
48
|
+
const value = await valueOrPromise;
|
|
49
|
+
return transformer(value);
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Check if a value is a promise
|
|
53
|
+
*/
|
|
54
|
+
function isPromiseLike(value) {
|
|
55
|
+
return (!!value &&
|
|
56
|
+
(typeof value === 'object' || typeof value === 'function') &&
|
|
57
|
+
typeof value.then === 'function');
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Try to get the value synchronously, throw if it's a promise
|
|
61
|
+
*/
|
|
62
|
+
function getDeepProperty(obj, path) {
|
|
63
|
+
const keys = path.split('.');
|
|
64
|
+
let result = obj;
|
|
65
|
+
for (const key of keys) {
|
|
66
|
+
if (result == null) {
|
|
67
|
+
throw new Error(`Cannot read property '${key}' of ${result}`);
|
|
68
|
+
}
|
|
69
|
+
result = result[key];
|
|
70
|
+
}
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=promise.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"promise.utility.js","sourceRoot":"","sources":["../../src/utilities/promise.utility.ts"],"names":[],"mappings":";;;AAqDA,0DAMC;AAKD,sCAMC;AAKD,0CAYC;AAnFD;;;;;;;;;;;;;;;;GAgBG;AACI,MAAM,uBAAuB,GAAG,KAAK,EAAK,IAIhD,EAAE,EAAE;IACH,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,GAAG,IAAI,CAAC;IAE1C,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,GAAG,EAAE,CAAC;IAE5B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,OAAO,GAAG,IAAI,EAAE,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;YACnC,SAAS,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC;YAC1B,OAAO,MAAM,CAAC;QAChB,CAAC,CAAC,CAAC;QAEH,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QACvB,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAEtB,IAAI,SAAS,CAAC,IAAI,IAAI,KAAK,EAAE,CAAC;YAC5B,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YAC3C,UAAU,EAAE,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IAED,MAAM,OAAO,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IAC7B,OAAO,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAC9B,CAAC,CAAC;AA3BW,QAAA,uBAAuB,2BA2BlC;AAEF;;GAEG;AACI,KAAK,UAAU,uBAAuB,CAC3C,cAAiC,EACjC,WAA4C;IAE5C,MAAM,KAAK,GAAG,MAAM,cAAc,CAAC;IACnC,OAAO,WAAW,CAAC,KAAK,CAAC,CAAC;AAC5B,CAAC;AAED;;GAEG;AACH,SAAgB,aAAa,CAAI,KAAyB;IACxD,OAAO,CACL,CAAC,CAAC,KAAK;QACP,CAAC,OAAO,KAAK,KAAK,QAAQ,IAAI,OAAO,KAAK,KAAK,UAAU,CAAC;QAC1D,OAAQ,KAAwB,CAAC,IAAI,KAAK,UAAU,CACrD,CAAC;AACJ,CAAC;AAED;;GAEG;AACH,SAAgB,eAAe,CAAO,GAAM,EAAE,IAAY;IACxD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IAC7B,IAAI,MAAM,GAAQ,GAAG,CAAC;IAEtB,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,IAAI,MAAM,IAAI,IAAI,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,GAAG,QAAQ,MAAM,EAAE,CAAC,CAAC;QAChE,CAAC;QACD,MAAM,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;IACvB,CAAC;IAED,OAAO,MAAW,CAAC;AACrB,CAAC"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export interface IRequestedRemark {
|
|
2
|
+
id: string;
|
|
3
|
+
url: string;
|
|
4
|
+
method: string;
|
|
5
|
+
[extra: string | symbol]: any;
|
|
6
|
+
}
|
|
7
|
+
interface IParseMultipartOptions<C extends {
|
|
8
|
+
req: any;
|
|
9
|
+
} = {
|
|
10
|
+
req: any;
|
|
11
|
+
}> {
|
|
12
|
+
storage?: 'memory' | 'disk';
|
|
13
|
+
uploadDir?: string;
|
|
14
|
+
context: C;
|
|
15
|
+
}
|
|
16
|
+
interface IParsedFile {
|
|
17
|
+
fieldname: string;
|
|
18
|
+
originalname: string;
|
|
19
|
+
encoding: string;
|
|
20
|
+
mimetype: string;
|
|
21
|
+
size: number;
|
|
22
|
+
buffer?: Buffer;
|
|
23
|
+
filename?: string;
|
|
24
|
+
path?: string;
|
|
25
|
+
}
|
|
26
|
+
export declare const parseMultipartBody: <C extends {
|
|
27
|
+
req: any;
|
|
28
|
+
} = {
|
|
29
|
+
req: any;
|
|
30
|
+
}>(opts: IParseMultipartOptions<C>) => Promise<IParsedFile[]>;
|
|
31
|
+
export {};
|
|
32
|
+
//# sourceMappingURL=request.utility.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.utility.d.ts","sourceRoot":"","sources":["../../src/utilities/request.utility.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,gBAAgB;IAC/B,EAAE,EAAE,MAAM,CAAC;IACX,GAAG,EAAE,MAAM,CAAC;IACZ,MAAM,EAAE,MAAM,CAAC;IACf,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;CAC/B;AAED,UAAU,sBAAsB,CAAC,CAAC,SAAS;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE;IACpE,OAAO,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,CAAC,CAAC;CACZ;AAED,UAAU,WAAW;IACnB,SAAS,EAAE,MAAM,CAAC;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,kBAAkB,GAAU,CAAC,SAAS;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,GAAG;IAAE,GAAG,EAAE,GAAG,CAAA;CAAE,EAC5E,MAAM,sBAAsB,CAAC,CAAC,CAAC,KAC9B,OAAO,CAAC,WAAW,EAAE,CA0DvB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.parseMultipartBody = void 0;
|
|
7
|
+
const error_1 = require("../helpers/error");
|
|
8
|
+
const node_fs_1 = __importDefault(require("node:fs"));
|
|
9
|
+
const node_path_1 = __importDefault(require("node:path"));
|
|
10
|
+
const parseMultipartBody = async (opts) => {
|
|
11
|
+
const { storage = 'memory', uploadDir = './uploads', context } = opts;
|
|
12
|
+
if (storage === 'disk' && !node_fs_1.default.existsSync(uploadDir)) {
|
|
13
|
+
node_fs_1.default.mkdirSync(uploadDir, { recursive: true });
|
|
14
|
+
}
|
|
15
|
+
const formData = await context.req.formData();
|
|
16
|
+
const files = [];
|
|
17
|
+
for (const [fieldname, value] of formData.entries()) {
|
|
18
|
+
if (typeof value === 'string') {
|
|
19
|
+
continue;
|
|
20
|
+
}
|
|
21
|
+
const file = value;
|
|
22
|
+
const arrayBuffer = await file.arrayBuffer();
|
|
23
|
+
const buffer = Buffer.from(arrayBuffer);
|
|
24
|
+
const parsedFile = {
|
|
25
|
+
fieldname,
|
|
26
|
+
originalname: file.name,
|
|
27
|
+
encoding: 'utf8', // Default encoding
|
|
28
|
+
mimetype: file.type,
|
|
29
|
+
size: file.size,
|
|
30
|
+
};
|
|
31
|
+
switch (storage) {
|
|
32
|
+
case 'memory': {
|
|
33
|
+
parsedFile.buffer = buffer;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case 'disk': {
|
|
37
|
+
// Store on disk (like multer.diskStorage())
|
|
38
|
+
const timestamp = Date.now();
|
|
39
|
+
const randomString = Math.random().toString(36).substring(7);
|
|
40
|
+
// Sanitize filename to prevent path traversal
|
|
41
|
+
const sanitizedName = node_path_1.default.basename(file.name).replace(/[^a-zA-Z0-9._-]/g, '_');
|
|
42
|
+
const filename = `${timestamp}-${randomString}-${sanitizedName}`;
|
|
43
|
+
const filepath = node_path_1.default.join(uploadDir, filename);
|
|
44
|
+
node_fs_1.default.writeFileSync(filepath, buffer);
|
|
45
|
+
parsedFile.filename = filename;
|
|
46
|
+
parsedFile.path = filepath;
|
|
47
|
+
break;
|
|
48
|
+
}
|
|
49
|
+
default: {
|
|
50
|
+
throw (0, error_1.getError)({
|
|
51
|
+
message: `[parseMultipartBody] storage: ${storage} | Invalid storage type | Valids: ['memory', 'disk']`,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
files.push(parsedFile);
|
|
56
|
+
}
|
|
57
|
+
return files;
|
|
58
|
+
};
|
|
59
|
+
exports.parseMultipartBody = parseMultipartBody;
|
|
60
|
+
//# sourceMappingURL=request.utility.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"request.utility.js","sourceRoot":"","sources":["../../src/utilities/request.utility.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA2C;AAC3C,sDAAyB;AACzB,0DAA6B;AA2BtB,MAAM,kBAAkB,GAAG,KAAK,EACrC,IAA+B,EACP,EAAE;IAC1B,MAAM,EAAE,OAAO,GAAG,QAAQ,EAAE,SAAS,GAAG,WAAW,EAAE,OAAO,EAAE,GAAG,IAAI,CAAC;IAEtE,IAAI,OAAO,KAAK,MAAM,IAAI,CAAC,iBAAE,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;QACpD,iBAAE,CAAC,SA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AM,QAAQ,GAAG,GAAG,SAAS,IAAI,YAAY,IAAI,aAAa,EAAE,CAAC;gBACjE,MAAM,QAAQ,GAAG,mBAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;gBAEhD,iBAAE,CAAC,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;gBAEnC,UAAU,CAAC,QAAQ,GAAG,QAAQ,CAAC;gBAC/B,UAAU,CAAC,IAAI,GAAG,QAAQ,CAAC;gBAC3B,MAAM;YACR,CAAC;YACD,OAAO,CAAC,CAAC,CAAC;gBACR,MAAM,IAAA,gBAAQ,EAAC;oBACb,OAAO,EAAE,iCAAiC,OAAO,sDAAsD;iBACxG,CAAC,CAAC;YACL,CAAC;QACH,CAAC;QAED,KAAK,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;IACzB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AA5DW,QAAA,kBAAkB,sBA4D7B"}
|
package/package.json
CHANGED
|
@@ -1,24 +1,40 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@venizia/ignis-helpers",
|
|
3
|
-
"version": "0.0.1-
|
|
3
|
+
"version": "0.0.1-5",
|
|
4
4
|
"description": "Utility helpers for the Ignis Framework - logging, cron, Redis, queues, storage, and more",
|
|
5
5
|
"keywords": [
|
|
6
|
+
"ignis",
|
|
6
7
|
"helpers",
|
|
7
8
|
"utilities",
|
|
9
|
+
"library",
|
|
10
|
+
"utils",
|
|
11
|
+
"tools",
|
|
12
|
+
"common",
|
|
13
|
+
"shared",
|
|
8
14
|
"logging",
|
|
15
|
+
"logger",
|
|
16
|
+
"log-management",
|
|
9
17
|
"winston",
|
|
10
18
|
"cron",
|
|
19
|
+
"cronjob",
|
|
20
|
+
"scheduler",
|
|
11
21
|
"redis",
|
|
12
22
|
"ioredis",
|
|
13
23
|
"queue",
|
|
24
|
+
"message-queue",
|
|
14
25
|
"bullmq",
|
|
15
26
|
"storage",
|
|
27
|
+
"object-storage",
|
|
28
|
+
"file-storage",
|
|
16
29
|
"minio",
|
|
17
30
|
"s3",
|
|
31
|
+
"aws-s3",
|
|
18
32
|
"mqtt",
|
|
33
|
+
"pub-sub",
|
|
19
34
|
"socket.io",
|
|
35
|
+
"real-time",
|
|
36
|
+
"websockets",
|
|
20
37
|
"venizia",
|
|
21
|
-
"ignis",
|
|
22
38
|
"bun",
|
|
23
39
|
"nodejs",
|
|
24
40
|
"typescript"
|
|
@@ -45,6 +61,7 @@
|
|
|
45
61
|
"bun": ">=1.3"
|
|
46
62
|
},
|
|
47
63
|
"scripts": {
|
|
64
|
+
"force-update": "sh ./scripts/force-update.sh",
|
|
48
65
|
"build": "sh ./scripts/build.sh",
|
|
49
66
|
"clean": "sh ./scripts/clean.sh",
|
|
50
67
|
"eslint": "eslint --report-unused-disable-directives .",
|
|
@@ -73,7 +90,7 @@
|
|
|
73
90
|
"dependencies": {
|
|
74
91
|
"@socket.io/redis-adapter": "^8.3.0",
|
|
75
92
|
"@socket.io/redis-emitter": "^5.1.0",
|
|
76
|
-
"@venizia/ignis-inversion": "
|
|
93
|
+
"@venizia/ignis-inversion": "^0.0.1-3",
|
|
77
94
|
"axios": "^1.12.2",
|
|
78
95
|
"bullmq": "^5.63.1",
|
|
79
96
|
"cron": "^4.3.3",
|
|
@@ -108,7 +125,7 @@
|
|
|
108
125
|
"@hono/zod-openapi": "^1.1.5",
|
|
109
126
|
"@types/bun": "^1.3.4",
|
|
110
127
|
"@types/lodash": "^4.17.20",
|
|
111
|
-
"@venizia/dev-configs": "
|
|
128
|
+
"@venizia/dev-configs": "^0.0.1-3",
|
|
112
129
|
"eslint": "^9.36.0",
|
|
113
130
|
"prettier": "^3.6.2",
|
|
114
131
|
"tsc-alias": "^1.8.16",
|