@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,364 @@
|
|
|
1
|
+
module.exports = {
|
|
2
|
+
errorUndefinedArgument: function (argName) {
|
|
3
|
+
let err = new Error();
|
|
4
|
+
err.code = 'UndefinedArgument';
|
|
5
|
+
err.data = { argName: argName };
|
|
6
|
+
return err;
|
|
7
|
+
},
|
|
8
|
+
errorInvalidConversion: function (value, targetType) {
|
|
9
|
+
let err = new Error();
|
|
10
|
+
err.code = 'InvalidConversion';
|
|
11
|
+
err.data = { value: value, targetType: targetType };
|
|
12
|
+
return err;
|
|
13
|
+
},
|
|
14
|
+
compare: function (value1, value2) { // TODO: Sort require for objects
|
|
15
|
+
if (value1 === null && value2 === null)
|
|
16
|
+
return 0;
|
|
17
|
+
if (value1 === null && value2 !== null)
|
|
18
|
+
return -1;
|
|
19
|
+
if (value1 !== null && value2 === null)
|
|
20
|
+
return 1;
|
|
21
|
+
let value1Type = toString.call(value1);
|
|
22
|
+
let value2Type = toString.call(value2);
|
|
23
|
+
let value1ToCompare = null;
|
|
24
|
+
let value2ToCompare = null;
|
|
25
|
+
if ((value1Type === '[object String]' && value2Type === '[object String]') ||
|
|
26
|
+
(value1Type === '[object Number]' && value2Type === '[object Number]')) {
|
|
27
|
+
value1ToCompare = value1;
|
|
28
|
+
value2ToCompare = value2;
|
|
29
|
+
}
|
|
30
|
+
else if (value1Type === '[object Boolean]' && value2Type === '[object Boolean]') {
|
|
31
|
+
value1ToCompare = value1 ? 1 : 0;
|
|
32
|
+
value2ToCompare = value2 ? 1 : 0;
|
|
33
|
+
}
|
|
34
|
+
else if (value1Type === '[object Date]' && value2Type === '[object Date]') {
|
|
35
|
+
value1ToCompare = value1.getTime();
|
|
36
|
+
value2ToCompare = value2.getTime();
|
|
37
|
+
}
|
|
38
|
+
else if (value1Type === '[object Object]' && value2Type === '[object Object]') {
|
|
39
|
+
value1ToCompare = JSON.stringify(value1);
|
|
40
|
+
value2ToCompare = JSON.stringify(value2);
|
|
41
|
+
}
|
|
42
|
+
else if (value1Type === '[object Array]' && value2Type === '[object Array]') {
|
|
43
|
+
let result = this.compare(value1.length, value2.length);
|
|
44
|
+
if (result !== 0)
|
|
45
|
+
return result;
|
|
46
|
+
for (let i = 0; i < value1.length; i++) {
|
|
47
|
+
let item1 = value1[i];
|
|
48
|
+
let item2 = value2[i];
|
|
49
|
+
result = this.compare(item1, item2);
|
|
50
|
+
if (result !== 0)
|
|
51
|
+
return result;
|
|
52
|
+
}
|
|
53
|
+
return 0;
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
if (value1Type === '[object String]')
|
|
57
|
+
value1ToCompare = value1;
|
|
58
|
+
else if (value1Type === '[object Number]')
|
|
59
|
+
value1ToCompare = value1.toString();
|
|
60
|
+
else if (value1Type === '[object Boolean]')
|
|
61
|
+
value1ToCompare = value1 ? '1' : '0';
|
|
62
|
+
else if (value1Type === '[object Date]')
|
|
63
|
+
value1ToCompare = value1.toJSON();
|
|
64
|
+
else
|
|
65
|
+
value1ToCompare = value1.toString();
|
|
66
|
+
if (value2Type === '[object String]')
|
|
67
|
+
value2ToCompare = value2;
|
|
68
|
+
else if (value2Type === '[object Number]')
|
|
69
|
+
value2ToCompare = value2.toString();
|
|
70
|
+
else if (value2Type === '[object Boolean]')
|
|
71
|
+
value2ToCompare = value2 ? '1' : '0';
|
|
72
|
+
else if (value2Type === '[object Date]')
|
|
73
|
+
value2ToCompare = value2.toJSON();
|
|
74
|
+
else
|
|
75
|
+
value2ToCompare = value2.toString();
|
|
76
|
+
}
|
|
77
|
+
if (value1ToCompare === value2ToCompare)
|
|
78
|
+
return 0;
|
|
79
|
+
else if (value1ToCompare < value2ToCompare)
|
|
80
|
+
return -1;
|
|
81
|
+
else if (value1ToCompare > value2ToCompare)
|
|
82
|
+
return 1;
|
|
83
|
+
else
|
|
84
|
+
return null;
|
|
85
|
+
},
|
|
86
|
+
convertMilliseconds: function (strMilliseconds) {
|
|
87
|
+
if (strMilliseconds) {
|
|
88
|
+
if (strMilliseconds.length < 3)
|
|
89
|
+
strMilliseconds = strMilliseconds.padEnd(3, '0');
|
|
90
|
+
if (strMilliseconds.length > 3)
|
|
91
|
+
strMilliseconds = strMilliseconds.substr(0, 3);
|
|
92
|
+
return Number(strMilliseconds);
|
|
93
|
+
}
|
|
94
|
+
else
|
|
95
|
+
return 0;
|
|
96
|
+
},
|
|
97
|
+
apply: function (obj1, obj2) {
|
|
98
|
+
let result = null;
|
|
99
|
+
if (obj1) {
|
|
100
|
+
result = {};
|
|
101
|
+
for (let key in obj1) {
|
|
102
|
+
result[key] = obj1[key];
|
|
103
|
+
}
|
|
104
|
+
if (obj2) {
|
|
105
|
+
for (let key in obj2) {
|
|
106
|
+
result[key] = obj2[key];
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return result;
|
|
111
|
+
},
|
|
112
|
+
base64Decode: function (value) {
|
|
113
|
+
if (value === undefined)
|
|
114
|
+
throw this.errorUndefinedArgument('value');
|
|
115
|
+
if (value === null)
|
|
116
|
+
return null;
|
|
117
|
+
return Buffer.from(value, 'base64');
|
|
118
|
+
},
|
|
119
|
+
base64Encode: function (value) {
|
|
120
|
+
if (value === undefined)
|
|
121
|
+
throw this.errorUndefinedArgument('value');
|
|
122
|
+
if (value === null)
|
|
123
|
+
return null;
|
|
124
|
+
return Buffer.from(value).toString('base64');
|
|
125
|
+
},
|
|
126
|
+
convertToBinary: function (value) {
|
|
127
|
+
if (value == null)
|
|
128
|
+
return null;
|
|
129
|
+
if (value && value.type === 'Buffer')
|
|
130
|
+
return Buffer.from(value);
|
|
131
|
+
if (Buffer.isBuffer(value))
|
|
132
|
+
return value;
|
|
133
|
+
if (Array.isArray(value) || typeof value === 'string')
|
|
134
|
+
return Buffer.from(value);
|
|
135
|
+
throw this.errorInvalidConversion(value, 'binary');
|
|
136
|
+
},
|
|
137
|
+
convertToBoolean: function (value) {
|
|
138
|
+
if (value === null)
|
|
139
|
+
return null;
|
|
140
|
+
let valueType = toString.call(value);
|
|
141
|
+
if (valueType === '[object String]') {
|
|
142
|
+
if (value === '1' || value.toUpperCase() === 'T' || value.toUpperCase() === 'TRUE' || value.toUpperCase() === 'Y' || value.toUpperCase() === 'YES')
|
|
143
|
+
return true;
|
|
144
|
+
if (value === '0' || value.toUpperCase() === 'F' || value.toUpperCase() === 'FALSE' || value.toUpperCase() === 'N' || value.toUpperCase() === 'NO')
|
|
145
|
+
return false;
|
|
146
|
+
}
|
|
147
|
+
if (valueType === '[object Number]') {
|
|
148
|
+
if (value === 1)
|
|
149
|
+
return true;
|
|
150
|
+
if (value === 0)
|
|
151
|
+
return false;
|
|
152
|
+
}
|
|
153
|
+
if (valueType === '[object Boolean]')
|
|
154
|
+
return value;
|
|
155
|
+
throw this.errorInvalidConversion(value, 'boolean');
|
|
156
|
+
},
|
|
157
|
+
convertToDate: function (value) {
|
|
158
|
+
if (value === null)
|
|
159
|
+
return null;
|
|
160
|
+
let valueType = toString.call(value);
|
|
161
|
+
if (valueType === '[object String]') {
|
|
162
|
+
let matchDate = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(value);
|
|
163
|
+
if (matchDate)
|
|
164
|
+
return new Date(Date.UTC(Number(matchDate[1]), Number(matchDate[2]) - 1, Number(matchDate[3]), 0, 0, 0, 0));
|
|
165
|
+
let matchDatetimeUtc = /^(\d{4})-(\d{1,2})-(\d{1,2})[T,\s](\d{1,2})\:(\d{1,2})\:(\d{1,2})\.?(\d+)?Z?$/.exec(value);
|
|
166
|
+
if (matchDatetimeUtc)
|
|
167
|
+
return new Date(Date.UTC(Number(matchDatetimeUtc[1]), Number(matchDatetimeUtc[2]) - 1, Number(matchDatetimeUtc[3]), 0, 0, 0, 0));
|
|
168
|
+
let matchDatetimeZone = /^(\d{4})-(\d{1,2})-(\d{1,2})[T\s](\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d+))?([+-]\d{2}:\d{2})?$/.exec(value);
|
|
169
|
+
if (matchDatetimeZone) // timezone
|
|
170
|
+
return new Date(Date.UTC(Number(matchDatetimeZone[1]), Number(matchDatetimeZone[2]) - 1, Number(matchDatetimeZone[3]), 0, 0, 0, 0));
|
|
171
|
+
}
|
|
172
|
+
if (valueType === '[object Date]') {
|
|
173
|
+
return new Date(Date.UTC(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), 0, 0, 0, 0));
|
|
174
|
+
}
|
|
175
|
+
throw this.errorInvalidConversion(value, 'date');
|
|
176
|
+
},
|
|
177
|
+
convertToDatetime: function (value) {
|
|
178
|
+
if (value === null)
|
|
179
|
+
return null;
|
|
180
|
+
let valueType = toString.call(value);
|
|
181
|
+
if (valueType === '[object String]') {
|
|
182
|
+
let matchDatetimeUtc = /^(\d{4})-(\d{1,2})-(\d{1,2})[T,\s](\d{1,2})\:(\d{1,2})\:(\d{1,2})\.?(\d+)?Z?$/.exec(value);
|
|
183
|
+
if (matchDatetimeUtc && matchDatetimeUtc[7] !== undefined) {
|
|
184
|
+
return new Date(Date.UTC(Number(matchDatetimeUtc[1]), Number(matchDatetimeUtc[2]) - 1, Number(matchDatetimeUtc[3]), Number(matchDatetimeUtc[4]), Number(matchDatetimeUtc[5]), Number(matchDatetimeUtc[6] || 0), this.convertMilliseconds(matchDatetimeUtc[7])));
|
|
185
|
+
}
|
|
186
|
+
let matchDatetimeZone = /^(\d{4})-(\d{1,2})-(\d{1,2})[T\s](\d{1,2}):(\d{1,2}):(\d{1,2})(?:\.(\d+))?([+-]\d{2}:\d{2})?$/.exec(value);
|
|
187
|
+
if (matchDatetimeZone) { // timezone
|
|
188
|
+
let year = Number(matchDatetimeZone[1]);
|
|
189
|
+
let month = Number(matchDatetimeZone[2]) - 1; // Month is zero-based in JavaScript Date
|
|
190
|
+
let day = Number(matchDatetimeZone[3]);
|
|
191
|
+
let hour = Number(matchDatetimeZone[4]);
|
|
192
|
+
let minute = Number(matchDatetimeZone[5]);
|
|
193
|
+
let second = Number(matchDatetimeZone[6] || 0);
|
|
194
|
+
let millisecond = this.convertMilliseconds(matchDatetimeZone[7]);
|
|
195
|
+
let timezoneOffset = matchDatetimeZone[8];
|
|
196
|
+
if (timezoneOffset) {
|
|
197
|
+
let offsetSign = timezoneOffset[0] === "+" ? 1 : -1;
|
|
198
|
+
let [offsetHour, offsetMinute] = timezoneOffset.slice(1).split(":").map(Number);
|
|
199
|
+
hour -= offsetSign * offsetHour;
|
|
200
|
+
minute -= offsetSign * offsetMinute;
|
|
201
|
+
}
|
|
202
|
+
return new Date(Date.UTC(year, month, day, hour, minute, second, millisecond));
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const probableDate = new Date(value)
|
|
206
|
+
if (probableDate.toString() !== 'Invalid Date') {
|
|
207
|
+
return probableDate
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
if (valueType === '[object Date]') {
|
|
212
|
+
return value;
|
|
213
|
+
}
|
|
214
|
+
throw this.errorInvalidConversion(value, 'datetime');
|
|
215
|
+
},
|
|
216
|
+
convertToDecimal: function (value) {
|
|
217
|
+
if (value === null)
|
|
218
|
+
return null;
|
|
219
|
+
let valueType = toString.call(value);
|
|
220
|
+
if (valueType === '[object String]' && value !== '' && !isNaN(value))
|
|
221
|
+
return Number(value);
|
|
222
|
+
if (valueType === '[object Number]')
|
|
223
|
+
return value;
|
|
224
|
+
if (valueType === '[object Boolean]')
|
|
225
|
+
return value ? 1 : 0;
|
|
226
|
+
throw this.errorInvalidConversion(value, 'decimal');
|
|
227
|
+
},
|
|
228
|
+
convertToInteger: function (value) {
|
|
229
|
+
if (value === null)
|
|
230
|
+
return null;
|
|
231
|
+
let valueType = toString.call(value);
|
|
232
|
+
if (valueType === '[object String]' && value !== '' && !isNaN(value))
|
|
233
|
+
return Math.round(Number(value));
|
|
234
|
+
if (valueType === '[object Number]')
|
|
235
|
+
return Math.round(value);
|
|
236
|
+
if (valueType === '[object Boolean]')
|
|
237
|
+
return value ? 1 : 0;
|
|
238
|
+
throw this.errorInvalidConversion(value, 'integer');
|
|
239
|
+
},
|
|
240
|
+
convertToString: function (value) {
|
|
241
|
+
if (value === null)
|
|
242
|
+
return null;
|
|
243
|
+
let valueType = toString.call(value);
|
|
244
|
+
if (valueType === '[object String]')
|
|
245
|
+
return value;
|
|
246
|
+
if (valueType === '[object Number]')
|
|
247
|
+
return value.toString();
|
|
248
|
+
if (valueType === '[object Uint8Array]')
|
|
249
|
+
return value.toString();
|
|
250
|
+
if (valueType === '[object Boolean]')
|
|
251
|
+
return value ? 'true' : 'false';
|
|
252
|
+
if (valueType === '[object Date]')
|
|
253
|
+
return value.toJSON();
|
|
254
|
+
if (valueType === '[object Object]' && value.type === 'Buffer' && value.data)
|
|
255
|
+
return Buffer.from(value.data).toString();
|
|
256
|
+
throw this.errorInvalidConversion(value, 'string');
|
|
257
|
+
},
|
|
258
|
+
convertToTime: function (value) {
|
|
259
|
+
if (value === null)
|
|
260
|
+
return null;
|
|
261
|
+
let valueType = toString.call(value);
|
|
262
|
+
if (valueType === '[object String]') {
|
|
263
|
+
let matchTime = /^(\d{1,2})\:(\d{1,2})\:(\d{1,2})\.?(\d+)?$/.exec(value);
|
|
264
|
+
if (matchTime)
|
|
265
|
+
return new Date(Date.UTC(1970, 0, 1, Number(matchTime[1]), Number(matchTime[2]), Number(matchTime[3]), this.convertMilliseconds(matchTime[4])));
|
|
266
|
+
let matchDatetime = /^(\d{4})-(\d{1,2})-(\d{1,2})[T,\s](\d{1,2})\:(\d{1,2})\:(\d{1,2})\.?(\d+)?Z?$/.exec(value);
|
|
267
|
+
if (matchDatetime)
|
|
268
|
+
return new Date(Date.UTC(1970, 0, 1, Number(matchDatetime[4]), Number(matchDatetime[5]), Number(matchDatetime[6] || 0), this.convertMilliseconds(matchDatetime[7])));
|
|
269
|
+
}
|
|
270
|
+
if (valueType === '[object Date]') {
|
|
271
|
+
return new Date(Date.UTC(1970, 0, 1, value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds()));
|
|
272
|
+
}
|
|
273
|
+
throw this.errorInvalidConversion(value, 'time');
|
|
274
|
+
},
|
|
275
|
+
entries: function( obj ) {
|
|
276
|
+
if( obj === undefined ) throw this.errorUndefinedArgument( 'obj' );
|
|
277
|
+
if( obj === null ) return null
|
|
278
|
+
return Object.entries( obj )
|
|
279
|
+
},
|
|
280
|
+
format: function (value, format) {
|
|
281
|
+
if (typeof Blz !== 'undefined' && Blz.format) {
|
|
282
|
+
return Blz.format(value, format);
|
|
283
|
+
}
|
|
284
|
+
if (value != null && value.toString) {
|
|
285
|
+
return value.toString();
|
|
286
|
+
}
|
|
287
|
+
return '';
|
|
288
|
+
},
|
|
289
|
+
htmlEncode: function (value) {
|
|
290
|
+
if (value)
|
|
291
|
+
return value.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/'/g,''').replace(/"/g,'"');
|
|
292
|
+
else
|
|
293
|
+
return value;
|
|
294
|
+
},
|
|
295
|
+
htmlDecode: function (value) {
|
|
296
|
+
if (value)
|
|
297
|
+
return value.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>').replace(/'/g,'\'').replace(/"/g,'"');
|
|
298
|
+
else
|
|
299
|
+
return value;
|
|
300
|
+
},
|
|
301
|
+
if: function( condition, valueIfConditionIsTrue, valueIfConditionIsFalse ) {
|
|
302
|
+
return condition ? valueIfConditionIsTrue : valueIfConditionIsFalse
|
|
303
|
+
},
|
|
304
|
+
isNotNull: function (value) {
|
|
305
|
+
return value !== null && value !== undefined;
|
|
306
|
+
},
|
|
307
|
+
isNull: function (value) {
|
|
308
|
+
return value === null || value === undefined;
|
|
309
|
+
},
|
|
310
|
+
isNullOrValue: function (value, valueToCompare) {
|
|
311
|
+
return value === null || value === undefined || this.compare(value, valueToCompare) === 0;
|
|
312
|
+
},
|
|
313
|
+
jsonParse: function (value) {
|
|
314
|
+
if (value === undefined)
|
|
315
|
+
throw this.errorUndefinedArgument('value');
|
|
316
|
+
if (value === null)
|
|
317
|
+
return null;
|
|
318
|
+
let obj = JSON.parse(value);
|
|
319
|
+
return obj;
|
|
320
|
+
},
|
|
321
|
+
jsonStringify: function (value, spaces) {
|
|
322
|
+
if (value === undefined)
|
|
323
|
+
throw this.errorUndefinedArgument('value');
|
|
324
|
+
if (value === null)
|
|
325
|
+
return null;
|
|
326
|
+
if (spaces === undefined || spaces === null)
|
|
327
|
+
return JSON.stringify(value);
|
|
328
|
+
else
|
|
329
|
+
return JSON.stringify(value, null, spaces);
|
|
330
|
+
},
|
|
331
|
+
keys: function( obj ) {
|
|
332
|
+
if( obj === undefined ) throw this.errorUndefinedArgument( 'obj' );
|
|
333
|
+
if( obj === null ) return null
|
|
334
|
+
return Object.keys( obj )
|
|
335
|
+
},
|
|
336
|
+
map: function( source, fnSelection ) {
|
|
337
|
+
if( Array.isArray( source ) ) { // list
|
|
338
|
+
const resultArray = new Array( source.length );
|
|
339
|
+
for( let i = 0; i < source.length; ++i ) {
|
|
340
|
+
const item = source[ i ]
|
|
341
|
+
resultArray[ i ] = fnSelection( item )
|
|
342
|
+
}
|
|
343
|
+
return resultArray
|
|
344
|
+
}
|
|
345
|
+
else if( source ) { // obj
|
|
346
|
+
return fnSelection( source );
|
|
347
|
+
}
|
|
348
|
+
return null;
|
|
349
|
+
},
|
|
350
|
+
nvl: function (value, replacementValue) {
|
|
351
|
+
return value !== null && value !== undefined ? value : replacementValue;
|
|
352
|
+
},
|
|
353
|
+
urlEncode: function (value) {
|
|
354
|
+
return encodeURIComponent(value);
|
|
355
|
+
},
|
|
356
|
+
urlDecode: function (value) {
|
|
357
|
+
return decodeURIComponent(value);
|
|
358
|
+
},
|
|
359
|
+
values: function( obj ) {
|
|
360
|
+
if( obj === undefined ) throw this.errorUndefinedArgument( 'obj' );
|
|
361
|
+
if( obj === null ) return null
|
|
362
|
+
return Object.values( obj )
|
|
363
|
+
}
|
|
364
|
+
};
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
const CryptoJs = require('crypto-js');
|
|
2
|
+
|
|
3
|
+
module.exports = {
|
|
4
|
+
encrypt: function (value, secret, algorithm) {
|
|
5
|
+
switch (algorithm) {
|
|
6
|
+
case 'MD5': {
|
|
7
|
+
return CryptoJs.MD5(value).toString();
|
|
8
|
+
}
|
|
9
|
+
case 'SHA1': {
|
|
10
|
+
return CryptoJs.SHA1(value).toString();
|
|
11
|
+
}
|
|
12
|
+
case 'SHA256': {
|
|
13
|
+
return CryptoJs.SHA256(value).toString();
|
|
14
|
+
}
|
|
15
|
+
case 'SHA384': {
|
|
16
|
+
return CryptoJs.SHA384(value).toString();
|
|
17
|
+
}
|
|
18
|
+
case 'SHA512': {
|
|
19
|
+
return CryptoJs.SHA512(value).toString();
|
|
20
|
+
}
|
|
21
|
+
case 'HMAC-MD5': {
|
|
22
|
+
return CryptoJs.HmacMD5(value, secret).toString();
|
|
23
|
+
}
|
|
24
|
+
case 'HMAC-SHA1': {
|
|
25
|
+
return CryptoJs.HmacSHA1(value, secret).toString();
|
|
26
|
+
}
|
|
27
|
+
case 'HMAC-SHA256': {
|
|
28
|
+
return CryptoJs.HmacSHA256(value, secret).toString();
|
|
29
|
+
}
|
|
30
|
+
case 'HMAC-SHA384': {
|
|
31
|
+
return CryptoJs.HmacSHA384(value, secret).toString();
|
|
32
|
+
}
|
|
33
|
+
case 'HMAC-SHA512': {
|
|
34
|
+
return CryptoJs.HmacSHA512(value, secret).toString();
|
|
35
|
+
}
|
|
36
|
+
case 'AES': {
|
|
37
|
+
return CryptoJs.AES.encrypt(value, secret).toString();
|
|
38
|
+
}
|
|
39
|
+
default: {
|
|
40
|
+
throw new Error('Invalid encryption algorithm');
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
},
|
|
44
|
+
decrypt: function (encryptedValue, secret, algorithm) {
|
|
45
|
+
switch (algorithm) {
|
|
46
|
+
case 'AES': {
|
|
47
|
+
return CryptoJs.AES.decrypt(encryptedValue, secret).toString(CryptoJs.enc.Utf8);
|
|
48
|
+
}
|
|
49
|
+
default: {
|
|
50
|
+
throw new Error('Invalid encryption algorithm');
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
};
|