@blazedpath/commons 0.2.2 → 0.3.1
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 +4 -1
- package/dist/blz-base/health/index.d.ts +1 -0
- package/dist/blz-base/health/index.js +1 -0
- package/dist/blz-base/index.d.ts +108 -0
- package/dist/blz-base/index.js +1 -0
- package/dist/blz-cache/LruCache.d.ts +31 -0
- package/dist/blz-cache/LruCache.js +1 -0
- package/dist/blz-cache/index.d.ts +2 -0
- package/dist/blz-cache/index.js +1 -0
- package/dist/blz-config/index.d.ts +16 -0
- package/dist/blz-config/index.js +1 -0
- package/dist/blz-core/index.d.ts +32 -0
- package/dist/blz-core/index.js +1 -0
- package/dist/blz-cryptography/index.d.ts +2 -0
- package/dist/blz-cryptography/index.js +1 -0
- package/dist/blz-datetimes/index.d.ts +35 -0
- package/dist/blz-datetimes/index.js +1 -0
- package/dist/blz-file/fileService.d.ts +25 -0
- package/dist/blz-file/fileService.js +1 -0
- package/dist/blz-file/index.d.ts +2 -0
- package/dist/blz-file/index.js +1 -0
- package/dist/blz-file/index.test.js +1 -0
- package/dist/blz-file/lab.js +1 -0
- package/dist/blz-hazelcast/index.d.ts +25 -0
- package/dist/blz-hazelcast/index.js +1 -0
- package/dist/blz-hazelcast/lib/credentials.d.ts +10 -0
- package/dist/blz-hazelcast/lib/credentials.js +1 -0
- package/dist/blz-hazelcast/lib/credentialsFactory.d.ts +1 -0
- package/dist/blz-hazelcast/lib/credentialsFactory.js +1 -0
- package/dist/blz-hazelcast/lib/hazelcastCache.d.ts +27 -0
- package/dist/blz-hazelcast/lib/hazelcastCache.js +1 -0
- package/dist/blz-iterable/index.d.ts +49 -0
- package/dist/blz-iterable/index.js +1 -0
- package/dist/blz-json-schema/index.d.ts +1 -0
- package/dist/blz-json-schema/index.js +1 -0
- package/dist/blz-jwt/index.d.ts +12 -0
- package/dist/blz-jwt/index.js +1 -0
- package/dist/blz-kafka/index.d.ts +9 -0
- package/dist/blz-kafka/index.js +1 -0
- package/dist/blz-math/index.d.ts +22 -0
- package/dist/blz-math/index.js +1 -0
- package/dist/blz-mongodb/index.d.ts +28 -0
- package/dist/blz-mongodb/index.js +1 -0
- package/dist/blz-rds/__test__/scape.test.js +1 -0
- package/dist/blz-rds/blz-rds-executor.d.ts +4 -0
- package/dist/blz-rds/blz-rds-executor.js +1 -0
- package/dist/blz-rds/blz-rds-helper.d.ts +5 -0
- package/dist/blz-rds/blz-rds-helper.js +1 -0
- package/dist/blz-rds/commands/core/add.d.ts +2 -0
- package/dist/blz-rds/commands/core/add.js +1 -0
- package/dist/blz-rds/commands/core/and.d.ts +3 -0
- package/dist/blz-rds/commands/core/and.js +1 -0
- package/dist/blz-rds/commands/core/asc.d.ts +2 -0
- package/dist/blz-rds/commands/core/asc.js +1 -0
- package/dist/blz-rds/commands/core/avg.d.ts +2 -0
- package/dist/blz-rds/commands/core/avg.js +1 -0
- package/dist/blz-rds/commands/core/column-ref.d.ts +2 -0
- package/dist/blz-rds/commands/core/column-ref.js +1 -0
- package/dist/blz-rds/commands/core/count-distinct.d.ts +2 -0
- package/dist/blz-rds/commands/core/count-distinct.js +1 -0
- package/dist/blz-rds/commands/core/count.d.ts +2 -0
- package/dist/blz-rds/commands/core/count.js +1 -0
- package/dist/blz-rds/commands/core/decimal.d.ts +2 -0
- package/dist/blz-rds/commands/core/decimal.js +1 -0
- package/dist/blz-rds/commands/core/desc.d.ts +2 -0
- package/dist/blz-rds/commands/core/desc.js +1 -0
- package/dist/blz-rds/commands/core/distinct.d.ts +2 -0
- package/dist/blz-rds/commands/core/distinct.js +1 -0
- package/dist/blz-rds/commands/core/divide.d.ts +2 -0
- package/dist/blz-rds/commands/core/divide.js +1 -0
- package/dist/blz-rds/commands/core/embedded-exists.d.ts +3 -0
- package/dist/blz-rds/commands/core/embedded-exists.js +1 -0
- package/dist/blz-rds/commands/core/embedded-select.d.ts +2 -0
- package/dist/blz-rds/commands/core/embedded-select.js +1 -0
- package/dist/blz-rds/commands/core/equals.d.ts +3 -0
- package/dist/blz-rds/commands/core/equals.js +1 -0
- package/dist/blz-rds/commands/core/false.d.ts +2 -0
- package/dist/blz-rds/commands/core/false.js +1 -0
- package/dist/blz-rds/commands/core/greater-or-equal.d.ts +3 -0
- package/dist/blz-rds/commands/core/greater-or-equal.js +1 -0
- package/dist/blz-rds/commands/core/greater.d.ts +3 -0
- package/dist/blz-rds/commands/core/greater.js +1 -0
- package/dist/blz-rds/commands/core/in.d.ts +3 -0
- package/dist/blz-rds/commands/core/in.js +1 -0
- package/dist/blz-rds/commands/core/integer.d.ts +2 -0
- package/dist/blz-rds/commands/core/integer.js +1 -0
- package/dist/blz-rds/commands/core/is-not-null.d.ts +3 -0
- package/dist/blz-rds/commands/core/is-not-null.js +1 -0
- package/dist/blz-rds/commands/core/is-null-or-value.d.ts +3 -0
- package/dist/blz-rds/commands/core/is-null-or-value.js +1 -0
- package/dist/blz-rds/commands/core/is-null.d.ts +3 -0
- package/dist/blz-rds/commands/core/is-null.js +1 -0
- package/dist/blz-rds/commands/core/less-or-equal.d.ts +3 -0
- package/dist/blz-rds/commands/core/less-or-equal.js +1 -0
- package/dist/blz-rds/commands/core/less-unary.d.ts +2 -0
- package/dist/blz-rds/commands/core/less-unary.js +1 -0
- package/dist/blz-rds/commands/core/less.d.ts +3 -0
- package/dist/blz-rds/commands/core/less.js +1 -0
- package/dist/blz-rds/commands/core/like.d.ts +3 -0
- package/dist/blz-rds/commands/core/like.js +1 -0
- package/dist/blz-rds/commands/core/max.d.ts +2 -0
- package/dist/blz-rds/commands/core/max.js +1 -0
- package/dist/blz-rds/commands/core/min.d.ts +2 -0
- package/dist/blz-rds/commands/core/min.js +1 -0
- package/dist/blz-rds/commands/core/multiply.d.ts +2 -0
- package/dist/blz-rds/commands/core/multiply.js +1 -0
- package/dist/blz-rds/commands/core/not-equals.d.ts +3 -0
- package/dist/blz-rds/commands/core/not-equals.js +1 -0
- package/dist/blz-rds/commands/core/not-in.d.ts +3 -0
- package/dist/blz-rds/commands/core/not-in.js +1 -0
- package/dist/blz-rds/commands/core/not.d.ts +3 -0
- package/dist/blz-rds/commands/core/not.js +1 -0
- package/dist/blz-rds/commands/core/null.d.ts +2 -0
- package/dist/blz-rds/commands/core/null.js +1 -0
- package/dist/blz-rds/commands/core/nvl.d.ts +2 -0
- package/dist/blz-rds/commands/core/nvl.js +1 -0
- package/dist/blz-rds/commands/core/or.d.ts +3 -0
- package/dist/blz-rds/commands/core/or.js +1 -0
- package/dist/blz-rds/commands/core/parameter.d.ts +2 -0
- package/dist/blz-rds/commands/core/parameter.js +1 -0
- package/dist/blz-rds/commands/core/remainder.d.ts +2 -0
- package/dist/blz-rds/commands/core/remainder.js +1 -0
- package/dist/blz-rds/commands/core/string.d.ts +2 -0
- package/dist/blz-rds/commands/core/string.js +1 -0
- package/dist/blz-rds/commands/core/subtract.d.ts +2 -0
- package/dist/blz-rds/commands/core/subtract.js +1 -0
- package/dist/blz-rds/commands/core/sum.d.ts +2 -0
- package/dist/blz-rds/commands/core/sum.js +1 -0
- package/dist/blz-rds/commands/core/true.d.ts +2 -0
- package/dist/blz-rds/commands/core/true.js +1 -0
- package/dist/blz-rds/commands/core/tuple.d.ts +2 -0
- package/dist/blz-rds/commands/core/tuple.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-days.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-days.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-hours.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-hours.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-milliseconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-milliseconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-minutes.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-minutes.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-months.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-months.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-seconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-seconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/add-years.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/add-years.js +1 -0
- package/dist/blz-rds/commands/datetimes/date-diff.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/date-diff.js +1 -0
- package/dist/blz-rds/commands/datetimes/date.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/date.js +1 -0
- package/dist/blz-rds/commands/datetimes/datetime-diff.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/datetime-diff.js +1 -0
- package/dist/blz-rds/commands/datetimes/datetime.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/datetime.js +1 -0
- package/dist/blz-rds/commands/datetimes/day.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/day.js +1 -0
- package/dist/blz-rds/commands/datetimes/hour.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/hour.js +1 -0
- package/dist/blz-rds/commands/datetimes/millisecond.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/millisecond.js +1 -0
- package/dist/blz-rds/commands/datetimes/minute.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/minute.js +1 -0
- package/dist/blz-rds/commands/datetimes/month-text.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/month-text.js +1 -0
- package/dist/blz-rds/commands/datetimes/month.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/month.js +1 -0
- package/dist/blz-rds/commands/datetimes/now.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/now.js +1 -0
- package/dist/blz-rds/commands/datetimes/second.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/second.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-days.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-days.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-hours.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-hours.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-minutes.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-minutes.js +1 -0
- package/dist/blz-rds/commands/datetimes/subtract-seconds.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/subtract-seconds.js +1 -0
- package/dist/blz-rds/commands/datetimes/time-diff.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/time-diff.js +1 -0
- package/dist/blz-rds/commands/datetimes/time.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/time.js +1 -0
- package/dist/blz-rds/commands/datetimes/today.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/today.js +1 -0
- package/dist/blz-rds/commands/datetimes/week-day-text.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/week-day-text.js +1 -0
- package/dist/blz-rds/commands/datetimes/week-day.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/week-day.js +1 -0
- package/dist/blz-rds/commands/datetimes/week.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/week.js +1 -0
- package/dist/blz-rds/commands/datetimes/year.d.ts +2 -0
- package/dist/blz-rds/commands/datetimes/year.js +1 -0
- package/dist/blz-rds/commands/math/abs.d.ts +2 -0
- package/dist/blz-rds/commands/math/abs.js +1 -0
- package/dist/blz-rds/commands/math/acos.d.ts +2 -0
- package/dist/blz-rds/commands/math/acos.js +1 -0
- package/dist/blz-rds/commands/math/asin.d.ts +2 -0
- package/dist/blz-rds/commands/math/asin.js +1 -0
- package/dist/blz-rds/commands/math/atan.d.ts +2 -0
- package/dist/blz-rds/commands/math/atan.js +1 -0
- package/dist/blz-rds/commands/math/atan2.d.ts +2 -0
- package/dist/blz-rds/commands/math/atan2.js +1 -0
- package/dist/blz-rds/commands/math/ceil.d.ts +2 -0
- package/dist/blz-rds/commands/math/ceil.js +1 -0
- package/dist/blz-rds/commands/math/cos.d.ts +2 -0
- package/dist/blz-rds/commands/math/cos.js +1 -0
- package/dist/blz-rds/commands/math/cosh.d.ts +2 -0
- package/dist/blz-rds/commands/math/cosh.js +1 -0
- package/dist/blz-rds/commands/math/exp.d.ts +2 -0
- package/dist/blz-rds/commands/math/exp.js +1 -0
- package/dist/blz-rds/commands/math/floor.d.ts +2 -0
- package/dist/blz-rds/commands/math/floor.js +1 -0
- package/dist/blz-rds/commands/math/log.d.ts +2 -0
- package/dist/blz-rds/commands/math/log.js +1 -0
- package/dist/blz-rds/commands/math/log10.d.ts +2 -0
- package/dist/blz-rds/commands/math/log10.js +1 -0
- package/dist/blz-rds/commands/math/pow.d.ts +2 -0
- package/dist/blz-rds/commands/math/pow.js +1 -0
- package/dist/blz-rds/commands/math/random.d.ts +2 -0
- package/dist/blz-rds/commands/math/random.js +1 -0
- package/dist/blz-rds/commands/math/round.d.ts +2 -0
- package/dist/blz-rds/commands/math/round.js +1 -0
- package/dist/blz-rds/commands/math/sign.d.ts +2 -0
- package/dist/blz-rds/commands/math/sign.js +1 -0
- package/dist/blz-rds/commands/math/sin.d.ts +2 -0
- package/dist/blz-rds/commands/math/sin.js +1 -0
- package/dist/blz-rds/commands/math/sinh.d.ts +2 -0
- package/dist/blz-rds/commands/math/sinh.js +1 -0
- package/dist/blz-rds/commands/math/sqrt.d.ts +2 -0
- package/dist/blz-rds/commands/math/sqrt.js +1 -0
- package/dist/blz-rds/commands/math/tan.d.ts +2 -0
- package/dist/blz-rds/commands/math/tan.js +1 -0
- package/dist/blz-rds/commands/math/tanh.d.ts +2 -0
- package/dist/blz-rds/commands/math/tanh.js +1 -0
- package/dist/blz-rds/commands/math/trunc.d.ts +2 -0
- package/dist/blz-rds/commands/math/trunc.js +1 -0
- package/dist/blz-rds/commands/strings/concat.d.ts +2 -0
- package/dist/blz-rds/commands/strings/concat.js +1 -0
- package/dist/blz-rds/commands/strings/contains.d.ts +3 -0
- package/dist/blz-rds/commands/strings/contains.js +1 -0
- package/dist/blz-rds/commands/strings/ends-with.d.ts +3 -0
- package/dist/blz-rds/commands/strings/ends-with.js +1 -0
- package/dist/blz-rds/commands/strings/index-of.d.ts +2 -0
- package/dist/blz-rds/commands/strings/index-of.js +1 -0
- package/dist/blz-rds/commands/strings/is-null-or-empty.d.ts +3 -0
- package/dist/blz-rds/commands/strings/is-null-or-empty.js +1 -0
- package/dist/blz-rds/commands/strings/is-null-or-white-space.d.ts +3 -0
- package/dist/blz-rds/commands/strings/is-null-or-white-space.js +1 -0
- package/dist/blz-rds/commands/strings/join.d.ts +2 -0
- package/dist/blz-rds/commands/strings/join.js +1 -0
- package/dist/blz-rds/commands/strings/last-index-of.d.ts +2 -0
- package/dist/blz-rds/commands/strings/last-index-of.js +1 -0
- package/dist/blz-rds/commands/strings/length.d.ts +2 -0
- package/dist/blz-rds/commands/strings/length.js +1 -0
- package/dist/blz-rds/commands/strings/pad-left.d.ts +2 -0
- package/dist/blz-rds/commands/strings/pad-left.js +1 -0
- package/dist/blz-rds/commands/strings/pad-right.d.ts +2 -0
- package/dist/blz-rds/commands/strings/pad-right.js +1 -0
- package/dist/blz-rds/commands/strings/replace.d.ts +2 -0
- package/dist/blz-rds/commands/strings/replace.js +1 -0
- package/dist/blz-rds/commands/strings/starts-with.d.ts +3 -0
- package/dist/blz-rds/commands/strings/starts-with.js +1 -0
- package/dist/blz-rds/commands/strings/substring.d.ts +2 -0
- package/dist/blz-rds/commands/strings/substring.js +1 -0
- package/dist/blz-rds/commands/strings/to-lower.d.ts +2 -0
- package/dist/blz-rds/commands/strings/to-lower.js +1 -0
- package/dist/blz-rds/commands/strings/to-upper.d.ts +2 -0
- package/dist/blz-rds/commands/strings/to-upper.js +1 -0
- package/dist/blz-rds/commands/strings/trim-end.d.ts +2 -0
- package/dist/blz-rds/commands/strings/trim-end.js +1 -0
- package/dist/blz-rds/commands/strings/trim-start.d.ts +2 -0
- package/dist/blz-rds/commands/strings/trim-start.js +1 -0
- package/dist/blz-rds/commands/strings/trim.d.ts +2 -0
- package/dist/blz-rds/commands/strings/trim.js +1 -0
- package/dist/blz-rds/index.d.ts +53 -0
- package/dist/blz-rds/index.js +1 -0
- package/dist/blz-rds-mysql/base.d.ts +83 -0
- package/dist/blz-rds-mysql/base.js +1 -0
- package/dist/blz-rds-mysql/connection-manager.d.ts +8 -0
- package/dist/blz-rds-mysql/connection-manager.js +1 -0
- package/dist/blz-rds-mysql/execute-bulk-insert.d.ts +2 -0
- package/dist/blz-rds-mysql/execute-bulk-insert.js +1 -0
- package/dist/blz-rds-mysql/execute-bulk-merge.d.ts +2 -0
- package/dist/blz-rds-mysql/execute-bulk-merge.js +1 -0
- package/dist/blz-rds-mysql/execute-non-query.d.ts +14 -0
- package/dist/blz-rds-mysql/execute-non-query.js +1 -0
- package/dist/blz-rds-mysql/execute-query.d.ts +11 -0
- package/dist/blz-rds-mysql/execute-query.js +1 -0
- package/dist/blz-rds-mysql/index.d.ts +9 -0
- package/dist/blz-rds-mysql/index.js +1 -0
- package/dist/blz-rds-mysql/stored-procedure.d.ts +19 -0
- package/dist/blz-rds-mysql/stored-procedure.js +1 -0
- package/dist/blz-rds-mysqlx/base.d.ts +83 -0
- package/dist/blz-rds-mysqlx/base.js +1 -0
- package/dist/blz-rds-mysqlx/connection-manager.d.ts +6 -0
- package/dist/blz-rds-mysqlx/connection-manager.js +1 -0
- package/dist/blz-rds-mysqlx/execute-bulk-insert.d.ts +2 -0
- package/dist/blz-rds-mysqlx/execute-bulk-insert.js +1 -0
- package/dist/blz-rds-mysqlx/execute-bulk-merge.d.ts +2 -0
- package/dist/blz-rds-mysqlx/execute-bulk-merge.js +1 -0
- package/dist/blz-rds-mysqlx/execute-non-query.d.ts +4 -0
- package/dist/blz-rds-mysqlx/execute-non-query.js +1 -0
- package/dist/blz-rds-mysqlx/execute-query.d.ts +7 -0
- package/dist/blz-rds-mysqlx/execute-query.js +1 -0
- package/dist/blz-rds-mysqlx/index.d.ts +9 -0
- package/dist/blz-rds-mysqlx/index.js +1 -0
- package/dist/blz-rds-mysqlx/stored-procedure.d.ts +20 -0
- package/dist/blz-rds-mysqlx/stored-procedure.js +1 -0
- package/dist/blz-rds-oracle/index.d.ts +25 -0
- package/dist/blz-rds-oracle/index.js +1 -0
- package/dist/blz-rds-postgres/base.d.ts +94 -0
- package/dist/blz-rds-postgres/base.js +1 -0
- package/dist/blz-rds-postgres/connection-manager.d.ts +6 -0
- package/dist/blz-rds-postgres/connection-manager.js +1 -0
- package/dist/blz-rds-postgres/execute-bulk-insert.d.ts +5 -0
- package/dist/blz-rds-postgres/execute-bulk-insert.js +1 -0
- package/dist/blz-rds-postgres/execute-bulk-merge.d.ts +4 -0
- package/dist/blz-rds-postgres/execute-bulk-merge.js +1 -0
- package/dist/blz-rds-postgres/execute-non-query.d.ts +12 -0
- package/dist/blz-rds-postgres/execute-non-query.js +1 -0
- package/dist/blz-rds-postgres/execute-query.d.ts +4 -0
- package/dist/blz-rds-postgres/execute-query.js +1 -0
- package/dist/blz-rds-postgres/index.d.ts +9 -0
- package/dist/blz-rds-postgres/index.js +1 -0
- package/dist/blz-rds-postgres/result-set.js +1 -0
- package/dist/blz-rds-postgres/stored-procedure.d.ts +19 -0
- package/dist/blz-rds-postgres/stored-procedure.js +1 -0
- package/dist/blz-redis/index.d.ts +31 -0
- package/dist/blz-redis/index.js +1 -0
- package/dist/blz-redis/lib/redisCache.d.ts +33 -0
- package/dist/blz-redis/lib/redisCache.js +1 -0
- package/dist/blz-regex/index.d.ts +3 -0
- package/dist/blz-regex/index.js +1 -0
- package/dist/blz-security/__test__/autorization.test.js +1 -0
- package/dist/blz-security/__test__/autorizationKpn.test.js +1 -0
- package/dist/blz-security/__test__/orderManagement.test.js +1 -0
- package/dist/blz-security/__test__/secureUrl.test.js +1 -0
- package/dist/blz-security/__test__/solveMergeRule.test.js +1 -0
- package/dist/blz-security/__test__/sqlInjectionGuard.test.js +1 -0
- package/dist/blz-security/__test__/xssGuard.test.js +1 -0
- package/dist/blz-security/authorizationService.d.ts +42 -0
- package/dist/blz-security/authorizationService.js +2 -0
- package/dist/blz-security/config/global.js +1 -0
- package/dist/blz-security/filescanner/index.d.ts +24 -0
- package/dist/blz-security/filescanner/index.js +1 -0
- package/dist/blz-security/helpers/consts.d.ts +28 -0
- package/dist/blz-security/helpers/consts.js +1 -0
- package/dist/blz-security/helpers/utils.d.ts +82 -0
- package/dist/blz-security/helpers/utils.js +1 -0
- package/dist/blz-security/implementations/cache.d.ts +58 -0
- package/dist/blz-security/implementations/cache.js +1 -0
- package/dist/blz-security/implementations/oidc.d.ts +100 -0
- package/dist/blz-security/implementations/oidc.js +1 -0
- package/dist/blz-security/implementations/pkceCacheStore.d.ts +2 -0
- package/dist/blz-security/implementations/pkceCacheStore.js +1 -0
- package/dist/blz-security/implementations/saml.js +1 -0
- package/dist/blz-security/implementations/uma.d.ts +31 -0
- package/dist/blz-security/implementations/uma.js +1 -0
- package/dist/blz-security/implementations/webAuthn.js +1 -0
- package/dist/blz-security/implementations/wstg.js +1 -0
- package/dist/blz-security/index.d.ts +4 -0
- package/dist/blz-security/index.js +2 -0
- package/dist/blz-security/lab/index.js +1 -0
- package/dist/blz-security/middleware/HapiServerAzureAd.d.ts +26 -0
- package/dist/blz-security/middleware/HapiServerAzureAd.js +1 -0
- package/dist/blz-security/middleware/HapiServerKeycloak.d.ts +47 -0
- package/dist/blz-security/middleware/HapiServerKeycloak.js +1 -0
- package/dist/blz-security/middleware/HapiServerSimToken.d.ts +13 -0
- package/dist/blz-security/middleware/HapiServerSimToken.js +1 -0
- package/dist/blz-security/middleware/hapi.d.ts +14 -0
- package/dist/blz-security/middleware/hapi.js +1 -0
- package/dist/blz-security/middleware/hapiServer.js +1 -0
- package/dist/blz-security/navigationMemoryRepository.d.ts +6 -0
- package/dist/blz-security/navigationMemoryRepository.js +1 -0
- package/dist/blz-security/navigationMongoDbRepository.d.ts +15 -0
- package/dist/blz-security/navigationMongoDbRepository.js +1 -0
- package/dist/blz-security/secureUrlService.d.ts +7 -0
- package/dist/blz-security/secureUrlService.js +1 -0
- package/dist/blz-security/securityService.d.ts +72 -0
- package/dist/blz-security/securityService.js +1 -0
- package/dist/blz-security/sqlInjectionGuard.d.ts +37 -0
- package/dist/blz-security/sqlInjectionGuard.js +1 -0
- package/dist/blz-security/xssGuard.d.ts +14 -0
- package/dist/blz-security/xssGuard.js +1 -0
- package/dist/blz-strings/index.d.ts +42 -0
- package/dist/blz-strings/index.js +1 -0
- package/dist/blz-uuid/index.d.ts +1 -0
- package/dist/blz-uuid/index.js +1 -0
- package/dist/blz-yaml/index.d.ts +2 -0
- package/dist/blz-yaml/index.js +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.js +1 -0
- package/dist/process-managers/index.d.ts +25 -0
- package/dist/process-managers/index.js +1 -0
- package/package.json +52 -41
- package/blz-base/health/index.js +0 -215
- package/blz-base/index.js +0 -1466
- package/blz-cache/LruCache.js +0 -44
- package/blz-cache/index.js +0 -29
- package/blz-config/index.js +0 -434
- package/blz-core/index.js +0 -364
- package/blz-cryptography/index.js +0 -54
- package/blz-datetimes/index.js +0 -356
- package/blz-file/example.dat +0 -2545
- package/blz-file/fileService.js +0 -205
- package/blz-file/index.js +0 -94
- package/blz-file/index.test.js +0 -31
- package/blz-file/lab.js +0 -33
- package/blz-hazelcast/index.js +0 -189
- package/blz-hazelcast/lib/credentials.js +0 -25
- package/blz-hazelcast/lib/credentialsFactory.js +0 -12
- package/blz-hazelcast/lib/hazelcastCache.js +0 -234
- package/blz-iterable/index.js +0 -446
- package/blz-json-schema/index.js +0 -11
- package/blz-jwt/index.js +0 -121
- package/blz-kafka/index.js +0 -522
- package/blz-math/index.js +0 -131
- package/blz-mongodb/index.js +0 -326
- package/blz-rds/__test__/scape.test.js +0 -58
- package/blz-rds/blz-rds-executor.js +0 -578
- package/blz-rds/blz-rds-helper.js +0 -310
- package/blz-rds/commands/core/add.js +0 -13
- package/blz-rds/commands/core/and.js +0 -18
- package/blz-rds/commands/core/asc.js +0 -10
- package/blz-rds/commands/core/avg.js +0 -10
- package/blz-rds/commands/core/column-ref.js +0 -8
- package/blz-rds/commands/core/count-distinct.js +0 -10
- package/blz-rds/commands/core/count.js +0 -10
- package/blz-rds/commands/core/decimal.js +0 -8
- package/blz-rds/commands/core/desc.js +0 -10
- package/blz-rds/commands/core/distinct.js +0 -10
- package/blz-rds/commands/core/divide.js +0 -11
- package/blz-rds/commands/core/embedded-exists.js +0 -17
- package/blz-rds/commands/core/embedded-select.js +0 -17
- package/blz-rds/commands/core/equals.js +0 -9
- package/blz-rds/commands/core/false.js +0 -8
- package/blz-rds/commands/core/greater-or-equal.js +0 -9
- package/blz-rds/commands/core/greater.js +0 -9
- package/blz-rds/commands/core/in.js +0 -9
- package/blz-rds/commands/core/integer.js +0 -8
- package/blz-rds/commands/core/is-not-null.js +0 -11
- package/blz-rds/commands/core/is-null-or-value.js +0 -10
- package/blz-rds/commands/core/is-null.js +0 -11
- package/blz-rds/commands/core/less-or-equal.js +0 -9
- package/blz-rds/commands/core/less-unary.js +0 -12
- package/blz-rds/commands/core/less.js +0 -9
- package/blz-rds/commands/core/like.js +0 -12
- package/blz-rds/commands/core/max.js +0 -10
- package/blz-rds/commands/core/min.js +0 -10
- package/blz-rds/commands/core/multiply.js +0 -13
- package/blz-rds/commands/core/not-equals.js +0 -9
- package/blz-rds/commands/core/not-in.js +0 -9
- package/blz-rds/commands/core/not.js +0 -13
- package/blz-rds/commands/core/null.js +0 -8
- package/blz-rds/commands/core/nvl.js +0 -11
- package/blz-rds/commands/core/or.js +0 -13
- package/blz-rds/commands/core/parameter.js +0 -34
- package/blz-rds/commands/core/remainder.js +0 -16
- package/blz-rds/commands/core/string.js +0 -8
- package/blz-rds/commands/core/subtract.js +0 -13
- package/blz-rds/commands/core/sum.js +0 -10
- package/blz-rds/commands/core/true.js +0 -8
- package/blz-rds/commands/core/tuple.js +0 -13
- package/blz-rds/commands/datetimes/add-days.js +0 -11
- package/blz-rds/commands/datetimes/add-hours.js +0 -11
- package/blz-rds/commands/datetimes/add-milliseconds.js +0 -11
- package/blz-rds/commands/datetimes/add-minutes.js +0 -11
- package/blz-rds/commands/datetimes/add-months.js +0 -11
- package/blz-rds/commands/datetimes/add-seconds.js +0 -11
- package/blz-rds/commands/datetimes/add-years.js +0 -11
- package/blz-rds/commands/datetimes/date-diff.js +0 -11
- package/blz-rds/commands/datetimes/date.js +0 -12
- package/blz-rds/commands/datetimes/datetime-diff.js +0 -11
- package/blz-rds/commands/datetimes/datetime.js +0 -15
- package/blz-rds/commands/datetimes/day.js +0 -10
- package/blz-rds/commands/datetimes/hour.js +0 -10
- package/blz-rds/commands/datetimes/millisecond.js +0 -10
- package/blz-rds/commands/datetimes/minute.js +0 -10
- package/blz-rds/commands/datetimes/month-text.js +0 -10
- package/blz-rds/commands/datetimes/month.js +0 -10
- package/blz-rds/commands/datetimes/now.js +0 -9
- package/blz-rds/commands/datetimes/second.js +0 -10
- package/blz-rds/commands/datetimes/subtract-days.js +0 -11
- package/blz-rds/commands/datetimes/subtract-hours.js +0 -11
- package/blz-rds/commands/datetimes/subtract-milliseconds.js +0 -11
- package/blz-rds/commands/datetimes/subtract-minutes.js +0 -11
- package/blz-rds/commands/datetimes/subtract-seconds.js +0 -11
- package/blz-rds/commands/datetimes/time-diff.js +0 -11
- package/blz-rds/commands/datetimes/time.js +0 -13
- package/blz-rds/commands/datetimes/today.js +0 -9
- package/blz-rds/commands/datetimes/week-day-text.js +0 -10
- package/blz-rds/commands/datetimes/week-day.js +0 -10
- package/blz-rds/commands/datetimes/week.js +0 -10
- package/blz-rds/commands/datetimes/year.js +0 -10
- package/blz-rds/commands/math/abs.js +0 -10
- package/blz-rds/commands/math/acos.js +0 -10
- package/blz-rds/commands/math/asin.js +0 -10
- package/blz-rds/commands/math/atan.js +0 -10
- package/blz-rds/commands/math/atan2.js +0 -11
- package/blz-rds/commands/math/ceil.js +0 -10
- package/blz-rds/commands/math/cos.js +0 -10
- package/blz-rds/commands/math/cosh.js +0 -10
- package/blz-rds/commands/math/exp.js +0 -10
- package/blz-rds/commands/math/floor.js +0 -10
- package/blz-rds/commands/math/log.js +0 -18
- package/blz-rds/commands/math/log10.js +0 -10
- package/blz-rds/commands/math/pow.js +0 -11
- package/blz-rds/commands/math/random.js +0 -9
- package/blz-rds/commands/math/round.js +0 -18
- package/blz-rds/commands/math/sign.js +0 -10
- package/blz-rds/commands/math/sin.js +0 -10
- package/blz-rds/commands/math/sinh.js +0 -10
- package/blz-rds/commands/math/sqrt.js +0 -10
- package/blz-rds/commands/math/tan.js +0 -10
- package/blz-rds/commands/math/tanh.js +0 -10
- package/blz-rds/commands/math/trunc.js +0 -18
- package/blz-rds/commands/strings/concat.js +0 -20
- package/blz-rds/commands/strings/contains.js +0 -12
- package/blz-rds/commands/strings/ends-with.js +0 -12
- package/blz-rds/commands/strings/index-of.js +0 -11
- package/blz-rds/commands/strings/is-null-or-empty.js +0 -11
- package/blz-rds/commands/strings/is-null-or-white-space.js +0 -11
- package/blz-rds/commands/strings/join.js +0 -22
- package/blz-rds/commands/strings/last-index-of.js +0 -11
- package/blz-rds/commands/strings/length.js +0 -10
- package/blz-rds/commands/strings/pad-left.js +0 -20
- package/blz-rds/commands/strings/pad-right.js +0 -20
- package/blz-rds/commands/strings/replace.js +0 -12
- package/blz-rds/commands/strings/starts-with.js +0 -12
- package/blz-rds/commands/strings/substring.js +0 -12
- package/blz-rds/commands/strings/to-lower.js +0 -10
- package/blz-rds/commands/strings/to-upper.js +0 -10
- package/blz-rds/commands/strings/trim-end.js +0 -10
- package/blz-rds/commands/strings/trim-start.js +0 -10
- package/blz-rds/commands/strings/trim.js +0 -10
- package/blz-rds/index.js +0 -744
- package/blz-rds-mysql/base.js +0 -857
- package/blz-rds-mysql/connection-manager.js +0 -129
- package/blz-rds-mysql/execute-bulk-insert.js +0 -35
- package/blz-rds-mysql/execute-bulk-merge.js +0 -45
- package/blz-rds-mysql/execute-non-query.js +0 -34
- package/blz-rds-mysql/execute-query.js +0 -50
- package/blz-rds-mysql/index.js +0 -41
- package/blz-rds-mysql/stored-procedure.js +0 -207
- package/blz-rds-mysqlx/base.js +0 -846
- package/blz-rds-mysqlx/connection-manager.js +0 -141
- package/blz-rds-mysqlx/execute-bulk-insert.js +0 -35
- package/blz-rds-mysqlx/execute-bulk-merge.js +0 -45
- package/blz-rds-mysqlx/execute-non-query.js +0 -29
- package/blz-rds-mysqlx/execute-query.js +0 -39
- package/blz-rds-mysqlx/index.js +0 -41
- package/blz-rds-mysqlx/stored-procedure.js +0 -179
- package/blz-rds-oracle/index.js +0 -539
- package/blz-rds-postgres/base.js +0 -861
- package/blz-rds-postgres/connection-manager.js +0 -225
- package/blz-rds-postgres/execute-bulk-insert.js +0 -81
- package/blz-rds-postgres/execute-bulk-merge.js +0 -93
- package/blz-rds-postgres/execute-non-query.js +0 -23
- package/blz-rds-postgres/execute-query.js +0 -37
- package/blz-rds-postgres/index.js +0 -41
- package/blz-rds-postgres/result-set.js +0 -51
- package/blz-rds-postgres/stored-procedure.js +0 -116
- package/blz-redis/index.js +0 -217
- package/blz-redis/lib/redisCache.js +0 -265
- package/blz-regex/index.js +0 -25
- package/blz-security/.eslintrc.js +0 -15
- package/blz-security/__test__/AuthorizationKpn.yaml +0 -1149
- package/blz-security/__test__/FinancingSetting.yaml +0 -177
- package/blz-security/__test__/KpnConfigPortal.yaml +0 -330
- package/blz-security/__test__/OrderManagement.yaml +0 -5190
- package/blz-security/__test__/Security.yaml +0 -128
- package/blz-security/__test__/autorization.test.js +0 -105
- package/blz-security/__test__/autorizationKpn.test.js +0 -42
- package/blz-security/__test__/orderManagement.test.js +0 -26
- package/blz-security/__test__/secureUrl.test.js +0 -79
- package/blz-security/__test__/solveMergeRule.test.js +0 -109
- package/blz-security/__test__/sqlInjectionGuard.test.js +0 -203
- package/blz-security/__test__/xssGuard.test.js +0 -204
- package/blz-security/authorizationService.js +0 -537
- package/blz-security/config/global.js +0 -8
- package/blz-security/config/welcome +0 -8
- package/blz-security/doc/README.md +0 -75
- package/blz-security/filescanner/index.js +0 -46
- package/blz-security/helpers/consts.js +0 -229
- package/blz-security/helpers/utils.js +0 -267
- package/blz-security/implementations/cache.js +0 -90
- package/blz-security/implementations/oidc.js +0 -404
- package/blz-security/implementations/pkceCacheStore.js +0 -23
- package/blz-security/implementations/saml.js +0 -10
- package/blz-security/implementations/uma.js +0 -63
- package/blz-security/implementations/webAuthn.js +0 -9
- package/blz-security/implementations/wstg.js +0 -72
- package/blz-security/index.js +0 -77
- package/blz-security/lab/index.js +0 -43
- package/blz-security/middleware/HapiServerAzureAd.js +0 -681
- package/blz-security/middleware/HapiServerKeycloak.js +0 -876
- package/blz-security/middleware/HapiServerSimToken.js +0 -286
- package/blz-security/middleware/hapi.js +0 -555
- package/blz-security/middleware/hapiServer.js +0 -1008
- package/blz-security/navigationMemoryRepository.js +0 -15
- package/blz-security/navigationMongoDbRepository.js +0 -73
- package/blz-security/secureUrlService.js +0 -47
- package/blz-security/securityService.js +0 -413
- package/blz-security/sqlInjectionGuard.js +0 -162
- package/blz-security/templates/forbidden.html +0 -0
- package/blz-security/templates/session-iframe-azure-ad.html +0 -7
- package/blz-security/templates/session-iframe.html +0 -73
- package/blz-security/templates/unauthorized.html +0 -1
- package/blz-security/xssGuard.js +0 -87
- package/blz-strings/index.js +0 -167
- package/blz-uuid/index.js +0 -7
- package/blz-yaml/index.js +0 -19
- package/index.js +0 -84
- package/process-managers/index.js +0 -422
- /package/{blz-rds-mysql → dist/blz-rds-mysql}/syntaxis.json +0 -0
- /package/{blz-rds-mysqlx → dist/blz-rds-mysqlx}/syntaxis.json +0 -0
- /package/{blz-rds-oracle → dist/blz-rds-oracle}/syntaxis.json +0 -0
- /package/{blz-rds-postgres → dist/blz-rds-postgres}/syntaxis.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/ConfigurationAdmin.agent.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/frontend.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/result.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/resultOnWeb.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/rules.json +0 -0
- /package/{blz-security → dist/blz-security}/lab/securityRules.json +0 -0
package/blz-rds-mysqlx/base.js
DELETED
|
@@ -1,846 +0,0 @@
|
|
|
1
|
-
const Fs = require('fs-extra');
|
|
2
|
-
const toString = Object.prototype.toString;
|
|
3
|
-
const dayjs = require("dayjs");
|
|
4
|
-
const utc = require('dayjs/plugin/utc')
|
|
5
|
-
const _ = require('underscore');
|
|
6
|
-
const { h3lp } = require('h3lp');
|
|
7
|
-
dayjs.extend(utc);
|
|
8
|
-
module.exports = {
|
|
9
|
-
replace: function (string, search, replace) {
|
|
10
|
-
return string.split(search).join(replace)
|
|
11
|
-
},
|
|
12
|
-
error: function (code, data, innerError = new Error("UndefinedError")) {
|
|
13
|
-
let err = new Error(`${code} ${innerError.message}`);
|
|
14
|
-
err.code = code;
|
|
15
|
-
if (data) {
|
|
16
|
-
err.data = data;
|
|
17
|
-
}
|
|
18
|
-
err.innerError = innerError;
|
|
19
|
-
return err;
|
|
20
|
-
},
|
|
21
|
-
errorUndefinedArgument: function (argName) {
|
|
22
|
-
return this.error('UndefinedArgument', { argName: argName });
|
|
23
|
-
},
|
|
24
|
-
tryString: function (value) {
|
|
25
|
-
if (toString.call(value) === '[object String]')
|
|
26
|
-
return value;
|
|
27
|
-
else
|
|
28
|
-
return null;
|
|
29
|
-
},
|
|
30
|
-
tryInteger: function (value) {
|
|
31
|
-
if (toString.call(value) === '[object Number]' && value === parseInt(value))
|
|
32
|
-
return value;
|
|
33
|
-
else
|
|
34
|
-
return null;
|
|
35
|
-
},
|
|
36
|
-
tryDecimal: function (value) {
|
|
37
|
-
if (toString.call(value) === '[object Number]')
|
|
38
|
-
return value;
|
|
39
|
-
else
|
|
40
|
-
return null;
|
|
41
|
-
},
|
|
42
|
-
tryBoolean: function (value) {
|
|
43
|
-
if (toString.call(value) === '[object Boolean]')
|
|
44
|
-
return value;
|
|
45
|
-
else
|
|
46
|
-
return null;
|
|
47
|
-
},
|
|
48
|
-
tryDatetime: function (value) {
|
|
49
|
-
let strType = toString.call(value);
|
|
50
|
-
if (strType === '[object Date]') {
|
|
51
|
-
return value;
|
|
52
|
-
}
|
|
53
|
-
else if (strType === '[object String]') {
|
|
54
|
-
let match = /^(\d{4})-(\d{1,2})-(\d{1,2})[T,\s](\d{1,2})\:(\d{1,2})\:(\d{1,2})\.?(\d+)?Z?$/.exec(value);
|
|
55
|
-
if (match) {
|
|
56
|
-
const probableDate = new Date(value);
|
|
57
|
-
if (probableDate.toString() !== 'Invalid Date') {
|
|
58
|
-
return probableDate;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
return null;
|
|
63
|
-
},
|
|
64
|
-
tryDate: function (value) {
|
|
65
|
-
let strType = toString.call(value);
|
|
66
|
-
if (strType === '[object Date]') {
|
|
67
|
-
return new Date(Date.UTC(value.getUTCFullYear(), value.getUTCMonth(), value.getUTCDate(), 0, 0, 0, 0));
|
|
68
|
-
}
|
|
69
|
-
else if (strType === '[object String]') {
|
|
70
|
-
let match = /^(\d{4})-(\d{1,2})-(\d{1,2})$/.exec(value);
|
|
71
|
-
if (match)
|
|
72
|
-
return new Date(Date.UTC(Number(match[1]), Number(match[2]) - 1, Number(match[3]), 0, 0, 0, 0));
|
|
73
|
-
}
|
|
74
|
-
return null;
|
|
75
|
-
},
|
|
76
|
-
tryTime: function (value) {
|
|
77
|
-
let convertMilliseconds = function(strMilliseconds) {
|
|
78
|
-
if (strMilliseconds) {
|
|
79
|
-
if (strMilliseconds.length < 3)
|
|
80
|
-
strMilliseconds = strMilliseconds.padEnd(3, '0');
|
|
81
|
-
if (strMilliseconds.length > 3)
|
|
82
|
-
strMilliseconds = strMilliseconds.substr(0, 3);
|
|
83
|
-
return Number(strMilliseconds);
|
|
84
|
-
}
|
|
85
|
-
else
|
|
86
|
-
return 0;
|
|
87
|
-
};
|
|
88
|
-
let strType = toString.call(value);
|
|
89
|
-
if (strType === '[object Date]') {
|
|
90
|
-
return new Date(Date.UTC(1970, 0, 1, value.getUTCHours(), value.getUTCMinutes(), value.getUTCSeconds(), value.getUTCMilliseconds()));
|
|
91
|
-
}
|
|
92
|
-
else if (strType === '[object String]') {
|
|
93
|
-
let match = /^(\d{1,2})\:(\d{1,2})\:(\d{1,2})\.?(\d+)?$/.exec(value);
|
|
94
|
-
if (match)
|
|
95
|
-
return new Date(Date.UTC(1970, 0, 1, Number(match[1]), Number(match[2]), Number(match[3]), convertMilliseconds(match[4])));
|
|
96
|
-
}
|
|
97
|
-
return null;
|
|
98
|
-
},
|
|
99
|
-
tryBinary: function (value) {
|
|
100
|
-
if (Buffer.isBuffer(value)) {
|
|
101
|
-
return value;
|
|
102
|
-
}
|
|
103
|
-
else if (Array.isArray(value)) {
|
|
104
|
-
return Buffer.from(value);
|
|
105
|
-
}
|
|
106
|
-
return null;
|
|
107
|
-
},
|
|
108
|
-
tryObject: function (value) {
|
|
109
|
-
if (toString.call(value) === '[object Object]')
|
|
110
|
-
return value;
|
|
111
|
-
else
|
|
112
|
-
return null;
|
|
113
|
-
},
|
|
114
|
-
tryArray: function (value) {
|
|
115
|
-
if (toString.call(value) === '[object Array]')
|
|
116
|
-
return value;
|
|
117
|
-
else
|
|
118
|
-
return null;
|
|
119
|
-
},
|
|
120
|
-
ensureString: function (value) {
|
|
121
|
-
let string = this.tryString(value);
|
|
122
|
-
if (string !== null)
|
|
123
|
-
return string;
|
|
124
|
-
else
|
|
125
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'string' });
|
|
126
|
-
},
|
|
127
|
-
ensureInteger: function (value) {
|
|
128
|
-
let integer = this.tryInteger(value);
|
|
129
|
-
if (integer !== null)
|
|
130
|
-
return integer;
|
|
131
|
-
else
|
|
132
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'integer' });
|
|
133
|
-
},
|
|
134
|
-
ensureDecimal: function (value) {
|
|
135
|
-
let decimal = this.tryDecimal(value);
|
|
136
|
-
if (decimal !== null)
|
|
137
|
-
return decimal;
|
|
138
|
-
else
|
|
139
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'decimal' });
|
|
140
|
-
},
|
|
141
|
-
ensureBoolean: function (value) {
|
|
142
|
-
let boolean = this.tryBoolean(value);
|
|
143
|
-
if (boolean !== null)
|
|
144
|
-
return boolean;
|
|
145
|
-
else
|
|
146
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'boolean' });
|
|
147
|
-
},
|
|
148
|
-
ensureDatetime: function (value) {
|
|
149
|
-
let datetime = this.tryDatetime(value);
|
|
150
|
-
if (datetime !== null)
|
|
151
|
-
return datetime;
|
|
152
|
-
else
|
|
153
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'datetime' });
|
|
154
|
-
},
|
|
155
|
-
ensureDate: function (value) {
|
|
156
|
-
let date = this.tryDate(value);
|
|
157
|
-
if (date !== null)
|
|
158
|
-
return date;
|
|
159
|
-
else
|
|
160
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'date' });
|
|
161
|
-
},
|
|
162
|
-
ensureTime: function (value) {
|
|
163
|
-
let time = this.tryTime(value);
|
|
164
|
-
if (time !== null)
|
|
165
|
-
return time;
|
|
166
|
-
else
|
|
167
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'time' });
|
|
168
|
-
},
|
|
169
|
-
ensureBinary: function (value) {
|
|
170
|
-
let binary = this.tryBinary(value);
|
|
171
|
-
if (binary !== null)
|
|
172
|
-
return binary;
|
|
173
|
-
else
|
|
174
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'binary' });
|
|
175
|
-
},
|
|
176
|
-
ensureObject: function (value) {
|
|
177
|
-
let object = this.tryObject(value);
|
|
178
|
-
if (object !== null)
|
|
179
|
-
return array;
|
|
180
|
-
else
|
|
181
|
-
throw this.error('UnexpectedType', { value: object, expectedType: 'object' });
|
|
182
|
-
},
|
|
183
|
-
ensureArray: function (value) {
|
|
184
|
-
let array = this.tryArray(value);
|
|
185
|
-
if (array !== null)
|
|
186
|
-
return array;
|
|
187
|
-
else
|
|
188
|
-
throw this.error('UnexpectedType', { value: value, expectedType: 'array' });
|
|
189
|
-
},
|
|
190
|
-
convertToString: function (value) {
|
|
191
|
-
if (value === null)
|
|
192
|
-
return null;
|
|
193
|
-
let string = this.tryString(value);
|
|
194
|
-
if (string !== null)
|
|
195
|
-
return string;
|
|
196
|
-
let integer = this.tryInteger(value);
|
|
197
|
-
if (integer !== null)
|
|
198
|
-
return integer.toString();
|
|
199
|
-
let decimal = this.tryDecimal(value);
|
|
200
|
-
if (decimal !== null)
|
|
201
|
-
return decimal.toString();
|
|
202
|
-
let boolean = this.tryBoolean(value);
|
|
203
|
-
if (boolean !== null)
|
|
204
|
-
return boolean ? 'true' : 'false';
|
|
205
|
-
let datetime = this.tryDatetime(value);
|
|
206
|
-
if (datetime !== null)
|
|
207
|
-
return datetime.toJSON();
|
|
208
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'string' });
|
|
209
|
-
},
|
|
210
|
-
convertToInteger: function (value) {
|
|
211
|
-
if (value === null)
|
|
212
|
-
return null;
|
|
213
|
-
let integer = this.tryInteger(value);
|
|
214
|
-
if (integer !== null)
|
|
215
|
-
return integer;
|
|
216
|
-
let string = this.tryString(value);
|
|
217
|
-
if (string !== null && !isNaN(string))
|
|
218
|
-
return Math.round(Number(string));
|
|
219
|
-
let decimal = this.tryDecimal(value);
|
|
220
|
-
if (decimal !== null)
|
|
221
|
-
return Math.round(decimal);
|
|
222
|
-
let boolean = this.tryBoolean(value);
|
|
223
|
-
if (boolean !== null)
|
|
224
|
-
return boolean ? 1 : 0;
|
|
225
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'integer' });
|
|
226
|
-
},
|
|
227
|
-
convertToDecimal: function (value) {
|
|
228
|
-
if (value === null)
|
|
229
|
-
return null;
|
|
230
|
-
let decimal = this.tryDecimal(value);
|
|
231
|
-
if (decimal !== null)
|
|
232
|
-
return decimal;
|
|
233
|
-
let string = this.tryString(value);
|
|
234
|
-
if (string !== null && !isNaN(string))
|
|
235
|
-
return Number(string);
|
|
236
|
-
let integer = this.tryInteger(value);
|
|
237
|
-
if (integer !== null)
|
|
238
|
-
return integer;
|
|
239
|
-
let boolean = this.tryBoolean(value);
|
|
240
|
-
if (boolean !== null)
|
|
241
|
-
return boolean ? 1 : 0;
|
|
242
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'decimal' });
|
|
243
|
-
},
|
|
244
|
-
convertToBoolean: function (value) {
|
|
245
|
-
if (value === null)
|
|
246
|
-
return null;
|
|
247
|
-
let boolean = this.tryBoolean(value);
|
|
248
|
-
if (boolean !== null)
|
|
249
|
-
return boolean;
|
|
250
|
-
let string = this.tryString(value);
|
|
251
|
-
if (string !== null && (string === '1' || string.toUpperCase() === 'T' || string.toUpperCase() === 'TRUE' || string.toUpperCase() === 'Y' || string.toUpperCase() === 'YES'))
|
|
252
|
-
return true;
|
|
253
|
-
if (string !== null && (string === '0' || string.toUpperCase() === 'F' || string.toUpperCase() === 'FALSE' || string.toUpperCase() === 'N' || string.toUpperCase() === 'NO'))
|
|
254
|
-
return false;
|
|
255
|
-
let integer = this.tryInteger(value);
|
|
256
|
-
if (integer !== null && integer === 1)
|
|
257
|
-
return true;
|
|
258
|
-
if (integer !== null && integer === 0)
|
|
259
|
-
return false;
|
|
260
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'boolean' });
|
|
261
|
-
},
|
|
262
|
-
convertToDatetime: function (value) {
|
|
263
|
-
if (value === null)
|
|
264
|
-
return null;
|
|
265
|
-
let datetime = this.tryDatetime(value);
|
|
266
|
-
if (datetime !== null)
|
|
267
|
-
return datetime;
|
|
268
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'datetime' });
|
|
269
|
-
},
|
|
270
|
-
convertToDate: function (value) {
|
|
271
|
-
if (value === null)
|
|
272
|
-
return null;
|
|
273
|
-
let date = this.tryDate(value);
|
|
274
|
-
if (date !== null)
|
|
275
|
-
return date;
|
|
276
|
-
let datetime = this.tryDatetime(value);
|
|
277
|
-
if (datetime !== null)
|
|
278
|
-
return new Date(Date.UTC(datetime.getUTCFullYear(), datetime.getUTCMonth(), datetime.getUTCDate(), 0, 0, 0, 0));
|
|
279
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'date' });
|
|
280
|
-
},
|
|
281
|
-
convertToTime: function (value) {
|
|
282
|
-
if (value === null)
|
|
283
|
-
return null;
|
|
284
|
-
let time = this.tryTime(value);
|
|
285
|
-
if (time !== null)
|
|
286
|
-
return time;
|
|
287
|
-
let datetime = this.tryDatetime(value);
|
|
288
|
-
if (datetime !== null)
|
|
289
|
-
return new Date(Date.UTC(1970, 0, 1, datetime.getUTCHours(), datetime.getUTCMinutes(), datetime.getUTCSeconds(), datetime.getUTCMilliseconds()));
|
|
290
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'time' });
|
|
291
|
-
},
|
|
292
|
-
convertToBinary: function (value) {
|
|
293
|
-
if (value == null)
|
|
294
|
-
return null;
|
|
295
|
-
let binary = this.tryBinary(value);
|
|
296
|
-
if (binary !== null)
|
|
297
|
-
return binary;
|
|
298
|
-
throw this.error('InvalidConversion', { value: value, targetType: 'binary' });
|
|
299
|
-
},
|
|
300
|
-
convertToListOfStrings: function (value) {
|
|
301
|
-
if (Array.isArray(value)) {
|
|
302
|
-
let list = [];
|
|
303
|
-
for (let i = 0; i < value.length; i++) {
|
|
304
|
-
list.push(this.convertToString(value[i]));
|
|
305
|
-
}
|
|
306
|
-
return list;
|
|
307
|
-
}
|
|
308
|
-
else {
|
|
309
|
-
return [this.convertToString(value)];
|
|
310
|
-
}
|
|
311
|
-
},
|
|
312
|
-
convertToListOfIntegers: function (value) {
|
|
313
|
-
if (Array.isArray(value)) {
|
|
314
|
-
let list = [];
|
|
315
|
-
for (let i = 0; i < value.length; i++) {
|
|
316
|
-
list.push(this.convertToInteger(value[i]));
|
|
317
|
-
}
|
|
318
|
-
return list;
|
|
319
|
-
}
|
|
320
|
-
else {
|
|
321
|
-
return [this.convertToInteger(value)];
|
|
322
|
-
}
|
|
323
|
-
},
|
|
324
|
-
convertToListOfDecimals: function (value) {
|
|
325
|
-
if (Array.isArray(value)) {
|
|
326
|
-
let list = [];
|
|
327
|
-
for (let i = 0; i < value.length; i++) {
|
|
328
|
-
list.push(this.convertToDecimal(value[i]));
|
|
329
|
-
}
|
|
330
|
-
return list;
|
|
331
|
-
}
|
|
332
|
-
else {
|
|
333
|
-
return [this.convertToDecimal(value)];
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
convertToListOfBooleans: function (value) {
|
|
337
|
-
if (Array.isArray(value)) {
|
|
338
|
-
let list = [];
|
|
339
|
-
for (let i = 0; i < value.length; i++) {
|
|
340
|
-
list.push(this.convertToBoolean(value[i]));
|
|
341
|
-
}
|
|
342
|
-
return list;
|
|
343
|
-
}
|
|
344
|
-
else {
|
|
345
|
-
return [this.convertToBoolean(value)];
|
|
346
|
-
}
|
|
347
|
-
},
|
|
348
|
-
convertToListOfDatetimes: function (value) {
|
|
349
|
-
if (Array.isArray(value)) {
|
|
350
|
-
let list = [];
|
|
351
|
-
for (let i = 0; i < value.length; i++) {
|
|
352
|
-
list.push(this.convertToDatetime(value[i]));
|
|
353
|
-
}
|
|
354
|
-
return list;
|
|
355
|
-
}
|
|
356
|
-
else {
|
|
357
|
-
return [this.convertToDatetime(value)];
|
|
358
|
-
}
|
|
359
|
-
},
|
|
360
|
-
convertToListOfDates: function (value) {
|
|
361
|
-
if (Array.isArray(value)) {
|
|
362
|
-
let list = [];
|
|
363
|
-
for (let i = 0; i < value.length; i++) {
|
|
364
|
-
list.push(this.convertToDate(value[i]));
|
|
365
|
-
}
|
|
366
|
-
return list;
|
|
367
|
-
}
|
|
368
|
-
else {
|
|
369
|
-
return [this.convertToDate(value)];
|
|
370
|
-
}
|
|
371
|
-
},
|
|
372
|
-
convertToListOfTimes: function (value) {
|
|
373
|
-
if (Array.isArray(value)) {
|
|
374
|
-
let list = [];
|
|
375
|
-
for (let i = 0; i < value.length; i++) {
|
|
376
|
-
list.push(this.convertToTime(value[i]));
|
|
377
|
-
}
|
|
378
|
-
return list;
|
|
379
|
-
}
|
|
380
|
-
else {
|
|
381
|
-
return [this.convertToTime(value)];
|
|
382
|
-
}
|
|
383
|
-
},
|
|
384
|
-
convertToListOfBinaries: function (value) {
|
|
385
|
-
if (Array.isArray(value)) {
|
|
386
|
-
let list = [];
|
|
387
|
-
for (let i = 0; i < value.length; i++) {
|
|
388
|
-
list.push(this.convertToBinary(value[i]));
|
|
389
|
-
}
|
|
390
|
-
return list;
|
|
391
|
-
}
|
|
392
|
-
else {
|
|
393
|
-
return [this.convertToBinary(value)];
|
|
394
|
-
}
|
|
395
|
-
},
|
|
396
|
-
httpCall: function (httpRequest) {
|
|
397
|
-
return new Promise(function (response, reject) {
|
|
398
|
-
let options = {
|
|
399
|
-
method: httpRequest.method ? httpRequest.method.toLowerCase() : 'get',
|
|
400
|
-
headers: {},
|
|
401
|
-
body: httpRequest.body
|
|
402
|
-
};
|
|
403
|
-
if (httpRequest.headers)
|
|
404
|
-
for (let i = 0; i < httpRequest.headers.length; i++) {
|
|
405
|
-
let httpHeader = httpRequest.headers[i];
|
|
406
|
-
options.headers[httpHeader.name] = httpHeader.value;
|
|
407
|
-
}
|
|
408
|
-
});
|
|
409
|
-
},
|
|
410
|
-
isNotNull: function (value) {
|
|
411
|
-
return value !== null;
|
|
412
|
-
},
|
|
413
|
-
isNull: function (value) {
|
|
414
|
-
return value === null;
|
|
415
|
-
},
|
|
416
|
-
isNullOrValue: function (value, valueToCompare) {
|
|
417
|
-
return value === null || this.compare(value, valueToCompare) === 0;
|
|
418
|
-
},
|
|
419
|
-
nvl: function (value, replacementValue) {
|
|
420
|
-
return value !== null ? value : replacementValue;
|
|
421
|
-
},
|
|
422
|
-
get: function (objOrTuple, codePathOrIndex) {
|
|
423
|
-
if (objOrTuple === null)
|
|
424
|
-
return null;
|
|
425
|
-
else {
|
|
426
|
-
let obj = this.tryObject(objOrTuple);
|
|
427
|
-
if (obj) {
|
|
428
|
-
let posPoint = codePathOrIndex.indexOf('.');
|
|
429
|
-
if (posPoint === -1)
|
|
430
|
-
return obj[codePathOrIndex] !== undefined ? obj[codePathOrIndex] : null;
|
|
431
|
-
else
|
|
432
|
-
return this.get(obj[codePathOrIndex.substring(0, posPoint)], codePathOrIndex.substring(posPoint + 1, codePathOrIndex.length));
|
|
433
|
-
}
|
|
434
|
-
if (toString.call(objOrTuple) === '[object Error]') {
|
|
435
|
-
let error = objOrTuple;
|
|
436
|
-
let posPoint = codePathOrIndex.indexOf('.');
|
|
437
|
-
if (posPoint === -1)
|
|
438
|
-
return error[codePathOrIndex] !== undefined ? error[codePathOrIndex] : null;
|
|
439
|
-
else
|
|
440
|
-
return this.get(error[codePathOrIndex.substring(0, posPoint)], codePathOrIndex.substring(posPoint + 1, codePathOrIndex.length));
|
|
441
|
-
}
|
|
442
|
-
let tuple = this.tryArray(objOrTuple);
|
|
443
|
-
if (tuple) {
|
|
444
|
-
return tuple[codePathOrIndex];
|
|
445
|
-
}
|
|
446
|
-
return null;
|
|
447
|
-
}
|
|
448
|
-
},
|
|
449
|
-
and: function (value1, value2) {
|
|
450
|
-
return this.ensureBoolean(value1) && this.ensureBoolean(value2);
|
|
451
|
-
},
|
|
452
|
-
or: function (value1, value2) {
|
|
453
|
-
return this.ensureBoolean(value1) || this.ensureBoolean(value2);
|
|
454
|
-
},
|
|
455
|
-
not: function (value) {
|
|
456
|
-
return !this.ensureBoolean(value);
|
|
457
|
-
},
|
|
458
|
-
compare: function (value1, value2) { // TODO: Sort require for objects
|
|
459
|
-
let compareClassic = function (value1, value2) {
|
|
460
|
-
if (value1 === value2)
|
|
461
|
-
return 0;
|
|
462
|
-
else if (value1 < value2)
|
|
463
|
-
return -1;
|
|
464
|
-
else if (value1 > value2)
|
|
465
|
-
return 1;
|
|
466
|
-
else
|
|
467
|
-
return null;
|
|
468
|
-
};
|
|
469
|
-
if (value1 === null && value2 === null)
|
|
470
|
-
return 0;
|
|
471
|
-
if (value1 === null && value2 !== null)
|
|
472
|
-
return -1;
|
|
473
|
-
if (value1 !== null && value2 === null)
|
|
474
|
-
return 1;
|
|
475
|
-
let string1 = this.tryString(value1);
|
|
476
|
-
let string2 = this.tryString(value2);
|
|
477
|
-
if (string1 !== null && string2 !== null)
|
|
478
|
-
return compareClassic(string1, string2);
|
|
479
|
-
let decimal1 = this.tryDecimal(value1);
|
|
480
|
-
let decimal2 = this.tryDecimal(value2);
|
|
481
|
-
if (decimal1 !== null && decimal2 !== null)
|
|
482
|
-
return compareClassic(decimal1, decimal2);
|
|
483
|
-
let boolean1 = this.tryBoolean(value1);
|
|
484
|
-
let boolean2 = this.tryBoolean(value2);
|
|
485
|
-
if (boolean1 !== null && boolean2 !== null)
|
|
486
|
-
return compareClassic(boolean1, boolean2);
|
|
487
|
-
let datetime1 = this.tryDatetime(value1);
|
|
488
|
-
let datetime2 = this.tryDatetime(value2);
|
|
489
|
-
if (datetime1 !== null && datetime2 !== null)
|
|
490
|
-
return compareClassic(datetime1.toJSON(), datetime2.toJSON());
|
|
491
|
-
let date1 = this.tryDate(value1);
|
|
492
|
-
let date2 = this.tryDate(value2);
|
|
493
|
-
if (date1 !== null && date2 !== null)
|
|
494
|
-
return compareClassic(date1.toJSON(), date2.toJSON());
|
|
495
|
-
let time1 = this.tryTime(value1);
|
|
496
|
-
let time2 = this.tryTime(value2);
|
|
497
|
-
if (time1 !== null && time2 !== null)
|
|
498
|
-
return compareClassic(time1.toJSON(), time2.toJSON());
|
|
499
|
-
let array1 = this.tryArray(value1);
|
|
500
|
-
let array2 = this.tryArray(value2);
|
|
501
|
-
if (array1 !== null && array2 !== null) {
|
|
502
|
-
let result;
|
|
503
|
-
result = compareClassic(array1.length, array2.length);
|
|
504
|
-
if (result !== 0)
|
|
505
|
-
return result;
|
|
506
|
-
for (let i = 0; i < array1.length; i++) {
|
|
507
|
-
if (result === 0) {
|
|
508
|
-
let item1 = array1[i];
|
|
509
|
-
let item2 = array2[i];
|
|
510
|
-
result = this.compare(item1, item2);
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
|
-
return result;
|
|
514
|
-
}
|
|
515
|
-
let binary1 = this.tryBinary(value1);
|
|
516
|
-
let binary2 = this.tryBinary(value2);
|
|
517
|
-
if (binary1 !== null && binary2 !== null)
|
|
518
|
-
return Buffer.compare(binary1, binary2);
|
|
519
|
-
let obj1 = this.tryObject(value1);
|
|
520
|
-
let obj2 = this.tryObject(value2);
|
|
521
|
-
if (obj1 !== null && obj2 !== null) {
|
|
522
|
-
////Only other option is we have object. JsonStringify is more performant than deepAssert by 42%
|
|
523
|
-
return compareClassic(JSON.stringify(obj1), JSON.stringify(obj2));
|
|
524
|
-
}
|
|
525
|
-
return null;
|
|
526
|
-
},
|
|
527
|
-
equals: function (value1, value2) {
|
|
528
|
-
return this.compare(value1, value2) === 0;
|
|
529
|
-
},
|
|
530
|
-
notEquals: function (value1, value2) {
|
|
531
|
-
return this.compare(value1, value2) !== 0;
|
|
532
|
-
},
|
|
533
|
-
greater: function (value1, value2) {
|
|
534
|
-
return this.compare(value1, value2) > 0;
|
|
535
|
-
},
|
|
536
|
-
less: function (value1, value2) {
|
|
537
|
-
return this.compare(value1, value2) < 0;
|
|
538
|
-
},
|
|
539
|
-
greaterOrEqual: function (value1, value2) {
|
|
540
|
-
return this.compare(value1, value2) >= 0;
|
|
541
|
-
},
|
|
542
|
-
lessOrEqual: function (value1, value2) {
|
|
543
|
-
return this.compare(value1, value2) <= 0;
|
|
544
|
-
},
|
|
545
|
-
concat: function (value1, value2) {
|
|
546
|
-
if (value1 === null)
|
|
547
|
-
return value2;
|
|
548
|
-
if (value2 === null)
|
|
549
|
-
return value1;
|
|
550
|
-
let string1 = this.ensureString(value1);
|
|
551
|
-
let string2 = this.ensureString(value2);
|
|
552
|
-
return string1 + string2;
|
|
553
|
-
},
|
|
554
|
-
add: function (value1, value2) {
|
|
555
|
-
if (value1 === null)
|
|
556
|
-
return value2;
|
|
557
|
-
if (value2 === null)
|
|
558
|
-
return value1;
|
|
559
|
-
let integer1 = this.tryInteger(value1);
|
|
560
|
-
let integer2 = this.tryInteger(value2);
|
|
561
|
-
if (integer1 !== null && integer2 !== null)
|
|
562
|
-
return integer1 + integer2;
|
|
563
|
-
let decimal1 = this.ensureDecimal(value1);
|
|
564
|
-
let decimal2 = this.ensureDecimal(value2);
|
|
565
|
-
return decimal1 + decimal2;
|
|
566
|
-
},
|
|
567
|
-
subtract: function (value1, value2) {
|
|
568
|
-
if (value1 === null)
|
|
569
|
-
return null;
|
|
570
|
-
if (value2 === null)
|
|
571
|
-
return value1;
|
|
572
|
-
let integer1 = this.tryInteger(value1);
|
|
573
|
-
let integer2 = this.tryInteger(value2);
|
|
574
|
-
if (integer1 !== null && integer2 !== null)
|
|
575
|
-
return integer1 - integer2;
|
|
576
|
-
let decimal1 = this.ensureDecimal(value1);
|
|
577
|
-
let decimal2 = this.ensureDecimal(value2);
|
|
578
|
-
return decimal1 - decimal2;
|
|
579
|
-
},
|
|
580
|
-
multiply: function (value1, value2) {
|
|
581
|
-
if (value1 === null)
|
|
582
|
-
return null;
|
|
583
|
-
if (value2 === null)
|
|
584
|
-
return null;
|
|
585
|
-
let integer1 = this.tryInteger(value1);
|
|
586
|
-
let integer2 = this.tryInteger(value2);
|
|
587
|
-
if (integer1 !== null && integer2 !== null)
|
|
588
|
-
return integer1 * integer2;
|
|
589
|
-
let decimal1 = this.ensureDecimal(value1);
|
|
590
|
-
let decimal2 = this.ensureDecimal(value2);
|
|
591
|
-
return decimal1 * decimal2;
|
|
592
|
-
},
|
|
593
|
-
divide: function (value1, value2) {
|
|
594
|
-
if (value1 === null)
|
|
595
|
-
return null;
|
|
596
|
-
let decimal1 = this.ensureDecimal(value1);
|
|
597
|
-
let decimal2 = this.ensureDecimal(value2);
|
|
598
|
-
if (decimal2 === 0)
|
|
599
|
-
throw this.error('DivisionByZero');
|
|
600
|
-
return decimal1 / decimal2;
|
|
601
|
-
},
|
|
602
|
-
remainder: function (value1, value2) {
|
|
603
|
-
if (value1 === null)
|
|
604
|
-
return null;
|
|
605
|
-
let decimal1 = this.ensureDecimal(value1);
|
|
606
|
-
let decimal2 = this.ensureDecimal(value2);
|
|
607
|
-
if (decimal2 === 0)
|
|
608
|
-
throw this.error('DivisionByZero');
|
|
609
|
-
return decimal1 % decimal2;
|
|
610
|
-
},
|
|
611
|
-
lessUnary: function (value) {
|
|
612
|
-
if (value === null)
|
|
613
|
-
return null;
|
|
614
|
-
let integer = this.tryInteger(value);
|
|
615
|
-
if (integer !== null)
|
|
616
|
-
return -integer;
|
|
617
|
-
let decimal = this.ensureDecimal(value);
|
|
618
|
-
return -decimal;
|
|
619
|
-
},
|
|
620
|
-
datetimeAdd: function (value1, value2) {
|
|
621
|
-
if (value1 === null)
|
|
622
|
-
return null;
|
|
623
|
-
if (value2 === null)
|
|
624
|
-
return value1;
|
|
625
|
-
let datetime = this.ensureDatetime(value1);
|
|
626
|
-
let milliseconds = this.ensureInteger(value2);
|
|
627
|
-
return new Date(Date.UTC(datetime.getUTCFullYear(), datetime.getUTCMonth(), datetime.getUTCDate(), datetime.getUTCHours(), datetime.getUTCMinutes(), datetime.getUTCSeconds(), datetime.getUTCMilliseconds() + milliseconds));
|
|
628
|
-
},
|
|
629
|
-
datetimeDiff: function (value1, value2) {
|
|
630
|
-
if (value1 === null)
|
|
631
|
-
return null;
|
|
632
|
-
if (value2 === null)
|
|
633
|
-
return value1;
|
|
634
|
-
let datetime1 = this.ensureDatetime(value1);
|
|
635
|
-
let datetime2 = this.ensureDatetime(value2);
|
|
636
|
-
return datetime1 - datetime2;
|
|
637
|
-
},
|
|
638
|
-
dateAdd: function (value1, value2) {
|
|
639
|
-
if (value1 === null)
|
|
640
|
-
return null;
|
|
641
|
-
if (value2 === null)
|
|
642
|
-
return value1;
|
|
643
|
-
let date = this.ensureDate(value1);
|
|
644
|
-
let days = this.ensureInteger(value2);
|
|
645
|
-
return new Date(Date.UTC(date.getUTCFullYear(), date.getUTCMonth(), date.getUTCDate() + days, 0, 0, 0 ,0));
|
|
646
|
-
},
|
|
647
|
-
dateDiff: function (value1, value2) {
|
|
648
|
-
if (value1 === null)
|
|
649
|
-
return null;
|
|
650
|
-
if (value2 === null)
|
|
651
|
-
return value1;
|
|
652
|
-
let date1 = this.ensureDate(value1);
|
|
653
|
-
let date2 = this.ensureDate(value2);
|
|
654
|
-
return (date1 - date2) / 86400000;
|
|
655
|
-
},
|
|
656
|
-
timeAdd: function (value1, value2) {
|
|
657
|
-
if (value1 === null)
|
|
658
|
-
return null;
|
|
659
|
-
if (value2 === null)
|
|
660
|
-
return value1;
|
|
661
|
-
let time = this.ensureTime(value1);
|
|
662
|
-
let milliseconds = this.ensureInteger(value2);
|
|
663
|
-
return new Date(Date.UTC(1970, 0, 1, time.getUTCHours(), time.getUTCMinutes(), time.getUTCSeconds(), time.getUTCMilliseconds() + milliseconds));
|
|
664
|
-
},
|
|
665
|
-
timeDiff: function (value1, value2) {
|
|
666
|
-
if (value1 === null)
|
|
667
|
-
return null;
|
|
668
|
-
if (value2 === null)
|
|
669
|
-
return value1;
|
|
670
|
-
let time1 = this.ensureTime(value1);
|
|
671
|
-
let time2 = this.ensureTime(value2);
|
|
672
|
-
return time1 - time2;
|
|
673
|
-
},
|
|
674
|
-
jsonParse: function (value) {
|
|
675
|
-
if (value === undefined)
|
|
676
|
-
throw this.errorUndefinedArgument('value');
|
|
677
|
-
if (value === null)
|
|
678
|
-
return null;
|
|
679
|
-
let obj = JSON.parse(this.ensureString(value));
|
|
680
|
-
return obj;
|
|
681
|
-
},
|
|
682
|
-
jsonStringify: function (value, spaces) {
|
|
683
|
-
if (value === undefined)
|
|
684
|
-
throw this.errorUndefinedArgument('value');
|
|
685
|
-
if (value === null)
|
|
686
|
-
return null;
|
|
687
|
-
if (spaces === undefined || spaces === null) {
|
|
688
|
-
let stringified = JSON.stringify(value);
|
|
689
|
-
return stringified;
|
|
690
|
-
} else {
|
|
691
|
-
let identSpaces = this.ensureInteger(spaces);
|
|
692
|
-
let stringified = JSON.stringify(value, null, identSpaces);
|
|
693
|
-
return stringified;
|
|
694
|
-
}
|
|
695
|
-
},
|
|
696
|
-
base64Decode: function (value) {
|
|
697
|
-
if (value === undefined)
|
|
698
|
-
throw this.errorUndefinedArgument('value');
|
|
699
|
-
if (value === null)
|
|
700
|
-
return null;
|
|
701
|
-
let ensuredString = this.ensureString(value);
|
|
702
|
-
return Buffer.from(ensuredString, 'base64');
|
|
703
|
-
},
|
|
704
|
-
base64Encode: function (value) {
|
|
705
|
-
if (value === undefined)
|
|
706
|
-
throw this.errorUndefinedArgument('value');
|
|
707
|
-
if (value === null)
|
|
708
|
-
return null;
|
|
709
|
-
let ensuredBinary = this.ensureBinary(value);
|
|
710
|
-
return Buffer.from(ensuredBinary).toString('base64');
|
|
711
|
-
},
|
|
712
|
-
apply: function (obj1, obj2) {
|
|
713
|
-
let result = {};
|
|
714
|
-
if (obj1 === null)
|
|
715
|
-
return null;
|
|
716
|
-
let obj1Ok = this.tryObject(obj1);
|
|
717
|
-
if (obj1Ok === null)
|
|
718
|
-
throw fnError('InvalidObject', { value: obj1 });
|
|
719
|
-
for (let key in obj1Ok) {
|
|
720
|
-
result[key] = obj1Ok[key];
|
|
721
|
-
}
|
|
722
|
-
if (obj2 !== null) {
|
|
723
|
-
let obj2Ok = this.tryObject(obj2);
|
|
724
|
-
if (obj2Ok === null)
|
|
725
|
-
throw fnError('InvalidObject', { value: obj2 });
|
|
726
|
-
for (let key in obj2Ok) {
|
|
727
|
-
result[key] = obj2Ok[key];
|
|
728
|
-
}
|
|
729
|
-
}
|
|
730
|
-
return result;
|
|
731
|
-
},
|
|
732
|
-
stringFormat: function () {
|
|
733
|
-
if (arguments.length === 0) {
|
|
734
|
-
return null;
|
|
735
|
-
}
|
|
736
|
-
else if (arguments.length === 1) {
|
|
737
|
-
return arguments[0];
|
|
738
|
-
}
|
|
739
|
-
else {
|
|
740
|
-
let result = arguments[0];
|
|
741
|
-
for (let i = 1; i < arguments.length; i++) {
|
|
742
|
-
result = result.split('%' + i + '$s').join(arguments[i]);
|
|
743
|
-
}
|
|
744
|
-
return result;
|
|
745
|
-
}
|
|
746
|
-
},
|
|
747
|
-
loadResource: function (name) {
|
|
748
|
-
return Promise.resolve()
|
|
749
|
-
.then(function () {
|
|
750
|
-
if (name.indexOf('.') === -1) {
|
|
751
|
-
return require('../resources/main/' + name + '.json');
|
|
752
|
-
}
|
|
753
|
-
else {
|
|
754
|
-
let nameParts = name.split('.');
|
|
755
|
-
return require('../resources/edges/' + nameParts[0] + '/' + nameParts[1] + '.json');
|
|
756
|
-
}
|
|
757
|
-
});
|
|
758
|
-
},
|
|
759
|
-
existsPath: async function (sourcePath) {
|
|
760
|
-
const fullPath = this.resolvePath(sourcePath)
|
|
761
|
-
return new Promise((resolve) => {
|
|
762
|
-
Fs.access(fullPath, (err) => {
|
|
763
|
-
if (err) {
|
|
764
|
-
resolve(false)
|
|
765
|
-
} else {
|
|
766
|
-
resolve(true)
|
|
767
|
-
}
|
|
768
|
-
})
|
|
769
|
-
})
|
|
770
|
-
},
|
|
771
|
-
resolvePath: function (source) {
|
|
772
|
-
const _source = source.trim()
|
|
773
|
-
if (_source.startsWith('.')) {
|
|
774
|
-
return Path.join(process.cwd(), source)
|
|
775
|
-
}
|
|
776
|
-
if (_source.startsWith('~')) {
|
|
777
|
-
return _source.replace('~', process.env.HOME)
|
|
778
|
-
}
|
|
779
|
-
return source
|
|
780
|
-
},
|
|
781
|
-
readFile: async function(filePath) {
|
|
782
|
-
const fullPath = this.resolvePath(filePath)
|
|
783
|
-
if (!await this.existsPath(fullPath)) {
|
|
784
|
-
return null
|
|
785
|
-
}
|
|
786
|
-
return new Promise((resolve, reject) => {
|
|
787
|
-
Fs.readFile(fullPath, (err, data) => err ? reject(err) : resolve(data.toString('utf8')))
|
|
788
|
-
})
|
|
789
|
-
},
|
|
790
|
-
tryDatetime: function (value) {
|
|
791
|
-
let strType = toString.call(value);
|
|
792
|
-
if (strType === '[object Date]') {
|
|
793
|
-
return value;
|
|
794
|
-
}
|
|
795
|
-
else if (strType === '[object String]') {
|
|
796
|
-
let match = /^(\d{4})-(\d{1,2})-(\d{1,2})[T,\s](\d{1,2})\:(\d{1,2})\:(\d{1,2})\.?(\d+)?Z?$/.exec(value);
|
|
797
|
-
if (match) {
|
|
798
|
-
const probableDate = new Date(value);
|
|
799
|
-
if (probableDate.toString() !== 'Invalid Date') {
|
|
800
|
-
return probableDate;
|
|
801
|
-
}
|
|
802
|
-
}
|
|
803
|
-
}
|
|
804
|
-
return null;
|
|
805
|
-
},
|
|
806
|
-
convertValueToDb: function (value) {
|
|
807
|
-
if (_.isUndefined(value)) {
|
|
808
|
-
return null;
|
|
809
|
-
}
|
|
810
|
-
if(_.isNull(value)) {
|
|
811
|
-
return null;
|
|
812
|
-
}
|
|
813
|
-
if (value === true) {
|
|
814
|
-
return 1;
|
|
815
|
-
}
|
|
816
|
-
if (value === false) {
|
|
817
|
-
return 0;
|
|
818
|
-
}
|
|
819
|
-
let datetime = this.tryDatetime(value);
|
|
820
|
-
if (datetime) {
|
|
821
|
-
return datetime;
|
|
822
|
-
// let result = datetime.toJSON();
|
|
823
|
-
// if (result.length === 24) {
|
|
824
|
-
// result = result.substring(0, 19);
|
|
825
|
-
// }
|
|
826
|
-
// return result;
|
|
827
|
-
}
|
|
828
|
-
return value;
|
|
829
|
-
},
|
|
830
|
-
/**
|
|
831
|
-
* @param {[{name: string, value}]} parameters
|
|
832
|
-
* @returns {Object}
|
|
833
|
-
*/
|
|
834
|
-
reduceParameters: function(parameters,options) {
|
|
835
|
-
const acc = {};
|
|
836
|
-
for ( let i=0; i<parameters.length; i++) {
|
|
837
|
-
const parameter = parameters[i];
|
|
838
|
-
acc[parameter.name] = this.convertValueToDb(parameter.value);
|
|
839
|
-
}
|
|
840
|
-
return acc;
|
|
841
|
-
// _.reduce(parameters, (acc, cur) => {
|
|
842
|
-
// acc[cur.name] = convertValueToDb(cur.value);
|
|
843
|
-
// return acc;
|
|
844
|
-
// }, {});
|
|
845
|
-
}
|
|
846
|
-
}
|