@blazedpath/commons 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -4
- package/blz-base/health/index.js +215 -0
- package/blz-base/index.js +1466 -0
- package/blz-cache/LruCache.js +44 -0
- package/blz-cache/index.js +29 -0
- package/blz-config/index.js +434 -0
- package/blz-core/index.js +364 -0
- package/blz-cryptography/index.js +54 -0
- package/blz-datetimes/index.js +356 -0
- package/blz-file/example.dat +2545 -0
- package/blz-file/fileService.js +205 -0
- package/blz-file/index.js +94 -0
- package/blz-file/index.test.js +31 -0
- package/blz-file/lab.js +33 -0
- package/blz-hazelcast/index.js +189 -0
- package/blz-hazelcast/lib/credentials.js +25 -0
- package/blz-hazelcast/lib/credentialsFactory.js +12 -0
- package/blz-hazelcast/lib/hazelcastCache.js +234 -0
- package/blz-iterable/index.js +446 -0
- package/blz-json-schema/index.js +11 -0
- package/blz-jwt/index.js +121 -0
- package/blz-kafka/index.js +522 -0
- package/blz-math/index.js +131 -0
- package/blz-mongodb/index.js +326 -0
- package/blz-rds/__test__/scape.test.js +58 -0
- package/blz-rds/blz-rds-executor.js +578 -0
- package/blz-rds/blz-rds-helper.js +310 -0
- package/blz-rds/commands/core/add.js +13 -0
- package/blz-rds/commands/core/and.js +18 -0
- package/blz-rds/commands/core/asc.js +10 -0
- package/blz-rds/commands/core/avg.js +10 -0
- package/blz-rds/commands/core/column-ref.js +8 -0
- package/blz-rds/commands/core/count-distinct.js +10 -0
- package/blz-rds/commands/core/count.js +10 -0
- package/blz-rds/commands/core/decimal.js +8 -0
- package/blz-rds/commands/core/desc.js +10 -0
- package/blz-rds/commands/core/distinct.js +10 -0
- package/blz-rds/commands/core/divide.js +11 -0
- package/blz-rds/commands/core/embedded-exists.js +17 -0
- package/blz-rds/commands/core/embedded-select.js +17 -0
- package/blz-rds/commands/core/equals.js +9 -0
- package/blz-rds/commands/core/false.js +8 -0
- package/blz-rds/commands/core/greater-or-equal.js +9 -0
- package/blz-rds/commands/core/greater.js +9 -0
- package/blz-rds/commands/core/in.js +9 -0
- package/blz-rds/commands/core/integer.js +8 -0
- package/blz-rds/commands/core/is-not-null.js +11 -0
- package/blz-rds/commands/core/is-null-or-value.js +10 -0
- package/blz-rds/commands/core/is-null.js +11 -0
- package/blz-rds/commands/core/less-or-equal.js +9 -0
- package/blz-rds/commands/core/less-unary.js +12 -0
- package/blz-rds/commands/core/less.js +9 -0
- package/blz-rds/commands/core/like.js +12 -0
- package/blz-rds/commands/core/max.js +10 -0
- package/blz-rds/commands/core/min.js +10 -0
- package/blz-rds/commands/core/multiply.js +13 -0
- package/blz-rds/commands/core/not-equals.js +9 -0
- package/blz-rds/commands/core/not-in.js +9 -0
- package/blz-rds/commands/core/not.js +13 -0
- package/blz-rds/commands/core/null.js +8 -0
- package/blz-rds/commands/core/nvl.js +11 -0
- package/blz-rds/commands/core/or.js +13 -0
- package/blz-rds/commands/core/parameter.js +34 -0
- package/blz-rds/commands/core/remainder.js +16 -0
- package/blz-rds/commands/core/string.js +8 -0
- package/blz-rds/commands/core/subtract.js +13 -0
- package/blz-rds/commands/core/sum.js +10 -0
- package/blz-rds/commands/core/true.js +8 -0
- package/blz-rds/commands/core/tuple.js +13 -0
- package/blz-rds/commands/datetimes/add-days.js +11 -0
- package/blz-rds/commands/datetimes/add-hours.js +11 -0
- package/blz-rds/commands/datetimes/add-milliseconds.js +11 -0
- package/blz-rds/commands/datetimes/add-minutes.js +11 -0
- package/blz-rds/commands/datetimes/add-months.js +11 -0
- package/blz-rds/commands/datetimes/add-seconds.js +11 -0
- package/blz-rds/commands/datetimes/add-years.js +11 -0
- package/blz-rds/commands/datetimes/date-diff.js +11 -0
- package/blz-rds/commands/datetimes/date.js +12 -0
- package/blz-rds/commands/datetimes/datetime-diff.js +11 -0
- package/blz-rds/commands/datetimes/datetime.js +15 -0
- package/blz-rds/commands/datetimes/day.js +10 -0
- package/blz-rds/commands/datetimes/hour.js +10 -0
- package/blz-rds/commands/datetimes/millisecond.js +10 -0
- package/blz-rds/commands/datetimes/minute.js +10 -0
- package/blz-rds/commands/datetimes/month-text.js +10 -0
- package/blz-rds/commands/datetimes/month.js +10 -0
- package/blz-rds/commands/datetimes/now.js +9 -0
- package/blz-rds/commands/datetimes/second.js +10 -0
- package/blz-rds/commands/datetimes/subtract-days.js +11 -0
- package/blz-rds/commands/datetimes/subtract-hours.js +11 -0
- package/blz-rds/commands/datetimes/subtract-milliseconds.js +11 -0
- package/blz-rds/commands/datetimes/subtract-minutes.js +11 -0
- package/blz-rds/commands/datetimes/subtract-seconds.js +11 -0
- package/blz-rds/commands/datetimes/time-diff.js +11 -0
- package/blz-rds/commands/datetimes/time.js +13 -0
- package/blz-rds/commands/datetimes/today.js +9 -0
- package/blz-rds/commands/datetimes/week-day-text.js +10 -0
- package/blz-rds/commands/datetimes/week-day.js +10 -0
- package/blz-rds/commands/datetimes/week.js +10 -0
- package/blz-rds/commands/datetimes/year.js +10 -0
- package/blz-rds/commands/math/abs.js +10 -0
- package/blz-rds/commands/math/acos.js +10 -0
- package/blz-rds/commands/math/asin.js +10 -0
- package/blz-rds/commands/math/atan.js +10 -0
- package/blz-rds/commands/math/atan2.js +11 -0
- package/blz-rds/commands/math/ceil.js +10 -0
- package/blz-rds/commands/math/cos.js +10 -0
- package/blz-rds/commands/math/cosh.js +10 -0
- package/blz-rds/commands/math/exp.js +10 -0
- package/blz-rds/commands/math/floor.js +10 -0
- package/blz-rds/commands/math/log.js +18 -0
- package/blz-rds/commands/math/log10.js +10 -0
- package/blz-rds/commands/math/pow.js +11 -0
- package/blz-rds/commands/math/random.js +9 -0
- package/blz-rds/commands/math/round.js +18 -0
- package/blz-rds/commands/math/sign.js +10 -0
- package/blz-rds/commands/math/sin.js +10 -0
- package/blz-rds/commands/math/sinh.js +10 -0
- package/blz-rds/commands/math/sqrt.js +10 -0
- package/blz-rds/commands/math/tan.js +10 -0
- package/blz-rds/commands/math/tanh.js +10 -0
- package/blz-rds/commands/math/trunc.js +18 -0
- package/blz-rds/commands/strings/concat.js +20 -0
- package/blz-rds/commands/strings/contains.js +12 -0
- package/blz-rds/commands/strings/ends-with.js +12 -0
- package/blz-rds/commands/strings/index-of.js +11 -0
- package/blz-rds/commands/strings/is-null-or-empty.js +11 -0
- package/blz-rds/commands/strings/is-null-or-white-space.js +11 -0
- package/blz-rds/commands/strings/join.js +22 -0
- package/blz-rds/commands/strings/last-index-of.js +11 -0
- package/blz-rds/commands/strings/length.js +10 -0
- package/blz-rds/commands/strings/pad-left.js +20 -0
- package/blz-rds/commands/strings/pad-right.js +20 -0
- package/blz-rds/commands/strings/replace.js +12 -0
- package/blz-rds/commands/strings/starts-with.js +12 -0
- package/blz-rds/commands/strings/substring.js +12 -0
- package/blz-rds/commands/strings/to-lower.js +10 -0
- package/blz-rds/commands/strings/to-upper.js +10 -0
- package/blz-rds/commands/strings/trim-end.js +10 -0
- package/blz-rds/commands/strings/trim-start.js +10 -0
- package/blz-rds/commands/strings/trim.js +10 -0
- package/blz-rds/index.js +744 -0
- package/blz-rds-mysql/base.js +857 -0
- package/blz-rds-mysql/connection-manager.js +129 -0
- package/blz-rds-mysql/execute-bulk-insert.js +35 -0
- package/blz-rds-mysql/execute-bulk-merge.js +45 -0
- package/blz-rds-mysql/execute-non-query.js +34 -0
- package/blz-rds-mysql/execute-query.js +50 -0
- package/blz-rds-mysql/index.js +41 -0
- package/blz-rds-mysql/stored-procedure.js +207 -0
- package/blz-rds-mysqlx/base.js +846 -0
- package/blz-rds-mysqlx/connection-manager.js +141 -0
- package/blz-rds-mysqlx/execute-bulk-insert.js +35 -0
- package/blz-rds-mysqlx/execute-bulk-merge.js +45 -0
- package/blz-rds-mysqlx/execute-non-query.js +29 -0
- package/blz-rds-mysqlx/execute-query.js +39 -0
- package/blz-rds-mysqlx/index.js +41 -0
- package/blz-rds-mysqlx/stored-procedure.js +179 -0
- package/blz-rds-oracle/index.js +539 -0
- package/blz-rds-postgres/base.js +861 -0
- package/blz-rds-postgres/connection-manager.js +225 -0
- package/blz-rds-postgres/execute-bulk-insert.js +81 -0
- package/blz-rds-postgres/execute-bulk-merge.js +93 -0
- package/blz-rds-postgres/execute-non-query.js +23 -0
- package/blz-rds-postgres/execute-query.js +37 -0
- package/blz-rds-postgres/index.js +41 -0
- package/blz-rds-postgres/result-set.js +51 -0
- package/blz-rds-postgres/stored-procedure.js +116 -0
- package/blz-redis/index.js +217 -0
- package/blz-redis/lib/redisCache.js +265 -0
- package/blz-regex/index.js +25 -0
- package/blz-security/.eslintrc.js +15 -0
- package/blz-security/__test__/AuthorizationKpn.yaml +1149 -0
- package/blz-security/__test__/FinancingSetting.yaml +177 -0
- package/blz-security/__test__/KpnConfigPortal.yaml +330 -0
- package/blz-security/__test__/OrderManagement.yaml +5190 -0
- package/blz-security/__test__/Security.yaml +128 -0
- package/blz-security/__test__/autorization.test.js +105 -0
- package/blz-security/__test__/autorizationKpn.test.js +42 -0
- package/blz-security/__test__/orderManagement.test.js +26 -0
- package/blz-security/__test__/secureUrl.test.js +79 -0
- package/blz-security/__test__/solveMergeRule.test.js +109 -0
- package/blz-security/__test__/sqlInjectionGuard.test.js +203 -0
- package/blz-security/__test__/xssGuard.test.js +204 -0
- package/blz-security/authorizationService.js +537 -0
- package/blz-security/config/global.js +8 -0
- package/blz-security/config/welcome +8 -0
- package/blz-security/doc/README.md +75 -0
- package/blz-security/filescanner/index.js +46 -0
- package/blz-security/helpers/consts.js +229 -0
- package/blz-security/helpers/utils.js +267 -0
- package/blz-security/implementations/cache.js +90 -0
- package/blz-security/implementations/oidc.js +404 -0
- package/blz-security/implementations/pkceCacheStore.js +23 -0
- package/blz-security/implementations/saml.js +10 -0
- package/blz-security/implementations/uma.js +63 -0
- package/blz-security/implementations/webAuthn.js +9 -0
- package/blz-security/implementations/wstg.js +72 -0
- package/blz-security/index.js +77 -0
- package/blz-security/lab/index.js +43 -0
- package/blz-security/middleware/HapiServerAzureAd.js +681 -0
- package/blz-security/middleware/HapiServerKeycloak.js +876 -0
- package/blz-security/middleware/HapiServerSimToken.js +286 -0
- package/blz-security/middleware/hapi.js +555 -0
- package/blz-security/middleware/hapiServer.js +1008 -0
- package/blz-security/navigationMemoryRepository.js +15 -0
- package/blz-security/navigationMongoDbRepository.js +73 -0
- package/blz-security/secureUrlService.js +47 -0
- package/blz-security/securityService.js +413 -0
- package/blz-security/sqlInjectionGuard.js +162 -0
- package/blz-security/templates/forbidden.html +0 -0
- package/blz-security/templates/session-iframe-azure-ad.html +7 -0
- package/blz-security/templates/session-iframe.html +73 -0
- package/blz-security/templates/unauthorized.html +1 -0
- package/blz-security/xssGuard.js +87 -0
- package/blz-strings/index.js +167 -0
- package/blz-uuid/index.js +7 -0
- package/blz-yaml/index.js +19 -0
- package/index.js +84 -0
- package/package.json +40 -53
- package/process-managers/index.js +422 -0
- package/dist/blz-base/health/index.d.ts +0 -1
- package/dist/blz-base/health/index.js +0 -1
- package/dist/blz-base/index.d.ts +0 -108
- package/dist/blz-base/index.js +0 -1
- package/dist/blz-cache/LruCache.d.ts +0 -31
- package/dist/blz-cache/LruCache.js +0 -1
- package/dist/blz-cache/index.d.ts +0 -2
- package/dist/blz-cache/index.js +0 -1
- package/dist/blz-config/index.d.ts +0 -16
- package/dist/blz-config/index.js +0 -1
- package/dist/blz-core/index.d.ts +0 -32
- package/dist/blz-core/index.js +0 -1
- package/dist/blz-cryptography/index.d.ts +0 -2
- package/dist/blz-cryptography/index.js +0 -1
- package/dist/blz-datetimes/index.d.ts +0 -35
- package/dist/blz-datetimes/index.js +0 -1
- package/dist/blz-file/fileService.d.ts +0 -25
- package/dist/blz-file/fileService.js +0 -1
- package/dist/blz-file/index.d.ts +0 -2
- package/dist/blz-file/index.js +0 -1
- package/dist/blz-file/index.test.js +0 -1
- package/dist/blz-file/lab.js +0 -1
- package/dist/blz-hazelcast/index.d.ts +0 -25
- package/dist/blz-hazelcast/index.js +0 -1
- package/dist/blz-hazelcast/lib/credentials.d.ts +0 -10
- package/dist/blz-hazelcast/lib/credentials.js +0 -1
- package/dist/blz-hazelcast/lib/credentialsFactory.d.ts +0 -1
- package/dist/blz-hazelcast/lib/credentialsFactory.js +0 -1
- package/dist/blz-hazelcast/lib/hazelcastCache.d.ts +0 -27
- package/dist/blz-hazelcast/lib/hazelcastCache.js +0 -1
- package/dist/blz-iterable/index.d.ts +0 -49
- package/dist/blz-iterable/index.js +0 -1
- package/dist/blz-json-schema/index.d.ts +0 -1
- package/dist/blz-json-schema/index.js +0 -1
- package/dist/blz-jwt/index.d.ts +0 -12
- package/dist/blz-jwt/index.js +0 -1
- package/dist/blz-kafka/index.d.ts +0 -9
- package/dist/blz-kafka/index.js +0 -1
- package/dist/blz-math/index.d.ts +0 -22
- package/dist/blz-math/index.js +0 -1
- package/dist/blz-mongodb/index.d.ts +0 -28
- package/dist/blz-mongodb/index.js +0 -1
- package/dist/blz-rds/__test__/scape.test.js +0 -1
- package/dist/blz-rds/blz-rds-executor.d.ts +0 -4
- package/dist/blz-rds/blz-rds-executor.js +0 -1
- package/dist/blz-rds/blz-rds-helper.d.ts +0 -5
- package/dist/blz-rds/blz-rds-helper.js +0 -1
- package/dist/blz-rds/commands/core/add.d.ts +0 -2
- package/dist/blz-rds/commands/core/add.js +0 -1
- package/dist/blz-rds/commands/core/and.d.ts +0 -3
- package/dist/blz-rds/commands/core/and.js +0 -1
- package/dist/blz-rds/commands/core/asc.d.ts +0 -2
- package/dist/blz-rds/commands/core/asc.js +0 -1
- package/dist/blz-rds/commands/core/avg.d.ts +0 -2
- package/dist/blz-rds/commands/core/avg.js +0 -1
- package/dist/blz-rds/commands/core/column-ref.d.ts +0 -2
- package/dist/blz-rds/commands/core/column-ref.js +0 -1
- package/dist/blz-rds/commands/core/count-distinct.d.ts +0 -2
- package/dist/blz-rds/commands/core/count-distinct.js +0 -1
- package/dist/blz-rds/commands/core/count.d.ts +0 -2
- package/dist/blz-rds/commands/core/count.js +0 -1
- package/dist/blz-rds/commands/core/decimal.d.ts +0 -2
- package/dist/blz-rds/commands/core/decimal.js +0 -1
- package/dist/blz-rds/commands/core/desc.d.ts +0 -2
- package/dist/blz-rds/commands/core/desc.js +0 -1
- package/dist/blz-rds/commands/core/distinct.d.ts +0 -2
- package/dist/blz-rds/commands/core/distinct.js +0 -1
- package/dist/blz-rds/commands/core/divide.d.ts +0 -2
- package/dist/blz-rds/commands/core/divide.js +0 -1
- package/dist/blz-rds/commands/core/embedded-exists.d.ts +0 -3
- package/dist/blz-rds/commands/core/embedded-exists.js +0 -1
- package/dist/blz-rds/commands/core/embedded-select.d.ts +0 -2
- package/dist/blz-rds/commands/core/embedded-select.js +0 -1
- package/dist/blz-rds/commands/core/equals.d.ts +0 -3
- package/dist/blz-rds/commands/core/equals.js +0 -1
- package/dist/blz-rds/commands/core/false.d.ts +0 -2
- package/dist/blz-rds/commands/core/false.js +0 -1
- package/dist/blz-rds/commands/core/greater-or-equal.d.ts +0 -3
- package/dist/blz-rds/commands/core/greater-or-equal.js +0 -1
- package/dist/blz-rds/commands/core/greater.d.ts +0 -3
- package/dist/blz-rds/commands/core/greater.js +0 -1
- package/dist/blz-rds/commands/core/in.d.ts +0 -3
- package/dist/blz-rds/commands/core/in.js +0 -1
- package/dist/blz-rds/commands/core/integer.d.ts +0 -2
- package/dist/blz-rds/commands/core/integer.js +0 -1
- package/dist/blz-rds/commands/core/is-not-null.d.ts +0 -3
- package/dist/blz-rds/commands/core/is-not-null.js +0 -1
- package/dist/blz-rds/commands/core/is-null-or-value.d.ts +0 -3
- package/dist/blz-rds/commands/core/is-null-or-value.js +0 -1
- package/dist/blz-rds/commands/core/is-null.d.ts +0 -3
- package/dist/blz-rds/commands/core/is-null.js +0 -1
- package/dist/blz-rds/commands/core/less-or-equal.d.ts +0 -3
- package/dist/blz-rds/commands/core/less-or-equal.js +0 -1
- package/dist/blz-rds/commands/core/less-unary.d.ts +0 -2
- package/dist/blz-rds/commands/core/less-unary.js +0 -1
- package/dist/blz-rds/commands/core/less.d.ts +0 -3
- package/dist/blz-rds/commands/core/less.js +0 -1
- package/dist/blz-rds/commands/core/like.d.ts +0 -3
- package/dist/blz-rds/commands/core/like.js +0 -1
- package/dist/blz-rds/commands/core/max.d.ts +0 -2
- package/dist/blz-rds/commands/core/max.js +0 -1
- package/dist/blz-rds/commands/core/min.d.ts +0 -2
- package/dist/blz-rds/commands/core/min.js +0 -1
- package/dist/blz-rds/commands/core/multiply.d.ts +0 -2
- package/dist/blz-rds/commands/core/multiply.js +0 -1
- package/dist/blz-rds/commands/core/not-equals.d.ts +0 -3
- package/dist/blz-rds/commands/core/not-equals.js +0 -1
- package/dist/blz-rds/commands/core/not-in.d.ts +0 -3
- package/dist/blz-rds/commands/core/not-in.js +0 -1
- package/dist/blz-rds/commands/core/not.d.ts +0 -3
- package/dist/blz-rds/commands/core/not.js +0 -1
- package/dist/blz-rds/commands/core/null.d.ts +0 -2
- package/dist/blz-rds/commands/core/null.js +0 -1
- package/dist/blz-rds/commands/core/nvl.d.ts +0 -2
- package/dist/blz-rds/commands/core/nvl.js +0 -1
- package/dist/blz-rds/commands/core/or.d.ts +0 -3
- package/dist/blz-rds/commands/core/or.js +0 -1
- package/dist/blz-rds/commands/core/parameter.d.ts +0 -2
- package/dist/blz-rds/commands/core/parameter.js +0 -1
- package/dist/blz-rds/commands/core/remainder.d.ts +0 -2
- package/dist/blz-rds/commands/core/remainder.js +0 -1
- package/dist/blz-rds/commands/core/string.d.ts +0 -2
- package/dist/blz-rds/commands/core/string.js +0 -1
- package/dist/blz-rds/commands/core/subtract.d.ts +0 -2
- package/dist/blz-rds/commands/core/subtract.js +0 -1
- package/dist/blz-rds/commands/core/sum.d.ts +0 -2
- package/dist/blz-rds/commands/core/sum.js +0 -1
- package/dist/blz-rds/commands/core/true.d.ts +0 -2
- package/dist/blz-rds/commands/core/true.js +0 -1
- package/dist/blz-rds/commands/core/tuple.d.ts +0 -2
- package/dist/blz-rds/commands/core/tuple.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-days.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-days.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-hours.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-hours.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-milliseconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-milliseconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-minutes.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-minutes.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-months.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-months.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-seconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-seconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-years.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-years.js +0 -1
- package/dist/blz-rds/commands/datetimes/date-diff.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/date-diff.js +0 -1
- package/dist/blz-rds/commands/datetimes/date.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/date.js +0 -1
- package/dist/blz-rds/commands/datetimes/datetime-diff.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/datetime-diff.js +0 -1
- package/dist/blz-rds/commands/datetimes/datetime.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/datetime.js +0 -1
- package/dist/blz-rds/commands/datetimes/day.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/day.js +0 -1
- package/dist/blz-rds/commands/datetimes/hour.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/hour.js +0 -1
- package/dist/blz-rds/commands/datetimes/millisecond.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/millisecond.js +0 -1
- package/dist/blz-rds/commands/datetimes/minute.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/minute.js +0 -1
- package/dist/blz-rds/commands/datetimes/month-text.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/month-text.js +0 -1
- package/dist/blz-rds/commands/datetimes/month.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/month.js +0 -1
- package/dist/blz-rds/commands/datetimes/now.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/now.js +0 -1
- package/dist/blz-rds/commands/datetimes/second.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/second.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-days.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-days.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-hours.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-hours.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-minutes.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-minutes.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-seconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-seconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/time-diff.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/time-diff.js +0 -1
- package/dist/blz-rds/commands/datetimes/time.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/time.js +0 -1
- package/dist/blz-rds/commands/datetimes/today.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/today.js +0 -1
- package/dist/blz-rds/commands/datetimes/week-day-text.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/week-day-text.js +0 -1
- package/dist/blz-rds/commands/datetimes/week-day.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/week-day.js +0 -1
- package/dist/blz-rds/commands/datetimes/week.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/week.js +0 -1
- package/dist/blz-rds/commands/datetimes/year.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/year.js +0 -1
- package/dist/blz-rds/commands/math/abs.d.ts +0 -2
- package/dist/blz-rds/commands/math/abs.js +0 -1
- package/dist/blz-rds/commands/math/acos.d.ts +0 -2
- package/dist/blz-rds/commands/math/acos.js +0 -1
- package/dist/blz-rds/commands/math/asin.d.ts +0 -2
- package/dist/blz-rds/commands/math/asin.js +0 -1
- package/dist/blz-rds/commands/math/atan.d.ts +0 -2
- package/dist/blz-rds/commands/math/atan.js +0 -1
- package/dist/blz-rds/commands/math/atan2.d.ts +0 -2
- package/dist/blz-rds/commands/math/atan2.js +0 -1
- package/dist/blz-rds/commands/math/ceil.d.ts +0 -2
- package/dist/blz-rds/commands/math/ceil.js +0 -1
- package/dist/blz-rds/commands/math/cos.d.ts +0 -2
- package/dist/blz-rds/commands/math/cos.js +0 -1
- package/dist/blz-rds/commands/math/cosh.d.ts +0 -2
- package/dist/blz-rds/commands/math/cosh.js +0 -1
- package/dist/blz-rds/commands/math/exp.d.ts +0 -2
- package/dist/blz-rds/commands/math/exp.js +0 -1
- package/dist/blz-rds/commands/math/floor.d.ts +0 -2
- package/dist/blz-rds/commands/math/floor.js +0 -1
- package/dist/blz-rds/commands/math/log.d.ts +0 -2
- package/dist/blz-rds/commands/math/log.js +0 -1
- package/dist/blz-rds/commands/math/log10.d.ts +0 -2
- package/dist/blz-rds/commands/math/log10.js +0 -1
- package/dist/blz-rds/commands/math/pow.d.ts +0 -2
- package/dist/blz-rds/commands/math/pow.js +0 -1
- package/dist/blz-rds/commands/math/random.d.ts +0 -2
- package/dist/blz-rds/commands/math/random.js +0 -1
- package/dist/blz-rds/commands/math/round.d.ts +0 -2
- package/dist/blz-rds/commands/math/round.js +0 -1
- package/dist/blz-rds/commands/math/sign.d.ts +0 -2
- package/dist/blz-rds/commands/math/sign.js +0 -1
- package/dist/blz-rds/commands/math/sin.d.ts +0 -2
- package/dist/blz-rds/commands/math/sin.js +0 -1
- package/dist/blz-rds/commands/math/sinh.d.ts +0 -2
- package/dist/blz-rds/commands/math/sinh.js +0 -1
- package/dist/blz-rds/commands/math/sqrt.d.ts +0 -2
- package/dist/blz-rds/commands/math/sqrt.js +0 -1
- package/dist/blz-rds/commands/math/tan.d.ts +0 -2
- package/dist/blz-rds/commands/math/tan.js +0 -1
- package/dist/blz-rds/commands/math/tanh.d.ts +0 -2
- package/dist/blz-rds/commands/math/tanh.js +0 -1
- package/dist/blz-rds/commands/math/trunc.d.ts +0 -2
- package/dist/blz-rds/commands/math/trunc.js +0 -1
- package/dist/blz-rds/commands/strings/concat.d.ts +0 -2
- package/dist/blz-rds/commands/strings/concat.js +0 -1
- package/dist/blz-rds/commands/strings/contains.d.ts +0 -3
- package/dist/blz-rds/commands/strings/contains.js +0 -1
- package/dist/blz-rds/commands/strings/ends-with.d.ts +0 -3
- package/dist/blz-rds/commands/strings/ends-with.js +0 -1
- package/dist/blz-rds/commands/strings/index-of.d.ts +0 -2
- package/dist/blz-rds/commands/strings/index-of.js +0 -1
- package/dist/blz-rds/commands/strings/is-null-or-empty.d.ts +0 -3
- package/dist/blz-rds/commands/strings/is-null-or-empty.js +0 -1
- package/dist/blz-rds/commands/strings/is-null-or-white-space.d.ts +0 -3
- package/dist/blz-rds/commands/strings/is-null-or-white-space.js +0 -1
- package/dist/blz-rds/commands/strings/join.d.ts +0 -2
- package/dist/blz-rds/commands/strings/join.js +0 -1
- package/dist/blz-rds/commands/strings/last-index-of.d.ts +0 -2
- package/dist/blz-rds/commands/strings/last-index-of.js +0 -1
- package/dist/blz-rds/commands/strings/length.d.ts +0 -2
- package/dist/blz-rds/commands/strings/length.js +0 -1
- package/dist/blz-rds/commands/strings/pad-left.d.ts +0 -2
- package/dist/blz-rds/commands/strings/pad-left.js +0 -1
- package/dist/blz-rds/commands/strings/pad-right.d.ts +0 -2
- package/dist/blz-rds/commands/strings/pad-right.js +0 -1
- package/dist/blz-rds/commands/strings/replace.d.ts +0 -2
- package/dist/blz-rds/commands/strings/replace.js +0 -1
- package/dist/blz-rds/commands/strings/starts-with.d.ts +0 -3
- package/dist/blz-rds/commands/strings/starts-with.js +0 -1
- package/dist/blz-rds/commands/strings/substring.d.ts +0 -2
- package/dist/blz-rds/commands/strings/substring.js +0 -1
- package/dist/blz-rds/commands/strings/to-lower.d.ts +0 -2
- package/dist/blz-rds/commands/strings/to-lower.js +0 -1
- package/dist/blz-rds/commands/strings/to-upper.d.ts +0 -2
- package/dist/blz-rds/commands/strings/to-upper.js +0 -1
- package/dist/blz-rds/commands/strings/trim-end.d.ts +0 -2
- package/dist/blz-rds/commands/strings/trim-end.js +0 -1
- package/dist/blz-rds/commands/strings/trim-start.d.ts +0 -2
- package/dist/blz-rds/commands/strings/trim-start.js +0 -1
- package/dist/blz-rds/commands/strings/trim.d.ts +0 -2
- package/dist/blz-rds/commands/strings/trim.js +0 -1
- package/dist/blz-rds/index.d.ts +0 -53
- package/dist/blz-rds/index.js +0 -1
- package/dist/blz-rds-mysql/base.d.ts +0 -83
- package/dist/blz-rds-mysql/base.js +0 -1
- package/dist/blz-rds-mysql/connection-manager.d.ts +0 -8
- package/dist/blz-rds-mysql/connection-manager.js +0 -1
- package/dist/blz-rds-mysql/execute-bulk-insert.d.ts +0 -2
- package/dist/blz-rds-mysql/execute-bulk-insert.js +0 -1
- package/dist/blz-rds-mysql/execute-bulk-merge.d.ts +0 -2
- package/dist/blz-rds-mysql/execute-bulk-merge.js +0 -1
- package/dist/blz-rds-mysql/execute-non-query.d.ts +0 -14
- package/dist/blz-rds-mysql/execute-non-query.js +0 -1
- package/dist/blz-rds-mysql/execute-query.d.ts +0 -11
- package/dist/blz-rds-mysql/execute-query.js +0 -1
- package/dist/blz-rds-mysql/index.d.ts +0 -9
- package/dist/blz-rds-mysql/index.js +0 -1
- package/dist/blz-rds-mysql/stored-procedure.d.ts +0 -19
- package/dist/blz-rds-mysql/stored-procedure.js +0 -1
- package/dist/blz-rds-mysqlx/base.d.ts +0 -83
- package/dist/blz-rds-mysqlx/base.js +0 -1
- package/dist/blz-rds-mysqlx/connection-manager.d.ts +0 -6
- package/dist/blz-rds-mysqlx/connection-manager.js +0 -1
- package/dist/blz-rds-mysqlx/execute-bulk-insert.d.ts +0 -2
- package/dist/blz-rds-mysqlx/execute-bulk-insert.js +0 -1
- package/dist/blz-rds-mysqlx/execute-bulk-merge.d.ts +0 -2
- package/dist/blz-rds-mysqlx/execute-bulk-merge.js +0 -1
- package/dist/blz-rds-mysqlx/execute-non-query.d.ts +0 -4
- package/dist/blz-rds-mysqlx/execute-non-query.js +0 -1
- package/dist/blz-rds-mysqlx/execute-query.d.ts +0 -7
- package/dist/blz-rds-mysqlx/execute-query.js +0 -1
- package/dist/blz-rds-mysqlx/index.d.ts +0 -9
- package/dist/blz-rds-mysqlx/index.js +0 -1
- package/dist/blz-rds-mysqlx/stored-procedure.d.ts +0 -20
- package/dist/blz-rds-mysqlx/stored-procedure.js +0 -1
- package/dist/blz-rds-oracle/index.d.ts +0 -25
- package/dist/blz-rds-oracle/index.js +0 -1
- package/dist/blz-rds-postgres/base.d.ts +0 -94
- package/dist/blz-rds-postgres/base.js +0 -1
- package/dist/blz-rds-postgres/connection-manager.d.ts +0 -6
- package/dist/blz-rds-postgres/connection-manager.js +0 -1
- package/dist/blz-rds-postgres/execute-bulk-insert.d.ts +0 -5
- package/dist/blz-rds-postgres/execute-bulk-insert.js +0 -1
- package/dist/blz-rds-postgres/execute-bulk-merge.d.ts +0 -4
- package/dist/blz-rds-postgres/execute-bulk-merge.js +0 -1
- package/dist/blz-rds-postgres/execute-non-query.d.ts +0 -12
- package/dist/blz-rds-postgres/execute-non-query.js +0 -1
- package/dist/blz-rds-postgres/execute-query.d.ts +0 -4
- package/dist/blz-rds-postgres/execute-query.js +0 -1
- package/dist/blz-rds-postgres/index.d.ts +0 -9
- package/dist/blz-rds-postgres/index.js +0 -1
- package/dist/blz-rds-postgres/result-set.js +0 -1
- package/dist/blz-rds-postgres/stored-procedure.d.ts +0 -19
- package/dist/blz-rds-postgres/stored-procedure.js +0 -1
- package/dist/blz-redis/index.d.ts +0 -31
- package/dist/blz-redis/index.js +0 -1
- package/dist/blz-redis/lib/redisCache.d.ts +0 -33
- package/dist/blz-redis/lib/redisCache.js +0 -1
- package/dist/blz-regex/index.d.ts +0 -3
- package/dist/blz-regex/index.js +0 -1
- package/dist/blz-security/__test__/autorization.test.js +0 -1
- package/dist/blz-security/__test__/autorizationKpn.test.js +0 -1
- package/dist/blz-security/__test__/orderManagement.test.js +0 -1
- package/dist/blz-security/__test__/secureUrl.test.js +0 -1
- package/dist/blz-security/__test__/solveMergeRule.test.js +0 -1
- package/dist/blz-security/__test__/sqlInjectionGuard.test.js +0 -1
- package/dist/blz-security/__test__/xssGuard.test.js +0 -1
- package/dist/blz-security/authorizationService.d.ts +0 -42
- package/dist/blz-security/authorizationService.js +0 -2
- package/dist/blz-security/config/global.js +0 -1
- package/dist/blz-security/filescanner/index.d.ts +0 -24
- package/dist/blz-security/filescanner/index.js +0 -1
- package/dist/blz-security/helpers/consts.d.ts +0 -28
- package/dist/blz-security/helpers/consts.js +0 -1
- package/dist/blz-security/helpers/utils.d.ts +0 -82
- package/dist/blz-security/helpers/utils.js +0 -1
- package/dist/blz-security/implementations/cache.d.ts +0 -58
- package/dist/blz-security/implementations/cache.js +0 -1
- package/dist/blz-security/implementations/oidc.d.ts +0 -100
- package/dist/blz-security/implementations/oidc.js +0 -1
- package/dist/blz-security/implementations/pkceCacheStore.d.ts +0 -2
- package/dist/blz-security/implementations/pkceCacheStore.js +0 -1
- package/dist/blz-security/implementations/saml.js +0 -1
- package/dist/blz-security/implementations/uma.d.ts +0 -31
- package/dist/blz-security/implementations/uma.js +0 -1
- package/dist/blz-security/implementations/webAuthn.js +0 -1
- package/dist/blz-security/implementations/wstg.js +0 -1
- package/dist/blz-security/index.d.ts +0 -4
- package/dist/blz-security/index.js +0 -2
- package/dist/blz-security/lab/index.js +0 -1
- package/dist/blz-security/middleware/HapiServerAzureAd.d.ts +0 -26
- package/dist/blz-security/middleware/HapiServerAzureAd.js +0 -1
- package/dist/blz-security/middleware/HapiServerKeycloak.d.ts +0 -47
- package/dist/blz-security/middleware/HapiServerKeycloak.js +0 -1
- package/dist/blz-security/middleware/HapiServerSimToken.d.ts +0 -13
- package/dist/blz-security/middleware/HapiServerSimToken.js +0 -1
- package/dist/blz-security/middleware/hapi.d.ts +0 -14
- package/dist/blz-security/middleware/hapi.js +0 -1
- package/dist/blz-security/middleware/hapiServer.js +0 -1
- package/dist/blz-security/navigationMemoryRepository.d.ts +0 -6
- package/dist/blz-security/navigationMemoryRepository.js +0 -1
- package/dist/blz-security/navigationMongoDbRepository.d.ts +0 -15
- package/dist/blz-security/navigationMongoDbRepository.js +0 -1
- package/dist/blz-security/secureUrlService.d.ts +0 -7
- package/dist/blz-security/secureUrlService.js +0 -1
- package/dist/blz-security/securityService.d.ts +0 -72
- package/dist/blz-security/securityService.js +0 -1
- package/dist/blz-security/sqlInjectionGuard.d.ts +0 -37
- package/dist/blz-security/sqlInjectionGuard.js +0 -1
- package/dist/blz-security/xssGuard.d.ts +0 -14
- package/dist/blz-security/xssGuard.js +0 -1
- package/dist/blz-strings/index.d.ts +0 -42
- package/dist/blz-strings/index.js +0 -1
- package/dist/blz-uuid/index.d.ts +0 -1
- package/dist/blz-uuid/index.js +0 -1
- package/dist/blz-yaml/index.d.ts +0 -2
- package/dist/blz-yaml/index.js +0 -1
- package/dist/index.d.ts +0 -34
- package/dist/index.js +0 -1
- package/dist/process-managers/index.d.ts +0 -25
- package/dist/process-managers/index.js +0 -1
- /package/{dist/blz-rds-mysql → blz-rds-mysql}/syntaxis.json +0 -0
- /package/{dist/blz-rds-mysqlx → blz-rds-mysqlx}/syntaxis.json +0 -0
- /package/{dist/blz-rds-oracle → blz-rds-oracle}/syntaxis.json +0 -0
- /package/{dist/blz-rds-postgres → blz-rds-postgres}/syntaxis.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/ConfigurationAdmin.agent.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/frontend.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/result.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/resultOnWeb.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/rules.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/securityRules.json +0 -0
|
@@ -0,0 +1,217 @@
|
|
|
1
|
+
const redisCache = require('./lib/redisCache.js');
|
|
2
|
+
const fs = require('fs-extra');
|
|
3
|
+
|
|
4
|
+
// Redis Client cache
|
|
5
|
+
let redisClients = {};
|
|
6
|
+
|
|
7
|
+
// Gets a Redis Client by connection name
|
|
8
|
+
function getOrCreateRedisClient(connection) {
|
|
9
|
+
let redisClient = redisClients[connection.name];
|
|
10
|
+
if (redisClient) {
|
|
11
|
+
return redisClient;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
let options = {
|
|
15
|
+
connectionName: connection.name,
|
|
16
|
+
connectionOptions: { autoPipelining: true },
|
|
17
|
+
clusterMode: connection.clusterMode,
|
|
18
|
+
nodes: ensureNodes(connection.nodes),
|
|
19
|
+
pool: true,
|
|
20
|
+
poolMin: connection.poolMin,
|
|
21
|
+
poolMax: connection.poolMax,
|
|
22
|
+
poolKeepAlive: connection.poolKeepAlive,
|
|
23
|
+
poolAcquireTimeout: connection.poolAcquireTimeout,
|
|
24
|
+
poolRetryDelay: connection.poolRetryDelay
|
|
25
|
+
};
|
|
26
|
+
if (connection.host != null) {
|
|
27
|
+
options.connectionOptions.host = connection.host;
|
|
28
|
+
}
|
|
29
|
+
if (connection.port != null) {
|
|
30
|
+
options.connectionOptions.port = connection.port;
|
|
31
|
+
}
|
|
32
|
+
if (connection.db != null) {
|
|
33
|
+
options.connectionOptions.db = connection.db;
|
|
34
|
+
}
|
|
35
|
+
if (connection.tls) {
|
|
36
|
+
options.connectionOptions.tls = {};
|
|
37
|
+
if (connection.key) {
|
|
38
|
+
options.connectionOptions.tls.key = fs.readFileSync(connection.key);
|
|
39
|
+
}
|
|
40
|
+
if (connection.cert) {
|
|
41
|
+
options.connectionOptions.tls.cert = fs.readFileSync(connection.cert);
|
|
42
|
+
}
|
|
43
|
+
if (connection.ca) {
|
|
44
|
+
options.connectionOptions.tls.ca = fs.readFileSync(connection.ca);
|
|
45
|
+
}
|
|
46
|
+
if (connection.servername) {
|
|
47
|
+
options.connectionOptions.tls.servername = connection.servername;
|
|
48
|
+
}
|
|
49
|
+
if (!connection.rejectUnauthorized) {
|
|
50
|
+
options.connectionOptions.tls.rejectUnauthorized = false;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
if (connection.user != null) {
|
|
54
|
+
options.connectionOptions.username = connection.user;
|
|
55
|
+
}
|
|
56
|
+
if (connection.password != null) {
|
|
57
|
+
options.connectionOptions.password = connection.password;
|
|
58
|
+
}
|
|
59
|
+
redisClient = redisCache.createRedisClient(options);
|
|
60
|
+
redisClients[connection.name] = redisClient;
|
|
61
|
+
return redisClient;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
function ensureNodes(nodes) {
|
|
65
|
+
if (nodes) {
|
|
66
|
+
if (!Array.isArray(nodes)) {
|
|
67
|
+
if (typeof (nodes) === 'string') {
|
|
68
|
+
let nodes = nodes.split(',');
|
|
69
|
+
const arr = [];
|
|
70
|
+
for (let i = 0; i < nodes.length; i++) {
|
|
71
|
+
const obj = {};
|
|
72
|
+
let nodeInfo = nodes.split('@');
|
|
73
|
+
if (nodeInfo.length > 1) {
|
|
74
|
+
let auth = nodeInfo[0].split(':');
|
|
75
|
+
if (auth.length > 1) {
|
|
76
|
+
obj.username = auth[0];
|
|
77
|
+
}
|
|
78
|
+
obj.password = (obj.username) ? auth[1] : auth[0];
|
|
79
|
+
}
|
|
80
|
+
let host = (nodeInfo.length > 1) ? nodeInfo[1].split(':') : nodeInfo[0].split(':');
|
|
81
|
+
obj.host = host[0];
|
|
82
|
+
obj.port = host[1];
|
|
83
|
+
arr.push(obj);
|
|
84
|
+
}
|
|
85
|
+
return arr;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return nodes;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
module.exports = {
|
|
93
|
+
redisGet: function (connection, key) {
|
|
94
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
95
|
+
return redisClient.get(key);
|
|
96
|
+
},
|
|
97
|
+
redisMget: function (connection, keys) {
|
|
98
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
99
|
+
return redisClient.mget(keys);
|
|
100
|
+
},
|
|
101
|
+
redisSet: function (connection, key, value) {
|
|
102
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
103
|
+
return redisClient.set(key, value);
|
|
104
|
+
},
|
|
105
|
+
redisSetex: function (connection, key, ttl, value) {
|
|
106
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
107
|
+
return redisClient.setex(key, ttl, value);
|
|
108
|
+
},
|
|
109
|
+
redisMset: function (connection, data) {
|
|
110
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
111
|
+
return redisClient.mset(data);
|
|
112
|
+
},
|
|
113
|
+
redisDel: function (connection, key) {
|
|
114
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
115
|
+
return redisClient.del(key);
|
|
116
|
+
},
|
|
117
|
+
redisExpire: function (connection, key, ttl) {
|
|
118
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
119
|
+
return redisClient.expire(key, ttl);
|
|
120
|
+
},
|
|
121
|
+
redisTtl: function (connection, key) {
|
|
122
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
123
|
+
return redisClient.ttl(key);
|
|
124
|
+
},
|
|
125
|
+
redisExists: function (connection, key) {
|
|
126
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
127
|
+
return redisClient.exists(key);
|
|
128
|
+
},
|
|
129
|
+
redisKeys: function (connection, pattern) {
|
|
130
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
131
|
+
return redisClient.keys(pattern);
|
|
132
|
+
},
|
|
133
|
+
redisDbsize: function (connection) {
|
|
134
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
135
|
+
return redisClient.dbsize();
|
|
136
|
+
},
|
|
137
|
+
redisHget: function (connection, key, field) {
|
|
138
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
139
|
+
return redisClient.hget(key, field);
|
|
140
|
+
},
|
|
141
|
+
redisHmget: function (connection, key, fields) {
|
|
142
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
143
|
+
return redisClient.hmget(key, fields);
|
|
144
|
+
},
|
|
145
|
+
redisHset: function (connection, key, field, value) {
|
|
146
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
147
|
+
return redisClient.hset(key, field, value);
|
|
148
|
+
},
|
|
149
|
+
redisHmset: function (connection, key, data) {
|
|
150
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
151
|
+
return redisClient.hmset(key, data);
|
|
152
|
+
},
|
|
153
|
+
redisHdel: function (connection, key, field) {
|
|
154
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
155
|
+
return redisClient.hdel(key, field);
|
|
156
|
+
},
|
|
157
|
+
redisHexists: function (connection, key, field) {
|
|
158
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
159
|
+
return redisClient.hexists(key, field);
|
|
160
|
+
},
|
|
161
|
+
redisHkeys: function (connection, key) {
|
|
162
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
163
|
+
return redisClient.hkeys(key);
|
|
164
|
+
},
|
|
165
|
+
redisHvals: function (connection, key) {
|
|
166
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
167
|
+
return redisClient.hvals(key);
|
|
168
|
+
},
|
|
169
|
+
redisHgetall: function (connection, key) {
|
|
170
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
171
|
+
return redisClient.hgetall(key);
|
|
172
|
+
},
|
|
173
|
+
redisHlen: function (connection, key) {
|
|
174
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
175
|
+
return redisClient.hlen(key);
|
|
176
|
+
},
|
|
177
|
+
redisLindex: function (connection, key, index) {
|
|
178
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
179
|
+
return redisClient.lindex(key, index);
|
|
180
|
+
},
|
|
181
|
+
redisLpop: function (connection, key, count) {
|
|
182
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
183
|
+
return redisClient.lpop(key, count);
|
|
184
|
+
},
|
|
185
|
+
redisRpop: function (connection, key, count) {
|
|
186
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
187
|
+
return redisClient.rpop(key, count);
|
|
188
|
+
},
|
|
189
|
+
redisLset: function (connection, key, index, element) {
|
|
190
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
191
|
+
return redisClient.lset(key, index, element);
|
|
192
|
+
},
|
|
193
|
+
redisLpush: function (connection, key, element) {
|
|
194
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
195
|
+
return redisClient.lpush(key, element);
|
|
196
|
+
},
|
|
197
|
+
redisRpush: function (connection, key, element) {
|
|
198
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
199
|
+
return redisClient.rpush(key, element);
|
|
200
|
+
},
|
|
201
|
+
redisLlen: function (connection, key) {
|
|
202
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
203
|
+
return redisClient.llen(key);
|
|
204
|
+
},
|
|
205
|
+
redisFlushdb: function (connection) {
|
|
206
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
207
|
+
return redisClient.flushdb();
|
|
208
|
+
},
|
|
209
|
+
redisFlushall: function (connection) {
|
|
210
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
211
|
+
return redisClient.flushall();
|
|
212
|
+
},
|
|
213
|
+
redisPing: function (connection) {
|
|
214
|
+
let redisClient = getOrCreateRedisClient(connection);
|
|
215
|
+
return redisClient.ping();
|
|
216
|
+
}
|
|
217
|
+
};
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
const Redis = require('ioredis');
|
|
2
|
+
const genericPool = require('generic-pool');
|
|
3
|
+
|
|
4
|
+
// Connection Pool cache
|
|
5
|
+
let poolsByName = {};
|
|
6
|
+
|
|
7
|
+
function createRedisClient(config) {
|
|
8
|
+
return {
|
|
9
|
+
get: function(key) {
|
|
10
|
+
return send(config, 'get', key);
|
|
11
|
+
},
|
|
12
|
+
mget: function(keys) {
|
|
13
|
+
return send(config, 'mget', keys);
|
|
14
|
+
},
|
|
15
|
+
set: function(key, value) {
|
|
16
|
+
return send(config, 'set', key, value);
|
|
17
|
+
},
|
|
18
|
+
setex: function(key, ttl, value) {
|
|
19
|
+
return send(config, 'setex', key, ttl, value);
|
|
20
|
+
},
|
|
21
|
+
mset: function(data) {
|
|
22
|
+
return send(config, 'mset', data);
|
|
23
|
+
},
|
|
24
|
+
del: function(key) {
|
|
25
|
+
return send(config, 'del', key);
|
|
26
|
+
},
|
|
27
|
+
expire: function(key, ttl) {
|
|
28
|
+
return send(config, 'expire', key, ttl);
|
|
29
|
+
},
|
|
30
|
+
ttl: function(key) {
|
|
31
|
+
return send(config, 'ttl', key);
|
|
32
|
+
},
|
|
33
|
+
exists: function(key) {
|
|
34
|
+
return send(config, 'exists', key);
|
|
35
|
+
},
|
|
36
|
+
keys: function(pattern) {
|
|
37
|
+
return send(config, 'keys', pattern);
|
|
38
|
+
},
|
|
39
|
+
dbsize: function() {
|
|
40
|
+
return send(config, 'dbsize');
|
|
41
|
+
},
|
|
42
|
+
hget: function(key, field) {
|
|
43
|
+
return send(config, 'hget', key, field);
|
|
44
|
+
},
|
|
45
|
+
hmget: function(key, fields) {
|
|
46
|
+
return send(config, 'hmget', key, fields);
|
|
47
|
+
},
|
|
48
|
+
hset: function(key, field, value) {
|
|
49
|
+
return send(config, 'hset', key, field, value);
|
|
50
|
+
},
|
|
51
|
+
hmset: function(key, data) {
|
|
52
|
+
return send(config, 'hmset', key, data);
|
|
53
|
+
},
|
|
54
|
+
hdel: function(key, field) {
|
|
55
|
+
return send(config, 'hdel', key, field);
|
|
56
|
+
},
|
|
57
|
+
hexists: function(key, field) {
|
|
58
|
+
return send(config, 'hexists', key, field);
|
|
59
|
+
},
|
|
60
|
+
hkeys: function(key) {
|
|
61
|
+
return send(config, 'hkeys', key);
|
|
62
|
+
},
|
|
63
|
+
hvals: function(key) {
|
|
64
|
+
return send(config, 'hvals', key);
|
|
65
|
+
},
|
|
66
|
+
hgetall: function(key) {
|
|
67
|
+
return send(config, 'hgetall', key);
|
|
68
|
+
},
|
|
69
|
+
hlen: function(key) {
|
|
70
|
+
return send(config, 'hlen', key);
|
|
71
|
+
},
|
|
72
|
+
lindex: function(key, index) {
|
|
73
|
+
return send(config, 'lindex', key, index);
|
|
74
|
+
},
|
|
75
|
+
lpop: function(key, count) {
|
|
76
|
+
if (count) {
|
|
77
|
+
return send(config, 'lpop', key, count);
|
|
78
|
+
} else {
|
|
79
|
+
return send(config, 'lpop', key);
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
rpop: function(key, count) {
|
|
83
|
+
if (count) {
|
|
84
|
+
return send(config, 'rpop', key, count);
|
|
85
|
+
} else {
|
|
86
|
+
return send(config, 'rpop', key);
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
lset: function(key, index, element) {
|
|
90
|
+
return send(config, 'lset', key, index, element);
|
|
91
|
+
},
|
|
92
|
+
lpush: function(key, element) {
|
|
93
|
+
return send(config, 'lpush', key, element);
|
|
94
|
+
},
|
|
95
|
+
rpush: function(key, element) {
|
|
96
|
+
return send(config, 'rpush', key, element);
|
|
97
|
+
},
|
|
98
|
+
llen: function(key) {
|
|
99
|
+
return send(config, 'llen', key);
|
|
100
|
+
},
|
|
101
|
+
flushdb: async function() {
|
|
102
|
+
send(config, 'flushdb');
|
|
103
|
+
},
|
|
104
|
+
flushall: async function() {
|
|
105
|
+
send(config, 'flushall');
|
|
106
|
+
},
|
|
107
|
+
ping: async function() {
|
|
108
|
+
await send(config, 'ping');
|
|
109
|
+
return true;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
async function getConnection(config) {
|
|
115
|
+
if (!config.pool) {
|
|
116
|
+
return createConnection(config);
|
|
117
|
+
}
|
|
118
|
+
try {
|
|
119
|
+
return await getPool(config).acquire();
|
|
120
|
+
} catch (err) {
|
|
121
|
+
throw error('RedisPoolAcquireError', { connectionName: config.connectionName }, err);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
function createConnection(config) {
|
|
126
|
+
return new Promise(function(resolve, reject) {
|
|
127
|
+
config.connectionOptions.retryStrategy = function (times) {
|
|
128
|
+
return null;
|
|
129
|
+
};
|
|
130
|
+
let redisClient = (!config.clusterMode)
|
|
131
|
+
? new Redis(config.connectionOptions)
|
|
132
|
+
: new Redis.Cluster(config.nodes, { redisOptions: config.connectionOptions });
|
|
133
|
+
redisClient.pool = config.pool;
|
|
134
|
+
redisClient.connectionName = config.connectionName;
|
|
135
|
+
// listen for redis connection events
|
|
136
|
+
redisClient.on('error', err => {
|
|
137
|
+
// handle error here
|
|
138
|
+
redisClient.active = false;
|
|
139
|
+
reject(error('RedisConnectionError', { connectionName: config.connectionName }, err));
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
redisClient.on('close', () => {
|
|
143
|
+
redisClient.active = false;
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
redisClient.on('ready', () => {
|
|
147
|
+
redisClient.active = true;
|
|
148
|
+
resolve(redisClient);
|
|
149
|
+
});
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
async function send(config, command, ...args) {
|
|
154
|
+
let connection = null;
|
|
155
|
+
try {
|
|
156
|
+
connection = await getConnection(config);
|
|
157
|
+
return await executeCommand(connection, command, ...args);
|
|
158
|
+
} catch (err) {
|
|
159
|
+
throw error('RedisError', null, err);
|
|
160
|
+
} finally {
|
|
161
|
+
if (connection) {
|
|
162
|
+
closeConnection(connection);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
function executeCommand(connection, command, ...args) {
|
|
168
|
+
return connection[command](...args);
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
function closeConnection(connection) {
|
|
172
|
+
if (!connection.pool) {
|
|
173
|
+
return destroyConnection(connection);
|
|
174
|
+
} else {
|
|
175
|
+
return getPool({connectionName: connection.connectionName}).release(connection);
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
function destroyConnection(connection) {
|
|
180
|
+
connection.disconnect();
|
|
181
|
+
connection.active = false;
|
|
182
|
+
return Promise.resolve();
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
function checkConnection(connection) {
|
|
186
|
+
connection.ping().catch((err) => { connection.active = false; });
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
function scheduleKeepAliveRun(connection, interval) {
|
|
190
|
+
if (connection.pool) {
|
|
191
|
+
connection.scheduledKeepAlive = setTimeout(() => {
|
|
192
|
+
checkConnection(connection);
|
|
193
|
+
scheduleKeepAliveRun(connection, interval);
|
|
194
|
+
}, interval);
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
function descheduleKeepAliveRun(connection) {
|
|
199
|
+
if (connection.scheduledKeepAlive) {
|
|
200
|
+
clearTimeout(connection.scheduledKeepAlive);
|
|
201
|
+
}
|
|
202
|
+
connection.scheduledKeepAlive = null;
|
|
203
|
+
}
|
|
204
|
+
|
|
205
|
+
function getPool(config) {
|
|
206
|
+
let key = config.connectionName;
|
|
207
|
+
let pool = poolsByName[key];
|
|
208
|
+
if (pool) {
|
|
209
|
+
return pool;
|
|
210
|
+
}
|
|
211
|
+
else {
|
|
212
|
+
// Create pool using a factory object
|
|
213
|
+
const factory = {
|
|
214
|
+
create: async function() {
|
|
215
|
+
try {
|
|
216
|
+
const connection = await createConnection(config);
|
|
217
|
+
scheduleKeepAliveRun(connection, config.poolKeepAlive);
|
|
218
|
+
return connection;
|
|
219
|
+
} catch (err) {
|
|
220
|
+
return await new Promise(function (resolve, reject) {
|
|
221
|
+
setTimeout(() => {
|
|
222
|
+
reject(err);
|
|
223
|
+
}, config.poolRetryDelay);
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
destroy: async function(connection) {
|
|
228
|
+
await destroyConnection(connection);
|
|
229
|
+
descheduleKeepAliveRun(connection);
|
|
230
|
+
return true;
|
|
231
|
+
},
|
|
232
|
+
validate: function(connection) {
|
|
233
|
+
return Promise.resolve(connection.active);
|
|
234
|
+
}
|
|
235
|
+
};
|
|
236
|
+
|
|
237
|
+
const opts = {
|
|
238
|
+
max: config.poolMax,
|
|
239
|
+
min: config.poolMin,
|
|
240
|
+
testOnBorrow: true,
|
|
241
|
+
acquireTimeoutMillis: config.poolAcquireTimeout || 10000
|
|
242
|
+
//autostart: false
|
|
243
|
+
};
|
|
244
|
+
|
|
245
|
+
pool = genericPool.createPool(factory, opts);
|
|
246
|
+
//pool.start();
|
|
247
|
+
pool.connectionName = config.connectionName;
|
|
248
|
+
poolsByName[key] = pool;
|
|
249
|
+
return pool;
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
function error(code, data, innerError) {
|
|
254
|
+
let err = new Error();
|
|
255
|
+
err.code = code;
|
|
256
|
+
if (data)
|
|
257
|
+
err.data = data;
|
|
258
|
+
if (innerError)
|
|
259
|
+
err.innerError = innerError;
|
|
260
|
+
return err;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
module.exports = {
|
|
264
|
+
createRedisClient: createRedisClient
|
|
265
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
regexReplace: function (target, regex, newValue) {
|
|
3
|
+
if (target === null || target === undefined)
|
|
4
|
+
return null;
|
|
5
|
+
if (regex === null || regex === undefined)
|
|
6
|
+
return target;
|
|
7
|
+
if (newValue === null || newValue === undefined)
|
|
8
|
+
return target;
|
|
9
|
+
return target.replace(new RegExp(regex, 'g'), newValue);
|
|
10
|
+
},
|
|
11
|
+
regexSearch: function (target, regex) {
|
|
12
|
+
if (target === null || target === undefined)
|
|
13
|
+
return -1;
|
|
14
|
+
if (regex === null || regex === undefined)
|
|
15
|
+
return -1;
|
|
16
|
+
return target.search(new RegExp(regex, 'g'));
|
|
17
|
+
},
|
|
18
|
+
regexTest: function (target, regex) {
|
|
19
|
+
if (target === null || target === undefined)
|
|
20
|
+
return false;
|
|
21
|
+
if (regex === null || regex === undefined)
|
|
22
|
+
return false;
|
|
23
|
+
return new RegExp(regex, 'g').test(target);
|
|
24
|
+
}
|
|
25
|
+
};
|