@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,44 @@
|
|
|
1
|
+
const { LRUCache } = require('lru-cache')
|
|
2
|
+
class LruCache {
|
|
3
|
+
constructor () {
|
|
4
|
+
this._cache = new LRUCache({ max: 500, maxSize: 5000, ttl: 1000 * 60 * 60 * 3, sizeCalculation: (value, key) => { return 1 } })
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* @name set
|
|
9
|
+
* @api private
|
|
10
|
+
* @description Maximum age in ms.
|
|
11
|
+
* @param {*} key key to be cached.
|
|
12
|
+
* @param {*} value value to be cached.
|
|
13
|
+
* @param {*} expire Maximum age in ms.
|
|
14
|
+
*/
|
|
15
|
+
async set (key, value, expire) {
|
|
16
|
+
this._cache.set(key, value, expire)
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @name get
|
|
21
|
+
* @api private
|
|
22
|
+
* @description Get the value that was cached.
|
|
23
|
+
* @param {*} key
|
|
24
|
+
* @returns
|
|
25
|
+
*/
|
|
26
|
+
async get (key) {
|
|
27
|
+
return this._cache.get(key)
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @name del
|
|
32
|
+
* @api private
|
|
33
|
+
* @description It was removing the value that was in the cache.
|
|
34
|
+
* @param {*} key
|
|
35
|
+
* @returns
|
|
36
|
+
*/
|
|
37
|
+
async del (key) {
|
|
38
|
+
this._cache.delete(key)
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
const lruCache = new LruCache()
|
|
42
|
+
module.exports = {
|
|
43
|
+
lruCache
|
|
44
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
const { lruCache } = require('./LruCache')
|
|
2
|
+
|
|
3
|
+
module.exports = typeof module.exports === "undefined" ? {} : module.exports;
|
|
4
|
+
/**
|
|
5
|
+
* Get cache item
|
|
6
|
+
* @param {string} key - key cache item
|
|
7
|
+
* @return {any}
|
|
8
|
+
*/
|
|
9
|
+
module.exports.localCacheGet = function( key ) {
|
|
10
|
+
return lruCache.get(key)
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Remove cache item
|
|
14
|
+
* @param {string} key - key cache item
|
|
15
|
+
* @return {any}
|
|
16
|
+
*/
|
|
17
|
+
module.exports.localCacheRemove = function( key ) {
|
|
18
|
+
lruCache.del(key)
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Set cache item
|
|
22
|
+
* @param {string} key - key cache item
|
|
23
|
+
* @param {any} value - value of cache
|
|
24
|
+
* @param {integer} [expire] - expire time in milliseconds
|
|
25
|
+
* @return {any}
|
|
26
|
+
*/
|
|
27
|
+
module.exports.localCacheSet = function( key, value, expire ) {
|
|
28
|
+
lruCache.set(key, value, expire || 0)
|
|
29
|
+
}
|
|
@@ -0,0 +1,434 @@
|
|
|
1
|
+
const Path = require('path');
|
|
2
|
+
const Fs = require('fs-extra');
|
|
3
|
+
const {h3lp } = require('h3lp');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
class BlzConfig {
|
|
7
|
+
|
|
8
|
+
constructor() {
|
|
9
|
+
this._config = null
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
async initialize(configToOverride = {}, appPath) {
|
|
13
|
+
if (this._config != null) {
|
|
14
|
+
console.warn('You are call BlzConfig.initialize multiple times. We will override the config')
|
|
15
|
+
}
|
|
16
|
+
this._config = await this.loadConfig(configToOverride, appPath)
|
|
17
|
+
this.normalizeConfig(this._config)
|
|
18
|
+
this.validateConfig(this._config)
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async loadConfig(configToOverride, appPath) {
|
|
22
|
+
|
|
23
|
+
// It starts from the system configuration and the properties are added by environment variables
|
|
24
|
+
const configPath = Path.join(appPath, '../config.json')
|
|
25
|
+
if (!Fs.existsSync(configPath)) {
|
|
26
|
+
throw new Error(`${configPath} config file not exists`)
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
let config = JSON.parse(Fs.readFileSync(configPath), 'utf8');
|
|
30
|
+
config = { ...config, ...configToOverride }
|
|
31
|
+
let connectionsName = config.connections ? Object.keys(config.connections) : [];
|
|
32
|
+
|
|
33
|
+
// look for the .env file within the system or at the solution level.
|
|
34
|
+
let environmentPath = null
|
|
35
|
+
if (Fs.existsSync(Path.join(appPath, '../.env'))) {
|
|
36
|
+
environmentPath = Path.join(appPath, '../.env');
|
|
37
|
+
}
|
|
38
|
+
else if (Fs.existsSync(Path.join(appPath, '../../.env'))) {
|
|
39
|
+
environmentPath = Path.join(appPath, '../../.env');
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// Check duplicate keys in .env
|
|
43
|
+
if (environmentPath) {
|
|
44
|
+
this.checkDuplicateKeysInEnv(environmentPath)
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// if the .env file exists raise the environment variables from this file
|
|
48
|
+
if (Fs.existsSync(environmentPath)) {
|
|
49
|
+
require('dotenv').config({ path: environmentPath });
|
|
50
|
+
}
|
|
51
|
+
for (let p in process.env) {
|
|
52
|
+
if (p.startsWith('blz_')) {
|
|
53
|
+
if (p.startsWith('blz_' + config.name + '_param_') && p.endsWith('_user') && p !== 'blz_' + config.name + '_param_user') {
|
|
54
|
+
let name = p.replace('blz_' + config.name + '_param_', '');
|
|
55
|
+
name = name.substring(0, name.length - 5);
|
|
56
|
+
if (!config.parameters) config.parameters = {};
|
|
57
|
+
if (!config.parameters[name]) config.parameters[name] = {};
|
|
58
|
+
config.parameters[name].user = this.getValue(process.env[p]);
|
|
59
|
+
}
|
|
60
|
+
else if (p.startsWith('blz_' + config.name + '_param_') && p.endsWith('_password') && p !== 'blz_' + config.name + '_param_password') {
|
|
61
|
+
let name = p.replace('blz_' + config.name + '_param_', '');
|
|
62
|
+
name = name.substring(0, name.length - 9);
|
|
63
|
+
if (!config.parameters) config.parameters = {};
|
|
64
|
+
if (!config.parameters[name]) config.parameters[name] = {};
|
|
65
|
+
config.parameters[name].password = this.getValue(process.env[p]);
|
|
66
|
+
}
|
|
67
|
+
else if (p.startsWith('blz_' + config.name + '_param_')) {
|
|
68
|
+
let name = p.replace('blz_' + config.name + '_param_', '');
|
|
69
|
+
if (!config.parameters) config.parameters = {};
|
|
70
|
+
if (!config.visibleParameters) config.visibleParameters = {};
|
|
71
|
+
const format = config.configParameters && config.configParameters[name] ? config.configParameters[name].format : null;
|
|
72
|
+
const hidden = config.configParameters && config.configParameters[name] ? config.configParameters[name].hidden : false;
|
|
73
|
+
try {
|
|
74
|
+
const value = this.getFormatValue(process.env[p], format);
|
|
75
|
+
config.parameters[name] = value;
|
|
76
|
+
if (hidden!== true) {
|
|
77
|
+
config.visibleParameters[name] = value;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
throw new Error(`Error: Bad value for parameter "${p}" defined in the environment.\n- ${error.message}`)
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
else if (p.startsWith('blz_' + config.name + '_auth_')) {
|
|
85
|
+
let name = p.replace('blz_' + config.name + '_auth_', '');
|
|
86
|
+
if (!config.authServer) config.authServer = {};
|
|
87
|
+
config.authServer[name] = this.getValue(process.env[p]);
|
|
88
|
+
}
|
|
89
|
+
else if (p === 'blz_' + config.name + '_enableKafkaConsumers') {
|
|
90
|
+
const enableKafkaConsumersValue = this.getValue(process.env[p]) || ''
|
|
91
|
+
const enableKafkaConsumers = enableKafkaConsumersValue
|
|
92
|
+
.trim()
|
|
93
|
+
.split(',')
|
|
94
|
+
.filter(Boolean)
|
|
95
|
+
.map(consumerName => consumerName.trim())
|
|
96
|
+
const enableKafkaConsumersUniq = [... new Set(enableKafkaConsumers)]
|
|
97
|
+
config.enableKafkaConsumers = enableKafkaConsumersUniq
|
|
98
|
+
}
|
|
99
|
+
else if (p.startsWith('blz_' + config.name + '_')) {
|
|
100
|
+
let name = p.replace('blz_' + config.name + '_', '');
|
|
101
|
+
config[name] = this.getValue(process.env[p]);
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
let str = p.replace('blz_', '');
|
|
105
|
+
let index = str.indexOf('_');
|
|
106
|
+
let name = str.substring(0, index);
|
|
107
|
+
if (connectionsName.includes(name)) {
|
|
108
|
+
let paramName = str.replace(name + '_', '');
|
|
109
|
+
config.connections[name][paramName] = this.getValue(process.env[p]);
|
|
110
|
+
} else {
|
|
111
|
+
config[p] = this.getValue(process.env[p]);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
// set internal parameters
|
|
117
|
+
this.setAliasParams(config)
|
|
118
|
+
return config;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
setAliasParams(config){
|
|
122
|
+
if (config.parameters?.SecurityApiSanitizeSqlInjection) {
|
|
123
|
+
config.blz_securityApiSanitizeSqlInjection = config.parameters.SecurityApiSanitizeSqlInjection
|
|
124
|
+
process.env.blz_securityApiSanitizeSqlInjection = config.parameters.SecurityApiSanitizeSqlInjection
|
|
125
|
+
}
|
|
126
|
+
if (config.parameters?.SecurityApiSanitizeOnlyLog) {
|
|
127
|
+
process.env.blz_securityApiSanitizeOnlyLog = config.parameters.SecurityApiSanitizeOnlyLog
|
|
128
|
+
}
|
|
129
|
+
if (config.parameters?.SecurityExcludeSanitizePaths) {
|
|
130
|
+
process.env.blz_securityExcludeSanitizePaths = config.parameters.SecurityExcludeSanitizePaths
|
|
131
|
+
}
|
|
132
|
+
if (config.parameters?.SecurityApiSanitizeDangerousParamPatterns) {
|
|
133
|
+
process.env.blz_securityApiSanitizeDangerousParamPatterns = config.parameters.SecurityApiSanitizeDangerousParamPatterns
|
|
134
|
+
}
|
|
135
|
+
if (config.parameters?.SecurityApiSanitizeDangerousSqlPatterns) {
|
|
136
|
+
process.env.blz_securityApiSanitizeDangerousSqlPatterns = config.parameters.SecurityApiSanitizeDangerousSqlPatterns
|
|
137
|
+
}
|
|
138
|
+
if (config.parameters?.SecurityApiSanitizeAllowedSqlInputPatterns ) {
|
|
139
|
+
process.env.blz_securityApiSanitizeAllowedSqlInputPatterns = config.parameters.SecurityApiSanitizeAllowedSqlInputPatterns
|
|
140
|
+
}
|
|
141
|
+
if (config.parameters?.SecurityApiSanitizeAllowedInputPatterns ) {
|
|
142
|
+
process.env.blz_securityApiSanitizeAllowedInputPatterns = config.parameters.SecurityApiSanitizeAllowedInputPatterns
|
|
143
|
+
}
|
|
144
|
+
if (config.parameters?.HttpRequestLimiterTimeframe) {
|
|
145
|
+
config.httpRequestLimiterTimeframe= config.parameters.HttpRequestLimiterTimeframe
|
|
146
|
+
}
|
|
147
|
+
if (config.parameters?.HttpRequestLimiterCount) {
|
|
148
|
+
config.httpRequestLimiterCount = config.parameters.HttpRequestLimiterCount
|
|
149
|
+
}
|
|
150
|
+
if (config.parameters?.HttpRequestLimiterAddressOnly !== undefined) {
|
|
151
|
+
config.httpRequestLimiterAddressOnly = config.parameters.HttpRequestLimiterAddressOnly;
|
|
152
|
+
}
|
|
153
|
+
if (config.parameters?.HttpRequestLimiterTrustProxy !== undefined) {
|
|
154
|
+
config.httpRequestLimiterTrustProxy = config.parameters.HttpRequestLimiterTrustProxy;
|
|
155
|
+
}
|
|
156
|
+
if (process.env.blz_secureUrlCookieKey ) {
|
|
157
|
+
config.parameters.SecureUrlCookieKey = process.env.blz_secureUrlCookieKey
|
|
158
|
+
}
|
|
159
|
+
if (process.env.blz_secureUrlTimeoutMs ) {
|
|
160
|
+
config.parameters.SecureUrlTimeoutMs = process.env.blz_secureUrlTimeoutMs
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
checkDuplicateKeysInEnv(environmentPath) {
|
|
165
|
+
const env = Fs.readFileSync(environmentPath, 'utf8');
|
|
166
|
+
const lines = env.split('\n');
|
|
167
|
+
const keys = [];
|
|
168
|
+
const duplicateKeys = [];
|
|
169
|
+
lines.forEach((line) => {
|
|
170
|
+
line = line.trim();
|
|
171
|
+
if (line === '' || line.startsWith('#'))
|
|
172
|
+
return;
|
|
173
|
+
const [key] = line.split('=');
|
|
174
|
+
if (keys.includes(key)) {
|
|
175
|
+
duplicateKeys.push(key);
|
|
176
|
+
}
|
|
177
|
+
keys.push(key);
|
|
178
|
+
});
|
|
179
|
+
if (duplicateKeys.length > 0) {
|
|
180
|
+
throw new Error(`Error. Duplicate keys in .env file: ${JSON.stringify([...new Set(duplicateKeys)])}`);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
getValue(value) {
|
|
185
|
+
if (value === null) {
|
|
186
|
+
return null;
|
|
187
|
+
}
|
|
188
|
+
if (typeof value === 'string') {
|
|
189
|
+
if (value.toLocaleLowerCase().trim() === 'false') {
|
|
190
|
+
return false;
|
|
191
|
+
}
|
|
192
|
+
if (value.toLocaleLowerCase().trim() === 'true') {
|
|
193
|
+
return true;
|
|
194
|
+
}
|
|
195
|
+
let resultValue = value;
|
|
196
|
+
let indexStart = resultValue.indexOf('${');
|
|
197
|
+
let indexEnd = -1;
|
|
198
|
+
if (indexStart > -1) {
|
|
199
|
+
indexEnd = resultValue.indexOf('}', indexStart);
|
|
200
|
+
}
|
|
201
|
+
while (indexStart > -1 && indexEnd > indexStart) {
|
|
202
|
+
resultValue =
|
|
203
|
+
resultValue.substring(0, indexStart) +
|
|
204
|
+
process.env[resultValue.substring(indexStart + 2, indexEnd)] +
|
|
205
|
+
resultValue.substring(indexEnd + 1, resultValue.length);
|
|
206
|
+
indexStart = resultValue.indexOf('${');
|
|
207
|
+
indexEnd = -1;
|
|
208
|
+
if (indexStart > -1) {
|
|
209
|
+
indexEnd = resultValue.indexOf('}', indexStart);
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
return resultValue;
|
|
213
|
+
}
|
|
214
|
+
return value;
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
getFormatValue(value, format) {
|
|
218
|
+
if (value == null) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
if (!format) {
|
|
222
|
+
return this.getValue(value);
|
|
223
|
+
}
|
|
224
|
+
switch (format) {
|
|
225
|
+
case 'String': {
|
|
226
|
+
return this.getValue(value);
|
|
227
|
+
}
|
|
228
|
+
case 'Numeric': {
|
|
229
|
+
const numericValue = Number(value);
|
|
230
|
+
if (isNaN(numericValue)) {
|
|
231
|
+
throw new Error(`Invalid Numeric value. Detected: "${value}"`);
|
|
232
|
+
}
|
|
233
|
+
return parseFloat(value);
|
|
234
|
+
}
|
|
235
|
+
case 'Boolean': {
|
|
236
|
+
const boolValue = value.toLocaleLowerCase().trim();
|
|
237
|
+
if (!['true', 'false'].includes(boolValue)) {
|
|
238
|
+
throw new Error(`Invalid Boolean value (only allowed "true" or "false"). Detected: "${value}"`);
|
|
239
|
+
}
|
|
240
|
+
return boolValue === 'true';
|
|
241
|
+
}
|
|
242
|
+
default: {
|
|
243
|
+
return value;
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
normalizeConfig(config = {}) {
|
|
249
|
+
for (const p in config.connections) {
|
|
250
|
+
const connection = config.connections[p];
|
|
251
|
+
if (connection.type === "Mongodb") {
|
|
252
|
+
const hasOldFormat = Boolean(connection.database && connection.database.trim());
|
|
253
|
+
const hasNewFormat = Boolean(connection.databaseName && connection.databaseName.trim());
|
|
254
|
+
const hasToWarnAboutConfusion = hasOldFormat && hasNewFormat;
|
|
255
|
+
const hasToUpdate = hasOldFormat && !hasNewFormat;
|
|
256
|
+
|
|
257
|
+
if (hasToWarnAboutConfusion) {
|
|
258
|
+
console.warn(`Warning: Your are using the old format ("blz_${p}_database") and the new format ("blz_${p}_databaseName"). We will use the new one ("blz_${p}_databaseName"). Please, consider to remove the old format to avoid confusion.`);
|
|
259
|
+
delete connection.database;
|
|
260
|
+
}
|
|
261
|
+
if (hasToUpdate) {
|
|
262
|
+
console.warn(`Warning: Your are using the "blz_${p}_database" variable, but you need to use "blz_${p}_databaseName" instead. Environment variables for MongoDb databases with "blz_xxx_database" format may will disappear in the future. Please, update it.`);
|
|
263
|
+
connection.databaseName = connection.database;
|
|
264
|
+
delete connection.database;
|
|
265
|
+
}
|
|
266
|
+
} else if(connection.type === "Kafka") {
|
|
267
|
+
connection.requestTimeout = this.validateOrConvertToNumber(connection.requestTimeout, 'requestTimeout', 30000);
|
|
268
|
+
connection.connectionTimeout = this.validateOrConvertToNumber(connection.connectionTimeout, 'connectionTimeout', 3000);
|
|
269
|
+
connection.connectionRetries = this.validateOrConvertToNumber(connection.connectionRetries, 'connectionRetries', 3);
|
|
270
|
+
connection.connectionInitialRetryTime = this.validateOrConvertToNumber(connection.connectionInitialRetryTime, 'connectionInitialRetryTime', 3000);
|
|
271
|
+
connection.connectionMaxRetryTime = this.validateOrConvertToNumber(connection.connectionMaxRetryTime, 'connectionMaxRetryTime', 60000);
|
|
272
|
+
connection.connectionRetryFactor = this.validateOrConvertToNumber(connection.connectionRetryFactor, 'connectionRetryFactor', 1.5);
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
validateOrConvertToNumber(value,name, defaultValue) {
|
|
278
|
+
if (value === undefined || value === null) {
|
|
279
|
+
return defaultValue;
|
|
280
|
+
}
|
|
281
|
+
if (typeof value === 'string' && h3lp.val.isNumber(value)){
|
|
282
|
+
return h3lp.val.isDecimal(value)?parseFloat(value): Path.parse(value);
|
|
283
|
+
} else if (typeof value === 'number'){
|
|
284
|
+
return connection.requestTimeout;
|
|
285
|
+
} else {
|
|
286
|
+
throw new Error(`Error: ${name} ${value} not supported`);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
validateConfig(config) {
|
|
291
|
+
if (config === undefined) {
|
|
292
|
+
throw new Error(`Error: config not found`);
|
|
293
|
+
}
|
|
294
|
+
if (config.type === undefined) {
|
|
295
|
+
throw new Error(`Error: config type undefined`);
|
|
296
|
+
}
|
|
297
|
+
if (config.name === undefined) {
|
|
298
|
+
throw new Error(`Error: config name undefined`);
|
|
299
|
+
}
|
|
300
|
+
//validate application config
|
|
301
|
+
switch (config.type) {
|
|
302
|
+
case "Microservice":
|
|
303
|
+
case "ProcessEngine":
|
|
304
|
+
case "RestApi":
|
|
305
|
+
if (config.port === undefined) {
|
|
306
|
+
throw new Error(`Error: Environment variable blz_${config.name}_port is required`);
|
|
307
|
+
}
|
|
308
|
+
break;
|
|
309
|
+
case "Mongodb":
|
|
310
|
+
case "RelationalDatabase":
|
|
311
|
+
case "BeeAuthServer":
|
|
312
|
+
case "SmtpServer":
|
|
313
|
+
case "WebFrontend":
|
|
314
|
+
case "MobileApp":
|
|
315
|
+
case "Custom":
|
|
316
|
+
break;
|
|
317
|
+
default:
|
|
318
|
+
throw new Error(`Error: type ${config.type} not supported`);
|
|
319
|
+
}
|
|
320
|
+
//validate connections config
|
|
321
|
+
if (config.connections !== undefined) {
|
|
322
|
+
for (const p in config.connections) {
|
|
323
|
+
const connection = config.connections[p];
|
|
324
|
+
switch (connection.type) {
|
|
325
|
+
case "Microservice":
|
|
326
|
+
case "ProcessEngine":
|
|
327
|
+
case "RestApi":
|
|
328
|
+
if (connection.url === undefined || connection.url.trim() === "") {
|
|
329
|
+
throw new Error(`Error: Environment variable blz_${p}_url is required`);
|
|
330
|
+
}
|
|
331
|
+
break;
|
|
332
|
+
case "Mongodb":
|
|
333
|
+
if (connection.url === undefined || connection.url.trim() === "") {
|
|
334
|
+
throw new Error(`Error: Environment variable blz_${p}url is required`);
|
|
335
|
+
}
|
|
336
|
+
if (connection.databaseName === undefined || connection.databaseName.trim() === "") {
|
|
337
|
+
throw new Error(`Error: Environment variable blz_${p}_databaseName is required`);
|
|
338
|
+
}
|
|
339
|
+
break;
|
|
340
|
+
case "RelationalDatabase":
|
|
341
|
+
if (connection.providerName === undefined || connection.providerName.trim() === "") {
|
|
342
|
+
throw new Error(`Error: Environment variable blz_${p}_providerName is required`);
|
|
343
|
+
}
|
|
344
|
+
if (connection.customUrl) {
|
|
345
|
+
if (connection.protocol === undefined || connection.protocol.trim() === "") {
|
|
346
|
+
throw new Error(`Error: Environment variable blz_${p}_protocol is required`);
|
|
347
|
+
}
|
|
348
|
+
if (connection.url === undefined || connection.url.trim() === "") {
|
|
349
|
+
throw new Error(`Error: Environment variable blz_${p}_url is required`);
|
|
350
|
+
}
|
|
351
|
+
} else {
|
|
352
|
+
if (connection.providerName === 'Oracle') {
|
|
353
|
+
if (connection.dataSource === undefined || connection.dataSource.trim() === "") {
|
|
354
|
+
throw new Error(`Error: Environment variable blz_${p}_dataSource is required`);
|
|
355
|
+
}
|
|
356
|
+
} else {
|
|
357
|
+
if (connection.host === undefined || connection.host.trim() === "") {
|
|
358
|
+
throw new Error(`Error: Environment variable blz_${p}_host is required`);
|
|
359
|
+
}
|
|
360
|
+
if (connection.port === undefined || connection.port.trim() === "") {
|
|
361
|
+
throw new Error(`Error: Environment variable blz_${p}_port is required`);
|
|
362
|
+
}
|
|
363
|
+
if (connection.database === undefined || connection.database.trim() === "") {
|
|
364
|
+
throw new Error(`Error: Environment variable blz_${p}_database is required`);
|
|
365
|
+
}
|
|
366
|
+
}
|
|
367
|
+
if (connection.user === undefined || connection.user.trim() === "") {
|
|
368
|
+
throw new Error(`Error: Environment variable blz_${p}_user is required`);
|
|
369
|
+
}
|
|
370
|
+
if (connection.password === undefined || connection.password.trim() === "") {
|
|
371
|
+
throw new Error(`Error: Environment variable blz_${p}_password is required`);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
break;
|
|
375
|
+
case "Redis":
|
|
376
|
+
case "Hazelcast":
|
|
377
|
+
if (connection.providerName === undefined || connection.providerName.trim() === "") {
|
|
378
|
+
throw new Error(`Error: Environment variable blz_${p}_providerName is required`);
|
|
379
|
+
}
|
|
380
|
+
if (connection.host === undefined || connection.host.trim() === "") {
|
|
381
|
+
throw new Error(`Error: Environment variable blz_${p}_host is required`);
|
|
382
|
+
}
|
|
383
|
+
if (connection.port === undefined || connection.port.trim() === "") {
|
|
384
|
+
throw new Error(`Error: Environment variable blz_${p}_port is required`);
|
|
385
|
+
}
|
|
386
|
+
if (connection.database === undefined || connection.database.trim() === "") {
|
|
387
|
+
throw new Error(`Error: Environment variable blz_${p}_database is required`);
|
|
388
|
+
}
|
|
389
|
+
if (connection.password === undefined || connection.password.trim() === "") {
|
|
390
|
+
throw new Error(`Error: Environment variable blz_${p}_password is required`);
|
|
391
|
+
}
|
|
392
|
+
break;
|
|
393
|
+
}
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
//validate configParameters config
|
|
397
|
+
if (config.configParameters !== undefined) {
|
|
398
|
+
for (const p in config.configParameters) {
|
|
399
|
+
const configParameter = config.configParameters[p];
|
|
400
|
+
switch (configParameter.format) {
|
|
401
|
+
case "String":
|
|
402
|
+
case "Numeric":
|
|
403
|
+
case "Json":
|
|
404
|
+
case "Boolean":
|
|
405
|
+
if (config.parameters[p] === undefined) {
|
|
406
|
+
throw new Error(`Error: Environment variable blz_${config.name}_param_${p} is required`);
|
|
407
|
+
}
|
|
408
|
+
break;
|
|
409
|
+
case "Credentials":
|
|
410
|
+
if (config.parameters[p + '_user'] === undefined) {
|
|
411
|
+
throw new Error(`Error: Environment variable blz_${config.name}_param_${p}_user is required`);
|
|
412
|
+
}
|
|
413
|
+
if (config.parameters[p + '_password'] === undefined) {
|
|
414
|
+
throw new Error(`Error: Environment variable blz_${config.name}_param_${p}_password is required`);
|
|
415
|
+
}
|
|
416
|
+
break;
|
|
417
|
+
default:
|
|
418
|
+
throw new Error(`Error: parameter ${p} format ${configParameter.format} not supported`);
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
getConfig() {
|
|
425
|
+
return this._config
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
setConfig(config = {}) {
|
|
429
|
+
this.setAliasParams(config)
|
|
430
|
+
this._config = { ...config }
|
|
431
|
+
}
|
|
432
|
+
}
|
|
433
|
+
const blzConfig = new BlzConfig()
|
|
434
|
+
module.exports = blzConfig
|