@minimaltech/node-infra 0.5.9-12 → 0.5.9-14
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/base/applications/base.application.js +28 -41
- package/dist/base/applications/default.application.js +2 -9
- package/dist/base/applications/index.js +0 -1
- package/dist/base/base.component.js +2 -3
- package/dist/base/base.helper.js +4 -4
- package/dist/base/base.provider.js +2 -3
- package/dist/base/base.sequence.js +17 -27
- package/dist/base/controllers/common.js +8 -10
- package/dist/base/controllers/crud.controller.js +55 -68
- package/dist/base/controllers/express-request-handler.js +2 -1
- package/dist/base/controllers/index.js +0 -1
- package/dist/base/controllers/kv.controller.js +7 -19
- package/dist/base/controllers/relational.controller.d.ts +1 -3
- package/dist/base/controllers/relational.controller.js +40 -58
- package/dist/base/controllers/service-crud.controller.js +46 -47
- package/dist/base/datasources/base.datasource.js +1 -1
- package/dist/base/datasources/index.js +0 -1
- package/dist/base/datasources/types.js +0 -1
- package/dist/base/index.js +0 -1
- package/dist/base/loopback/@lb/auth/index.js +0 -1
- package/dist/base/loopback/@lb/core/index.d.ts +0 -1
- package/dist/base/loopback/@lb/core/index.js +0 -2
- package/dist/base/loopback/@lb/repository/index.d.ts +0 -1
- package/dist/base/loopback/@lb/repository/index.js +0 -2
- package/dist/base/loopback/@lb/rest/index.js +0 -1
- package/dist/base/loopback/authentication/index.d.ts +0 -2
- package/dist/base/loopback/authentication/index.js +0 -2
- package/dist/base/loopback/authorization/index.js +0 -1
- package/dist/base/loopback/boot/index.js +0 -1
- package/dist/base/loopback/core/index.js +0 -1
- package/dist/base/loopback/filter/index.d.ts +1 -2
- package/dist/base/loopback/filter/index.js +0 -16
- package/dist/base/loopback/health-check/index.js +0 -1
- package/dist/base/loopback/http-server/index.d.ts +1 -2
- package/dist/base/loopback/http-server/index.js +0 -16
- package/dist/base/loopback/metadata/index.js +0 -1
- package/dist/base/loopback/repository/index.js +0 -1
- package/dist/base/loopback/rest/index.js +0 -1
- package/dist/base/loopback/security/index.js +0 -1
- package/dist/base/loopback/service-proxy/index.js +0 -1
- package/dist/base/models/base.model.d.ts +0 -7
- package/dist/base/models/base.model.js +5 -24
- package/dist/base/models/index.js +0 -1
- package/dist/base/repositories/base.repository.d.ts +0 -3
- package/dist/base/repositories/base.repository.js +5 -25
- package/dist/base/repositories/index.js +0 -1
- package/dist/base/repositories/relations/has-many-polymorphic/decorator.d.ts +0 -8
- package/dist/base/repositories/relations/has-many-polymorphic/decorator.js +11 -11
- package/dist/base/repositories/relations/has-many-polymorphic/factory.d.ts +0 -9
- package/dist/base/repositories/relations/has-many-polymorphic/factory.js +12 -31
- package/dist/base/repositories/relations/has-many-polymorphic/index.js +0 -1
- package/dist/base/repositories/relations/has-many-polymorphic/types.js +0 -1
- package/dist/base/repositories/relations/index.js +0 -1
- package/dist/base/repositories/searchable-tz-crud.repository.js +129 -161
- package/dist/base/repositories/tz-crud.repository.js +23 -59
- package/dist/base/services/base-crud.service.js +6 -10
- package/dist/base/services/base.service.js +2 -3
- package/dist/base/services/index.js +0 -1
- package/dist/common/constants.js +81 -90
- package/dist/common/environments.js +25 -26
- package/dist/common/index.js +0 -1
- package/dist/common/keys.js +2 -3
- package/dist/common/statuses.js +28 -32
- package/dist/common/types.d.ts +0 -3
- package/dist/common/types.js +0 -1
- package/dist/components/authenticate/common/constants.js +11 -14
- package/dist/components/authenticate/common/index.js +0 -1
- package/dist/components/authenticate/common/keys.js +7 -8
- package/dist/components/authenticate/common/types.js +11 -4
- package/dist/components/authenticate/component.js +20 -29
- package/dist/components/authenticate/controllers/auth.controller.js +13 -12
- package/dist/components/authenticate/controllers/index.js +0 -1
- package/dist/components/authenticate/controllers/oauth2.controller.js +18 -21
- package/dist/components/authenticate/index.js +0 -1
- package/dist/components/authenticate/middleware.js +25 -36
- package/dist/components/authenticate/models/index.js +0 -1
- package/dist/components/authenticate/models/oauth2-client.model.js +8 -4
- package/dist/components/authenticate/models/oauth2-scope.model.js +4 -1
- package/dist/components/authenticate/models/oauth2-token.model.js +7 -1
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.js +4 -6
- package/dist/components/authenticate/oauth2-handlers/base.js +95 -111
- package/dist/components/authenticate/oauth2-handlers/client-credential.handler.js +2 -4
- package/dist/components/authenticate/oauth2-handlers/index.js +0 -1
- package/dist/components/authenticate/oauth2-handlers/oauth2.js +3 -3
- package/dist/components/authenticate/oauth2-handlers/password.handler.js +0 -1
- package/dist/components/authenticate/repositories/index.js +0 -1
- package/dist/components/authenticate/repositories/oauth2.repository.js +2 -1
- package/dist/components/authenticate/services/basic-token.service.js +18 -30
- package/dist/components/authenticate/services/basic.strategy.js +7 -18
- package/dist/components/authenticate/services/index.js +0 -1
- package/dist/components/authenticate/services/jwt-token.service.js +27 -41
- package/dist/components/authenticate/services/jwt.strategy.js +2 -2
- package/dist/components/authenticate/services/oauth2.service.js +98 -111
- package/dist/components/authenticate/services/oauth2.strategy.js +19 -32
- package/dist/components/authorize/adapters/adapter-builder.js +1 -1
- package/dist/components/authorize/adapters/base.adapter.js +2 -10
- package/dist/components/authorize/adapters/casbin-postgres-adapter.helper.js +37 -56
- package/dist/components/authorize/adapters/casbin-redis-adapter.helper.js +0 -2
- package/dist/components/authorize/adapters/index.js +0 -1
- package/dist/components/authorize/common/constants.js +10 -13
- package/dist/components/authorize/common/index.js +0 -1
- package/dist/components/authorize/common/keys.js +15 -16
- package/dist/components/authorize/common/types.js +2 -3
- package/dist/components/authorize/component.js +44 -60
- package/dist/components/authorize/decorators/index.d.ts +0 -11
- package/dist/components/authorize/decorators/index.js +1 -15
- package/dist/components/authorize/index.js +0 -1
- package/dist/components/authorize/interceptor.js +76 -81
- package/dist/components/authorize/migrations/0000-create-view-policy.js +3 -15
- package/dist/components/authorize/migrations/index.js +0 -1
- package/dist/components/authorize/models/defs.js +24 -6
- package/dist/components/authorize/models/index.js +0 -1
- package/dist/components/authorize/models/permission-mapping.model.js +0 -1
- package/dist/components/authorize/models/permission.model.js +0 -1
- package/dist/components/authorize/models/role.model.js +1 -2
- package/dist/components/authorize/models/user-role.model.js +0 -2
- package/dist/components/authorize/models/view-authorize-policy.model.js +4 -2
- package/dist/components/authorize/provider.js +81 -97
- package/dist/components/authorize/repositories/authorize.repository.js +3 -7
- package/dist/components/authorize/repositories/index.js +0 -1
- package/dist/components/authorize/services/enforcer.service.js +20 -28
- package/dist/components/authorize/services/generator.service.d.ts +0 -20
- package/dist/components/authorize/services/generator.service.js +62 -97
- package/dist/components/authorize/services/index.js +0 -1
- package/dist/components/crash-report/common/constants.js +0 -1
- package/dist/components/crash-report/common/index.js +0 -1
- package/dist/components/crash-report/common/keys.js +8 -11
- package/dist/components/crash-report/common/types.js +0 -1
- package/dist/components/crash-report/component.js +31 -45
- package/dist/components/crash-report/index.js +0 -1
- package/dist/components/crash-report/providers/index.js +0 -1
- package/dist/components/crash-report/providers/provider.js +1 -1
- package/dist/components/crash-report/providers/third-parties/base.js +2 -3
- package/dist/components/crash-report/providers/third-parties/index.js +0 -1
- package/dist/components/crash-report/services/index.js +0 -1
- package/dist/components/crash-report/services/mt-crash-report.service.js +5 -6
- package/dist/components/grpc/common/constants.js +0 -1
- package/dist/components/grpc/common/index.js +0 -1
- package/dist/components/grpc/common/keys.js +4 -5
- package/dist/components/grpc/common/types.js +0 -1
- package/dist/components/grpc/components/index.js +0 -1
- package/dist/components/grpc/components/server.component.js +8 -9
- package/dist/components/grpc/controllers/base.js +1 -1
- package/dist/components/grpc/controllers/index.js +0 -1
- package/dist/components/grpc/decorators/index.js +0 -1
- package/dist/components/grpc/helpers/grpc-client.js +9 -4
- package/dist/components/grpc/helpers/grpc-server.js +14 -18
- package/dist/components/grpc/helpers/index.js +0 -1
- package/dist/components/grpc/index.js +0 -1
- package/dist/components/grpc/persistents/grpc.connector.js +8 -3
- package/dist/components/grpc/persistents/grpc.datasource.js +2 -4
- package/dist/components/grpc/persistents/grpc.repository.js +3 -3
- package/dist/components/grpc/persistents/index.js +0 -1
- package/dist/components/health-check/component.js +1 -1
- package/dist/components/health-check/index.js +0 -1
- package/dist/components/index.js +0 -1
- package/dist/components/migration/common/index.js +0 -1
- package/dist/components/migration/common/keys.js +3 -4
- package/dist/components/migration/common/types.js +0 -1
- package/dist/components/migration/component.js +5 -9
- package/dist/components/migration/index.js +0 -1
- package/dist/components/migration/models/index.js +0 -1
- package/dist/components/migration/models/migration.model.js +2 -1
- package/dist/components/migration/repositories/index.js +0 -1
- package/dist/components/migration/repositories/migration.repository.js +0 -1
- package/dist/components/socket-io/common/constants.js +10 -11
- package/dist/components/socket-io/common/index.js +0 -1
- package/dist/components/socket-io/common/keys.js +6 -7
- package/dist/components/socket-io/component.js +9 -9
- package/dist/components/socket-io/helpers/index.js +0 -1
- package/dist/components/socket-io/helpers/socket-io-client.helper.js +7 -12
- package/dist/components/socket-io/helpers/socket-io-server.helper.js +26 -42
- package/dist/components/socket-io/index.js +0 -1
- package/dist/components/static-asset/common/index.js +0 -1
- package/dist/components/static-asset/common/keys.js +4 -5
- package/dist/components/static-asset/component.js +9 -9
- package/dist/components/static-asset/controllers/asset.controller.d.ts +0 -8
- package/dist/components/static-asset/controllers/asset.controller.js +71 -94
- package/dist/components/static-asset/controllers/index.js +0 -1
- package/dist/components/static-asset/controllers/resource.controller.js +8 -10
- package/dist/components/static-asset/index.js +0 -1
- package/dist/datasources/index.js +0 -1
- package/dist/datasources/kvmem/datasource.js +3 -4
- package/dist/datasources/kvmem/index.js +0 -1
- package/dist/datasources/postgres/datasource.js +10 -11
- package/dist/datasources/postgres/index.js +0 -1
- package/dist/datasources/postgres/types.js +0 -1
- package/dist/datasources/redis/connector.js +18 -8
- package/dist/datasources/redis/datasource.js +7 -8
- package/dist/datasources/redis/index.js +0 -1
- package/dist/datasources/redis/types.js +0 -1
- package/dist/helpers/application-environment.helper.js +3 -4
- package/dist/helpers/cron.helper.js +9 -15
- package/dist/helpers/crypto/algorithms/aes.algorithm.js +8 -8
- package/dist/helpers/crypto/algorithms/base.algorithm.js +3 -5
- package/dist/helpers/crypto/algorithms/index.js +0 -1
- package/dist/helpers/crypto/algorithms/rsa.algorithm.js +4 -6
- package/dist/helpers/crypto/common/constants.js +0 -1
- package/dist/helpers/crypto/common/index.js +0 -1
- package/dist/helpers/crypto/common/types.js +0 -1
- package/dist/helpers/crypto/index.js +0 -1
- package/dist/helpers/database/index.js +0 -1
- package/dist/helpers/database/query-builder.helper.js +2 -6
- package/dist/helpers/index.js +0 -1
- package/dist/helpers/logger/application-logger.js +7 -18
- package/dist/helpers/logger/common/index.js +0 -1
- package/dist/helpers/logger/common/types.js +20 -23
- package/dist/helpers/logger/default-logger.js +2 -13
- package/dist/helpers/logger/factory.js +1 -2
- package/dist/helpers/logger/index.js +0 -1
- package/dist/helpers/logger/transports/dgram.transport.js +16 -26
- package/dist/helpers/logger/transports/index.js +0 -1
- package/dist/helpers/network/http-request/base-network-request.helper.d.ts +2 -0
- package/dist/helpers/network/http-request/base-network-request.helper.js +36 -35
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.d.ts +2 -2
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.js +10 -23
- package/dist/helpers/network/http-request/fetcher/base-fetcher.d.ts +1 -0
- package/dist/helpers/network/http-request/fetcher/base-fetcher.js +13 -37
- package/dist/helpers/network/http-request/fetcher/index.js +0 -1
- package/dist/helpers/network/http-request/fetcher/node-fetcher.d.ts +2 -2
- package/dist/helpers/network/http-request/fetcher/node-fetcher.js +28 -13
- package/dist/helpers/network/http-request/index.js +0 -1
- package/dist/helpers/network/http-request/types.js +0 -1
- package/dist/helpers/network/index.js +0 -1
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.js +30 -28
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.js +21 -20
- package/dist/helpers/network/tcp-socket/index.js +0 -1
- package/dist/helpers/network/tcp-socket/network-tcp-client.helper.js +5 -2
- package/dist/helpers/network/tcp-socket/network-tcp-server.helper.js +5 -2
- package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.js +5 -2
- package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.js +5 -2
- package/dist/helpers/network/udp-socket/index.js +0 -1
- package/dist/helpers/network/udp-socket/network-udp-client.helper.js +21 -19
- package/dist/helpers/queue/bullmq.helper.js +21 -23
- package/dist/helpers/queue/index.js +0 -1
- package/dist/helpers/queue/mqtt.helper.js +15 -18
- package/dist/helpers/queue/queue.helper.js +74 -146
- package/dist/helpers/redis/default.helper.js +117 -163
- package/dist/helpers/redis/index.js +0 -1
- package/dist/helpers/redis/redis-cluster.helper.js +7 -3
- package/dist/helpers/redis/redis.helper.js +8 -6
- package/dist/helpers/redis/types.js +0 -1
- package/dist/helpers/storage/di-container.helper.js +2 -1
- package/dist/helpers/storage/index.js +0 -1
- package/dist/helpers/storage/minio.helper.js +88 -129
- package/dist/helpers/testing/common.js +3 -4
- package/dist/helpers/testing/describe.js +14 -22
- package/dist/helpers/testing/index.js +0 -1
- package/dist/helpers/testing/test-case.js +5 -1
- package/dist/helpers/testing/test-handler.js +23 -31
- package/dist/helpers/testing/test-plan/base.js +9 -7
- package/dist/helpers/testing/test-plan/default.js +0 -1
- package/dist/helpers/testing/test-plan/index.js +0 -1
- package/dist/helpers/testing/types.js +0 -1
- package/dist/helpers/worker-thread/base.js +10 -21
- package/dist/helpers/worker-thread/index.js +0 -1
- package/dist/helpers/worker-thread/types.js +0 -1
- package/dist/helpers/worker-thread/worker-bus.js +11 -13
- package/dist/helpers/worker-thread/worker-pool.js +17 -26
- package/dist/index.js +0 -1
- package/dist/interceptors/content-range.interceptor.js +115 -133
- package/dist/interceptors/index.js +0 -1
- package/dist/middlewares/index.js +0 -1
- package/dist/middlewares/request-body-parser.middleware.js +4 -17
- package/dist/middlewares/request-spy.middleware.js +4 -6
- package/dist/migrations/base-path.js +0 -1
- package/dist/migrations/handler.js +13 -23
- package/dist/migrations/index.js +0 -1
- package/dist/mixins/data-type.mixin.js +5 -1
- package/dist/mixins/deprecated/user-audit.mixin.d.ts +0 -3
- package/dist/mixins/deprecated/user-audit.mixin.js +2 -6
- package/dist/mixins/duplicatable.mixin.js +1 -1
- package/dist/mixins/index.js +0 -1
- package/dist/mixins/object-search.mixin.js +1 -1
- package/dist/mixins/principal.mixin.js +2 -1
- package/dist/mixins/soft-delete.mixin.js +1 -1
- package/dist/mixins/soft-persistent.mixin.js +1 -1
- package/dist/mixins/text-search.mixin.js +1 -1
- package/dist/mixins/tz.mixin.js +2 -1
- package/dist/mixins/user-audit.mixin.js +5 -4
- package/dist/mixins/vector.mixin.js +9 -7
- package/dist/tsconfig.base.json +11 -4
- package/dist/utilities/crypto.utility.js +0 -1
- package/dist/utilities/date.utility.js +5 -24
- package/dist/utilities/error.utility.js +2 -1
- package/dist/utilities/index.js +0 -1
- package/dist/utilities/model.utility.js +2 -7
- package/dist/utilities/parse.utility.d.ts +0 -16
- package/dist/utilities/parse.utility.js +6 -42
- package/dist/utilities/performance.utility.js +1 -3
- package/dist/utilities/promise.utility.d.ts +0 -17
- package/dist/utilities/promise.utility.js +5 -32
- package/dist/utilities/query.utility.js +8 -17
- package/dist/utilities/request.utility.js +2 -9
- package/dist/utilities/url.utility.js +0 -1
- package/package.json +8 -5
- package/dist/base/applications/base.application.js.map +0 -1
- package/dist/base/applications/default.application.js.map +0 -1
- package/dist/base/applications/index.js.map +0 -1
- package/dist/base/base.component.js.map +0 -1
- package/dist/base/base.helper.js.map +0 -1
- package/dist/base/base.provider.js.map +0 -1
- package/dist/base/base.sequence.js.map +0 -1
- package/dist/base/controllers/common.js.map +0 -1
- package/dist/base/controllers/crud.controller.js.map +0 -1
- package/dist/base/controllers/express-request-handler.js.map +0 -1
- package/dist/base/controllers/index.js.map +0 -1
- package/dist/base/controllers/kv.controller.js.map +0 -1
- package/dist/base/controllers/relational.controller.js.map +0 -1
- package/dist/base/controllers/service-crud.controller.js.map +0 -1
- package/dist/base/datasources/base.datasource.js.map +0 -1
- package/dist/base/datasources/index.js.map +0 -1
- package/dist/base/datasources/types.js.map +0 -1
- package/dist/base/index.js.map +0 -1
- package/dist/base/loopback/@lb/auth/index.js.map +0 -1
- package/dist/base/loopback/@lb/core/index.js.map +0 -1
- package/dist/base/loopback/@lb/repository/index.js.map +0 -1
- package/dist/base/loopback/@lb/rest/index.js.map +0 -1
- package/dist/base/loopback/authentication/index.js.map +0 -1
- package/dist/base/loopback/authorization/index.js.map +0 -1
- package/dist/base/loopback/boot/index.js.map +0 -1
- package/dist/base/loopback/core/index.js.map +0 -1
- package/dist/base/loopback/filter/index.js.map +0 -1
- package/dist/base/loopback/health-check/index.js.map +0 -1
- package/dist/base/loopback/http-server/index.js.map +0 -1
- package/dist/base/loopback/metadata/index.js.map +0 -1
- package/dist/base/loopback/repository/index.js.map +0 -1
- package/dist/base/loopback/rest/index.js.map +0 -1
- package/dist/base/loopback/security/index.js.map +0 -1
- package/dist/base/loopback/service-proxy/index.js.map +0 -1
- package/dist/base/models/base.model.js.map +0 -1
- package/dist/base/models/index.js.map +0 -1
- package/dist/base/repositories/base.repository.js.map +0 -1
- package/dist/base/repositories/index.js.map +0 -1
- package/dist/base/repositories/relations/has-many-polymorphic/decorator.js.map +0 -1
- package/dist/base/repositories/relations/has-many-polymorphic/factory.js.map +0 -1
- package/dist/base/repositories/relations/has-many-polymorphic/index.js.map +0 -1
- package/dist/base/repositories/relations/has-many-polymorphic/types.js.map +0 -1
- package/dist/base/repositories/relations/index.js.map +0 -1
- package/dist/base/repositories/searchable-tz-crud.repository.js.map +0 -1
- package/dist/base/repositories/tz-crud.repository.js.map +0 -1
- package/dist/base/services/base-crud.service.js.map +0 -1
- package/dist/base/services/base.service.js.map +0 -1
- package/dist/base/services/index.js.map +0 -1
- package/dist/common/constants.js.map +0 -1
- package/dist/common/environments.js.map +0 -1
- package/dist/common/index.js.map +0 -1
- package/dist/common/keys.js.map +0 -1
- package/dist/common/statuses.js.map +0 -1
- package/dist/common/types.js.map +0 -1
- package/dist/components/authenticate/common/constants.js.map +0 -1
- package/dist/components/authenticate/common/index.js.map +0 -1
- package/dist/components/authenticate/common/keys.js.map +0 -1
- package/dist/components/authenticate/common/types.js.map +0 -1
- package/dist/components/authenticate/component.js.map +0 -1
- package/dist/components/authenticate/controllers/auth.controller.js.map +0 -1
- package/dist/components/authenticate/controllers/index.js.map +0 -1
- package/dist/components/authenticate/controllers/oauth2.controller.js.map +0 -1
- package/dist/components/authenticate/index.js.map +0 -1
- package/dist/components/authenticate/middleware.js.map +0 -1
- package/dist/components/authenticate/models/index.js.map +0 -1
- package/dist/components/authenticate/models/oauth2-client.model.js.map +0 -1
- package/dist/components/authenticate/models/oauth2-scope.model.js.map +0 -1
- package/dist/components/authenticate/models/oauth2-token.model.js.map +0 -1
- package/dist/components/authenticate/oauth2-handlers/authorization-code.handler.js.map +0 -1
- package/dist/components/authenticate/oauth2-handlers/base.js.map +0 -1
- package/dist/components/authenticate/oauth2-handlers/client-credential.handler.js.map +0 -1
- package/dist/components/authenticate/oauth2-handlers/index.js.map +0 -1
- package/dist/components/authenticate/oauth2-handlers/oauth2.js.map +0 -1
- package/dist/components/authenticate/oauth2-handlers/password.handler.js.map +0 -1
- package/dist/components/authenticate/repositories/index.js.map +0 -1
- package/dist/components/authenticate/repositories/oauth2.repository.js.map +0 -1
- package/dist/components/authenticate/services/basic-token.service.js.map +0 -1
- package/dist/components/authenticate/services/basic.strategy.js.map +0 -1
- package/dist/components/authenticate/services/index.js.map +0 -1
- package/dist/components/authenticate/services/jwt-token.service.js.map +0 -1
- package/dist/components/authenticate/services/jwt.strategy.js.map +0 -1
- package/dist/components/authenticate/services/oauth2.service.js.map +0 -1
- package/dist/components/authenticate/services/oauth2.strategy.js.map +0 -1
- package/dist/components/authorize/adapters/adapter-builder.js.map +0 -1
- package/dist/components/authorize/adapters/base.adapter.js.map +0 -1
- package/dist/components/authorize/adapters/casbin-postgres-adapter.helper.js.map +0 -1
- package/dist/components/authorize/adapters/casbin-redis-adapter.helper.js.map +0 -1
- package/dist/components/authorize/adapters/index.js.map +0 -1
- package/dist/components/authorize/common/constants.js.map +0 -1
- package/dist/components/authorize/common/index.js.map +0 -1
- package/dist/components/authorize/common/keys.js.map +0 -1
- package/dist/components/authorize/common/types.js.map +0 -1
- package/dist/components/authorize/component.js.map +0 -1
- package/dist/components/authorize/decorators/index.js.map +0 -1
- package/dist/components/authorize/index.js.map +0 -1
- package/dist/components/authorize/interceptor.js.map +0 -1
- package/dist/components/authorize/migrations/0000-create-view-policy.js.map +0 -1
- package/dist/components/authorize/migrations/index.js.map +0 -1
- package/dist/components/authorize/models/defs.js.map +0 -1
- package/dist/components/authorize/models/index.js.map +0 -1
- package/dist/components/authorize/models/permission-mapping.model.js.map +0 -1
- package/dist/components/authorize/models/permission.model.js.map +0 -1
- package/dist/components/authorize/models/role.model.js.map +0 -1
- package/dist/components/authorize/models/user-role.model.js.map +0 -1
- package/dist/components/authorize/models/view-authorize-policy.model.js.map +0 -1
- package/dist/components/authorize/provider.js.map +0 -1
- package/dist/components/authorize/repositories/authorize.repository.js.map +0 -1
- package/dist/components/authorize/repositories/index.js.map +0 -1
- package/dist/components/authorize/services/enforcer.service.js.map +0 -1
- package/dist/components/authorize/services/generator.service.js.map +0 -1
- package/dist/components/authorize/services/index.js.map +0 -1
- package/dist/components/crash-report/common/constants.js.map +0 -1
- package/dist/components/crash-report/common/index.js.map +0 -1
- package/dist/components/crash-report/common/keys.js.map +0 -1
- package/dist/components/crash-report/common/types.js.map +0 -1
- package/dist/components/crash-report/component.js.map +0 -1
- package/dist/components/crash-report/index.js.map +0 -1
- package/dist/components/crash-report/providers/index.js.map +0 -1
- package/dist/components/crash-report/providers/provider.js.map +0 -1
- package/dist/components/crash-report/providers/third-parties/base.js.map +0 -1
- package/dist/components/crash-report/providers/third-parties/index.js.map +0 -1
- package/dist/components/crash-report/services/index.js.map +0 -1
- package/dist/components/crash-report/services/mt-crash-report.service.js.map +0 -1
- package/dist/components/grpc/common/constants.js.map +0 -1
- package/dist/components/grpc/common/index.js.map +0 -1
- package/dist/components/grpc/common/keys.js.map +0 -1
- package/dist/components/grpc/common/types.js.map +0 -1
- package/dist/components/grpc/components/index.js.map +0 -1
- package/dist/components/grpc/components/server.component.js.map +0 -1
- package/dist/components/grpc/controllers/base.js.map +0 -1
- package/dist/components/grpc/controllers/index.js.map +0 -1
- package/dist/components/grpc/decorators/index.js.map +0 -1
- package/dist/components/grpc/helpers/grpc-client.js.map +0 -1
- package/dist/components/grpc/helpers/grpc-server.js.map +0 -1
- package/dist/components/grpc/helpers/index.js.map +0 -1
- package/dist/components/grpc/index.js.map +0 -1
- package/dist/components/grpc/persistents/grpc.connector.js.map +0 -1
- package/dist/components/grpc/persistents/grpc.datasource.js.map +0 -1
- package/dist/components/grpc/persistents/grpc.repository.js.map +0 -1
- package/dist/components/grpc/persistents/index.js.map +0 -1
- package/dist/components/health-check/component.js.map +0 -1
- package/dist/components/health-check/index.js.map +0 -1
- package/dist/components/index.js.map +0 -1
- package/dist/components/migration/common/index.js.map +0 -1
- package/dist/components/migration/common/keys.js.map +0 -1
- package/dist/components/migration/common/types.js.map +0 -1
- package/dist/components/migration/component.js.map +0 -1
- package/dist/components/migration/index.js.map +0 -1
- package/dist/components/migration/models/index.js.map +0 -1
- package/dist/components/migration/models/migration.model.js.map +0 -1
- package/dist/components/migration/repositories/index.js.map +0 -1
- package/dist/components/migration/repositories/migration.repository.js.map +0 -1
- package/dist/components/socket-io/common/constants.js.map +0 -1
- package/dist/components/socket-io/common/index.js.map +0 -1
- package/dist/components/socket-io/common/keys.js.map +0 -1
- package/dist/components/socket-io/component.js.map +0 -1
- package/dist/components/socket-io/helpers/index.js.map +0 -1
- package/dist/components/socket-io/helpers/socket-io-client.helper.js.map +0 -1
- package/dist/components/socket-io/helpers/socket-io-server.helper.js.map +0 -1
- package/dist/components/socket-io/index.js.map +0 -1
- package/dist/components/static-asset/common/index.js.map +0 -1
- package/dist/components/static-asset/common/keys.js.map +0 -1
- package/dist/components/static-asset/component.js.map +0 -1
- package/dist/components/static-asset/controllers/asset.controller.js.map +0 -1
- package/dist/components/static-asset/controllers/index.js.map +0 -1
- package/dist/components/static-asset/controllers/resource.controller.js.map +0 -1
- package/dist/components/static-asset/index.js.map +0 -1
- package/dist/datasources/index.js.map +0 -1
- package/dist/datasources/kvmem/datasource.js.map +0 -1
- package/dist/datasources/kvmem/index.js.map +0 -1
- package/dist/datasources/postgres/datasource.js.map +0 -1
- package/dist/datasources/postgres/index.js.map +0 -1
- package/dist/datasources/postgres/types.js.map +0 -1
- package/dist/datasources/redis/connector.js.map +0 -1
- package/dist/datasources/redis/datasource.js.map +0 -1
- package/dist/datasources/redis/index.js.map +0 -1
- package/dist/datasources/redis/types.js.map +0 -1
- package/dist/helpers/application-environment.helper.js.map +0 -1
- package/dist/helpers/cron.helper.js.map +0 -1
- package/dist/helpers/crypto/algorithms/aes.algorithm.js.map +0 -1
- package/dist/helpers/crypto/algorithms/base.algorithm.js.map +0 -1
- package/dist/helpers/crypto/algorithms/index.js.map +0 -1
- package/dist/helpers/crypto/algorithms/rsa.algorithm.js.map +0 -1
- package/dist/helpers/crypto/common/constants.js.map +0 -1
- package/dist/helpers/crypto/common/index.js.map +0 -1
- package/dist/helpers/crypto/common/types.js.map +0 -1
- package/dist/helpers/crypto/index.js.map +0 -1
- package/dist/helpers/database/index.js.map +0 -1
- package/dist/helpers/database/query-builder.helper.js.map +0 -1
- package/dist/helpers/index.js.map +0 -1
- package/dist/helpers/logger/application-logger.js.map +0 -1
- package/dist/helpers/logger/common/index.js.map +0 -1
- package/dist/helpers/logger/common/types.js.map +0 -1
- package/dist/helpers/logger/default-logger.js.map +0 -1
- package/dist/helpers/logger/factory.js.map +0 -1
- package/dist/helpers/logger/index.js.map +0 -1
- package/dist/helpers/logger/transports/dgram.transport.js.map +0 -1
- package/dist/helpers/logger/transports/index.js.map +0 -1
- package/dist/helpers/network/http-request/base-network-request.helper.js.map +0 -1
- package/dist/helpers/network/http-request/fetcher/axios-fetcher.js.map +0 -1
- package/dist/helpers/network/http-request/fetcher/base-fetcher.js.map +0 -1
- package/dist/helpers/network/http-request/fetcher/index.js.map +0 -1
- package/dist/helpers/network/http-request/fetcher/node-fetcher.js.map +0 -1
- package/dist/helpers/network/http-request/index.js.map +0 -1
- package/dist/helpers/network/http-request/types.js.map +0 -1
- package/dist/helpers/network/index.js.map +0 -1
- package/dist/helpers/network/tcp-socket/base-tcp-client.helper.js.map +0 -1
- package/dist/helpers/network/tcp-socket/base-tcp-server.helper.js.map +0 -1
- package/dist/helpers/network/tcp-socket/index.js.map +0 -1
- package/dist/helpers/network/tcp-socket/network-tcp-client.helper.js.map +0 -1
- package/dist/helpers/network/tcp-socket/network-tcp-server.helper.js.map +0 -1
- package/dist/helpers/network/tcp-socket/network-tls-tcp-client.helper.js.map +0 -1
- package/dist/helpers/network/tcp-socket/network-tls-tcp-server.helper.js.map +0 -1
- package/dist/helpers/network/udp-socket/index.js.map +0 -1
- package/dist/helpers/network/udp-socket/network-udp-client.helper.js.map +0 -1
- package/dist/helpers/queue/bullmq.helper.js.map +0 -1
- package/dist/helpers/queue/index.js.map +0 -1
- package/dist/helpers/queue/mqtt.helper.js.map +0 -1
- package/dist/helpers/queue/queue.helper.js.map +0 -1
- package/dist/helpers/redis/default.helper.js.map +0 -1
- package/dist/helpers/redis/index.js.map +0 -1
- package/dist/helpers/redis/redis-cluster.helper.js.map +0 -1
- package/dist/helpers/redis/redis.helper.js.map +0 -1
- package/dist/helpers/redis/types.js.map +0 -1
- package/dist/helpers/storage/di-container.helper.js.map +0 -1
- package/dist/helpers/storage/index.js.map +0 -1
- package/dist/helpers/storage/minio.helper.js.map +0 -1
- package/dist/helpers/testing/common.js.map +0 -1
- package/dist/helpers/testing/describe.js.map +0 -1
- package/dist/helpers/testing/index.js.map +0 -1
- package/dist/helpers/testing/test-case.js.map +0 -1
- package/dist/helpers/testing/test-handler.js.map +0 -1
- package/dist/helpers/testing/test-plan/base.js.map +0 -1
- package/dist/helpers/testing/test-plan/default.js.map +0 -1
- package/dist/helpers/testing/test-plan/index.js.map +0 -1
- package/dist/helpers/testing/types.js.map +0 -1
- package/dist/helpers/worker-thread/base.js.map +0 -1
- package/dist/helpers/worker-thread/index.js.map +0 -1
- package/dist/helpers/worker-thread/types.js.map +0 -1
- package/dist/helpers/worker-thread/worker-bus.js.map +0 -1
- package/dist/helpers/worker-thread/worker-pool.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/interceptors/content-range.interceptor.js.map +0 -1
- package/dist/interceptors/index.js.map +0 -1
- package/dist/middlewares/index.js.map +0 -1
- package/dist/middlewares/request-body-parser.middleware.js.map +0 -1
- package/dist/middlewares/request-spy.middleware.js.map +0 -1
- package/dist/migrations/base-path.js.map +0 -1
- package/dist/migrations/handler.js.map +0 -1
- package/dist/migrations/index.js.map +0 -1
- package/dist/mixins/data-type.mixin.js.map +0 -1
- package/dist/mixins/deprecated/user-audit.mixin.js.map +0 -1
- package/dist/mixins/duplicatable.mixin.js.map +0 -1
- package/dist/mixins/index.js.map +0 -1
- package/dist/mixins/object-search.mixin.js.map +0 -1
- package/dist/mixins/principal.mixin.js.map +0 -1
- package/dist/mixins/soft-delete.mixin.js.map +0 -1
- package/dist/mixins/soft-persistent.mixin.js.map +0 -1
- package/dist/mixins/text-search.mixin.js.map +0 -1
- package/dist/mixins/tz.mixin.js.map +0 -1
- package/dist/mixins/user-audit.mixin.js.map +0 -1
- package/dist/mixins/vector.mixin.js.map +0 -1
- package/dist/utilities/crypto.utility.js.map +0 -1
- package/dist/utilities/date.utility.js.map +0 -1
- package/dist/utilities/error.utility.js.map +0 -1
- package/dist/utilities/index.js.map +0 -1
- package/dist/utilities/model.utility.js.map +0 -1
- package/dist/utilities/parse.utility.js.map +0 -1
- package/dist/utilities/performance.utility.js.map +0 -1
- package/dist/utilities/promise.utility.js.map +0 -1
- package/dist/utilities/query.utility.js.map +0 -1
- package/dist/utilities/request.utility.js.map +0 -1
- package/dist/utilities/url.utility.js.map +0 -1
|
@@ -1,15 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
14
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
15
4
|
};
|
|
@@ -19,34 +8,32 @@ const url_utility_1 = require("../../../../utilities/url.utility");
|
|
|
19
8
|
const axios_1 = __importDefault(require("axios"));
|
|
20
9
|
const node_https_1 = __importDefault(require("node:https"));
|
|
21
10
|
const base_fetcher_1 = require("./base-fetcher");
|
|
22
|
-
// -------------------------------------------------------------
|
|
23
11
|
class AxiosFetcher extends base_fetcher_1.AbstractNetworkFetchableHelper {
|
|
24
12
|
constructor(opts) {
|
|
25
|
-
var _a;
|
|
26
13
|
super({ name: opts.name, variant: 'axios' });
|
|
27
14
|
const { defaultConfigs } = opts;
|
|
28
|
-
|
|
29
|
-
this.worker = axios_1.default.create(
|
|
15
|
+
opts?.logger?.info('Creating new network request worker instance! Name: %s', this.name);
|
|
16
|
+
this.worker = axios_1.default.create({ ...defaultConfigs });
|
|
30
17
|
}
|
|
31
|
-
// -------------------------------------------------------------
|
|
32
|
-
// SEND REQUEST
|
|
33
|
-
// -------------------------------------------------------------
|
|
34
18
|
send(opts, logger) {
|
|
35
|
-
const { url, method = 'get', params = {}, body: data, headers
|
|
36
|
-
const props =
|
|
19
|
+
const { url, method = 'get', params = {}, body: data, headers, ...rest } = opts;
|
|
20
|
+
const props = {
|
|
21
|
+
url,
|
|
37
22
|
method,
|
|
38
23
|
params,
|
|
39
24
|
data,
|
|
40
|
-
headers,
|
|
25
|
+
headers,
|
|
26
|
+
paramsSerializer: { serialize: p => (0, url_utility_1.stringify)(p) },
|
|
27
|
+
...rest,
|
|
28
|
+
};
|
|
41
29
|
const protocol = this.getProtocol(url);
|
|
42
30
|
if (protocol === 'https') {
|
|
43
31
|
props.httpsAgent = new node_https_1.default.Agent({
|
|
44
32
|
rejectUnauthorized: false,
|
|
45
33
|
});
|
|
46
34
|
}
|
|
47
|
-
logger
|
|
35
|
+
logger?.info('[send] URL: %s | Props: %o', url, props);
|
|
48
36
|
return this.worker.request(props);
|
|
49
37
|
}
|
|
50
38
|
}
|
|
51
39
|
exports.AxiosFetcher = AxiosFetcher;
|
|
52
|
-
//# sourceMappingURL=axios-fetcher.js.map
|
|
@@ -3,6 +3,7 @@ export interface IRequestOptions {
|
|
|
3
3
|
url: string;
|
|
4
4
|
params?: Record<string | symbol, any>;
|
|
5
5
|
method?: string;
|
|
6
|
+
timeout?: number;
|
|
6
7
|
[extra: symbol | string]: any;
|
|
7
8
|
}
|
|
8
9
|
export interface IFetchable<V extends TFetcherVariant, RQ extends IRequestOptions, RS extends TFetcherResponse<V>> {
|
|
@@ -1,20 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
-
var t = {};
|
|
4
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
-
t[p] = s[p];
|
|
6
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
-
t[p[i]] = s[p[i]];
|
|
10
|
-
}
|
|
11
|
-
return t;
|
|
12
|
-
};
|
|
13
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
14
3
|
exports.AbstractNetworkFetchableHelper = void 0;
|
|
15
4
|
const HTTP = 'http';
|
|
16
5
|
const HTTPS = 'https';
|
|
17
6
|
class AbstractNetworkFetchableHelper {
|
|
7
|
+
name;
|
|
8
|
+
variant;
|
|
9
|
+
worker;
|
|
18
10
|
constructor(opts) {
|
|
19
11
|
this.name = opts.name;
|
|
20
12
|
this.variant = opts.variant;
|
|
@@ -25,41 +17,25 @@ class AbstractNetworkFetchableHelper {
|
|
|
25
17
|
getWorker() {
|
|
26
18
|
return this.worker;
|
|
27
19
|
}
|
|
28
|
-
// -------------------------------------------------------------
|
|
29
|
-
// GET REQUEST
|
|
30
|
-
// -------------------------------------------------------------
|
|
31
20
|
get(opts, logger) {
|
|
32
|
-
const rest =
|
|
33
|
-
return this.send(
|
|
21
|
+
const { ...rest } = opts;
|
|
22
|
+
return this.send({ ...rest, method: 'get' }, logger);
|
|
34
23
|
}
|
|
35
|
-
// -------------------------------------------------------------
|
|
36
|
-
// POST REQUEST
|
|
37
|
-
// -------------------------------------------------------------
|
|
38
24
|
post(opts, logger) {
|
|
39
|
-
const rest =
|
|
40
|
-
return this.send(
|
|
25
|
+
const { ...rest } = opts;
|
|
26
|
+
return this.send({ ...rest, method: 'post' }, logger);
|
|
41
27
|
}
|
|
42
|
-
// -------------------------------------------------------------
|
|
43
|
-
// PUT REQUEST
|
|
44
|
-
// -------------------------------------------------------------
|
|
45
28
|
put(opts, logger) {
|
|
46
|
-
const rest =
|
|
47
|
-
return this.send(
|
|
29
|
+
const { ...rest } = opts;
|
|
30
|
+
return this.send({ ...rest, method: 'put' }, logger);
|
|
48
31
|
}
|
|
49
|
-
// -------------------------------------------------------------
|
|
50
|
-
// PATCH REQUEST
|
|
51
|
-
// -------------------------------------------------------------
|
|
52
32
|
patch(opts, logger) {
|
|
53
|
-
const rest =
|
|
54
|
-
return this.send(
|
|
33
|
+
const { ...rest } = opts;
|
|
34
|
+
return this.send({ ...rest, method: 'patch' }, logger);
|
|
55
35
|
}
|
|
56
|
-
// -------------------------------------------------------------
|
|
57
|
-
// DELETE REQUEST
|
|
58
|
-
// -------------------------------------------------------------
|
|
59
36
|
delete(opts, logger) {
|
|
60
|
-
const rest =
|
|
61
|
-
return this.send(
|
|
37
|
+
const { ...rest } = opts;
|
|
38
|
+
return this.send({ ...rest, method: 'delete' }, logger);
|
|
62
39
|
}
|
|
63
40
|
}
|
|
64
41
|
exports.AbstractNetworkFetchableHelper = AbstractNetworkFetchableHelper;
|
|
65
|
-
//# sourceMappingURL=base-fetcher.js.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AbstractNetworkFetchableHelper } from './base-fetcher';
|
|
2
|
-
export interface INodeFetchRequestOptions extends RequestInit {
|
|
1
|
+
import { AbstractNetworkFetchableHelper, IRequestOptions } from './base-fetcher';
|
|
2
|
+
export interface INodeFetchRequestOptions extends RequestInit, IRequestOptions {
|
|
3
3
|
url: string;
|
|
4
4
|
params?: Record<string | symbol, any>;
|
|
5
5
|
}
|
|
@@ -3,24 +3,33 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.NodeFetcher = void 0;
|
|
4
4
|
const url_utility_1 = require("../../../../utilities/url.utility");
|
|
5
5
|
const base_fetcher_1 = require("./base-fetcher");
|
|
6
|
-
// -------------------------------------------------------------
|
|
7
6
|
class NodeFetcher extends base_fetcher_1.AbstractNetworkFetchableHelper {
|
|
7
|
+
defaultConfigs;
|
|
8
8
|
constructor(opts) {
|
|
9
|
-
var _a;
|
|
10
9
|
super({ name: opts.name, variant: 'node-fetch' });
|
|
11
10
|
const { name, defaultConfigs } = opts;
|
|
12
11
|
this.name = name;
|
|
13
|
-
|
|
12
|
+
opts?.logger?.info('Creating new network request worker instance! Name: %s', this.name);
|
|
14
13
|
this.defaultConfigs = defaultConfigs;
|
|
15
14
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
15
|
+
async send(opts, logger) {
|
|
16
|
+
const { url, method = 'get', params, body, headers, timeout, signal, ...rest } = opts;
|
|
17
|
+
let timeoutId;
|
|
18
|
+
let abortController;
|
|
19
|
+
if (timeout) {
|
|
20
|
+
abortController = new AbortController();
|
|
21
|
+
timeoutId = setTimeout(() => {
|
|
22
|
+
abortController?.abort();
|
|
23
|
+
}, timeout);
|
|
24
|
+
}
|
|
25
|
+
const requestConfigs = {
|
|
26
|
+
...this.defaultConfigs,
|
|
27
|
+
...rest,
|
|
28
|
+
method,
|
|
22
29
|
body,
|
|
23
|
-
headers
|
|
30
|
+
headers,
|
|
31
|
+
signal: abortController?.signal ?? signal,
|
|
32
|
+
};
|
|
24
33
|
let requestUrl = '';
|
|
25
34
|
const urlParts = [url];
|
|
26
35
|
if (params) {
|
|
@@ -30,9 +39,15 @@ class NodeFetcher extends base_fetcher_1.AbstractNetworkFetchableHelper {
|
|
|
30
39
|
else {
|
|
31
40
|
requestUrl = urlParts.join();
|
|
32
41
|
}
|
|
33
|
-
logger
|
|
34
|
-
|
|
42
|
+
logger?.info('[send] URL: %s | Props: %o | Timeout: %s', url, requestConfigs, timeout);
|
|
43
|
+
try {
|
|
44
|
+
return await fetch(requestUrl, requestConfigs);
|
|
45
|
+
}
|
|
46
|
+
finally {
|
|
47
|
+
if (timeoutId) {
|
|
48
|
+
clearTimeout(timeoutId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
35
51
|
}
|
|
36
52
|
}
|
|
37
53
|
exports.NodeFetcher = NodeFetcher;
|
|
38
|
-
//# sourceMappingURL=node-fetcher.js.map
|
|
@@ -16,4 +16,3 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./fetcher/"), exports);
|
|
18
18
|
__exportStar(require("./base-network-request.helper"), exports);
|
|
19
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -8,28 +8,37 @@ const base_helper_1 = require("../../../base/base.helper");
|
|
|
8
8
|
const isEmpty_1 = __importDefault(require("lodash/isEmpty"));
|
|
9
9
|
const DEFAULT_MAX_RETRY = 5;
|
|
10
10
|
class BaseNetworkTcpClient extends base_helper_1.BaseHelper {
|
|
11
|
+
client;
|
|
12
|
+
options;
|
|
13
|
+
reconnect;
|
|
14
|
+
retry = {
|
|
15
|
+
maxReconnect: DEFAULT_MAX_RETRY,
|
|
16
|
+
currentReconnect: 0,
|
|
17
|
+
};
|
|
18
|
+
reconnectTimeout;
|
|
19
|
+
encoding;
|
|
20
|
+
createClientFn;
|
|
21
|
+
onConnected;
|
|
22
|
+
onData;
|
|
23
|
+
onClosed;
|
|
24
|
+
onError;
|
|
11
25
|
constructor(opts) {
|
|
12
|
-
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
13
26
|
super({
|
|
14
|
-
scope:
|
|
27
|
+
scope: opts.scope ?? opts.identifier ?? BaseNetworkTcpClient.name,
|
|
15
28
|
identifier: opts.identifier,
|
|
16
29
|
});
|
|
17
|
-
this.retry = {
|
|
18
|
-
maxReconnect: DEFAULT_MAX_RETRY,
|
|
19
|
-
currentReconnect: 0,
|
|
20
|
-
};
|
|
21
30
|
this.options = opts.options;
|
|
22
31
|
this.retry = {
|
|
23
|
-
maxReconnect:
|
|
32
|
+
maxReconnect: opts.maxRetry ?? DEFAULT_MAX_RETRY,
|
|
24
33
|
currentReconnect: 0,
|
|
25
34
|
};
|
|
26
35
|
this.createClientFn = opts.createClientFn;
|
|
27
|
-
this.onConnected =
|
|
28
|
-
this.onData =
|
|
29
|
-
this.onClosed =
|
|
30
|
-
this.onError =
|
|
31
|
-
this.reconnect =
|
|
32
|
-
this.encoding = opts
|
|
36
|
+
this.onConnected = opts?.onConnected ?? this.handleConnected;
|
|
37
|
+
this.onData = opts?.onData ?? this.handleData;
|
|
38
|
+
this.onClosed = opts?.onClosed ?? this.handleClosed;
|
|
39
|
+
this.onError = opts?.onError ?? this.handleError;
|
|
40
|
+
this.reconnect = opts?.reconnect ?? false;
|
|
41
|
+
this.encoding = opts?.encoding;
|
|
33
42
|
}
|
|
34
43
|
getClient() {
|
|
35
44
|
return this.client;
|
|
@@ -53,8 +62,7 @@ class BaseNetworkTcpClient extends base_helper_1.BaseHelper {
|
|
|
53
62
|
return;
|
|
54
63
|
}
|
|
55
64
|
this.reconnectTimeout = setTimeout(() => {
|
|
56
|
-
|
|
57
|
-
(_a = this.client) === null || _a === void 0 ? void 0 : _a.destroy();
|
|
65
|
+
this.client?.destroy();
|
|
58
66
|
this.client = null;
|
|
59
67
|
this.logger.info('[handleClosed][%s] Retrying to establish TCP Connection | Options: %j', this.identifier, this.options);
|
|
60
68
|
this.connect({ resetReconnectCounter: false });
|
|
@@ -62,7 +70,6 @@ class BaseNetworkTcpClient extends base_helper_1.BaseHelper {
|
|
|
62
70
|
}, 5000);
|
|
63
71
|
}
|
|
64
72
|
connect(opts) {
|
|
65
|
-
var _a;
|
|
66
73
|
if (this.isConnected()) {
|
|
67
74
|
this.logger.info('[connect][%s] NetworkTcpClient is already initialized!', this.identifier);
|
|
68
75
|
return;
|
|
@@ -72,20 +79,19 @@ class BaseNetworkTcpClient extends base_helper_1.BaseHelper {
|
|
|
72
79
|
return;
|
|
73
80
|
}
|
|
74
81
|
this.logger.info('[connect][%s] New network tcp client | Options: %s', this.identifier, this.options);
|
|
75
|
-
if (opts
|
|
82
|
+
if (opts?.resetReconnectCounter) {
|
|
76
83
|
this.retry.currentReconnect = 0;
|
|
77
84
|
}
|
|
78
85
|
if (this.client !== null && this.client !== undefined) {
|
|
79
|
-
|
|
86
|
+
this.client?.destroy();
|
|
80
87
|
this.client = null;
|
|
81
88
|
}
|
|
82
89
|
this.client = this.createClientFn(this.options, () => {
|
|
83
|
-
var _a;
|
|
84
90
|
if (!this.client) {
|
|
85
91
|
this.logger.error('[createClientFn] Failed to initialize socket client!');
|
|
86
92
|
return;
|
|
87
93
|
}
|
|
88
|
-
|
|
94
|
+
this.onConnected?.({ client: this.client });
|
|
89
95
|
});
|
|
90
96
|
if (this.encoding) {
|
|
91
97
|
this.client.setEncoding(this.encoding);
|
|
@@ -94,24 +100,21 @@ class BaseNetworkTcpClient extends base_helper_1.BaseHelper {
|
|
|
94
100
|
this.onData({ identifier: this.identifier, message });
|
|
95
101
|
});
|
|
96
102
|
this.client.on('close', () => {
|
|
97
|
-
var _a;
|
|
98
103
|
if (!this.client) {
|
|
99
104
|
return;
|
|
100
105
|
}
|
|
101
|
-
|
|
106
|
+
this.onClosed?.({ client: this.client });
|
|
102
107
|
});
|
|
103
108
|
this.client.on('error', error => {
|
|
104
|
-
|
|
105
|
-
(_a = this.onError) === null || _a === void 0 ? void 0 : _a.call(this, error);
|
|
109
|
+
this.onError?.(error);
|
|
106
110
|
});
|
|
107
111
|
}
|
|
108
112
|
disconnect() {
|
|
109
|
-
var _a;
|
|
110
113
|
if (!this.client) {
|
|
111
114
|
this.logger.info('[disconnect][%s] NetworkTcpClient is not initialized yet!', this.identifier);
|
|
112
115
|
return;
|
|
113
116
|
}
|
|
114
|
-
|
|
117
|
+
this.client?.destroy();
|
|
115
118
|
this.client = null;
|
|
116
119
|
clearTimeout(this.reconnectTimeout);
|
|
117
120
|
this.reconnectTimeout = null;
|
|
@@ -130,7 +133,7 @@ class BaseNetworkTcpClient extends base_helper_1.BaseHelper {
|
|
|
130
133
|
return;
|
|
131
134
|
}
|
|
132
135
|
const { payload } = opts;
|
|
133
|
-
if (!
|
|
136
|
+
if (!payload?.length) {
|
|
134
137
|
this.logger.info('[emit][%s] Invalid payload to write to TCP Socket!', this.identifier);
|
|
135
138
|
return;
|
|
136
139
|
}
|
|
@@ -138,4 +141,3 @@ class BaseNetworkTcpClient extends base_helper_1.BaseHelper {
|
|
|
138
141
|
}
|
|
139
142
|
}
|
|
140
143
|
exports.BaseNetworkTcpClient = BaseNetworkTcpClient;
|
|
141
|
-
//# sourceMappingURL=base-tcp-client.helper.js.map
|
|
@@ -10,14 +10,23 @@ const date_utility_1 = require("../../../utilities/date.utility");
|
|
|
10
10
|
const parse_utility_1 = require("../../../utilities/parse.utility");
|
|
11
11
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
12
12
|
class BaseNetworkTcpServer extends base_helper_1.BaseHelper {
|
|
13
|
+
serverOptions = {};
|
|
14
|
+
listenOptions = {};
|
|
15
|
+
authenticateOptions;
|
|
16
|
+
clients;
|
|
17
|
+
server;
|
|
18
|
+
extraEvents;
|
|
19
|
+
createServerFn;
|
|
20
|
+
onServerReady;
|
|
21
|
+
onClientConnected;
|
|
22
|
+
onClientData;
|
|
23
|
+
onClientClose;
|
|
24
|
+
onClientError;
|
|
13
25
|
constructor(opts) {
|
|
14
|
-
var _a, _b, _c;
|
|
15
26
|
super({
|
|
16
|
-
scope:
|
|
27
|
+
scope: opts.scope ?? opts.identifier ?? BaseNetworkTcpServer.name,
|
|
17
28
|
identifier: opts.identifier,
|
|
18
29
|
});
|
|
19
|
-
this.serverOptions = {};
|
|
20
|
-
this.listenOptions = {};
|
|
21
30
|
this.clients = Object.assign({});
|
|
22
31
|
this.serverOptions = opts.serverOptions;
|
|
23
32
|
this.listenOptions = opts.listenOptions;
|
|
@@ -28,7 +37,7 @@ class BaseNetworkTcpServer extends base_helper_1.BaseHelper {
|
|
|
28
37
|
message: 'TCP Server | Invalid authenticate duration | Required duration for authenticateOptions',
|
|
29
38
|
});
|
|
30
39
|
}
|
|
31
|
-
this.extraEvents =
|
|
40
|
+
this.extraEvents = opts.extraEvents ?? {};
|
|
32
41
|
this.createServerFn = opts.createServerFn;
|
|
33
42
|
this.onServerReady = opts.onServerReady;
|
|
34
43
|
this.onClientConnected = opts.onClientConnected;
|
|
@@ -41,29 +50,24 @@ class BaseNetworkTcpServer extends base_helper_1.BaseHelper {
|
|
|
41
50
|
this.onNewConnection({ socket });
|
|
42
51
|
});
|
|
43
52
|
this.server.listen(this.listenOptions, () => {
|
|
44
|
-
var _a;
|
|
45
53
|
this.logger.info('[configure] TCP Socket Server is now listening | Options: %j', this.listenOptions);
|
|
46
|
-
|
|
54
|
+
this.onServerReady?.({ server: this.server });
|
|
47
55
|
});
|
|
48
56
|
}
|
|
49
57
|
onNewConnection(opts) {
|
|
50
|
-
var _a;
|
|
51
58
|
const { socket } = opts;
|
|
52
59
|
const id = (0, parse_utility_1.getUID)();
|
|
53
60
|
socket.on('data', (data) => {
|
|
54
|
-
|
|
55
|
-
(_a = this.onClientData) === null || _a === void 0 ? void 0 : _a.call(this, { id, socket, data });
|
|
61
|
+
this.onClientData?.({ id, socket, data });
|
|
56
62
|
});
|
|
57
63
|
socket.on('error', (error) => {
|
|
58
|
-
var _a;
|
|
59
64
|
this.logger.error('[onClientConnect][error] ID: %s | Error: %s', id, error);
|
|
60
|
-
|
|
65
|
+
this.onClientError?.({ id, socket, error });
|
|
61
66
|
socket.end();
|
|
62
67
|
});
|
|
63
68
|
socket.on('close', (hasError) => {
|
|
64
|
-
var _a;
|
|
65
69
|
this.logger.info('[onClientConnect][close] ID: %s | hasError: %s', id, hasError);
|
|
66
|
-
|
|
70
|
+
this.onClientClose?.({ id, socket });
|
|
67
71
|
this.clients = (0, omit_1.default)(this.clients, [id]);
|
|
68
72
|
});
|
|
69
73
|
for (const extraEvent in this.extraEvents) {
|
|
@@ -82,8 +86,7 @@ class BaseNetworkTcpServer extends base_helper_1.BaseHelper {
|
|
|
82
86
|
},
|
|
83
87
|
};
|
|
84
88
|
this.logger.info('[onClientConnect] New TCP SocketClient | Client: %s | authenticateOptions: %s %s', `${id} - ${socket.remoteAddress} - ${socket.remotePort} - ${socket.remoteFamily}`, this.authenticateOptions.required, this.authenticateOptions.duration);
|
|
85
|
-
|
|
86
|
-
// Check client authentication
|
|
89
|
+
this.onClientConnected?.({ id, socket });
|
|
87
90
|
if (this.authenticateOptions.required &&
|
|
88
91
|
this.authenticateOptions.duration &&
|
|
89
92
|
this.authenticateOptions.duration > 0) {
|
|
@@ -104,8 +107,7 @@ class BaseNetworkTcpServer extends base_helper_1.BaseHelper {
|
|
|
104
107
|
return this.clients;
|
|
105
108
|
}
|
|
106
109
|
getClient(opts) {
|
|
107
|
-
|
|
108
|
-
return (_a = this.clients) === null || _a === void 0 ? void 0 : _a[opts.id];
|
|
110
|
+
return this.clients?.[opts.id];
|
|
109
111
|
}
|
|
110
112
|
getServer() {
|
|
111
113
|
return this.server;
|
|
@@ -145,7 +147,7 @@ class BaseNetworkTcpServer extends base_helper_1.BaseHelper {
|
|
|
145
147
|
this.logger.error('[emit][%s] Client %s NOT WRITABLE', clientId);
|
|
146
148
|
return;
|
|
147
149
|
}
|
|
148
|
-
if (!
|
|
150
|
+
if (!payload?.length) {
|
|
149
151
|
this.logger.info('[emit][%s] Client %s | Invalid payload to write to TCP Socket!', this.identifier, clientId);
|
|
150
152
|
return;
|
|
151
153
|
}
|
|
@@ -153,4 +155,3 @@ class BaseNetworkTcpServer extends base_helper_1.BaseHelper {
|
|
|
153
155
|
}
|
|
154
156
|
}
|
|
155
157
|
exports.BaseNetworkTcpServer = BaseNetworkTcpServer;
|
|
156
|
-
//# sourceMappingURL=base-tcp-server.helper.js.map
|
|
@@ -20,4 +20,3 @@ __exportStar(require("./network-tcp-client.helper"), exports);
|
|
|
20
20
|
__exportStar(require("./network-tcp-server.helper"), exports);
|
|
21
21
|
__exportStar(require("./network-tls-tcp-client.helper"), exports);
|
|
22
22
|
__exportStar(require("./network-tls-tcp-server.helper"), exports);
|
|
23
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -5,7 +5,11 @@ const node_net_1 = require("node:net");
|
|
|
5
5
|
const base_tcp_client_helper_1 = require("./base-tcp-client.helper");
|
|
6
6
|
class NetworkTcpClient extends base_tcp_client_helper_1.BaseNetworkTcpClient {
|
|
7
7
|
constructor(opts) {
|
|
8
|
-
super(
|
|
8
|
+
super({
|
|
9
|
+
...opts,
|
|
10
|
+
scope: NetworkTcpClient.name,
|
|
11
|
+
createClientFn: node_net_1.connect,
|
|
12
|
+
});
|
|
9
13
|
this.options = opts.options;
|
|
10
14
|
}
|
|
11
15
|
static newInstance(opts) {
|
|
@@ -13,4 +17,3 @@ class NetworkTcpClient extends base_tcp_client_helper_1.BaseNetworkTcpClient {
|
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
exports.NetworkTcpClient = NetworkTcpClient;
|
|
16
|
-
//# sourceMappingURL=network-tcp-client.helper.js.map
|
|
@@ -5,11 +5,14 @@ const node_net_1 = require("node:net");
|
|
|
5
5
|
const base_tcp_server_helper_1 = require("./base-tcp-server.helper");
|
|
6
6
|
class NetworkTcpServer extends base_tcp_server_helper_1.BaseNetworkTcpServer {
|
|
7
7
|
constructor(opts) {
|
|
8
|
-
super(
|
|
8
|
+
super({
|
|
9
|
+
...opts,
|
|
10
|
+
scope: NetworkTcpServer.name,
|
|
11
|
+
createServerFn: node_net_1.createServer,
|
|
12
|
+
});
|
|
9
13
|
}
|
|
10
14
|
static newInstance(opts) {
|
|
11
15
|
return new NetworkTcpServer(opts);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
exports.NetworkTcpServer = NetworkTcpServer;
|
|
15
|
-
//# sourceMappingURL=network-tcp-server.helper.js.map
|
|
@@ -5,7 +5,11 @@ const node_tls_1 = require("node:tls");
|
|
|
5
5
|
const base_tcp_client_helper_1 = require("./base-tcp-client.helper");
|
|
6
6
|
class NetworkTlsTcpClient extends base_tcp_client_helper_1.BaseNetworkTcpClient {
|
|
7
7
|
constructor(opts) {
|
|
8
|
-
super(
|
|
8
|
+
super({
|
|
9
|
+
...opts,
|
|
10
|
+
scope: NetworkTlsTcpClient.name,
|
|
11
|
+
createClientFn: node_tls_1.connect,
|
|
12
|
+
});
|
|
9
13
|
this.options = opts.options;
|
|
10
14
|
}
|
|
11
15
|
static newInstance(opts) {
|
|
@@ -13,4 +17,3 @@ class NetworkTlsTcpClient extends base_tcp_client_helper_1.BaseNetworkTcpClient
|
|
|
13
17
|
}
|
|
14
18
|
}
|
|
15
19
|
exports.NetworkTlsTcpClient = NetworkTlsTcpClient;
|
|
16
|
-
//# sourceMappingURL=network-tls-tcp-client.helper.js.map
|
|
@@ -5,11 +5,14 @@ const node_tls_1 = require("node:tls");
|
|
|
5
5
|
const base_tcp_server_helper_1 = require("./base-tcp-server.helper");
|
|
6
6
|
class NetworkTlsTcpServer extends base_tcp_server_helper_1.BaseNetworkTcpServer {
|
|
7
7
|
constructor(opts) {
|
|
8
|
-
super(
|
|
8
|
+
super({
|
|
9
|
+
...opts,
|
|
10
|
+
scope: NetworkTlsTcpServer.name,
|
|
11
|
+
createServerFn: node_tls_1.createServer,
|
|
12
|
+
});
|
|
9
13
|
}
|
|
10
14
|
static newInstance(opts) {
|
|
11
15
|
return new NetworkTlsTcpServer(opts);
|
|
12
16
|
}
|
|
13
17
|
}
|
|
14
18
|
exports.NetworkTlsTcpServer = NetworkTlsTcpServer;
|
|
15
|
-
//# sourceMappingURL=network-tls-tcp-server.helper.js.map
|
|
@@ -7,18 +7,27 @@ exports.NetworkUdpClient = void 0;
|
|
|
7
7
|
const base_helper_1 = require("../../../base/base.helper");
|
|
8
8
|
const node_dgram_1 = __importDefault(require("node:dgram"));
|
|
9
9
|
class NetworkUdpClient extends base_helper_1.BaseHelper {
|
|
10
|
+
host;
|
|
11
|
+
port;
|
|
12
|
+
reuseAddr;
|
|
13
|
+
multicastAddress;
|
|
14
|
+
onConnected;
|
|
15
|
+
onData;
|
|
16
|
+
onClosed;
|
|
17
|
+
onError;
|
|
18
|
+
onBind;
|
|
19
|
+
client;
|
|
10
20
|
constructor(opts) {
|
|
11
|
-
var _a, _b, _c, _d;
|
|
12
21
|
super({ scope: NetworkUdpClient.name, identifier: opts.identifier });
|
|
13
22
|
this.host = opts.host;
|
|
14
23
|
this.port = opts.port;
|
|
15
24
|
this.reuseAddr = opts.reuseAddr;
|
|
16
25
|
this.multicastAddress = opts.multicastAddress;
|
|
17
|
-
this.onConnected =
|
|
18
|
-
this.onData =
|
|
19
|
-
this.onClosed =
|
|
20
|
-
this.onError =
|
|
21
|
-
this.onBind = opts
|
|
26
|
+
this.onConnected = opts?.onConnected ?? this.handleConnected;
|
|
27
|
+
this.onData = opts?.onData ?? this.handleData;
|
|
28
|
+
this.onClosed = opts?.onClosed ?? this.handleClosed;
|
|
29
|
+
this.onError = opts?.onError ?? this.handleError;
|
|
30
|
+
this.onBind = opts?.onBind;
|
|
22
31
|
}
|
|
23
32
|
static newInstance(opts) {
|
|
24
33
|
return new NetworkUdpClient(opts);
|
|
@@ -64,24 +73,19 @@ class NetworkUdpClient extends base_helper_1.BaseHelper {
|
|
|
64
73
|
this.logger.info('[connect][%s] New network udp client | Host: %s | Port: %s | multicastAddress: %j', this.identifier, this.host, this.port, this.multicastAddress);
|
|
65
74
|
this.client = node_dgram_1.default.createSocket({ type: 'udp4', reuseAddr: this.reuseAddr });
|
|
66
75
|
this.client.on('close', () => {
|
|
67
|
-
|
|
68
|
-
(_a = this.onClosed) === null || _a === void 0 ? void 0 : _a.call(this, { identifier: this.identifier, host: this.host, port: this.port });
|
|
76
|
+
this.onClosed?.({ identifier: this.identifier, host: this.host, port: this.port });
|
|
69
77
|
});
|
|
70
78
|
this.client.on('error', error => {
|
|
71
|
-
|
|
72
|
-
(_a = this.onError) === null || _a === void 0 ? void 0 : _a.call(this, { identifier: this.identifier, host: this.host, port: this.port, error });
|
|
79
|
+
this.onError?.({ identifier: this.identifier, host: this.host, port: this.port, error });
|
|
73
80
|
});
|
|
74
81
|
this.client.on('listening', () => {
|
|
75
|
-
|
|
76
|
-
(_a = this.onConnected) === null || _a === void 0 ? void 0 : _a.call(this, { identifier: this.identifier, host: this.host, port: this.port });
|
|
82
|
+
this.onConnected?.({ identifier: this.identifier, host: this.host, port: this.port });
|
|
77
83
|
});
|
|
78
84
|
this.client.on('message', (message, remoteInfo) => {
|
|
79
|
-
|
|
80
|
-
(_a = this.onData) === null || _a === void 0 ? void 0 : _a.call(this, { identifier: this.identifier, message, remoteInfo });
|
|
85
|
+
this.onData?.({ identifier: this.identifier, message, remoteInfo });
|
|
81
86
|
});
|
|
82
87
|
this.client.bind({ port: this.port, address: this.host }, () => {
|
|
83
|
-
|
|
84
|
-
(_a = this.onBind) === null || _a === void 0 ? void 0 : _a.call(this, {
|
|
88
|
+
this.onBind?.({
|
|
85
89
|
identifier: this.identifier,
|
|
86
90
|
socket: this.client,
|
|
87
91
|
host: this.host,
|
|
@@ -92,12 +96,11 @@ class NetworkUdpClient extends base_helper_1.BaseHelper {
|
|
|
92
96
|
});
|
|
93
97
|
}
|
|
94
98
|
disconnect() {
|
|
95
|
-
var _a;
|
|
96
99
|
if (!this.client) {
|
|
97
100
|
this.logger.info('[disconnect][%s] UdpClient is not initialized yet!', this.identifier);
|
|
98
101
|
return;
|
|
99
102
|
}
|
|
100
|
-
|
|
103
|
+
this.client?.close();
|
|
101
104
|
this.client = null;
|
|
102
105
|
this.logger.info('[disconnect][%s] UdpClient is destroyed!', this.identifier);
|
|
103
106
|
}
|
|
@@ -106,4 +109,3 @@ class NetworkUdpClient extends base_helper_1.BaseHelper {
|
|
|
106
109
|
}
|
|
107
110
|
}
|
|
108
111
|
exports.NetworkUdpClient = NetworkUdpClient;
|
|
109
|
-
//# sourceMappingURL=network-udp-client.helper.js.map
|