@blazedpath/commons 0.3.1 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -4
- package/blz-base/health/index.js +215 -0
- package/blz-base/index.js +1466 -0
- package/blz-cache/LruCache.js +44 -0
- package/blz-cache/index.js +29 -0
- package/blz-config/index.js +434 -0
- package/blz-core/index.js +364 -0
- package/blz-cryptography/index.js +54 -0
- package/blz-datetimes/index.js +356 -0
- package/blz-file/example.dat +2545 -0
- package/blz-file/fileService.js +205 -0
- package/blz-file/index.js +94 -0
- package/blz-file/index.test.js +31 -0
- package/blz-file/lab.js +33 -0
- package/blz-hazelcast/index.js +189 -0
- package/blz-hazelcast/lib/credentials.js +25 -0
- package/blz-hazelcast/lib/credentialsFactory.js +12 -0
- package/blz-hazelcast/lib/hazelcastCache.js +234 -0
- package/blz-iterable/index.js +446 -0
- package/blz-json-schema/index.js +11 -0
- package/blz-jwt/index.js +121 -0
- package/blz-kafka/index.js +522 -0
- package/blz-math/index.js +131 -0
- package/blz-mongodb/index.js +326 -0
- package/blz-rds/__test__/scape.test.js +58 -0
- package/blz-rds/blz-rds-executor.js +578 -0
- package/blz-rds/blz-rds-helper.js +310 -0
- package/blz-rds/commands/core/add.js +13 -0
- package/blz-rds/commands/core/and.js +18 -0
- package/blz-rds/commands/core/asc.js +10 -0
- package/blz-rds/commands/core/avg.js +10 -0
- package/blz-rds/commands/core/column-ref.js +8 -0
- package/blz-rds/commands/core/count-distinct.js +10 -0
- package/blz-rds/commands/core/count.js +10 -0
- package/blz-rds/commands/core/decimal.js +8 -0
- package/blz-rds/commands/core/desc.js +10 -0
- package/blz-rds/commands/core/distinct.js +10 -0
- package/blz-rds/commands/core/divide.js +11 -0
- package/blz-rds/commands/core/embedded-exists.js +17 -0
- package/blz-rds/commands/core/embedded-select.js +17 -0
- package/blz-rds/commands/core/equals.js +9 -0
- package/blz-rds/commands/core/false.js +8 -0
- package/blz-rds/commands/core/greater-or-equal.js +9 -0
- package/blz-rds/commands/core/greater.js +9 -0
- package/blz-rds/commands/core/in.js +9 -0
- package/blz-rds/commands/core/integer.js +8 -0
- package/blz-rds/commands/core/is-not-null.js +11 -0
- package/blz-rds/commands/core/is-null-or-value.js +10 -0
- package/blz-rds/commands/core/is-null.js +11 -0
- package/blz-rds/commands/core/less-or-equal.js +9 -0
- package/blz-rds/commands/core/less-unary.js +12 -0
- package/blz-rds/commands/core/less.js +9 -0
- package/blz-rds/commands/core/like.js +12 -0
- package/blz-rds/commands/core/max.js +10 -0
- package/blz-rds/commands/core/min.js +10 -0
- package/blz-rds/commands/core/multiply.js +13 -0
- package/blz-rds/commands/core/not-equals.js +9 -0
- package/blz-rds/commands/core/not-in.js +9 -0
- package/blz-rds/commands/core/not.js +13 -0
- package/blz-rds/commands/core/null.js +8 -0
- package/blz-rds/commands/core/nvl.js +11 -0
- package/blz-rds/commands/core/or.js +13 -0
- package/blz-rds/commands/core/parameter.js +34 -0
- package/blz-rds/commands/core/remainder.js +16 -0
- package/blz-rds/commands/core/string.js +8 -0
- package/blz-rds/commands/core/subtract.js +13 -0
- package/blz-rds/commands/core/sum.js +10 -0
- package/blz-rds/commands/core/true.js +8 -0
- package/blz-rds/commands/core/tuple.js +13 -0
- package/blz-rds/commands/datetimes/add-days.js +11 -0
- package/blz-rds/commands/datetimes/add-hours.js +11 -0
- package/blz-rds/commands/datetimes/add-milliseconds.js +11 -0
- package/blz-rds/commands/datetimes/add-minutes.js +11 -0
- package/blz-rds/commands/datetimes/add-months.js +11 -0
- package/blz-rds/commands/datetimes/add-seconds.js +11 -0
- package/blz-rds/commands/datetimes/add-years.js +11 -0
- package/blz-rds/commands/datetimes/date-diff.js +11 -0
- package/blz-rds/commands/datetimes/date.js +12 -0
- package/blz-rds/commands/datetimes/datetime-diff.js +11 -0
- package/blz-rds/commands/datetimes/datetime.js +15 -0
- package/blz-rds/commands/datetimes/day.js +10 -0
- package/blz-rds/commands/datetimes/hour.js +10 -0
- package/blz-rds/commands/datetimes/millisecond.js +10 -0
- package/blz-rds/commands/datetimes/minute.js +10 -0
- package/blz-rds/commands/datetimes/month-text.js +10 -0
- package/blz-rds/commands/datetimes/month.js +10 -0
- package/blz-rds/commands/datetimes/now.js +9 -0
- package/blz-rds/commands/datetimes/second.js +10 -0
- package/blz-rds/commands/datetimes/subtract-days.js +11 -0
- package/blz-rds/commands/datetimes/subtract-hours.js +11 -0
- package/blz-rds/commands/datetimes/subtract-milliseconds.js +11 -0
- package/blz-rds/commands/datetimes/subtract-minutes.js +11 -0
- package/blz-rds/commands/datetimes/subtract-seconds.js +11 -0
- package/blz-rds/commands/datetimes/time-diff.js +11 -0
- package/blz-rds/commands/datetimes/time.js +13 -0
- package/blz-rds/commands/datetimes/today.js +9 -0
- package/blz-rds/commands/datetimes/week-day-text.js +10 -0
- package/blz-rds/commands/datetimes/week-day.js +10 -0
- package/blz-rds/commands/datetimes/week.js +10 -0
- package/blz-rds/commands/datetimes/year.js +10 -0
- package/blz-rds/commands/math/abs.js +10 -0
- package/blz-rds/commands/math/acos.js +10 -0
- package/blz-rds/commands/math/asin.js +10 -0
- package/blz-rds/commands/math/atan.js +10 -0
- package/blz-rds/commands/math/atan2.js +11 -0
- package/blz-rds/commands/math/ceil.js +10 -0
- package/blz-rds/commands/math/cos.js +10 -0
- package/blz-rds/commands/math/cosh.js +10 -0
- package/blz-rds/commands/math/exp.js +10 -0
- package/blz-rds/commands/math/floor.js +10 -0
- package/blz-rds/commands/math/log.js +18 -0
- package/blz-rds/commands/math/log10.js +10 -0
- package/blz-rds/commands/math/pow.js +11 -0
- package/blz-rds/commands/math/random.js +9 -0
- package/blz-rds/commands/math/round.js +18 -0
- package/blz-rds/commands/math/sign.js +10 -0
- package/blz-rds/commands/math/sin.js +10 -0
- package/blz-rds/commands/math/sinh.js +10 -0
- package/blz-rds/commands/math/sqrt.js +10 -0
- package/blz-rds/commands/math/tan.js +10 -0
- package/blz-rds/commands/math/tanh.js +10 -0
- package/blz-rds/commands/math/trunc.js +18 -0
- package/blz-rds/commands/strings/concat.js +20 -0
- package/blz-rds/commands/strings/contains.js +12 -0
- package/blz-rds/commands/strings/ends-with.js +12 -0
- package/blz-rds/commands/strings/index-of.js +11 -0
- package/blz-rds/commands/strings/is-null-or-empty.js +11 -0
- package/blz-rds/commands/strings/is-null-or-white-space.js +11 -0
- package/blz-rds/commands/strings/join.js +22 -0
- package/blz-rds/commands/strings/last-index-of.js +11 -0
- package/blz-rds/commands/strings/length.js +10 -0
- package/blz-rds/commands/strings/pad-left.js +20 -0
- package/blz-rds/commands/strings/pad-right.js +20 -0
- package/blz-rds/commands/strings/replace.js +12 -0
- package/blz-rds/commands/strings/starts-with.js +12 -0
- package/blz-rds/commands/strings/substring.js +12 -0
- package/blz-rds/commands/strings/to-lower.js +10 -0
- package/blz-rds/commands/strings/to-upper.js +10 -0
- package/blz-rds/commands/strings/trim-end.js +10 -0
- package/blz-rds/commands/strings/trim-start.js +10 -0
- package/blz-rds/commands/strings/trim.js +10 -0
- package/blz-rds/index.js +744 -0
- package/blz-rds-mysql/base.js +857 -0
- package/blz-rds-mysql/connection-manager.js +129 -0
- package/blz-rds-mysql/execute-bulk-insert.js +35 -0
- package/blz-rds-mysql/execute-bulk-merge.js +45 -0
- package/blz-rds-mysql/execute-non-query.js +34 -0
- package/blz-rds-mysql/execute-query.js +50 -0
- package/blz-rds-mysql/index.js +41 -0
- package/blz-rds-mysql/stored-procedure.js +207 -0
- package/blz-rds-mysqlx/base.js +846 -0
- package/blz-rds-mysqlx/connection-manager.js +141 -0
- package/blz-rds-mysqlx/execute-bulk-insert.js +35 -0
- package/blz-rds-mysqlx/execute-bulk-merge.js +45 -0
- package/blz-rds-mysqlx/execute-non-query.js +29 -0
- package/blz-rds-mysqlx/execute-query.js +39 -0
- package/blz-rds-mysqlx/index.js +41 -0
- package/blz-rds-mysqlx/stored-procedure.js +179 -0
- package/blz-rds-oracle/index.js +539 -0
- package/blz-rds-postgres/base.js +861 -0
- package/blz-rds-postgres/connection-manager.js +225 -0
- package/blz-rds-postgres/execute-bulk-insert.js +81 -0
- package/blz-rds-postgres/execute-bulk-merge.js +93 -0
- package/blz-rds-postgres/execute-non-query.js +23 -0
- package/blz-rds-postgres/execute-query.js +37 -0
- package/blz-rds-postgres/index.js +41 -0
- package/blz-rds-postgres/result-set.js +51 -0
- package/blz-rds-postgres/stored-procedure.js +116 -0
- package/blz-redis/index.js +217 -0
- package/blz-redis/lib/redisCache.js +265 -0
- package/blz-regex/index.js +25 -0
- package/blz-security/.eslintrc.js +15 -0
- package/blz-security/__test__/AuthorizationKpn.yaml +1149 -0
- package/blz-security/__test__/FinancingSetting.yaml +177 -0
- package/blz-security/__test__/KpnConfigPortal.yaml +330 -0
- package/blz-security/__test__/OrderManagement.yaml +5190 -0
- package/blz-security/__test__/Security.yaml +128 -0
- package/blz-security/__test__/autorization.test.js +105 -0
- package/blz-security/__test__/autorizationKpn.test.js +42 -0
- package/blz-security/__test__/orderManagement.test.js +26 -0
- package/blz-security/__test__/secureUrl.test.js +79 -0
- package/blz-security/__test__/solveMergeRule.test.js +109 -0
- package/blz-security/__test__/sqlInjectionGuard.test.js +203 -0
- package/blz-security/__test__/xssGuard.test.js +204 -0
- package/blz-security/authorizationService.js +537 -0
- package/blz-security/config/global.js +8 -0
- package/blz-security/config/welcome +8 -0
- package/blz-security/doc/README.md +75 -0
- package/blz-security/filescanner/index.js +46 -0
- package/blz-security/helpers/consts.js +229 -0
- package/blz-security/helpers/utils.js +267 -0
- package/blz-security/implementations/cache.js +90 -0
- package/blz-security/implementations/oidc.js +404 -0
- package/blz-security/implementations/pkceCacheStore.js +23 -0
- package/blz-security/implementations/saml.js +10 -0
- package/blz-security/implementations/uma.js +63 -0
- package/blz-security/implementations/webAuthn.js +9 -0
- package/blz-security/implementations/wstg.js +72 -0
- package/blz-security/index.js +77 -0
- package/blz-security/lab/index.js +43 -0
- package/blz-security/middleware/HapiServerAzureAd.js +681 -0
- package/blz-security/middleware/HapiServerKeycloak.js +876 -0
- package/blz-security/middleware/HapiServerSimToken.js +286 -0
- package/blz-security/middleware/hapi.js +555 -0
- package/blz-security/middleware/hapiServer.js +1008 -0
- package/blz-security/navigationMemoryRepository.js +15 -0
- package/blz-security/navigationMongoDbRepository.js +73 -0
- package/blz-security/secureUrlService.js +47 -0
- package/blz-security/securityService.js +413 -0
- package/blz-security/sqlInjectionGuard.js +162 -0
- package/blz-security/templates/forbidden.html +0 -0
- package/blz-security/templates/session-iframe-azure-ad.html +7 -0
- package/blz-security/templates/session-iframe.html +73 -0
- package/blz-security/templates/unauthorized.html +1 -0
- package/blz-security/xssGuard.js +87 -0
- package/blz-strings/index.js +167 -0
- package/blz-uuid/index.js +7 -0
- package/blz-yaml/index.js +19 -0
- package/index.js +84 -0
- package/package.json +40 -53
- package/process-managers/index.js +422 -0
- package/dist/blz-base/health/index.d.ts +0 -1
- package/dist/blz-base/health/index.js +0 -1
- package/dist/blz-base/index.d.ts +0 -108
- package/dist/blz-base/index.js +0 -1
- package/dist/blz-cache/LruCache.d.ts +0 -31
- package/dist/blz-cache/LruCache.js +0 -1
- package/dist/blz-cache/index.d.ts +0 -2
- package/dist/blz-cache/index.js +0 -1
- package/dist/blz-config/index.d.ts +0 -16
- package/dist/blz-config/index.js +0 -1
- package/dist/blz-core/index.d.ts +0 -32
- package/dist/blz-core/index.js +0 -1
- package/dist/blz-cryptography/index.d.ts +0 -2
- package/dist/blz-cryptography/index.js +0 -1
- package/dist/blz-datetimes/index.d.ts +0 -35
- package/dist/blz-datetimes/index.js +0 -1
- package/dist/blz-file/fileService.d.ts +0 -25
- package/dist/blz-file/fileService.js +0 -1
- package/dist/blz-file/index.d.ts +0 -2
- package/dist/blz-file/index.js +0 -1
- package/dist/blz-file/index.test.js +0 -1
- package/dist/blz-file/lab.js +0 -1
- package/dist/blz-hazelcast/index.d.ts +0 -25
- package/dist/blz-hazelcast/index.js +0 -1
- package/dist/blz-hazelcast/lib/credentials.d.ts +0 -10
- package/dist/blz-hazelcast/lib/credentials.js +0 -1
- package/dist/blz-hazelcast/lib/credentialsFactory.d.ts +0 -1
- package/dist/blz-hazelcast/lib/credentialsFactory.js +0 -1
- package/dist/blz-hazelcast/lib/hazelcastCache.d.ts +0 -27
- package/dist/blz-hazelcast/lib/hazelcastCache.js +0 -1
- package/dist/blz-iterable/index.d.ts +0 -49
- package/dist/blz-iterable/index.js +0 -1
- package/dist/blz-json-schema/index.d.ts +0 -1
- package/dist/blz-json-schema/index.js +0 -1
- package/dist/blz-jwt/index.d.ts +0 -12
- package/dist/blz-jwt/index.js +0 -1
- package/dist/blz-kafka/index.d.ts +0 -9
- package/dist/blz-kafka/index.js +0 -1
- package/dist/blz-math/index.d.ts +0 -22
- package/dist/blz-math/index.js +0 -1
- package/dist/blz-mongodb/index.d.ts +0 -28
- package/dist/blz-mongodb/index.js +0 -1
- package/dist/blz-rds/__test__/scape.test.js +0 -1
- package/dist/blz-rds/blz-rds-executor.d.ts +0 -4
- package/dist/blz-rds/blz-rds-executor.js +0 -1
- package/dist/blz-rds/blz-rds-helper.d.ts +0 -5
- package/dist/blz-rds/blz-rds-helper.js +0 -1
- package/dist/blz-rds/commands/core/add.d.ts +0 -2
- package/dist/blz-rds/commands/core/add.js +0 -1
- package/dist/blz-rds/commands/core/and.d.ts +0 -3
- package/dist/blz-rds/commands/core/and.js +0 -1
- package/dist/blz-rds/commands/core/asc.d.ts +0 -2
- package/dist/blz-rds/commands/core/asc.js +0 -1
- package/dist/blz-rds/commands/core/avg.d.ts +0 -2
- package/dist/blz-rds/commands/core/avg.js +0 -1
- package/dist/blz-rds/commands/core/column-ref.d.ts +0 -2
- package/dist/blz-rds/commands/core/column-ref.js +0 -1
- package/dist/blz-rds/commands/core/count-distinct.d.ts +0 -2
- package/dist/blz-rds/commands/core/count-distinct.js +0 -1
- package/dist/blz-rds/commands/core/count.d.ts +0 -2
- package/dist/blz-rds/commands/core/count.js +0 -1
- package/dist/blz-rds/commands/core/decimal.d.ts +0 -2
- package/dist/blz-rds/commands/core/decimal.js +0 -1
- package/dist/blz-rds/commands/core/desc.d.ts +0 -2
- package/dist/blz-rds/commands/core/desc.js +0 -1
- package/dist/blz-rds/commands/core/distinct.d.ts +0 -2
- package/dist/blz-rds/commands/core/distinct.js +0 -1
- package/dist/blz-rds/commands/core/divide.d.ts +0 -2
- package/dist/blz-rds/commands/core/divide.js +0 -1
- package/dist/blz-rds/commands/core/embedded-exists.d.ts +0 -3
- package/dist/blz-rds/commands/core/embedded-exists.js +0 -1
- package/dist/blz-rds/commands/core/embedded-select.d.ts +0 -2
- package/dist/blz-rds/commands/core/embedded-select.js +0 -1
- package/dist/blz-rds/commands/core/equals.d.ts +0 -3
- package/dist/blz-rds/commands/core/equals.js +0 -1
- package/dist/blz-rds/commands/core/false.d.ts +0 -2
- package/dist/blz-rds/commands/core/false.js +0 -1
- package/dist/blz-rds/commands/core/greater-or-equal.d.ts +0 -3
- package/dist/blz-rds/commands/core/greater-or-equal.js +0 -1
- package/dist/blz-rds/commands/core/greater.d.ts +0 -3
- package/dist/blz-rds/commands/core/greater.js +0 -1
- package/dist/blz-rds/commands/core/in.d.ts +0 -3
- package/dist/blz-rds/commands/core/in.js +0 -1
- package/dist/blz-rds/commands/core/integer.d.ts +0 -2
- package/dist/blz-rds/commands/core/integer.js +0 -1
- package/dist/blz-rds/commands/core/is-not-null.d.ts +0 -3
- package/dist/blz-rds/commands/core/is-not-null.js +0 -1
- package/dist/blz-rds/commands/core/is-null-or-value.d.ts +0 -3
- package/dist/blz-rds/commands/core/is-null-or-value.js +0 -1
- package/dist/blz-rds/commands/core/is-null.d.ts +0 -3
- package/dist/blz-rds/commands/core/is-null.js +0 -1
- package/dist/blz-rds/commands/core/less-or-equal.d.ts +0 -3
- package/dist/blz-rds/commands/core/less-or-equal.js +0 -1
- package/dist/blz-rds/commands/core/less-unary.d.ts +0 -2
- package/dist/blz-rds/commands/core/less-unary.js +0 -1
- package/dist/blz-rds/commands/core/less.d.ts +0 -3
- package/dist/blz-rds/commands/core/less.js +0 -1
- package/dist/blz-rds/commands/core/like.d.ts +0 -3
- package/dist/blz-rds/commands/core/like.js +0 -1
- package/dist/blz-rds/commands/core/max.d.ts +0 -2
- package/dist/blz-rds/commands/core/max.js +0 -1
- package/dist/blz-rds/commands/core/min.d.ts +0 -2
- package/dist/blz-rds/commands/core/min.js +0 -1
- package/dist/blz-rds/commands/core/multiply.d.ts +0 -2
- package/dist/blz-rds/commands/core/multiply.js +0 -1
- package/dist/blz-rds/commands/core/not-equals.d.ts +0 -3
- package/dist/blz-rds/commands/core/not-equals.js +0 -1
- package/dist/blz-rds/commands/core/not-in.d.ts +0 -3
- package/dist/blz-rds/commands/core/not-in.js +0 -1
- package/dist/blz-rds/commands/core/not.d.ts +0 -3
- package/dist/blz-rds/commands/core/not.js +0 -1
- package/dist/blz-rds/commands/core/null.d.ts +0 -2
- package/dist/blz-rds/commands/core/null.js +0 -1
- package/dist/blz-rds/commands/core/nvl.d.ts +0 -2
- package/dist/blz-rds/commands/core/nvl.js +0 -1
- package/dist/blz-rds/commands/core/or.d.ts +0 -3
- package/dist/blz-rds/commands/core/or.js +0 -1
- package/dist/blz-rds/commands/core/parameter.d.ts +0 -2
- package/dist/blz-rds/commands/core/parameter.js +0 -1
- package/dist/blz-rds/commands/core/remainder.d.ts +0 -2
- package/dist/blz-rds/commands/core/remainder.js +0 -1
- package/dist/blz-rds/commands/core/string.d.ts +0 -2
- package/dist/blz-rds/commands/core/string.js +0 -1
- package/dist/blz-rds/commands/core/subtract.d.ts +0 -2
- package/dist/blz-rds/commands/core/subtract.js +0 -1
- package/dist/blz-rds/commands/core/sum.d.ts +0 -2
- package/dist/blz-rds/commands/core/sum.js +0 -1
- package/dist/blz-rds/commands/core/true.d.ts +0 -2
- package/dist/blz-rds/commands/core/true.js +0 -1
- package/dist/blz-rds/commands/core/tuple.d.ts +0 -2
- package/dist/blz-rds/commands/core/tuple.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-days.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-days.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-hours.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-hours.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-milliseconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-milliseconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-minutes.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-minutes.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-months.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-months.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-seconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-seconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/add-years.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/add-years.js +0 -1
- package/dist/blz-rds/commands/datetimes/date-diff.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/date-diff.js +0 -1
- package/dist/blz-rds/commands/datetimes/date.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/date.js +0 -1
- package/dist/blz-rds/commands/datetimes/datetime-diff.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/datetime-diff.js +0 -1
- package/dist/blz-rds/commands/datetimes/datetime.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/datetime.js +0 -1
- package/dist/blz-rds/commands/datetimes/day.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/day.js +0 -1
- package/dist/blz-rds/commands/datetimes/hour.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/hour.js +0 -1
- package/dist/blz-rds/commands/datetimes/millisecond.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/millisecond.js +0 -1
- package/dist/blz-rds/commands/datetimes/minute.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/minute.js +0 -1
- package/dist/blz-rds/commands/datetimes/month-text.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/month-text.js +0 -1
- package/dist/blz-rds/commands/datetimes/month.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/month.js +0 -1
- package/dist/blz-rds/commands/datetimes/now.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/now.js +0 -1
- package/dist/blz-rds/commands/datetimes/second.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/second.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-days.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-days.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-hours.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-hours.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-milliseconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-minutes.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-minutes.js +0 -1
- package/dist/blz-rds/commands/datetimes/subtract-seconds.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/subtract-seconds.js +0 -1
- package/dist/blz-rds/commands/datetimes/time-diff.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/time-diff.js +0 -1
- package/dist/blz-rds/commands/datetimes/time.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/time.js +0 -1
- package/dist/blz-rds/commands/datetimes/today.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/today.js +0 -1
- package/dist/blz-rds/commands/datetimes/week-day-text.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/week-day-text.js +0 -1
- package/dist/blz-rds/commands/datetimes/week-day.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/week-day.js +0 -1
- package/dist/blz-rds/commands/datetimes/week.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/week.js +0 -1
- package/dist/blz-rds/commands/datetimes/year.d.ts +0 -2
- package/dist/blz-rds/commands/datetimes/year.js +0 -1
- package/dist/blz-rds/commands/math/abs.d.ts +0 -2
- package/dist/blz-rds/commands/math/abs.js +0 -1
- package/dist/blz-rds/commands/math/acos.d.ts +0 -2
- package/dist/blz-rds/commands/math/acos.js +0 -1
- package/dist/blz-rds/commands/math/asin.d.ts +0 -2
- package/dist/blz-rds/commands/math/asin.js +0 -1
- package/dist/blz-rds/commands/math/atan.d.ts +0 -2
- package/dist/blz-rds/commands/math/atan.js +0 -1
- package/dist/blz-rds/commands/math/atan2.d.ts +0 -2
- package/dist/blz-rds/commands/math/atan2.js +0 -1
- package/dist/blz-rds/commands/math/ceil.d.ts +0 -2
- package/dist/blz-rds/commands/math/ceil.js +0 -1
- package/dist/blz-rds/commands/math/cos.d.ts +0 -2
- package/dist/blz-rds/commands/math/cos.js +0 -1
- package/dist/blz-rds/commands/math/cosh.d.ts +0 -2
- package/dist/blz-rds/commands/math/cosh.js +0 -1
- package/dist/blz-rds/commands/math/exp.d.ts +0 -2
- package/dist/blz-rds/commands/math/exp.js +0 -1
- package/dist/blz-rds/commands/math/floor.d.ts +0 -2
- package/dist/blz-rds/commands/math/floor.js +0 -1
- package/dist/blz-rds/commands/math/log.d.ts +0 -2
- package/dist/blz-rds/commands/math/log.js +0 -1
- package/dist/blz-rds/commands/math/log10.d.ts +0 -2
- package/dist/blz-rds/commands/math/log10.js +0 -1
- package/dist/blz-rds/commands/math/pow.d.ts +0 -2
- package/dist/blz-rds/commands/math/pow.js +0 -1
- package/dist/blz-rds/commands/math/random.d.ts +0 -2
- package/dist/blz-rds/commands/math/random.js +0 -1
- package/dist/blz-rds/commands/math/round.d.ts +0 -2
- package/dist/blz-rds/commands/math/round.js +0 -1
- package/dist/blz-rds/commands/math/sign.d.ts +0 -2
- package/dist/blz-rds/commands/math/sign.js +0 -1
- package/dist/blz-rds/commands/math/sin.d.ts +0 -2
- package/dist/blz-rds/commands/math/sin.js +0 -1
- package/dist/blz-rds/commands/math/sinh.d.ts +0 -2
- package/dist/blz-rds/commands/math/sinh.js +0 -1
- package/dist/blz-rds/commands/math/sqrt.d.ts +0 -2
- package/dist/blz-rds/commands/math/sqrt.js +0 -1
- package/dist/blz-rds/commands/math/tan.d.ts +0 -2
- package/dist/blz-rds/commands/math/tan.js +0 -1
- package/dist/blz-rds/commands/math/tanh.d.ts +0 -2
- package/dist/blz-rds/commands/math/tanh.js +0 -1
- package/dist/blz-rds/commands/math/trunc.d.ts +0 -2
- package/dist/blz-rds/commands/math/trunc.js +0 -1
- package/dist/blz-rds/commands/strings/concat.d.ts +0 -2
- package/dist/blz-rds/commands/strings/concat.js +0 -1
- package/dist/blz-rds/commands/strings/contains.d.ts +0 -3
- package/dist/blz-rds/commands/strings/contains.js +0 -1
- package/dist/blz-rds/commands/strings/ends-with.d.ts +0 -3
- package/dist/blz-rds/commands/strings/ends-with.js +0 -1
- package/dist/blz-rds/commands/strings/index-of.d.ts +0 -2
- package/dist/blz-rds/commands/strings/index-of.js +0 -1
- package/dist/blz-rds/commands/strings/is-null-or-empty.d.ts +0 -3
- package/dist/blz-rds/commands/strings/is-null-or-empty.js +0 -1
- package/dist/blz-rds/commands/strings/is-null-or-white-space.d.ts +0 -3
- package/dist/blz-rds/commands/strings/is-null-or-white-space.js +0 -1
- package/dist/blz-rds/commands/strings/join.d.ts +0 -2
- package/dist/blz-rds/commands/strings/join.js +0 -1
- package/dist/blz-rds/commands/strings/last-index-of.d.ts +0 -2
- package/dist/blz-rds/commands/strings/last-index-of.js +0 -1
- package/dist/blz-rds/commands/strings/length.d.ts +0 -2
- package/dist/blz-rds/commands/strings/length.js +0 -1
- package/dist/blz-rds/commands/strings/pad-left.d.ts +0 -2
- package/dist/blz-rds/commands/strings/pad-left.js +0 -1
- package/dist/blz-rds/commands/strings/pad-right.d.ts +0 -2
- package/dist/blz-rds/commands/strings/pad-right.js +0 -1
- package/dist/blz-rds/commands/strings/replace.d.ts +0 -2
- package/dist/blz-rds/commands/strings/replace.js +0 -1
- package/dist/blz-rds/commands/strings/starts-with.d.ts +0 -3
- package/dist/blz-rds/commands/strings/starts-with.js +0 -1
- package/dist/blz-rds/commands/strings/substring.d.ts +0 -2
- package/dist/blz-rds/commands/strings/substring.js +0 -1
- package/dist/blz-rds/commands/strings/to-lower.d.ts +0 -2
- package/dist/blz-rds/commands/strings/to-lower.js +0 -1
- package/dist/blz-rds/commands/strings/to-upper.d.ts +0 -2
- package/dist/blz-rds/commands/strings/to-upper.js +0 -1
- package/dist/blz-rds/commands/strings/trim-end.d.ts +0 -2
- package/dist/blz-rds/commands/strings/trim-end.js +0 -1
- package/dist/blz-rds/commands/strings/trim-start.d.ts +0 -2
- package/dist/blz-rds/commands/strings/trim-start.js +0 -1
- package/dist/blz-rds/commands/strings/trim.d.ts +0 -2
- package/dist/blz-rds/commands/strings/trim.js +0 -1
- package/dist/blz-rds/index.d.ts +0 -53
- package/dist/blz-rds/index.js +0 -1
- package/dist/blz-rds-mysql/base.d.ts +0 -83
- package/dist/blz-rds-mysql/base.js +0 -1
- package/dist/blz-rds-mysql/connection-manager.d.ts +0 -8
- package/dist/blz-rds-mysql/connection-manager.js +0 -1
- package/dist/blz-rds-mysql/execute-bulk-insert.d.ts +0 -2
- package/dist/blz-rds-mysql/execute-bulk-insert.js +0 -1
- package/dist/blz-rds-mysql/execute-bulk-merge.d.ts +0 -2
- package/dist/blz-rds-mysql/execute-bulk-merge.js +0 -1
- package/dist/blz-rds-mysql/execute-non-query.d.ts +0 -14
- package/dist/blz-rds-mysql/execute-non-query.js +0 -1
- package/dist/blz-rds-mysql/execute-query.d.ts +0 -11
- package/dist/blz-rds-mysql/execute-query.js +0 -1
- package/dist/blz-rds-mysql/index.d.ts +0 -9
- package/dist/blz-rds-mysql/index.js +0 -1
- package/dist/blz-rds-mysql/stored-procedure.d.ts +0 -19
- package/dist/blz-rds-mysql/stored-procedure.js +0 -1
- package/dist/blz-rds-mysqlx/base.d.ts +0 -83
- package/dist/blz-rds-mysqlx/base.js +0 -1
- package/dist/blz-rds-mysqlx/connection-manager.d.ts +0 -6
- package/dist/blz-rds-mysqlx/connection-manager.js +0 -1
- package/dist/blz-rds-mysqlx/execute-bulk-insert.d.ts +0 -2
- package/dist/blz-rds-mysqlx/execute-bulk-insert.js +0 -1
- package/dist/blz-rds-mysqlx/execute-bulk-merge.d.ts +0 -2
- package/dist/blz-rds-mysqlx/execute-bulk-merge.js +0 -1
- package/dist/blz-rds-mysqlx/execute-non-query.d.ts +0 -4
- package/dist/blz-rds-mysqlx/execute-non-query.js +0 -1
- package/dist/blz-rds-mysqlx/execute-query.d.ts +0 -7
- package/dist/blz-rds-mysqlx/execute-query.js +0 -1
- package/dist/blz-rds-mysqlx/index.d.ts +0 -9
- package/dist/blz-rds-mysqlx/index.js +0 -1
- package/dist/blz-rds-mysqlx/stored-procedure.d.ts +0 -20
- package/dist/blz-rds-mysqlx/stored-procedure.js +0 -1
- package/dist/blz-rds-oracle/index.d.ts +0 -25
- package/dist/blz-rds-oracle/index.js +0 -1
- package/dist/blz-rds-postgres/base.d.ts +0 -94
- package/dist/blz-rds-postgres/base.js +0 -1
- package/dist/blz-rds-postgres/connection-manager.d.ts +0 -6
- package/dist/blz-rds-postgres/connection-manager.js +0 -1
- package/dist/blz-rds-postgres/execute-bulk-insert.d.ts +0 -5
- package/dist/blz-rds-postgres/execute-bulk-insert.js +0 -1
- package/dist/blz-rds-postgres/execute-bulk-merge.d.ts +0 -4
- package/dist/blz-rds-postgres/execute-bulk-merge.js +0 -1
- package/dist/blz-rds-postgres/execute-non-query.d.ts +0 -12
- package/dist/blz-rds-postgres/execute-non-query.js +0 -1
- package/dist/blz-rds-postgres/execute-query.d.ts +0 -4
- package/dist/blz-rds-postgres/execute-query.js +0 -1
- package/dist/blz-rds-postgres/index.d.ts +0 -9
- package/dist/blz-rds-postgres/index.js +0 -1
- package/dist/blz-rds-postgres/result-set.js +0 -1
- package/dist/blz-rds-postgres/stored-procedure.d.ts +0 -19
- package/dist/blz-rds-postgres/stored-procedure.js +0 -1
- package/dist/blz-redis/index.d.ts +0 -31
- package/dist/blz-redis/index.js +0 -1
- package/dist/blz-redis/lib/redisCache.d.ts +0 -33
- package/dist/blz-redis/lib/redisCache.js +0 -1
- package/dist/blz-regex/index.d.ts +0 -3
- package/dist/blz-regex/index.js +0 -1
- package/dist/blz-security/__test__/autorization.test.js +0 -1
- package/dist/blz-security/__test__/autorizationKpn.test.js +0 -1
- package/dist/blz-security/__test__/orderManagement.test.js +0 -1
- package/dist/blz-security/__test__/secureUrl.test.js +0 -1
- package/dist/blz-security/__test__/solveMergeRule.test.js +0 -1
- package/dist/blz-security/__test__/sqlInjectionGuard.test.js +0 -1
- package/dist/blz-security/__test__/xssGuard.test.js +0 -1
- package/dist/blz-security/authorizationService.d.ts +0 -42
- package/dist/blz-security/authorizationService.js +0 -2
- package/dist/blz-security/config/global.js +0 -1
- package/dist/blz-security/filescanner/index.d.ts +0 -24
- package/dist/blz-security/filescanner/index.js +0 -1
- package/dist/blz-security/helpers/consts.d.ts +0 -28
- package/dist/blz-security/helpers/consts.js +0 -1
- package/dist/blz-security/helpers/utils.d.ts +0 -82
- package/dist/blz-security/helpers/utils.js +0 -1
- package/dist/blz-security/implementations/cache.d.ts +0 -58
- package/dist/blz-security/implementations/cache.js +0 -1
- package/dist/blz-security/implementations/oidc.d.ts +0 -100
- package/dist/blz-security/implementations/oidc.js +0 -1
- package/dist/blz-security/implementations/pkceCacheStore.d.ts +0 -2
- package/dist/blz-security/implementations/pkceCacheStore.js +0 -1
- package/dist/blz-security/implementations/saml.js +0 -1
- package/dist/blz-security/implementations/uma.d.ts +0 -31
- package/dist/blz-security/implementations/uma.js +0 -1
- package/dist/blz-security/implementations/webAuthn.js +0 -1
- package/dist/blz-security/implementations/wstg.js +0 -1
- package/dist/blz-security/index.d.ts +0 -4
- package/dist/blz-security/index.js +0 -2
- package/dist/blz-security/lab/index.js +0 -1
- package/dist/blz-security/middleware/HapiServerAzureAd.d.ts +0 -26
- package/dist/blz-security/middleware/HapiServerAzureAd.js +0 -1
- package/dist/blz-security/middleware/HapiServerKeycloak.d.ts +0 -47
- package/dist/blz-security/middleware/HapiServerKeycloak.js +0 -1
- package/dist/blz-security/middleware/HapiServerSimToken.d.ts +0 -13
- package/dist/blz-security/middleware/HapiServerSimToken.js +0 -1
- package/dist/blz-security/middleware/hapi.d.ts +0 -14
- package/dist/blz-security/middleware/hapi.js +0 -1
- package/dist/blz-security/middleware/hapiServer.js +0 -1
- package/dist/blz-security/navigationMemoryRepository.d.ts +0 -6
- package/dist/blz-security/navigationMemoryRepository.js +0 -1
- package/dist/blz-security/navigationMongoDbRepository.d.ts +0 -15
- package/dist/blz-security/navigationMongoDbRepository.js +0 -1
- package/dist/blz-security/secureUrlService.d.ts +0 -7
- package/dist/blz-security/secureUrlService.js +0 -1
- package/dist/blz-security/securityService.d.ts +0 -72
- package/dist/blz-security/securityService.js +0 -1
- package/dist/blz-security/sqlInjectionGuard.d.ts +0 -37
- package/dist/blz-security/sqlInjectionGuard.js +0 -1
- package/dist/blz-security/xssGuard.d.ts +0 -14
- package/dist/blz-security/xssGuard.js +0 -1
- package/dist/blz-strings/index.d.ts +0 -42
- package/dist/blz-strings/index.js +0 -1
- package/dist/blz-uuid/index.d.ts +0 -1
- package/dist/blz-uuid/index.js +0 -1
- package/dist/blz-yaml/index.d.ts +0 -2
- package/dist/blz-yaml/index.js +0 -1
- package/dist/index.d.ts +0 -34
- package/dist/index.js +0 -1
- package/dist/process-managers/index.d.ts +0 -25
- package/dist/process-managers/index.js +0 -1
- /package/{dist/blz-rds-mysql → blz-rds-mysql}/syntaxis.json +0 -0
- /package/{dist/blz-rds-mysqlx → blz-rds-mysqlx}/syntaxis.json +0 -0
- /package/{dist/blz-rds-oracle → blz-rds-oracle}/syntaxis.json +0 -0
- /package/{dist/blz-rds-postgres → blz-rds-postgres}/syntaxis.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/ConfigurationAdmin.agent.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/frontend.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/result.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/resultOnWeb.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/rules.json +0 -0
- /package/{dist/blz-security → blz-security}/lab/securityRules.json +0 -0
package/package.json
CHANGED
|
@@ -1,91 +1,84 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blazedpath/commons",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "commos library for blazedpath applications",
|
|
5
|
-
"main": "
|
|
6
|
-
"files": [
|
|
7
|
-
"dist"
|
|
8
|
-
],
|
|
5
|
+
"main": "index.js",
|
|
9
6
|
"types": "dist/index.d.ts",
|
|
10
7
|
"license": "UNLICENSED",
|
|
11
8
|
"publishConfig": {
|
|
12
9
|
"access": "public"
|
|
13
10
|
},
|
|
14
11
|
"dependencies": {
|
|
15
|
-
"@azure/msal-node": "^3.4.1",
|
|
16
12
|
"@hapi/boom": "^10.0.1",
|
|
17
13
|
"@hapi/call": "^9.0.1",
|
|
18
14
|
"@hapi/cookie": "^12.0.1",
|
|
19
15
|
"@hapi/jwt": "^3.2.0",
|
|
20
16
|
"@hapi/yar": "^11.0.3",
|
|
21
|
-
"
|
|
17
|
+
"crypto": "^1.0.1",
|
|
18
|
+
"dompurify": "^3.2.6",
|
|
19
|
+
"fs-extra": "^11.3.0",
|
|
20
|
+
"got": "^11.8.6",
|
|
21
|
+
"handlebars": "^4.7.8",
|
|
22
|
+
"jsdom": "^26.1.0",
|
|
23
|
+
"jwk-to-pem": "^2.0.7",
|
|
24
|
+
"nearley": "^2.20.1",
|
|
25
|
+
"path": "^0.12.7",
|
|
26
|
+
"semver": "^7.6.0",
|
|
27
|
+
"underscore": "^1.13.7",
|
|
22
28
|
"agenda": "^5.0.0",
|
|
23
29
|
"async-retry": "^1.3.3",
|
|
30
|
+
"@azure/msal-node": "^3.4.1",
|
|
24
31
|
"axios": "^1.12.0",
|
|
25
32
|
"clamav.js": "^0.12.0",
|
|
26
|
-
"crypto": "^1.0.1",
|
|
27
33
|
"crypto-js": "^4.2.0",
|
|
28
|
-
"dayjs": "^1.11.10",
|
|
29
34
|
"decode-uri-component": "^0.4.1",
|
|
30
|
-
"dompurify": "^3.2.6",
|
|
31
|
-
"dotenv": "^16.4.4",
|
|
32
|
-
"electron-rebuild": "^3.2.9",
|
|
33
|
-
"fs-extra": "^11.3.0",
|
|
34
|
-
"generic-pool": "^3.9.0",
|
|
35
|
-
"got": "^11.8.6",
|
|
36
35
|
"h3lp": "^1.12.1",
|
|
37
|
-
"handlebars": "^4.7.8",
|
|
38
|
-
"hazelcast-client": "^5.3.0",
|
|
39
36
|
"ioredis": "^5.6.0",
|
|
40
37
|
"jest": "^29.7.0",
|
|
41
38
|
"js-yaml": "^4.1.0",
|
|
42
|
-
"jsdom": "^26.1.0",
|
|
43
39
|
"jsonpath": "^1.1.1",
|
|
44
|
-
"jsonschema": "^1.4.1",
|
|
45
40
|
"jsonwebtoken": "^9.0.2",
|
|
46
|
-
"jwk-to-pem": "^2.0.7",
|
|
47
41
|
"jwks-rsa": "^3.1.0",
|
|
48
|
-
"kafkajs": "^2.2.4",
|
|
49
42
|
"lru-cache": "^10.2.1",
|
|
50
|
-
"luxon": "^3.4.4",
|
|
51
43
|
"micromatch": "^4.0.8",
|
|
52
44
|
"mongodb": "^4.17.2",
|
|
53
|
-
"mysql": "^2.18.1",
|
|
54
|
-
"named-placeholders": "^1.1.3",
|
|
55
|
-
"nan": "2.18.0",
|
|
56
|
-
"nearley": "^2.20.1",
|
|
57
45
|
"node-fetch": "^2.7.0",
|
|
58
46
|
"openid-client": "^5.6.4",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
47
|
+
"pino": "^9.7.0",
|
|
48
|
+
"uuid": "^9.0.1",
|
|
49
|
+
"yargs": "^17.7.2",
|
|
50
|
+
"zod": "^3.25.56",
|
|
51
|
+
"dotenv": "^16.4.4",
|
|
52
|
+
"soap": "^0.45.0",
|
|
53
|
+
"generic-pool": "^3.9.0",
|
|
54
|
+
"dayjs": "^1.11.10",
|
|
55
|
+
"luxon": "^3.4.4",
|
|
61
56
|
"pg": "^8.11.3",
|
|
62
57
|
"pg-cursor": "^2.10.3",
|
|
63
58
|
"pgsql-ast-parser": "^12.0.1",
|
|
64
|
-
"pino": "^9.7.0",
|
|
65
|
-
"semver": "^7.6.0",
|
|
66
|
-
"soap": "^0.45.0",
|
|
67
59
|
"sqlstring": "^2.3.3",
|
|
68
|
-
"
|
|
69
|
-
"
|
|
70
|
-
"
|
|
71
|
-
"
|
|
60
|
+
"nan": "2.18.0",
|
|
61
|
+
"oracledb": "^6.7.0",
|
|
62
|
+
"@mysql/xdevapi": "^8.0.35",
|
|
63
|
+
"mysql": "^2.18.1",
|
|
64
|
+
"named-placeholders": "^1.1.3",
|
|
65
|
+
"kafkajs": "^2.2.4",
|
|
66
|
+
"jsonschema": "^1.4.1",
|
|
67
|
+
"hazelcast-client": "^5.3.0"
|
|
72
68
|
},
|
|
73
69
|
"devDependencies": {
|
|
74
70
|
"@types/got": "9.6.12",
|
|
75
71
|
"@types/handlebars": "4.1.0",
|
|
76
|
-
"@types/mysql": "2.15.25",
|
|
77
|
-
"@types/node": "20.11.17",
|
|
78
|
-
"@types/pg": "8.11.0",
|
|
79
|
-
"@types/underscore": "1.11.15",
|
|
80
|
-
"esbuild": "^0.27.2",
|
|
81
72
|
"eslint": "7.32.0",
|
|
82
73
|
"eslint-config-standard": "16.0.3",
|
|
83
74
|
"eslint-plugin-import": "2.26.0",
|
|
84
75
|
"eslint-plugin-node": "11.1.0",
|
|
85
76
|
"eslint-plugin-promise": "5.2.0",
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
77
|
+
"@types/pg": "8.11.0",
|
|
78
|
+
"@types/underscore": "1.11.15",
|
|
79
|
+
"@types/mysql": "2.15.25",
|
|
80
|
+
"@types/node": "20.11.17",
|
|
81
|
+
"jest": "^29.7.0"
|
|
89
82
|
},
|
|
90
83
|
"bin": {
|
|
91
84
|
"blz-security": "."
|
|
@@ -95,19 +88,13 @@
|
|
|
95
88
|
},
|
|
96
89
|
"scripts": {
|
|
97
90
|
"lint": "standard",
|
|
98
|
-
"test": "jest"
|
|
99
|
-
"postinstall": "npx electron-rebuild --version 7.1.10 -f -w oracledb",
|
|
100
|
-
"clean": "rimraf dist",
|
|
101
|
-
"build:js": "node scripts/build-js.cjs",
|
|
102
|
-
"build:types": "tsc -p tsconfig.types.json",
|
|
103
|
-
"build": "npm run clean && npm run build:js && npm run build:types",
|
|
104
|
-
"prepublishOnly": "npm run build"
|
|
91
|
+
"test": "jest"
|
|
105
92
|
},
|
|
106
93
|
"overrides": {
|
|
107
94
|
"shelljs": "0.9.2",
|
|
108
95
|
"cross-spawn": "7.0.6",
|
|
109
96
|
"glob": "^12.0.0",
|
|
110
|
-
|
|
111
|
-
|
|
97
|
+
"qs": "^6.14.1",
|
|
98
|
+
"jws": "^4.0.1"
|
|
112
99
|
}
|
|
113
|
-
}
|
|
100
|
+
}
|
|
@@ -0,0 +1,422 @@
|
|
|
1
|
+
const { MongoClient, ObjectId } = require('mongodb');
|
|
2
|
+
let Agenda = require('agenda');
|
|
3
|
+
const AsyncRetry = require('async-retry');
|
|
4
|
+
const logger = require('pino')();
|
|
5
|
+
|
|
6
|
+
let removeTokenAndChilds = function (instanceData, tokenId, unset) {
|
|
7
|
+
delete instanceData.tokens[tokenId];
|
|
8
|
+
unset['tokens.' + tokenId] = '';
|
|
9
|
+
for (let otherTokenId in instanceData.tokens) {
|
|
10
|
+
let otherTokenData = instanceData.tokens[otherTokenId];
|
|
11
|
+
if (otherTokenData.parentTokenId === tokenId)
|
|
12
|
+
removeTokenAndChilds(instanceData, otherTokenId, unset);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
let getInstance = function (instanceData) {
|
|
17
|
+
let instance = {
|
|
18
|
+
processName: instanceData.processName,
|
|
19
|
+
instanceId: instanceData._id,
|
|
20
|
+
model: instanceData.model,
|
|
21
|
+
tokens: []
|
|
22
|
+
};
|
|
23
|
+
for (let tokenId in instanceData.tokens) {
|
|
24
|
+
let tokenData = instanceData.tokens[tokenId];
|
|
25
|
+
let token = {
|
|
26
|
+
tokenId: tokenId,
|
|
27
|
+
nodeName: tokenData.nodeName,
|
|
28
|
+
hasError: tokenData.hasError ?? undefined
|
|
29
|
+
};
|
|
30
|
+
if (tokenData.parentTokenId)
|
|
31
|
+
token.parentTokenId = tokenData.parentTokenId;
|
|
32
|
+
instance.tokens.push(token);
|
|
33
|
+
}
|
|
34
|
+
return instance;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
let writeMongo = async function (processName, instanceId, variableName, value) {
|
|
38
|
+
let set = {};
|
|
39
|
+
set[variableName] = value;
|
|
40
|
+
await _mongodbCollectionInstances.updateOne({ _id: { $eq: ObjectId(instanceId) } }, { $set: set });
|
|
41
|
+
return null;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
let tokenProcessorFn = null;
|
|
45
|
+
|
|
46
|
+
module.exports = {
|
|
47
|
+
setConnection: async function (connection, tokenProcessor, config) {
|
|
48
|
+
tokenProcessorFn = tokenProcessor;
|
|
49
|
+
_processorConfig = config;
|
|
50
|
+
// seccion que hace el retry
|
|
51
|
+
let mongoClient = null;
|
|
52
|
+
if (connection.useRetries){
|
|
53
|
+
await AsyncRetry(async () => {
|
|
54
|
+
mongoClient = new MongoClient(connection.url, { useUnifiedTopology: true });
|
|
55
|
+
try {
|
|
56
|
+
await mongoClient.connect();
|
|
57
|
+
} catch (err) {
|
|
58
|
+
console.error('Error connecting to MongoDB:', err);
|
|
59
|
+
throw err; // This will trigger a retry
|
|
60
|
+
} finally {
|
|
61
|
+
}
|
|
62
|
+
}, {
|
|
63
|
+
retries: connection.retryCount,
|
|
64
|
+
minTimeout: connection.minRetryInterval * 1000,
|
|
65
|
+
maxTimeout: connection.maxRetryInterval * 1000,
|
|
66
|
+
});
|
|
67
|
+
} else {
|
|
68
|
+
mongoClient = new MongoClient(connection.url, { useUnifiedTopology: true });
|
|
69
|
+
await mongoClient.connect();
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
// termino la seccion del retry
|
|
73
|
+
let mongoDb = mongoClient.db(connection.databaseName);
|
|
74
|
+
_mongodbCollectionInstances = mongoDb.collection('blz-instances');
|
|
75
|
+
_agenda = new Agenda({ mongo: mongoDb, db: { collection: 'blz-jobs' }, name: `worker-${process.pid}` });
|
|
76
|
+
_agenda.define('start', async function (job) {
|
|
77
|
+
module.exports.start(job.attrs.data.processName, {}, job.attrs.data.startNodeName, tokenProcessor);
|
|
78
|
+
await job.remove();
|
|
79
|
+
});
|
|
80
|
+
// This is the job in charge of processing the token.
|
|
81
|
+
_agenda.define('process-token', { concurrency: 1, lockLimit: 1, lockLifetime: 120000 }, async function (job) {
|
|
82
|
+
// 🧱 Prevent double execution manually
|
|
83
|
+
if (job.attrs.data.status === 'done' || job.attrs.data.running) {
|
|
84
|
+
if (job.attrs.data.status === 'done') {
|
|
85
|
+
logger.info(`process-token skipped: already executed for token ${tokenId}`);
|
|
86
|
+
await job.remove(); // cleanup
|
|
87
|
+
}
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
// 🏁 Mark it as running
|
|
91
|
+
job.attrs.data.running = true;
|
|
92
|
+
await job.save();
|
|
93
|
+
|
|
94
|
+
const { processName, instanceId, tokenId, nodeName, inboundTransaction } = job.attrs.data;
|
|
95
|
+
let instanceData = null;
|
|
96
|
+
try {
|
|
97
|
+
instanceData = await _mongodbCollectionInstances.findOne({ _id: new ObjectId(instanceId) });
|
|
98
|
+
|
|
99
|
+
if (instanceData && instanceData.tokens[tokenId]) {
|
|
100
|
+
await tokenProcessor(processName, instanceId, tokenId, nodeName, inboundTransaction);
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
// 🧩 3️⃣ Mark done.
|
|
104
|
+
job.attrs.data.status = 'done';
|
|
105
|
+
job.attrs.data.running = false;
|
|
106
|
+
await job.save();
|
|
107
|
+
await job.remove();
|
|
108
|
+
} catch (err) {
|
|
109
|
+
const safeError = (err instanceof Error)
|
|
110
|
+
? { message: err.message ?? err.data, stack: err.stack }
|
|
111
|
+
: { ...err };
|
|
112
|
+
|
|
113
|
+
job.attrs.failCount = (job.attrs.failCount || 0) + 1;
|
|
114
|
+
|
|
115
|
+
if (job.attrs.failCount >= _processorConfig.retriesAfterError) {
|
|
116
|
+
logger.error({
|
|
117
|
+
msg: 'process-token failed maximum times, disabling job',
|
|
118
|
+
processName,
|
|
119
|
+
instanceId,
|
|
120
|
+
tokenId,
|
|
121
|
+
nodeName,
|
|
122
|
+
failCount: job.attrs.failCount,
|
|
123
|
+
error: safeError
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
job.attrs.disabled = true;
|
|
127
|
+
const newTokens = { ...instanceData.tokens };
|
|
128
|
+
if (newTokens[tokenId]) {
|
|
129
|
+
newTokens[tokenId] = { ...newTokens[tokenId], hasError: true };
|
|
130
|
+
}
|
|
131
|
+
await writeMongo(processName, instanceId, 'tokens', newTokens);
|
|
132
|
+
} else {
|
|
133
|
+
const retryInMs = 5000;
|
|
134
|
+
logger.warn({
|
|
135
|
+
msg: `process-token failed, scheduled new retry (attempt ${job.attrs.failCount}/${_processorConfig.retriesAfterError})`,
|
|
136
|
+
processName,
|
|
137
|
+
instanceId,
|
|
138
|
+
tokenId,
|
|
139
|
+
nodeName,
|
|
140
|
+
failCount: job.attrs.failCount,
|
|
141
|
+
nextRetryInMs: retryInMs,
|
|
142
|
+
error: safeError
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
job.attrs.nextRunAt = new Date(Date.now() + retryInMs);
|
|
146
|
+
}
|
|
147
|
+
job.attrs.data.running = false;
|
|
148
|
+
await job.save();
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
await _agenda.start();
|
|
154
|
+
},
|
|
155
|
+
start: async function (processName, startModel, startNodeName) {
|
|
156
|
+
let mongodbInstanceId = new ObjectId();
|
|
157
|
+
let instanceId = mongodbInstanceId.toHexString();
|
|
158
|
+
let tokenId = (new ObjectId).toHexString();
|
|
159
|
+
let instanceData = {
|
|
160
|
+
_id: mongodbInstanceId,
|
|
161
|
+
processName: processName,
|
|
162
|
+
model: startModel,
|
|
163
|
+
tokens: {},
|
|
164
|
+
compensations: {}
|
|
165
|
+
};
|
|
166
|
+
instanceData.tokens[tokenId] = { nodeName: startNodeName };
|
|
167
|
+
await _mongodbCollectionInstances.insertOne(instanceData);
|
|
168
|
+
console.log('Creating job for tokenId:', tokenId);
|
|
169
|
+
// // Prevent duplicates and Do not update an existing job if it exists
|
|
170
|
+
await _agenda.now('process-token', { processName: processName, instanceId: instanceId, tokenId: tokenId, nodeName: startNodeName }, { unique: { 'data.tokenId': tokenId }, insertOnly: true });
|
|
171
|
+
return instanceId;
|
|
172
|
+
},
|
|
173
|
+
resume: async function (processName, instanceId) {
|
|
174
|
+
let mongoInstance = await module.exports.getInstance(processName, instanceId)
|
|
175
|
+
// get token/node that has the the error
|
|
176
|
+
let jobId = null;
|
|
177
|
+
for( let i = 0; i < mongoInstance.tokens.length; ++i ) {
|
|
178
|
+
const item = mongoInstance.tokens[ i ];
|
|
179
|
+
if( item.hasError )
|
|
180
|
+
jobId = mongoInstance.tokens[0].tokenId;
|
|
181
|
+
}
|
|
182
|
+
if (!jobId) {
|
|
183
|
+
logger.warn(`No bpm mongoInstance.token found with errors for mongoInstance ${instanceId}`);
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
const jobs = await _agenda.jobs({ 'data.tokenId': jobId });
|
|
187
|
+
const job = jobs[0];
|
|
188
|
+
if (!job) {
|
|
189
|
+
logger.warn(`No job found with id ${jobId}`);
|
|
190
|
+
return null;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Re-enable the job
|
|
194
|
+
job.attrs.disabled = false;
|
|
195
|
+
|
|
196
|
+
// Clear any lock or failed timestamps to allow retry
|
|
197
|
+
job.attrs.lockedAt = null;
|
|
198
|
+
job.attrs.lastFinishedAt = null;
|
|
199
|
+
job.attrs.failedAt = null;
|
|
200
|
+
job.attrs.failReason = null;
|
|
201
|
+
|
|
202
|
+
// Save the updated job
|
|
203
|
+
await job.save();
|
|
204
|
+
// Reschedule or immediately run
|
|
205
|
+
await job.run();
|
|
206
|
+
|
|
207
|
+
logger.info(`BPM instance: ${instanceId} has been re-enabled, and is attempting to run again.`);
|
|
208
|
+
return null;
|
|
209
|
+
},
|
|
210
|
+
killAgendaJob: async function (agenda, jobId, options = {}) {
|
|
211
|
+
|
|
212
|
+
},
|
|
213
|
+
scheduleStart: async function (processName, startNodeName, datetime) {
|
|
214
|
+
let now = new Date(Date.now());
|
|
215
|
+
now = new Date(Date.UTC(now.getUTCFullYear(), now.getUTCMonth(), now.getUTCDate(), now.getUTCHours(), now.getUTCMinutes(), now.getUTCSeconds(), now.getUTCMilliseconds()));
|
|
216
|
+
await _agenda.schedule(datetime, 'start', { processName: processName, startNodeName: startNodeName });
|
|
217
|
+
},
|
|
218
|
+
killInstance: async function (processName, instanceId, instanceFinisher) {
|
|
219
|
+
await _mongodbCollectionInstances.deleteOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
220
|
+
instanceFinisher(processName);
|
|
221
|
+
},
|
|
222
|
+
createToken: async function (processName, instanceId, nodeName, parentTokenId) {
|
|
223
|
+
let tokenId = (new ObjectId()).toHexString();
|
|
224
|
+
let tokenData = { nodeName: nodeName };
|
|
225
|
+
if (parentTokenId)
|
|
226
|
+
tokenData.parentTokenId = parentTokenId;
|
|
227
|
+
let set = {};
|
|
228
|
+
set['tokens.' + tokenId] = tokenData;
|
|
229
|
+
await _mongodbCollectionInstances.updateOne({ _id: { $eq: ObjectId(instanceId) } }, { $set: set });
|
|
230
|
+
await _agenda.now('process-token', { processName: processName, instanceId: instanceId, tokenId: tokenId, nodeName: nodeName });
|
|
231
|
+
},
|
|
232
|
+
moveToken: async function (processName, instanceId, tokenId, targets, newGatewayNumber, tokenProcessor) {
|
|
233
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
234
|
+
let tokenData = instanceData.tokens[tokenId];
|
|
235
|
+
if (tokenData) {
|
|
236
|
+
let parentTokenId = tokenData.parentTokenId;
|
|
237
|
+
let gatewayNumbers = tokenData.gatewayNumbers;
|
|
238
|
+
let unset = {};
|
|
239
|
+
let set = {};
|
|
240
|
+
removeTokenAndChilds(instanceData, tokenId, unset);
|
|
241
|
+
await _mongodbCollectionInstances.updateOne({ _id: { $eq: ObjectId(instanceId) } }, { $unset: unset });
|
|
242
|
+
instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
243
|
+
for (let i = 0; i < targets.length; i++) {
|
|
244
|
+
let target = targets[i];
|
|
245
|
+
let pass = true;
|
|
246
|
+
if (target.filterGatewayNumber) {
|
|
247
|
+
for (let otherTokenId in instanceData.tokens) {
|
|
248
|
+
let otherTokenData = instanceData.tokens[otherTokenId];
|
|
249
|
+
if (otherTokenData.gatewayNumbers && otherTokenData.gatewayNumbers.indexOf(target.filterGatewayNumber) !== -1)
|
|
250
|
+
pass = false;
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
if (pass) {
|
|
254
|
+
target.newTokenId = (new ObjectId()).toHexString();
|
|
255
|
+
target.newTokenData = {nodeName: target.nodeName};
|
|
256
|
+
if (parentTokenId)
|
|
257
|
+
target.newTokenData.parentTokenId = parentTokenId;
|
|
258
|
+
if (gatewayNumbers || newGatewayNumber) {
|
|
259
|
+
target.newTokenData.gatewayNumbers = [];
|
|
260
|
+
if (gatewayNumbers) {
|
|
261
|
+
for (let j = 0; j < gatewayNumbers.length; j++) {
|
|
262
|
+
let gatewayNumber = gatewayNumbers[j];
|
|
263
|
+
if (gatewayNumber !== target.filterGatewayNumber)
|
|
264
|
+
target.newTokenData.gatewayNumbers.push(gatewayNumber);
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
if (newGatewayNumber) {
|
|
268
|
+
target.newTokenData.gatewayNumbers.push(newGatewayNumber);
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
if (target.waitMessages)
|
|
272
|
+
target.newTokenData.waitMessages = target.waitMessages;
|
|
273
|
+
if (target.waitSignals)
|
|
274
|
+
target.newTokenData.waitSignals = target.waitSignals;
|
|
275
|
+
set['tokens.' + target.newTokenId] = target.newTokenData;
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
if (Object.keys(set).length === 0)
|
|
279
|
+
await _mongodbCollectionInstances.updateOne({_id: {$eq: ObjectId(instanceId)}}, { $unset: unset });
|
|
280
|
+
else
|
|
281
|
+
await _mongodbCollectionInstances.updateOne({_id: {$eq: ObjectId(instanceId)}}, { $unset: unset, $set: set });
|
|
282
|
+
for (let i = 0; i < targets.length; i++) {
|
|
283
|
+
let target = targets[i];
|
|
284
|
+
if (target.newTokenId) {
|
|
285
|
+
if (target.immediateNodeName) {
|
|
286
|
+
if (target.immediateSchedule) {
|
|
287
|
+
await _agenda.now('process-token', { processName: processName, instanceId: instanceId, tokenId: target.newTokenId, nodeName: target.immediateNodeName, inboundTransaction: target.inbound });
|
|
288
|
+
}
|
|
289
|
+
else {
|
|
290
|
+
await tokenProcessor(processName, instanceId, target.newTokenId, target.immediateNodeName, target.inbound);
|
|
291
|
+
}
|
|
292
|
+
}
|
|
293
|
+
if (target.waitTimers) {
|
|
294
|
+
for (let j = 0; j < target.waitTimers.length; j++) {
|
|
295
|
+
let waitTimer = target.waitTimers[j];
|
|
296
|
+
await _agenda.schedule(waitTimer.datetime, 'process-token', { processName: processName, instanceId: instanceId, tokenId: target.newTokenId, nodeName: waitTimer.nodeName, inboundTransaction: target.inbound });
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
},
|
|
303
|
+
killToken: async function (processName, instanceId, tokenId, subProcessFinisher, instanceFinisher, err) {
|
|
304
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
305
|
+
let tokenData = instanceData.tokens[tokenId];
|
|
306
|
+
if (tokenData) {
|
|
307
|
+
let parentTokenId = tokenData.parentTokenId;
|
|
308
|
+
let unset = {};
|
|
309
|
+
removeTokenAndChilds(instanceData, tokenId, unset);
|
|
310
|
+
if (err) {
|
|
311
|
+
for (let otherTokenId in instanceData.tokens) {
|
|
312
|
+
let otherTokenData = instanceData.tokens[otherTokenId];
|
|
313
|
+
if (otherTokenData.parentTokenId === parentTokenId)
|
|
314
|
+
removeTokenAndChilds(instanceData, otherTokenId, unset);
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
if (Object.keys(instanceData.tokens).length === 0) {
|
|
318
|
+
await _mongodbCollectionInstances.deleteOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
319
|
+
instanceFinisher(processName, err);
|
|
320
|
+
}
|
|
321
|
+
else {
|
|
322
|
+
await _mongodbCollectionInstances.updateOne({ _id: { $eq: ObjectId(instanceId) } }, { $unset: unset });
|
|
323
|
+
if (parentTokenId) {
|
|
324
|
+
let subProcessFinished = true;
|
|
325
|
+
for (let otherTokenId in instanceData.tokens) {
|
|
326
|
+
let otherTokenData = instanceData.tokens[otherTokenId];
|
|
327
|
+
if (otherTokenData.parentTokenId === parentTokenId)
|
|
328
|
+
subProcessFinished = false;
|
|
329
|
+
}
|
|
330
|
+
if (subProcessFinished)
|
|
331
|
+
subProcessFinisher(processName, instanceId, parentTokenId, err);
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
},
|
|
336
|
+
readModel: async function (processName, instanceId, variableName) {
|
|
337
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
338
|
+
if (instanceData) {
|
|
339
|
+
if (variableName === null || variableName === undefined)
|
|
340
|
+
return instanceData.model;
|
|
341
|
+
else
|
|
342
|
+
return instanceData.model[variableName];
|
|
343
|
+
}
|
|
344
|
+
return null;
|
|
345
|
+
},
|
|
346
|
+
writeModel: async function (processName, instanceId, variableName, value) {
|
|
347
|
+
let set = {};
|
|
348
|
+
set['model.' + variableName] = value;
|
|
349
|
+
await _mongodbCollectionInstances.updateOne({ _id: { $eq: ObjectId(instanceId) } }, { $set: set });
|
|
350
|
+
return null;
|
|
351
|
+
},
|
|
352
|
+
getNodeName: async function (processName, instanceId, tokenId) {
|
|
353
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
354
|
+
let nodeName = null;
|
|
355
|
+
if (instanceData) {
|
|
356
|
+
let tokenData = instanceData.tokens[tokenId];
|
|
357
|
+
if (tokenData)
|
|
358
|
+
nodeName = tokenData.nodeName;
|
|
359
|
+
}
|
|
360
|
+
return nodeName;
|
|
361
|
+
},
|
|
362
|
+
getReceivers: async function (processName, instanceId, messageKey, signalName) {
|
|
363
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
364
|
+
let receivers = [];
|
|
365
|
+
if (instanceData) {
|
|
366
|
+
for (let tokenId in instanceData.tokens) {
|
|
367
|
+
let tokenData = instanceData.tokens[tokenId];
|
|
368
|
+
if (tokenData.waitMessages) {
|
|
369
|
+
for (let i = 0; i < tokenData.waitMessages.length; i++) {
|
|
370
|
+
let waitMessage = tokenData.waitMessages[i];
|
|
371
|
+
if (waitMessage.messageKey === messageKey)
|
|
372
|
+
receivers.push({ tokenId: tokenId, nodeName: waitMessage.nodeName });
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
if (tokenData.waitSignals) {
|
|
376
|
+
for (let i = 0; i < tokenData.waitSignals.length; i++) {
|
|
377
|
+
let waitSignal = tokenData.waitSignals[i];
|
|
378
|
+
if (waitSignal.signalName === signalName)
|
|
379
|
+
receivers.push({ tokenId: tokenId, nodeName: waitSignal.nodeName });
|
|
380
|
+
}
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
return receivers;
|
|
385
|
+
},
|
|
386
|
+
enqueueCompensation: async function (processName, instanceId, compensationKey, nodeName) {
|
|
387
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
388
|
+
let compensations = instanceData.compensations[compensationKey];
|
|
389
|
+
if (compensations === null || compensations === undefined) {
|
|
390
|
+
compensations = [];
|
|
391
|
+
instanceData.compensations[compensationKey] = compensations;
|
|
392
|
+
}
|
|
393
|
+
compensations.push({ nodeName: nodeName, model: JSON.parse(JSON.stringify(instanceData.model)) });
|
|
394
|
+
let set = {};
|
|
395
|
+
set['compensations.' + compensationKey] = compensations;
|
|
396
|
+
await _mongodbCollectionInstances.updateOne({ _id: { $eq: ObjectId(instanceId) } }, { $set: set });
|
|
397
|
+
},
|
|
398
|
+
compensate: async function (processName, instanceId, compensationKey, instanceCompensator) {
|
|
399
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
400
|
+
let compensations = instanceData.compensations[compensationKey];
|
|
401
|
+
if (compensations) {
|
|
402
|
+
while (compensations.length > 0) {
|
|
403
|
+
let compensation = compensations.pop();
|
|
404
|
+
instanceCompensator(processName, instanceId, compensationKey, compensation.nodeName, compensation.model);
|
|
405
|
+
}
|
|
406
|
+
}
|
|
407
|
+
let set = {};
|
|
408
|
+
set['compensations.' + compensationKey] = [];
|
|
409
|
+
await _mongodbCollectionInstances.updateOne({ _id: { $eq: ObjectId(instanceId) } }, { $set: set });
|
|
410
|
+
},
|
|
411
|
+
listInstances: async function (processName, offset, limit) {
|
|
412
|
+
var mongodbCursor = await _mongodbCollectionInstances.find({ processName: { $eq: processName } }, { skip: offset, limit: limit });
|
|
413
|
+
return await mongodbCursor.map(function (instanceData) { return getInstance(instanceData); }).toArray();
|
|
414
|
+
},
|
|
415
|
+
getInstance: async function (processName, instanceId) {
|
|
416
|
+
var instanceData = await _mongodbCollectionInstances.findOne({ _id: { $eq: ObjectId(instanceId) } });
|
|
417
|
+
let instance = null;
|
|
418
|
+
if (instanceData)
|
|
419
|
+
instance = getInstance(instanceData);
|
|
420
|
+
return instance;
|
|
421
|
+
}
|
|
422
|
+
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export function getHealthStatus(_buildSystem: any, _connections: any): Promise<{}>;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const fetch=require("node-fetch"),logger=require("pino")(),safeRequire=function(e){try{return require.resolve(e),require(e)}catch(t){if("MODULE_NOT_FOUND"===t.code){let t=e.replace(/^\.\.\//,"");return e!==t?safeRequire(t):void 0}throw t}},mongoDb=safeRequire("../../../essentials/extensions/blz-mongodb/sources-backend-nodejs/index.js")||safeRequire("../../blz-mongodb/backend/index.js"),kafka=safeRequire("../../../essentials/extensions/blz-kafka/sources-backend-nodejs/index.js")||safeRequire("../../blz-kafka/backend/index.js"),rds=safeRequire("../../../essentials/extensions/blz-rds/sources-backend-nodejs/index.js")||safeRequire("../../blz-rds/backend/index.js");async function healthCheckMicroservice(e){let t={};const a=e.healthCheckPath?new URL(healthCheckPath.healthCheckPath,e.url).toString():new URL("/blz-health-status",e.url).toString();try{const n=await fetch(a);if(n.ok){const a=await n.json();t={name:e.name,type:e.type,status:n.status,statusCode:n.statusCode,error:"-",internal:a}}else t={name:e.name,type:e.type,status:"error",error:`HTTP Error: ${n.statusText}`}}catch(a){t={name:e.name,type:e.type,status:"error",error:a.message}}return t}async function healthCheckAllPossibleUrl(e){let t=["/blz-health-status","/health","/actuator/health","/"];e.healthCheckPath&&t.unshift(e.healthCheckPath);for(const a of t){const t=new URL(a,e.url).toString();try{const e=await fetch(t);if(e.ok&&"/blz-health-status"===a){const a=await e.json();return{status:e.status,url:t,data:a}}if(e.ok&&"/health"===a)return{status:e.status,url:t,data:"Connected with /Health API. httpCode 200."};if(e.ok)return{status:e.status,url:t,data:"Connected with standard Http code 200 protocol. Endpoint: "+a}}catch(e){logger.info(e)}}return{status:"error",message:"No valid health check endpoint found"}}async function getHealthStatus(e,t){let a=e.name,n=e.type,s={};s[a]={name:a,type:"Self",status:"ok",error:"-"};const r=[];for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const s=t[e];if(s.name!==a){const e=(async()=>{switch(s.type){case"Microservice":case"ProcessEngine":return{name:s.name,result:await healthCheckMicroservice(s)};case"RestApi":return{name:s.name,result:await healthCheckAllPossibleUrl(s)};case"Mongodb":{if(!mongoDb)return{name:s.name,type:s.type,result:{name:s.name,type:s.type,error:"mongoDb module not present"}};const e=await mongoDb.mongodbConnectionHealthCheck(s);return{name:s.name,result:{name:s.name,type:s.type,...e}}}case"Kafka":{if(!kafka)return{name:s.name,type:s.type,error:"kafka module not present"};const e=await kafka.kafkaConnectionHealthCheck(s);return{name:s.name,result:{name:s.name,type:s.type,...e}}}case"RelationalDatabase":{if(!rds)return{name:s.name,type:s.type,error:"rds module not present"};const e={callStack:[],callVariables:{},currentUrl:"",description:"GET /health",systemName:a,systemType:n},t=await rds.rdsConnectionHealthCheck(s,e);return{name:s.name,result:{name:s.name,type:s.type,...t}}}default:return{name:s.name,result:{name:s.name,type:s.type,status:"Not Implemented",error:"Not Implemented"}}}})();r.push(e)}}const o=await Promise.all(r);for(const{name:e,result:t}of o)s[e]=t;return s}function assembleHealthResponseObject(e,t){return{name:e.name,type:e.type,status:t.status,statusCode:t.statusCode,error:t.error,internal:t.internal}}module.exports={getHealthStatus:getHealthStatus};
|