@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/index.js
DELETED
|
@@ -1,744 +0,0 @@
|
|
|
1
|
-
const BlzRdsHelper = require('./blz-rds-helper');
|
|
2
|
-
const BlzRdsExecutor = require('./blz-rds-executor');
|
|
3
|
-
const SqlString = require('sqlstring');
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
const rdsEscapeId = function(identifier) {
|
|
7
|
-
return SqlString.escapeId(identifier)
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
const rdsEscape = function(value) {
|
|
11
|
-
return SqlString.escape(value)
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
const getColumnPrimaryKey = function (rdsTable) {
|
|
15
|
-
for (let i = 0; i < rdsTable.columns.length; i++) {
|
|
16
|
-
let column = rdsTable.columns[i];
|
|
17
|
-
if (column.primaryKey)
|
|
18
|
-
return column;
|
|
19
|
-
}
|
|
20
|
-
return null;
|
|
21
|
-
};
|
|
22
|
-
|
|
23
|
-
const getColumnNameByAlias = function (rdsTable, alias) {
|
|
24
|
-
for (let i = 0; i < rdsTable.columns.length; i++) {
|
|
25
|
-
let column = rdsTable.columns[i];
|
|
26
|
-
if (column.alias === alias)
|
|
27
|
-
return column.name;
|
|
28
|
-
}
|
|
29
|
-
return null;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const setValue = function (obj, codePath, value) {
|
|
33
|
-
let posPoint = codePath.indexOf('.');
|
|
34
|
-
if (posPoint === -1)
|
|
35
|
-
obj[codePath] = value;
|
|
36
|
-
else {
|
|
37
|
-
let firstPart = codePath.substring(0, posPoint);
|
|
38
|
-
let lastParts = codePath.substring(posPoint + 1, codePath.length);
|
|
39
|
-
if (obj[firstPart] === undefined)
|
|
40
|
-
obj[firstPart] = {};
|
|
41
|
-
return setValue(obj[firstPart], lastParts, value);
|
|
42
|
-
}
|
|
43
|
-
};
|
|
44
|
-
|
|
45
|
-
const rdsSelect = async function (callContext, connection, rdsSelectConfig, fnSelector) {
|
|
46
|
-
let rdsTable = connection.rdsElements[rdsSelectConfig.rdsTableName];
|
|
47
|
-
let embeddeds = {};
|
|
48
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: true };
|
|
49
|
-
embeddeds[0] = embedded;
|
|
50
|
-
if (rdsSelectConfig.fields)
|
|
51
|
-
for (let i = 0; i < rdsSelectConfig.fields.length; i++) {
|
|
52
|
-
let field = rdsSelectConfig.fields[i];
|
|
53
|
-
BlzRdsHelper.prebuild(connection, field, embeddeds);
|
|
54
|
-
}
|
|
55
|
-
if (rdsSelectConfig.where)
|
|
56
|
-
BlzRdsHelper.prebuild(connection, rdsSelectConfig.where, embeddeds);
|
|
57
|
-
if (rdsSelectConfig.orders)
|
|
58
|
-
for (let i = 0; i < rdsSelectConfig.orders.length; i++) {
|
|
59
|
-
let order = rdsSelectConfig.orders[i];
|
|
60
|
-
BlzRdsHelper.prebuild(connection, order, embeddeds);
|
|
61
|
-
}
|
|
62
|
-
let sql = '';
|
|
63
|
-
let values = [];
|
|
64
|
-
let types = [];
|
|
65
|
-
let fieldSentencesAggregates = [];
|
|
66
|
-
let fieldSentencesNoAggregates = [];
|
|
67
|
-
for (let i = 0; i < rdsSelectConfig.fields.length; i++) {
|
|
68
|
-
let field = rdsSelectConfig.fields[i];
|
|
69
|
-
let fieldSentence = BlzRdsHelper.getSql(field, connection.provider.syntaxis, values);
|
|
70
|
-
if (field.command === 'avg' || field.command === 'count' || field.command === 'countDistinct' || field.command === 'max' || field.command === 'min' || field.command === 'sum')
|
|
71
|
-
fieldSentencesAggregates.push(fieldSentence);
|
|
72
|
-
else
|
|
73
|
-
fieldSentencesNoAggregates.push(fieldSentence);
|
|
74
|
-
sql += fieldSentence + ' C' + i + ', ';
|
|
75
|
-
types.push(BlzRdsHelper.getType(field));
|
|
76
|
-
}
|
|
77
|
-
sql = sql.slice(0, -2);
|
|
78
|
-
sql += ' FROM ' + rdsTable.tableName + ' T0';
|
|
79
|
-
for (let i = 0; i < embedded.rdsJoins.length; i++) {
|
|
80
|
-
let rdsJoin = embedded.rdsJoins[i];
|
|
81
|
-
sql += ' ' + rdsJoin.sql;
|
|
82
|
-
}
|
|
83
|
-
if (rdsSelectConfig.where) {
|
|
84
|
-
let sqlWhere = BlzRdsHelper.getSql(rdsSelectConfig.where, connection.provider.syntaxis, values, true);
|
|
85
|
-
if (sqlWhere)
|
|
86
|
-
sql += ' WHERE ' + sqlWhere;
|
|
87
|
-
}
|
|
88
|
-
if (fieldSentencesAggregates.length > 0 && fieldSentencesNoAggregates.length > 0) {
|
|
89
|
-
sql += ' GROUP BY ';
|
|
90
|
-
for (let i = 0; i < fieldSentencesNoAggregates.length; i++) {
|
|
91
|
-
sql += fieldSentencesNoAggregates[i] + ', ';
|
|
92
|
-
}
|
|
93
|
-
sql = sql.slice(0, -2);
|
|
94
|
-
}
|
|
95
|
-
if (rdsSelectConfig.orders && rdsSelectConfig.orders.length > 0) {
|
|
96
|
-
let sqlsOrders = [];
|
|
97
|
-
for (let i = 0; i < rdsSelectConfig.orders.length; i++) {
|
|
98
|
-
let order = rdsSelectConfig.orders[i];
|
|
99
|
-
sqlsOrders.push(BlzRdsHelper.getSql(order, connection.provider.syntaxis, values));
|
|
100
|
-
}
|
|
101
|
-
sql += ' ORDER BY ' + sqlsOrders.join(', ');
|
|
102
|
-
}
|
|
103
|
-
if (rdsSelectConfig.offset !== null && rdsSelectConfig.offset !== undefined && rdsSelectConfig.limit !== null && rdsSelectConfig.limit !== undefined)
|
|
104
|
-
sql = BlzRdsHelper.stringFormat(rdsSelectConfig.offset === 0 ? connection.provider.syntaxis.selectWithPaging1 : connection.provider.syntaxis.selectWithPagingN, sql, rdsSelectConfig.offset, rdsSelectConfig.offset + rdsSelectConfig.limit, rdsSelectConfig.limit);
|
|
105
|
-
else
|
|
106
|
-
sql = 'SELECT ' + sql;
|
|
107
|
-
let parameters = [];
|
|
108
|
-
for (let i = 0; i < values.length; i++) {
|
|
109
|
-
let value = values[i];
|
|
110
|
-
parameters.push({ name: 'PARAM' + i, value: value, direction: 'in' });
|
|
111
|
-
}
|
|
112
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, { query: true }, types, fnSelector);
|
|
113
|
-
return result.data;
|
|
114
|
-
};
|
|
115
|
-
|
|
116
|
-
const rdsSelectReader = function (connection, rdsSelectReaderConfig) {
|
|
117
|
-
return {
|
|
118
|
-
_blz_reader: true,
|
|
119
|
-
connection: connection,
|
|
120
|
-
rdsSelectReaderConfig: rdsSelectReaderConfig,
|
|
121
|
-
rdsTable: connection.rdsElements[rdsSelectReaderConfig.rdsTableName],
|
|
122
|
-
read: async function (callContext, codePaths, fnSelection) {
|
|
123
|
-
let rdsSelectConfig = JSON.parse(JSON.stringify(this.rdsSelectReaderConfig));
|
|
124
|
-
rdsSelectConfig.fields = [];
|
|
125
|
-
for (let i = 0; i < codePaths.length; i++) {
|
|
126
|
-
let codePath = codePaths[i];
|
|
127
|
-
if (BlzRdsHelper.isValidCodePath(this.connection, this.rdsTable, codePath)) {
|
|
128
|
-
rdsSelectConfig.fields.push({
|
|
129
|
-
command: 'columnRef',
|
|
130
|
-
columnRef: { codePath: codePath, embeddedIndex: 0 }
|
|
131
|
-
});
|
|
132
|
-
}
|
|
133
|
-
else {
|
|
134
|
-
rdsSelectConfig.fields.push({
|
|
135
|
-
command: 'null'
|
|
136
|
-
});
|
|
137
|
-
}
|
|
138
|
-
}
|
|
139
|
-
return await rdsSelect(
|
|
140
|
-
callContext,
|
|
141
|
-
this.connection,
|
|
142
|
-
rdsSelectConfig,
|
|
143
|
-
async function (row) {
|
|
144
|
-
let obj = {};
|
|
145
|
-
for (let i = 0; i < codePaths.length; i++) {
|
|
146
|
-
let codePath = codePaths[i];
|
|
147
|
-
setValue(obj, codePath, row[i]);
|
|
148
|
-
}
|
|
149
|
-
return await fnSelection(obj);
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const rdsSelectOne = async function (callContext, connection, rdsSelectOneConfig, fnSelector) {
|
|
156
|
-
let rdsTable = connection.rdsElements[rdsSelectOneConfig.rdsTableName];
|
|
157
|
-
let embeddeds = {};
|
|
158
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: true };
|
|
159
|
-
embeddeds[0] = embedded;
|
|
160
|
-
if (rdsSelectOneConfig.fields)
|
|
161
|
-
for (let i = 0; i < rdsSelectOneConfig.fields.length; i++) {
|
|
162
|
-
let field = rdsSelectOneConfig.fields[i];
|
|
163
|
-
BlzRdsHelper.prebuild(connection, field, embeddeds);
|
|
164
|
-
}
|
|
165
|
-
if (rdsSelectOneConfig.where)
|
|
166
|
-
BlzRdsHelper.prebuild(connection, rdsSelectOneConfig.where, embeddeds);
|
|
167
|
-
let sql = '';
|
|
168
|
-
let values = [];
|
|
169
|
-
let types = [];
|
|
170
|
-
sql += 'SELECT ';
|
|
171
|
-
let fieldSentencesAggregates = [];
|
|
172
|
-
let fieldSentencesNoAggregates = [];
|
|
173
|
-
for (let i = 0; i < rdsSelectOneConfig.fields.length; i++) {
|
|
174
|
-
let field = rdsSelectOneConfig.fields[i];
|
|
175
|
-
let fieldSentence = BlzRdsHelper.getSql(field, connection.provider.syntaxis, values);
|
|
176
|
-
if (field.command === 'avg' || field.command === 'count' || field.command === 'countDistinct' || field.command === 'max' || field.command === 'min' || field.command === 'sum')
|
|
177
|
-
fieldSentencesAggregates.push(fieldSentence);
|
|
178
|
-
else
|
|
179
|
-
fieldSentencesNoAggregates.push(fieldSentence);
|
|
180
|
-
sql += fieldSentence + ' C' + i + ', ';
|
|
181
|
-
types.push(BlzRdsHelper.getType(field));
|
|
182
|
-
}
|
|
183
|
-
sql = sql.slice(0, -2);
|
|
184
|
-
sql += ' FROM ' + rdsTable.tableName + ' T0';
|
|
185
|
-
for (let i = 0; i < embedded.rdsJoins.length; i++) {
|
|
186
|
-
let rdsJoin = embedded.rdsJoins[i];
|
|
187
|
-
sql += ' ' + rdsJoin.sql;
|
|
188
|
-
}
|
|
189
|
-
if (rdsSelectOneConfig.where) {
|
|
190
|
-
let sqlWhere = BlzRdsHelper.getSql(rdsSelectOneConfig.where, connection.provider.syntaxis, values, true);
|
|
191
|
-
if (sqlWhere)
|
|
192
|
-
sql += ' WHERE ' + sqlWhere;
|
|
193
|
-
}
|
|
194
|
-
if (fieldSentencesAggregates.length > 0 && fieldSentencesNoAggregates.length > 0) {
|
|
195
|
-
sql += ' GROUP BY ';
|
|
196
|
-
for (let i = 0; i < fieldSentencesNoAggregates.length; i++) {
|
|
197
|
-
sql += fieldSentencesNoAggregates[i] + ', ';
|
|
198
|
-
}
|
|
199
|
-
sql = sql.slice(0, -2);
|
|
200
|
-
}
|
|
201
|
-
let parameters = [];
|
|
202
|
-
for (let i = 0; i < values.length; i++) {
|
|
203
|
-
let value = values[i];
|
|
204
|
-
parameters.push({ name: 'PARAM' + i, value: value, direction: 'in' });
|
|
205
|
-
}
|
|
206
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, { queryOne: true }, types, fnSelector);
|
|
207
|
-
return result.data;
|
|
208
|
-
};
|
|
209
|
-
|
|
210
|
-
const rdsSelectOneReader = function (connection, rdsSelectOneReaderConfig) {
|
|
211
|
-
return {
|
|
212
|
-
_blz_reader: true,
|
|
213
|
-
connection: connection,
|
|
214
|
-
rdsSelectOneReaderConfig: rdsSelectOneReaderConfig,
|
|
215
|
-
rdsTable: connection.rdsElements[rdsSelectOneReaderConfig.rdsTableName],
|
|
216
|
-
read: async function (callContext, codePaths, fnSelection) {
|
|
217
|
-
let rdsSelectOneConfig = JSON.parse(JSON.stringify(this.rdsSelectOneReaderConfig));
|
|
218
|
-
rdsSelectOneConfig.fields = [];
|
|
219
|
-
for (let i = 0; i < codePaths.length; i++) {
|
|
220
|
-
let codePath = codePaths[i];
|
|
221
|
-
if (BlzRdsHelper.isValidCodePath(this.connection, this.rdsTable, codePath)) {
|
|
222
|
-
rdsSelectOneConfig.fields.push({
|
|
223
|
-
command: 'columnRef',
|
|
224
|
-
columnRef: { codePath: codePath, embeddedIndex: 0 }
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
else {
|
|
228
|
-
rdsSelectOneConfig.fields.push({
|
|
229
|
-
command: 'null',
|
|
230
|
-
columnRef: { codePath: codePath, embeddedIndex: 0 }
|
|
231
|
-
});
|
|
232
|
-
}
|
|
233
|
-
}
|
|
234
|
-
return await rdsSelectOne(
|
|
235
|
-
callContext,
|
|
236
|
-
this.connection,
|
|
237
|
-
rdsSelectOneConfig,
|
|
238
|
-
async function (row) {
|
|
239
|
-
let obj = {};
|
|
240
|
-
for (let i = 0; i < codePaths.length; i++) {
|
|
241
|
-
let codePath = codePaths[i];
|
|
242
|
-
setValue(obj, codePath, row[i]);
|
|
243
|
-
}
|
|
244
|
-
return await fnSelection(obj);
|
|
245
|
-
});
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
};
|
|
249
|
-
|
|
250
|
-
const rdsExists = async function (callContext, connection, rdsExistsConfig) {
|
|
251
|
-
let rdsTable = connection.rdsElements[rdsExistsConfig.rdsTableName];
|
|
252
|
-
let embeddeds = {};
|
|
253
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: true };
|
|
254
|
-
embeddeds[0] = embedded;
|
|
255
|
-
if (rdsExistsConfig.where)
|
|
256
|
-
BlzRdsHelper.prebuild(connection, rdsExistsConfig.where, embeddeds);
|
|
257
|
-
let sql = '';
|
|
258
|
-
let values = [];
|
|
259
|
-
sql += 'EXISTS(SELECT 1 FROM ' + rdsTable.tableName + ' T0';
|
|
260
|
-
for (let i = 0; i < embedded.rdsJoins.length; i++) {
|
|
261
|
-
let rdsJoin = embedded.rdsJoins[i];
|
|
262
|
-
sql += ' ' + rdsJoin.sql;
|
|
263
|
-
}
|
|
264
|
-
if (rdsExistsConfig.where) {
|
|
265
|
-
let sqlWhere = BlzRdsHelper.getSql(rdsExistsConfig.where, connection.provider.syntaxis, values, true);
|
|
266
|
-
if (sqlWhere)
|
|
267
|
-
sql += ' WHERE ' + sqlWhere;
|
|
268
|
-
}
|
|
269
|
-
sql += ')';
|
|
270
|
-
sql = BlzRdsHelper.stringFormat(connection.provider.syntaxis.selectExists, sql);
|
|
271
|
-
let parameters = [];
|
|
272
|
-
for (let i = 0; i < values.length; i++) {
|
|
273
|
-
let value = values[i];
|
|
274
|
-
parameters.push({ name: 'PARAM' + i, value: value, direction: 'in' });
|
|
275
|
-
}
|
|
276
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, { queryOne: true }, ['boolean'], function(ctx) { return ctx[0]; });
|
|
277
|
-
return result.data;
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
const rdsInsert = async function (callContext, connection, rdsInsertConfig) {
|
|
281
|
-
let rdsTable = connection.rdsElements[rdsInsertConfig.rdsTableName];
|
|
282
|
-
let embeddeds = {};
|
|
283
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
|
|
284
|
-
embeddeds[0] = embedded;
|
|
285
|
-
if (rdsInsertConfig.sets)
|
|
286
|
-
for (let i = 0; i < rdsInsertConfig.sets.length; i++) {
|
|
287
|
-
let set = rdsInsertConfig.sets[i];
|
|
288
|
-
BlzRdsHelper.prebuild(connection, set.value, embeddeds);
|
|
289
|
-
}
|
|
290
|
-
let sql = '';
|
|
291
|
-
let values = [];
|
|
292
|
-
let setsFields = [];
|
|
293
|
-
let setsValues = [];
|
|
294
|
-
const columns = [];
|
|
295
|
-
for (let i = 0; i < rdsInsertConfig.sets.length; i++) {
|
|
296
|
-
let set = rdsInsertConfig.sets[i];
|
|
297
|
-
setsFields.push(getColumnNameByAlias(rdsTable, set.columnAlias));
|
|
298
|
-
setsValues.push(BlzRdsHelper.getSql(set.value, connection.provider.syntaxis, values));
|
|
299
|
-
columns.push(rdsTable.columns.find(p=> p.alias === set.columnAlias))
|
|
300
|
-
}
|
|
301
|
-
let autoincrementalData = null;
|
|
302
|
-
if (rdsTable.autoincrementalPrimaryKey) {
|
|
303
|
-
if (connection.provider.syntaxis.insertAutoIncremental.indexOf('%2$s') !== -1 && (rdsTable.sequenceName === '' || rdsTable.sequenceName === null || rdsTable.sequenceName === undefined)) {
|
|
304
|
-
let err = new Error();
|
|
305
|
-
err.code = 'RdsError';
|
|
306
|
-
err.message = 'Table ' + rdsTable.tableName + ' does not have sequence defined. Sequence definition is mandatory in the current db provider.';
|
|
307
|
-
throw err;
|
|
308
|
-
}
|
|
309
|
-
autoincrementalData = {
|
|
310
|
-
tableName: rdsTable.tableName,
|
|
311
|
-
sequenceName: rdsTable.sequenceName,
|
|
312
|
-
pkColumnName: getColumnPrimaryKey(rdsTable).name
|
|
313
|
-
};
|
|
314
|
-
sql += BlzRdsHelper.stringFormat(connection.provider.syntaxis.insertAutoIncremental, autoincrementalData.tableName, autoincrementalData.sequenceName, autoincrementalData.pkColumnName, setsFields.join(', '), setsValues.join(', '));
|
|
315
|
-
}
|
|
316
|
-
else {
|
|
317
|
-
sql += 'INSERT INTO ' + rdsTable.tableName + ' (' + setsFields.join(', ') + ') VALUES (' + setsValues.join(', ') + ')';
|
|
318
|
-
}
|
|
319
|
-
let parameters = [];
|
|
320
|
-
for (let i = 0; i < values.length; i++) {
|
|
321
|
-
let value = values[i];
|
|
322
|
-
let columnInfo = await findByAlias(connection.rdsElements[rdsInsertConfig.rdsTableName].columns, rdsInsertConfig.sets[i].columnAlias);
|
|
323
|
-
parameters.push({ name: 'PARAM' + i, value: value, direction: 'in', columnInfo: columnInfo });
|
|
324
|
-
}
|
|
325
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, { autoincrementalData, columns });
|
|
326
|
-
return result.id !== undefined ? result.id : null
|
|
327
|
-
};
|
|
328
|
-
const findByAlias = async function (array, alias) {
|
|
329
|
-
return array.find(obj => obj.alias === alias);
|
|
330
|
-
}
|
|
331
|
-
|
|
332
|
-
const rdsInsertConditional = async function (callContext, connection, rdsInsertConfig) {
|
|
333
|
-
let rdsTable = connection.rdsElements[rdsInsertConfig.rdsTableName];
|
|
334
|
-
let embeddeds = {};
|
|
335
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
|
|
336
|
-
embeddeds[0] = embedded;
|
|
337
|
-
if (rdsInsertConfig.sets)
|
|
338
|
-
for (let i = 0; i < rdsInsertConfig.sets.length; i++) {
|
|
339
|
-
let set = rdsInsertConfig.sets[i];
|
|
340
|
-
BlzRdsHelper.prebuild(connection, set.value, embeddeds);
|
|
341
|
-
}
|
|
342
|
-
if (rdsInsertConfig.where)
|
|
343
|
-
BlzRdsHelper.prebuild(connection, rdsInsertConfig.where, embeddeds);
|
|
344
|
-
let sql = '';
|
|
345
|
-
let values = [];
|
|
346
|
-
let setsFields = [];
|
|
347
|
-
let setsValues = [];
|
|
348
|
-
for (let i = 0; i < rdsInsertConfig.sets.length; i++) {
|
|
349
|
-
let set = rdsInsertConfig.sets[i];
|
|
350
|
-
setsFields.push(getColumnNameByAlias(rdsTable, set.columnAlias));
|
|
351
|
-
setsValues.push(BlzRdsHelper.getSql(set.value, connection.provider.syntaxis, values));
|
|
352
|
-
}
|
|
353
|
-
if (!rdsInsertConfig.where) {
|
|
354
|
-
let err = new Error();
|
|
355
|
-
err.code = 'RdsError';
|
|
356
|
-
err.message = 'Table ' + rdsTable.tableName + ' does not have WHERE defined.';
|
|
357
|
-
throw err;
|
|
358
|
-
}
|
|
359
|
-
const sqlWhere = BlzRdsHelper.getSql(rdsInsertConfig.where, connection.provider.syntaxis, values, true);
|
|
360
|
-
if (!sqlWhere) {
|
|
361
|
-
let err = new Error();
|
|
362
|
-
err.code = 'RdsError';
|
|
363
|
-
err.message = 'Table ' + rdsTable.tableName + ' does not have WHERE defined.';
|
|
364
|
-
throw err;
|
|
365
|
-
}
|
|
366
|
-
let autoincrementalData = null;
|
|
367
|
-
if (rdsTable.autoincrementalPrimaryKey) {
|
|
368
|
-
if (connection.provider.syntaxis.insertConditionalAutoIncremental.indexOf('%2$s') !== -1 && (rdsTable.sequenceName === '' || rdsTable.sequenceName === null || rdsTable.sequenceName === undefined)) {
|
|
369
|
-
let err = new Error();
|
|
370
|
-
err.code = 'RdsError';
|
|
371
|
-
err.message = 'Table ' + rdsTable.tableName + ' does not have sequence defined. Sequence definition is mandatory in the current db provider.';
|
|
372
|
-
throw err;
|
|
373
|
-
}
|
|
374
|
-
autoincrementalData = {
|
|
375
|
-
tableName: rdsTable.tableName,
|
|
376
|
-
sequenceName: rdsTable.sequenceName,
|
|
377
|
-
pkColumnName: getColumnPrimaryKey(rdsTable).name
|
|
378
|
-
};
|
|
379
|
-
sql += BlzRdsHelper.stringFormat(connection.provider.syntaxis.insertConditionalAutoIncremental, autoincrementalData.tableName, autoincrementalData.sequenceName, autoincrementalData.pkColumnName, setsFields.join(', '), setsValues.join(', '), sqlWhere);
|
|
380
|
-
}
|
|
381
|
-
else {
|
|
382
|
-
sql += BlzRdsHelper.stringFormat(connection.provider.syntaxis.insertConditional, rdsTable.tableName, "", "", setsFields.join(', '), setsValues.join(', '), sqlWhere);
|
|
383
|
-
}
|
|
384
|
-
let parameters = [];
|
|
385
|
-
for (let i = 0; i < values.length; i++) {
|
|
386
|
-
let value = values[i];
|
|
387
|
-
parameters.push({ name: 'PARAM' + i, value: value, direction: 'in' });
|
|
388
|
-
}
|
|
389
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, { autoincrementalData: autoincrementalData });
|
|
390
|
-
return result.id !== undefined ? result.id : null
|
|
391
|
-
};
|
|
392
|
-
|
|
393
|
-
const rdsBulkInsert = async function (callContext, connection, rdsInsertConfig) {
|
|
394
|
-
let rdsTable = connection.rdsElements[rdsInsertConfig.rdsTableName];
|
|
395
|
-
let embeddeds = {};
|
|
396
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
|
|
397
|
-
embeddeds[0] = embedded;
|
|
398
|
-
if (!rdsInsertConfig.list || rdsInsertConfig.list.length === 0) {
|
|
399
|
-
return []
|
|
400
|
-
}
|
|
401
|
-
let values = [];
|
|
402
|
-
let setsFields = [];
|
|
403
|
-
const columns = []
|
|
404
|
-
for (let i = 0; i < rdsInsertConfig.sets.length; i++) {
|
|
405
|
-
let field = rdsInsertConfig.sets[i];
|
|
406
|
-
setsFields.push(getColumnNameByAlias(rdsTable, field.columnAlias))
|
|
407
|
-
columns.push(rdsTable.columns.find(p=> p.alias === field.columnAlias))
|
|
408
|
-
}
|
|
409
|
-
for (let i = 0; i < rdsInsertConfig.list.length; i++) {
|
|
410
|
-
let row = rdsInsertConfig.list[i];
|
|
411
|
-
values.push(row);
|
|
412
|
-
}
|
|
413
|
-
let autoincrementalData = null;
|
|
414
|
-
if (rdsTable.autoincrementalPrimaryKey) {
|
|
415
|
-
if (connection.provider.syntaxis.insertAutoIncremental.indexOf('%2$s') !== -1 && (rdsTable.sequenceName === '' || rdsTable.sequenceName === null || rdsTable.sequenceName === undefined)) {
|
|
416
|
-
let err = new Error();
|
|
417
|
-
err.code = 'RdsError';
|
|
418
|
-
err.message = 'Table ' + rdsTable.tableName + ' does not have sequence defined. Sequence definition is mandatory in the current db provider.';
|
|
419
|
-
throw err;
|
|
420
|
-
}
|
|
421
|
-
const pkColumn = getColumnPrimaryKey(rdsTable)
|
|
422
|
-
autoincrementalData = {
|
|
423
|
-
tableName: rdsTable.tableName,
|
|
424
|
-
sequenceName: rdsTable.sequenceName,
|
|
425
|
-
pkColumnName: pkColumn.name,
|
|
426
|
-
pkColumnAlias: pkColumn.alias,
|
|
427
|
-
pkColumnType: pkColumn.type
|
|
428
|
-
};
|
|
429
|
-
}
|
|
430
|
-
const sql = 'INSERT INTO ' + rdsTable.tableName + ' (' + setsFields.join(', ') + ') VALUES ';
|
|
431
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, values, { bulkInsert:true, autoincrementalData: autoincrementalData, columns , setsFields, rdsTable });
|
|
432
|
-
return result.ids !== undefined ? result.ids : null
|
|
433
|
-
};
|
|
434
|
-
|
|
435
|
-
const rdsBulkMerge = async function (callContext, connection, rdsMergeConfig) {
|
|
436
|
-
let rdsTable = connection.rdsElements[rdsMergeConfig.rdsTableName];
|
|
437
|
-
let embeddeds = {};
|
|
438
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
|
|
439
|
-
embeddeds[0] = embedded;
|
|
440
|
-
|
|
441
|
-
if (!rdsMergeConfig.sets || rdsMergeConfig.sets.length === 0) {
|
|
442
|
-
return []
|
|
443
|
-
}
|
|
444
|
-
for (let i = 0; i < rdsMergeConfig.sets.length; i++) {
|
|
445
|
-
let set = rdsMergeConfig.sets[i];
|
|
446
|
-
for (let j = 0; j < set.length; j++) {
|
|
447
|
-
BlzRdsHelper.prebuild(connection, set[j].value, embeddeds);
|
|
448
|
-
}
|
|
449
|
-
}
|
|
450
|
-
let values = [];
|
|
451
|
-
let setsFields = [];
|
|
452
|
-
const columns = []
|
|
453
|
-
const firstRow = rdsMergeConfig.sets[0]
|
|
454
|
-
if (!rdsMergeConfig.fields) {
|
|
455
|
-
let err = new Error();
|
|
456
|
-
err.code = 'RdsError';
|
|
457
|
-
err.message = 'Merge sentence does not have fields defined.';
|
|
458
|
-
throw err;
|
|
459
|
-
}
|
|
460
|
-
for (let i = 0; i < firstRow.length; i++) {
|
|
461
|
-
let field = firstRow[i];
|
|
462
|
-
setsFields.push(getColumnNameByAlias(rdsTable, field.columnAlias))
|
|
463
|
-
columns.push(rdsTable.columns.find(p=> p.alias === field.columnAlias))
|
|
464
|
-
}
|
|
465
|
-
for (let i = 0; i < rdsMergeConfig.sets.length; i++) {
|
|
466
|
-
let set = rdsMergeConfig.sets[i];
|
|
467
|
-
let row = [];
|
|
468
|
-
for (let j = 0; j < set.length; j++) {
|
|
469
|
-
BlzRdsHelper.getSql(set[j].value, connection.provider.syntaxis, row)
|
|
470
|
-
}
|
|
471
|
-
values.push(row);
|
|
472
|
-
}
|
|
473
|
-
let autoincrementalData = null;
|
|
474
|
-
if (rdsTable.autoincrementalPrimaryKey) {
|
|
475
|
-
if (connection.provider.syntaxis.insertAutoIncremental.indexOf('%2$s') !== -1 && (rdsTable.sequenceName === '' || rdsTable.sequenceName === null || rdsTable.sequenceName === undefined)) {
|
|
476
|
-
let err = new Error();
|
|
477
|
-
err.code = 'RdsError';
|
|
478
|
-
err.message = 'Table ' + rdsTable.tableName + ' does not have sequence defined. Sequence definition is mandatory in the current db provider.';
|
|
479
|
-
throw err;
|
|
480
|
-
}
|
|
481
|
-
const pkColumn = getColumnPrimaryKey(rdsTable)
|
|
482
|
-
autoincrementalData = {
|
|
483
|
-
tableName: rdsTable.tableName,
|
|
484
|
-
sequenceName: rdsTable.sequenceName,
|
|
485
|
-
pkColumnName: pkColumn.name,
|
|
486
|
-
pkColumnAlias: pkColumn.alias,
|
|
487
|
-
pkColumnType: pkColumn.type
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
|
-
if (!rdsMergeConfig.fields || !rdsMergeConfig.fields.length || rdsMergeConfig.fields.length === 0) {
|
|
491
|
-
let err = new Error();
|
|
492
|
-
err.code = 'RdsError';
|
|
493
|
-
err.message = 'Merge sentence does not have merge fields defined.';
|
|
494
|
-
throw err;
|
|
495
|
-
}
|
|
496
|
-
const mergeFields = []
|
|
497
|
-
for(const field of rdsMergeConfig.fields) {
|
|
498
|
-
if (!field || !field.columnRef || !field.columnRef.codePath) {
|
|
499
|
-
let err = new Error();
|
|
500
|
-
err.code = 'RdsError';
|
|
501
|
-
err.message = 'Merge sentence does not have merge fields defined.';
|
|
502
|
-
throw err;
|
|
503
|
-
}
|
|
504
|
-
const fieldName = field.columnRef.codePath
|
|
505
|
-
const column = rdsTable.columns.find((p) => p.alias === fieldName)
|
|
506
|
-
if (!column) {
|
|
507
|
-
let err = new Error();
|
|
508
|
-
err.code = 'RdsError';
|
|
509
|
-
err.message = 'Merge sentence does not have merge fields defined.';
|
|
510
|
-
throw err;
|
|
511
|
-
}
|
|
512
|
-
if( !rdsTable.uniqueKeys || rdsTable.uniqueKeys.length === 0 || rdsTable.uniqueKeys.filter(p => p.columnsNames !== undefined && p.columnsNames.find(c => c === column.name)).length === 0 ) {
|
|
513
|
-
if (rdsTable.columns.filter(p => p.primaryKey && p.name === column.name).length === 0) {
|
|
514
|
-
let err = new Error();
|
|
515
|
-
err.code = 'RdsError';
|
|
516
|
-
err.message = 'The field selected to determine the merge must be defined as unique key or primary key';
|
|
517
|
-
throw err;
|
|
518
|
-
}
|
|
519
|
-
}
|
|
520
|
-
}
|
|
521
|
-
const sql = '';
|
|
522
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, values, { bulkMerge:true, mergeFields:mergeFields, autoincrementalData: autoincrementalData, columns , setsFields, rdsTable });
|
|
523
|
-
return result.affectedRows
|
|
524
|
-
};
|
|
525
|
-
|
|
526
|
-
const rdsInsertWriter = function (connection, rdsInsertWriterConfig) {
|
|
527
|
-
return {
|
|
528
|
-
isWriter: true,
|
|
529
|
-
connection: connection,
|
|
530
|
-
rdsInsertWriterConfig: rdsInsertWriterConfig,
|
|
531
|
-
write: async function (callContext, obj) {
|
|
532
|
-
let rdsTable = this.connection.rdsElements[this.rdsInsertWriterConfig.rdsTableName];
|
|
533
|
-
let pkAliases = [];
|
|
534
|
-
for (let i = 0; i < rdsTable.columns.length; i++) {
|
|
535
|
-
let column = rdsTable.columns[i];
|
|
536
|
-
if (column.primaryKey)
|
|
537
|
-
pkAliases.push(column.alias);
|
|
538
|
-
}
|
|
539
|
-
let rdsInsertConfig = JSON.parse(JSON.stringify(this.rdsInsertWriterConfig));
|
|
540
|
-
rdsInsertConfig.sets = [];
|
|
541
|
-
for (var key in obj) {
|
|
542
|
-
var value = obj[key];
|
|
543
|
-
if (!(rdsTable.autoincrementalPrimaryKey && pkAliases.indexOf(key) !== -1))
|
|
544
|
-
rdsInsertConfig.sets.push({ columnAlias: key, value: { command: 'parameter', parameterValue: value } });
|
|
545
|
-
}
|
|
546
|
-
return await rdsInsert(callContext, this.connection, rdsInsertConfig);
|
|
547
|
-
}
|
|
548
|
-
};
|
|
549
|
-
};
|
|
550
|
-
|
|
551
|
-
const rdsUpdate = async function (callContext, connection, rdsUpdateConfig) {
|
|
552
|
-
let rdsTable = connection.rdsElements[rdsUpdateConfig.rdsTableName];
|
|
553
|
-
let embeddeds = {};
|
|
554
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
|
|
555
|
-
embeddeds[0] = embedded;
|
|
556
|
-
if (rdsUpdateConfig.sets)
|
|
557
|
-
for (let i = 0; i < rdsUpdateConfig.sets.length; i++) {
|
|
558
|
-
let set = rdsUpdateConfig.sets[i];
|
|
559
|
-
BlzRdsHelper.prebuild(connection, set.value, embeddeds);
|
|
560
|
-
}
|
|
561
|
-
if (rdsUpdateConfig.where)
|
|
562
|
-
BlzRdsHelper.prebuild(connection, rdsUpdateConfig.where, embeddeds);
|
|
563
|
-
let sql = '';
|
|
564
|
-
let values = [];
|
|
565
|
-
sql += 'UPDATE ' + rdsTable.tableName;
|
|
566
|
-
let setsFieldsValues = [];
|
|
567
|
-
for (let i = 0; i < rdsUpdateConfig.sets.length; i++) {
|
|
568
|
-
let set = rdsUpdateConfig.sets[i];
|
|
569
|
-
setsFieldsValues.push(getColumnNameByAlias(rdsTable, set.columnAlias) + ' = ' + BlzRdsHelper.getSql(set.value, connection.provider.syntaxis, values));
|
|
570
|
-
}
|
|
571
|
-
sql += ' SET ' + setsFieldsValues.join(', ');
|
|
572
|
-
if (rdsUpdateConfig.where) {
|
|
573
|
-
let sqlWhere = BlzRdsHelper.getSql(rdsUpdateConfig.where, connection.provider.syntaxis, values, true);
|
|
574
|
-
if (sqlWhere)
|
|
575
|
-
sql += ' WHERE ' + sqlWhere;
|
|
576
|
-
}
|
|
577
|
-
let parameters = [];
|
|
578
|
-
for (let i = 0; i < values.length; i++) {
|
|
579
|
-
let value = values[i];
|
|
580
|
-
let columnInfo = null;
|
|
581
|
-
if (rdsUpdateConfig.sets[i])
|
|
582
|
-
columnInfo = await findByAlias(connection.rdsElements[rdsUpdateConfig.rdsTableName].columns, rdsUpdateConfig.sets[i].columnAlias);
|
|
583
|
-
parameters.push({ name: 'PARAM' + i, value: value, direction: 'in', columnInfo: columnInfo });
|
|
584
|
-
}
|
|
585
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, null);
|
|
586
|
-
return result.rowsAffected;
|
|
587
|
-
};
|
|
588
|
-
|
|
589
|
-
const rdsUpdateWriter = function (connection, rdsUpdateWriterConfig) {
|
|
590
|
-
return {
|
|
591
|
-
isWriter: true,
|
|
592
|
-
connection: connection,
|
|
593
|
-
rdsUpdateWriterConfig: rdsUpdateWriterConfig,
|
|
594
|
-
write: async function (callContext, obj) {
|
|
595
|
-
let rdsTable = this.connection.rdsElements[this.rdsUpdateWriterConfig.rdsTableName];
|
|
596
|
-
let pkAliases = [];
|
|
597
|
-
for (let i = 0; i < rdsTable.columns.length; i++) {
|
|
598
|
-
let column = rdsTable.columns[i];
|
|
599
|
-
if (column.primaryKey)
|
|
600
|
-
pkAliases.push(column.alias);
|
|
601
|
-
}
|
|
602
|
-
let rdsUpdateConfig = JSON.parse(JSON.stringify(this.rdsUpdateWriterConfig));
|
|
603
|
-
rdsUpdateConfig.sets = [];
|
|
604
|
-
let whereChildren = [];
|
|
605
|
-
for (var key in obj) {
|
|
606
|
-
var value = obj[key];
|
|
607
|
-
if (pkAliases.indexOf(key) === -1)
|
|
608
|
-
rdsUpdateConfig.sets.push({ columnAlias: key, value: { command: 'parameter', parameterValue: value } });
|
|
609
|
-
else
|
|
610
|
-
whereChildren.push({ command: 'equals', children: [{ command: 'columnRef', columnRef: { codePath: key, embeddedIndex: 0 }}, { command: 'parameter', parameterValue: value }] });
|
|
611
|
-
}
|
|
612
|
-
if (whereChildren.length > 0)
|
|
613
|
-
rdsUpdateConfig.where = { command: 'and', children: whereChildren };
|
|
614
|
-
return await rdsUpdate(callContext, this.connection, rdsUpdateConfig);
|
|
615
|
-
}
|
|
616
|
-
};
|
|
617
|
-
};
|
|
618
|
-
|
|
619
|
-
const rdsDelete = async function (callContext, connection, rdsDeleteConfig) {
|
|
620
|
-
let rdsTable = connection.rdsElements[rdsDeleteConfig.rdsTableName];
|
|
621
|
-
let embeddeds = {};
|
|
622
|
-
let embedded = { rdsTable: rdsTable, rdsJoins: [], allowLevels: false };
|
|
623
|
-
embeddeds[0] = embedded;
|
|
624
|
-
if (rdsDeleteConfig.where)
|
|
625
|
-
BlzRdsHelper.prebuild(connection, rdsDeleteConfig.where, embeddeds);
|
|
626
|
-
let sql = '';
|
|
627
|
-
let values = [];
|
|
628
|
-
sql += 'DELETE FROM ' + rdsTable.tableName;
|
|
629
|
-
if (rdsDeleteConfig.where) {
|
|
630
|
-
let sqlWhere = BlzRdsHelper.getSql(rdsDeleteConfig.where, connection.provider.syntaxis, values, true);
|
|
631
|
-
if (sqlWhere)
|
|
632
|
-
sql += ' WHERE ' + sqlWhere;
|
|
633
|
-
}
|
|
634
|
-
let parameters = [];
|
|
635
|
-
for (let i = 0; i < values.length; i++) {
|
|
636
|
-
let value = values[i];
|
|
637
|
-
parameters.push({ name: 'PARAM' + i, value: value, direction: 'in' });
|
|
638
|
-
}
|
|
639
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, parameters, null);
|
|
640
|
-
return result.rowsAffected;
|
|
641
|
-
};
|
|
642
|
-
|
|
643
|
-
const rdsExecuteStoredProcedure = async function (callContext, connection, rdsStoredProcedureName, parameters) {
|
|
644
|
-
let rdsStoredProcedure = connection.rdsElements[rdsStoredProcedureName];
|
|
645
|
-
let spParameterNames = [];
|
|
646
|
-
let spParameters = [];
|
|
647
|
-
if (rdsStoredProcedure.parameters)
|
|
648
|
-
for (let i = 0; i < rdsStoredProcedure.parameters.length; i++) {
|
|
649
|
-
let rdsStoredProcedureParameter = rdsStoredProcedure.parameters[i];
|
|
650
|
-
let spParameter = {
|
|
651
|
-
name: rdsStoredProcedureParameter.name,
|
|
652
|
-
type: rdsStoredProcedureParameter.type,
|
|
653
|
-
direction: rdsStoredProcedureParameter.direction,
|
|
654
|
-
isExplicitParameter: rdsStoredProcedureParameter.isExplicitParameter,
|
|
655
|
-
isResultSet: rdsStoredProcedureParameter.isResultSet,
|
|
656
|
-
attributes: rdsStoredProcedureParameter.attributes,
|
|
657
|
-
dbTypes: rdsStoredProcedureParameter.dbTypes
|
|
658
|
-
};
|
|
659
|
-
if (!rdsStoredProcedureParameter.isResultSet ||
|
|
660
|
-
(rdsStoredProcedureParameter.isResultSet && (connection.provider.syntaxis.storedProcedureResultSet === 'explicit' || (connection.provider.syntaxis.storedProcedureResultSet !== 'implicit' && rdsStoredProcedureParameter.isExplicitParameter)))) {
|
|
661
|
-
spParameterNames.push(BlzRdsHelper.stringFormat(connection.provider.syntaxis.core.parameter, rdsStoredProcedureParameter.name));
|
|
662
|
-
spParameter.isExplicitParameter = true;
|
|
663
|
-
}
|
|
664
|
-
else {
|
|
665
|
-
spParameter.isExplicitParameter = false;
|
|
666
|
-
}
|
|
667
|
-
if (parameters)
|
|
668
|
-
spParameter.value = parameters[rdsStoredProcedureParameter.name];
|
|
669
|
-
spParameters.push(spParameter);
|
|
670
|
-
}
|
|
671
|
-
let sql = BlzRdsHelper.stringFormat(connection.provider.syntaxis.executeStoredProcedure, rdsStoredProcedure.storedProcedureName, spParameterNames.join(', '));
|
|
672
|
-
return (await BlzRdsExecutor.execute(callContext, connection, sql, spParameters, null)).outParameters;
|
|
673
|
-
};
|
|
674
|
-
|
|
675
|
-
const rdsExecuteQuery = async function (callContext, connection, sql, parameters, resultTypes) {
|
|
676
|
-
let sqlParameters = [];
|
|
677
|
-
for (let name in parameters) {
|
|
678
|
-
sql = sql.split('@' + name).join(BlzRdsHelper.stringFormat(connection.provider.syntaxis.core.parameter, name));
|
|
679
|
-
sqlParameters.push({ name: name, value: parameters[name], direction: 'in' });
|
|
680
|
-
}
|
|
681
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, sqlParameters, { query: true }, resultTypes, function (row) { return row; });
|
|
682
|
-
return result.data;
|
|
683
|
-
};
|
|
684
|
-
|
|
685
|
-
const rdsExecuteNonQuery = async function (callContext, connection, sql, parameters) {
|
|
686
|
-
let sqlParameters = [];
|
|
687
|
-
for (let name in parameters) {
|
|
688
|
-
sql = sql.split('@' + name).join(BlzRdsHelper.stringFormat(connection.provider.syntaxis.core.parameter, name));
|
|
689
|
-
sqlParameters.push({ name: name, value: parameters[name], direction: 'in' });
|
|
690
|
-
}
|
|
691
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, sqlParameters, null);
|
|
692
|
-
return result.rowsAffected;
|
|
693
|
-
};
|
|
694
|
-
|
|
695
|
-
const rdsConnectionHealthCheck = async function (connection, callContext) {
|
|
696
|
-
let sql = '';
|
|
697
|
-
let sqlParameters = [];
|
|
698
|
-
switch (connection.providerName) {
|
|
699
|
-
case 'Postgres': {
|
|
700
|
-
sql = 'SELECT NOW();'
|
|
701
|
-
break;
|
|
702
|
-
}
|
|
703
|
-
case 'Oracle': {
|
|
704
|
-
sql = 'SELECT SYSDATE FROM DUAL'
|
|
705
|
-
break;
|
|
706
|
-
}
|
|
707
|
-
default:{
|
|
708
|
-
return { error: "Provider not yet implemented"}
|
|
709
|
-
}
|
|
710
|
-
}
|
|
711
|
-
// If this sql query was able to return a date, connection works
|
|
712
|
-
try {
|
|
713
|
-
let result = await BlzRdsExecutor.execute(callContext, connection, sql, sqlParameters, { query: true }, null, function (row) { return row; });
|
|
714
|
-
if (result && result.data && result.data.length === 1) {
|
|
715
|
-
return { status: "ok", message: `Connection works, server datetime: ${JSON.stringify(result.data)}` }
|
|
716
|
-
} else {
|
|
717
|
-
return { status: "error", error: `Unable to obtain date from database ${JSON.stringify(result)}` }
|
|
718
|
-
}
|
|
719
|
-
} catch (error) {
|
|
720
|
-
return { status: "error", error: JSON.stringify(error) }
|
|
721
|
-
}
|
|
722
|
-
};
|
|
723
|
-
|
|
724
|
-
module.exports = {
|
|
725
|
-
rdsSelect,
|
|
726
|
-
rdsSelectReader,
|
|
727
|
-
rdsSelectOne,
|
|
728
|
-
rdsSelectOneReader,
|
|
729
|
-
rdsExists,
|
|
730
|
-
rdsInsert,
|
|
731
|
-
rdsInsertConditional,
|
|
732
|
-
rdsBulkInsert,
|
|
733
|
-
rdsBulkMerge,
|
|
734
|
-
rdsInsertWriter,
|
|
735
|
-
rdsUpdate,
|
|
736
|
-
rdsUpdateWriter,
|
|
737
|
-
rdsDelete,
|
|
738
|
-
rdsExecuteStoredProcedure,
|
|
739
|
-
rdsExecuteQuery,
|
|
740
|
-
rdsExecuteNonQuery,
|
|
741
|
-
rdsConnectionHealthCheck,
|
|
742
|
-
rdsEscape,
|
|
743
|
-
rdsEscapeId
|
|
744
|
-
}
|