@carno.js/core 0.2.11 → 1.0.2

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.
Files changed (314) hide show
  1. package/LICENSE +673 -673
  2. package/README.md +188 -0
  3. package/dist/Carno.js +272 -333
  4. package/dist/Carno.mjs +268 -0
  5. package/dist/DefaultRoutes.js +51 -0
  6. package/dist/DefaultRoutes.mjs +34 -0
  7. package/dist/bun/index.js +183 -0
  8. package/dist/bun/index.js.map +86 -0
  9. package/dist/cache/CacheDriver.js +13 -0
  10. package/dist/cache/CacheDriver.mjs +0 -0
  11. package/dist/cache/CacheService.js +113 -0
  12. package/dist/cache/CacheService.mjs +93 -0
  13. package/dist/cache/MemoryDriver.js +66 -0
  14. package/dist/cache/MemoryDriver.mjs +46 -0
  15. package/dist/cache/RedisDriver.js +81 -0
  16. package/dist/cache/RedisDriver.mjs +61 -0
  17. package/dist/compiler/JITCompiler.js +111 -0
  18. package/dist/compiler/JITCompiler.mjs +89 -0
  19. package/dist/container/Container.js +99 -0
  20. package/dist/container/Container.mjs +78 -0
  21. package/dist/context/Context.js +97 -0
  22. package/dist/context/Context.mjs +77 -0
  23. package/dist/cors/CorsHandler.js +90 -0
  24. package/dist/cors/CorsHandler.mjs +68 -0
  25. package/dist/decorators/Controller.js +42 -0
  26. package/dist/decorators/Controller.mjs +22 -0
  27. package/dist/decorators/Inject.js +30 -0
  28. package/dist/decorators/Inject.mjs +10 -0
  29. package/dist/decorators/Middleware.js +35 -0
  30. package/dist/decorators/Middleware.mjs +15 -0
  31. package/dist/decorators/Service.js +31 -0
  32. package/dist/decorators/Service.mjs +12 -0
  33. package/dist/decorators/methods.js +60 -0
  34. package/dist/decorators/methods.mjs +34 -0
  35. package/dist/decorators/params.js +63 -0
  36. package/dist/decorators/params.mjs +37 -0
  37. package/dist/events/Lifecycle.js +69 -0
  38. package/dist/events/Lifecycle.mjs +41 -0
  39. package/dist/exceptions/HttpException.js +112 -26
  40. package/dist/exceptions/HttpException.mjs +82 -0
  41. package/dist/index.js +129 -31
  42. package/dist/index.mjs +94 -0
  43. package/dist/metadata.js +34 -0
  44. package/dist/metadata.mjs +9 -0
  45. package/dist/middleware/CarnoMiddleware.js +13 -0
  46. package/dist/middleware/CarnoMiddleware.mjs +0 -0
  47. package/dist/router/RadixRouter.js +121 -0
  48. package/dist/router/RadixRouter.mjs +101 -0
  49. package/dist/testing/TestHarness.js +81 -0
  50. package/dist/testing/TestHarness.mjs +60 -0
  51. package/dist/utils/Metadata.js +53 -0
  52. package/dist/utils/Metadata.mjs +31 -0
  53. package/dist/validation/ValibotAdapter.js +67 -0
  54. package/dist/validation/ValibotAdapter.mjs +48 -0
  55. package/dist/validation/ValidatorAdapter.js +35 -19
  56. package/dist/validation/ValidatorAdapter.mjs +14 -0
  57. package/dist/validation/ZodAdapter.js +80 -0
  58. package/dist/validation/ZodAdapter.mjs +59 -0
  59. package/package.json +21 -63
  60. package/src/Carno.ts +605 -0
  61. package/src/DefaultRoutes.ts +34 -0
  62. package/src/cache/CacheDriver.ts +50 -0
  63. package/src/cache/CacheService.ts +139 -0
  64. package/src/cache/MemoryDriver.ts +104 -0
  65. package/src/cache/RedisDriver.ts +116 -0
  66. package/src/compiler/JITCompiler.ts +167 -0
  67. package/src/container/Container.ts +168 -0
  68. package/src/context/Context.ts +128 -0
  69. package/src/cors/CorsHandler.ts +145 -0
  70. package/src/decorators/Controller.ts +63 -0
  71. package/src/decorators/Inject.ts +16 -0
  72. package/src/decorators/Middleware.ts +22 -0
  73. package/src/decorators/Service.ts +18 -0
  74. package/src/decorators/methods.ts +58 -0
  75. package/src/decorators/params.ts +47 -0
  76. package/src/events/Lifecycle.ts +97 -0
  77. package/src/exceptions/HttpException.ts +99 -0
  78. package/src/index.ts +92 -0
  79. package/src/metadata.ts +46 -0
  80. package/src/middleware/CarnoMiddleware.ts +14 -0
  81. package/src/router/RadixRouter.ts +225 -0
  82. package/src/testing/TestHarness.ts +177 -0
  83. package/src/utils/Metadata.ts +43 -0
  84. package/src/validation/ValibotAdapter.ts +95 -0
  85. package/src/validation/ValidatorAdapter.ts +69 -0
  86. package/src/validation/ZodAdapter.ts +102 -0
  87. package/dist/Carno.d.ts +0 -75
  88. package/dist/cache/bento-cache.driver.d.ts +0 -13
  89. package/dist/cache/bento-cache.driver.js +0 -55
  90. package/dist/cache/cache.service.d.ts +0 -8
  91. package/dist/cache/cache.service.js +0 -6
  92. package/dist/commons/decorators/Injectable.decorator.d.ts +0 -20
  93. package/dist/commons/decorators/Injectable.decorator.js +0 -33
  94. package/dist/commons/decorators/controller.decorator.d.ts +0 -8
  95. package/dist/commons/decorators/controller.decorator.js +0 -22
  96. package/dist/commons/decorators/http.decorators.d.ts +0 -13
  97. package/dist/commons/decorators/http.decorators.js +0 -63
  98. package/dist/commons/decorators/index.d.ts +0 -6
  99. package/dist/commons/decorators/index.js +0 -22
  100. package/dist/commons/decorators/inject.decorator.d.ts +0 -1
  101. package/dist/commons/decorators/inject.decorator.js +0 -5
  102. package/dist/commons/decorators/middleware.decorator.d.ts +0 -2
  103. package/dist/commons/decorators/middleware.decorator.js +0 -30
  104. package/dist/commons/decorators/service.decorator.d.ts +0 -2
  105. package/dist/commons/decorators/service.decorator.js +0 -7
  106. package/dist/commons/decorators/validation.decorator.d.ts +0 -32
  107. package/dist/commons/decorators/validation.decorator.js +0 -40
  108. package/dist/commons/http-code.enum.d.ts +0 -50
  109. package/dist/commons/http-code.enum.js +0 -54
  110. package/dist/commons/index.d.ts +0 -3
  111. package/dist/commons/index.js +0 -19
  112. package/dist/commons/registries/ProviderControl.d.ts +0 -77
  113. package/dist/commons/registries/ProviderControl.js +0 -112
  114. package/dist/commons/registries/ProviderRegistry.d.ts +0 -7
  115. package/dist/commons/registries/ProviderRegistry.js +0 -20
  116. package/dist/constants.d.ts +0 -8
  117. package/dist/constants.js +0 -11
  118. package/dist/container/ContainerConfiguration.d.ts +0 -45
  119. package/dist/container/ContainerConfiguration.js +0 -121
  120. package/dist/container/DependencyResolver.d.ts +0 -20
  121. package/dist/container/DependencyResolver.js +0 -85
  122. package/dist/container/InjectorService.d.ts +0 -58
  123. package/dist/container/InjectorService.js +0 -286
  124. package/dist/container/MethodInvoker.d.ts +0 -21
  125. package/dist/container/MethodInvoker.js +0 -83
  126. package/dist/container/RouteResolver.d.ts +0 -27
  127. package/dist/container/RouteResolver.js +0 -173
  128. package/dist/container/container.d.ts +0 -41
  129. package/dist/container/container.js +0 -71
  130. package/dist/container/createContainer.d.ts +0 -3
  131. package/dist/container/createContainer.js +0 -12
  132. package/dist/container/createInjector.d.ts +0 -2
  133. package/dist/container/createInjector.js +0 -7
  134. package/dist/container/index.d.ts +0 -6
  135. package/dist/container/index.js +0 -22
  136. package/dist/container/middleware.resolver.d.ts +0 -9
  137. package/dist/container/middleware.resolver.js +0 -35
  138. package/dist/default-routes-carno.d.ts +0 -3
  139. package/dist/default-routes-carno.js +0 -29
  140. package/dist/domain/BaseContext.d.ts +0 -15
  141. package/dist/domain/BaseContext.js +0 -2
  142. package/dist/domain/CarnoClosure.d.ts +0 -1
  143. package/dist/domain/CarnoClosure.js +0 -2
  144. package/dist/domain/CarnoMiddleware.d.ts +0 -5
  145. package/dist/domain/CarnoMiddleware.js +0 -2
  146. package/dist/domain/Context.d.ts +0 -58
  147. package/dist/domain/Context.js +0 -188
  148. package/dist/domain/FastContext.d.ts +0 -34
  149. package/dist/domain/FastContext.js +0 -59
  150. package/dist/domain/LocalsContainer.d.ts +0 -4
  151. package/dist/domain/LocalsContainer.js +0 -10
  152. package/dist/domain/Metadata.d.ts +0 -449
  153. package/dist/domain/Metadata.js +0 -511
  154. package/dist/domain/cors-config.d.ts +0 -12
  155. package/dist/domain/cors-config.js +0 -18
  156. package/dist/domain/cors-headers-cache.d.ts +0 -17
  157. package/dist/domain/cors-headers-cache.js +0 -101
  158. package/dist/domain/http-method.d.ts +0 -7
  159. package/dist/domain/http-method.js +0 -11
  160. package/dist/domain/index.d.ts +0 -10
  161. package/dist/domain/index.js +0 -26
  162. package/dist/domain/provider-scope.d.ts +0 -5
  163. package/dist/domain/provider-scope.js +0 -9
  164. package/dist/domain/provider-type.d.ts +0 -6
  165. package/dist/domain/provider-type.js +0 -10
  166. package/dist/domain/provider.d.ts +0 -37
  167. package/dist/domain/provider.js +0 -70
  168. package/dist/events/hooks.decorator.d.ts +0 -3
  169. package/dist/events/hooks.decorator.js +0 -29
  170. package/dist/events/index.d.ts +0 -2
  171. package/dist/events/index.js +0 -18
  172. package/dist/events/on-event.d.ts +0 -13
  173. package/dist/events/on-event.js +0 -11
  174. package/dist/exceptions/HttpException.d.ts +0 -9
  175. package/dist/exceptions/index.d.ts +0 -1
  176. package/dist/exceptions/index.js +0 -17
  177. package/dist/index.d.ts +0 -16
  178. package/dist/route/CompiledRoute.d.ts +0 -23
  179. package/dist/route/CompiledRoute.js +0 -9
  180. package/dist/route/FastPathExecutor.d.ts +0 -12
  181. package/dist/route/FastPathExecutor.js +0 -50
  182. package/dist/route/JITCompiler.d.ts +0 -28
  183. package/dist/route/JITCompiler.js +0 -245
  184. package/dist/route/Matcher.d.ts +0 -11
  185. package/dist/route/Matcher.js +0 -48
  186. package/dist/route/ParamResolverFactory.d.ts +0 -14
  187. package/dist/route/ParamResolverFactory.js +0 -49
  188. package/dist/route/RouteCompiler.d.ts +0 -28
  189. package/dist/route/RouteCompiler.js +0 -157
  190. package/dist/route/RouteExecutor.d.ts +0 -12
  191. package/dist/route/RouteExecutor.js +0 -84
  192. package/dist/route/memoirist.d.ts +0 -31
  193. package/dist/route/memoirist.js +0 -373
  194. package/dist/services/logger.service.d.ts +0 -23
  195. package/dist/services/logger.service.js +0 -47
  196. package/dist/testing/core-testing.d.ts +0 -24
  197. package/dist/testing/core-testing.js +0 -102
  198. package/dist/testing/index.d.ts +0 -1
  199. package/dist/testing/index.js +0 -17
  200. package/dist/utils/ValidationCache.d.ts +0 -5
  201. package/dist/utils/ValidationCache.js +0 -35
  202. package/dist/utils/ancestorOf.d.ts +0 -2
  203. package/dist/utils/ancestorOf.js +0 -10
  204. package/dist/utils/ancestorsOf.d.ts +0 -6
  205. package/dist/utils/ancestorsOf.js +0 -20
  206. package/dist/utils/classOf.d.ts +0 -13
  207. package/dist/utils/classOf.js +0 -21
  208. package/dist/utils/cleanObject.d.ts +0 -6
  209. package/dist/utils/cleanObject.js +0 -22
  210. package/dist/utils/constructorOf.d.ts +0 -11
  211. package/dist/utils/constructorOf.js +0 -18
  212. package/dist/utils/createInstance.d.ts +0 -1
  213. package/dist/utils/createInstance.js +0 -7
  214. package/dist/utils/decoratorTypeOf.d.ts +0 -11
  215. package/dist/utils/decoratorTypeOf.js +0 -32
  216. package/dist/utils/deepClone.d.ts +0 -6
  217. package/dist/utils/deepClone.js +0 -63
  218. package/dist/utils/deepMerge.d.ts +0 -9
  219. package/dist/utils/deepMerge.js +0 -62
  220. package/dist/utils/descriptorOf.d.ts +0 -8
  221. package/dist/utils/descriptorOf.js +0 -16
  222. package/dist/utils/formatValidationErrors.d.ts +0 -5
  223. package/dist/utils/formatValidationErrors.js +0 -80
  224. package/dist/utils/getClassOrSymbol.d.ts +0 -1
  225. package/dist/utils/getClassOrSymbol.js +0 -8
  226. package/dist/utils/getConstructorArgNames.d.ts +0 -1
  227. package/dist/utils/getConstructorArgNames.js +0 -12
  228. package/dist/utils/getMethodArgTypes.d.ts +0 -1
  229. package/dist/utils/getMethodArgTypes.js +0 -9
  230. package/dist/utils/getValue.d.ts +0 -32
  231. package/dist/utils/getValue.js +0 -47
  232. package/dist/utils/hasJsonMethod.d.ts +0 -1
  233. package/dist/utils/hasJsonMethod.js +0 -6
  234. package/dist/utils/index.d.ts +0 -15
  235. package/dist/utils/index.js +0 -31
  236. package/dist/utils/isArray.d.ts +0 -13
  237. package/dist/utils/isArray.js +0 -21
  238. package/dist/utils/isArrowFn.d.ts +0 -1
  239. package/dist/utils/isArrowFn.js +0 -7
  240. package/dist/utils/isBoolean.d.ts +0 -7
  241. package/dist/utils/isBoolean.js +0 -15
  242. package/dist/utils/isBuffer.d.ts +0 -7
  243. package/dist/utils/isBuffer.js +0 -19
  244. package/dist/utils/isClass.d.ts +0 -1
  245. package/dist/utils/isClass.js +0 -26
  246. package/dist/utils/isCollection.d.ts +0 -6
  247. package/dist/utils/isCollection.js +0 -20
  248. package/dist/utils/isDate.d.ts +0 -6
  249. package/dist/utils/isDate.js +0 -11
  250. package/dist/utils/isEmpty.d.ts +0 -6
  251. package/dist/utils/isEmpty.js +0 -12
  252. package/dist/utils/isFunction.d.ts +0 -1
  253. package/dist/utils/isFunction.js +0 -6
  254. package/dist/utils/isInheritedFrom.d.ts +0 -1
  255. package/dist/utils/isInheritedFrom.js +0 -24
  256. package/dist/utils/isMomentObject.d.ts +0 -1
  257. package/dist/utils/isMomentObject.js +0 -6
  258. package/dist/utils/isMongooseObject.d.ts +0 -2
  259. package/dist/utils/isMongooseObject.js +0 -11
  260. package/dist/utils/isNil.d.ts +0 -1
  261. package/dist/utils/isNil.js +0 -6
  262. package/dist/utils/isNumber.d.ts +0 -7
  263. package/dist/utils/isNumber.js +0 -15
  264. package/dist/utils/isObject.d.ts +0 -1
  265. package/dist/utils/isObject.js +0 -6
  266. package/dist/utils/isObservable.d.ts +0 -1
  267. package/dist/utils/isObservable.js +0 -6
  268. package/dist/utils/isPlainObject.d.ts +0 -7
  269. package/dist/utils/isPlainObject.js +0 -16
  270. package/dist/utils/isPrimitive.d.ts +0 -14
  271. package/dist/utils/isPrimitive.js +0 -28
  272. package/dist/utils/isPrimitiveType.d.ts +0 -1
  273. package/dist/utils/isPrimitiveType.js +0 -11
  274. package/dist/utils/isPromise.d.ts +0 -7
  275. package/dist/utils/isPromise.js +0 -14
  276. package/dist/utils/isProtectedKey.d.ts +0 -5
  277. package/dist/utils/isProtectedKey.js +0 -10
  278. package/dist/utils/isRegExp.d.ts +0 -1
  279. package/dist/utils/isRegExp.js +0 -6
  280. package/dist/utils/isRequestScope.d.ts +0 -11
  281. package/dist/utils/isRequestScope.js +0 -23
  282. package/dist/utils/isSerializable.d.ts +0 -1
  283. package/dist/utils/isSerializable.js +0 -11
  284. package/dist/utils/isStream.d.ts +0 -1
  285. package/dist/utils/isStream.js +0 -6
  286. package/dist/utils/isString.d.ts +0 -6
  287. package/dist/utils/isString.js +0 -14
  288. package/dist/utils/isSymbol.d.ts +0 -6
  289. package/dist/utils/isSymbol.js +0 -14
  290. package/dist/utils/methodsOf.d.ts +0 -9
  291. package/dist/utils/methodsOf.js +0 -24
  292. package/dist/utils/nameOf.d.ts +0 -14
  293. package/dist/utils/nameOf.js +0 -31
  294. package/dist/utils/objectKeys.d.ts +0 -1
  295. package/dist/utils/objectKeys.js +0 -7
  296. package/dist/utils/primitiveOf.d.ts +0 -1
  297. package/dist/utils/primitiveOf.js +0 -18
  298. package/dist/utils/prototypeOf.d.ts +0 -6
  299. package/dist/utils/prototypeOf.js +0 -12
  300. package/dist/utils/setValue.d.ts +0 -1
  301. package/dist/utils/setValue.js +0 -32
  302. package/dist/utils/toMap.d.ts +0 -3
  303. package/dist/utils/toMap.js +0 -34
  304. package/dist/utils/toStringConstructor.d.ts +0 -1
  305. package/dist/utils/toStringConstructor.js +0 -10
  306. package/dist/validation/ValidatorAdapter.d.ts +0 -66
  307. package/dist/validation/adapters/ClassValidatorAdapter.d.ts +0 -23
  308. package/dist/validation/adapters/ClassValidatorAdapter.js +0 -47
  309. package/dist/validation/adapters/ZodAdapter.d.ts +0 -14
  310. package/dist/validation/adapters/ZodAdapter.js +0 -56
  311. package/dist/validation/adapters/index.d.ts +0 -4
  312. package/dist/validation/adapters/index.js +0 -7
  313. package/dist/validation/index.d.ts +0 -3
  314. package/dist/validation/index.js +0 -20
@@ -0,0 +1,86 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../../../node_modules/@ioredis/commands/built/index.js", "../../../../node_modules/standard-as-callback/built/utils.js", "../../../../node_modules/standard-as-callback/built/index.js", "../../../../node_modules/redis-errors/lib/old.js", "../../../../node_modules/redis-errors/lib/modern.js", "../../../../node_modules/redis-errors/index.js", "../../../../node_modules/cluster-key-slot/lib/index.js", "../../../../node_modules/lodash.defaults/index.js", "../../../../node_modules/lodash.isarguments/index.js", "../../../../node_modules/ioredis/built/utils/lodash.js", "../../../../node_modules/ms/index.js", "../../../../node_modules/debug/src/common.js", "../../../../node_modules/debug/src/browser.js", "../../../../node_modules/has-flag/index.js", "../../../../node_modules/supports-color/index.js", "../../../../node_modules/debug/src/node.js", "../../../../node_modules/debug/src/index.js", "../../../../node_modules/ioredis/built/utils/debug.js", "../../../../node_modules/ioredis/built/constants/TLSProfiles.js", "../../../../node_modules/ioredis/built/utils/index.js", "../../../../node_modules/ioredis/built/Command.js", "../../../../node_modules/ioredis/built/errors/ClusterAllFailedError.js", "../../../../node_modules/ioredis/built/ScanStream.js", "../../../../node_modules/ioredis/built/autoPipelining.js", "../../../../node_modules/ioredis/built/Script.js", "../../../../node_modules/ioredis/built/utils/Commander.js", "../../../../node_modules/ioredis/built/Pipeline.js", "../../../../node_modules/ioredis/built/transaction.js", "../../../../node_modules/ioredis/built/utils/applyMixin.js", "../../../../node_modules/ioredis/built/cluster/ClusterOptions.js", "../../../../node_modules/ioredis/built/cluster/util.js", "../../../../node_modules/ioredis/built/cluster/ClusterSubscriber.js", "../../../../node_modules/ioredis/built/cluster/ConnectionPool.js", "../../../../node_modules/denque/index.js", "../../../../node_modules/ioredis/built/cluster/DelayQueue.js", "../../../../node_modules/ioredis/built/cluster/ClusterSubscriberGroup.js", "../../../../node_modules/ioredis/built/cluster/index.js", "../../../../node_modules/ioredis/built/connectors/AbstractConnector.js", "../../../../node_modules/ioredis/built/connectors/StandaloneConnector.js", "../../../../node_modules/ioredis/built/connectors/SentinelConnector/SentinelIterator.js", "../../../../node_modules/ioredis/built/connectors/SentinelConnector/FailoverDetector.js", "../../../../node_modules/ioredis/built/connectors/SentinelConnector/index.js", "../../../../node_modules/ioredis/built/connectors/index.js", "../../../../node_modules/ioredis/built/errors/MaxRetriesPerRequestError.js", "../../../../node_modules/ioredis/built/errors/index.js", "../../../../node_modules/redis-parser/lib/parser.js", "../../../../node_modules/ioredis/built/SubscriptionSet.js", "../../../../node_modules/ioredis/built/DataHandler.js", "../../../../node_modules/ioredis/built/redis/event_handler.js", "../../../../node_modules/ioredis/built/redis/RedisOptions.js", "../../../../node_modules/ioredis/built/Redis.js", "../../../../node_modules/ioredis/built/index.js", "../../../../node_modules/reflect-metadata/Reflect.js", "../../src/metadata.ts", "../../src/compiler/JITCompiler.ts", "../../src/context/Context.ts", "../../src/container/Container.ts", "../../src/cors/CorsHandler.ts", "../../src/exceptions/HttpException.ts", "../../src/validation/ValidatorAdapter.ts", "../../src/validation/ZodAdapter.ts", "../../src/events/Lifecycle.ts", "../../src/cache/MemoryDriver.ts", "../../src/cache/CacheService.ts", "../../src/decorators/Controller.ts", "../../src/decorators/methods.ts", "../../src/DefaultRoutes.ts", "../../src/Carno.ts", "../../src/decorators/params.ts", "../../src/decorators/Middleware.ts", "../../src/decorators/Service.ts", "../../src/decorators/Inject.ts", "../../src/router/RadixRouter.ts", "../../src/validation/ValibotAdapter.ts", "../../src/cache/RedisDriver.ts", "../../src/testing/TestHarness.ts", "../../src/utils/Metadata.ts"],
4
+ "sourcesContent": [
5
+ "\"use strict\";\nvar __importDefault = (this && this.__importDefault) || function (mod) {\n return (mod && mod.__esModule) ? mod : { \"default\": mod };\n};\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getKeyIndexes = exports.hasFlag = exports.exists = exports.list = void 0;\nconst commands_json_1 = __importDefault(require(\"./commands.json\"));\n/**\n * Redis command list\n *\n * All commands are lowercased.\n */\nexports.list = Object.keys(commands_json_1.default);\nconst flags = {};\nexports.list.forEach((commandName) => {\n flags[commandName] = commands_json_1.default[commandName].flags.reduce(function (flags, flag) {\n flags[flag] = true;\n return flags;\n }, {});\n});\n/**\n * Check if the command exists\n */\nfunction exists(commandName) {\n return Boolean(commands_json_1.default[commandName]);\n}\nexports.exists = exists;\n/**\n * Check if the command has the flag\n *\n * Some of possible flags: readonly, noscript, loading\n */\nfunction hasFlag(commandName, flag) {\n if (!flags[commandName]) {\n throw new Error(\"Unknown command \" + commandName);\n }\n return Boolean(flags[commandName][flag]);\n}\nexports.hasFlag = hasFlag;\n/**\n * Get indexes of keys in the command arguments\n *\n * @example\n * ```javascript\n * getKeyIndexes('set', ['key', 'value']) // [0]\n * getKeyIndexes('mget', ['key1', 'key2']) // [0, 1]\n * ```\n */\nfunction getKeyIndexes(commandName, args, options) {\n const command = commands_json_1.default[commandName];\n if (!command) {\n throw new Error(\"Unknown command \" + commandName);\n }\n if (!Array.isArray(args)) {\n throw new Error(\"Expect args to be an array\");\n }\n const keys = [];\n const parseExternalKey = Boolean(options && options.parseExternalKey);\n const takeDynamicKeys = (args, startIndex) => {\n const keys = [];\n const keyStop = Number(args[startIndex]);\n for (let i = 0; i < keyStop; i++) {\n keys.push(i + startIndex + 1);\n }\n return keys;\n };\n const takeKeyAfterToken = (args, startIndex, token) => {\n for (let i = startIndex; i < args.length - 1; i += 1) {\n if (String(args[i]).toLowerCase() === token.toLowerCase()) {\n return i + 1;\n }\n }\n return null;\n };\n switch (commandName) {\n case \"zunionstore\":\n case \"zinterstore\":\n case \"zdiffstore\":\n keys.push(0, ...takeDynamicKeys(args, 1));\n break;\n case \"eval\":\n case \"evalsha\":\n case \"eval_ro\":\n case \"evalsha_ro\":\n case \"fcall\":\n case \"fcall_ro\":\n case \"blmpop\":\n case \"bzmpop\":\n keys.push(...takeDynamicKeys(args, 1));\n break;\n case \"sintercard\":\n case \"lmpop\":\n case \"zunion\":\n case \"zinter\":\n case \"zmpop\":\n case \"zintercard\":\n case \"zdiff\": {\n keys.push(...takeDynamicKeys(args, 0));\n break;\n }\n case \"georadius\": {\n keys.push(0);\n const storeKey = takeKeyAfterToken(args, 5, \"STORE\");\n if (storeKey)\n keys.push(storeKey);\n const distKey = takeKeyAfterToken(args, 5, \"STOREDIST\");\n if (distKey)\n keys.push(distKey);\n break;\n }\n case \"georadiusbymember\": {\n keys.push(0);\n const storeKey = takeKeyAfterToken(args, 4, \"STORE\");\n if (storeKey)\n keys.push(storeKey);\n const distKey = takeKeyAfterToken(args, 4, \"STOREDIST\");\n if (distKey)\n keys.push(distKey);\n break;\n }\n case \"sort\":\n case \"sort_ro\":\n keys.push(0);\n for (let i = 1; i < args.length - 1; i++) {\n let arg = args[i];\n if (typeof arg !== \"string\") {\n continue;\n }\n const directive = arg.toUpperCase();\n if (directive === \"GET\") {\n i += 1;\n arg = args[i];\n if (arg !== \"#\") {\n if (parseExternalKey) {\n keys.push([i, getExternalKeyNameLength(arg)]);\n }\n else {\n keys.push(i);\n }\n }\n }\n else if (directive === \"BY\") {\n i += 1;\n if (parseExternalKey) {\n keys.push([i, getExternalKeyNameLength(args[i])]);\n }\n else {\n keys.push(i);\n }\n }\n else if (directive === \"STORE\") {\n i += 1;\n keys.push(i);\n }\n }\n break;\n case \"migrate\":\n if (args[2] === \"\") {\n for (let i = 5; i < args.length - 1; i++) {\n const arg = args[i];\n if (typeof arg === \"string\" && arg.toUpperCase() === \"KEYS\") {\n for (let j = i + 1; j < args.length; j++) {\n keys.push(j);\n }\n break;\n }\n }\n }\n else {\n keys.push(2);\n }\n break;\n case \"xreadgroup\":\n case \"xread\":\n // Keys are 1st half of the args after STREAMS argument.\n for (let i = commandName === \"xread\" ? 0 : 3; i < args.length - 1; i++) {\n if (String(args[i]).toUpperCase() === \"STREAMS\") {\n for (let j = i + 1; j <= i + (args.length - 1 - i) / 2; j++) {\n keys.push(j);\n }\n break;\n }\n }\n break;\n default:\n // Step has to be at least one in this case, otherwise the command does\n // not contain a key.\n if (command.step > 0) {\n const keyStart = command.keyStart - 1;\n const keyStop = command.keyStop > 0\n ? command.keyStop\n : args.length + command.keyStop + 1;\n for (let i = keyStart; i < keyStop; i += command.step) {\n keys.push(i);\n }\n }\n break;\n }\n return keys;\n}\nexports.getKeyIndexes = getKeyIndexes;\nfunction getExternalKeyNameLength(key) {\n if (typeof key !== \"string\") {\n key = String(key);\n }\n const hashPos = key.indexOf(\"->\");\n return hashPos === -1 ? key.length : hashPos;\n}\n",
6
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.tryCatch = exports.errorObj = void 0;\n//Try catch is not supported in optimizing\n//compiler, so it is isolated\nexports.errorObj = { e: {} };\nlet tryCatchTarget;\nfunction tryCatcher(err, val) {\n try {\n const target = tryCatchTarget;\n tryCatchTarget = null;\n return target.apply(this, arguments);\n }\n catch (e) {\n exports.errorObj.e = e;\n return exports.errorObj;\n }\n}\nfunction tryCatch(fn) {\n tryCatchTarget = fn;\n return tryCatcher;\n}\nexports.tryCatch = tryCatch;\n",
7
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst utils_1 = require(\"./utils\");\nfunction throwLater(e) {\n setTimeout(function () {\n throw e;\n }, 0);\n}\nfunction asCallback(promise, nodeback, options) {\n if (typeof nodeback === \"function\") {\n promise.then((val) => {\n let ret;\n if (options !== undefined &&\n Object(options).spread &&\n Array.isArray(val)) {\n ret = utils_1.tryCatch(nodeback).apply(undefined, [null].concat(val));\n }\n else {\n ret =\n val === undefined\n ? utils_1.tryCatch(nodeback)(null)\n : utils_1.tryCatch(nodeback)(null, val);\n }\n if (ret === utils_1.errorObj) {\n throwLater(ret.e);\n }\n }, (cause) => {\n if (!cause) {\n const newReason = new Error(cause + \"\");\n Object.assign(newReason, { cause });\n cause = newReason;\n }\n const ret = utils_1.tryCatch(nodeback)(cause);\n if (ret === utils_1.errorObj) {\n throwLater(ret.e);\n }\n });\n }\n return promise;\n}\nexports.default = asCallback;\n",
8
+ "'use strict'\n\nconst assert = require('assert')\nconst util = require('util')\n\n// RedisError\n\nfunction RedisError (message) {\n Object.defineProperty(this, 'message', {\n value: message || '',\n configurable: true,\n writable: true\n })\n Error.captureStackTrace(this, this.constructor)\n}\n\nutil.inherits(RedisError, Error)\n\nObject.defineProperty(RedisError.prototype, 'name', {\n value: 'RedisError',\n configurable: true,\n writable: true\n})\n\n// ParserError\n\nfunction ParserError (message, buffer, offset) {\n assert(buffer)\n assert.strictEqual(typeof offset, 'number')\n\n Object.defineProperty(this, 'message', {\n value: message || '',\n configurable: true,\n writable: true\n })\n\n const tmp = Error.stackTraceLimit\n Error.stackTraceLimit = 2\n Error.captureStackTrace(this, this.constructor)\n Error.stackTraceLimit = tmp\n this.offset = offset\n this.buffer = buffer\n}\n\nutil.inherits(ParserError, RedisError)\n\nObject.defineProperty(ParserError.prototype, 'name', {\n value: 'ParserError',\n configurable: true,\n writable: true\n})\n\n// ReplyError\n\nfunction ReplyError (message) {\n Object.defineProperty(this, 'message', {\n value: message || '',\n configurable: true,\n writable: true\n })\n const tmp = Error.stackTraceLimit\n Error.stackTraceLimit = 2\n Error.captureStackTrace(this, this.constructor)\n Error.stackTraceLimit = tmp\n}\n\nutil.inherits(ReplyError, RedisError)\n\nObject.defineProperty(ReplyError.prototype, 'name', {\n value: 'ReplyError',\n configurable: true,\n writable: true\n})\n\n// AbortError\n\nfunction AbortError (message) {\n Object.defineProperty(this, 'message', {\n value: message || '',\n configurable: true,\n writable: true\n })\n Error.captureStackTrace(this, this.constructor)\n}\n\nutil.inherits(AbortError, RedisError)\n\nObject.defineProperty(AbortError.prototype, 'name', {\n value: 'AbortError',\n configurable: true,\n writable: true\n})\n\n// InterruptError\n\nfunction InterruptError (message) {\n Object.defineProperty(this, 'message', {\n value: message || '',\n configurable: true,\n writable: true\n })\n Error.captureStackTrace(this, this.constructor)\n}\n\nutil.inherits(InterruptError, AbortError)\n\nObject.defineProperty(InterruptError.prototype, 'name', {\n value: 'InterruptError',\n configurable: true,\n writable: true\n})\n\nmodule.exports = {\n RedisError,\n ParserError,\n ReplyError,\n AbortError,\n InterruptError\n}\n",
9
+ "'use strict'\n\nconst assert = require('assert')\n\nclass RedisError extends Error {\n get name () {\n return this.constructor.name\n }\n}\n\nclass ParserError extends RedisError {\n constructor (message, buffer, offset) {\n assert(buffer)\n assert.strictEqual(typeof offset, 'number')\n\n const tmp = Error.stackTraceLimit\n Error.stackTraceLimit = 2\n super(message)\n Error.stackTraceLimit = tmp\n this.offset = offset\n this.buffer = buffer\n }\n\n get name () {\n return this.constructor.name\n }\n}\n\nclass ReplyError extends RedisError {\n constructor (message) {\n const tmp = Error.stackTraceLimit\n Error.stackTraceLimit = 2\n super(message)\n Error.stackTraceLimit = tmp\n }\n get name () {\n return this.constructor.name\n }\n}\n\nclass AbortError extends RedisError {\n get name () {\n return this.constructor.name\n }\n}\n\nclass InterruptError extends AbortError {\n get name () {\n return this.constructor.name\n }\n}\n\nmodule.exports = {\n RedisError,\n ParserError,\n ReplyError,\n AbortError,\n InterruptError\n}\n",
10
+ "'use strict'\n\nconst Errors = process.version.charCodeAt(1) < 55 && process.version.charCodeAt(2) === 46\n ? require('./lib/old') // Node.js < 7\n : require('./lib/modern')\n\nmodule.exports = Errors\n",
11
+ "/*\n * Copyright 2001-2010 Georges Menie (www.menie.org)\n * Copyright 2010 Salvatore Sanfilippo (adapted to Redis coding style)\n * Copyright 2015 Zihua Li (http://zihua.li) (ported to JavaScript)\n * Copyright 2016 Mike Diarmid (http://github.com/salakar) (re-write for performance, ~700% perf inc)\n * All rights reserved.\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * * Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * * Neither the name of the University of California, Berkeley nor the\n * names of its contributors may be used to endorse or promote products\n * derived from this software without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND ANY\n * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED\n * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE REGENTS AND CONTRIBUTORS BE LIABLE FOR ANY\n * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES\n * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;\n * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND\n * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\n\n/* CRC16 implementation according to CCITT standards.\n *\n * Note by @antirez: this is actually the XMODEM CRC 16 algorithm, using the\n * following parameters:\n *\n * Name : \"XMODEM\", also known as \"ZMODEM\", \"CRC-16/ACORN\"\n * Width : 16 bit\n * Poly : 1021 (That is actually x^16 + x^12 + x^5 + 1)\n * Initialization : 0000\n * Reflect Input byte : False\n * Reflect Output CRC : False\n * Xor constant to output CRC : 0000\n * Output for \"123456789\" : 31C3\n */\n\nvar lookup = [\n 0x0000, 0x1021, 0x2042, 0x3063, 0x4084, 0x50a5, 0x60c6, 0x70e7,\n 0x8108, 0x9129, 0xa14a, 0xb16b, 0xc18c, 0xd1ad, 0xe1ce, 0xf1ef,\n 0x1231, 0x0210, 0x3273, 0x2252, 0x52b5, 0x4294, 0x72f7, 0x62d6,\n 0x9339, 0x8318, 0xb37b, 0xa35a, 0xd3bd, 0xc39c, 0xf3ff, 0xe3de,\n 0x2462, 0x3443, 0x0420, 0x1401, 0x64e6, 0x74c7, 0x44a4, 0x5485,\n 0xa56a, 0xb54b, 0x8528, 0x9509, 0xe5ee, 0xf5cf, 0xc5ac, 0xd58d,\n 0x3653, 0x2672, 0x1611, 0x0630, 0x76d7, 0x66f6, 0x5695, 0x46b4,\n 0xb75b, 0xa77a, 0x9719, 0x8738, 0xf7df, 0xe7fe, 0xd79d, 0xc7bc,\n 0x48c4, 0x58e5, 0x6886, 0x78a7, 0x0840, 0x1861, 0x2802, 0x3823,\n 0xc9cc, 0xd9ed, 0xe98e, 0xf9af, 0x8948, 0x9969, 0xa90a, 0xb92b,\n 0x5af5, 0x4ad4, 0x7ab7, 0x6a96, 0x1a71, 0x0a50, 0x3a33, 0x2a12,\n 0xdbfd, 0xcbdc, 0xfbbf, 0xeb9e, 0x9b79, 0x8b58, 0xbb3b, 0xab1a,\n 0x6ca6, 0x7c87, 0x4ce4, 0x5cc5, 0x2c22, 0x3c03, 0x0c60, 0x1c41,\n 0xedae, 0xfd8f, 0xcdec, 0xddcd, 0xad2a, 0xbd0b, 0x8d68, 0x9d49,\n 0x7e97, 0x6eb6, 0x5ed5, 0x4ef4, 0x3e13, 0x2e32, 0x1e51, 0x0e70,\n 0xff9f, 0xefbe, 0xdfdd, 0xcffc, 0xbf1b, 0xaf3a, 0x9f59, 0x8f78,\n 0x9188, 0x81a9, 0xb1ca, 0xa1eb, 0xd10c, 0xc12d, 0xf14e, 0xe16f,\n 0x1080, 0x00a1, 0x30c2, 0x20e3, 0x5004, 0x4025, 0x7046, 0x6067,\n 0x83b9, 0x9398, 0xa3fb, 0xb3da, 0xc33d, 0xd31c, 0xe37f, 0xf35e,\n 0x02b1, 0x1290, 0x22f3, 0x32d2, 0x4235, 0x5214, 0x6277, 0x7256,\n 0xb5ea, 0xa5cb, 0x95a8, 0x8589, 0xf56e, 0xe54f, 0xd52c, 0xc50d,\n 0x34e2, 0x24c3, 0x14a0, 0x0481, 0x7466, 0x6447, 0x5424, 0x4405,\n 0xa7db, 0xb7fa, 0x8799, 0x97b8, 0xe75f, 0xf77e, 0xc71d, 0xd73c,\n 0x26d3, 0x36f2, 0x0691, 0x16b0, 0x6657, 0x7676, 0x4615, 0x5634,\n 0xd94c, 0xc96d, 0xf90e, 0xe92f, 0x99c8, 0x89e9, 0xb98a, 0xa9ab,\n 0x5844, 0x4865, 0x7806, 0x6827, 0x18c0, 0x08e1, 0x3882, 0x28a3,\n 0xcb7d, 0xdb5c, 0xeb3f, 0xfb1e, 0x8bf9, 0x9bd8, 0xabbb, 0xbb9a,\n 0x4a75, 0x5a54, 0x6a37, 0x7a16, 0x0af1, 0x1ad0, 0x2ab3, 0x3a92,\n 0xfd2e, 0xed0f, 0xdd6c, 0xcd4d, 0xbdaa, 0xad8b, 0x9de8, 0x8dc9,\n 0x7c26, 0x6c07, 0x5c64, 0x4c45, 0x3ca2, 0x2c83, 0x1ce0, 0x0cc1,\n 0xef1f, 0xff3e, 0xcf5d, 0xdf7c, 0xaf9b, 0xbfba, 0x8fd9, 0x9ff8,\n 0x6e17, 0x7e36, 0x4e55, 0x5e74, 0x2e93, 0x3eb2, 0x0ed1, 0x1ef0\n];\n\n/**\n * Convert a string to a UTF8 array - faster than via buffer\n * @param str\n * @returns {Array}\n */\nvar toUTF8Array = function toUTF8Array(str) {\n var char;\n var i = 0;\n var p = 0;\n var utf8 = [];\n var len = str.length;\n\n for (; i < len; i++) {\n char = str.charCodeAt(i);\n if (char < 128) {\n utf8[p++] = char;\n } else if (char < 2048) {\n utf8[p++] = (char >> 6) | 192;\n utf8[p++] = (char & 63) | 128;\n } else if (\n ((char & 0xFC00) === 0xD800) && (i + 1) < str.length &&\n ((str.charCodeAt(i + 1) & 0xFC00) === 0xDC00)) {\n char = 0x10000 + ((char & 0x03FF) << 10) + (str.charCodeAt(++i) & 0x03FF);\n utf8[p++] = (char >> 18) | 240;\n utf8[p++] = ((char >> 12) & 63) | 128;\n utf8[p++] = ((char >> 6) & 63) | 128;\n utf8[p++] = (char & 63) | 128;\n } else {\n utf8[p++] = (char >> 12) | 224;\n utf8[p++] = ((char >> 6) & 63) | 128;\n utf8[p++] = (char & 63) | 128;\n }\n }\n\n return utf8;\n};\n\n/**\n * Convert a string into a redis slot hash.\n * @param str\n * @returns {number}\n */\nvar generate = module.exports = function generate(str) {\n var char;\n var i = 0;\n var start = -1;\n var result = 0;\n var resultHash = 0;\n var utf8 = typeof str === 'string' ? toUTF8Array(str) : str;\n var len = utf8.length;\n\n while (i < len) {\n char = utf8[i++];\n if (start === -1) {\n if (char === 0x7B) {\n start = i;\n }\n } else if (char !== 0x7D) {\n resultHash = lookup[(char ^ (resultHash >> 8)) & 0xFF] ^ (resultHash << 8);\n } else if (i - 1 !== start) {\n return resultHash & 0x3FFF;\n }\n\n result = lookup[(char ^ (result >> 8)) & 0xFF] ^ (result << 8);\n }\n\n return result & 0x3FFF;\n};\n\n/**\n * Convert an array of multiple strings into a redis slot hash.\n * Returns -1 if one of the keys is not for the same slot as the others\n * @param keys\n * @returns {number}\n */\nmodule.exports.generateMulti = function generateMulti(keys) {\n var i = 1;\n var len = keys.length;\n var base = generate(keys[0]);\n\n while (i < len) {\n if (generate(keys[i++]) !== base) return -1;\n }\n\n return base;\n};\n",
12
+ "/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used to detect unsigned integer values. */\nvar reIsUint = /^(?:0|[1-9]\\d*)$/;\n\n/**\n * A faster alternative to `Function#apply`, this function invokes `func`\n * with the `this` binding of `thisArg` and the arguments of `args`.\n *\n * @private\n * @param {Function} func The function to invoke.\n * @param {*} thisArg The `this` binding of `func`.\n * @param {Array} args The arguments to invoke `func` with.\n * @returns {*} Returns the result of `func`.\n */\nfunction apply(func, thisArg, args) {\n switch (args.length) {\n case 0: return func.call(thisArg);\n case 1: return func.call(thisArg, args[0]);\n case 2: return func.call(thisArg, args[0], args[1]);\n case 3: return func.call(thisArg, args[0], args[1], args[2]);\n }\n return func.apply(thisArg, args);\n}\n\n/**\n * The base implementation of `_.times` without support for iteratee shorthands\n * or max array length checks.\n *\n * @private\n * @param {number} n The number of times to invoke `iteratee`.\n * @param {Function} iteratee The function invoked per iteration.\n * @returns {Array} Returns the array of results.\n */\nfunction baseTimes(n, iteratee) {\n var index = -1,\n result = Array(n);\n\n while (++index < n) {\n result[index] = iteratee(index);\n }\n return result;\n}\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max;\n\n/**\n * Creates an array of the enumerable property names of the array-like `value`.\n *\n * @private\n * @param {*} value The value to query.\n * @param {boolean} inherited Specify returning inherited property names.\n * @returns {Array} Returns the array of property names.\n */\nfunction arrayLikeKeys(value, inherited) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n // Safari 9 makes `arguments.length` enumerable in strict mode.\n var result = (isArray(value) || isArguments(value))\n ? baseTimes(value.length, String)\n : [];\n\n var length = result.length,\n skipIndexes = !!length;\n\n for (var key in value) {\n if ((inherited || hasOwnProperty.call(value, key)) &&\n !(skipIndexes && (key == 'length' || isIndex(key, length)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Used by `_.defaults` to customize its `_.assignIn` use.\n *\n * @private\n * @param {*} objValue The destination value.\n * @param {*} srcValue The source value.\n * @param {string} key The key of the property to assign.\n * @param {Object} object The parent object of `objValue`.\n * @returns {*} Returns the value to assign.\n */\nfunction assignInDefaults(objValue, srcValue, key, object) {\n if (objValue === undefined ||\n (eq(objValue, objectProto[key]) && !hasOwnProperty.call(object, key))) {\n return srcValue;\n }\n return objValue;\n}\n\n/**\n * Assigns `value` to `key` of `object` if the existing value is not equivalent\n * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * for equality comparisons.\n *\n * @private\n * @param {Object} object The object to modify.\n * @param {string} key The key of the property to assign.\n * @param {*} value The value to assign.\n */\nfunction assignValue(object, key, value) {\n var objValue = object[key];\n if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) ||\n (value === undefined && !(key in object))) {\n object[key] = value;\n }\n}\n\n/**\n * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction baseKeysIn(object) {\n if (!isObject(object)) {\n return nativeKeysIn(object);\n }\n var isProto = isPrototype(object),\n result = [];\n\n for (var key in object) {\n if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * The base implementation of `_.rest` which doesn't validate or coerce arguments.\n *\n * @private\n * @param {Function} func The function to apply a rest parameter to.\n * @param {number} [start=func.length-1] The start position of the rest parameter.\n * @returns {Function} Returns the new function.\n */\nfunction baseRest(func, start) {\n start = nativeMax(start === undefined ? (func.length - 1) : start, 0);\n return function() {\n var args = arguments,\n index = -1,\n length = nativeMax(args.length - start, 0),\n array = Array(length);\n\n while (++index < length) {\n array[index] = args[start + index];\n }\n index = -1;\n var otherArgs = Array(start + 1);\n while (++index < start) {\n otherArgs[index] = args[index];\n }\n otherArgs[start] = array;\n return apply(func, this, otherArgs);\n };\n}\n\n/**\n * Copies properties of `source` to `object`.\n *\n * @private\n * @param {Object} source The object to copy properties from.\n * @param {Array} props The property identifiers to copy.\n * @param {Object} [object={}] The object to copy properties to.\n * @param {Function} [customizer] The function to customize copied values.\n * @returns {Object} Returns `object`.\n */\nfunction copyObject(source, props, object, customizer) {\n object || (object = {});\n\n var index = -1,\n length = props.length;\n\n while (++index < length) {\n var key = props[index];\n\n var newValue = customizer\n ? customizer(object[key], source[key], key, object, source)\n : undefined;\n\n assignValue(object, key, newValue === undefined ? source[key] : newValue);\n }\n return object;\n}\n\n/**\n * Creates a function like `_.assign`.\n *\n * @private\n * @param {Function} assigner The function to assign values.\n * @returns {Function} Returns the new assigner function.\n */\nfunction createAssigner(assigner) {\n return baseRest(function(object, sources) {\n var index = -1,\n length = sources.length,\n customizer = length > 1 ? sources[length - 1] : undefined,\n guard = length > 2 ? sources[2] : undefined;\n\n customizer = (assigner.length > 3 && typeof customizer == 'function')\n ? (length--, customizer)\n : undefined;\n\n if (guard && isIterateeCall(sources[0], sources[1], guard)) {\n customizer = length < 3 ? undefined : customizer;\n length = 1;\n }\n object = Object(object);\n while (++index < length) {\n var source = sources[index];\n if (source) {\n assigner(object, source, index, customizer);\n }\n }\n return object;\n });\n}\n\n/**\n * Checks if `value` is a valid array-like index.\n *\n * @private\n * @param {*} value The value to check.\n * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.\n * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.\n */\nfunction isIndex(value, length) {\n length = length == null ? MAX_SAFE_INTEGER : length;\n return !!length &&\n (typeof value == 'number' || reIsUint.test(value)) &&\n (value > -1 && value % 1 == 0 && value < length);\n}\n\n/**\n * Checks if the given arguments are from an iteratee call.\n *\n * @private\n * @param {*} value The potential iteratee value argument.\n * @param {*} index The potential iteratee index or key argument.\n * @param {*} object The potential iteratee object argument.\n * @returns {boolean} Returns `true` if the arguments are from an iteratee call,\n * else `false`.\n */\nfunction isIterateeCall(value, index, object) {\n if (!isObject(object)) {\n return false;\n }\n var type = typeof index;\n if (type == 'number'\n ? (isArrayLike(object) && isIndex(index, object.length))\n : (type == 'string' && index in object)\n ) {\n return eq(object[index], value);\n }\n return false;\n}\n\n/**\n * Checks if `value` is likely a prototype object.\n *\n * @private\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a prototype, else `false`.\n */\nfunction isPrototype(value) {\n var Ctor = value && value.constructor,\n proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto;\n\n return value === proto;\n}\n\n/**\n * This function is like\n * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys)\n * except that it includes inherited enumerable properties.\n *\n * @private\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n */\nfunction nativeKeysIn(object) {\n var result = [];\n if (object != null) {\n for (var key in Object(object)) {\n result.push(key);\n }\n }\n return result;\n}\n\n/**\n * Performs a\n * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)\n * comparison between two values to determine if they are equivalent.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to compare.\n * @param {*} other The other value to compare.\n * @returns {boolean} Returns `true` if the values are equivalent, else `false`.\n * @example\n *\n * var object = { 'a': 1 };\n * var other = { 'a': 1 };\n *\n * _.eq(object, object);\n * // => true\n *\n * _.eq(object, other);\n * // => false\n *\n * _.eq('a', 'a');\n * // => true\n *\n * _.eq('a', Object('a'));\n * // => false\n *\n * _.eq(NaN, NaN);\n * // => true\n */\nfunction eq(value, other) {\n return value === other || (value !== value && other !== other);\n}\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is classified as an `Array` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array, else `false`.\n * @example\n *\n * _.isArray([1, 2, 3]);\n * // => true\n *\n * _.isArray(document.body.children);\n * // => false\n *\n * _.isArray('abc');\n * // => false\n *\n * _.isArray(_.noop);\n * // => false\n */\nvar isArray = Array.isArray;\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * This method is like `_.assignIn` except that it accepts `customizer`\n * which is invoked to produce the assigned values. If `customizer` returns\n * `undefined`, assignment is handled by the method instead. The `customizer`\n * is invoked with five arguments: (objValue, srcValue, key, object, source).\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @alias extendWith\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} sources The source objects.\n * @param {Function} [customizer] The function to customize assigned values.\n * @returns {Object} Returns `object`.\n * @see _.assignWith\n * @example\n *\n * function customizer(objValue, srcValue) {\n * return _.isUndefined(objValue) ? srcValue : objValue;\n * }\n *\n * var defaults = _.partialRight(_.assignInWith, customizer);\n *\n * defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar assignInWith = createAssigner(function(object, source, srcIndex, customizer) {\n copyObject(source, keysIn(source), object, customizer);\n});\n\n/**\n * Assigns own and inherited enumerable string keyed properties of source\n * objects to the destination object for all destination properties that\n * resolve to `undefined`. Source objects are applied from left to right.\n * Once a property is set, additional values of the same property are ignored.\n *\n * **Note:** This method mutates `object`.\n *\n * @static\n * @since 0.1.0\n * @memberOf _\n * @category Object\n * @param {Object} object The destination object.\n * @param {...Object} [sources] The source objects.\n * @returns {Object} Returns `object`.\n * @see _.defaultsDeep\n * @example\n *\n * _.defaults({ 'a': 1 }, { 'b': 2 }, { 'a': 3 });\n * // => { 'a': 1, 'b': 2 }\n */\nvar defaults = baseRest(function(args) {\n args.push(undefined, assignInDefaults);\n return apply(assignInWith, undefined, args);\n});\n\n/**\n * Creates an array of the own and inherited enumerable property names of `object`.\n *\n * **Note:** Non-object values are coerced to objects.\n *\n * @static\n * @memberOf _\n * @since 3.0.0\n * @category Object\n * @param {Object} object The object to query.\n * @returns {Array} Returns the array of property names.\n * @example\n *\n * function Foo() {\n * this.a = 1;\n * this.b = 2;\n * }\n *\n * Foo.prototype.c = 3;\n *\n * _.keysIn(new Foo);\n * // => ['a', 'b', 'c'] (iteration order is not guaranteed)\n */\nfunction keysIn(object) {\n return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object);\n}\n\nmodule.exports = defaults;\n",
13
+ "/**\n * lodash (Custom Build) <https://lodash.com/>\n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors <https://jquery.org/>\n * Released under MIT license <https://lodash.com/license>\n * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>\n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as references for various `Number` constants. */\nvar MAX_SAFE_INTEGER = 9007199254740991;\n\n/** `Object#toString` result references. */\nvar argsTag = '[object Arguments]',\n funcTag = '[object Function]',\n genTag = '[object GeneratorFunction]';\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/** Used to check objects for own properties. */\nvar hasOwnProperty = objectProto.hasOwnProperty;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/** Built-in value references. */\nvar propertyIsEnumerable = objectProto.propertyIsEnumerable;\n\n/**\n * Checks if `value` is likely an `arguments` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an `arguments` object,\n * else `false`.\n * @example\n *\n * _.isArguments(function() { return arguments; }());\n * // => true\n *\n * _.isArguments([1, 2, 3]);\n * // => false\n */\nfunction isArguments(value) {\n // Safari 8.1 makes `arguments.callee` enumerable in strict mode.\n return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&\n (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);\n}\n\n/**\n * Checks if `value` is array-like. A value is considered array-like if it's\n * not a function and has a `value.length` that's an integer greater than or\n * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is array-like, else `false`.\n * @example\n *\n * _.isArrayLike([1, 2, 3]);\n * // => true\n *\n * _.isArrayLike(document.body.children);\n * // => true\n *\n * _.isArrayLike('abc');\n * // => true\n *\n * _.isArrayLike(_.noop);\n * // => false\n */\nfunction isArrayLike(value) {\n return value != null && isLength(value.length) && !isFunction(value);\n}\n\n/**\n * This method is like `_.isArrayLike` except that it also checks if `value`\n * is an object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an array-like object,\n * else `false`.\n * @example\n *\n * _.isArrayLikeObject([1, 2, 3]);\n * // => true\n *\n * _.isArrayLikeObject(document.body.children);\n * // => true\n *\n * _.isArrayLikeObject('abc');\n * // => false\n *\n * _.isArrayLikeObject(_.noop);\n * // => false\n */\nfunction isArrayLikeObject(value) {\n return isObjectLike(value) && isArrayLike(value);\n}\n\n/**\n * Checks if `value` is classified as a `Function` object.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a function, else `false`.\n * @example\n *\n * _.isFunction(_);\n * // => true\n *\n * _.isFunction(/abc/);\n * // => false\n */\nfunction isFunction(value) {\n // The use of `Object#toString` avoids issues with the `typeof` operator\n // in Safari 8-9 which returns 'object' for typed array and other constructors.\n var tag = isObject(value) ? objectToString.call(value) : '';\n return tag == funcTag || tag == genTag;\n}\n\n/**\n * Checks if `value` is a valid array-like length.\n *\n * **Note:** This method is loosely based on\n * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.\n * @example\n *\n * _.isLength(3);\n * // => true\n *\n * _.isLength(Number.MIN_VALUE);\n * // => false\n *\n * _.isLength(Infinity);\n * // => false\n *\n * _.isLength('3');\n * // => false\n */\nfunction isLength(value) {\n return typeof value == 'number' &&\n value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\nmodule.exports = isArguments;\n",
14
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.isArguments = exports.defaults = exports.noop = void 0;\nconst defaults = require(\"lodash.defaults\");\nexports.defaults = defaults;\nconst isArguments = require(\"lodash.isarguments\");\nexports.isArguments = isArguments;\nfunction noop() { }\nexports.noop = noop;\n",
15
+ "/**\n * Helpers.\n */\n\nvar s = 1000;\nvar m = s * 60;\nvar h = m * 60;\nvar d = h * 24;\nvar w = d * 7;\nvar y = d * 365.25;\n\n/**\n * Parse or format the given `val`.\n *\n * Options:\n *\n * - `long` verbose formatting [false]\n *\n * @param {String|Number} val\n * @param {Object} [options]\n * @throws {Error} throw an error if val is not a non-empty string or a number\n * @return {String|Number}\n * @api public\n */\n\nmodule.exports = function (val, options) {\n options = options || {};\n var type = typeof val;\n if (type === 'string' && val.length > 0) {\n return parse(val);\n } else if (type === 'number' && isFinite(val)) {\n return options.long ? fmtLong(val) : fmtShort(val);\n }\n throw new Error(\n 'val is not a non-empty string or a valid number. val=' +\n JSON.stringify(val)\n );\n};\n\n/**\n * Parse the given `str` and return milliseconds.\n *\n * @param {String} str\n * @return {Number}\n * @api private\n */\n\nfunction parse(str) {\n str = String(str);\n if (str.length > 100) {\n return;\n }\n var match = /^(-?(?:\\d+)?\\.?\\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(\n str\n );\n if (!match) {\n return;\n }\n var n = parseFloat(match[1]);\n var type = (match[2] || 'ms').toLowerCase();\n switch (type) {\n case 'years':\n case 'year':\n case 'yrs':\n case 'yr':\n case 'y':\n return n * y;\n case 'weeks':\n case 'week':\n case 'w':\n return n * w;\n case 'days':\n case 'day':\n case 'd':\n return n * d;\n case 'hours':\n case 'hour':\n case 'hrs':\n case 'hr':\n case 'h':\n return n * h;\n case 'minutes':\n case 'minute':\n case 'mins':\n case 'min':\n case 'm':\n return n * m;\n case 'seconds':\n case 'second':\n case 'secs':\n case 'sec':\n case 's':\n return n * s;\n case 'milliseconds':\n case 'millisecond':\n case 'msecs':\n case 'msec':\n case 'ms':\n return n;\n default:\n return undefined;\n }\n}\n\n/**\n * Short format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtShort(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return Math.round(ms / d) + 'd';\n }\n if (msAbs >= h) {\n return Math.round(ms / h) + 'h';\n }\n if (msAbs >= m) {\n return Math.round(ms / m) + 'm';\n }\n if (msAbs >= s) {\n return Math.round(ms / s) + 's';\n }\n return ms + 'ms';\n}\n\n/**\n * Long format for `ms`.\n *\n * @param {Number} ms\n * @return {String}\n * @api private\n */\n\nfunction fmtLong(ms) {\n var msAbs = Math.abs(ms);\n if (msAbs >= d) {\n return plural(ms, msAbs, d, 'day');\n }\n if (msAbs >= h) {\n return plural(ms, msAbs, h, 'hour');\n }\n if (msAbs >= m) {\n return plural(ms, msAbs, m, 'minute');\n }\n if (msAbs >= s) {\n return plural(ms, msAbs, s, 'second');\n }\n return ms + ' ms';\n}\n\n/**\n * Pluralization helper.\n */\n\nfunction plural(ms, msAbs, n, name) {\n var isPlural = msAbs >= n * 1.5;\n return Math.round(ms / n) + ' ' + name + (isPlural ? 's' : '');\n}\n",
16
+ "\n/**\n * This is the common logic for both the Node.js and web browser\n * implementations of `debug()`.\n */\n\nfunction setup(env) {\n\tcreateDebug.debug = createDebug;\n\tcreateDebug.default = createDebug;\n\tcreateDebug.coerce = coerce;\n\tcreateDebug.disable = disable;\n\tcreateDebug.enable = enable;\n\tcreateDebug.enabled = enabled;\n\tcreateDebug.humanize = require('ms');\n\tcreateDebug.destroy = destroy;\n\n\tObject.keys(env).forEach(key => {\n\t\tcreateDebug[key] = env[key];\n\t});\n\n\t/**\n\t* The currently active debug mode names, and names to skip.\n\t*/\n\n\tcreateDebug.names = [];\n\tcreateDebug.skips = [];\n\n\t/**\n\t* Map of special \"%n\" handling functions, for the debug \"format\" argument.\n\t*\n\t* Valid key names are a single, lower or upper-case letter, i.e. \"n\" and \"N\".\n\t*/\n\tcreateDebug.formatters = {};\n\n\t/**\n\t* Selects a color for a debug namespace\n\t* @param {String} namespace The namespace string for the debug instance to be colored\n\t* @return {Number|String} An ANSI color code for the given namespace\n\t* @api private\n\t*/\n\tfunction selectColor(namespace) {\n\t\tlet hash = 0;\n\n\t\tfor (let i = 0; i < namespace.length; i++) {\n\t\t\thash = ((hash << 5) - hash) + namespace.charCodeAt(i);\n\t\t\thash |= 0; // Convert to 32bit integer\n\t\t}\n\n\t\treturn createDebug.colors[Math.abs(hash) % createDebug.colors.length];\n\t}\n\tcreateDebug.selectColor = selectColor;\n\n\t/**\n\t* Create a debugger with the given `namespace`.\n\t*\n\t* @param {String} namespace\n\t* @return {Function}\n\t* @api public\n\t*/\n\tfunction createDebug(namespace) {\n\t\tlet prevTime;\n\t\tlet enableOverride = null;\n\t\tlet namespacesCache;\n\t\tlet enabledCache;\n\n\t\tfunction debug(...args) {\n\t\t\t// Disabled?\n\t\t\tif (!debug.enabled) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tconst self = debug;\n\n\t\t\t// Set `diff` timestamp\n\t\t\tconst curr = Number(new Date());\n\t\t\tconst ms = curr - (prevTime || curr);\n\t\t\tself.diff = ms;\n\t\t\tself.prev = prevTime;\n\t\t\tself.curr = curr;\n\t\t\tprevTime = curr;\n\n\t\t\targs[0] = createDebug.coerce(args[0]);\n\n\t\t\tif (typeof args[0] !== 'string') {\n\t\t\t\t// Anything else let's inspect with %O\n\t\t\t\targs.unshift('%O');\n\t\t\t}\n\n\t\t\t// Apply any `formatters` transformations\n\t\t\tlet index = 0;\n\t\t\targs[0] = args[0].replace(/%([a-zA-Z%])/g, (match, format) => {\n\t\t\t\t// If we encounter an escaped % then don't increase the array index\n\t\t\t\tif (match === '%%') {\n\t\t\t\t\treturn '%';\n\t\t\t\t}\n\t\t\t\tindex++;\n\t\t\t\tconst formatter = createDebug.formatters[format];\n\t\t\t\tif (typeof formatter === 'function') {\n\t\t\t\t\tconst val = args[index];\n\t\t\t\t\tmatch = formatter.call(self, val);\n\n\t\t\t\t\t// Now we need to remove `args[index]` since it's inlined in the `format`\n\t\t\t\t\targs.splice(index, 1);\n\t\t\t\t\tindex--;\n\t\t\t\t}\n\t\t\t\treturn match;\n\t\t\t});\n\n\t\t\t// Apply env-specific formatting (colors, etc.)\n\t\t\tcreateDebug.formatArgs.call(self, args);\n\n\t\t\tconst logFn = self.log || createDebug.log;\n\t\t\tlogFn.apply(self, args);\n\t\t}\n\n\t\tdebug.namespace = namespace;\n\t\tdebug.useColors = createDebug.useColors();\n\t\tdebug.color = createDebug.selectColor(namespace);\n\t\tdebug.extend = extend;\n\t\tdebug.destroy = createDebug.destroy; // XXX Temporary. Will be removed in the next major release.\n\n\t\tObject.defineProperty(debug, 'enabled', {\n\t\t\tenumerable: true,\n\t\t\tconfigurable: false,\n\t\t\tget: () => {\n\t\t\t\tif (enableOverride !== null) {\n\t\t\t\t\treturn enableOverride;\n\t\t\t\t}\n\t\t\t\tif (namespacesCache !== createDebug.namespaces) {\n\t\t\t\t\tnamespacesCache = createDebug.namespaces;\n\t\t\t\t\tenabledCache = createDebug.enabled(namespace);\n\t\t\t\t}\n\n\t\t\t\treturn enabledCache;\n\t\t\t},\n\t\t\tset: v => {\n\t\t\t\tenableOverride = v;\n\t\t\t}\n\t\t});\n\n\t\t// Env-specific initialization logic for debug instances\n\t\tif (typeof createDebug.init === 'function') {\n\t\t\tcreateDebug.init(debug);\n\t\t}\n\n\t\treturn debug;\n\t}\n\n\tfunction extend(namespace, delimiter) {\n\t\tconst newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);\n\t\tnewDebug.log = this.log;\n\t\treturn newDebug;\n\t}\n\n\t/**\n\t* Enables a debug mode by namespaces. This can include modes\n\t* separated by a colon and wildcards.\n\t*\n\t* @param {String} namespaces\n\t* @api public\n\t*/\n\tfunction enable(namespaces) {\n\t\tcreateDebug.save(namespaces);\n\t\tcreateDebug.namespaces = namespaces;\n\n\t\tcreateDebug.names = [];\n\t\tcreateDebug.skips = [];\n\n\t\tconst split = (typeof namespaces === 'string' ? namespaces : '')\n\t\t\t.trim()\n\t\t\t.replace(/\\s+/g, ',')\n\t\t\t.split(',')\n\t\t\t.filter(Boolean);\n\n\t\tfor (const ns of split) {\n\t\t\tif (ns[0] === '-') {\n\t\t\t\tcreateDebug.skips.push(ns.slice(1));\n\t\t\t} else {\n\t\t\t\tcreateDebug.names.push(ns);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if the given string matches a namespace template, honoring\n\t * asterisks as wildcards.\n\t *\n\t * @param {String} search\n\t * @param {String} template\n\t * @return {Boolean}\n\t */\n\tfunction matchesTemplate(search, template) {\n\t\tlet searchIndex = 0;\n\t\tlet templateIndex = 0;\n\t\tlet starIndex = -1;\n\t\tlet matchIndex = 0;\n\n\t\twhile (searchIndex < search.length) {\n\t\t\tif (templateIndex < template.length && (template[templateIndex] === search[searchIndex] || template[templateIndex] === '*')) {\n\t\t\t\t// Match character or proceed with wildcard\n\t\t\t\tif (template[templateIndex] === '*') {\n\t\t\t\t\tstarIndex = templateIndex;\n\t\t\t\t\tmatchIndex = searchIndex;\n\t\t\t\t\ttemplateIndex++; // Skip the '*'\n\t\t\t\t} else {\n\t\t\t\t\tsearchIndex++;\n\t\t\t\t\ttemplateIndex++;\n\t\t\t\t}\n\t\t\t} else if (starIndex !== -1) { // eslint-disable-line no-negated-condition\n\t\t\t\t// Backtrack to the last '*' and try to match more characters\n\t\t\t\ttemplateIndex = starIndex + 1;\n\t\t\t\tmatchIndex++;\n\t\t\t\tsearchIndex = matchIndex;\n\t\t\t} else {\n\t\t\t\treturn false; // No match\n\t\t\t}\n\t\t}\n\n\t\t// Handle trailing '*' in template\n\t\twhile (templateIndex < template.length && template[templateIndex] === '*') {\n\t\t\ttemplateIndex++;\n\t\t}\n\n\t\treturn templateIndex === template.length;\n\t}\n\n\t/**\n\t* Disable debug output.\n\t*\n\t* @return {String} namespaces\n\t* @api public\n\t*/\n\tfunction disable() {\n\t\tconst namespaces = [\n\t\t\t...createDebug.names,\n\t\t\t...createDebug.skips.map(namespace => '-' + namespace)\n\t\t].join(',');\n\t\tcreateDebug.enable('');\n\t\treturn namespaces;\n\t}\n\n\t/**\n\t* Returns true if the given mode name is enabled, false otherwise.\n\t*\n\t* @param {String} name\n\t* @return {Boolean}\n\t* @api public\n\t*/\n\tfunction enabled(name) {\n\t\tfor (const skip of createDebug.skips) {\n\t\t\tif (matchesTemplate(name, skip)) {\n\t\t\t\treturn false;\n\t\t\t}\n\t\t}\n\n\t\tfor (const ns of createDebug.names) {\n\t\t\tif (matchesTemplate(name, ns)) {\n\t\t\t\treturn true;\n\t\t\t}\n\t\t}\n\n\t\treturn false;\n\t}\n\n\t/**\n\t* Coerce `val`.\n\t*\n\t* @param {Mixed} val\n\t* @return {Mixed}\n\t* @api private\n\t*/\n\tfunction coerce(val) {\n\t\tif (val instanceof Error) {\n\t\t\treturn val.stack || val.message;\n\t\t}\n\t\treturn val;\n\t}\n\n\t/**\n\t* XXX DO NOT USE. This is a temporary stub function.\n\t* XXX It WILL be removed in the next major release.\n\t*/\n\tfunction destroy() {\n\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t}\n\n\tcreateDebug.enable(createDebug.load());\n\n\treturn createDebug;\n}\n\nmodule.exports = setup;\n",
17
+ "/* eslint-env browser */\n\n/**\n * This is the web browser implementation of `debug()`.\n */\n\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.storage = localstorage();\nexports.destroy = (() => {\n\tlet warned = false;\n\n\treturn () => {\n\t\tif (!warned) {\n\t\t\twarned = true;\n\t\t\tconsole.warn('Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.');\n\t\t}\n\t};\n})();\n\n/**\n * Colors.\n */\n\nexports.colors = [\n\t'#0000CC',\n\t'#0000FF',\n\t'#0033CC',\n\t'#0033FF',\n\t'#0066CC',\n\t'#0066FF',\n\t'#0099CC',\n\t'#0099FF',\n\t'#00CC00',\n\t'#00CC33',\n\t'#00CC66',\n\t'#00CC99',\n\t'#00CCCC',\n\t'#00CCFF',\n\t'#3300CC',\n\t'#3300FF',\n\t'#3333CC',\n\t'#3333FF',\n\t'#3366CC',\n\t'#3366FF',\n\t'#3399CC',\n\t'#3399FF',\n\t'#33CC00',\n\t'#33CC33',\n\t'#33CC66',\n\t'#33CC99',\n\t'#33CCCC',\n\t'#33CCFF',\n\t'#6600CC',\n\t'#6600FF',\n\t'#6633CC',\n\t'#6633FF',\n\t'#66CC00',\n\t'#66CC33',\n\t'#9900CC',\n\t'#9900FF',\n\t'#9933CC',\n\t'#9933FF',\n\t'#99CC00',\n\t'#99CC33',\n\t'#CC0000',\n\t'#CC0033',\n\t'#CC0066',\n\t'#CC0099',\n\t'#CC00CC',\n\t'#CC00FF',\n\t'#CC3300',\n\t'#CC3333',\n\t'#CC3366',\n\t'#CC3399',\n\t'#CC33CC',\n\t'#CC33FF',\n\t'#CC6600',\n\t'#CC6633',\n\t'#CC9900',\n\t'#CC9933',\n\t'#CCCC00',\n\t'#CCCC33',\n\t'#FF0000',\n\t'#FF0033',\n\t'#FF0066',\n\t'#FF0099',\n\t'#FF00CC',\n\t'#FF00FF',\n\t'#FF3300',\n\t'#FF3333',\n\t'#FF3366',\n\t'#FF3399',\n\t'#FF33CC',\n\t'#FF33FF',\n\t'#FF6600',\n\t'#FF6633',\n\t'#FF9900',\n\t'#FF9933',\n\t'#FFCC00',\n\t'#FFCC33'\n];\n\n/**\n * Currently only WebKit-based Web Inspectors, Firefox >= v31,\n * and the Firebug extension (any Firefox version) are known\n * to support \"%c\" CSS customizations.\n *\n * TODO: add a `localStorage` variable to explicitly enable/disable colors\n */\n\n// eslint-disable-next-line complexity\nfunction useColors() {\n\t// NB: In an Electron preload script, document will be defined but not fully\n\t// initialized. Since we know we're in Chrome, we'll just detect this case\n\t// explicitly\n\tif (typeof window !== 'undefined' && window.process && (window.process.type === 'renderer' || window.process.__nwjs)) {\n\t\treturn true;\n\t}\n\n\t// Internet Explorer and Edge do not support colors.\n\tif (typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/(edge|trident)\\/(\\d+)/)) {\n\t\treturn false;\n\t}\n\n\tlet m;\n\n\t// Is webkit? http://stackoverflow.com/a/16459606/376773\n\t// document is undefined in react-native: https://github.com/facebook/react-native/pull/1632\n\t// eslint-disable-next-line no-return-assign\n\treturn (typeof document !== 'undefined' && document.documentElement && document.documentElement.style && document.documentElement.style.WebkitAppearance) ||\n\t\t// Is firebug? http://stackoverflow.com/a/398120/376773\n\t\t(typeof window !== 'undefined' && window.console && (window.console.firebug || (window.console.exception && window.console.table))) ||\n\t\t// Is firefox >= v31?\n\t\t// https://developer.mozilla.org/en-US/docs/Tools/Web_Console#Styling_messages\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && (m = navigator.userAgent.toLowerCase().match(/firefox\\/(\\d+)/)) && parseInt(m[1], 10) >= 31) ||\n\t\t// Double check webkit in userAgent just in case we are in a worker\n\t\t(typeof navigator !== 'undefined' && navigator.userAgent && navigator.userAgent.toLowerCase().match(/applewebkit\\/(\\d+)/));\n}\n\n/**\n * Colorize log arguments if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\targs[0] = (this.useColors ? '%c' : '') +\n\t\tthis.namespace +\n\t\t(this.useColors ? ' %c' : ' ') +\n\t\targs[0] +\n\t\t(this.useColors ? '%c ' : ' ') +\n\t\t'+' + module.exports.humanize(this.diff);\n\n\tif (!this.useColors) {\n\t\treturn;\n\t}\n\n\tconst c = 'color: ' + this.color;\n\targs.splice(1, 0, c, 'color: inherit');\n\n\t// The final \"%c\" is somewhat tricky, because there could be other\n\t// arguments passed either before or after the %c, so we need to\n\t// figure out the correct index to insert the CSS into\n\tlet index = 0;\n\tlet lastC = 0;\n\targs[0].replace(/%[a-zA-Z%]/g, match => {\n\t\tif (match === '%%') {\n\t\t\treturn;\n\t\t}\n\t\tindex++;\n\t\tif (match === '%c') {\n\t\t\t// We only are interested in the *last* %c\n\t\t\t// (the user may have provided their own)\n\t\t\tlastC = index;\n\t\t}\n\t});\n\n\targs.splice(lastC, 0, c);\n}\n\n/**\n * Invokes `console.debug()` when available.\n * No-op when `console.debug` is not a \"function\".\n * If `console.debug` is not available, falls back\n * to `console.log`.\n *\n * @api public\n */\nexports.log = console.debug || console.log || (() => {});\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\ttry {\n\t\tif (namespaces) {\n\t\t\texports.storage.setItem('debug', namespaces);\n\t\t} else {\n\t\t\texports.storage.removeItem('debug');\n\t\t}\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\nfunction load() {\n\tlet r;\n\ttry {\n\t\tr = exports.storage.getItem('debug') || exports.storage.getItem('DEBUG') ;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n\n\t// If debug isn't set in LS, and we're in Electron, try to load $DEBUG\n\tif (!r && typeof process !== 'undefined' && 'env' in process) {\n\t\tr = process.env.DEBUG;\n\t}\n\n\treturn r;\n}\n\n/**\n * Localstorage attempts to return the localstorage.\n *\n * This is necessary because safari throws\n * when a user disables cookies/localstorage\n * and you attempt to access it.\n *\n * @return {LocalStorage}\n * @api private\n */\n\nfunction localstorage() {\n\ttry {\n\t\t// TVMLKit (Apple TV JS Runtime) does not have a window object, just localStorage in the global context\n\t\t// The Browser also has localStorage in the global context.\n\t\treturn localStorage;\n\t} catch (error) {\n\t\t// Swallow\n\t\t// XXX (@Qix-) should we be logging these?\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.\n */\n\nformatters.j = function (v) {\n\ttry {\n\t\treturn JSON.stringify(v);\n\t} catch (error) {\n\t\treturn '[UnexpectedJSONParseError]: ' + error.message;\n\t}\n};\n",
18
+ "'use strict';\n\nmodule.exports = (flag, argv = process.argv) => {\n\tconst prefix = flag.startsWith('-') ? '' : (flag.length === 1 ? '-' : '--');\n\tconst position = argv.indexOf(prefix + flag);\n\tconst terminatorPosition = argv.indexOf('--');\n\treturn position !== -1 && (terminatorPosition === -1 || position < terminatorPosition);\n};\n",
19
+ "'use strict';\nconst os = require('os');\nconst tty = require('tty');\nconst hasFlag = require('has-flag');\n\nconst {env} = process;\n\nlet forceColor;\nif (hasFlag('no-color') ||\n\thasFlag('no-colors') ||\n\thasFlag('color=false') ||\n\thasFlag('color=never')) {\n\tforceColor = 0;\n} else if (hasFlag('color') ||\n\thasFlag('colors') ||\n\thasFlag('color=true') ||\n\thasFlag('color=always')) {\n\tforceColor = 1;\n}\n\nif ('FORCE_COLOR' in env) {\n\tif (env.FORCE_COLOR === 'true') {\n\t\tforceColor = 1;\n\t} else if (env.FORCE_COLOR === 'false') {\n\t\tforceColor = 0;\n\t} else {\n\t\tforceColor = env.FORCE_COLOR.length === 0 ? 1 : Math.min(parseInt(env.FORCE_COLOR, 10), 3);\n\t}\n}\n\nfunction translateLevel(level) {\n\tif (level === 0) {\n\t\treturn false;\n\t}\n\n\treturn {\n\t\tlevel,\n\t\thasBasic: true,\n\t\thas256: level >= 2,\n\t\thas16m: level >= 3\n\t};\n}\n\nfunction supportsColor(haveStream, streamIsTTY) {\n\tif (forceColor === 0) {\n\t\treturn 0;\n\t}\n\n\tif (hasFlag('color=16m') ||\n\t\thasFlag('color=full') ||\n\t\thasFlag('color=truecolor')) {\n\t\treturn 3;\n\t}\n\n\tif (hasFlag('color=256')) {\n\t\treturn 2;\n\t}\n\n\tif (haveStream && !streamIsTTY && forceColor === undefined) {\n\t\treturn 0;\n\t}\n\n\tconst min = forceColor || 0;\n\n\tif (env.TERM === 'dumb') {\n\t\treturn min;\n\t}\n\n\tif (process.platform === 'win32') {\n\t\t// Windows 10 build 10586 is the first Windows release that supports 256 colors.\n\t\t// Windows 10 build 14931 is the first release that supports 16m/TrueColor.\n\t\tconst osRelease = os.release().split('.');\n\t\tif (\n\t\t\tNumber(osRelease[0]) >= 10 &&\n\t\t\tNumber(osRelease[2]) >= 10586\n\t\t) {\n\t\t\treturn Number(osRelease[2]) >= 14931 ? 3 : 2;\n\t\t}\n\n\t\treturn 1;\n\t}\n\n\tif ('CI' in env) {\n\t\tif (['TRAVIS', 'CIRCLECI', 'APPVEYOR', 'GITLAB_CI', 'GITHUB_ACTIONS', 'BUILDKITE'].some(sign => sign in env) || env.CI_NAME === 'codeship') {\n\t\t\treturn 1;\n\t\t}\n\n\t\treturn min;\n\t}\n\n\tif ('TEAMCITY_VERSION' in env) {\n\t\treturn /^(9\\.(0*[1-9]\\d*)\\.|\\d{2,}\\.)/.test(env.TEAMCITY_VERSION) ? 1 : 0;\n\t}\n\n\tif (env.COLORTERM === 'truecolor') {\n\t\treturn 3;\n\t}\n\n\tif ('TERM_PROGRAM' in env) {\n\t\tconst version = parseInt((env.TERM_PROGRAM_VERSION || '').split('.')[0], 10);\n\n\t\tswitch (env.TERM_PROGRAM) {\n\t\t\tcase 'iTerm.app':\n\t\t\t\treturn version >= 3 ? 3 : 2;\n\t\t\tcase 'Apple_Terminal':\n\t\t\t\treturn 2;\n\t\t\t// No default\n\t\t}\n\t}\n\n\tif (/-256(color)?$/i.test(env.TERM)) {\n\t\treturn 2;\n\t}\n\n\tif (/^screen|^xterm|^vt100|^vt220|^rxvt|color|ansi|cygwin|linux/i.test(env.TERM)) {\n\t\treturn 1;\n\t}\n\n\tif ('COLORTERM' in env) {\n\t\treturn 1;\n\t}\n\n\treturn min;\n}\n\nfunction getSupportLevel(stream) {\n\tconst level = supportsColor(stream, stream && stream.isTTY);\n\treturn translateLevel(level);\n}\n\nmodule.exports = {\n\tsupportsColor: getSupportLevel,\n\tstdout: translateLevel(supportsColor(true, tty.isatty(1))),\n\tstderr: translateLevel(supportsColor(true, tty.isatty(2)))\n};\n",
20
+ "/**\n * Module dependencies.\n */\n\nconst tty = require('tty');\nconst util = require('util');\n\n/**\n * This is the Node.js implementation of `debug()`.\n */\n\nexports.init = init;\nexports.log = log;\nexports.formatArgs = formatArgs;\nexports.save = save;\nexports.load = load;\nexports.useColors = useColors;\nexports.destroy = util.deprecate(\n\t() => {},\n\t'Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.'\n);\n\n/**\n * Colors.\n */\n\nexports.colors = [6, 2, 3, 4, 5, 1];\n\ntry {\n\t// Optional dependency (as in, doesn't need to be installed, NOT like optionalDependencies in package.json)\n\t// eslint-disable-next-line import/no-extraneous-dependencies\n\tconst supportsColor = require('supports-color');\n\n\tif (supportsColor && (supportsColor.stderr || supportsColor).level >= 2) {\n\t\texports.colors = [\n\t\t\t20,\n\t\t\t21,\n\t\t\t26,\n\t\t\t27,\n\t\t\t32,\n\t\t\t33,\n\t\t\t38,\n\t\t\t39,\n\t\t\t40,\n\t\t\t41,\n\t\t\t42,\n\t\t\t43,\n\t\t\t44,\n\t\t\t45,\n\t\t\t56,\n\t\t\t57,\n\t\t\t62,\n\t\t\t63,\n\t\t\t68,\n\t\t\t69,\n\t\t\t74,\n\t\t\t75,\n\t\t\t76,\n\t\t\t77,\n\t\t\t78,\n\t\t\t79,\n\t\t\t80,\n\t\t\t81,\n\t\t\t92,\n\t\t\t93,\n\t\t\t98,\n\t\t\t99,\n\t\t\t112,\n\t\t\t113,\n\t\t\t128,\n\t\t\t129,\n\t\t\t134,\n\t\t\t135,\n\t\t\t148,\n\t\t\t149,\n\t\t\t160,\n\t\t\t161,\n\t\t\t162,\n\t\t\t163,\n\t\t\t164,\n\t\t\t165,\n\t\t\t166,\n\t\t\t167,\n\t\t\t168,\n\t\t\t169,\n\t\t\t170,\n\t\t\t171,\n\t\t\t172,\n\t\t\t173,\n\t\t\t178,\n\t\t\t179,\n\t\t\t184,\n\t\t\t185,\n\t\t\t196,\n\t\t\t197,\n\t\t\t198,\n\t\t\t199,\n\t\t\t200,\n\t\t\t201,\n\t\t\t202,\n\t\t\t203,\n\t\t\t204,\n\t\t\t205,\n\t\t\t206,\n\t\t\t207,\n\t\t\t208,\n\t\t\t209,\n\t\t\t214,\n\t\t\t215,\n\t\t\t220,\n\t\t\t221\n\t\t];\n\t}\n} catch (error) {\n\t// Swallow - we only care if `supports-color` is available; it doesn't have to be.\n}\n\n/**\n * Build up the default `inspectOpts` object from the environment variables.\n *\n * $ DEBUG_COLORS=no DEBUG_DEPTH=10 DEBUG_SHOW_HIDDEN=enabled node script.js\n */\n\nexports.inspectOpts = Object.keys(process.env).filter(key => {\n\treturn /^debug_/i.test(key);\n}).reduce((obj, key) => {\n\t// Camel-case\n\tconst prop = key\n\t\t.substring(6)\n\t\t.toLowerCase()\n\t\t.replace(/_([a-z])/g, (_, k) => {\n\t\t\treturn k.toUpperCase();\n\t\t});\n\n\t// Coerce string value into JS value\n\tlet val = process.env[key];\n\tif (/^(yes|on|true|enabled)$/i.test(val)) {\n\t\tval = true;\n\t} else if (/^(no|off|false|disabled)$/i.test(val)) {\n\t\tval = false;\n\t} else if (val === 'null') {\n\t\tval = null;\n\t} else {\n\t\tval = Number(val);\n\t}\n\n\tobj[prop] = val;\n\treturn obj;\n}, {});\n\n/**\n * Is stdout a TTY? Colored output is enabled when `true`.\n */\n\nfunction useColors() {\n\treturn 'colors' in exports.inspectOpts ?\n\t\tBoolean(exports.inspectOpts.colors) :\n\t\ttty.isatty(process.stderr.fd);\n}\n\n/**\n * Adds ANSI color escape codes if enabled.\n *\n * @api public\n */\n\nfunction formatArgs(args) {\n\tconst {namespace: name, useColors} = this;\n\n\tif (useColors) {\n\t\tconst c = this.color;\n\t\tconst colorCode = '\\u001B[3' + (c < 8 ? c : '8;5;' + c);\n\t\tconst prefix = ` ${colorCode};1m${name} \\u001B[0m`;\n\n\t\targs[0] = prefix + args[0].split('\\n').join('\\n' + prefix);\n\t\targs.push(colorCode + 'm+' + module.exports.humanize(this.diff) + '\\u001B[0m');\n\t} else {\n\t\targs[0] = getDate() + name + ' ' + args[0];\n\t}\n}\n\nfunction getDate() {\n\tif (exports.inspectOpts.hideDate) {\n\t\treturn '';\n\t}\n\treturn new Date().toISOString() + ' ';\n}\n\n/**\n * Invokes `util.formatWithOptions()` with the specified arguments and writes to stderr.\n */\n\nfunction log(...args) {\n\treturn process.stderr.write(util.formatWithOptions(exports.inspectOpts, ...args) + '\\n');\n}\n\n/**\n * Save `namespaces`.\n *\n * @param {String} namespaces\n * @api private\n */\nfunction save(namespaces) {\n\tif (namespaces) {\n\t\tprocess.env.DEBUG = namespaces;\n\t} else {\n\t\t// If you set a process.env field to null or undefined, it gets cast to the\n\t\t// string 'null' or 'undefined'. Just delete instead.\n\t\tdelete process.env.DEBUG;\n\t}\n}\n\n/**\n * Load `namespaces`.\n *\n * @return {String} returns the previously persisted debug modes\n * @api private\n */\n\nfunction load() {\n\treturn process.env.DEBUG;\n}\n\n/**\n * Init logic for `debug` instances.\n *\n * Create a new `inspectOpts` object in case `useColors` is set\n * differently for a particular `debug` instance.\n */\n\nfunction init(debug) {\n\tdebug.inspectOpts = {};\n\n\tconst keys = Object.keys(exports.inspectOpts);\n\tfor (let i = 0; i < keys.length; i++) {\n\t\tdebug.inspectOpts[keys[i]] = exports.inspectOpts[keys[i]];\n\t}\n}\n\nmodule.exports = require('./common')(exports);\n\nconst {formatters} = module.exports;\n\n/**\n * Map %o to `util.inspect()`, all on a single line.\n */\n\nformatters.o = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts)\n\t\t.split('\\n')\n\t\t.map(str => str.trim())\n\t\t.join(' ');\n};\n\n/**\n * Map %O to `util.inspect()`, allowing multiple lines if needed.\n */\n\nformatters.O = function (v) {\n\tthis.inspectOpts.colors = this.useColors;\n\treturn util.inspect(v, this.inspectOpts);\n};\n",
21
+ "/**\n * Detect Electron renderer / nwjs process, which is node, but we should\n * treat as a browser.\n */\n\nif (typeof process === 'undefined' || process.type === 'renderer' || process.browser === true || process.__nwjs) {\n\tmodule.exports = require('./browser.js');\n} else {\n\tmodule.exports = require('./node.js');\n}\n",
22
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.genRedactedString = exports.getStringValue = exports.MAX_ARGUMENT_LENGTH = void 0;\nconst debug_1 = require(\"debug\");\nconst MAX_ARGUMENT_LENGTH = 200;\nexports.MAX_ARGUMENT_LENGTH = MAX_ARGUMENT_LENGTH;\nconst NAMESPACE_PREFIX = \"ioredis\";\n/**\n * helper function that tried to get a string value for\n * arbitrary \"debug\" arg\n */\nfunction getStringValue(v) {\n if (v === null) {\n return;\n }\n switch (typeof v) {\n case \"boolean\":\n return;\n case \"number\":\n return;\n case \"object\":\n if (Buffer.isBuffer(v)) {\n return v.toString(\"hex\");\n }\n if (Array.isArray(v)) {\n return v.join(\",\");\n }\n try {\n return JSON.stringify(v);\n }\n catch (e) {\n return;\n }\n case \"string\":\n return v;\n }\n}\nexports.getStringValue = getStringValue;\n/**\n * helper function that redacts a string representation of a \"debug\" arg\n */\nfunction genRedactedString(str, maxLen) {\n const { length } = str;\n return length <= maxLen\n ? str\n : str.slice(0, maxLen) + ' ... <REDACTED full-length=\"' + length + '\">';\n}\nexports.genRedactedString = genRedactedString;\n/**\n * a wrapper for the `debug` module, used to generate\n * \"debug functions\" that trim the values in their output\n */\nfunction genDebugFunction(namespace) {\n const fn = (0, debug_1.default)(`${NAMESPACE_PREFIX}:${namespace}`);\n function wrappedDebug(...args) {\n if (!fn.enabled) {\n return; // no-op\n }\n // we skip the first arg because that is the message\n for (let i = 1; i < args.length; i++) {\n const str = getStringValue(args[i]);\n if (typeof str === \"string\" && str.length > MAX_ARGUMENT_LENGTH) {\n args[i] = genRedactedString(str, MAX_ARGUMENT_LENGTH);\n }\n }\n return fn.apply(null, args);\n }\n Object.defineProperties(wrappedDebug, {\n namespace: {\n get() {\n return fn.namespace;\n },\n },\n enabled: {\n get() {\n return fn.enabled;\n },\n },\n destroy: {\n get() {\n return fn.destroy;\n },\n },\n log: {\n get() {\n return fn.log;\n },\n set(l) {\n fn.log = l;\n },\n },\n });\n return wrappedDebug;\n}\nexports.default = genDebugFunction;\n",
23
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * TLS settings for Redis Cloud. Updated on 2022-08-19.\n */\nconst RedisCloudCA = `-----BEGIN CERTIFICATE-----\nMIIDTzCCAjegAwIBAgIJAKSVpiDswLcwMA0GCSqGSIb3DQEBBQUAMD4xFjAU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WtiHL8\nRgJDx7KKnQRfJMsuS+FggkbhUqsMgUdwbN1k0ev1LKMPgj0MK66X17YUhhB5uzsT\ngHeMCOFJ0mpiLx9e+pZo34knlTifBtc+ycsmWQ1z3rDI6SYOgxXG71uL0gRgykmm\nKPZpO/bLyCiR5Z2KYVc3rHQU3HTgOu5yLy6c+9C7v/U9AOEGM+iCK65TpjoWc4zd\nQQ4gOsC0p6Hpsk+QLjJg6VfLuQSSaGjlOCZgdbKfd/+RFO+uIEn8rUAVSNECMWEZ\nXriX7613t2Saer9fwRPvm2L7DWzgVGkWqQPabumDk3F2xmmFghcCAwEAAaNCMEAw\nDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0OBBYEFI/wS3+o\nLkUkrk1Q+mOai97i3Ru8MA0GCSqGSIb3DQEBCwUAA4IBAQBLQNvAUKr+yAzv95ZU\nRUm7lgAJQayzE4aGKAczymvmdLm6AC2upArT9fHxD4q/c2dKg8dEe3jgr25sbwMp\njjM5RcOO5LlXbKr8EpbsU8Yt5CRsuZRj+9xTaGdWPoO4zzUhw8lo/s7awlOqzJCK\n6fBdRoyV3XpYKBovHd7NADdBj+1EbddTKJd+82cEHhXXipa0095MJ6RMG3NzdvQX\nmcIfeg7jLQitChws/zyrVQ4PkX4268NXSb7hLi18YIvDQVETI53O9zJrlAGomecs\nMx86OyXShkDOOyyGeMlhLxS67ttVb9+E7gUJTb0o2HLO02JQZR7rkpeDMdmztcpH\nWD9f\n-----END CERTIFICATE-----`;\nconst TLSProfiles = {\n RedisCloudFixed: { ca: RedisCloudCA },\n RedisCloudFlexible: { ca: RedisCloudCA },\n};\nexports.default = TLSProfiles;\n",
24
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.noop = exports.defaults = exports.Debug = exports.getPackageMeta = exports.zipMap = exports.CONNECTION_CLOSED_ERROR_MSG = exports.shuffle = exports.sample = exports.resolveTLSProfile = exports.parseURL = exports.optimizeErrorStack = exports.toArg = exports.convertMapToArray = exports.convertObjectToArray = exports.timeout = exports.packObject = exports.isInt = exports.wrapMultiResult = exports.convertBufferToString = void 0;\nconst fs_1 = require(\"fs\");\nconst path_1 = require(\"path\");\nconst url_1 = require(\"url\");\nconst lodash_1 = require(\"./lodash\");\nObject.defineProperty(exports, \"defaults\", { enumerable: true, get: function () { return lodash_1.defaults; } });\nObject.defineProperty(exports, \"noop\", { enumerable: true, get: function () { return lodash_1.noop; } });\nconst debug_1 = require(\"./debug\");\nexports.Debug = debug_1.default;\nconst TLSProfiles_1 = require(\"../constants/TLSProfiles\");\n/**\n * Convert a buffer to string, supports buffer array\n *\n * @example\n * ```js\n * const input = [Buffer.from('foo'), [Buffer.from('bar')]]\n * const res = convertBufferToString(input, 'utf8')\n * expect(res).to.eql(['foo', ['bar']])\n * ```\n */\nfunction convertBufferToString(value, encoding) {\n if (value instanceof Buffer) {\n return value.toString(encoding);\n }\n if (Array.isArray(value)) {\n const length = value.length;\n const res = Array(length);\n for (let i = 0; i < length; ++i) {\n res[i] =\n value[i] instanceof Buffer && encoding === \"utf8\"\n ? value[i].toString()\n : convertBufferToString(value[i], encoding);\n }\n return res;\n }\n return value;\n}\nexports.convertBufferToString = convertBufferToString;\n/**\n * Convert a list of results to node-style\n *\n * @example\n * ```js\n * const input = ['a', 'b', new Error('c'), 'd']\n * const output = exports.wrapMultiResult(input)\n * expect(output).to.eql([[null, 'a'], [null, 'b'], [new Error('c')], [null, 'd'])\n * ```\n */\nfunction wrapMultiResult(arr) {\n // When using WATCH/EXEC transactions, the EXEC will return\n // a null instead of an array\n if (!arr) {\n return null;\n }\n const result = [];\n const length = arr.length;\n for (let i = 0; i < length; ++i) {\n const item = arr[i];\n if (item instanceof Error) {\n result.push([item]);\n }\n else {\n result.push([null, item]);\n }\n }\n return result;\n}\nexports.wrapMultiResult = wrapMultiResult;\n/**\n * Detect if the argument is a int\n * @example\n * ```js\n * > isInt('123')\n * true\n * > isInt('123.3')\n * false\n * > isInt('1x')\n * false\n * > isInt(123)\n * true\n * > isInt(true)\n * false\n * ```\n */\nfunction isInt(value) {\n const x = parseFloat(value);\n return !isNaN(value) && (x | 0) === x;\n}\nexports.isInt = isInt;\n/**\n * Pack an array to an Object\n *\n * @example\n * ```js\n * > packObject(['a', 'b', 'c', 'd'])\n * { a: 'b', c: 'd' }\n * ```\n */\nfunction packObject(array) {\n const result = {};\n const length = array.length;\n for (let i = 1; i < length; i += 2) {\n result[array[i - 1]] = array[i];\n }\n return result;\n}\nexports.packObject = packObject;\n/**\n * Return a callback with timeout\n */\nfunction timeout(callback, timeout) {\n let timer = null;\n const run = function () {\n if (timer) {\n clearTimeout(timer);\n timer = null;\n callback.apply(this, arguments);\n }\n };\n timer = setTimeout(run, timeout, new Error(\"timeout\"));\n return run;\n}\nexports.timeout = timeout;\n/**\n * Convert an object to an array\n * @example\n * ```js\n * > convertObjectToArray({ a: '1' })\n * ['a', '1']\n * ```\n */\nfunction convertObjectToArray(obj) {\n const result = [];\n const keys = Object.keys(obj); // Object.entries requires node 7+\n for (let i = 0, l = keys.length; i < l; i++) {\n result.push(keys[i], obj[keys[i]]);\n }\n return result;\n}\nexports.convertObjectToArray = convertObjectToArray;\n/**\n * Convert a map to an array\n * @example\n * ```js\n * > convertMapToArray(new Map([[1, '2']]))\n * [1, '2']\n * ```\n */\nfunction convertMapToArray(map) {\n const result = [];\n let pos = 0;\n map.forEach(function (value, key) {\n result[pos] = key;\n result[pos + 1] = value;\n pos += 2;\n });\n return result;\n}\nexports.convertMapToArray = convertMapToArray;\n/**\n * Convert a non-string arg to a string\n */\nfunction toArg(arg) {\n if (arg === null || typeof arg === \"undefined\") {\n return \"\";\n }\n return String(arg);\n}\nexports.toArg = toArg;\n/**\n * Optimize error stack\n *\n * @param error actually error\n * @param friendlyStack the stack that more meaningful\n * @param filterPath only show stacks with the specified path\n */\nfunction optimizeErrorStack(error, friendlyStack, filterPath) {\n const stacks = friendlyStack.split(\"\\n\");\n let lines = \"\";\n let i;\n for (i = 1; i < stacks.length; ++i) {\n if (stacks[i].indexOf(filterPath) === -1) {\n break;\n }\n }\n for (let j = i; j < stacks.length; ++j) {\n lines += \"\\n\" + stacks[j];\n }\n if (error.stack) {\n const pos = error.stack.indexOf(\"\\n\");\n error.stack = error.stack.slice(0, pos) + lines;\n }\n return error;\n}\nexports.optimizeErrorStack = optimizeErrorStack;\n/**\n * Parse the redis protocol url\n */\nfunction parseURL(url) {\n if (isInt(url)) {\n return { port: url };\n }\n let parsed = (0, url_1.parse)(url, true, true);\n if (!parsed.slashes && url[0] !== \"/\") {\n url = \"//\" + url;\n parsed = (0, url_1.parse)(url, true, true);\n }\n const options = parsed.query || {};\n const result = {};\n if (parsed.auth) {\n const index = parsed.auth.indexOf(\":\");\n result.username = index === -1 ? parsed.auth : parsed.auth.slice(0, index);\n result.password = index === -1 ? \"\" : parsed.auth.slice(index + 1);\n }\n if (parsed.pathname) {\n if (parsed.protocol === \"redis:\" || parsed.protocol === \"rediss:\") {\n if (parsed.pathname.length > 1) {\n result.db = parsed.pathname.slice(1);\n }\n }\n else {\n result.path = parsed.pathname;\n }\n }\n if (parsed.host) {\n result.host = parsed.hostname;\n }\n if (parsed.port) {\n result.port = parsed.port;\n }\n if (typeof options.family === \"string\") {\n const intFamily = Number.parseInt(options.family, 10);\n if (!Number.isNaN(intFamily)) {\n result.family = intFamily;\n }\n }\n (0, lodash_1.defaults)(result, options);\n return result;\n}\nexports.parseURL = parseURL;\n/**\n * Resolve TLS profile shortcut in connection options\n */\nfunction resolveTLSProfile(options) {\n let tls = options === null || options === void 0 ? void 0 : options.tls;\n if (typeof tls === \"string\")\n tls = { profile: tls };\n const profile = TLSProfiles_1.default[tls === null || tls === void 0 ? void 0 : tls.profile];\n if (profile) {\n tls = Object.assign({}, profile, tls);\n delete tls.profile;\n options = Object.assign({}, options, { tls });\n }\n return options;\n}\nexports.resolveTLSProfile = resolveTLSProfile;\n/**\n * Get a random element from `array`\n */\nfunction sample(array, from = 0) {\n const length = array.length;\n if (from >= length) {\n return null;\n }\n return array[from + Math.floor(Math.random() * (length - from))];\n}\nexports.sample = sample;\n/**\n * Shuffle the array using the Fisher-Yates Shuffle.\n * This method will mutate the original array.\n */\nfunction shuffle(array) {\n let counter = array.length;\n // While there are elements in the array\n while (counter > 0) {\n // Pick a random index\n const index = Math.floor(Math.random() * counter);\n // Decrease counter by 1\n counter--;\n // And swap the last element with it\n [array[counter], array[index]] = [array[index], array[counter]];\n }\n return array;\n}\nexports.shuffle = shuffle;\n/**\n * Error message for connection being disconnected\n */\nexports.CONNECTION_CLOSED_ERROR_MSG = \"Connection is closed.\";\nfunction zipMap(keys, values) {\n const map = new Map();\n keys.forEach((key, index) => {\n map.set(key, values[index]);\n });\n return map;\n}\nexports.zipMap = zipMap;\n/**\n * Memoized package metadata to avoid repeated file system reads.\n *\n * @internal\n */\nlet cachedPackageMeta = null;\n/**\n * Retrieves cached package metadata from package.json.\n *\n * @internal\n * @returns {Promise<{version: string} | null>} Package metadata or null if unavailable\n */\nasync function getPackageMeta() {\n if (cachedPackageMeta) {\n return cachedPackageMeta;\n }\n try {\n const filePath = (0, path_1.resolve)(__dirname, \"..\", \"..\", \"package.json\");\n const data = await fs_1.promises.readFile(filePath, \"utf8\");\n const parsed = JSON.parse(data);\n cachedPackageMeta = {\n version: parsed.version,\n };\n return cachedPackageMeta;\n }\n catch (err) {\n cachedPackageMeta = {\n version: \"error-fetching-version\",\n };\n return cachedPackageMeta;\n }\n}\nexports.getPackageMeta = getPackageMeta;\n",
25
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst commands_1 = require(\"@ioredis/commands\");\nconst calculateSlot = require(\"cluster-key-slot\");\nconst standard_as_callback_1 = require(\"standard-as-callback\");\nconst utils_1 = require(\"./utils\");\n/**\n * Command instance\n *\n * It's rare that you need to create a Command instance yourself.\n *\n * ```js\n * var infoCommand = new Command('info', null, function (err, result) {\n * console.log('result', result);\n * });\n *\n * redis.sendCommand(infoCommand);\n *\n * // When no callback provided, Command instance will have a `promise` property,\n * // which will resolve/reject with the result of the command.\n * var getCommand = new Command('get', ['foo']);\n * getCommand.promise.then(function (result) {\n * console.log('result', result);\n * });\n * ```\n */\nclass Command {\n /**\n * Creates an instance of Command.\n * @param name Command name\n * @param args An array of command arguments\n * @param options\n * @param callback The callback that handles the response.\n * If omit, the response will be handled via Promise\n */\n constructor(name, args = [], options = {}, callback) {\n this.name = name;\n this.inTransaction = false;\n this.isResolved = false;\n this.transformed = false;\n this.replyEncoding = options.replyEncoding;\n this.errorStack = options.errorStack;\n this.args = args.flat();\n this.callback = callback;\n this.initPromise();\n if (options.keyPrefix) {\n // @ts-expect-error\n const isBufferKeyPrefix = options.keyPrefix instanceof Buffer;\n // @ts-expect-error\n let keyPrefixBuffer = isBufferKeyPrefix\n ? options.keyPrefix\n : null;\n this._iterateKeys((key) => {\n if (key instanceof Buffer) {\n if (keyPrefixBuffer === null) {\n keyPrefixBuffer = Buffer.from(options.keyPrefix);\n }\n return Buffer.concat([keyPrefixBuffer, key]);\n }\n else if (isBufferKeyPrefix) {\n // @ts-expect-error\n return Buffer.concat([options.keyPrefix, Buffer.from(String(key))]);\n }\n return options.keyPrefix + key;\n });\n }\n if (options.readOnly) {\n this.isReadOnly = true;\n }\n }\n /**\n * Check whether the command has the flag\n */\n static checkFlag(flagName, commandName) {\n return !!this.getFlagMap()[flagName][commandName];\n }\n static setArgumentTransformer(name, func) {\n this._transformer.argument[name] = func;\n }\n static setReplyTransformer(name, func) {\n this._transformer.reply[name] = func;\n }\n static getFlagMap() {\n if (!this.flagMap) {\n this.flagMap = Object.keys(Command.FLAGS).reduce((map, flagName) => {\n map[flagName] = {};\n Command.FLAGS[flagName].forEach((commandName) => {\n map[flagName][commandName] = true;\n });\n return map;\n }, {});\n }\n return this.flagMap;\n }\n getSlot() {\n if (typeof this.slot === \"undefined\") {\n const key = this.getKeys()[0];\n this.slot = key == null ? null : calculateSlot(key);\n }\n return this.slot;\n }\n getKeys() {\n return this._iterateKeys();\n }\n /**\n * Convert command to writable buffer or string\n */\n toWritable(_socket) {\n let result;\n const commandStr = \"*\" +\n (this.args.length + 1) +\n \"\\r\\n$\" +\n Buffer.byteLength(this.name) +\n \"\\r\\n\" +\n this.name +\n \"\\r\\n\";\n if (this.bufferMode) {\n const buffers = new MixedBuffers();\n buffers.push(commandStr);\n for (let i = 0; i < this.args.length; ++i) {\n const arg = this.args[i];\n if (arg instanceof Buffer) {\n if (arg.length === 0) {\n buffers.push(\"$0\\r\\n\\r\\n\");\n }\n else {\n buffers.push(\"$\" + arg.length + \"\\r\\n\");\n buffers.push(arg);\n buffers.push(\"\\r\\n\");\n }\n }\n else {\n buffers.push(\"$\" +\n Buffer.byteLength(arg) +\n \"\\r\\n\" +\n arg +\n \"\\r\\n\");\n }\n }\n result = buffers.toBuffer();\n }\n else {\n result = commandStr;\n for (let i = 0; i < this.args.length; ++i) {\n const arg = this.args[i];\n result +=\n \"$\" +\n Buffer.byteLength(arg) +\n \"\\r\\n\" +\n arg +\n \"\\r\\n\";\n }\n }\n return result;\n }\n stringifyArguments() {\n for (let i = 0; i < this.args.length; ++i) {\n const arg = this.args[i];\n if (typeof arg === \"string\") {\n // buffers and strings don't need any transformation\n }\n else if (arg instanceof Buffer) {\n this.bufferMode = true;\n }\n else {\n this.args[i] = (0, utils_1.toArg)(arg);\n }\n }\n }\n /**\n * Convert buffer/buffer[] to string/string[],\n * and apply reply transformer.\n */\n transformReply(result) {\n if (this.replyEncoding) {\n result = (0, utils_1.convertBufferToString)(result, this.replyEncoding);\n }\n const transformer = Command._transformer.reply[this.name];\n if (transformer) {\n result = transformer(result);\n }\n return result;\n }\n /**\n * Set the wait time before terminating the attempt to execute a command\n * and generating an error.\n */\n setTimeout(ms) {\n if (!this._commandTimeoutTimer) {\n this._commandTimeoutTimer = setTimeout(() => {\n if (!this.isResolved) {\n this.reject(new Error(\"Command timed out\"));\n }\n }, ms);\n }\n }\n initPromise() {\n const promise = new Promise((resolve, reject) => {\n if (!this.transformed) {\n this.transformed = true;\n const transformer = Command._transformer.argument[this.name];\n if (transformer) {\n this.args = transformer(this.args);\n }\n this.stringifyArguments();\n }\n this.resolve = this._convertValue(resolve);\n if (this.errorStack) {\n this.reject = (err) => {\n reject((0, utils_1.optimizeErrorStack)(err, this.errorStack.stack, __dirname));\n };\n }\n else {\n this.reject = reject;\n }\n });\n this.promise = (0, standard_as_callback_1.default)(promise, this.callback);\n }\n /**\n * Iterate through the command arguments that are considered keys.\n */\n _iterateKeys(transform = (key) => key) {\n if (typeof this.keys === \"undefined\") {\n this.keys = [];\n if ((0, commands_1.exists)(this.name)) {\n // @ts-expect-error\n const keyIndexes = (0, commands_1.getKeyIndexes)(this.name, this.args);\n for (const index of keyIndexes) {\n this.args[index] = transform(this.args[index]);\n this.keys.push(this.args[index]);\n }\n }\n }\n return this.keys;\n }\n /**\n * Convert the value from buffer to the target encoding.\n */\n _convertValue(resolve) {\n return (value) => {\n try {\n const existingTimer = this._commandTimeoutTimer;\n if (existingTimer) {\n clearTimeout(existingTimer);\n delete this._commandTimeoutTimer;\n }\n resolve(this.transformReply(value));\n this.isResolved = true;\n }\n catch (err) {\n this.reject(err);\n }\n return this.promise;\n };\n }\n}\nexports.default = Command;\nCommand.FLAGS = {\n VALID_IN_SUBSCRIBER_MODE: [\n \"subscribe\",\n \"psubscribe\",\n \"unsubscribe\",\n \"punsubscribe\",\n \"ssubscribe\",\n \"sunsubscribe\",\n \"ping\",\n \"quit\",\n ],\n VALID_IN_MONITOR_MODE: [\"monitor\", \"auth\"],\n ENTER_SUBSCRIBER_MODE: [\"subscribe\", \"psubscribe\", \"ssubscribe\"],\n EXIT_SUBSCRIBER_MODE: [\"unsubscribe\", \"punsubscribe\", \"sunsubscribe\"],\n WILL_DISCONNECT: [\"quit\"],\n HANDSHAKE_COMMANDS: [\"auth\", \"select\", \"client\", \"readonly\", \"info\"],\n IGNORE_RECONNECT_ON_ERROR: [\"client\"],\n};\nCommand._transformer = {\n argument: {},\n reply: {},\n};\nconst msetArgumentTransformer = function (args) {\n if (args.length === 1) {\n if (args[0] instanceof Map) {\n return (0, utils_1.convertMapToArray)(args[0]);\n }\n if (typeof args[0] === \"object\" && args[0] !== null) {\n return (0, utils_1.convertObjectToArray)(args[0]);\n }\n }\n return args;\n};\nconst hsetArgumentTransformer = function (args) {\n if (args.length === 2) {\n if (args[1] instanceof Map) {\n return [args[0]].concat((0, utils_1.convertMapToArray)(args[1]));\n }\n if (typeof args[1] === \"object\" && args[1] !== null) {\n return [args[0]].concat((0, utils_1.convertObjectToArray)(args[1]));\n }\n }\n return args;\n};\nCommand.setArgumentTransformer(\"mset\", msetArgumentTransformer);\nCommand.setArgumentTransformer(\"msetnx\", msetArgumentTransformer);\nCommand.setArgumentTransformer(\"hset\", hsetArgumentTransformer);\nCommand.setArgumentTransformer(\"hmset\", hsetArgumentTransformer);\nCommand.setReplyTransformer(\"hgetall\", function (result) {\n if (Array.isArray(result)) {\n const obj = {};\n for (let i = 0; i < result.length; i += 2) {\n const key = result[i];\n const value = result[i + 1];\n if (key in obj) {\n // can only be truthy if the property is special somehow, like '__proto__' or 'constructor'\n // https://github.com/luin/ioredis/issues/1267\n Object.defineProperty(obj, key, {\n value,\n configurable: true,\n enumerable: true,\n writable: true,\n });\n }\n else {\n obj[key] = value;\n }\n }\n return obj;\n }\n return result;\n});\nclass MixedBuffers {\n constructor() {\n this.length = 0;\n this.items = [];\n }\n push(x) {\n this.length += Buffer.byteLength(x);\n this.items.push(x);\n }\n toBuffer() {\n const result = Buffer.allocUnsafe(this.length);\n let offset = 0;\n for (const item of this.items) {\n const length = Buffer.byteLength(item);\n Buffer.isBuffer(item)\n ? item.copy(result, offset)\n : result.write(item, offset, length);\n offset += length;\n }\n return result;\n }\n}\n",
26
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst redis_errors_1 = require(\"redis-errors\");\nclass ClusterAllFailedError extends redis_errors_1.RedisError {\n constructor(message, lastNodeError) {\n super(message);\n this.lastNodeError = lastNodeError;\n Error.captureStackTrace(this, this.constructor);\n }\n get name() {\n return this.constructor.name;\n }\n}\nexports.default = ClusterAllFailedError;\nClusterAllFailedError.defaultMessage = \"Failed to refresh slots cache.\";\n",
27
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst stream_1 = require(\"stream\");\n/**\n * Convenient class to convert the process of scanning keys to a readable stream.\n */\nclass ScanStream extends stream_1.Readable {\n constructor(opt) {\n super(opt);\n this.opt = opt;\n this._redisCursor = \"0\";\n this._redisDrained = false;\n }\n _read() {\n if (this._redisDrained) {\n this.push(null);\n return;\n }\n const args = [this._redisCursor];\n if (this.opt.key) {\n args.unshift(this.opt.key);\n }\n if (this.opt.match) {\n args.push(\"MATCH\", this.opt.match);\n }\n if (this.opt.type) {\n args.push(\"TYPE\", this.opt.type);\n }\n if (this.opt.count) {\n args.push(\"COUNT\", String(this.opt.count));\n }\n if (this.opt.noValues) {\n args.push(\"NOVALUES\");\n }\n this.opt.redis[this.opt.command](args, (err, res) => {\n if (err) {\n this.emit(\"error\", err);\n return;\n }\n this._redisCursor = res[0] instanceof Buffer ? res[0].toString() : res[0];\n if (this._redisCursor === \"0\") {\n this._redisDrained = true;\n }\n this.push(res[1]);\n });\n }\n close() {\n this._redisDrained = true;\n }\n}\nexports.default = ScanStream;\n",
28
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.executeWithAutoPipelining = exports.getFirstValueInFlattenedArray = exports.shouldUseAutoPipelining = exports.notAllowedAutoPipelineCommands = exports.kCallbacks = exports.kExec = void 0;\nconst lodash_1 = require(\"./utils/lodash\");\nconst calculateSlot = require(\"cluster-key-slot\");\nconst standard_as_callback_1 = require(\"standard-as-callback\");\nexports.kExec = Symbol(\"exec\");\nexports.kCallbacks = Symbol(\"callbacks\");\nexports.notAllowedAutoPipelineCommands = [\n \"auth\",\n \"info\",\n \"script\",\n \"quit\",\n \"cluster\",\n \"pipeline\",\n \"multi\",\n \"subscribe\",\n \"psubscribe\",\n \"unsubscribe\",\n \"unpsubscribe\",\n \"select\",\n \"client\",\n];\nfunction executeAutoPipeline(client, slotKey) {\n /*\n If a pipeline is already executing, keep queueing up commands\n since ioredis won't serve two pipelines at the same time\n */\n if (client._runningAutoPipelines.has(slotKey)) {\n return;\n }\n if (!client._autoPipelines.has(slotKey)) {\n /*\n Rare edge case. Somehow, something has deleted this running autopipeline in an immediate\n call to executeAutoPipeline.\n \n Maybe the callback in the pipeline.exec is sometimes called in the same tick,\n e.g. if redis is disconnected?\n */\n return;\n }\n client._runningAutoPipelines.add(slotKey);\n // Get the pipeline and immediately delete it so that new commands are queued on a new pipeline\n const pipeline = client._autoPipelines.get(slotKey);\n client._autoPipelines.delete(slotKey);\n const callbacks = pipeline[exports.kCallbacks];\n // Stop keeping a reference to callbacks immediately after the callbacks stop being used.\n // This allows the GC to reclaim objects referenced by callbacks, especially with 16384 slots\n // in Redis.Cluster\n pipeline[exports.kCallbacks] = null;\n // Perform the call\n pipeline.exec(function (err, results) {\n client._runningAutoPipelines.delete(slotKey);\n /*\n Invoke all callback in nextTick so the stack is cleared\n and callbacks can throw errors without affecting other callbacks.\n */\n if (err) {\n for (let i = 0; i < callbacks.length; i++) {\n process.nextTick(callbacks[i], err);\n }\n }\n else {\n for (let i = 0; i < callbacks.length; i++) {\n process.nextTick(callbacks[i], ...results[i]);\n }\n }\n // If there is another pipeline on the same node, immediately execute it without waiting for nextTick\n if (client._autoPipelines.has(slotKey)) {\n executeAutoPipeline(client, slotKey);\n }\n });\n}\nfunction shouldUseAutoPipelining(client, functionName, commandName) {\n return (functionName &&\n client.options.enableAutoPipelining &&\n !client.isPipeline &&\n !exports.notAllowedAutoPipelineCommands.includes(commandName) &&\n !client.options.autoPipeliningIgnoredCommands.includes(commandName));\n}\nexports.shouldUseAutoPipelining = shouldUseAutoPipelining;\nfunction getFirstValueInFlattenedArray(args) {\n for (let i = 0; i < args.length; i++) {\n const arg = args[i];\n if (typeof arg === \"string\") {\n return arg;\n }\n else if (Array.isArray(arg) || (0, lodash_1.isArguments)(arg)) {\n if (arg.length === 0) {\n continue;\n }\n return arg[0];\n }\n const flattened = [arg].flat();\n if (flattened.length > 0) {\n return flattened[0];\n }\n }\n return undefined;\n}\nexports.getFirstValueInFlattenedArray = getFirstValueInFlattenedArray;\nfunction executeWithAutoPipelining(client, functionName, commandName, args, callback) {\n // On cluster mode let's wait for slots to be available\n if (client.isCluster && !client.slots.length) {\n if (client.status === \"wait\")\n client.connect().catch(lodash_1.noop);\n return (0, standard_as_callback_1.default)(new Promise(function (resolve, reject) {\n client.delayUntilReady((err) => {\n if (err) {\n reject(err);\n return;\n }\n executeWithAutoPipelining(client, functionName, commandName, args, null).then(resolve, reject);\n });\n }), callback);\n }\n // If we have slot information, we can improve routing by grouping slots served by the same subset of nodes\n // Note that the first value in args may be a (possibly empty) array.\n // ioredis will only flatten one level of the array, in the Command constructor.\n const prefix = client.options.keyPrefix || \"\";\n const slotKey = client.isCluster\n ? client.slots[calculateSlot(`${prefix}${getFirstValueInFlattenedArray(args)}`)].join(\",\")\n : \"main\";\n if (!client._autoPipelines.has(slotKey)) {\n const pipeline = client.pipeline();\n pipeline[exports.kExec] = false;\n pipeline[exports.kCallbacks] = [];\n client._autoPipelines.set(slotKey, pipeline);\n }\n const pipeline = client._autoPipelines.get(slotKey);\n /*\n Mark the pipeline as scheduled.\n The symbol will make sure that the pipeline is only scheduled once per tick.\n New commands are appended to an already scheduled pipeline.\n */\n if (!pipeline[exports.kExec]) {\n pipeline[exports.kExec] = true;\n /*\n Deferring with setImmediate so we have a chance to capture multiple\n commands that can be scheduled by I/O events already in the event loop queue.\n */\n setImmediate(executeAutoPipeline, client, slotKey);\n }\n // Create the promise which will execute the command in the pipeline.\n const autoPipelinePromise = new Promise(function (resolve, reject) {\n pipeline[exports.kCallbacks].push(function (err, value) {\n if (err) {\n reject(err);\n return;\n }\n resolve(value);\n });\n if (functionName === \"call\") {\n args.unshift(commandName);\n }\n pipeline[functionName](...args);\n });\n return (0, standard_as_callback_1.default)(autoPipelinePromise, callback);\n}\nexports.executeWithAutoPipelining = executeWithAutoPipelining;\n",
29
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst crypto_1 = require(\"crypto\");\nconst Command_1 = require(\"./Command\");\nconst standard_as_callback_1 = require(\"standard-as-callback\");\nclass Script {\n constructor(lua, numberOfKeys = null, keyPrefix = \"\", readOnly = false) {\n this.lua = lua;\n this.numberOfKeys = numberOfKeys;\n this.keyPrefix = keyPrefix;\n this.readOnly = readOnly;\n this.sha = (0, crypto_1.createHash)(\"sha1\").update(lua).digest(\"hex\");\n const sha = this.sha;\n const socketHasScriptLoaded = new WeakSet();\n this.Command = class CustomScriptCommand extends Command_1.default {\n toWritable(socket) {\n const origReject = this.reject;\n this.reject = (err) => {\n if (err.message.indexOf(\"NOSCRIPT\") !== -1) {\n socketHasScriptLoaded.delete(socket);\n }\n origReject.call(this, err);\n };\n if (!socketHasScriptLoaded.has(socket)) {\n socketHasScriptLoaded.add(socket);\n this.name = \"eval\";\n this.args[0] = lua;\n }\n else if (this.name === \"eval\") {\n this.name = \"evalsha\";\n this.args[0] = sha;\n }\n return super.toWritable(socket);\n }\n };\n }\n execute(container, args, options, callback) {\n if (typeof this.numberOfKeys === \"number\") {\n args.unshift(this.numberOfKeys);\n }\n if (this.keyPrefix) {\n options.keyPrefix = this.keyPrefix;\n }\n if (this.readOnly) {\n options.readOnly = true;\n }\n const evalsha = new this.Command(\"evalsha\", [this.sha, ...args], options);\n evalsha.promise = evalsha.promise.catch((err) => {\n if (err.message.indexOf(\"NOSCRIPT\") === -1) {\n throw err;\n }\n // Resend the same custom evalsha command that gets transformed\n // to an eval in case it's not loaded yet on the connection.\n const resend = new this.Command(\"evalsha\", [this.sha, ...args], options);\n const client = container.isPipeline ? container.redis : container;\n return client.sendCommand(resend);\n });\n (0, standard_as_callback_1.default)(evalsha.promise, callback);\n return container.sendCommand(evalsha);\n }\n}\nexports.default = Script;\n",
30
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst commands_1 = require(\"@ioredis/commands\");\nconst autoPipelining_1 = require(\"../autoPipelining\");\nconst Command_1 = require(\"../Command\");\nconst Script_1 = require(\"../Script\");\n// eslint-disable-next-line @typescript-eslint/no-unused-vars\nclass Commander {\n constructor() {\n this.options = {};\n /**\n * @ignore\n */\n this.scriptsSet = {};\n /**\n * @ignore\n */\n this.addedBuiltinSet = new Set();\n }\n /**\n * Return supported builtin commands\n */\n getBuiltinCommands() {\n return commands.slice(0);\n }\n /**\n * Create a builtin command\n */\n createBuiltinCommand(commandName) {\n return {\n string: generateFunction(null, commandName, \"utf8\"),\n buffer: generateFunction(null, commandName, null),\n };\n }\n /**\n * Create add builtin command\n */\n addBuiltinCommand(commandName) {\n this.addedBuiltinSet.add(commandName);\n this[commandName] = generateFunction(commandName, commandName, \"utf8\");\n this[commandName + \"Buffer\"] = generateFunction(commandName + \"Buffer\", commandName, null);\n }\n /**\n * Define a custom command using lua script\n */\n defineCommand(name, definition) {\n const script = new Script_1.default(definition.lua, definition.numberOfKeys, this.options.keyPrefix, definition.readOnly);\n this.scriptsSet[name] = script;\n this[name] = generateScriptingFunction(name, name, script, \"utf8\");\n this[name + \"Buffer\"] = generateScriptingFunction(name + \"Buffer\", name, script, null);\n }\n /**\n * @ignore\n */\n sendCommand(command, stream, node) {\n throw new Error('\"sendCommand\" is not implemented');\n }\n}\nconst commands = commands_1.list.filter((command) => command !== \"monitor\");\ncommands.push(\"sentinel\");\ncommands.forEach(function (commandName) {\n Commander.prototype[commandName] = generateFunction(commandName, commandName, \"utf8\");\n Commander.prototype[commandName + \"Buffer\"] = generateFunction(commandName + \"Buffer\", commandName, null);\n});\nCommander.prototype.call = generateFunction(\"call\", \"utf8\");\nCommander.prototype.callBuffer = generateFunction(\"callBuffer\", null);\n// @ts-expect-error\nCommander.prototype.send_command = Commander.prototype.call;\nfunction generateFunction(functionName, _commandName, _encoding) {\n if (typeof _encoding === \"undefined\") {\n _encoding = _commandName;\n _commandName = null;\n }\n return function (...args) {\n const commandName = (_commandName || args.shift());\n let callback = args[args.length - 1];\n if (typeof callback === \"function\") {\n args.pop();\n }\n else {\n callback = undefined;\n }\n const options = {\n errorStack: this.options.showFriendlyErrorStack ? new Error() : undefined,\n keyPrefix: this.options.keyPrefix,\n replyEncoding: _encoding,\n };\n // No auto pipeline, use regular command sending\n if (!(0, autoPipelining_1.shouldUseAutoPipelining)(this, functionName, commandName)) {\n return this.sendCommand(\n // @ts-expect-error\n new Command_1.default(commandName, args, options, callback));\n }\n // Create a new pipeline and make sure it's scheduled\n return (0, autoPipelining_1.executeWithAutoPipelining)(this, functionName, commandName, \n // @ts-expect-error\n args, callback);\n };\n}\nfunction generateScriptingFunction(functionName, commandName, script, encoding) {\n return function (...args) {\n const callback = typeof args[args.length - 1] === \"function\" ? args.pop() : undefined;\n const options = {\n replyEncoding: encoding,\n };\n if (this.options.showFriendlyErrorStack) {\n options.errorStack = new Error();\n }\n // No auto pipeline, use regular command sending\n if (!(0, autoPipelining_1.shouldUseAutoPipelining)(this, functionName, commandName)) {\n return script.execute(this, args, options, callback);\n }\n // Create a new pipeline and make sure it's scheduled\n return (0, autoPipelining_1.executeWithAutoPipelining)(this, functionName, commandName, args, callback);\n };\n}\nexports.default = Commander;\n",
31
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst calculateSlot = require(\"cluster-key-slot\");\nconst commands_1 = require(\"@ioredis/commands\");\nconst standard_as_callback_1 = require(\"standard-as-callback\");\nconst util_1 = require(\"util\");\nconst Command_1 = require(\"./Command\");\nconst utils_1 = require(\"./utils\");\nconst Commander_1 = require(\"./utils/Commander\");\n/*\n This function derives from the cluster-key-slot implementation.\n Instead of checking that all keys have the same slot, it checks that all slots are served by the same set of nodes.\n If this is satisfied, it returns the first key's slot.\n*/\nfunction generateMultiWithNodes(redis, keys) {\n const slot = calculateSlot(keys[0]);\n const target = redis._groupsBySlot[slot];\n for (let i = 1; i < keys.length; i++) {\n if (redis._groupsBySlot[calculateSlot(keys[i])] !== target) {\n return -1;\n }\n }\n return slot;\n}\nclass Pipeline extends Commander_1.default {\n constructor(redis) {\n super();\n this.redis = redis;\n this.isPipeline = true;\n this.replyPending = 0;\n this._queue = [];\n this._result = [];\n this._transactions = 0;\n this._shaToScript = {};\n this.isCluster =\n this.redis.constructor.name === \"Cluster\" || this.redis.isCluster;\n this.options = redis.options;\n Object.keys(redis.scriptsSet).forEach((name) => {\n const script = redis.scriptsSet[name];\n this._shaToScript[script.sha] = script;\n this[name] = redis[name];\n this[name + \"Buffer\"] = redis[name + \"Buffer\"];\n });\n redis.addedBuiltinSet.forEach((name) => {\n this[name] = redis[name];\n this[name + \"Buffer\"] = redis[name + \"Buffer\"];\n });\n this.promise = new Promise((resolve, reject) => {\n this.resolve = resolve;\n this.reject = reject;\n });\n const _this = this;\n Object.defineProperty(this, \"length\", {\n get: function () {\n return _this._queue.length;\n },\n });\n }\n fillResult(value, position) {\n if (this._queue[position].name === \"exec\" && Array.isArray(value[1])) {\n const execLength = value[1].length;\n for (let i = 0; i < execLength; i++) {\n if (value[1][i] instanceof Error) {\n continue;\n }\n const cmd = this._queue[position - (execLength - i)];\n try {\n value[1][i] = cmd.transformReply(value[1][i]);\n }\n catch (err) {\n value[1][i] = err;\n }\n }\n }\n this._result[position] = value;\n if (--this.replyPending) {\n return;\n }\n if (this.isCluster) {\n let retriable = true;\n let commonError;\n for (let i = 0; i < this._result.length; ++i) {\n const error = this._result[i][0];\n const command = this._queue[i];\n if (error) {\n if (command.name === \"exec\" &&\n error.message ===\n \"EXECABORT Transaction discarded because of previous errors.\") {\n continue;\n }\n if (!commonError) {\n commonError = {\n name: error.name,\n message: error.message,\n };\n }\n else if (commonError.name !== error.name ||\n commonError.message !== error.message) {\n retriable = false;\n break;\n }\n }\n else if (!command.inTransaction) {\n const isReadOnly = (0, commands_1.exists)(command.name) && (0, commands_1.hasFlag)(command.name, \"readonly\");\n if (!isReadOnly) {\n retriable = false;\n break;\n }\n }\n }\n if (commonError && retriable) {\n const _this = this;\n const errv = commonError.message.split(\" \");\n const queue = this._queue;\n let inTransaction = false;\n this._queue = [];\n for (let i = 0; i < queue.length; ++i) {\n if (errv[0] === \"ASK\" &&\n !inTransaction &&\n queue[i].name !== \"asking\" &&\n (!queue[i - 1] || queue[i - 1].name !== \"asking\")) {\n const asking = new Command_1.default(\"asking\");\n asking.ignore = true;\n this.sendCommand(asking);\n }\n queue[i].initPromise();\n this.sendCommand(queue[i]);\n inTransaction = queue[i].inTransaction;\n }\n let matched = true;\n if (typeof this.leftRedirections === \"undefined\") {\n this.leftRedirections = {};\n }\n const exec = function () {\n _this.exec();\n };\n const cluster = this.redis;\n cluster.handleError(commonError, this.leftRedirections, {\n moved: function (_slot, key) {\n _this.preferKey = key;\n cluster.slots[errv[1]] = [key];\n cluster._groupsBySlot[errv[1]] =\n cluster._groupsIds[cluster.slots[errv[1]].join(\";\")];\n cluster.refreshSlotsCache();\n _this.exec();\n },\n ask: function (_slot, key) {\n _this.preferKey = key;\n _this.exec();\n },\n tryagain: exec,\n clusterDown: exec,\n connectionClosed: exec,\n maxRedirections: () => {\n matched = false;\n },\n defaults: () => {\n matched = false;\n },\n });\n if (matched) {\n return;\n }\n }\n }\n let ignoredCount = 0;\n for (let i = 0; i < this._queue.length - ignoredCount; ++i) {\n if (this._queue[i + ignoredCount].ignore) {\n ignoredCount += 1;\n }\n this._result[i] = this._result[i + ignoredCount];\n }\n this.resolve(this._result.slice(0, this._result.length - ignoredCount));\n }\n sendCommand(command) {\n if (this._transactions > 0) {\n command.inTransaction = true;\n }\n const position = this._queue.length;\n command.pipelineIndex = position;\n command.promise\n .then((result) => {\n this.fillResult([null, result], position);\n })\n .catch((error) => {\n this.fillResult([error], position);\n });\n this._queue.push(command);\n return this;\n }\n addBatch(commands) {\n let command, commandName, args;\n for (let i = 0; i < commands.length; ++i) {\n command = commands[i];\n commandName = command[0];\n args = command.slice(1);\n this[commandName].apply(this, args);\n }\n return this;\n }\n}\nexports.default = Pipeline;\n// @ts-expect-error\nconst multi = Pipeline.prototype.multi;\n// @ts-expect-error\nPipeline.prototype.multi = function () {\n this._transactions += 1;\n return multi.apply(this, arguments);\n};\n// @ts-expect-error\nconst execBuffer = Pipeline.prototype.execBuffer;\n// @ts-expect-error\nPipeline.prototype.execBuffer = (0, util_1.deprecate)(function () {\n if (this._transactions > 0) {\n this._transactions -= 1;\n }\n return execBuffer.apply(this, arguments);\n}, \"Pipeline#execBuffer: Use Pipeline#exec instead\");\n// NOTE: To avoid an unhandled promise rejection, this will unconditionally always return this.promise,\n// which always has the rejection handled by standard-as-callback\n// adding the provided rejection callback.\n//\n// If a different promise instance were returned, that promise would cause its own unhandled promise rejection\n// errors, even if that promise unconditionally resolved to **the resolved value of** this.promise.\nPipeline.prototype.exec = function (callback) {\n // Wait for the cluster to be connected, since we need nodes information before continuing\n if (this.isCluster && !this.redis.slots.length) {\n if (this.redis.status === \"wait\")\n this.redis.connect().catch(utils_1.noop);\n if (callback && !this.nodeifiedPromise) {\n this.nodeifiedPromise = true;\n (0, standard_as_callback_1.default)(this.promise, callback);\n }\n this.redis.delayUntilReady((err) => {\n if (err) {\n this.reject(err);\n return;\n }\n this.exec(callback);\n });\n return this.promise;\n }\n if (this._transactions > 0) {\n this._transactions -= 1;\n return execBuffer.apply(this, arguments);\n }\n if (!this.nodeifiedPromise) {\n this.nodeifiedPromise = true;\n (0, standard_as_callback_1.default)(this.promise, callback);\n }\n if (!this._queue.length) {\n this.resolve([]);\n }\n let pipelineSlot;\n if (this.isCluster) {\n // List of the first key for each command\n const sampleKeys = [];\n for (let i = 0; i < this._queue.length; i++) {\n const keys = this._queue[i].getKeys();\n if (keys.length) {\n sampleKeys.push(keys[0]);\n }\n // For each command, check that the keys belong to the same slot\n if (keys.length && calculateSlot.generateMulti(keys) < 0) {\n this.reject(new Error(\"All the keys in a pipeline command should belong to the same slot\"));\n return this.promise;\n }\n }\n if (sampleKeys.length) {\n pipelineSlot = generateMultiWithNodes(this.redis, sampleKeys);\n if (pipelineSlot < 0) {\n this.reject(new Error(\"All keys in the pipeline should belong to the same slots allocation group\"));\n return this.promise;\n }\n }\n else {\n // Send the pipeline to a random node\n pipelineSlot = (Math.random() * 16384) | 0;\n }\n }\n const _this = this;\n execPipeline();\n return this.promise;\n function execPipeline() {\n let writePending = (_this.replyPending = _this._queue.length);\n let node;\n if (_this.isCluster) {\n node = {\n slot: pipelineSlot,\n redis: _this.redis.connectionPool.nodes.all[_this.preferKey],\n };\n }\n let data = \"\";\n let buffers;\n const stream = {\n isPipeline: true,\n destination: _this.isCluster ? node : { redis: _this.redis },\n write(writable) {\n if (typeof writable !== \"string\") {\n if (!buffers) {\n buffers = [];\n }\n if (data) {\n buffers.push(Buffer.from(data, \"utf8\"));\n data = \"\";\n }\n buffers.push(writable);\n }\n else {\n data += writable;\n }\n if (!--writePending) {\n if (buffers) {\n if (data) {\n buffers.push(Buffer.from(data, \"utf8\"));\n }\n stream.destination.redis.stream.write(Buffer.concat(buffers));\n }\n else {\n stream.destination.redis.stream.write(data);\n }\n // Reset writePending for resending\n writePending = _this._queue.length;\n data = \"\";\n buffers = undefined;\n }\n },\n };\n for (let i = 0; i < _this._queue.length; ++i) {\n _this.redis.sendCommand(_this._queue[i], stream, node);\n }\n return _this.promise;\n }\n};\n",
32
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.addTransactionSupport = void 0;\nconst utils_1 = require(\"./utils\");\nconst standard_as_callback_1 = require(\"standard-as-callback\");\nconst Pipeline_1 = require(\"./Pipeline\");\nfunction addTransactionSupport(redis) {\n redis.pipeline = function (commands) {\n const pipeline = new Pipeline_1.default(this);\n if (Array.isArray(commands)) {\n pipeline.addBatch(commands);\n }\n return pipeline;\n };\n const { multi } = redis;\n redis.multi = function (commands, options) {\n if (typeof options === \"undefined\" && !Array.isArray(commands)) {\n options = commands;\n commands = null;\n }\n if (options && options.pipeline === false) {\n return multi.call(this);\n }\n const pipeline = new Pipeline_1.default(this);\n // @ts-expect-error\n pipeline.multi();\n if (Array.isArray(commands)) {\n pipeline.addBatch(commands);\n }\n const exec = pipeline.exec;\n pipeline.exec = function (callback) {\n // Wait for the cluster to be connected, since we need nodes information before continuing\n if (this.isCluster && !this.redis.slots.length) {\n if (this.redis.status === \"wait\")\n this.redis.connect().catch(utils_1.noop);\n return (0, standard_as_callback_1.default)(new Promise((resolve, reject) => {\n this.redis.delayUntilReady((err) => {\n if (err) {\n reject(err);\n return;\n }\n this.exec(pipeline).then(resolve, reject);\n });\n }), callback);\n }\n if (this._transactions > 0) {\n exec.call(pipeline);\n }\n // Returns directly when the pipeline\n // has been called multiple times (retries).\n if (this.nodeifiedPromise) {\n return exec.call(pipeline);\n }\n const promise = exec.call(pipeline);\n return (0, standard_as_callback_1.default)(promise.then(function (result) {\n const execResult = result[result.length - 1];\n if (typeof execResult === \"undefined\") {\n throw new Error(\"Pipeline cannot be used to send any commands when the `exec()` has been called on it.\");\n }\n if (execResult[0]) {\n execResult[0].previousErrors = [];\n for (let i = 0; i < result.length - 1; ++i) {\n if (result[i][0]) {\n execResult[0].previousErrors.push(result[i][0]);\n }\n }\n throw execResult[0];\n }\n return (0, utils_1.wrapMultiResult)(execResult[1]);\n }), callback);\n };\n // @ts-expect-error\n const { execBuffer } = pipeline;\n // @ts-expect-error\n pipeline.execBuffer = function (callback) {\n if (this._transactions > 0) {\n execBuffer.call(pipeline);\n }\n return pipeline.exec(callback);\n };\n return pipeline;\n };\n const { exec } = redis;\n redis.exec = function (callback) {\n return (0, standard_as_callback_1.default)(exec.call(this).then(function (results) {\n if (Array.isArray(results)) {\n results = (0, utils_1.wrapMultiResult)(results);\n }\n return results;\n }), callback);\n };\n}\nexports.addTransactionSupport = addTransactionSupport;\n",
33
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction applyMixin(derivedConstructor, mixinConstructor) {\n Object.getOwnPropertyNames(mixinConstructor.prototype).forEach((name) => {\n Object.defineProperty(derivedConstructor.prototype, name, Object.getOwnPropertyDescriptor(mixinConstructor.prototype, name));\n });\n}\nexports.default = applyMixin;\n",
34
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DEFAULT_CLUSTER_OPTIONS = void 0;\nconst dns_1 = require(\"dns\");\nexports.DEFAULT_CLUSTER_OPTIONS = {\n clusterRetryStrategy: (times) => Math.min(100 + times * 2, 2000),\n enableOfflineQueue: true,\n enableReadyCheck: true,\n scaleReads: \"master\",\n maxRedirections: 16,\n retryDelayOnMoved: 0,\n retryDelayOnFailover: 100,\n retryDelayOnClusterDown: 100,\n retryDelayOnTryAgain: 100,\n slotsRefreshTimeout: 1000,\n useSRVRecords: false,\n resolveSrv: dns_1.resolveSrv,\n dnsLookup: dns_1.lookup,\n enableAutoPipelining: false,\n autoPipeliningIgnoredCommands: [],\n shardedSubscribers: false,\n};\n",
35
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.getConnectionName = exports.weightSrvRecords = exports.groupSrvRecords = exports.getUniqueHostnamesFromOptions = exports.normalizeNodeOptions = exports.nodeKeyToRedisOptions = exports.getNodeKey = void 0;\nconst utils_1 = require(\"../utils\");\nconst net_1 = require(\"net\");\nfunction getNodeKey(node) {\n node.port = node.port || 6379;\n node.host = node.host || \"127.0.0.1\";\n return node.host + \":\" + node.port;\n}\nexports.getNodeKey = getNodeKey;\nfunction nodeKeyToRedisOptions(nodeKey) {\n const portIndex = nodeKey.lastIndexOf(\":\");\n if (portIndex === -1) {\n throw new Error(`Invalid node key ${nodeKey}`);\n }\n return {\n host: nodeKey.slice(0, portIndex),\n port: Number(nodeKey.slice(portIndex + 1)),\n };\n}\nexports.nodeKeyToRedisOptions = nodeKeyToRedisOptions;\nfunction normalizeNodeOptions(nodes) {\n return nodes.map((node) => {\n const options = {};\n if (typeof node === \"object\") {\n Object.assign(options, node);\n }\n else if (typeof node === \"string\") {\n Object.assign(options, (0, utils_1.parseURL)(node));\n }\n else if (typeof node === \"number\") {\n options.port = node;\n }\n else {\n throw new Error(\"Invalid argument \" + node);\n }\n if (typeof options.port === \"string\") {\n options.port = parseInt(options.port, 10);\n }\n // Cluster mode only support db 0\n delete options.db;\n if (!options.port) {\n options.port = 6379;\n }\n if (!options.host) {\n options.host = \"127.0.0.1\";\n }\n return (0, utils_1.resolveTLSProfile)(options);\n });\n}\nexports.normalizeNodeOptions = normalizeNodeOptions;\nfunction getUniqueHostnamesFromOptions(nodes) {\n const uniqueHostsMap = {};\n nodes.forEach((node) => {\n uniqueHostsMap[node.host] = true;\n });\n return Object.keys(uniqueHostsMap).filter((host) => !(0, net_1.isIP)(host));\n}\nexports.getUniqueHostnamesFromOptions = getUniqueHostnamesFromOptions;\nfunction groupSrvRecords(records) {\n const recordsByPriority = {};\n for (const record of records) {\n if (!recordsByPriority.hasOwnProperty(record.priority)) {\n recordsByPriority[record.priority] = {\n totalWeight: record.weight,\n records: [record],\n };\n }\n else {\n recordsByPriority[record.priority].totalWeight += record.weight;\n recordsByPriority[record.priority].records.push(record);\n }\n }\n return recordsByPriority;\n}\nexports.groupSrvRecords = groupSrvRecords;\nfunction weightSrvRecords(recordsGroup) {\n if (recordsGroup.records.length === 1) {\n recordsGroup.totalWeight = 0;\n return recordsGroup.records.shift();\n }\n // + `recordsGroup.records.length` to support `weight` 0\n const random = Math.floor(Math.random() * (recordsGroup.totalWeight + recordsGroup.records.length));\n let total = 0;\n for (const [i, record] of recordsGroup.records.entries()) {\n total += 1 + record.weight;\n if (total > random) {\n recordsGroup.totalWeight -= record.weight;\n recordsGroup.records.splice(i, 1);\n return record;\n }\n }\n}\nexports.weightSrvRecords = weightSrvRecords;\nfunction getConnectionName(component, nodeConnectionName) {\n const prefix = `ioredis-cluster(${component})`;\n return nodeConnectionName ? `${prefix}:${nodeConnectionName}` : prefix;\n}\nexports.getConnectionName = getConnectionName;\n",
36
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst util_1 = require(\"./util\");\nconst utils_1 = require(\"../utils\");\nconst Redis_1 = require(\"../Redis\");\nconst debug = (0, utils_1.Debug)(\"cluster:subscriber\");\nclass ClusterSubscriber {\n constructor(connectionPool, emitter, isSharded = false) {\n this.connectionPool = connectionPool;\n this.emitter = emitter;\n this.isSharded = isSharded;\n this.started = false;\n //There is only one connection for the entire pool\n this.subscriber = null;\n //The slot range for which this subscriber is responsible\n this.slotRange = [];\n this.onSubscriberEnd = () => {\n if (!this.started) {\n debug(\"subscriber has disconnected, but ClusterSubscriber is not started, so not reconnecting.\");\n return;\n }\n // If the subscriber closes whilst it's still the active connection,\n // we might as well try to connecting to a new node if possible to\n // minimise the number of missed publishes.\n debug(\"subscriber has disconnected, selecting a new one...\");\n this.selectSubscriber();\n };\n // If the current node we're using as the subscriber disappears\n // from the node pool for some reason, we will select a new one\n // to connect to.\n // Note that this event is only triggered if the connection to\n // the node has been used; cluster subscriptions are setup with\n // lazyConnect = true. It's possible for the subscriber node to\n // disappear without this method being called!\n // See https://github.com/luin/ioredis/pull/1589\n this.connectionPool.on(\"-node\", (_, key) => {\n if (!this.started || !this.subscriber) {\n return;\n }\n if ((0, util_1.getNodeKey)(this.subscriber.options) === key) {\n debug(\"subscriber has left, selecting a new one...\");\n this.selectSubscriber();\n }\n });\n this.connectionPool.on(\"+node\", () => {\n if (!this.started || this.subscriber) {\n return;\n }\n debug(\"a new node is discovered and there is no subscriber, selecting a new one...\");\n this.selectSubscriber();\n });\n }\n getInstance() {\n return this.subscriber;\n }\n /**\n * Associate this subscriber to a specific slot range.\n *\n * Returns the range or an empty array if the slot range couldn't be associated.\n *\n * BTW: This is more for debugging and testing purposes.\n *\n * @param range\n */\n associateSlotRange(range) {\n if (this.isSharded) {\n this.slotRange = range;\n }\n return this.slotRange;\n }\n start() {\n this.started = true;\n this.selectSubscriber();\n debug(\"started\");\n }\n stop() {\n this.started = false;\n if (this.subscriber) {\n this.subscriber.disconnect();\n this.subscriber = null;\n }\n }\n isStarted() {\n return this.started;\n }\n selectSubscriber() {\n const lastActiveSubscriber = this.lastActiveSubscriber;\n // Disconnect the previous subscriber even if there\n // will not be a new one.\n if (lastActiveSubscriber) {\n lastActiveSubscriber.off(\"end\", this.onSubscriberEnd);\n lastActiveSubscriber.disconnect();\n }\n if (this.subscriber) {\n this.subscriber.off(\"end\", this.onSubscriberEnd);\n this.subscriber.disconnect();\n }\n const sampleNode = (0, utils_1.sample)(this.connectionPool.getNodes());\n if (!sampleNode) {\n debug(\"selecting subscriber failed since there is no node discovered in the cluster yet\");\n this.subscriber = null;\n return;\n }\n const { options } = sampleNode;\n debug(\"selected a subscriber %s:%s\", options.host, options.port);\n /*\n * Create a specialized Redis connection for the subscription.\n * Note that auto reconnection is enabled here.\n *\n * `enableReadyCheck` is also enabled because although subscription is allowed\n * while redis is loading data from the disk, we can check if the password\n * provided for the subscriber is correct, and if not, the current subscriber\n * will be disconnected and a new subscriber will be selected.\n */\n let connectionPrefix = \"subscriber\";\n if (this.isSharded)\n connectionPrefix = \"ssubscriber\";\n this.subscriber = new Redis_1.default({\n port: options.port,\n host: options.host,\n username: options.username,\n password: options.password,\n enableReadyCheck: true,\n connectionName: (0, util_1.getConnectionName)(connectionPrefix, options.connectionName),\n lazyConnect: true,\n tls: options.tls,\n // Don't try to reconnect the subscriber connection. If the connection fails\n // we will get an end event (handled below), at which point we'll pick a new\n // node from the pool and try to connect to that as the subscriber connection.\n retryStrategy: null,\n });\n // Ignore the errors since they're handled in the connection pool.\n this.subscriber.on(\"error\", utils_1.noop);\n this.subscriber.on(\"moved\", () => {\n this.emitter.emit(\"forceRefresh\");\n });\n // The node we lost connection to may not come back up in a\n // reasonable amount of time (e.g. a slave that's taken down\n // for maintainence), we could potentially miss many published\n // messages so we should reconnect as quickly as possible, to\n // a different node if needed.\n this.subscriber.once(\"end\", this.onSubscriberEnd);\n // Re-subscribe previous channels\n const previousChannels = { subscribe: [], psubscribe: [], ssubscribe: [] };\n if (lastActiveSubscriber) {\n const condition = lastActiveSubscriber.condition || lastActiveSubscriber.prevCondition;\n if (condition && condition.subscriber) {\n previousChannels.subscribe = condition.subscriber.channels(\"subscribe\");\n previousChannels.psubscribe =\n condition.subscriber.channels(\"psubscribe\");\n previousChannels.ssubscribe =\n condition.subscriber.channels(\"ssubscribe\");\n }\n }\n if (previousChannels.subscribe.length ||\n previousChannels.psubscribe.length ||\n previousChannels.ssubscribe.length) {\n let pending = 0;\n for (const type of [\"subscribe\", \"psubscribe\", \"ssubscribe\"]) {\n const channels = previousChannels[type];\n if (channels.length == 0) {\n continue;\n }\n debug(\"%s %d channels\", type, channels.length);\n if (type === \"ssubscribe\") {\n for (const channel of channels) {\n pending += 1;\n this.subscriber[type](channel)\n .then(() => {\n if (!--pending) {\n this.lastActiveSubscriber = this.subscriber;\n }\n })\n .catch(() => {\n // TODO: should probably disconnect the subscriber and try again.\n debug(\"failed to ssubscribe to channel: %s\", channel);\n });\n }\n }\n else {\n pending += 1;\n this.subscriber[type](channels)\n .then(() => {\n if (!--pending) {\n this.lastActiveSubscriber = this.subscriber;\n }\n })\n .catch(() => {\n // TODO: should probably disconnect the subscriber and try again.\n debug(\"failed to %s %d channels\", type, channels.length);\n });\n }\n }\n }\n else {\n this.lastActiveSubscriber = this.subscriber;\n }\n for (const event of [\n \"message\",\n \"messageBuffer\",\n ]) {\n this.subscriber.on(event, (arg1, arg2) => {\n this.emitter.emit(event, arg1, arg2);\n });\n }\n for (const event of [\"pmessage\", \"pmessageBuffer\"]) {\n this.subscriber.on(event, (arg1, arg2, arg3) => {\n this.emitter.emit(event, arg1, arg2, arg3);\n });\n }\n if (this.isSharded == true) {\n for (const event of [\n \"smessage\",\n \"smessageBuffer\",\n ]) {\n this.subscriber.on(event, (arg1, arg2) => {\n this.emitter.emit(event, arg1, arg2);\n });\n }\n }\n }\n}\nexports.default = ClusterSubscriber;\n",
37
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst events_1 = require(\"events\");\nconst utils_1 = require(\"../utils\");\nconst util_1 = require(\"./util\");\nconst Redis_1 = require(\"../Redis\");\nconst debug = (0, utils_1.Debug)(\"cluster:connectionPool\");\nclass ConnectionPool extends events_1.EventEmitter {\n constructor(redisOptions) {\n super();\n this.redisOptions = redisOptions;\n // master + slave = all\n this.nodes = {\n all: {},\n master: {},\n slave: {},\n };\n this.specifiedOptions = {};\n }\n getNodes(role = \"all\") {\n const nodes = this.nodes[role];\n return Object.keys(nodes).map((key) => nodes[key]);\n }\n getInstanceByKey(key) {\n return this.nodes.all[key];\n }\n getSampleInstance(role) {\n const keys = Object.keys(this.nodes[role]);\n const sampleKey = (0, utils_1.sample)(keys);\n return this.nodes[role][sampleKey];\n }\n /**\n * Add a master node to the pool\n * @param node\n */\n addMasterNode(node) {\n const key = (0, util_1.getNodeKey)(node.options);\n const redis = this.createRedisFromOptions(node, node.options.readOnly);\n //Master nodes aren't read-only\n if (!node.options.readOnly) {\n this.nodes.all[key] = redis;\n this.nodes.master[key] = redis;\n return true;\n }\n return false;\n }\n /**\n * Creates a Redis connection instance from the node options\n * @param node\n * @param readOnly\n */\n createRedisFromOptions(node, readOnly) {\n const redis = new Redis_1.default((0, utils_1.defaults)({\n // Never try to reconnect when a node is lose,\n // instead, waiting for a `MOVED` error and\n // fetch the slots again.\n retryStrategy: null,\n // Offline queue should be enabled so that\n // we don't need to wait for the `ready` event\n // before sending commands to the node.\n enableOfflineQueue: true,\n readOnly: readOnly,\n }, node, this.redisOptions, { lazyConnect: true }));\n return redis;\n }\n /**\n * Find or create a connection to the node\n */\n findOrCreate(node, readOnly = false) {\n const key = (0, util_1.getNodeKey)(node);\n readOnly = Boolean(readOnly);\n if (this.specifiedOptions[key]) {\n Object.assign(node, this.specifiedOptions[key]);\n }\n else {\n this.specifiedOptions[key] = node;\n }\n let redis;\n if (this.nodes.all[key]) {\n redis = this.nodes.all[key];\n if (redis.options.readOnly !== readOnly) {\n redis.options.readOnly = readOnly;\n debug(\"Change role of %s to %s\", key, readOnly ? \"slave\" : \"master\");\n redis[readOnly ? \"readonly\" : \"readwrite\"]().catch(utils_1.noop);\n if (readOnly) {\n delete this.nodes.master[key];\n this.nodes.slave[key] = redis;\n }\n else {\n delete this.nodes.slave[key];\n this.nodes.master[key] = redis;\n }\n }\n }\n else {\n debug(\"Connecting to %s as %s\", key, readOnly ? \"slave\" : \"master\");\n redis = this.createRedisFromOptions(node, readOnly);\n this.nodes.all[key] = redis;\n this.nodes[readOnly ? \"slave\" : \"master\"][key] = redis;\n redis.once(\"end\", () => {\n this.removeNode(key);\n this.emit(\"-node\", redis, key);\n if (!Object.keys(this.nodes.all).length) {\n this.emit(\"drain\");\n }\n });\n this.emit(\"+node\", redis, key);\n redis.on(\"error\", function (error) {\n this.emit(\"nodeError\", error, key);\n });\n }\n return redis;\n }\n /**\n * Reset the pool with a set of nodes.\n * The old node will be removed.\n */\n reset(nodes) {\n debug(\"Reset with %O\", nodes);\n const newNodes = {};\n nodes.forEach((node) => {\n const key = (0, util_1.getNodeKey)(node);\n // Don't override the existing (master) node\n // when the current one is slave.\n if (!(node.readOnly && newNodes[key])) {\n newNodes[key] = node;\n }\n });\n Object.keys(this.nodes.all).forEach((key) => {\n if (!newNodes[key]) {\n debug(\"Disconnect %s because the node does not hold any slot\", key);\n this.nodes.all[key].disconnect();\n this.removeNode(key);\n }\n });\n Object.keys(newNodes).forEach((key) => {\n const node = newNodes[key];\n this.findOrCreate(node, node.readOnly);\n });\n }\n /**\n * Remove a node from the pool.\n */\n removeNode(key) {\n const { nodes } = this;\n if (nodes.all[key]) {\n debug(\"Remove %s from the pool\", key);\n delete nodes.all[key];\n }\n delete nodes.master[key];\n delete nodes.slave[key];\n }\n}\nexports.default = ConnectionPool;\n",
38
+ "'use strict';\n\n/**\n * Custom implementation of a double ended queue.\n */\nfunction Denque(array, options) {\n var options = options || {};\n this._capacity = options.capacity;\n\n this._head = 0;\n this._tail = 0;\n\n if (Array.isArray(array)) {\n this._fromArray(array);\n } else {\n this._capacityMask = 0x3;\n this._list = new Array(4);\n }\n}\n\n/**\n * --------------\n * PUBLIC API\n * -------------\n */\n\n/**\n * Returns the item at the specified index from the list.\n * 0 is the first element, 1 is the second, and so on...\n * Elements at negative values are that many from the end: -1 is one before the end\n * (the last element), -2 is two before the end (one before last), etc.\n * @param index\n * @returns {*}\n */\nDenque.prototype.peekAt = function peekAt(index) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n var len = this.size();\n if (i >= len || i < -len) return undefined;\n if (i < 0) i += len;\n i = (this._head + i) & this._capacityMask;\n return this._list[i];\n};\n\n/**\n * Alias for peekAt()\n * @param i\n * @returns {*}\n */\nDenque.prototype.get = function get(i) {\n return this.peekAt(i);\n};\n\n/**\n * Returns the first item in the list without removing it.\n * @returns {*}\n */\nDenque.prototype.peek = function peek() {\n if (this._head === this._tail) return undefined;\n return this._list[this._head];\n};\n\n/**\n * Alias for peek()\n * @returns {*}\n */\nDenque.prototype.peekFront = function peekFront() {\n return this.peek();\n};\n\n/**\n * Returns the item that is at the back of the queue without removing it.\n * Uses peekAt(-1)\n */\nDenque.prototype.peekBack = function peekBack() {\n return this.peekAt(-1);\n};\n\n/**\n * Returns the current length of the queue\n * @return {Number}\n */\nObject.defineProperty(Denque.prototype, 'length', {\n get: function length() {\n return this.size();\n }\n});\n\n/**\n * Return the number of items on the list, or 0 if empty.\n * @returns {number}\n */\nDenque.prototype.size = function size() {\n if (this._head === this._tail) return 0;\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Add an item at the beginning of the list.\n * @param item\n */\nDenque.prototype.unshift = function unshift(item) {\n if (arguments.length === 0) return this.size();\n var len = this._list.length;\n this._head = (this._head - 1 + len) & this._capacityMask;\n this._list[this._head] = item;\n if (this._tail === this._head) this._growArray();\n if (this._capacity && this.size() > this._capacity) this.pop();\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Remove and return the first item on the list,\n * Returns undefined if the list is empty.\n * @returns {*}\n */\nDenque.prototype.shift = function shift() {\n var head = this._head;\n if (head === this._tail) return undefined;\n var item = this._list[head];\n this._list[head] = undefined;\n this._head = (head + 1) & this._capacityMask;\n if (head < 2 && this._tail > 10000 && this._tail <= this._list.length >>> 2) this._shrinkArray();\n return item;\n};\n\n/**\n * Add an item to the bottom of the list.\n * @param item\n */\nDenque.prototype.push = function push(item) {\n if (arguments.length === 0) return this.size();\n var tail = this._tail;\n this._list[tail] = item;\n this._tail = (tail + 1) & this._capacityMask;\n if (this._tail === this._head) {\n this._growArray();\n }\n if (this._capacity && this.size() > this._capacity) {\n this.shift();\n }\n if (this._head < this._tail) return this._tail - this._head;\n else return this._capacityMask + 1 - (this._head - this._tail);\n};\n\n/**\n * Remove and return the last item on the list.\n * Returns undefined if the list is empty.\n * @returns {*}\n */\nDenque.prototype.pop = function pop() {\n var tail = this._tail;\n if (tail === this._head) return undefined;\n var len = this._list.length;\n this._tail = (tail - 1 + len) & this._capacityMask;\n var item = this._list[this._tail];\n this._list[this._tail] = undefined;\n if (this._head < 2 && tail > 10000 && tail <= len >>> 2) this._shrinkArray();\n return item;\n};\n\n/**\n * Remove and return the item at the specified index from the list.\n * Returns undefined if the list is empty.\n * @param index\n * @returns {*}\n */\nDenque.prototype.removeOne = function removeOne(index) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n if (this._head === this._tail) return void 0;\n var size = this.size();\n var len = this._list.length;\n if (i >= size || i < -size) return void 0;\n if (i < 0) i += size;\n i = (this._head + i) & this._capacityMask;\n var item = this._list[i];\n var k;\n if (index < size / 2) {\n for (k = index; k > 0; k--) {\n this._list[i] = this._list[i = (i - 1 + len) & this._capacityMask];\n }\n this._list[i] = void 0;\n this._head = (this._head + 1 + len) & this._capacityMask;\n } else {\n for (k = size - 1 - index; k > 0; k--) {\n this._list[i] = this._list[i = (i + 1 + len) & this._capacityMask];\n }\n this._list[i] = void 0;\n this._tail = (this._tail - 1 + len) & this._capacityMask;\n }\n return item;\n};\n\n/**\n * Remove number of items from the specified index from the list.\n * Returns array of removed items.\n * Returns undefined if the list is empty.\n * @param index\n * @param count\n * @returns {array}\n */\nDenque.prototype.remove = function remove(index, count) {\n var i = index;\n var removed;\n var del_count = count;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n if (this._head === this._tail) return void 0;\n var size = this.size();\n var len = this._list.length;\n if (i >= size || i < -size || count < 1) return void 0;\n if (i < 0) i += size;\n if (count === 1 || !count) {\n removed = new Array(1);\n removed[0] = this.removeOne(i);\n return removed;\n }\n if (i === 0 && i + count >= size) {\n removed = this.toArray();\n this.clear();\n return removed;\n }\n if (i + count > size) count = size - i;\n var k;\n removed = new Array(count);\n for (k = 0; k < count; k++) {\n removed[k] = this._list[(this._head + i + k) & this._capacityMask];\n }\n i = (this._head + i) & this._capacityMask;\n if (index + count === size) {\n this._tail = (this._tail - count + len) & this._capacityMask;\n for (k = count; k > 0; k--) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n }\n return removed;\n }\n if (index === 0) {\n this._head = (this._head + count + len) & this._capacityMask;\n for (k = count - 1; k > 0; k--) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n }\n return removed;\n }\n if (i < size / 2) {\n this._head = (this._head + index + count + len) & this._capacityMask;\n for (k = index; k > 0; k--) {\n this.unshift(this._list[i = (i - 1 + len) & this._capacityMask]);\n }\n i = (this._head - 1 + len) & this._capacityMask;\n while (del_count > 0) {\n this._list[i = (i - 1 + len) & this._capacityMask] = void 0;\n del_count--;\n }\n if (index < 0) this._tail = i;\n } else {\n this._tail = i;\n i = (i + count + len) & this._capacityMask;\n for (k = size - (count + index); k > 0; k--) {\n this.push(this._list[i++]);\n }\n i = this._tail;\n while (del_count > 0) {\n this._list[i = (i + 1 + len) & this._capacityMask] = void 0;\n del_count--;\n }\n }\n if (this._head < 2 && this._tail > 10000 && this._tail <= len >>> 2) this._shrinkArray();\n return removed;\n};\n\n/**\n * Native splice implementation.\n * Remove number of items from the specified index from the list and/or add new elements.\n * Returns array of removed items or empty array if count == 0.\n * Returns undefined if the list is empty.\n *\n * @param index\n * @param count\n * @param {...*} [elements]\n * @returns {array}\n */\nDenque.prototype.splice = function splice(index, count) {\n var i = index;\n // expect a number or return undefined\n if ((i !== (i | 0))) {\n return void 0;\n }\n var size = this.size();\n if (i < 0) i += size;\n if (i > size) return void 0;\n if (arguments.length > 2) {\n var k;\n var temp;\n var removed;\n var arg_len = arguments.length;\n var len = this._list.length;\n var arguments_index = 2;\n if (!size || i < size / 2) {\n temp = new Array(i);\n for (k = 0; k < i; k++) {\n temp[k] = this._list[(this._head + k) & this._capacityMask];\n }\n if (count === 0) {\n removed = [];\n if (i > 0) {\n this._head = (this._head + i + len) & this._capacityMask;\n }\n } else {\n removed = this.remove(i, count);\n this._head = (this._head + i + len) & this._capacityMask;\n }\n while (arg_len > arguments_index) {\n this.unshift(arguments[--arg_len]);\n }\n for (k = i; k > 0; k--) {\n this.unshift(temp[k - 1]);\n }\n } else {\n temp = new Array(size - (i + count));\n var leng = temp.length;\n for (k = 0; k < leng; k++) {\n temp[k] = this._list[(this._head + i + count + k) & this._capacityMask];\n }\n if (count === 0) {\n removed = [];\n if (i != size) {\n this._tail = (this._head + i + len) & this._capacityMask;\n }\n } else {\n removed = this.remove(i, count);\n this._tail = (this._tail - leng + len) & this._capacityMask;\n }\n while (arguments_index < arg_len) {\n this.push(arguments[arguments_index++]);\n }\n for (k = 0; k < leng; k++) {\n this.push(temp[k]);\n }\n }\n return removed;\n } else {\n return this.remove(i, count);\n }\n};\n\n/**\n * Soft clear - does not reset capacity.\n */\nDenque.prototype.clear = function clear() {\n this._list = new Array(this._list.length);\n this._head = 0;\n this._tail = 0;\n};\n\n/**\n * Returns true or false whether the list is empty.\n * @returns {boolean}\n */\nDenque.prototype.isEmpty = function isEmpty() {\n return this._head === this._tail;\n};\n\n/**\n * Returns an array of all queue items.\n * @returns {Array}\n */\nDenque.prototype.toArray = function toArray() {\n return this._copyArray(false);\n};\n\n/**\n * -------------\n * INTERNALS\n * -------------\n */\n\n/**\n * Fills the queue with items from an array\n * For use in the constructor\n * @param array\n * @private\n */\nDenque.prototype._fromArray = function _fromArray(array) {\n var length = array.length;\n var capacity = this._nextPowerOf2(length);\n\n this._list = new Array(capacity);\n this._capacityMask = capacity - 1;\n this._tail = length;\n\n for (var i = 0; i < length; i++) this._list[i] = array[i];\n};\n\n/**\n *\n * @param fullCopy\n * @param size Initialize the array with a specific size. Will default to the current list size\n * @returns {Array}\n * @private\n */\nDenque.prototype._copyArray = function _copyArray(fullCopy, size) {\n var src = this._list;\n var capacity = src.length;\n var length = this.length;\n size = size | length;\n\n // No prealloc requested and the buffer is contiguous\n if (size == length && this._head < this._tail) {\n // Simply do a fast slice copy\n return this._list.slice(this._head, this._tail);\n }\n\n var dest = new Array(size);\n\n var k = 0;\n var i;\n if (fullCopy || this._head > this._tail) {\n for (i = this._head; i < capacity; i++) dest[k++] = src[i];\n for (i = 0; i < this._tail; i++) dest[k++] = src[i];\n } else {\n for (i = this._head; i < this._tail; i++) dest[k++] = src[i];\n }\n\n return dest;\n}\n\n/**\n * Grows the internal list array.\n * @private\n */\nDenque.prototype._growArray = function _growArray() {\n if (this._head != 0) {\n // double array size and copy existing data, head to end, then beginning to tail.\n var newList = this._copyArray(true, this._list.length << 1);\n\n this._tail = this._list.length;\n this._head = 0;\n\n this._list = newList;\n } else {\n this._tail = this._list.length;\n this._list.length <<= 1;\n }\n\n this._capacityMask = (this._capacityMask << 1) | 1;\n};\n\n/**\n * Shrinks the internal list array.\n * @private\n */\nDenque.prototype._shrinkArray = function _shrinkArray() {\n this._list.length >>>= 1;\n this._capacityMask >>>= 1;\n};\n\n/**\n * Find the next power of 2, at least 4\n * @private\n * @param {number} num \n * @returns {number}\n */\nDenque.prototype._nextPowerOf2 = function _nextPowerOf2(num) {\n var log2 = Math.log(num) / Math.log(2);\n var nextPow2 = 1 << (log2 + 1);\n\n return Math.max(nextPow2, 4);\n}\n\nmodule.exports = Denque;\n",
39
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst utils_1 = require(\"../utils\");\nconst Deque = require(\"denque\");\nconst debug = (0, utils_1.Debug)(\"delayqueue\");\n/**\n * Queue that runs items after specified duration\n */\nclass DelayQueue {\n constructor() {\n this.queues = {};\n this.timeouts = {};\n }\n /**\n * Add a new item to the queue\n *\n * @param bucket bucket name\n * @param item function that will run later\n * @param options\n */\n push(bucket, item, options) {\n const callback = options.callback || process.nextTick;\n if (!this.queues[bucket]) {\n this.queues[bucket] = new Deque();\n }\n const queue = this.queues[bucket];\n queue.push(item);\n if (!this.timeouts[bucket]) {\n this.timeouts[bucket] = setTimeout(() => {\n callback(() => {\n this.timeouts[bucket] = null;\n this.execute(bucket);\n });\n }, options.timeout);\n }\n }\n execute(bucket) {\n const queue = this.queues[bucket];\n if (!queue) {\n return;\n }\n const { length } = queue;\n if (!length) {\n return;\n }\n debug(\"send %d commands in %s queue\", length, bucket);\n this.queues[bucket] = null;\n while (queue.length > 0) {\n queue.shift()();\n }\n }\n}\nexports.default = DelayQueue;\n",
40
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst utils_1 = require(\"../utils\");\nconst ClusterSubscriber_1 = require(\"./ClusterSubscriber\");\nconst ConnectionPool_1 = require(\"./ConnectionPool\");\nconst util_1 = require(\"./util\");\nconst calculateSlot = require(\"cluster-key-slot\");\nconst debug = (0, utils_1.Debug)(\"cluster:subscriberGroup\");\n/**\n * Redis differs between \"normal\" and sharded PubSub. If using the \"normal\" PubSub feature, exactly one\n * ClusterSubscriber exists per cluster instance. This works because the Redis cluster bus forwards m\n * messages between shards. However, this has scalability limitations, which is the reason why the sharded\n * PubSub feature was added to Redis. With sharded PubSub, each shard is responsible for its own messages.\n * Given that, we need at least one ClusterSubscriber per master endpoint/node.\n *\n * This class leverages the previously exising ClusterSubscriber by adding support for multiple such subscribers\n * in alignment to the master nodes of the cluster. The ClusterSubscriber class was extended in a non-breaking way\n * to support this feature.\n */\nclass ClusterSubscriberGroup {\n /**\n * Register callbacks\n *\n * @param cluster\n */\n constructor(cluster, refreshSlotsCacheCallback) {\n this.cluster = cluster;\n this.shardedSubscribers = new Map();\n this.clusterSlots = [];\n //Simple [min, max] slot ranges aren't enough because you can migrate single slots\n this.subscriberToSlotsIndex = new Map();\n this.channels = new Map();\n cluster.on(\"+node\", (redis) => {\n this._addSubscriber(redis);\n });\n cluster.on(\"-node\", (redis) => {\n this._removeSubscriber(redis);\n });\n cluster.on(\"refresh\", () => {\n this._refreshSlots(cluster);\n });\n cluster.on(\"forceRefresh\", () => {\n refreshSlotsCacheCallback();\n });\n }\n /**\n * Get the responsible subscriber.\n *\n * Returns null if no subscriber was found\n *\n * @param slot\n */\n getResponsibleSubscriber(slot) {\n const nodeKey = this.clusterSlots[slot][0];\n return this.shardedSubscribers.get(nodeKey);\n }\n /**\n * Adds a channel for which this subscriber group is responsible\n *\n * @param channels\n */\n addChannels(channels) {\n const slot = calculateSlot(channels[0]);\n //Check if the all channels belong to the same slot and otherwise reject the operation\n channels.forEach((c) => {\n if (calculateSlot(c) != slot)\n return -1;\n });\n const currChannels = this.channels.get(slot);\n if (!currChannels) {\n this.channels.set(slot, channels);\n }\n else {\n this.channels.set(slot, currChannels.concat(channels));\n }\n return [...this.channels.values()].flatMap(v => v).length;\n }\n /**\n * Removes channels for which the subscriber group is responsible by optionally unsubscribing\n * @param channels\n */\n removeChannels(channels) {\n const slot = calculateSlot(channels[0]);\n //Check if the all channels belong to the same slot and otherwise reject the operation\n channels.forEach((c) => {\n if (calculateSlot(c) != slot)\n return -1;\n });\n const slotChannels = this.channels.get(slot);\n if (slotChannels) {\n const updatedChannels = slotChannels.filter(c => !channels.includes(c));\n this.channels.set(slot, updatedChannels);\n }\n return [...this.channels.values()].flatMap(v => v).length;\n }\n /**\n * Disconnect all subscribers\n */\n stop() {\n for (const s of this.shardedSubscribers.values()) {\n s.stop();\n }\n }\n /**\n * Start all not yet started subscribers\n */\n start() {\n for (const s of this.shardedSubscribers.values()) {\n if (!s.isStarted()) {\n s.start();\n }\n }\n }\n /**\n * Add a subscriber to the group of subscribers\n *\n * @param redis\n */\n _addSubscriber(redis) {\n const pool = new ConnectionPool_1.default(redis.options);\n if (pool.addMasterNode(redis)) {\n const sub = new ClusterSubscriber_1.default(pool, this.cluster, true);\n const nodeKey = (0, util_1.getNodeKey)(redis.options);\n this.shardedSubscribers.set(nodeKey, sub);\n sub.start();\n // We need to attempt to resubscribe them in case the new node serves their slot\n this._resubscribe();\n this.cluster.emit(\"+subscriber\");\n return sub;\n }\n return null;\n }\n /**\n * Removes a subscriber from the group\n * @param redis\n */\n _removeSubscriber(redis) {\n const nodeKey = (0, util_1.getNodeKey)(redis.options);\n const sub = this.shardedSubscribers.get(nodeKey);\n if (sub) {\n sub.stop();\n this.shardedSubscribers.delete(nodeKey);\n // Even though the subscriber to this node is going down, we might have another subscriber\n // handling the same slots, so we need to attempt to subscribe the orphaned channels\n this._resubscribe();\n this.cluster.emit(\"-subscriber\");\n }\n return this.shardedSubscribers;\n }\n /**\n * Refreshes the subscriber-related slot ranges\n *\n * Returns false if no refresh was needed\n *\n * @param cluster\n */\n _refreshSlots(cluster) {\n //If there was an actual change, then reassign the slot ranges\n if (this._slotsAreEqual(cluster.slots)) {\n debug(\"Nothing to refresh because the new cluster map is equal to the previous one.\");\n }\n else {\n debug(\"Refreshing the slots of the subscriber group.\");\n //Rebuild the slots index\n this.subscriberToSlotsIndex = new Map();\n for (let slot = 0; slot < cluster.slots.length; slot++) {\n const node = cluster.slots[slot][0];\n if (!this.subscriberToSlotsIndex.has(node)) {\n this.subscriberToSlotsIndex.set(node, []);\n }\n this.subscriberToSlotsIndex.get(node).push(Number(slot));\n }\n //Update the subscribers from the index\n this._resubscribe();\n //Update the cached slots map\n this.clusterSlots = JSON.parse(JSON.stringify(cluster.slots));\n this.cluster.emit(\"subscribersReady\");\n return true;\n }\n return false;\n }\n /**\n * Resubscribes to the previous channels\n *\n * @private\n */\n _resubscribe() {\n if (this.shardedSubscribers) {\n this.shardedSubscribers.forEach((s, nodeKey) => {\n const subscriberSlots = this.subscriberToSlotsIndex.get(nodeKey);\n if (subscriberSlots) {\n //More for debugging purposes\n s.associateSlotRange(subscriberSlots);\n //Resubscribe on the underlying connection\n subscriberSlots.forEach((ss) => {\n //Might return null if being disconnected\n const redis = s.getInstance();\n const channels = this.channels.get(ss);\n if (channels && channels.length > 0) {\n //Try to subscribe now\n if (redis) {\n redis.ssubscribe(channels);\n //If the instance isn't ready yet, then register the re-subscription for later\n redis.on(\"ready\", () => {\n redis.ssubscribe(channels);\n });\n }\n }\n });\n }\n });\n }\n }\n /**\n * Deep equality of the cluster slots objects\n *\n * @param other\n * @private\n */\n _slotsAreEqual(other) {\n if (this.clusterSlots === undefined)\n return false;\n else\n return JSON.stringify(this.clusterSlots) === JSON.stringify(other);\n }\n}\nexports.default = ClusterSubscriberGroup;\n",
41
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst commands_1 = require(\"@ioredis/commands\");\nconst events_1 = require(\"events\");\nconst redis_errors_1 = require(\"redis-errors\");\nconst standard_as_callback_1 = require(\"standard-as-callback\");\nconst Command_1 = require(\"../Command\");\nconst ClusterAllFailedError_1 = require(\"../errors/ClusterAllFailedError\");\nconst Redis_1 = require(\"../Redis\");\nconst ScanStream_1 = require(\"../ScanStream\");\nconst transaction_1 = require(\"../transaction\");\nconst utils_1 = require(\"../utils\");\nconst applyMixin_1 = require(\"../utils/applyMixin\");\nconst Commander_1 = require(\"../utils/Commander\");\nconst ClusterOptions_1 = require(\"./ClusterOptions\");\nconst ClusterSubscriber_1 = require(\"./ClusterSubscriber\");\nconst ConnectionPool_1 = require(\"./ConnectionPool\");\nconst DelayQueue_1 = require(\"./DelayQueue\");\nconst util_1 = require(\"./util\");\nconst Deque = require(\"denque\");\nconst ClusterSubscriberGroup_1 = require(\"./ClusterSubscriberGroup\");\nconst debug = (0, utils_1.Debug)(\"cluster\");\nconst REJECT_OVERWRITTEN_COMMANDS = new WeakSet();\n/**\n * Client for the official Redis Cluster\n */\nclass Cluster extends Commander_1.default {\n /**\n * Creates an instance of Cluster.\n */\n //TODO: Add an option that enables or disables sharded PubSub\n constructor(startupNodes, options = {}) {\n super();\n this.slots = [];\n /**\n * @ignore\n */\n this._groupsIds = {};\n /**\n * @ignore\n */\n this._groupsBySlot = Array(16384);\n /**\n * @ignore\n */\n this.isCluster = true;\n this.retryAttempts = 0;\n this.delayQueue = new DelayQueue_1.default();\n this.offlineQueue = new Deque();\n this.isRefreshing = false;\n this._refreshSlotsCacheCallbacks = [];\n this._autoPipelines = new Map();\n this._runningAutoPipelines = new Set();\n this._readyDelayedCallbacks = [];\n /**\n * Every time Cluster#connect() is called, this value will be\n * auto-incrementing. The purpose of this value is used for\n * discarding previous connect attampts when creating a new\n * connection.\n */\n this.connectionEpoch = 0;\n events_1.EventEmitter.call(this);\n this.startupNodes = startupNodes;\n this.options = (0, utils_1.defaults)({}, options, ClusterOptions_1.DEFAULT_CLUSTER_OPTIONS, this.options);\n if (this.options.shardedSubscribers == true)\n this.shardedSubscribers = new ClusterSubscriberGroup_1.default(this, this.refreshSlotsCache.bind(this));\n if (this.options.redisOptions &&\n this.options.redisOptions.keyPrefix &&\n !this.options.keyPrefix) {\n this.options.keyPrefix = this.options.redisOptions.keyPrefix;\n }\n // validate options\n if (typeof this.options.scaleReads !== \"function\" &&\n [\"all\", \"master\", \"slave\"].indexOf(this.options.scaleReads) === -1) {\n throw new Error('Invalid option scaleReads \"' +\n this.options.scaleReads +\n '\". Expected \"all\", \"master\", \"slave\" or a custom function');\n }\n this.connectionPool = new ConnectionPool_1.default(this.options.redisOptions);\n this.connectionPool.on(\"-node\", (redis, key) => {\n this.emit(\"-node\", redis);\n });\n this.connectionPool.on(\"+node\", (redis) => {\n this.emit(\"+node\", redis);\n });\n this.connectionPool.on(\"drain\", () => {\n this.setStatus(\"close\");\n });\n this.connectionPool.on(\"nodeError\", (error, key) => {\n this.emit(\"node error\", error, key);\n });\n this.subscriber = new ClusterSubscriber_1.default(this.connectionPool, this);\n if (this.options.scripts) {\n Object.entries(this.options.scripts).forEach(([name, definition]) => {\n this.defineCommand(name, definition);\n });\n }\n if (this.options.lazyConnect) {\n this.setStatus(\"wait\");\n }\n else {\n this.connect().catch((err) => {\n debug(\"connecting failed: %s\", err);\n });\n }\n }\n /**\n * Connect to a cluster\n */\n connect() {\n return new Promise((resolve, reject) => {\n if (this.status === \"connecting\" ||\n this.status === \"connect\" ||\n this.status === \"ready\") {\n reject(new Error(\"Redis is already connecting/connected\"));\n return;\n }\n const epoch = ++this.connectionEpoch;\n this.setStatus(\"connecting\");\n this.resolveStartupNodeHostnames()\n .then((nodes) => {\n if (this.connectionEpoch !== epoch) {\n debug(\"discard connecting after resolving startup nodes because epoch not match: %d != %d\", epoch, this.connectionEpoch);\n reject(new redis_errors_1.RedisError(\"Connection is discarded because a new connection is made\"));\n return;\n }\n if (this.status !== \"connecting\") {\n debug(\"discard connecting after resolving startup nodes because the status changed to %s\", this.status);\n reject(new redis_errors_1.RedisError(\"Connection is aborted\"));\n return;\n }\n this.connectionPool.reset(nodes);\n const readyHandler = () => {\n this.setStatus(\"ready\");\n this.retryAttempts = 0;\n this.executeOfflineCommands();\n this.resetNodesRefreshInterval();\n resolve();\n };\n let closeListener = undefined;\n const refreshListener = () => {\n this.invokeReadyDelayedCallbacks(undefined);\n this.removeListener(\"close\", closeListener);\n this.manuallyClosing = false;\n this.setStatus(\"connect\");\n if (this.options.enableReadyCheck) {\n this.readyCheck((err, fail) => {\n if (err || fail) {\n debug(\"Ready check failed (%s). Reconnecting...\", err || fail);\n if (this.status === \"connect\") {\n this.disconnect(true);\n }\n }\n else {\n readyHandler();\n }\n });\n }\n else {\n readyHandler();\n }\n };\n closeListener = () => {\n const error = new Error(\"None of startup nodes is available\");\n this.removeListener(\"refresh\", refreshListener);\n this.invokeReadyDelayedCallbacks(error);\n reject(error);\n };\n this.once(\"refresh\", refreshListener);\n this.once(\"close\", closeListener);\n this.once(\"close\", this.handleCloseEvent.bind(this));\n this.refreshSlotsCache((err) => {\n if (err && err.message === ClusterAllFailedError_1.default.defaultMessage) {\n Redis_1.default.prototype.silentEmit.call(this, \"error\", err);\n this.connectionPool.reset([]);\n }\n });\n this.subscriber.start();\n if (this.options.shardedSubscribers) {\n this.shardedSubscribers.start();\n }\n })\n .catch((err) => {\n this.setStatus(\"close\");\n this.handleCloseEvent(err);\n this.invokeReadyDelayedCallbacks(err);\n reject(err);\n });\n });\n }\n /**\n * Disconnect from every node in the cluster.\n */\n disconnect(reconnect = false) {\n const status = this.status;\n this.setStatus(\"disconnecting\");\n if (!reconnect) {\n this.manuallyClosing = true;\n }\n if (this.reconnectTimeout && !reconnect) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n debug(\"Canceled reconnecting attempts\");\n }\n this.clearNodesRefreshInterval();\n this.subscriber.stop();\n if (this.options.shardedSubscribers) {\n this.shardedSubscribers.stop();\n }\n if (status === \"wait\") {\n this.setStatus(\"close\");\n this.handleCloseEvent();\n }\n else {\n this.connectionPool.reset([]);\n }\n }\n /**\n * Quit the cluster gracefully.\n */\n quit(callback) {\n const status = this.status;\n this.setStatus(\"disconnecting\");\n this.manuallyClosing = true;\n if (this.reconnectTimeout) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n this.clearNodesRefreshInterval();\n this.subscriber.stop();\n if (this.options.shardedSubscribers) {\n this.shardedSubscribers.stop();\n }\n if (status === \"wait\") {\n const ret = (0, standard_as_callback_1.default)(Promise.resolve(\"OK\"), callback);\n // use setImmediate to make sure \"close\" event\n // being emitted after quit() is returned\n setImmediate(function () {\n this.setStatus(\"close\");\n this.handleCloseEvent();\n }.bind(this));\n return ret;\n }\n return (0, standard_as_callback_1.default)(Promise.all(this.nodes().map((node) => node.quit().catch((err) => {\n // Ignore the error caused by disconnecting since\n // we're disconnecting...\n if (err.message === utils_1.CONNECTION_CLOSED_ERROR_MSG) {\n return \"OK\";\n }\n throw err;\n }))).then(() => \"OK\"), callback);\n }\n /**\n * Create a new instance with the same startup nodes and options as the current one.\n *\n * @example\n * ```js\n * var cluster = new Redis.Cluster([{ host: \"127.0.0.1\", port: \"30001\" }]);\n * var anotherCluster = cluster.duplicate();\n * ```\n */\n duplicate(overrideStartupNodes = [], overrideOptions = {}) {\n const startupNodes = overrideStartupNodes.length > 0\n ? overrideStartupNodes\n : this.startupNodes.slice(0);\n const options = Object.assign({}, this.options, overrideOptions);\n return new Cluster(startupNodes, options);\n }\n /**\n * Get nodes with the specified role\n */\n nodes(role = \"all\") {\n if (role !== \"all\" && role !== \"master\" && role !== \"slave\") {\n throw new Error('Invalid role \"' + role + '\". Expected \"all\", \"master\" or \"slave\"');\n }\n return this.connectionPool.getNodes(role);\n }\n /**\n * This is needed in order not to install a listener for each auto pipeline\n *\n * @ignore\n */\n delayUntilReady(callback) {\n this._readyDelayedCallbacks.push(callback);\n }\n /**\n * Get the number of commands queued in automatic pipelines.\n *\n * This is not available (and returns 0) until the cluster is connected and slots information have been received.\n */\n get autoPipelineQueueSize() {\n let queued = 0;\n for (const pipeline of this._autoPipelines.values()) {\n queued += pipeline.length;\n }\n return queued;\n }\n /**\n * Refresh the slot cache\n *\n * @ignore\n */\n refreshSlotsCache(callback) {\n if (callback) {\n this._refreshSlotsCacheCallbacks.push(callback);\n }\n if (this.isRefreshing) {\n return;\n }\n this.isRefreshing = true;\n const _this = this;\n const wrapper = (error) => {\n this.isRefreshing = false;\n for (const callback of this._refreshSlotsCacheCallbacks) {\n callback(error);\n }\n this._refreshSlotsCacheCallbacks = [];\n };\n const nodes = (0, utils_1.shuffle)(this.connectionPool.getNodes());\n let lastNodeError = null;\n function tryNode(index) {\n if (index === nodes.length) {\n const error = new ClusterAllFailedError_1.default(ClusterAllFailedError_1.default.defaultMessage, lastNodeError);\n return wrapper(error);\n }\n const node = nodes[index];\n const key = `${node.options.host}:${node.options.port}`;\n debug(\"getting slot cache from %s\", key);\n _this.getInfoFromNode(node, function (err) {\n switch (_this.status) {\n case \"close\":\n case \"end\":\n return wrapper(new Error(\"Cluster is disconnected.\"));\n case \"disconnecting\":\n return wrapper(new Error(\"Cluster is disconnecting.\"));\n }\n if (err) {\n _this.emit(\"node error\", err, key);\n lastNodeError = err;\n tryNode(index + 1);\n }\n else {\n _this.emit(\"refresh\");\n wrapper();\n }\n });\n }\n tryNode(0);\n }\n /**\n * @ignore\n */\n sendCommand(command, stream, node) {\n if (this.status === \"wait\") {\n this.connect().catch(utils_1.noop);\n }\n if (this.status === \"end\") {\n command.reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));\n return command.promise;\n }\n let to = this.options.scaleReads;\n if (to !== \"master\") {\n const isCommandReadOnly = command.isReadOnly ||\n ((0, commands_1.exists)(command.name) && (0, commands_1.hasFlag)(command.name, \"readonly\"));\n if (!isCommandReadOnly) {\n to = \"master\";\n }\n }\n let targetSlot = node ? node.slot : command.getSlot();\n const ttl = {};\n const _this = this;\n if (!node && !REJECT_OVERWRITTEN_COMMANDS.has(command)) {\n REJECT_OVERWRITTEN_COMMANDS.add(command);\n const reject = command.reject;\n command.reject = function (err) {\n const partialTry = tryConnection.bind(null, true);\n _this.handleError(err, ttl, {\n moved: function (slot, key) {\n debug(\"command %s is moved to %s\", command.name, key);\n targetSlot = Number(slot);\n if (_this.slots[slot]) {\n _this.slots[slot][0] = key;\n }\n else {\n _this.slots[slot] = [key];\n }\n _this._groupsBySlot[slot] =\n _this._groupsIds[_this.slots[slot].join(\";\")];\n _this.connectionPool.findOrCreate(_this.natMapper(key));\n tryConnection();\n debug(\"refreshing slot caches... (triggered by MOVED error)\");\n _this.refreshSlotsCache();\n },\n ask: function (slot, key) {\n debug(\"command %s is required to ask %s:%s\", command.name, key);\n const mapped = _this.natMapper(key);\n _this.connectionPool.findOrCreate(mapped);\n tryConnection(false, `${mapped.host}:${mapped.port}`);\n },\n tryagain: partialTry,\n clusterDown: partialTry,\n connectionClosed: partialTry,\n maxRedirections: function (redirectionError) {\n reject.call(command, redirectionError);\n },\n defaults: function () {\n reject.call(command, err);\n },\n });\n };\n }\n tryConnection();\n function tryConnection(random, asking) {\n if (_this.status === \"end\") {\n command.reject(new redis_errors_1.AbortError(\"Cluster is ended.\"));\n return;\n }\n let redis;\n if (_this.status === \"ready\" || command.name === \"cluster\") {\n if (node && node.redis) {\n redis = node.redis;\n }\n else if (Command_1.default.checkFlag(\"ENTER_SUBSCRIBER_MODE\", command.name) ||\n Command_1.default.checkFlag(\"EXIT_SUBSCRIBER_MODE\", command.name)) {\n if (_this.options.shardedSubscribers == true &&\n (command.name == \"ssubscribe\" || command.name == \"sunsubscribe\")) {\n const sub = _this.shardedSubscribers.getResponsibleSubscriber(targetSlot);\n let status = -1;\n if (command.name == \"ssubscribe\")\n status = _this.shardedSubscribers.addChannels(command.getKeys());\n if (command.name == \"sunsubscribe\")\n status = _this.shardedSubscribers.removeChannels(command.getKeys());\n if (status !== -1) {\n redis = sub.getInstance();\n }\n else {\n command.reject(new redis_errors_1.AbortError(\"Can't add or remove the given channels. Are they in the same slot?\"));\n }\n }\n else {\n redis = _this.subscriber.getInstance();\n }\n if (!redis) {\n command.reject(new redis_errors_1.AbortError(\"No subscriber for the cluster\"));\n return;\n }\n }\n else {\n if (!random) {\n if (typeof targetSlot === \"number\" && _this.slots[targetSlot]) {\n const nodeKeys = _this.slots[targetSlot];\n if (typeof to === \"function\") {\n const nodes = nodeKeys.map(function (key) {\n return _this.connectionPool.getInstanceByKey(key);\n });\n redis = to(nodes, command);\n if (Array.isArray(redis)) {\n redis = (0, utils_1.sample)(redis);\n }\n if (!redis) {\n redis = nodes[0];\n }\n }\n else {\n let key;\n if (to === \"all\") {\n key = (0, utils_1.sample)(nodeKeys);\n }\n else if (to === \"slave\" && nodeKeys.length > 1) {\n key = (0, utils_1.sample)(nodeKeys, 1);\n }\n else {\n key = nodeKeys[0];\n }\n redis = _this.connectionPool.getInstanceByKey(key);\n }\n }\n if (asking) {\n redis = _this.connectionPool.getInstanceByKey(asking);\n redis.asking();\n }\n }\n if (!redis) {\n redis =\n (typeof to === \"function\"\n ? null\n : _this.connectionPool.getSampleInstance(to)) ||\n _this.connectionPool.getSampleInstance(\"all\");\n }\n }\n if (node && !node.redis) {\n node.redis = redis;\n }\n }\n if (redis) {\n redis.sendCommand(command, stream);\n }\n else if (_this.options.enableOfflineQueue) {\n _this.offlineQueue.push({\n command: command,\n stream: stream,\n node: node,\n });\n }\n else {\n command.reject(new Error(\"Cluster isn't ready and enableOfflineQueue options is false\"));\n }\n }\n return command.promise;\n }\n sscanStream(key, options) {\n return this.createScanStream(\"sscan\", { key, options });\n }\n sscanBufferStream(key, options) {\n return this.createScanStream(\"sscanBuffer\", { key, options });\n }\n hscanStream(key, options) {\n return this.createScanStream(\"hscan\", { key, options });\n }\n hscanBufferStream(key, options) {\n return this.createScanStream(\"hscanBuffer\", { key, options });\n }\n zscanStream(key, options) {\n return this.createScanStream(\"zscan\", { key, options });\n }\n zscanBufferStream(key, options) {\n return this.createScanStream(\"zscanBuffer\", { key, options });\n }\n /**\n * @ignore\n */\n handleError(error, ttl, handlers) {\n if (typeof ttl.value === \"undefined\") {\n ttl.value = this.options.maxRedirections;\n }\n else {\n ttl.value -= 1;\n }\n if (ttl.value <= 0) {\n handlers.maxRedirections(new Error(\"Too many Cluster redirections. Last error: \" + error));\n return;\n }\n const errv = error.message.split(\" \");\n if (errv[0] === \"MOVED\") {\n const timeout = this.options.retryDelayOnMoved;\n if (timeout && typeof timeout === \"number\") {\n this.delayQueue.push(\"moved\", handlers.moved.bind(null, errv[1], errv[2]), { timeout });\n }\n else {\n handlers.moved(errv[1], errv[2]);\n }\n }\n else if (errv[0] === \"ASK\") {\n handlers.ask(errv[1], errv[2]);\n }\n else if (errv[0] === \"TRYAGAIN\") {\n this.delayQueue.push(\"tryagain\", handlers.tryagain, {\n timeout: this.options.retryDelayOnTryAgain,\n });\n }\n else if (errv[0] === \"CLUSTERDOWN\" &&\n this.options.retryDelayOnClusterDown > 0) {\n this.delayQueue.push(\"clusterdown\", handlers.connectionClosed, {\n timeout: this.options.retryDelayOnClusterDown,\n callback: this.refreshSlotsCache.bind(this),\n });\n }\n else if (error.message === utils_1.CONNECTION_CLOSED_ERROR_MSG &&\n this.options.retryDelayOnFailover > 0 &&\n this.status === \"ready\") {\n this.delayQueue.push(\"failover\", handlers.connectionClosed, {\n timeout: this.options.retryDelayOnFailover,\n callback: this.refreshSlotsCache.bind(this),\n });\n }\n else {\n handlers.defaults();\n }\n }\n resetOfflineQueue() {\n this.offlineQueue = new Deque();\n }\n clearNodesRefreshInterval() {\n if (this.slotsTimer) {\n clearTimeout(this.slotsTimer);\n this.slotsTimer = null;\n }\n }\n resetNodesRefreshInterval() {\n if (this.slotsTimer || !this.options.slotsRefreshInterval) {\n return;\n }\n const nextRound = () => {\n this.slotsTimer = setTimeout(() => {\n debug('refreshing slot caches... (triggered by \"slotsRefreshInterval\" option)');\n this.refreshSlotsCache(() => {\n nextRound();\n });\n }, this.options.slotsRefreshInterval);\n };\n nextRound();\n }\n /**\n * Change cluster instance's status\n */\n setStatus(status) {\n debug(\"status: %s -> %s\", this.status || \"[empty]\", status);\n this.status = status;\n process.nextTick(() => {\n this.emit(status);\n });\n }\n /**\n * Called when closed to check whether a reconnection should be made\n */\n handleCloseEvent(reason) {\n if (reason) {\n debug(\"closed because %s\", reason);\n }\n let retryDelay;\n if (!this.manuallyClosing &&\n typeof this.options.clusterRetryStrategy === \"function\") {\n retryDelay = this.options.clusterRetryStrategy.call(this, ++this.retryAttempts, reason);\n }\n if (typeof retryDelay === \"number\") {\n this.setStatus(\"reconnecting\");\n this.reconnectTimeout = setTimeout(() => {\n this.reconnectTimeout = null;\n debug(\"Cluster is disconnected. Retrying after %dms\", retryDelay);\n this.connect().catch(function (err) {\n debug(\"Got error %s when reconnecting. Ignoring...\", err);\n });\n }, retryDelay);\n }\n else {\n this.setStatus(\"end\");\n this.flushQueue(new Error(\"None of startup nodes is available\"));\n }\n }\n /**\n * Flush offline queue with error.\n */\n flushQueue(error) {\n let item;\n while ((item = this.offlineQueue.shift())) {\n item.command.reject(error);\n }\n }\n executeOfflineCommands() {\n if (this.offlineQueue.length) {\n debug(\"send %d commands in offline queue\", this.offlineQueue.length);\n const offlineQueue = this.offlineQueue;\n this.resetOfflineQueue();\n let item;\n while ((item = offlineQueue.shift())) {\n this.sendCommand(item.command, item.stream, item.node);\n }\n }\n }\n natMapper(nodeKey) {\n const key = typeof nodeKey === \"string\"\n ? nodeKey\n : `${nodeKey.host}:${nodeKey.port}`;\n let mapped = null;\n if (this.options.natMap && typeof this.options.natMap === \"function\") {\n mapped = this.options.natMap(key);\n }\n else if (this.options.natMap && typeof this.options.natMap === \"object\") {\n mapped = this.options.natMap[key];\n }\n if (mapped) {\n debug(\"NAT mapping %s -> %O\", key, mapped);\n return Object.assign({}, mapped);\n }\n return typeof nodeKey === \"string\"\n ? (0, util_1.nodeKeyToRedisOptions)(nodeKey)\n : nodeKey;\n }\n getInfoFromNode(redis, callback) {\n if (!redis) {\n return callback(new Error(\"Node is disconnected\"));\n }\n // Use a duplication of the connection to avoid\n // timeouts when the connection is in the blocking\n // mode (e.g. waiting for BLPOP).\n const duplicatedConnection = redis.duplicate({\n enableOfflineQueue: true,\n enableReadyCheck: false,\n retryStrategy: null,\n connectionName: (0, util_1.getConnectionName)(\"refresher\", this.options.redisOptions && this.options.redisOptions.connectionName),\n });\n // Ignore error events since we will handle\n // exceptions for the CLUSTER SLOTS command.\n duplicatedConnection.on(\"error\", utils_1.noop);\n duplicatedConnection.cluster(\"SLOTS\", (0, utils_1.timeout)((err, result) => {\n duplicatedConnection.disconnect();\n if (err) {\n debug(\"error encountered running CLUSTER.SLOTS: %s\", err);\n return callback(err);\n }\n if (this.status === \"disconnecting\" ||\n this.status === \"close\" ||\n this.status === \"end\") {\n debug(\"ignore CLUSTER.SLOTS results (count: %d) since cluster status is %s\", result.length, this.status);\n callback();\n return;\n }\n const nodes = [];\n debug(\"cluster slots result count: %d\", result.length);\n for (let i = 0; i < result.length; ++i) {\n const items = result[i];\n const slotRangeStart = items[0];\n const slotRangeEnd = items[1];\n const keys = [];\n for (let j = 2; j < items.length; j++) {\n if (!items[j][0]) {\n continue;\n }\n const node = this.natMapper({\n host: items[j][0],\n port: items[j][1],\n });\n node.readOnly = j !== 2;\n nodes.push(node);\n keys.push(node.host + \":\" + node.port);\n }\n debug(\"cluster slots result [%d]: slots %d~%d served by %s\", i, slotRangeStart, slotRangeEnd, keys);\n for (let slot = slotRangeStart; slot <= slotRangeEnd; slot++) {\n this.slots[slot] = keys;\n }\n }\n // Assign to each node keys a numeric value to make autopipeline comparison faster.\n this._groupsIds = Object.create(null);\n let j = 0;\n for (let i = 0; i < 16384; i++) {\n const target = (this.slots[i] || []).join(\";\");\n if (!target.length) {\n this._groupsBySlot[i] = undefined;\n continue;\n }\n if (!this._groupsIds[target]) {\n this._groupsIds[target] = ++j;\n }\n this._groupsBySlot[i] = this._groupsIds[target];\n }\n this.connectionPool.reset(nodes);\n callback();\n }, this.options.slotsRefreshTimeout));\n }\n invokeReadyDelayedCallbacks(err) {\n for (const c of this._readyDelayedCallbacks) {\n process.nextTick(c, err);\n }\n this._readyDelayedCallbacks = [];\n }\n /**\n * Check whether Cluster is able to process commands\n */\n readyCheck(callback) {\n this.cluster(\"INFO\", (err, res) => {\n if (err) {\n return callback(err);\n }\n if (typeof res !== \"string\") {\n return callback();\n }\n let state;\n const lines = res.split(\"\\r\\n\");\n for (let i = 0; i < lines.length; ++i) {\n const parts = lines[i].split(\":\");\n if (parts[0] === \"cluster_state\") {\n state = parts[1];\n break;\n }\n }\n if (state === \"fail\") {\n debug(\"cluster state not ok (%s)\", state);\n callback(null, state);\n }\n else {\n callback();\n }\n });\n }\n resolveSrv(hostname) {\n return new Promise((resolve, reject) => {\n this.options.resolveSrv(hostname, (err, records) => {\n if (err) {\n return reject(err);\n }\n const self = this, groupedRecords = (0, util_1.groupSrvRecords)(records), sortedKeys = Object.keys(groupedRecords).sort((a, b) => parseInt(a) - parseInt(b));\n function tryFirstOne(err) {\n if (!sortedKeys.length) {\n return reject(err);\n }\n const key = sortedKeys[0], group = groupedRecords[key], record = (0, util_1.weightSrvRecords)(group);\n if (!group.records.length) {\n sortedKeys.shift();\n }\n self.dnsLookup(record.name).then((host) => resolve({\n host,\n port: record.port,\n }), tryFirstOne);\n }\n tryFirstOne();\n });\n });\n }\n dnsLookup(hostname) {\n return new Promise((resolve, reject) => {\n this.options.dnsLookup(hostname, (err, address) => {\n if (err) {\n debug(\"failed to resolve hostname %s to IP: %s\", hostname, err.message);\n reject(err);\n }\n else {\n debug(\"resolved hostname %s to IP %s\", hostname, address);\n resolve(address);\n }\n });\n });\n }\n /**\n * Normalize startup nodes, and resolving hostnames to IPs.\n *\n * This process happens every time when #connect() is called since\n * #startupNodes and DNS records may chanage.\n */\n async resolveStartupNodeHostnames() {\n if (!Array.isArray(this.startupNodes) || this.startupNodes.length === 0) {\n throw new Error(\"`startupNodes` should contain at least one node.\");\n }\n const startupNodes = (0, util_1.normalizeNodeOptions)(this.startupNodes);\n const hostnames = (0, util_1.getUniqueHostnamesFromOptions)(startupNodes);\n if (hostnames.length === 0) {\n return startupNodes;\n }\n const configs = await Promise.all(hostnames.map((this.options.useSRVRecords ? this.resolveSrv : this.dnsLookup).bind(this)));\n const hostnameToConfig = (0, utils_1.zipMap)(hostnames, configs);\n return startupNodes.map((node) => {\n const config = hostnameToConfig.get(node.host);\n if (!config) {\n return node;\n }\n if (this.options.useSRVRecords) {\n return Object.assign({}, node, config);\n }\n return Object.assign({}, node, { host: config });\n });\n }\n createScanStream(command, { key, options = {} }) {\n return new ScanStream_1.default({\n objectMode: true,\n key: key,\n redis: this,\n command: command,\n ...options,\n });\n }\n}\n(0, applyMixin_1.default)(Cluster, events_1.EventEmitter);\n(0, transaction_1.addTransactionSupport)(Cluster.prototype);\nexports.default = Cluster;\n",
42
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst utils_1 = require(\"../utils\");\nconst debug = (0, utils_1.Debug)(\"AbstractConnector\");\nclass AbstractConnector {\n constructor(disconnectTimeout) {\n this.connecting = false;\n this.disconnectTimeout = disconnectTimeout;\n }\n check(info) {\n return true;\n }\n disconnect() {\n this.connecting = false;\n if (this.stream) {\n const stream = this.stream; // Make sure callbacks refer to the same instance\n const timeout = setTimeout(() => {\n debug(\"stream %s:%s still open, destroying it\", stream.remoteAddress, stream.remotePort);\n stream.destroy();\n }, this.disconnectTimeout);\n stream.on(\"close\", () => clearTimeout(timeout));\n stream.end();\n }\n }\n}\nexports.default = AbstractConnector;\n",
43
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst net_1 = require(\"net\");\nconst tls_1 = require(\"tls\");\nconst utils_1 = require(\"../utils\");\nconst AbstractConnector_1 = require(\"./AbstractConnector\");\nclass StandaloneConnector extends AbstractConnector_1.default {\n constructor(options) {\n super(options.disconnectTimeout);\n this.options = options;\n }\n connect(_) {\n const { options } = this;\n this.connecting = true;\n let connectionOptions;\n if (\"path\" in options && options.path) {\n connectionOptions = {\n path: options.path,\n };\n }\n else {\n connectionOptions = {};\n if (\"port\" in options && options.port != null) {\n connectionOptions.port = options.port;\n }\n if (\"host\" in options && options.host != null) {\n connectionOptions.host = options.host;\n }\n if (\"family\" in options && options.family != null) {\n connectionOptions.family = options.family;\n }\n }\n if (options.tls) {\n Object.assign(connectionOptions, options.tls);\n }\n // TODO:\n // We use native Promise here since other Promise\n // implementation may use different schedulers that\n // cause issue when the stream is resolved in the\n // next tick.\n // Should use the provided promise in the next major\n // version and do not connect before resolved.\n return new Promise((resolve, reject) => {\n process.nextTick(() => {\n if (!this.connecting) {\n reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));\n return;\n }\n try {\n if (options.tls) {\n this.stream = (0, tls_1.connect)(connectionOptions);\n }\n else {\n this.stream = (0, net_1.createConnection)(connectionOptions);\n }\n }\n catch (err) {\n reject(err);\n return;\n }\n this.stream.once(\"error\", (err) => {\n this.firstError = err;\n });\n resolve(this.stream);\n });\n });\n }\n}\nexports.default = StandaloneConnector;\n",
44
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nfunction isSentinelEql(a, b) {\n return ((a.host || \"127.0.0.1\") === (b.host || \"127.0.0.1\") &&\n (a.port || 26379) === (b.port || 26379));\n}\nclass SentinelIterator {\n constructor(sentinels) {\n this.cursor = 0;\n this.sentinels = sentinels.slice(0);\n }\n next() {\n const done = this.cursor >= this.sentinels.length;\n return { done, value: done ? undefined : this.sentinels[this.cursor++] };\n }\n reset(moveCurrentEndpointToFirst) {\n if (moveCurrentEndpointToFirst &&\n this.sentinels.length > 1 &&\n this.cursor !== 1) {\n this.sentinels.unshift(...this.sentinels.splice(this.cursor - 1));\n }\n this.cursor = 0;\n }\n add(sentinel) {\n for (let i = 0; i < this.sentinels.length; i++) {\n if (isSentinelEql(sentinel, this.sentinels[i])) {\n return false;\n }\n }\n this.sentinels.push(sentinel);\n return true;\n }\n toString() {\n return `${JSON.stringify(this.sentinels)} @${this.cursor}`;\n }\n}\nexports.default = SentinelIterator;\n",
45
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.FailoverDetector = void 0;\nconst utils_1 = require(\"../../utils\");\nconst debug = (0, utils_1.Debug)(\"FailoverDetector\");\nconst CHANNEL_NAME = \"+switch-master\";\nclass FailoverDetector {\n // sentinels can't be used for regular commands after this\n constructor(connector, sentinels) {\n this.isDisconnected = false;\n this.connector = connector;\n this.sentinels = sentinels;\n }\n cleanup() {\n this.isDisconnected = true;\n for (const sentinel of this.sentinels) {\n sentinel.client.disconnect();\n }\n }\n async subscribe() {\n debug(\"Starting FailoverDetector\");\n const promises = [];\n for (const sentinel of this.sentinels) {\n const promise = sentinel.client.subscribe(CHANNEL_NAME).catch((err) => {\n debug(\"Failed to subscribe to failover messages on sentinel %s:%s (%s)\", sentinel.address.host || \"127.0.0.1\", sentinel.address.port || 26739, err.message);\n });\n promises.push(promise);\n sentinel.client.on(\"message\", (channel) => {\n if (!this.isDisconnected && channel === CHANNEL_NAME) {\n this.disconnect();\n }\n });\n }\n await Promise.all(promises);\n }\n disconnect() {\n // Avoid disconnecting more than once per failover.\n // A new FailoverDetector will be created after reconnecting.\n this.isDisconnected = true;\n debug(\"Failover detected, disconnecting\");\n // Will call this.cleanup()\n this.connector.disconnect();\n }\n}\nexports.FailoverDetector = FailoverDetector;\n",
46
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SentinelIterator = void 0;\nconst net_1 = require(\"net\");\nconst utils_1 = require(\"../../utils\");\nconst tls_1 = require(\"tls\");\nconst SentinelIterator_1 = require(\"./SentinelIterator\");\nexports.SentinelIterator = SentinelIterator_1.default;\nconst AbstractConnector_1 = require(\"../AbstractConnector\");\nconst Redis_1 = require(\"../../Redis\");\nconst FailoverDetector_1 = require(\"./FailoverDetector\");\nconst debug = (0, utils_1.Debug)(\"SentinelConnector\");\nclass SentinelConnector extends AbstractConnector_1.default {\n constructor(options) {\n super(options.disconnectTimeout);\n this.options = options;\n this.emitter = null;\n this.failoverDetector = null;\n if (!this.options.sentinels.length) {\n throw new Error(\"Requires at least one sentinel to connect to.\");\n }\n if (!this.options.name) {\n throw new Error(\"Requires the name of master.\");\n }\n this.sentinelIterator = new SentinelIterator_1.default(this.options.sentinels);\n }\n check(info) {\n const roleMatches = !info.role || this.options.role === info.role;\n if (!roleMatches) {\n debug(\"role invalid, expected %s, but got %s\", this.options.role, info.role);\n // Start from the next item.\n // Note that `reset` will move the cursor to the previous element,\n // so we advance two steps here.\n this.sentinelIterator.next();\n this.sentinelIterator.next();\n this.sentinelIterator.reset(true);\n }\n return roleMatches;\n }\n disconnect() {\n super.disconnect();\n if (this.failoverDetector) {\n this.failoverDetector.cleanup();\n }\n }\n connect(eventEmitter) {\n this.connecting = true;\n this.retryAttempts = 0;\n let lastError;\n const connectToNext = async () => {\n const endpoint = this.sentinelIterator.next();\n if (endpoint.done) {\n this.sentinelIterator.reset(false);\n const retryDelay = typeof this.options.sentinelRetryStrategy === \"function\"\n ? this.options.sentinelRetryStrategy(++this.retryAttempts)\n : null;\n let errorMsg = typeof retryDelay !== \"number\"\n ? \"All sentinels are unreachable and retry is disabled.\"\n : `All sentinels are unreachable. Retrying from scratch after ${retryDelay}ms.`;\n if (lastError) {\n errorMsg += ` Last error: ${lastError.message}`;\n }\n debug(errorMsg);\n const error = new Error(errorMsg);\n if (typeof retryDelay === \"number\") {\n eventEmitter(\"error\", error);\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n return connectToNext();\n }\n else {\n throw error;\n }\n }\n let resolved = null;\n let err = null;\n try {\n resolved = await this.resolve(endpoint.value);\n }\n catch (error) {\n err = error;\n }\n if (!this.connecting) {\n throw new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG);\n }\n const endpointAddress = endpoint.value.host + \":\" + endpoint.value.port;\n if (resolved) {\n debug(\"resolved: %s:%s from sentinel %s\", resolved.host, resolved.port, endpointAddress);\n if (this.options.enableTLSForSentinelMode && this.options.tls) {\n Object.assign(resolved, this.options.tls);\n this.stream = (0, tls_1.connect)(resolved);\n this.stream.once(\"secureConnect\", this.initFailoverDetector.bind(this));\n }\n else {\n this.stream = (0, net_1.createConnection)(resolved);\n this.stream.once(\"connect\", this.initFailoverDetector.bind(this));\n }\n this.stream.once(\"error\", (err) => {\n this.firstError = err;\n });\n return this.stream;\n }\n else {\n const errorMsg = err\n ? \"failed to connect to sentinel \" +\n endpointAddress +\n \" because \" +\n err.message\n : \"connected to sentinel \" +\n endpointAddress +\n \" successfully, but got an invalid reply: \" +\n resolved;\n debug(errorMsg);\n eventEmitter(\"sentinelError\", new Error(errorMsg));\n if (err) {\n lastError = err;\n }\n return connectToNext();\n }\n };\n return connectToNext();\n }\n async updateSentinels(client) {\n if (!this.options.updateSentinels) {\n return;\n }\n const result = await client.sentinel(\"sentinels\", this.options.name);\n if (!Array.isArray(result)) {\n return;\n }\n result\n .map(utils_1.packObject)\n .forEach((sentinel) => {\n const flags = sentinel.flags ? sentinel.flags.split(\",\") : [];\n if (flags.indexOf(\"disconnected\") === -1 &&\n sentinel.ip &&\n sentinel.port) {\n const endpoint = this.sentinelNatResolve(addressResponseToAddress(sentinel));\n if (this.sentinelIterator.add(endpoint)) {\n debug(\"adding sentinel %s:%s\", endpoint.host, endpoint.port);\n }\n }\n });\n debug(\"Updated internal sentinels: %s\", this.sentinelIterator);\n }\n async resolveMaster(client) {\n const result = await client.sentinel(\"get-master-addr-by-name\", this.options.name);\n await this.updateSentinels(client);\n return this.sentinelNatResolve(Array.isArray(result)\n ? { host: result[0], port: Number(result[1]) }\n : null);\n }\n async resolveSlave(client) {\n const result = await client.sentinel(\"slaves\", this.options.name);\n if (!Array.isArray(result)) {\n return null;\n }\n const availableSlaves = result\n .map(utils_1.packObject)\n .filter((slave) => slave.flags && !slave.flags.match(/(disconnected|s_down|o_down)/));\n return this.sentinelNatResolve(selectPreferredSentinel(availableSlaves, this.options.preferredSlaves));\n }\n sentinelNatResolve(item) {\n if (!item || !this.options.natMap)\n return item;\n const key = `${item.host}:${item.port}`;\n let result = item;\n if (typeof this.options.natMap === \"function\") {\n result = this.options.natMap(key) || item;\n }\n else if (typeof this.options.natMap === \"object\") {\n result = this.options.natMap[key] || item;\n }\n return result;\n }\n connectToSentinel(endpoint, options) {\n const redis = new Redis_1.default({\n port: endpoint.port || 26379,\n host: endpoint.host,\n username: this.options.sentinelUsername || null,\n password: this.options.sentinelPassword || null,\n family: endpoint.family ||\n // @ts-expect-error\n (\"path\" in this.options && this.options.path\n ? undefined\n : // @ts-expect-error\n this.options.family),\n tls: this.options.sentinelTLS,\n retryStrategy: null,\n enableReadyCheck: false,\n connectTimeout: this.options.connectTimeout,\n commandTimeout: this.options.sentinelCommandTimeout,\n ...options,\n });\n // @ts-expect-error\n return redis;\n }\n async resolve(endpoint) {\n const client = this.connectToSentinel(endpoint);\n // ignore the errors since resolve* methods will handle them\n client.on(\"error\", noop);\n try {\n if (this.options.role === \"slave\") {\n return await this.resolveSlave(client);\n }\n else {\n return await this.resolveMaster(client);\n }\n }\n finally {\n client.disconnect();\n }\n }\n async initFailoverDetector() {\n var _a;\n if (!this.options.failoverDetector) {\n return;\n }\n // Move the current sentinel to the first position\n this.sentinelIterator.reset(true);\n const sentinels = [];\n // In case of a large amount of sentinels, limit the number of concurrent connections\n while (sentinels.length < this.options.sentinelMaxConnections) {\n const { done, value } = this.sentinelIterator.next();\n if (done) {\n break;\n }\n const client = this.connectToSentinel(value, {\n lazyConnect: true,\n retryStrategy: this.options.sentinelReconnectStrategy,\n });\n client.on(\"reconnecting\", () => {\n var _a;\n // Tests listen to this event\n (_a = this.emitter) === null || _a === void 0 ? void 0 : _a.emit(\"sentinelReconnecting\");\n });\n sentinels.push({ address: value, client });\n }\n this.sentinelIterator.reset(false);\n if (this.failoverDetector) {\n // Clean up previous detector\n this.failoverDetector.cleanup();\n }\n this.failoverDetector = new FailoverDetector_1.FailoverDetector(this, sentinels);\n await this.failoverDetector.subscribe();\n // Tests listen to this event\n (_a = this.emitter) === null || _a === void 0 ? void 0 : _a.emit(\"failoverSubscribed\");\n }\n}\nexports.default = SentinelConnector;\nfunction selectPreferredSentinel(availableSlaves, preferredSlaves) {\n if (availableSlaves.length === 0) {\n return null;\n }\n let selectedSlave;\n if (typeof preferredSlaves === \"function\") {\n selectedSlave = preferredSlaves(availableSlaves);\n }\n else if (preferredSlaves !== null && typeof preferredSlaves === \"object\") {\n const preferredSlavesArray = Array.isArray(preferredSlaves)\n ? preferredSlaves\n : [preferredSlaves];\n // sort by priority\n preferredSlavesArray.sort((a, b) => {\n // default the priority to 1\n if (!a.prio) {\n a.prio = 1;\n }\n if (!b.prio) {\n b.prio = 1;\n }\n // lowest priority first\n if (a.prio < b.prio) {\n return -1;\n }\n if (a.prio > b.prio) {\n return 1;\n }\n return 0;\n });\n // loop over preferred slaves and return the first match\n for (let p = 0; p < preferredSlavesArray.length; p++) {\n for (let a = 0; a < availableSlaves.length; a++) {\n const slave = availableSlaves[a];\n if (slave.ip === preferredSlavesArray[p].ip) {\n if (slave.port === preferredSlavesArray[p].port) {\n selectedSlave = slave;\n break;\n }\n }\n }\n if (selectedSlave) {\n break;\n }\n }\n }\n // if none of the preferred slaves are available, a random available slave is returned\n if (!selectedSlave) {\n selectedSlave = (0, utils_1.sample)(availableSlaves);\n }\n return addressResponseToAddress(selectedSlave);\n}\nfunction addressResponseToAddress(input) {\n return { host: input.ip, port: Number(input.port) };\n}\nfunction noop() { }\n",
47
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.SentinelConnector = exports.StandaloneConnector = void 0;\nconst StandaloneConnector_1 = require(\"./StandaloneConnector\");\nexports.StandaloneConnector = StandaloneConnector_1.default;\nconst SentinelConnector_1 = require(\"./SentinelConnector\");\nexports.SentinelConnector = SentinelConnector_1.default;\n",
48
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst redis_errors_1 = require(\"redis-errors\");\nclass MaxRetriesPerRequestError extends redis_errors_1.AbortError {\n constructor(maxRetriesPerRequest) {\n const message = `Reached the max retries per request limit (which is ${maxRetriesPerRequest}). Refer to \"maxRetriesPerRequest\" option for details.`;\n super(message);\n Error.captureStackTrace(this, this.constructor);\n }\n get name() {\n return this.constructor.name;\n }\n}\nexports.default = MaxRetriesPerRequestError;\n",
49
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.MaxRetriesPerRequestError = void 0;\nconst MaxRetriesPerRequestError_1 = require(\"./MaxRetriesPerRequestError\");\nexports.MaxRetriesPerRequestError = MaxRetriesPerRequestError_1.default;\n",
50
+ "'use strict'\n\nconst Buffer = require('buffer').Buffer\nconst StringDecoder = require('string_decoder').StringDecoder\nconst decoder = new StringDecoder()\nconst errors = require('redis-errors')\nconst ReplyError = errors.ReplyError\nconst ParserError = errors.ParserError\nvar bufferPool = Buffer.allocUnsafe(32 * 1024)\nvar bufferOffset = 0\nvar interval = null\nvar counter = 0\nvar notDecreased = 0\n\n/**\n * Used for integer numbers only\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|number}\n */\nfunction parseSimpleNumbers (parser) {\n const length = parser.buffer.length - 1\n var offset = parser.offset\n var number = 0\n var sign = 1\n\n if (parser.buffer[offset] === 45) {\n sign = -1\n offset++\n }\n\n while (offset < length) {\n const c1 = parser.buffer[offset++]\n if (c1 === 13) { // \\r\\n\n parser.offset = offset + 1\n return sign * number\n }\n number = (number * 10) + (c1 - 48)\n }\n}\n\n/**\n * Used for integer numbers in case of the returnNumbers option\n *\n * Reading the string as parts of n SMI is more efficient than\n * using a string directly.\n *\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|string}\n */\nfunction parseStringNumbers (parser) {\n const length = parser.buffer.length - 1\n var offset = parser.offset\n var number = 0\n var res = ''\n\n if (parser.buffer[offset] === 45) {\n res += '-'\n offset++\n }\n\n while (offset < length) {\n var c1 = parser.buffer[offset++]\n if (c1 === 13) { // \\r\\n\n parser.offset = offset + 1\n if (number !== 0) {\n res += number\n }\n return res\n } else if (number > 429496728) {\n res += (number * 10) + (c1 - 48)\n number = 0\n } else if (c1 === 48 && number === 0) {\n res += 0\n } else {\n number = (number * 10) + (c1 - 48)\n }\n }\n}\n\n/**\n * Parse a '+' redis simple string response but forward the offsets\n * onto convertBufferRange to generate a string.\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|string|Buffer}\n */\nfunction parseSimpleString (parser) {\n const start = parser.offset\n const buffer = parser.buffer\n const length = buffer.length - 1\n var offset = start\n\n while (offset < length) {\n if (buffer[offset++] === 13) { // \\r\\n\n parser.offset = offset + 1\n if (parser.optionReturnBuffers === true) {\n return parser.buffer.slice(start, offset - 1)\n }\n return parser.buffer.toString('utf8', start, offset - 1)\n }\n }\n}\n\n/**\n * Returns the read length\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|number}\n */\nfunction parseLength (parser) {\n const length = parser.buffer.length - 1\n var offset = parser.offset\n var number = 0\n\n while (offset < length) {\n const c1 = parser.buffer[offset++]\n if (c1 === 13) {\n parser.offset = offset + 1\n return number\n }\n number = (number * 10) + (c1 - 48)\n }\n}\n\n/**\n * Parse a ':' redis integer response\n *\n * If stringNumbers is activated the parser always returns numbers as string\n * This is important for big numbers (number > Math.pow(2, 53)) as js numbers\n * are 64bit floating point numbers with reduced precision\n *\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|number|string}\n */\nfunction parseInteger (parser) {\n if (parser.optionStringNumbers === true) {\n return parseStringNumbers(parser)\n }\n return parseSimpleNumbers(parser)\n}\n\n/**\n * Parse a '$' redis bulk string response\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|null|string}\n */\nfunction parseBulkString (parser) {\n const length = parseLength(parser)\n if (length === undefined) {\n return\n }\n if (length < 0) {\n return null\n }\n const offset = parser.offset + length\n if (offset + 2 > parser.buffer.length) {\n parser.bigStrSize = offset + 2\n parser.totalChunkSize = parser.buffer.length\n parser.bufferCache.push(parser.buffer)\n return\n }\n const start = parser.offset\n parser.offset = offset + 2\n if (parser.optionReturnBuffers === true) {\n return parser.buffer.slice(start, offset)\n }\n return parser.buffer.toString('utf8', start, offset)\n}\n\n/**\n * Parse a '-' redis error response\n * @param {JavascriptRedisParser} parser\n * @returns {ReplyError}\n */\nfunction parseError (parser) {\n var string = parseSimpleString(parser)\n if (string !== undefined) {\n if (parser.optionReturnBuffers === true) {\n string = string.toString()\n }\n return new ReplyError(string)\n }\n}\n\n/**\n * Parsing error handler, resets parser buffer\n * @param {JavascriptRedisParser} parser\n * @param {number} type\n * @returns {undefined}\n */\nfunction handleError (parser, type) {\n const err = new ParserError(\n 'Protocol error, got ' + JSON.stringify(String.fromCharCode(type)) + ' as reply type byte',\n JSON.stringify(parser.buffer),\n parser.offset\n )\n parser.buffer = null\n parser.returnFatalError(err)\n}\n\n/**\n * Parse a '*' redis array response\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|null|any[]}\n */\nfunction parseArray (parser) {\n const length = parseLength(parser)\n if (length === undefined) {\n return\n }\n if (length < 0) {\n return null\n }\n const responses = new Array(length)\n return parseArrayElements(parser, responses, 0)\n}\n\n/**\n * Push a partly parsed array to the stack\n *\n * @param {JavascriptRedisParser} parser\n * @param {any[]} array\n * @param {number} pos\n * @returns {undefined}\n */\nfunction pushArrayCache (parser, array, pos) {\n parser.arrayCache.push(array)\n parser.arrayPos.push(pos)\n}\n\n/**\n * Parse chunked redis array response\n * @param {JavascriptRedisParser} parser\n * @returns {undefined|any[]}\n */\nfunction parseArrayChunks (parser) {\n const tmp = parser.arrayCache.pop()\n var pos = parser.arrayPos.pop()\n if (parser.arrayCache.length) {\n const res = parseArrayChunks(parser)\n if (res === undefined) {\n pushArrayCache(parser, tmp, pos)\n return\n }\n tmp[pos++] = res\n }\n return parseArrayElements(parser, tmp, pos)\n}\n\n/**\n * Parse redis array response elements\n * @param {JavascriptRedisParser} parser\n * @param {Array} responses\n * @param {number} i\n * @returns {undefined|null|any[]}\n */\nfunction parseArrayElements (parser, responses, i) {\n const bufferLength = parser.buffer.length\n while (i < responses.length) {\n const offset = parser.offset\n if (parser.offset >= bufferLength) {\n pushArrayCache(parser, responses, i)\n return\n }\n const response = parseType(parser, parser.buffer[parser.offset++])\n if (response === undefined) {\n if (!(parser.arrayCache.length || parser.bufferCache.length)) {\n parser.offset = offset\n }\n pushArrayCache(parser, responses, i)\n return\n }\n responses[i] = response\n i++\n }\n\n return responses\n}\n\n/**\n * Called the appropriate parser for the specified type.\n *\n * 36: $\n * 43: +\n * 42: *\n * 58: :\n * 45: -\n *\n * @param {JavascriptRedisParser} parser\n * @param {number} type\n * @returns {*}\n */\nfunction parseType (parser, type) {\n switch (type) {\n case 36:\n return parseBulkString(parser)\n case 43:\n return parseSimpleString(parser)\n case 42:\n return parseArray(parser)\n case 58:\n return parseInteger(parser)\n case 45:\n return parseError(parser)\n default:\n return handleError(parser, type)\n }\n}\n\n/**\n * Decrease the bufferPool size over time\n *\n * Balance between increasing and decreasing the bufferPool.\n * Decrease the bufferPool by 10% by removing the first 10% of the current pool.\n * @returns {undefined}\n */\nfunction decreaseBufferPool () {\n if (bufferPool.length > 50 * 1024) {\n if (counter === 1 || notDecreased > counter * 2) {\n const minSliceLen = Math.floor(bufferPool.length / 10)\n const sliceLength = minSliceLen < bufferOffset\n ? bufferOffset\n : minSliceLen\n bufferOffset = 0\n bufferPool = bufferPool.slice(sliceLength, bufferPool.length)\n } else {\n notDecreased++\n counter--\n }\n } else {\n clearInterval(interval)\n counter = 0\n notDecreased = 0\n interval = null\n }\n}\n\n/**\n * Check if the requested size fits in the current bufferPool.\n * If it does not, reset and increase the bufferPool accordingly.\n *\n * @param {number} length\n * @returns {undefined}\n */\nfunction resizeBuffer (length) {\n if (bufferPool.length < length + bufferOffset) {\n const multiplier = length > 1024 * 1024 * 75 ? 2 : 3\n if (bufferOffset > 1024 * 1024 * 111) {\n bufferOffset = 1024 * 1024 * 50\n }\n bufferPool = Buffer.allocUnsafe(length * multiplier + bufferOffset)\n bufferOffset = 0\n counter++\n if (interval === null) {\n interval = setInterval(decreaseBufferPool, 50)\n }\n }\n}\n\n/**\n * Concat a bulk string containing multiple chunks\n *\n * Notes:\n * 1) The first chunk might contain the whole bulk string including the \\r\n * 2) We are only safe to fully add up elements that are neither the first nor any of the last two elements\n *\n * @param {JavascriptRedisParser} parser\n * @returns {String}\n */\nfunction concatBulkString (parser) {\n const list = parser.bufferCache\n const oldOffset = parser.offset\n var chunks = list.length\n var offset = parser.bigStrSize - parser.totalChunkSize\n parser.offset = offset\n if (offset <= 2) {\n if (chunks === 2) {\n return list[0].toString('utf8', oldOffset, list[0].length + offset - 2)\n }\n chunks--\n offset = list[list.length - 2].length + offset\n }\n var res = decoder.write(list[0].slice(oldOffset))\n for (var i = 1; i < chunks - 1; i++) {\n res += decoder.write(list[i])\n }\n res += decoder.end(list[i].slice(0, offset - 2))\n return res\n}\n\n/**\n * Concat the collected chunks from parser.bufferCache.\n *\n * Increases the bufferPool size beforehand if necessary.\n *\n * @param {JavascriptRedisParser} parser\n * @returns {Buffer}\n */\nfunction concatBulkBuffer (parser) {\n const list = parser.bufferCache\n const oldOffset = parser.offset\n const length = parser.bigStrSize - oldOffset - 2\n var chunks = list.length\n var offset = parser.bigStrSize - parser.totalChunkSize\n parser.offset = offset\n if (offset <= 2) {\n if (chunks === 2) {\n return list[0].slice(oldOffset, list[0].length + offset - 2)\n }\n chunks--\n offset = list[list.length - 2].length + offset\n }\n resizeBuffer(length)\n const start = bufferOffset\n list[0].copy(bufferPool, start, oldOffset, list[0].length)\n bufferOffset += list[0].length - oldOffset\n for (var i = 1; i < chunks - 1; i++) {\n list[i].copy(bufferPool, bufferOffset)\n bufferOffset += list[i].length\n }\n list[i].copy(bufferPool, bufferOffset, 0, offset - 2)\n bufferOffset += offset - 2\n return bufferPool.slice(start, bufferOffset)\n}\n\nclass JavascriptRedisParser {\n /**\n * Javascript Redis Parser constructor\n * @param {{returnError: Function, returnReply: Function, returnFatalError?: Function, returnBuffers: boolean, stringNumbers: boolean }} options\n * @constructor\n */\n constructor (options) {\n if (!options) {\n throw new TypeError('Options are mandatory.')\n }\n if (typeof options.returnError !== 'function' || typeof options.returnReply !== 'function') {\n throw new TypeError('The returnReply and returnError options have to be functions.')\n }\n this.setReturnBuffers(!!options.returnBuffers)\n this.setStringNumbers(!!options.stringNumbers)\n this.returnError = options.returnError\n this.returnFatalError = options.returnFatalError || options.returnError\n this.returnReply = options.returnReply\n this.reset()\n }\n\n /**\n * Reset the parser values to the initial state\n *\n * @returns {undefined}\n */\n reset () {\n this.offset = 0\n this.buffer = null\n this.bigStrSize = 0\n this.totalChunkSize = 0\n this.bufferCache = []\n this.arrayCache = []\n this.arrayPos = []\n }\n\n /**\n * Set the returnBuffers option\n *\n * @param {boolean} returnBuffers\n * @returns {undefined}\n */\n setReturnBuffers (returnBuffers) {\n if (typeof returnBuffers !== 'boolean') {\n throw new TypeError('The returnBuffers argument has to be a boolean')\n }\n this.optionReturnBuffers = returnBuffers\n }\n\n /**\n * Set the stringNumbers option\n *\n * @param {boolean} stringNumbers\n * @returns {undefined}\n */\n setStringNumbers (stringNumbers) {\n if (typeof stringNumbers !== 'boolean') {\n throw new TypeError('The stringNumbers argument has to be a boolean')\n }\n this.optionStringNumbers = stringNumbers\n }\n\n /**\n * Parse the redis buffer\n * @param {Buffer} buffer\n * @returns {undefined}\n */\n execute (buffer) {\n if (this.buffer === null) {\n this.buffer = buffer\n this.offset = 0\n } else if (this.bigStrSize === 0) {\n const oldLength = this.buffer.length\n const remainingLength = oldLength - this.offset\n const newBuffer = Buffer.allocUnsafe(remainingLength + buffer.length)\n this.buffer.copy(newBuffer, 0, this.offset, oldLength)\n buffer.copy(newBuffer, remainingLength, 0, buffer.length)\n this.buffer = newBuffer\n this.offset = 0\n if (this.arrayCache.length) {\n const arr = parseArrayChunks(this)\n if (arr === undefined) {\n return\n }\n this.returnReply(arr)\n }\n } else if (this.totalChunkSize + buffer.length >= this.bigStrSize) {\n this.bufferCache.push(buffer)\n var tmp = this.optionReturnBuffers ? concatBulkBuffer(this) : concatBulkString(this)\n this.bigStrSize = 0\n this.bufferCache = []\n this.buffer = buffer\n if (this.arrayCache.length) {\n this.arrayCache[0][this.arrayPos[0]++] = tmp\n tmp = parseArrayChunks(this)\n if (tmp === undefined) {\n return\n }\n }\n this.returnReply(tmp)\n } else {\n this.bufferCache.push(buffer)\n this.totalChunkSize += buffer.length\n return\n }\n\n while (this.offset < this.buffer.length) {\n const offset = this.offset\n const type = this.buffer[this.offset++]\n const response = parseType(this, type)\n if (response === undefined) {\n if (!(this.arrayCache.length || this.bufferCache.length)) {\n this.offset = offset\n }\n return\n }\n\n if (type === 45) {\n this.returnError(response)\n } else {\n this.returnReply(response)\n }\n }\n\n this.buffer = null\n }\n}\n\nmodule.exports = JavascriptRedisParser\n",
51
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\n/**\n * Tiny class to simplify dealing with subscription set\n */\nclass SubscriptionSet {\n constructor() {\n this.set = {\n subscribe: {},\n psubscribe: {},\n ssubscribe: {},\n };\n }\n add(set, channel) {\n this.set[mapSet(set)][channel] = true;\n }\n del(set, channel) {\n delete this.set[mapSet(set)][channel];\n }\n channels(set) {\n return Object.keys(this.set[mapSet(set)]);\n }\n isEmpty() {\n return (this.channels(\"subscribe\").length === 0 &&\n this.channels(\"psubscribe\").length === 0 &&\n this.channels(\"ssubscribe\").length === 0);\n }\n}\nexports.default = SubscriptionSet;\nfunction mapSet(set) {\n if (set === \"unsubscribe\") {\n return \"subscribe\";\n }\n if (set === \"punsubscribe\") {\n return \"psubscribe\";\n }\n if (set === \"sunsubscribe\") {\n return \"ssubscribe\";\n }\n return set;\n}\n",
52
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst Command_1 = require(\"./Command\");\nconst utils_1 = require(\"./utils\");\nconst RedisParser = require(\"redis-parser\");\nconst SubscriptionSet_1 = require(\"./SubscriptionSet\");\nconst debug = (0, utils_1.Debug)(\"dataHandler\");\nclass DataHandler {\n constructor(redis, parserOptions) {\n this.redis = redis;\n const parser = new RedisParser({\n stringNumbers: parserOptions.stringNumbers,\n returnBuffers: true,\n returnError: (err) => {\n this.returnError(err);\n },\n returnFatalError: (err) => {\n this.returnFatalError(err);\n },\n returnReply: (reply) => {\n this.returnReply(reply);\n },\n });\n // prependListener ensures the parser receives and processes data before socket timeout checks are performed\n redis.stream.prependListener(\"data\", (data) => {\n parser.execute(data);\n });\n // prependListener() doesn't enable flowing mode automatically - we need to resume the stream manually\n redis.stream.resume();\n }\n returnFatalError(err) {\n err.message += \". Please report this.\";\n this.redis.recoverFromFatalError(err, err, { offlineQueue: false });\n }\n returnError(err) {\n const item = this.shiftCommand(err);\n if (!item) {\n return;\n }\n err.command = {\n name: item.command.name,\n args: item.command.args,\n };\n if (item.command.name == \"ssubscribe\" && err.message.includes(\"MOVED\")) {\n this.redis.emit(\"moved\");\n return;\n }\n this.redis.handleReconnection(err, item);\n }\n returnReply(reply) {\n if (this.handleMonitorReply(reply)) {\n return;\n }\n if (this.handleSubscriberReply(reply)) {\n return;\n }\n const item = this.shiftCommand(reply);\n if (!item) {\n return;\n }\n if (Command_1.default.checkFlag(\"ENTER_SUBSCRIBER_MODE\", item.command.name)) {\n this.redis.condition.subscriber = new SubscriptionSet_1.default();\n this.redis.condition.subscriber.add(item.command.name, reply[1].toString());\n if (!fillSubCommand(item.command, reply[2])) {\n this.redis.commandQueue.unshift(item);\n }\n }\n else if (Command_1.default.checkFlag(\"EXIT_SUBSCRIBER_MODE\", item.command.name)) {\n if (!fillUnsubCommand(item.command, reply[2])) {\n this.redis.commandQueue.unshift(item);\n }\n }\n else {\n item.command.resolve(reply);\n }\n }\n handleSubscriberReply(reply) {\n if (!this.redis.condition.subscriber) {\n return false;\n }\n const replyType = Array.isArray(reply) ? reply[0].toString() : null;\n debug('receive reply \"%s\" in subscriber mode', replyType);\n switch (replyType) {\n case \"message\":\n if (this.redis.listeners(\"message\").length > 0) {\n // Check if there're listeners to avoid unnecessary `toString()`.\n this.redis.emit(\"message\", reply[1].toString(), reply[2] ? reply[2].toString() : \"\");\n }\n this.redis.emit(\"messageBuffer\", reply[1], reply[2]);\n break;\n case \"pmessage\": {\n const pattern = reply[1].toString();\n if (this.redis.listeners(\"pmessage\").length > 0) {\n this.redis.emit(\"pmessage\", pattern, reply[2].toString(), reply[3].toString());\n }\n this.redis.emit(\"pmessageBuffer\", pattern, reply[2], reply[3]);\n break;\n }\n case \"smessage\": {\n if (this.redis.listeners(\"smessage\").length > 0) {\n this.redis.emit(\"smessage\", reply[1].toString(), reply[2] ? reply[2].toString() : \"\");\n }\n this.redis.emit(\"smessageBuffer\", reply[1], reply[2]);\n break;\n }\n case \"ssubscribe\":\n case \"subscribe\":\n case \"psubscribe\": {\n const channel = reply[1].toString();\n this.redis.condition.subscriber.add(replyType, channel);\n const item = this.shiftCommand(reply);\n if (!item) {\n return;\n }\n if (!fillSubCommand(item.command, reply[2])) {\n this.redis.commandQueue.unshift(item);\n }\n break;\n }\n case \"sunsubscribe\":\n case \"unsubscribe\":\n case \"punsubscribe\": {\n const channel = reply[1] ? reply[1].toString() : null;\n if (channel) {\n this.redis.condition.subscriber.del(replyType, channel);\n }\n const count = reply[2];\n if (Number(count) === 0) {\n this.redis.condition.subscriber = false;\n }\n const item = this.shiftCommand(reply);\n if (!item) {\n return;\n }\n if (!fillUnsubCommand(item.command, count)) {\n this.redis.commandQueue.unshift(item);\n }\n break;\n }\n default: {\n const item = this.shiftCommand(reply);\n if (!item) {\n return;\n }\n item.command.resolve(reply);\n }\n }\n return true;\n }\n handleMonitorReply(reply) {\n if (this.redis.status !== \"monitoring\") {\n return false;\n }\n const replyStr = reply.toString();\n if (replyStr === \"OK\") {\n // Valid commands in the monitoring mode are AUTH and MONITOR,\n // both of which always reply with 'OK'.\n // So if we got an 'OK', we can make certain that\n // the reply is made to AUTH & MONITOR.\n return false;\n }\n // Since commands sent in the monitoring mode will trigger an exception,\n // any replies we received in the monitoring mode should consider to be\n // realtime monitor data instead of result of commands.\n const len = replyStr.indexOf(\" \");\n const timestamp = replyStr.slice(0, len);\n const argIndex = replyStr.indexOf('\"');\n const args = replyStr\n .slice(argIndex + 1, -1)\n .split('\" \"')\n .map((elem) => elem.replace(/\\\\\"/g, '\"'));\n const dbAndSource = replyStr.slice(len + 2, argIndex - 2).split(\" \");\n this.redis.emit(\"monitor\", timestamp, args, dbAndSource[1], dbAndSource[0]);\n return true;\n }\n shiftCommand(reply) {\n const item = this.redis.commandQueue.shift();\n if (!item) {\n const message = \"Command queue state error. If you can reproduce this, please report it.\";\n const error = new Error(message +\n (reply instanceof Error\n ? ` Last error: ${reply.message}`\n : ` Last reply: ${reply.toString()}`));\n this.redis.emit(\"error\", error);\n return null;\n }\n return item;\n }\n}\nexports.default = DataHandler;\nconst remainingRepliesMap = new WeakMap();\nfunction fillSubCommand(command, count) {\n let remainingReplies = remainingRepliesMap.has(command)\n ? remainingRepliesMap.get(command)\n : command.args.length;\n remainingReplies -= 1;\n if (remainingReplies <= 0) {\n command.resolve(count);\n remainingRepliesMap.delete(command);\n return true;\n }\n remainingRepliesMap.set(command, remainingReplies);\n return false;\n}\nfunction fillUnsubCommand(command, count) {\n let remainingReplies = remainingRepliesMap.has(command)\n ? remainingRepliesMap.get(command)\n : command.args.length;\n if (remainingReplies === 0) {\n if (Number(count) === 0) {\n remainingRepliesMap.delete(command);\n command.resolve(count);\n return true;\n }\n return false;\n }\n remainingReplies -= 1;\n if (remainingReplies <= 0) {\n command.resolve(count);\n return true;\n }\n remainingRepliesMap.set(command, remainingReplies);\n return false;\n}\n",
53
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.readyHandler = exports.errorHandler = exports.closeHandler = exports.connectHandler = void 0;\nconst redis_errors_1 = require(\"redis-errors\");\nconst Command_1 = require(\"../Command\");\nconst errors_1 = require(\"../errors\");\nconst utils_1 = require(\"../utils\");\nconst DataHandler_1 = require(\"../DataHandler\");\nconst debug = (0, utils_1.Debug)(\"connection\");\nfunction connectHandler(self) {\n return function () {\n var _a;\n self.setStatus(\"connect\");\n self.resetCommandQueue();\n // AUTH command should be processed before any other commands\n let flushed = false;\n const { connectionEpoch } = self;\n if (self.condition.auth) {\n self.auth(self.condition.auth, function (err) {\n if (connectionEpoch !== self.connectionEpoch) {\n return;\n }\n if (err) {\n if (err.message.indexOf(\"no password is set\") !== -1) {\n console.warn(\"[WARN] Redis server does not require a password, but a password was supplied.\");\n }\n else if (err.message.indexOf(\"without any password configured for the default user\") !== -1) {\n console.warn(\"[WARN] This Redis server's `default` user does not require a password, but a password was supplied\");\n }\n else if (err.message.indexOf(\"wrong number of arguments for 'auth' command\") !== -1) {\n console.warn(`[ERROR] The server returned \"wrong number of arguments for 'auth' command\". You are probably passing both username and password to Redis version 5 or below. You should only pass the 'password' option for Redis version 5 and under.`);\n }\n else {\n flushed = true;\n self.recoverFromFatalError(err, err);\n }\n }\n });\n }\n if (self.condition.select) {\n self.select(self.condition.select).catch((err) => {\n // If the node is in cluster mode, select is disallowed.\n // In this case, reconnect won't help.\n self.silentEmit(\"error\", err);\n });\n }\n /*\n No need to keep the reference of DataHandler here\n because we don't need to do the cleanup.\n `Stream#end()` will remove all listeners for us.\n */\n new DataHandler_1.default(self, {\n stringNumbers: self.options.stringNumbers,\n });\n const clientCommandPromises = [];\n if (self.options.connectionName) {\n debug(\"set the connection name [%s]\", self.options.connectionName);\n clientCommandPromises.push(self.client(\"setname\", self.options.connectionName).catch(utils_1.noop));\n }\n if (!self.options.disableClientInfo) {\n debug(\"set the client info\");\n clientCommandPromises.push((0, utils_1.getPackageMeta)()\n .then((packageMeta) => {\n return self\n .client(\"SETINFO\", \"LIB-VER\", packageMeta.version)\n .catch(utils_1.noop);\n })\n .catch(utils_1.noop));\n clientCommandPromises.push(self\n .client(\"SETINFO\", \"LIB-NAME\", ((_a = self.options) === null || _a === void 0 ? void 0 : _a.clientInfoTag)\n ? `ioredis(${self.options.clientInfoTag})`\n : \"ioredis\")\n .catch(utils_1.noop));\n }\n Promise.all(clientCommandPromises)\n .catch(utils_1.noop)\n .finally(() => {\n if (!self.options.enableReadyCheck) {\n exports.readyHandler(self)();\n }\n if (self.options.enableReadyCheck) {\n self._readyCheck(function (err, info) {\n if (connectionEpoch !== self.connectionEpoch) {\n return;\n }\n if (err) {\n if (!flushed) {\n self.recoverFromFatalError(new Error(\"Ready check failed: \" + err.message), err);\n }\n }\n else {\n if (self.connector.check(info)) {\n exports.readyHandler(self)();\n }\n else {\n self.disconnect(true);\n }\n }\n });\n }\n });\n };\n}\nexports.connectHandler = connectHandler;\nfunction abortError(command) {\n const err = new redis_errors_1.AbortError(\"Command aborted due to connection close\");\n err.command = {\n name: command.name,\n args: command.args,\n };\n return err;\n}\n// If a contiguous set of pipeline commands starts from index zero then they\n// can be safely reattempted. If however we have a chain of pipelined commands\n// starting at index 1 or more it means we received a partial response before\n// the connection close and those pipelined commands must be aborted. For\n// example, if the queue looks like this: [2, 3, 4, 0, 1, 2] then after\n// aborting and purging we'll have a queue that looks like this: [0, 1, 2]\nfunction abortIncompletePipelines(commandQueue) {\n var _a;\n let expectedIndex = 0;\n for (let i = 0; i < commandQueue.length;) {\n const command = (_a = commandQueue.peekAt(i)) === null || _a === void 0 ? void 0 : _a.command;\n const pipelineIndex = command.pipelineIndex;\n if (pipelineIndex === undefined || pipelineIndex === 0) {\n expectedIndex = 0;\n }\n if (pipelineIndex !== undefined && pipelineIndex !== expectedIndex++) {\n commandQueue.remove(i, 1);\n command.reject(abortError(command));\n continue;\n }\n i++;\n }\n}\n// If only a partial transaction result was received before connection close,\n// we have to abort any transaction fragments that may have ended up in the\n// offline queue\nfunction abortTransactionFragments(commandQueue) {\n var _a;\n for (let i = 0; i < commandQueue.length;) {\n const command = (_a = commandQueue.peekAt(i)) === null || _a === void 0 ? void 0 : _a.command;\n if (command.name === \"multi\") {\n break;\n }\n if (command.name === \"exec\") {\n commandQueue.remove(i, 1);\n command.reject(abortError(command));\n break;\n }\n if (command.inTransaction) {\n commandQueue.remove(i, 1);\n command.reject(abortError(command));\n }\n else {\n i++;\n }\n }\n}\nfunction closeHandler(self) {\n return function () {\n const prevStatus = self.status;\n self.setStatus(\"close\");\n if (self.commandQueue.length) {\n abortIncompletePipelines(self.commandQueue);\n }\n if (self.offlineQueue.length) {\n abortTransactionFragments(self.offlineQueue);\n }\n if (prevStatus === \"ready\") {\n if (!self.prevCondition) {\n self.prevCondition = self.condition;\n }\n if (self.commandQueue.length) {\n self.prevCommandQueue = self.commandQueue;\n }\n }\n if (self.manuallyClosing) {\n self.manuallyClosing = false;\n debug(\"skip reconnecting since the connection is manually closed.\");\n return close();\n }\n if (typeof self.options.retryStrategy !== \"function\") {\n debug(\"skip reconnecting because `retryStrategy` is not a function\");\n return close();\n }\n const retryDelay = self.options.retryStrategy(++self.retryAttempts);\n if (typeof retryDelay !== \"number\") {\n debug(\"skip reconnecting because `retryStrategy` doesn't return a number\");\n return close();\n }\n debug(\"reconnect in %sms\", retryDelay);\n self.setStatus(\"reconnecting\", retryDelay);\n self.reconnectTimeout = setTimeout(function () {\n self.reconnectTimeout = null;\n self.connect().catch(utils_1.noop);\n }, retryDelay);\n const { maxRetriesPerRequest } = self.options;\n if (typeof maxRetriesPerRequest === \"number\") {\n if (maxRetriesPerRequest < 0) {\n debug(\"maxRetriesPerRequest is negative, ignoring...\");\n }\n else {\n const remainder = self.retryAttempts % (maxRetriesPerRequest + 1);\n if (remainder === 0) {\n debug(\"reach maxRetriesPerRequest limitation, flushing command queue...\");\n self.flushQueue(new errors_1.MaxRetriesPerRequestError(maxRetriesPerRequest));\n }\n }\n }\n };\n function close() {\n self.setStatus(\"end\");\n self.flushQueue(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));\n }\n}\nexports.closeHandler = closeHandler;\nfunction errorHandler(self) {\n return function (error) {\n debug(\"error: %s\", error);\n self.silentEmit(\"error\", error);\n };\n}\nexports.errorHandler = errorHandler;\nfunction readyHandler(self) {\n return function () {\n self.setStatus(\"ready\");\n self.retryAttempts = 0;\n if (self.options.monitor) {\n self.call(\"monitor\").then(() => self.setStatus(\"monitoring\"), (error) => self.emit(\"error\", error));\n const { sendCommand } = self;\n self.sendCommand = function (command) {\n if (Command_1.default.checkFlag(\"VALID_IN_MONITOR_MODE\", command.name)) {\n return sendCommand.call(self, command);\n }\n command.reject(new Error(\"Connection is in monitoring mode, can't process commands.\"));\n return command.promise;\n };\n self.once(\"close\", function () {\n delete self.sendCommand;\n });\n return;\n }\n const finalSelect = self.prevCondition\n ? self.prevCondition.select\n : self.condition.select;\n if (self.options.readOnly) {\n debug(\"set the connection to readonly mode\");\n self.readonly().catch(utils_1.noop);\n }\n if (self.prevCondition) {\n const condition = self.prevCondition;\n self.prevCondition = null;\n if (condition.subscriber && self.options.autoResubscribe) {\n // We re-select the previous db first since\n // `SELECT` command is not valid in sub mode.\n if (self.condition.select !== finalSelect) {\n debug(\"connect to db [%d]\", finalSelect);\n self.select(finalSelect);\n }\n const subscribeChannels = condition.subscriber.channels(\"subscribe\");\n if (subscribeChannels.length) {\n debug(\"subscribe %d channels\", subscribeChannels.length);\n self.subscribe(subscribeChannels);\n }\n const psubscribeChannels = condition.subscriber.channels(\"psubscribe\");\n if (psubscribeChannels.length) {\n debug(\"psubscribe %d channels\", psubscribeChannels.length);\n self.psubscribe(psubscribeChannels);\n }\n const ssubscribeChannels = condition.subscriber.channels(\"ssubscribe\");\n if (ssubscribeChannels.length) {\n debug(\"ssubscribe %s\", ssubscribeChannels.length);\n for (const channel of ssubscribeChannels) {\n self.ssubscribe(channel);\n }\n }\n }\n }\n if (self.prevCommandQueue) {\n if (self.options.autoResendUnfulfilledCommands) {\n debug(\"resend %d unfulfilled commands\", self.prevCommandQueue.length);\n while (self.prevCommandQueue.length > 0) {\n const item = self.prevCommandQueue.shift();\n if (item.select !== self.condition.select &&\n item.command.name !== \"select\") {\n self.select(item.select);\n }\n self.sendCommand(item.command, item.stream);\n }\n }\n else {\n self.prevCommandQueue = null;\n }\n }\n if (self.offlineQueue.length) {\n debug(\"send %d commands in offline queue\", self.offlineQueue.length);\n const offlineQueue = self.offlineQueue;\n self.resetOfflineQueue();\n while (offlineQueue.length > 0) {\n const item = offlineQueue.shift();\n if (item.select !== self.condition.select &&\n item.command.name !== \"select\") {\n self.select(item.select);\n }\n self.sendCommand(item.command, item.stream);\n }\n }\n if (self.condition.select !== finalSelect) {\n debug(\"connect to db [%d]\", finalSelect);\n self.select(finalSelect);\n }\n };\n}\nexports.readyHandler = readyHandler;\n",
54
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.DEFAULT_REDIS_OPTIONS = void 0;\nexports.DEFAULT_REDIS_OPTIONS = {\n // Connection\n port: 6379,\n host: \"localhost\",\n family: 0,\n connectTimeout: 10000,\n disconnectTimeout: 2000,\n retryStrategy: function (times) {\n return Math.min(times * 50, 2000);\n },\n keepAlive: 0,\n noDelay: true,\n connectionName: null,\n disableClientInfo: false,\n clientInfoTag: undefined,\n // Sentinel\n sentinels: null,\n name: null,\n role: \"master\",\n sentinelRetryStrategy: function (times) {\n return Math.min(times * 10, 1000);\n },\n sentinelReconnectStrategy: function () {\n // This strategy only applies when sentinels are used for detecting\n // a failover, not during initial master resolution.\n // The deployment can still function when some of the sentinels are down\n // for a long period of time, so we may not want to attempt reconnection\n // very often. Therefore the default interval is fairly long (1 minute).\n return 60000;\n },\n natMap: null,\n enableTLSForSentinelMode: false,\n updateSentinels: true,\n failoverDetector: false,\n // Status\n username: null,\n password: null,\n db: 0,\n // Others\n enableOfflineQueue: true,\n enableReadyCheck: true,\n autoResubscribe: true,\n autoResendUnfulfilledCommands: true,\n lazyConnect: false,\n keyPrefix: \"\",\n reconnectOnError: null,\n readOnly: false,\n stringNumbers: false,\n maxRetriesPerRequest: 20,\n maxLoadingRetryTime: 10000,\n enableAutoPipelining: false,\n autoPipeliningIgnoredCommands: [],\n sentinelMaxConnections: 10,\n};\n",
55
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nconst commands_1 = require(\"@ioredis/commands\");\nconst events_1 = require(\"events\");\nconst standard_as_callback_1 = require(\"standard-as-callback\");\nconst cluster_1 = require(\"./cluster\");\nconst Command_1 = require(\"./Command\");\nconst connectors_1 = require(\"./connectors\");\nconst SentinelConnector_1 = require(\"./connectors/SentinelConnector\");\nconst eventHandler = require(\"./redis/event_handler\");\nconst RedisOptions_1 = require(\"./redis/RedisOptions\");\nconst ScanStream_1 = require(\"./ScanStream\");\nconst transaction_1 = require(\"./transaction\");\nconst utils_1 = require(\"./utils\");\nconst applyMixin_1 = require(\"./utils/applyMixin\");\nconst Commander_1 = require(\"./utils/Commander\");\nconst lodash_1 = require(\"./utils/lodash\");\nconst Deque = require(\"denque\");\nconst debug = (0, utils_1.Debug)(\"redis\");\n/**\n * This is the major component of ioredis.\n * Use it to connect to a standalone Redis server or Sentinels.\n *\n * ```typescript\n * const redis = new Redis(); // Default port is 6379\n * async function main() {\n * redis.set(\"foo\", \"bar\");\n * redis.get(\"foo\", (err, result) => {\n * // `result` should be \"bar\"\n * console.log(err, result);\n * });\n * // Or use Promise\n * const result = await redis.get(\"foo\");\n * }\n * ```\n */\nclass Redis extends Commander_1.default {\n constructor(arg1, arg2, arg3) {\n super();\n this.status = \"wait\";\n /**\n * @ignore\n */\n this.isCluster = false;\n this.reconnectTimeout = null;\n this.connectionEpoch = 0;\n this.retryAttempts = 0;\n this.manuallyClosing = false;\n // Prepare autopipelines structures\n this._autoPipelines = new Map();\n this._runningAutoPipelines = new Set();\n this.parseOptions(arg1, arg2, arg3);\n events_1.EventEmitter.call(this);\n this.resetCommandQueue();\n this.resetOfflineQueue();\n if (this.options.Connector) {\n this.connector = new this.options.Connector(this.options);\n }\n else if (this.options.sentinels) {\n const sentinelConnector = new SentinelConnector_1.default(this.options);\n sentinelConnector.emitter = this;\n this.connector = sentinelConnector;\n }\n else {\n this.connector = new connectors_1.StandaloneConnector(this.options);\n }\n if (this.options.scripts) {\n Object.entries(this.options.scripts).forEach(([name, definition]) => {\n this.defineCommand(name, definition);\n });\n }\n // end(or wait) -> connecting -> connect -> ready -> end\n if (this.options.lazyConnect) {\n this.setStatus(\"wait\");\n }\n else {\n this.connect().catch(lodash_1.noop);\n }\n }\n /**\n * Create a Redis instance.\n * This is the same as `new Redis()` but is included for compatibility with node-redis.\n */\n static createClient(...args) {\n return new Redis(...args);\n }\n get autoPipelineQueueSize() {\n let queued = 0;\n for (const pipeline of this._autoPipelines.values()) {\n queued += pipeline.length;\n }\n return queued;\n }\n /**\n * Create a connection to Redis.\n * This method will be invoked automatically when creating a new Redis instance\n * unless `lazyConnect: true` is passed.\n *\n * When calling this method manually, a Promise is returned, which will\n * be resolved when the connection status is ready. The promise can reject\n * if the connection fails, times out, or if Redis is already connecting/connected.\n */\n connect(callback) {\n const promise = new Promise((resolve, reject) => {\n if (this.status === \"connecting\" ||\n this.status === \"connect\" ||\n this.status === \"ready\") {\n reject(new Error(\"Redis is already connecting/connected\"));\n return;\n }\n this.connectionEpoch += 1;\n this.setStatus(\"connecting\");\n const { options } = this;\n this.condition = {\n select: options.db,\n auth: options.username\n ? [options.username, options.password]\n : options.password,\n subscriber: false,\n };\n const _this = this;\n (0, standard_as_callback_1.default)(this.connector.connect(function (type, err) {\n _this.silentEmit(type, err);\n }), function (err, stream) {\n if (err) {\n _this.flushQueue(err);\n _this.silentEmit(\"error\", err);\n reject(err);\n _this.setStatus(\"end\");\n return;\n }\n let CONNECT_EVENT = options.tls ? \"secureConnect\" : \"connect\";\n if (\"sentinels\" in options &&\n options.sentinels &&\n !options.enableTLSForSentinelMode) {\n CONNECT_EVENT = \"connect\";\n }\n _this.stream = stream;\n if (options.noDelay) {\n stream.setNoDelay(true);\n }\n // Node ignores setKeepAlive before connect, therefore we wait for the event:\n // https://github.com/nodejs/node/issues/31663\n if (typeof options.keepAlive === \"number\") {\n if (stream.connecting) {\n stream.once(CONNECT_EVENT, () => {\n stream.setKeepAlive(true, options.keepAlive);\n });\n }\n else {\n stream.setKeepAlive(true, options.keepAlive);\n }\n }\n if (stream.connecting) {\n stream.once(CONNECT_EVENT, eventHandler.connectHandler(_this));\n if (options.connectTimeout) {\n /*\n * Typically, Socket#setTimeout(0) will clear the timer\n * set before. However, in some platforms (Electron 3.x~4.x),\n * the timer will not be cleared. So we introduce a variable here.\n *\n * See https://github.com/electron/electron/issues/14915\n */\n let connectTimeoutCleared = false;\n stream.setTimeout(options.connectTimeout, function () {\n if (connectTimeoutCleared) {\n return;\n }\n stream.setTimeout(0);\n stream.destroy();\n const err = new Error(\"connect ETIMEDOUT\");\n // @ts-expect-error\n err.errorno = \"ETIMEDOUT\";\n // @ts-expect-error\n err.code = \"ETIMEDOUT\";\n // @ts-expect-error\n err.syscall = \"connect\";\n eventHandler.errorHandler(_this)(err);\n });\n stream.once(CONNECT_EVENT, function () {\n connectTimeoutCleared = true;\n stream.setTimeout(0);\n });\n }\n }\n else if (stream.destroyed) {\n const firstError = _this.connector.firstError;\n if (firstError) {\n process.nextTick(() => {\n eventHandler.errorHandler(_this)(firstError);\n });\n }\n process.nextTick(eventHandler.closeHandler(_this));\n }\n else {\n process.nextTick(eventHandler.connectHandler(_this));\n }\n if (!stream.destroyed) {\n stream.once(\"error\", eventHandler.errorHandler(_this));\n stream.once(\"close\", eventHandler.closeHandler(_this));\n }\n const connectionReadyHandler = function () {\n _this.removeListener(\"close\", connectionCloseHandler);\n resolve();\n };\n var connectionCloseHandler = function () {\n _this.removeListener(\"ready\", connectionReadyHandler);\n reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));\n };\n _this.once(\"ready\", connectionReadyHandler);\n _this.once(\"close\", connectionCloseHandler);\n });\n });\n return (0, standard_as_callback_1.default)(promise, callback);\n }\n /**\n * Disconnect from Redis.\n *\n * This method closes the connection immediately,\n * and may lose some pending replies that haven't written to client.\n * If you want to wait for the pending replies, use Redis#quit instead.\n */\n disconnect(reconnect = false) {\n if (!reconnect) {\n this.manuallyClosing = true;\n }\n if (this.reconnectTimeout && !reconnect) {\n clearTimeout(this.reconnectTimeout);\n this.reconnectTimeout = null;\n }\n if (this.status === \"wait\") {\n eventHandler.closeHandler(this)();\n }\n else {\n this.connector.disconnect();\n }\n }\n /**\n * Disconnect from Redis.\n *\n * @deprecated\n */\n end() {\n this.disconnect();\n }\n /**\n * Create a new instance with the same options as the current one.\n *\n * @example\n * ```js\n * var redis = new Redis(6380);\n * var anotherRedis = redis.duplicate();\n * ```\n */\n duplicate(override) {\n return new Redis({ ...this.options, ...override });\n }\n /**\n * Mode of the connection.\n *\n * One of `\"normal\"`, `\"subscriber\"`, or `\"monitor\"`. When the connection is\n * not in `\"normal\"` mode, certain commands are not allowed.\n */\n get mode() {\n var _a;\n return this.options.monitor\n ? \"monitor\"\n : ((_a = this.condition) === null || _a === void 0 ? void 0 : _a.subscriber)\n ? \"subscriber\"\n : \"normal\";\n }\n /**\n * Listen for all requests received by the server in real time.\n *\n * This command will create a new connection to Redis and send a\n * MONITOR command via the new connection in order to avoid disturbing\n * the current connection.\n *\n * @param callback The callback function. If omit, a promise will be returned.\n * @example\n * ```js\n * var redis = new Redis();\n * redis.monitor(function (err, monitor) {\n * // Entering monitoring mode.\n * monitor.on('monitor', function (time, args, source, database) {\n * console.log(time + \": \" + util.inspect(args));\n * });\n * });\n *\n * // supports promise as well as other commands\n * redis.monitor().then(function (monitor) {\n * monitor.on('monitor', function (time, args, source, database) {\n * console.log(time + \": \" + util.inspect(args));\n * });\n * });\n * ```\n */\n monitor(callback) {\n const monitorInstance = this.duplicate({\n monitor: true,\n lazyConnect: false,\n });\n return (0, standard_as_callback_1.default)(new Promise(function (resolve, reject) {\n monitorInstance.once(\"error\", reject);\n monitorInstance.once(\"monitoring\", function () {\n resolve(monitorInstance);\n });\n }), callback);\n }\n /**\n * Send a command to Redis\n *\n * This method is used internally and in most cases you should not\n * use it directly. If you need to send a command that is not supported\n * by the library, you can use the `call` method:\n *\n * ```js\n * const redis = new Redis();\n *\n * redis.call('set', 'foo', 'bar');\n * // or\n * redis.call(['set', 'foo', 'bar']);\n * ```\n *\n * @ignore\n */\n sendCommand(command, stream) {\n var _a, _b;\n if (this.status === \"wait\") {\n this.connect().catch(lodash_1.noop);\n }\n if (this.status === \"end\") {\n command.reject(new Error(utils_1.CONNECTION_CLOSED_ERROR_MSG));\n return command.promise;\n }\n if (((_a = this.condition) === null || _a === void 0 ? void 0 : _a.subscriber) &&\n !Command_1.default.checkFlag(\"VALID_IN_SUBSCRIBER_MODE\", command.name)) {\n command.reject(new Error(\"Connection in subscriber mode, only subscriber commands may be used\"));\n return command.promise;\n }\n if (typeof this.options.commandTimeout === \"number\") {\n command.setTimeout(this.options.commandTimeout);\n }\n let writable = this.status === \"ready\" ||\n (!stream &&\n this.status === \"connect\" &&\n (0, commands_1.exists)(command.name) &&\n ((0, commands_1.hasFlag)(command.name, \"loading\") ||\n Command_1.default.checkFlag(\"HANDSHAKE_COMMANDS\", command.name)));\n if (!this.stream) {\n writable = false;\n }\n else if (!this.stream.writable) {\n writable = false;\n // @ts-expect-error\n }\n else if (this.stream._writableState && this.stream._writableState.ended) {\n // TODO: We should be able to remove this as the PR has already been merged.\n // https://github.com/iojs/io.js/pull/1217\n writable = false;\n }\n if (!writable) {\n if (!this.options.enableOfflineQueue) {\n command.reject(new Error(\"Stream isn't writeable and enableOfflineQueue options is false\"));\n return command.promise;\n }\n if (command.name === \"quit\" && this.offlineQueue.length === 0) {\n this.disconnect();\n command.resolve(Buffer.from(\"OK\"));\n return command.promise;\n }\n // @ts-expect-error\n if (debug.enabled) {\n debug(\"queue command[%s]: %d -> %s(%o)\", this._getDescription(), this.condition.select, command.name, command.args);\n }\n this.offlineQueue.push({\n command: command,\n stream: stream,\n select: this.condition.select,\n });\n }\n else {\n // @ts-expect-error\n if (debug.enabled) {\n debug(\"write command[%s]: %d -> %s(%o)\", this._getDescription(), (_b = this.condition) === null || _b === void 0 ? void 0 : _b.select, command.name, command.args);\n }\n if (stream) {\n if (\"isPipeline\" in stream && stream.isPipeline) {\n stream.write(command.toWritable(stream.destination.redis.stream));\n }\n else {\n stream.write(command.toWritable(stream));\n }\n }\n else {\n this.stream.write(command.toWritable(this.stream));\n }\n this.commandQueue.push({\n command: command,\n stream: stream,\n select: this.condition.select,\n });\n if (Command_1.default.checkFlag(\"WILL_DISCONNECT\", command.name)) {\n this.manuallyClosing = true;\n }\n if (this.options.socketTimeout !== undefined && this.socketTimeoutTimer === undefined) {\n this.setSocketTimeout();\n }\n }\n if (command.name === \"select\" && (0, utils_1.isInt)(command.args[0])) {\n const db = parseInt(command.args[0], 10);\n if (this.condition.select !== db) {\n this.condition.select = db;\n this.emit(\"select\", db);\n debug(\"switch to db [%d]\", this.condition.select);\n }\n }\n return command.promise;\n }\n setSocketTimeout() {\n this.socketTimeoutTimer = setTimeout(() => {\n this.stream.destroy(new Error(`Socket timeout. Expecting data, but didn't receive any in ${this.options.socketTimeout}ms.`));\n this.socketTimeoutTimer = undefined;\n }, this.options.socketTimeout);\n // this handler must run after the \"data\" handler in \"DataHandler\"\n // so that `this.commandQueue.length` will be updated\n this.stream.once(\"data\", () => {\n clearTimeout(this.socketTimeoutTimer);\n this.socketTimeoutTimer = undefined;\n if (this.commandQueue.length === 0)\n return;\n this.setSocketTimeout();\n });\n }\n scanStream(options) {\n return this.createScanStream(\"scan\", { options });\n }\n scanBufferStream(options) {\n return this.createScanStream(\"scanBuffer\", { options });\n }\n sscanStream(key, options) {\n return this.createScanStream(\"sscan\", { key, options });\n }\n sscanBufferStream(key, options) {\n return this.createScanStream(\"sscanBuffer\", { key, options });\n }\n hscanStream(key, options) {\n return this.createScanStream(\"hscan\", { key, options });\n }\n hscanBufferStream(key, options) {\n return this.createScanStream(\"hscanBuffer\", { key, options });\n }\n zscanStream(key, options) {\n return this.createScanStream(\"zscan\", { key, options });\n }\n zscanBufferStream(key, options) {\n return this.createScanStream(\"zscanBuffer\", { key, options });\n }\n /**\n * Emit only when there's at least one listener.\n *\n * @ignore\n */\n silentEmit(eventName, arg) {\n let error;\n if (eventName === \"error\") {\n error = arg;\n if (this.status === \"end\") {\n return;\n }\n if (this.manuallyClosing) {\n // ignore connection related errors when manually disconnecting\n if (error instanceof Error &&\n (error.message === utils_1.CONNECTION_CLOSED_ERROR_MSG ||\n // @ts-expect-error\n error.syscall === \"connect\" ||\n // @ts-expect-error\n error.syscall === \"read\")) {\n return;\n }\n }\n }\n if (this.listeners(eventName).length > 0) {\n return this.emit.apply(this, arguments);\n }\n if (error && error instanceof Error) {\n console.error(\"[ioredis] Unhandled error event:\", error.stack);\n }\n return false;\n }\n /**\n * @ignore\n */\n recoverFromFatalError(_commandError, err, options) {\n this.flushQueue(err, options);\n this.silentEmit(\"error\", err);\n this.disconnect(true);\n }\n /**\n * @ignore\n */\n handleReconnection(err, item) {\n var _a;\n let needReconnect = false;\n if (this.options.reconnectOnError &&\n !Command_1.default.checkFlag(\"IGNORE_RECONNECT_ON_ERROR\", item.command.name)) {\n needReconnect = this.options.reconnectOnError(err);\n }\n switch (needReconnect) {\n case 1:\n case true:\n if (this.status !== \"reconnecting\") {\n this.disconnect(true);\n }\n item.command.reject(err);\n break;\n case 2:\n if (this.status !== \"reconnecting\") {\n this.disconnect(true);\n }\n if (((_a = this.condition) === null || _a === void 0 ? void 0 : _a.select) !== item.select &&\n item.command.name !== \"select\") {\n this.select(item.select);\n }\n // TODO\n // @ts-expect-error\n this.sendCommand(item.command);\n break;\n default:\n item.command.reject(err);\n }\n }\n /**\n * Get description of the connection. Used for debugging.\n */\n _getDescription() {\n let description;\n if (\"path\" in this.options && this.options.path) {\n description = this.options.path;\n }\n else if (this.stream &&\n this.stream.remoteAddress &&\n this.stream.remotePort) {\n description = this.stream.remoteAddress + \":\" + this.stream.remotePort;\n }\n else if (\"host\" in this.options && this.options.host) {\n description = this.options.host + \":\" + this.options.port;\n }\n else {\n // Unexpected\n description = \"\";\n }\n if (this.options.connectionName) {\n description += ` (${this.options.connectionName})`;\n }\n return description;\n }\n resetCommandQueue() {\n this.commandQueue = new Deque();\n }\n resetOfflineQueue() {\n this.offlineQueue = new Deque();\n }\n parseOptions(...args) {\n const options = {};\n let isTls = false;\n for (let i = 0; i < args.length; ++i) {\n const arg = args[i];\n if (arg === null || typeof arg === \"undefined\") {\n continue;\n }\n if (typeof arg === \"object\") {\n (0, lodash_1.defaults)(options, arg);\n }\n else if (typeof arg === \"string\") {\n (0, lodash_1.defaults)(options, (0, utils_1.parseURL)(arg));\n if (arg.startsWith(\"rediss://\")) {\n isTls = true;\n }\n }\n else if (typeof arg === \"number\") {\n options.port = arg;\n }\n else {\n throw new Error(\"Invalid argument \" + arg);\n }\n }\n if (isTls) {\n (0, lodash_1.defaults)(options, { tls: true });\n }\n (0, lodash_1.defaults)(options, Redis.defaultOptions);\n if (typeof options.port === \"string\") {\n options.port = parseInt(options.port, 10);\n }\n if (typeof options.db === \"string\") {\n options.db = parseInt(options.db, 10);\n }\n // @ts-expect-error\n this.options = (0, utils_1.resolveTLSProfile)(options);\n }\n /**\n * Change instance's status\n */\n setStatus(status, arg) {\n // @ts-expect-error\n if (debug.enabled) {\n debug(\"status[%s]: %s -> %s\", this._getDescription(), this.status || \"[empty]\", status);\n }\n this.status = status;\n process.nextTick(this.emit.bind(this, status, arg));\n }\n createScanStream(command, { key, options = {} }) {\n return new ScanStream_1.default({\n objectMode: true,\n key: key,\n redis: this,\n command: command,\n ...options,\n });\n }\n /**\n * Flush offline queue and command queue with error.\n *\n * @param error The error object to send to the commands\n * @param options options\n */\n flushQueue(error, options) {\n options = (0, lodash_1.defaults)({}, options, {\n offlineQueue: true,\n commandQueue: true,\n });\n let item;\n if (options.offlineQueue) {\n while ((item = this.offlineQueue.shift())) {\n item.command.reject(error);\n }\n }\n if (options.commandQueue) {\n if (this.commandQueue.length > 0) {\n if (this.stream) {\n this.stream.removeAllListeners(\"data\");\n }\n while ((item = this.commandQueue.shift())) {\n item.command.reject(error);\n }\n }\n }\n }\n /**\n * Check whether Redis has finished loading the persistent data and is able to\n * process commands.\n */\n _readyCheck(callback) {\n const _this = this;\n this.info(function (err, res) {\n if (err) {\n if (err.message && err.message.includes(\"NOPERM\")) {\n console.warn(`Skipping the ready check because INFO command fails: \"${err.message}\". You can disable ready check with \"enableReadyCheck\". More: https://github.com/luin/ioredis/wiki/Disable-ready-check.`);\n return callback(null, {});\n }\n return callback(err);\n }\n if (typeof res !== \"string\") {\n return callback(null, res);\n }\n const info = {};\n const lines = res.split(\"\\r\\n\");\n for (let i = 0; i < lines.length; ++i) {\n const [fieldName, ...fieldValueParts] = lines[i].split(\":\");\n const fieldValue = fieldValueParts.join(\":\");\n if (fieldValue) {\n info[fieldName] = fieldValue;\n }\n }\n if (!info.loading || info.loading === \"0\") {\n callback(null, info);\n }\n else {\n const loadingEtaMs = (info.loading_eta_seconds || 1) * 1000;\n const retryTime = _this.options.maxLoadingRetryTime &&\n _this.options.maxLoadingRetryTime < loadingEtaMs\n ? _this.options.maxLoadingRetryTime\n : loadingEtaMs;\n debug(\"Redis server still loading, trying again in \" + retryTime + \"ms\");\n setTimeout(function () {\n _this._readyCheck(callback);\n }, retryTime);\n }\n }).catch(lodash_1.noop);\n }\n}\nRedis.Cluster = cluster_1.default;\nRedis.Command = Command_1.default;\n/**\n * Default options\n */\nRedis.defaultOptions = RedisOptions_1.DEFAULT_REDIS_OPTIONS;\n(0, applyMixin_1.default)(Redis, events_1.EventEmitter);\n(0, transaction_1.addTransactionSupport)(Redis.prototype);\nexports.default = Redis;\n",
56
+ "\"use strict\";\nObject.defineProperty(exports, \"__esModule\", { value: true });\nexports.print = exports.ReplyError = exports.SentinelIterator = exports.SentinelConnector = exports.AbstractConnector = exports.Pipeline = exports.ScanStream = exports.Command = exports.Cluster = exports.Redis = exports.default = void 0;\nexports = module.exports = require(\"./Redis\").default;\nvar Redis_1 = require(\"./Redis\");\nObject.defineProperty(exports, \"default\", { enumerable: true, get: function () { return Redis_1.default; } });\nvar Redis_2 = require(\"./Redis\");\nObject.defineProperty(exports, \"Redis\", { enumerable: true, get: function () { return Redis_2.default; } });\nvar cluster_1 = require(\"./cluster\");\nObject.defineProperty(exports, \"Cluster\", { enumerable: true, get: function () { return cluster_1.default; } });\n/**\n * @ignore\n */\nvar Command_1 = require(\"./Command\");\nObject.defineProperty(exports, \"Command\", { enumerable: true, get: function () { return Command_1.default; } });\n/**\n * @ignore\n */\nvar ScanStream_1 = require(\"./ScanStream\");\nObject.defineProperty(exports, \"ScanStream\", { enumerable: true, get: function () { return ScanStream_1.default; } });\n/**\n * @ignore\n */\nvar Pipeline_1 = require(\"./Pipeline\");\nObject.defineProperty(exports, \"Pipeline\", { enumerable: true, get: function () { return Pipeline_1.default; } });\n/**\n * @ignore\n */\nvar AbstractConnector_1 = require(\"./connectors/AbstractConnector\");\nObject.defineProperty(exports, \"AbstractConnector\", { enumerable: true, get: function () { return AbstractConnector_1.default; } });\n/**\n * @ignore\n */\nvar SentinelConnector_1 = require(\"./connectors/SentinelConnector\");\nObject.defineProperty(exports, \"SentinelConnector\", { enumerable: true, get: function () { return SentinelConnector_1.default; } });\nObject.defineProperty(exports, \"SentinelIterator\", { enumerable: true, get: function () { return SentinelConnector_1.SentinelIterator; } });\n// No TS typings\nexports.ReplyError = require(\"redis-errors\").ReplyError;\n/**\n * @ignore\n */\nObject.defineProperty(exports, \"Promise\", {\n get() {\n console.warn(\"ioredis v5 does not support plugging third-party Promise library anymore. Native Promise will be used.\");\n return Promise;\n },\n set(_lib) {\n console.warn(\"ioredis v5 does not support plugging third-party Promise library anymore. Native Promise will be used.\");\n },\n});\n/**\n * @ignore\n */\nfunction print(err, reply) {\n if (err) {\n console.log(\"Error: \" + err);\n }\n else {\n console.log(\"Reply: \" + reply);\n }\n}\nexports.print = print;\n",
57
+ "/*! *****************************************************************************\nCopyright (C) Microsoft. All rights reserved.\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use\nthis file except in compliance with the License. You may obtain a copy of the\nLicense at http://www.apache.org/licenses/LICENSE-2.0\n\nTHIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\nKIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED\nWARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,\nMERCHANTABLITY OR NON-INFRINGEMENT.\n\nSee the Apache Version 2.0 License for specific language governing permissions\nand limitations under the License.\n***************************************************************************** */\nvar Reflect;\n(function (Reflect) {\n // Metadata Proposal\n // https://rbuckton.github.io/reflect-metadata/\n (function (factory) {\n var root = typeof global === \"object\" ? global :\n typeof self === \"object\" ? self :\n typeof this === \"object\" ? this :\n Function(\"return this;\")();\n var exporter = makeExporter(Reflect);\n if (typeof root.Reflect === \"undefined\") {\n root.Reflect = Reflect;\n }\n else {\n exporter = makeExporter(root.Reflect, exporter);\n }\n factory(exporter);\n function makeExporter(target, previous) {\n return function (key, value) {\n if (typeof target[key] !== \"function\") {\n Object.defineProperty(target, key, { configurable: true, writable: true, value: value });\n }\n if (previous)\n previous(key, value);\n };\n }\n })(function (exporter) {\n var hasOwn = Object.prototype.hasOwnProperty;\n // feature test for Symbol support\n var supportsSymbol = typeof Symbol === \"function\";\n var toPrimitiveSymbol = supportsSymbol && typeof Symbol.toPrimitive !== \"undefined\" ? Symbol.toPrimitive : \"@@toPrimitive\";\n var iteratorSymbol = supportsSymbol && typeof Symbol.iterator !== \"undefined\" ? Symbol.iterator : \"@@iterator\";\n var supportsCreate = typeof Object.create === \"function\"; // feature test for Object.create support\n var supportsProto = { __proto__: [] } instanceof Array; // feature test for __proto__ support\n var downLevel = !supportsCreate && !supportsProto;\n var HashMap = {\n // create an object in dictionary mode (a.k.a. \"slow\" mode in v8)\n create: supportsCreate\n ? function () { return MakeDictionary(Object.create(null)); }\n : supportsProto\n ? function () { return MakeDictionary({ __proto__: null }); }\n : function () { return MakeDictionary({}); },\n has: downLevel\n ? function (map, key) { return hasOwn.call(map, key); }\n : function (map, key) { return key in map; },\n get: downLevel\n ? function (map, key) { return hasOwn.call(map, key) ? map[key] : undefined; }\n : function (map, key) { return map[key]; },\n };\n // Load global or shim versions of Map, Set, and WeakMap\n var functionPrototype = Object.getPrototypeOf(Function);\n var usePolyfill = typeof process === \"object\" && process[\"env\" + \"\"] && process[\"env\" + \"\"][\"REFLECT_METADATA_USE_MAP_POLYFILL\"] === \"true\";\n var _Map = !usePolyfill && typeof Map === \"function\" && typeof Map.prototype.entries === \"function\" ? Map : CreateMapPolyfill();\n var _Set = !usePolyfill && typeof Set === \"function\" && typeof Set.prototype.entries === \"function\" ? Set : CreateSetPolyfill();\n var _WeakMap = !usePolyfill && typeof WeakMap === \"function\" ? WeakMap : CreateWeakMapPolyfill();\n // [[Metadata]] internal slot\n // https://rbuckton.github.io/reflect-metadata/#ordinary-object-internal-methods-and-internal-slots\n var Metadata = new _WeakMap();\n /**\n * Applies a set of decorators to a property of a target object.\n * @param decorators An array of decorators.\n * @param target The target object.\n * @param propertyKey (Optional) The property key to decorate.\n * @param attributes (Optional) The property descriptor for the target key.\n * @remarks Decorators are applied in reverse order.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Example = Reflect.decorate(decoratorsArray, Example);\n *\n * // property (on constructor)\n * Reflect.decorate(decoratorsArray, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.decorate(decoratorsArray, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Object.defineProperty(Example, \"staticMethod\",\n * Reflect.decorate(decoratorsArray, Example, \"staticMethod\",\n * Object.getOwnPropertyDescriptor(Example, \"staticMethod\")));\n *\n * // method (on prototype)\n * Object.defineProperty(Example.prototype, \"method\",\n * Reflect.decorate(decoratorsArray, Example.prototype, \"method\",\n * Object.getOwnPropertyDescriptor(Example.prototype, \"method\")));\n *\n */\n function decorate(decorators, target, propertyKey, attributes) {\n if (!IsUndefined(propertyKey)) {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsObject(target))\n throw new TypeError();\n if (!IsObject(attributes) && !IsUndefined(attributes) && !IsNull(attributes))\n throw new TypeError();\n if (IsNull(attributes))\n attributes = undefined;\n propertyKey = ToPropertyKey(propertyKey);\n return DecorateProperty(decorators, target, propertyKey, attributes);\n }\n else {\n if (!IsArray(decorators))\n throw new TypeError();\n if (!IsConstructor(target))\n throw new TypeError();\n return DecorateConstructor(decorators, target);\n }\n }\n exporter(\"decorate\", decorate);\n // 4.1.2 Reflect.metadata(metadataKey, metadataValue)\n // https://rbuckton.github.io/reflect-metadata/#reflect.metadata\n /**\n * A default metadata decorator factory that can be used on a class, class member, or parameter.\n * @param metadataKey The key for the metadata entry.\n * @param metadataValue The value for the metadata entry.\n * @returns A decorator function.\n * @remarks\n * If `metadataKey` is already defined for the target and target key, the\n * metadataValue for that key will be overwritten.\n * @example\n *\n * // constructor\n * @Reflect.metadata(key, value)\n * class Example {\n * }\n *\n * // property (on constructor, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticProperty;\n * }\n *\n * // property (on prototype, TypeScript only)\n * class Example {\n * @Reflect.metadata(key, value)\n * property;\n * }\n *\n * // method (on constructor)\n * class Example {\n * @Reflect.metadata(key, value)\n * static staticMethod() { }\n * }\n *\n * // method (on prototype)\n * class Example {\n * @Reflect.metadata(key, value)\n * method() { }\n * }\n *\n */\n function metadata(metadataKey, metadataValue) {\n function decorator(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey) && !IsPropertyKey(propertyKey))\n throw new TypeError();\n OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n return decorator;\n }\n exporter(\"metadata\", metadata);\n /**\n * Define a unique metadata entry on the target.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param metadataValue A value that contains attached metadata.\n * @param target The target object on which to define metadata.\n * @param propertyKey (Optional) The property key for the target.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * Reflect.defineMetadata(\"custom:annotation\", options, Example);\n *\n * // property (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticProperty\");\n *\n * // property (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"property\");\n *\n * // method (on constructor)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example, \"staticMethod\");\n *\n * // method (on prototype)\n * Reflect.defineMetadata(\"custom:annotation\", options, Example.prototype, \"method\");\n *\n * // decorator factory as metadata-producing annotation.\n * function MyAnnotation(options): Decorator {\n * return (target, key?) => Reflect.defineMetadata(\"custom:annotation\", options, target, key);\n * }\n *\n */\n function defineMetadata(metadataKey, metadataValue, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryDefineOwnMetadata(metadataKey, metadataValue, target, propertyKey);\n }\n exporter(\"defineMetadata\", defineMetadata);\n /**\n * Gets a value indicating whether the target object or its prototype chain has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object or its prototype chain; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasMetadata\", hasMetadata);\n /**\n * Gets a value indicating whether the target object has the provided metadata key defined.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata key was defined on the target object; otherwise, `false`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.hasOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function hasOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryHasOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"hasOwnMetadata\", hasOwnMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object or its prototype chain.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getMetadata\", getMetadata);\n /**\n * Gets the metadata value for the provided metadata key on the target object.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns The metadata value for the metadata key if found; otherwise, `undefined`.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function getOwnMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryGetOwnMetadata(metadataKey, target, propertyKey);\n }\n exporter(\"getOwnMetadata\", getOwnMetadata);\n /**\n * Gets the metadata keys defined on the target object or its prototype chain.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryMetadataKeys(target, propertyKey);\n }\n exporter(\"getMetadataKeys\", getMetadataKeys);\n /**\n * Gets the unique metadata keys defined on the target object.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns An array of unique metadata keys.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.getOwnMetadataKeys(Example);\n *\n * // property (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.getOwnMetadataKeys(Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.getOwnMetadataKeys(Example.prototype, \"method\");\n *\n */\n function getOwnMetadataKeys(target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n return OrdinaryOwnMetadataKeys(target, propertyKey);\n }\n exporter(\"getOwnMetadataKeys\", getOwnMetadataKeys);\n /**\n * Deletes the metadata entry from the target object with the provided key.\n * @param metadataKey A key used to store and retrieve metadata.\n * @param target The target object on which the metadata is defined.\n * @param propertyKey (Optional) The property key for the target.\n * @returns `true` if the metadata entry was found and deleted; otherwise, false.\n * @example\n *\n * class Example {\n * // property declarations are not part of ES6, though they are valid in TypeScript:\n * // static staticProperty;\n * // property;\n *\n * constructor(p) { }\n * static staticMethod(p) { }\n * method(p) { }\n * }\n *\n * // constructor\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example);\n *\n * // property (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticProperty\");\n *\n * // property (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"property\");\n *\n * // method (on constructor)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example, \"staticMethod\");\n *\n * // method (on prototype)\n * result = Reflect.deleteMetadata(\"custom:annotation\", Example.prototype, \"method\");\n *\n */\n function deleteMetadata(metadataKey, target, propertyKey) {\n if (!IsObject(target))\n throw new TypeError();\n if (!IsUndefined(propertyKey))\n propertyKey = ToPropertyKey(propertyKey);\n var metadataMap = GetOrCreateMetadataMap(target, propertyKey, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n if (!metadataMap.delete(metadataKey))\n return false;\n if (metadataMap.size > 0)\n return true;\n var targetMetadata = Metadata.get(target);\n targetMetadata.delete(propertyKey);\n if (targetMetadata.size > 0)\n return true;\n Metadata.delete(target);\n return true;\n }\n exporter(\"deleteMetadata\", deleteMetadata);\n function DecorateConstructor(decorators, target) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsConstructor(decorated))\n throw new TypeError();\n target = decorated;\n }\n }\n return target;\n }\n function DecorateProperty(decorators, target, propertyKey, descriptor) {\n for (var i = decorators.length - 1; i >= 0; --i) {\n var decorator = decorators[i];\n var decorated = decorator(target, propertyKey, descriptor);\n if (!IsUndefined(decorated) && !IsNull(decorated)) {\n if (!IsObject(decorated))\n throw new TypeError();\n descriptor = decorated;\n }\n }\n return descriptor;\n }\n function GetOrCreateMetadataMap(O, P, Create) {\n var targetMetadata = Metadata.get(O);\n if (IsUndefined(targetMetadata)) {\n if (!Create)\n return undefined;\n targetMetadata = new _Map();\n Metadata.set(O, targetMetadata);\n }\n var metadataMap = targetMetadata.get(P);\n if (IsUndefined(metadataMap)) {\n if (!Create)\n return undefined;\n metadataMap = new _Map();\n targetMetadata.set(P, metadataMap);\n }\n return metadataMap;\n }\n // 3.1.1.1 OrdinaryHasMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasmetadata\n function OrdinaryHasMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return true;\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryHasMetadata(MetadataKey, parent, P);\n return false;\n }\n // 3.1.2.1 OrdinaryHasOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryhasownmetadata\n function OrdinaryHasOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return false;\n return ToBoolean(metadataMap.has(MetadataKey));\n }\n // 3.1.3.1 OrdinaryGetMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetmetadata\n function OrdinaryGetMetadata(MetadataKey, O, P) {\n var hasOwn = OrdinaryHasOwnMetadata(MetadataKey, O, P);\n if (hasOwn)\n return OrdinaryGetOwnMetadata(MetadataKey, O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (!IsNull(parent))\n return OrdinaryGetMetadata(MetadataKey, parent, P);\n return undefined;\n }\n // 3.1.4.1 OrdinaryGetOwnMetadata(MetadataKey, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarygetownmetadata\n function OrdinaryGetOwnMetadata(MetadataKey, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return undefined;\n return metadataMap.get(MetadataKey);\n }\n // 3.1.5.1 OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarydefineownmetadata\n function OrdinaryDefineOwnMetadata(MetadataKey, MetadataValue, O, P) {\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ true);\n metadataMap.set(MetadataKey, MetadataValue);\n }\n // 3.1.6.1 OrdinaryMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinarymetadatakeys\n function OrdinaryMetadataKeys(O, P) {\n var ownKeys = OrdinaryOwnMetadataKeys(O, P);\n var parent = OrdinaryGetPrototypeOf(O);\n if (parent === null)\n return ownKeys;\n var parentKeys = OrdinaryMetadataKeys(parent, P);\n if (parentKeys.length <= 0)\n return ownKeys;\n if (ownKeys.length <= 0)\n return parentKeys;\n var set = new _Set();\n var keys = [];\n for (var _i = 0, ownKeys_1 = ownKeys; _i < ownKeys_1.length; _i++) {\n var key = ownKeys_1[_i];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n for (var _a = 0, parentKeys_1 = parentKeys; _a < parentKeys_1.length; _a++) {\n var key = parentKeys_1[_a];\n var hasKey = set.has(key);\n if (!hasKey) {\n set.add(key);\n keys.push(key);\n }\n }\n return keys;\n }\n // 3.1.7.1 OrdinaryOwnMetadataKeys(O, P)\n // https://rbuckton.github.io/reflect-metadata/#ordinaryownmetadatakeys\n function OrdinaryOwnMetadataKeys(O, P) {\n var keys = [];\n var metadataMap = GetOrCreateMetadataMap(O, P, /*Create*/ false);\n if (IsUndefined(metadataMap))\n return keys;\n var keysObj = metadataMap.keys();\n var iterator = GetIterator(keysObj);\n var k = 0;\n while (true) {\n var next = IteratorStep(iterator);\n if (!next) {\n keys.length = k;\n return keys;\n }\n var nextValue = IteratorValue(next);\n try {\n keys[k] = nextValue;\n }\n catch (e) {\n try {\n IteratorClose(iterator);\n }\n finally {\n throw e;\n }\n }\n k++;\n }\n }\n // 6 ECMAScript Data Typ0es and Values\n // https://tc39.github.io/ecma262/#sec-ecmascript-data-types-and-values\n function Type(x) {\n if (x === null)\n return 1 /* Null */;\n switch (typeof x) {\n case \"undefined\": return 0 /* Undefined */;\n case \"boolean\": return 2 /* Boolean */;\n case \"string\": return 3 /* String */;\n case \"symbol\": return 4 /* Symbol */;\n case \"number\": return 5 /* Number */;\n case \"object\": return x === null ? 1 /* Null */ : 6 /* Object */;\n default: return 6 /* Object */;\n }\n }\n // 6.1.1 The Undefined Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-undefined-type\n function IsUndefined(x) {\n return x === undefined;\n }\n // 6.1.2 The Null Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-null-type\n function IsNull(x) {\n return x === null;\n }\n // 6.1.5 The Symbol Type\n // https://tc39.github.io/ecma262/#sec-ecmascript-language-types-symbol-type\n function IsSymbol(x) {\n return typeof x === \"symbol\";\n }\n // 6.1.7 The Object Type\n // https://tc39.github.io/ecma262/#sec-object-type\n function IsObject(x) {\n return typeof x === \"object\" ? x !== null : typeof x === \"function\";\n }\n // 7.1 Type Conversion\n // https://tc39.github.io/ecma262/#sec-type-conversion\n // 7.1.1 ToPrimitive(input [, PreferredType])\n // https://tc39.github.io/ecma262/#sec-toprimitive\n function ToPrimitive(input, PreferredType) {\n switch (Type(input)) {\n case 0 /* Undefined */: return input;\n case 1 /* Null */: return input;\n case 2 /* Boolean */: return input;\n case 3 /* String */: return input;\n case 4 /* Symbol */: return input;\n case 5 /* Number */: return input;\n }\n var hint = PreferredType === 3 /* String */ ? \"string\" : PreferredType === 5 /* Number */ ? \"number\" : \"default\";\n var exoticToPrim = GetMethod(input, toPrimitiveSymbol);\n if (exoticToPrim !== undefined) {\n var result = exoticToPrim.call(input, hint);\n if (IsObject(result))\n throw new TypeError();\n return result;\n }\n return OrdinaryToPrimitive(input, hint === \"default\" ? \"number\" : hint);\n }\n // 7.1.1.1 OrdinaryToPrimitive(O, hint)\n // https://tc39.github.io/ecma262/#sec-ordinarytoprimitive\n function OrdinaryToPrimitive(O, hint) {\n if (hint === \"string\") {\n var toString_1 = O.toString;\n if (IsCallable(toString_1)) {\n var result = toString_1.call(O);\n if (!IsObject(result))\n return result;\n }\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n else {\n var valueOf = O.valueOf;\n if (IsCallable(valueOf)) {\n var result = valueOf.call(O);\n if (!IsObject(result))\n return result;\n }\n var toString_2 = O.toString;\n if (IsCallable(toString_2)) {\n var result = toString_2.call(O);\n if (!IsObject(result))\n return result;\n }\n }\n throw new TypeError();\n }\n // 7.1.2 ToBoolean(argument)\n // https://tc39.github.io/ecma262/2016/#sec-toboolean\n function ToBoolean(argument) {\n return !!argument;\n }\n // 7.1.12 ToString(argument)\n // https://tc39.github.io/ecma262/#sec-tostring\n function ToString(argument) {\n return \"\" + argument;\n }\n // 7.1.14 ToPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-topropertykey\n function ToPropertyKey(argument) {\n var key = ToPrimitive(argument, 3 /* String */);\n if (IsSymbol(key))\n return key;\n return ToString(key);\n }\n // 7.2 Testing and Comparison Operations\n // https://tc39.github.io/ecma262/#sec-testing-and-comparison-operations\n // 7.2.2 IsArray(argument)\n // https://tc39.github.io/ecma262/#sec-isarray\n function IsArray(argument) {\n return Array.isArray\n ? Array.isArray(argument)\n : argument instanceof Object\n ? argument instanceof Array\n : Object.prototype.toString.call(argument) === \"[object Array]\";\n }\n // 7.2.3 IsCallable(argument)\n // https://tc39.github.io/ecma262/#sec-iscallable\n function IsCallable(argument) {\n // NOTE: This is an approximation as we cannot check for [[Call]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.4 IsConstructor(argument)\n // https://tc39.github.io/ecma262/#sec-isconstructor\n function IsConstructor(argument) {\n // NOTE: This is an approximation as we cannot check for [[Construct]] internal method.\n return typeof argument === \"function\";\n }\n // 7.2.7 IsPropertyKey(argument)\n // https://tc39.github.io/ecma262/#sec-ispropertykey\n function IsPropertyKey(argument) {\n switch (Type(argument)) {\n case 3 /* String */: return true;\n case 4 /* Symbol */: return true;\n default: return false;\n }\n }\n // 7.3 Operations on Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-objects\n // 7.3.9 GetMethod(V, P)\n // https://tc39.github.io/ecma262/#sec-getmethod\n function GetMethod(V, P) {\n var func = V[P];\n if (func === undefined || func === null)\n return undefined;\n if (!IsCallable(func))\n throw new TypeError();\n return func;\n }\n // 7.4 Operations on Iterator Objects\n // https://tc39.github.io/ecma262/#sec-operations-on-iterator-objects\n function GetIterator(obj) {\n var method = GetMethod(obj, iteratorSymbol);\n if (!IsCallable(method))\n throw new TypeError(); // from Call\n var iterator = method.call(obj);\n if (!IsObject(iterator))\n throw new TypeError();\n return iterator;\n }\n // 7.4.4 IteratorValue(iterResult)\n // https://tc39.github.io/ecma262/2016/#sec-iteratorvalue\n function IteratorValue(iterResult) {\n return iterResult.value;\n }\n // 7.4.5 IteratorStep(iterator)\n // https://tc39.github.io/ecma262/#sec-iteratorstep\n function IteratorStep(iterator) {\n var result = iterator.next();\n return result.done ? false : result;\n }\n // 7.4.6 IteratorClose(iterator, completion)\n // https://tc39.github.io/ecma262/#sec-iteratorclose\n function IteratorClose(iterator) {\n var f = iterator[\"return\"];\n if (f)\n f.call(iterator);\n }\n // 9.1 Ordinary Object Internal Methods and Internal Slots\n // https://tc39.github.io/ecma262/#sec-ordinary-object-internal-methods-and-internal-slots\n // 9.1.1.1 OrdinaryGetPrototypeOf(O)\n // https://tc39.github.io/ecma262/#sec-ordinarygetprototypeof\n function OrdinaryGetPrototypeOf(O) {\n var proto = Object.getPrototypeOf(O);\n if (typeof O !== \"function\" || O === functionPrototype)\n return proto;\n // TypeScript doesn't set __proto__ in ES5, as it's non-standard.\n // Try to determine the superclass constructor. Compatible implementations\n // must either set __proto__ on a subclass constructor to the superclass constructor,\n // or ensure each class has a valid `constructor` property on its prototype that\n // points back to the constructor.\n // If this is not the same as Function.[[Prototype]], then this is definately inherited.\n // This is the case when in ES6 or when using __proto__ in a compatible browser.\n if (proto !== functionPrototype)\n return proto;\n // If the super prototype is Object.prototype, null, or undefined, then we cannot determine the heritage.\n var prototype = O.prototype;\n var prototypeProto = prototype && Object.getPrototypeOf(prototype);\n if (prototypeProto == null || prototypeProto === Object.prototype)\n return proto;\n // If the constructor was not a function, then we cannot determine the heritage.\n var constructor = prototypeProto.constructor;\n if (typeof constructor !== \"function\")\n return proto;\n // If we have some kind of self-reference, then we cannot determine the heritage.\n if (constructor === O)\n return proto;\n // we have a pretty good guess at the heritage.\n return constructor;\n }\n // naive Map shim\n function CreateMapPolyfill() {\n var cacheSentinel = {};\n var arraySentinel = [];\n var MapIterator = /** @class */ (function () {\n function MapIterator(keys, values, selector) {\n this._index = 0;\n this._keys = keys;\n this._values = values;\n this._selector = selector;\n }\n MapIterator.prototype[\"@@iterator\"] = function () { return this; };\n MapIterator.prototype[iteratorSymbol] = function () { return this; };\n MapIterator.prototype.next = function () {\n var index = this._index;\n if (index >= 0 && index < this._keys.length) {\n var result = this._selector(this._keys[index], this._values[index]);\n if (index + 1 >= this._keys.length) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n else {\n this._index++;\n }\n return { value: result, done: false };\n }\n return { value: undefined, done: true };\n };\n MapIterator.prototype.throw = function (error) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n throw error;\n };\n MapIterator.prototype.return = function (value) {\n if (this._index >= 0) {\n this._index = -1;\n this._keys = arraySentinel;\n this._values = arraySentinel;\n }\n return { value: value, done: true };\n };\n return MapIterator;\n }());\n return /** @class */ (function () {\n function Map() {\n this._keys = [];\n this._values = [];\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n Object.defineProperty(Map.prototype, \"size\", {\n get: function () { return this._keys.length; },\n enumerable: true,\n configurable: true\n });\n Map.prototype.has = function (key) { return this._find(key, /*insert*/ false) >= 0; };\n Map.prototype.get = function (key) {\n var index = this._find(key, /*insert*/ false);\n return index >= 0 ? this._values[index] : undefined;\n };\n Map.prototype.set = function (key, value) {\n var index = this._find(key, /*insert*/ true);\n this._values[index] = value;\n return this;\n };\n Map.prototype.delete = function (key) {\n var index = this._find(key, /*insert*/ false);\n if (index >= 0) {\n var size = this._keys.length;\n for (var i = index + 1; i < size; i++) {\n this._keys[i - 1] = this._keys[i];\n this._values[i - 1] = this._values[i];\n }\n this._keys.length--;\n this._values.length--;\n if (key === this._cacheKey) {\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n }\n return true;\n }\n return false;\n };\n Map.prototype.clear = function () {\n this._keys.length = 0;\n this._values.length = 0;\n this._cacheKey = cacheSentinel;\n this._cacheIndex = -2;\n };\n Map.prototype.keys = function () { return new MapIterator(this._keys, this._values, getKey); };\n Map.prototype.values = function () { return new MapIterator(this._keys, this._values, getValue); };\n Map.prototype.entries = function () { return new MapIterator(this._keys, this._values, getEntry); };\n Map.prototype[\"@@iterator\"] = function () { return this.entries(); };\n Map.prototype[iteratorSymbol] = function () { return this.entries(); };\n Map.prototype._find = function (key, insert) {\n if (this._cacheKey !== key) {\n this._cacheIndex = this._keys.indexOf(this._cacheKey = key);\n }\n if (this._cacheIndex < 0 && insert) {\n this._cacheIndex = this._keys.length;\n this._keys.push(key);\n this._values.push(undefined);\n }\n return this._cacheIndex;\n };\n return Map;\n }());\n function getKey(key, _) {\n return key;\n }\n function getValue(_, value) {\n return value;\n }\n function getEntry(key, value) {\n return [key, value];\n }\n }\n // naive Set shim\n function CreateSetPolyfill() {\n return /** @class */ (function () {\n function Set() {\n this._map = new _Map();\n }\n Object.defineProperty(Set.prototype, \"size\", {\n get: function () { return this._map.size; },\n enumerable: true,\n configurable: true\n });\n Set.prototype.has = function (value) { return this._map.has(value); };\n Set.prototype.add = function (value) { return this._map.set(value, value), this; };\n Set.prototype.delete = function (value) { return this._map.delete(value); };\n Set.prototype.clear = function () { this._map.clear(); };\n Set.prototype.keys = function () { return this._map.keys(); };\n Set.prototype.values = function () { return this._map.values(); };\n Set.prototype.entries = function () { return this._map.entries(); };\n Set.prototype[\"@@iterator\"] = function () { return this.keys(); };\n Set.prototype[iteratorSymbol] = function () { return this.keys(); };\n return Set;\n }());\n }\n // naive WeakMap shim\n function CreateWeakMapPolyfill() {\n var UUID_SIZE = 16;\n var keys = HashMap.create();\n var rootKey = CreateUniqueKey();\n return /** @class */ (function () {\n function WeakMap() {\n this._key = CreateUniqueKey();\n }\n WeakMap.prototype.has = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.has(table, this._key) : false;\n };\n WeakMap.prototype.get = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? HashMap.get(table, this._key) : undefined;\n };\n WeakMap.prototype.set = function (target, value) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ true);\n table[this._key] = value;\n return this;\n };\n WeakMap.prototype.delete = function (target) {\n var table = GetOrCreateWeakMapTable(target, /*create*/ false);\n return table !== undefined ? delete table[this._key] : false;\n };\n WeakMap.prototype.clear = function () {\n // NOTE: not a real clear, just makes the previous data unreachable\n this._key = CreateUniqueKey();\n };\n return WeakMap;\n }());\n function CreateUniqueKey() {\n var key;\n do\n key = \"@@WeakMap@@\" + CreateUUID();\n while (HashMap.has(keys, key));\n keys[key] = true;\n return key;\n }\n function GetOrCreateWeakMapTable(target, create) {\n if (!hasOwn.call(target, rootKey)) {\n if (!create)\n return undefined;\n Object.defineProperty(target, rootKey, { value: HashMap.create() });\n }\n return target[rootKey];\n }\n function FillRandomBytes(buffer, size) {\n for (var i = 0; i < size; ++i)\n buffer[i] = Math.random() * 0xff | 0;\n return buffer;\n }\n function GenRandomBytes(size) {\n if (typeof Uint8Array === \"function\") {\n if (typeof crypto !== \"undefined\")\n return crypto.getRandomValues(new Uint8Array(size));\n if (typeof msCrypto !== \"undefined\")\n return msCrypto.getRandomValues(new Uint8Array(size));\n return FillRandomBytes(new Uint8Array(size), size);\n }\n return FillRandomBytes(new Array(size), size);\n }\n function CreateUUID() {\n var data = GenRandomBytes(UUID_SIZE);\n // mark as random - RFC 4122 § 4.4\n data[6] = data[6] & 0x4f | 0x40;\n data[8] = data[8] & 0xbf | 0x80;\n var result = \"\";\n for (var offset = 0; offset < UUID_SIZE; ++offset) {\n var byte = data[offset];\n if (offset === 4 || offset === 6 || offset === 8)\n result += \"-\";\n if (byte < 16)\n result += \"0\";\n result += byte.toString(16).toLowerCase();\n }\n return result;\n }\n }\n // uses a heuristic used by v8 and chakra to force an object into dictionary mode.\n function MakeDictionary(obj) {\n obj.__ = undefined;\n delete obj.__;\n return obj;\n }\n });\n})(Reflect || (Reflect = {}));\n",
58
+ "import { Scope } from './container/Container';\n\n/**\n * Controller options for the @Controller decorator.\n */\nexport interface ControllerOptions {\n path?: string;\n scope?: Scope;\n children?: any[];\n}\n\n/**\n * Controller metadata stored on controller classes.\n */\nexport interface ControllerMeta {\n path: string;\n scope?: Scope;\n children?: any[];\n}\n\n/**\n * Route metadata stored on controllers.\n */\nexport interface RouteInfo {\n method: 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options';\n path: string;\n handlerName: string;\n}\n\n/**\n * Middleware metadata.\n */\nexport interface MiddlewareInfo {\n handler: Function;\n target?: string;\n}\n\n/**\n * Metadata keys.\n */\nexport const CONTROLLER_META = Symbol('turbo:controller');\nexport const ROUTES_META = Symbol('turbo:routes');\nexport const PARAMS_META = Symbol('turbo:params');\nexport const MIDDLEWARE_META = Symbol('turbo:middleware');\nexport const SERVICE_META = Symbol('turbo:service');\nexport const INJECT_META = Symbol('turbo:inject');\n",
59
+ "/**\n * JIT Compiler for Turbo.\n * \n * Aggressive AOT optimizations:\n * - Detects async at compile time (not runtime)\n * - Generates specialized handlers via new Function()\n * - Inlines parameter access\n * - Zero overhead for simple handlers\n */\n\nimport type { ParamType } from '../decorators/params';\n\nexport interface ParamInfo {\n type: ParamType;\n key?: string;\n index: number;\n}\n\nexport interface CompiledHandler {\n fn: Function;\n isAsync: boolean;\n isStatic: boolean;\n staticValue?: any;\n}\n\nconst ASYNC_REGEX = /^async\\s|^\\([^)]*\\)\\s*=>\\s*\\{[\\s\\S]*await\\s|^function\\s*\\*|\\.then\\s*\\(/;\n\n/**\n * Detects if function is async at compile time.\n * Checks: async keyword, await usage, generators, .then()\n */\nexport function isAsyncFunction(fn: Function): boolean {\n if (fn.constructor.name === 'AsyncFunction') {\n return true;\n }\n\n const source = fn.toString();\n\n return ASYNC_REGEX.test(source);\n}\n\n/**\n * Detects if handler returns a static value.\n * Static handlers can be pre-computed at startup.\n */\nexport function isStaticHandler(fn: Function): boolean {\n const source = fn.toString();\n\n if (source.includes('this.') || source.includes('await')) {\n return false;\n }\n\n const returnMatch = source.match(/=>\\s*[\"'`]|return\\s+[\"'`]|=>\\s*\\{|=>\\s*\\d/);\n\n return !!returnMatch;\n}\n\n/**\n * Compiles handler with inlined parameter access.\n * Uses new Function() for maximum V8 optimization.\n */\nexport function compileHandler(\n instance: any,\n methodName: string,\n params: ParamInfo[]\n): CompiledHandler {\n const method = instance[methodName];\n const bound = method.bind(instance);\n const async = isAsyncFunction(method);\n\n if (params.length === 0) {\n const isStatic = isStaticHandler(method);\n\n if (isStatic && !async) {\n const staticValue = bound();\n\n return {\n fn: bound,\n isAsync: false,\n isStatic: true,\n staticValue\n };\n }\n\n return {\n fn: bound,\n isAsync: async,\n isStatic: false\n };\n }\n\n const argExprs = params\n .sort((a, b) => a.index - b.index)\n .map(p => buildArgExpression(p));\n\n const argsCode = argExprs.join(',');\n const hasBody = params.some(p => p.type === 'body');\n\n if (hasBody) {\n const code = `return async function(c){\nawait c.parseBody();\nreturn h(${argsCode});\n}`;\n\n return {\n fn: new Function('h', code)(bound),\n isAsync: true,\n isStatic: false\n };\n }\n\n if (async) {\n const code = `return async function(c){\nreturn await h(${argsCode});\n}`;\n\n return {\n fn: new Function('h', code)(bound),\n isAsync: true,\n isStatic: false\n };\n }\n\n const code = `return function(c){\nreturn h(${argsCode});\n}`;\n\n return {\n fn: new Function('h', code)(bound),\n isAsync: false,\n isStatic: false\n };\n}\n\nfunction escapeKey(key: string): string {\n return key.replace(/['\\\"\\\\]/g, '\\\\$&');\n}\n\nfunction buildArgExpression(param: ParamInfo): string {\n const key = param.key ? escapeKey(param.key) : undefined;\n\n switch (param.type) {\n case 'param':\n return key ? `c.params['${key}']` : 'c.params';\n\n case 'query':\n return key ? `c.query['${key}']` : 'c.query';\n\n case 'body':\n return key ? `c.body['${key}']` : 'c.body';\n\n case 'header':\n return key ? `c.req.headers.get('${key}')` : 'c.req.headers';\n\n case 'req':\n return 'c.req';\n\n case 'ctx':\n return 'c';\n\n case 'locals':\n return key ? `c.locals['${key}']` : 'c.locals';\n\n default:\n return 'undefined';\n }\n}\n",
60
+ "/**\n * Request Context for Turbo.\n * \n * Lazy initialization for maximum performance:\n * - Query parsed only when accessed\n * - Body parsed only when needed\n * - Minimal allocations in hot path\n */\n\nconst EMPTY_PARAMS: Record<string, string> = Object.freeze({}) as Record<string, string>;\n\nexport class Context {\n readonly req: Request;\n params: Record<string, string>;\n locals: Record<string, any> = {};\n\n // Lazy fields - only allocated when accessed\n private _query: Record<string, string> | null = null;\n private _body: any;\n private _bodyParsed = false;\n private _url: URL | null = null;\n private _status = 0;\n\n constructor(req: Request, params: Record<string, string> = EMPTY_PARAMS) {\n this.req = req;\n this.params = params;\n }\n\n get status(): number {\n return this._status || 200;\n }\n\n set status(value: number) {\n this._status = value;\n }\n\n get url(): URL {\n if (!this._url) {\n this._url = new URL(this.req.url);\n }\n\n return this._url;\n }\n\n get query(): Record<string, string> {\n if (!this._query) {\n this._query = Object.fromEntries(this.url.searchParams);\n }\n\n return this._query;\n }\n\n get body(): any {\n return this._body;\n }\n\n async parseBody(): Promise<any> {\n if (this._bodyParsed) {\n return this._body;\n }\n\n this._bodyParsed = true;\n const contentType = this.req.headers.get('content-type') || '';\n\n if (contentType.includes('application/json')) {\n this._body = await this.req.json();\n } else if (contentType.includes('form')) {\n const formData = await this.req.formData();\n this._body = Object.fromEntries(formData);\n } else if (contentType.includes('text')) {\n this._body = await this.req.text();\n } else {\n this._body = await this.req.arrayBuffer();\n }\n\n return this._body;\n }\n\n get method(): string {\n return this.req.method;\n }\n\n get headers(): Headers {\n return this.req.headers;\n }\n\n get path(): string {\n return this.url.pathname;\n }\n\n json(data: any, status?: number): Response {\n if (status) this.status = status;\n\n return Response.json(data, { status: this.status });\n }\n\n text(data: string, status?: number): Response {\n if (status) this.status = status;\n\n return new Response(data, {\n status: this.status,\n headers: { 'Content-Type': 'text/plain' }\n });\n }\n\n html(data: string, status?: number): Response {\n if (status) this.status = status;\n\n return new Response(data, {\n status: this.status,\n headers: { 'Content-Type': 'text/html' }\n });\n }\n\n redirect(url: string, status: number = 302): Response {\n return Response.redirect(url, status);\n }\n\n /**\n * Creates a Context from a job (for queue processing).\n */\n static createFromJob(job: any): Context {\n const fakeRequest = new Request('http://localhost/job');\n const ctx = new Context(fakeRequest);\n ctx.locals.job = job;\n return ctx;\n }\n}\n",
61
+ "/**\n * Lightweight DI Container for Turbo.\n * \n * Features:\n * - Constructor injection via reflect-metadata\n * - Singleton scope by default\n * - Request scope support\n * - Lazy instantiation\n */\n\nexport type Token<T = any> = new (...args: any[]) => T;\n\nexport enum Scope {\n SINGLETON = 'singleton', // Always the same instance\n REQUEST = 'request', // New instance per request\n INSTANCE = 'instance' // New instance per dependency injection\n}\n\nexport interface ProviderConfig<T = any> {\n token: Token<T>;\n useClass?: Token<T>;\n useValue?: T;\n scope?: Scope;\n}\n\ninterface ProviderEntry {\n config: ProviderConfig;\n instance: any | null;\n}\n\nexport class Container {\n private configs = new Map<Token, ProviderConfig>();\n private instances = new Map<Token, any>();\n private resolving = new Set<Token>();\n\n register<T>(config: ProviderConfig<T> | Token<T>): this {\n const normalized = this.normalizeConfig(config);\n\n this.configs.set(normalized.token, normalized);\n\n if (normalized.useValue !== undefined) {\n this.instances.set(normalized.token, normalized.useValue);\n }\n\n return this;\n }\n\n get<T>(token: Token<T>): T {\n const cached = this.instances.get(token);\n\n if (cached !== undefined) {\n return cached;\n }\n\n const res = this.resolveInternal(token);\n return res.instance;\n }\n\n has(token: Token): boolean {\n return this.configs.has(token);\n }\n\n /**\n * Resolves a token to return instance and its effective scope.\n */\n private resolveInternal<T>(token: Token<T>, requestLocals?: Map<Token, any>): { instance: T, scope: Scope } {\n // 1. Check Request Cache\n if (requestLocals?.has(token)) {\n return { instance: requestLocals.get(token), scope: Scope.REQUEST };\n }\n\n // 2. Check Singleton Cache\n const cached = this.instances.get(token);\n if (cached !== undefined) {\n return { instance: cached, scope: Scope.SINGLETON };\n }\n\n const config = this.configs.get(token);\n\n if (!config) {\n throw new Error(`Provider not found: ${token.name}`);\n }\n\n // 3. Create Instance with Scope Bubbling\n const creation = this.createInstance(config, requestLocals);\n\n // 4. Cache based on Effective Scope\n if (creation.scope === Scope.SINGLETON) {\n this.instances.set(token, creation.instance);\n } else if (creation.scope === Scope.REQUEST && requestLocals) {\n requestLocals.set(token, creation.instance);\n }\n // INSTANCE scope is never cached\n\n return creation;\n }\n\n private createInstance(config: ProviderConfig, requestLocals?: Map<Token, any>): { instance: any, scope: Scope } {\n const target = config.useClass ?? config.token;\n\n if (this.resolving.has(target)) {\n throw new Error(`Circular dependency detected: ${target.name}`);\n }\n\n this.resolving.add(target);\n\n try {\n const depsToken = this.getDependencies(target);\n\n if (depsToken.length === 0) {\n // No deps: Scope is as configured\n return { instance: new target(), scope: config.scope || Scope.SINGLETON };\n }\n\n const args: any[] = [];\n let effectiveScope = config.scope || Scope.SINGLETON;\n\n for (const depToken of depsToken) {\n const depResult = this.resolveInternal(depToken, requestLocals);\n args.push(depResult.instance);\n\n // Scope Bubbling Logic:\n // If a dependency is REQUEST scoped, the parent MUST become REQUEST scoped (if it was Singleton)\n // to avoid holding a stale reference to a request-bound instance.\n if (depResult.scope === Scope.REQUEST && effectiveScope === Scope.SINGLETON) {\n effectiveScope = Scope.REQUEST;\n }\n\n // Note: INSTANCE scope dependencies do not force bubbling because they are transient and safe to hold (usually),\n // unless semantic logic dictates otherwise. For now, strictly bubbling REQUEST scope.\n }\n\n return { instance: new target(...args), scope: effectiveScope };\n } finally {\n this.resolving.delete(target);\n }\n }\n\n private getDependencies(target: Token): Token[] {\n const types = Reflect.getMetadata('design:paramtypes', target) || [];\n return types.filter((t: any) => t && typeof t === 'function' && !this.isPrimitive(t));\n }\n\n private isPrimitive(type: any): boolean {\n return type === String || type === Number || type === Boolean || type === Object || type === Array || type === Symbol;\n }\n\n private normalizeConfig<T>(config: ProviderConfig<T> | Token<T>): ProviderConfig<T> {\n if (typeof config === 'function') {\n return {\n token: config,\n useClass: config,\n scope: Scope.SINGLETON\n };\n }\n\n return {\n ...config,\n useClass: config.useClass ?? config.token,\n scope: config.scope ?? Scope.SINGLETON\n };\n }\n\n clear(): void {\n this.configs.clear();\n this.instances.clear();\n }\n}\n",
62
+ "/**\n * CORS Configuration types.\n */\nexport type CorsOrigin =\n | string\n | string[]\n | RegExp\n | ((origin: string) => boolean);\n\nexport interface CorsConfig {\n origins: CorsOrigin;\n methods?: string[];\n allowedHeaders?: string[];\n exposedHeaders?: string[];\n credentials?: boolean;\n maxAge?: number;\n}\n\nexport const DEFAULT_CORS_METHODS = ['GET', 'HEAD', 'PUT', 'PATCH', 'POST', 'DELETE'];\nexport const DEFAULT_CORS_HEADERS = ['Content-Type', 'Authorization', 'X-Requested-With', 'Accept', 'Origin'];\n\ntype OriginMatcher = (origin: string) => boolean;\n\n/**\n * CORS Handler - Pre-computes headers at startup for maximum performance.\n */\nexport class CorsHandler {\n private readonly cache = new Map<string, Record<string, string>>();\n private readonly methodsStr: string;\n private readonly headersStr: string;\n private readonly exposedStr: string | null;\n private readonly maxAgeStr: string | null;\n private readonly hasCredentials: boolean;\n private readonly isWildcard: boolean;\n private readonly matcher: OriginMatcher;\n\n // Pre-created preflight response for wildcard CORS\n private readonly preflightResponse: Response | null = null;\n\n constructor(config: CorsConfig) {\n this.methodsStr = (config.methods || DEFAULT_CORS_METHODS).join(', ');\n this.headersStr = (config.allowedHeaders || DEFAULT_CORS_HEADERS).join(', ');\n this.exposedStr = config.exposedHeaders?.join(', ') || null;\n this.maxAgeStr = config.maxAge?.toString() || null;\n this.hasCredentials = !!config.credentials;\n this.isWildcard = config.origins === '*';\n this.matcher = this.buildMatcher(config.origins);\n\n // Pre-create preflight response for wildcard\n if (this.isWildcard) {\n this.preflightResponse = new Response(null, {\n status: 204,\n headers: this.buildHeaders('*')\n });\n }\n }\n\n /**\n * Handle preflight (OPTIONS) request.\n */\n preflight(origin: string): Response {\n if (this.isWildcard && this.preflightResponse) {\n return this.preflightResponse.clone();\n }\n\n if (!this.isAllowed(origin)) {\n return new Response(null, { status: 403 });\n }\n\n return new Response(null, {\n status: 204,\n headers: this.getHeaders(origin)\n });\n }\n\n /**\n * Apply CORS headers to a response.\n */\n apply(response: Response, origin: string): Response {\n if (!this.isAllowed(origin)) {\n return response;\n }\n\n const headers = this.getHeaders(origin);\n for (const [key, value] of Object.entries(headers)) {\n response.headers.set(key, value);\n }\n\n return response;\n }\n\n /**\n * Check if origin is allowed.\n */\n isAllowed(origin: string): boolean {\n return this.matcher(origin);\n }\n\n /**\n * Get cached CORS headers for origin.\n */\n private getHeaders(origin: string): Record<string, string> {\n const key = this.isWildcard ? '*' : origin;\n let headers = this.cache.get(key);\n\n if (!headers) {\n headers = this.buildHeaders(origin);\n this.cache.set(key, headers);\n }\n\n return headers;\n }\n\n private buildHeaders(origin: string): Record<string, string> {\n const headers: Record<string, string> = {\n 'Access-Control-Allow-Origin': this.isWildcard ? '*' : origin,\n 'Access-Control-Allow-Methods': this.methodsStr,\n 'Access-Control-Allow-Headers': this.headersStr\n };\n\n if (this.hasCredentials) {\n headers['Access-Control-Allow-Credentials'] = 'true';\n }\n if (this.exposedStr) {\n headers['Access-Control-Expose-Headers'] = this.exposedStr;\n }\n if (this.maxAgeStr) {\n headers['Access-Control-Max-Age'] = this.maxAgeStr;\n }\n\n return headers;\n }\n\n private buildMatcher(origins: CorsOrigin): OriginMatcher {\n if (origins === '*') return () => true;\n if (typeof origins === 'string') return (o) => o === origins;\n if (Array.isArray(origins)) {\n const set = new Set(origins);\n return (o) => set.has(o);\n }\n if (origins instanceof RegExp) return (o) => origins.test(o);\n if (typeof origins === 'function') return origins;\n return () => false;\n }\n}\n",
63
+ "/**\n * Base HTTP Exception class.\n * Throw this from handlers to return custom HTTP error responses.\n */\nexport class HttpException extends Error {\n constructor(\n public readonly statusCode: number,\n message: string,\n public readonly errors?: any[]\n ) {\n super(message);\n this.name = 'HttpException';\n }\n\n /**\n * Convert exception to Response.\n */\n toResponse(): Response {\n const body = {\n statusCode: this.statusCode,\n message: this.message,\n ...(this.errors && { errors: this.errors })\n };\n\n return Response.json(body, { status: this.statusCode });\n }\n}\n\n// Common HTTP Exceptions\n\nexport class BadRequestException extends HttpException {\n constructor(message: string = 'Bad Request', errors?: any[]) {\n super(400, message, errors);\n this.name = 'BadRequestException';\n }\n}\n\nexport class UnauthorizedException extends HttpException {\n constructor(message: string = 'Unauthorized') {\n super(401, message);\n this.name = 'UnauthorizedException';\n }\n}\n\nexport class ForbiddenException extends HttpException {\n constructor(message: string = 'Forbidden') {\n super(403, message);\n this.name = 'ForbiddenException';\n }\n}\n\nexport class NotFoundException extends HttpException {\n constructor(message: string = 'Not Found') {\n super(404, message);\n this.name = 'NotFoundException';\n }\n}\n\nexport class MethodNotAllowedException extends HttpException {\n constructor(message: string = 'Method Not Allowed') {\n super(405, message);\n this.name = 'MethodNotAllowedException';\n }\n}\n\nexport class ConflictException extends HttpException {\n constructor(message: string = 'Conflict') {\n super(409, message);\n this.name = 'ConflictException';\n }\n}\n\nexport class UnprocessableEntityException extends HttpException {\n constructor(message: string = 'Unprocessable Entity', errors?: any[]) {\n super(422, message, errors);\n this.name = 'UnprocessableEntityException';\n }\n}\n\nexport class TooManyRequestsException extends HttpException {\n constructor(message: string = 'Too Many Requests') {\n super(429, message);\n this.name = 'TooManyRequestsException';\n }\n}\n\nexport class InternalServerErrorException extends HttpException {\n constructor(message: string = 'Internal Server Error') {\n super(500, message);\n this.name = 'InternalServerErrorException';\n }\n}\n\nexport class ServiceUnavailableException extends HttpException {\n constructor(message: string = 'Service Unavailable') {\n super(503, message);\n this.name = 'ServiceUnavailableException';\n }\n}\n",
64
+ "/**\n * Validation result type.\n */\nexport interface ValidationResult<T = any> {\n success: boolean;\n data?: T;\n errors?: ValidationError[];\n}\n\nexport interface ValidationError {\n path: string;\n message: string;\n}\n\n/**\n * Base interface for validation adapters.\n * Adapters provide validation capabilities for different libraries.\n */\nexport interface ValidatorAdapter {\n /**\n * Validator name for debugging.\n */\n readonly name: string;\n\n /**\n * Check if a target has validation schema.\n */\n hasValidation(target: any): boolean;\n\n /**\n * Validate and transform a value.\n * Returns result object instead of throwing for better performance.\n */\n validate<T>(target: any, value: unknown): ValidationResult<T>;\n\n /**\n * Validate and transform, throwing on error.\n * Used when you want to short-circuit on failure.\n */\n validateOrThrow<T>(target: any, value: unknown): T;\n}\n\n/**\n * Validation configuration for Turbo.\n */\nexport interface ValidationConfig {\n adapter: ValidatorAdapter;\n}\n\n/**\n * Symbol for storing validation schema on DTOs.\n */\nexport const VALIDATION_SCHEMA = Symbol('turbo:validation');\n\n/**\n * Decorator to attach a validation schema to a DTO class.\n */\nexport function Schema(schema: any): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(VALIDATION_SCHEMA, schema, target);\n };\n}\n\n/**\n * Get the validation schema from a DTO class.\n */\nexport function getSchema(target: any): any | undefined {\n return Reflect.getMetadata(VALIDATION_SCHEMA, target);\n}\n",
65
+ "import type { ValidatorAdapter, ValidationResult, ValidationError } from './ValidatorAdapter';\nimport { VALIDATION_SCHEMA, getSchema } from './ValidatorAdapter';\n\n/**\n * Zod Adapter - Default validation adapter for Turbo.\n * \n * Usage:\n * ```typescript\n * import { z } from 'zod';\n * \n * @Schema(z.object({\n * name: z.string().min(1),\n * email: z.string().email()\n * }))\n * class CreateUserDto {\n * name: string;\n * email: string;\n * }\n * ```\n */\nexport class ZodAdapter implements ValidatorAdapter {\n readonly name = 'ZodAdapter';\n\n // Cache parsed schemas for performance\n private schemaCache = new Map<any, any>();\n\n hasValidation(target: any): boolean {\n return getSchema(target) !== undefined;\n }\n\n validate<T>(target: any, value: unknown): ValidationResult<T> {\n const schema = this.getOrCacheSchema(target);\n\n if (!schema) {\n return { success: true, data: value as T };\n }\n\n const result = schema.safeParse(value);\n\n if (result.success) {\n return { success: true, data: result.data };\n }\n\n return {\n success: false,\n errors: this.formatErrors(result.error)\n };\n }\n\n validateOrThrow<T>(target: any, value: unknown): T {\n const schema = this.getOrCacheSchema(target);\n\n if (!schema) {\n return value as T;\n }\n\n const result = schema.safeParse(value);\n\n if (result.success) {\n return result.data;\n }\n\n const errors = this.formatErrors(result.error);\n throw new ValidationException(errors);\n }\n\n private getOrCacheSchema(target: any): any {\n let schema = this.schemaCache.get(target);\n\n if (schema === undefined) {\n schema = getSchema(target) ?? null;\n this.schemaCache.set(target, schema);\n }\n\n return schema;\n }\n\n private formatErrors(zodError: any): ValidationError[] {\n return zodError.issues.map((issue: any) => ({\n path: issue.path.join('.'),\n message: issue.message\n }));\n }\n}\n\n/**\n * Validation exception thrown when validation fails.\n */\nexport class ValidationException extends Error {\n constructor(public readonly errors: ValidationError[]) {\n super(`Validation failed: ${errors.map(e => `${e.path}: ${e.message}`).join(', ')}`);\n this.name = 'ValidationException';\n }\n\n toResponse(): Response {\n return Response.json({\n statusCode: 400,\n message: 'Validation failed',\n errors: this.errors\n }, { status: 400 });\n }\n}\n",
66
+ "/**\n * Lifecycle Event Types.\n */\nexport enum EventType {\n /** Called when DI container initializes, before server starts */\n INIT = 'onInit',\n /** Called right after application is fully bootstrapped */\n BOOT = 'onBoot',\n /** Called when application receives SIGTERM/SIGINT */\n SHUTDOWN = 'onShutdown'\n}\n\n/**\n * Stored event handler info.\n */\nexport interface EventHandler {\n target: any;\n methodName: string;\n priority: number;\n}\n\n/**\n * Metadata key for storing events.\n */\nexport const EVENTS_META = Symbol('turbo:events');\n\n/**\n * Event registry - stores all decorated event handlers.\n * Populated at decoration time, read at bootstrap.\n */\nconst eventRegistry = new Map<EventType, EventHandler[]>();\n\n/**\n * Register an event handler (called by decorators).\n */\nexport function registerEvent(type: EventType, target: any, methodName: string, priority: number = 0): void {\n let handlers = eventRegistry.get(type);\n if (!handlers) {\n handlers = [];\n eventRegistry.set(type, handlers);\n }\n handlers.push({ target, methodName, priority });\n}\n\n/**\n * Get all handlers for an event type, sorted by priority (descending).\n */\nexport function getEventHandlers(type: EventType): EventHandler[] {\n const handlers = eventRegistry.get(type) || [];\n return handlers.sort((a, b) => b.priority - a.priority);\n}\n\n/**\n * Check if any handlers exist for an event type.\n */\nexport function hasEventHandlers(type: EventType): boolean {\n return (eventRegistry.get(type)?.length ?? 0) > 0;\n}\n\n/**\n * Clear all event handlers (for testing).\n */\nexport function clearEventRegistry(): void {\n eventRegistry.clear();\n}\n\n// ============ Decorators ============\n\n/**\n * Called when DI container initializes, before the server starts.\n * Use for database connections, cache warming, etc.\n */\nexport function OnApplicationInit(priority: number = 0) {\n return function (target: any, propertyKey: string) {\n registerEvent(EventType.INIT, target.constructor, propertyKey, priority);\n };\n}\n\n/**\n * Called right after the application is fully bootstrapped and server is ready.\n * Use for logging, health checks, etc.\n */\nexport function OnApplicationBoot(priority: number = 0) {\n return function (target: any, propertyKey: string) {\n registerEvent(EventType.BOOT, target.constructor, propertyKey, priority);\n };\n}\n\n/**\n * Called when application receives SIGTERM or SIGINT.\n * Use for graceful cleanup, closing connections, etc.\n */\nexport function OnApplicationShutdown(priority: number = 0) {\n return function (target: any, propertyKey: string) {\n registerEvent(EventType.SHUTDOWN, target.constructor, propertyKey, priority);\n };\n}\n",
67
+ "import type { CacheDriver } from './CacheDriver';\n\ninterface CacheEntry<T> {\n value: T;\n expiresAt: number | null;\n}\n\n/**\n * In-Memory Cache Driver.\n * Ultra-fast, perfect for single-instance applications.\n * \n * Features:\n * - O(1) get/set/del operations\n * - Lazy expiration (checked on access)\n * - Periodic cleanup of expired entries\n */\nexport class MemoryDriver implements CacheDriver {\n readonly name = 'MemoryDriver';\n\n private cache = new Map<string, CacheEntry<any>>();\n private cleanupInterval: Timer | null = null;\n\n constructor(cleanupIntervalMs: number = 0) {\n // Periodic cleanup of expired entries (disabled by default for performance)\n if (cleanupIntervalMs > 0) {\n this.cleanupInterval = setInterval(() => this.cleanup(), cleanupIntervalMs);\n }\n }\n\n async get<T>(key: string): Promise<T | null> {\n const entry = this.cache.get(key);\n\n if (!entry) {\n return null;\n }\n\n // Check expiration\n if (entry.expiresAt !== null && Date.now() > entry.expiresAt) {\n this.cache.delete(key);\n return null;\n }\n\n return entry.value;\n }\n\n async set<T>(key: string, value: T, ttl?: number): Promise<boolean> {\n const expiresAt = ttl ? Date.now() + ttl : null;\n\n this.cache.set(key, { value, expiresAt });\n\n return true;\n }\n\n async del(key: string): Promise<boolean> {\n return this.cache.delete(key);\n }\n\n async has(key: string): Promise<boolean> {\n const entry = this.cache.get(key);\n\n if (!entry) {\n return false;\n }\n\n if (entry.expiresAt !== null && Date.now() > entry.expiresAt) {\n this.cache.delete(key);\n return false;\n }\n\n return true;\n }\n\n async clear(): Promise<void> {\n this.cache.clear();\n }\n\n async close(): Promise<void> {\n if (this.cleanupInterval) {\n clearInterval(this.cleanupInterval);\n this.cleanupInterval = null;\n }\n this.cache.clear();\n }\n\n /**\n * Remove expired entries.\n */\n private cleanup(): void {\n const now = Date.now();\n\n for (const [key, entry] of this.cache) {\n if (entry.expiresAt !== null && now > entry.expiresAt) {\n this.cache.delete(key);\n }\n }\n }\n\n /**\n * Get cache stats (for debugging).\n */\n stats(): { size: number } {\n return { size: this.cache.size };\n }\n}\n",
68
+ "import type { CacheDriver, CacheConfig } from './CacheDriver';\nimport { MemoryDriver } from './MemoryDriver';\n\n/**\n * CacheService - High-performance caching with driver pattern.\n * \n * Features:\n * - In-memory (default) or Redis backend\n * - getOrSet for cache-aside pattern\n * - Key prefixing for namespacing\n * - Configurable default TTL\n * \n * Usage:\n * ```typescript\n * const cache = new CacheService();\n * \n * // Basic operations\n * await cache.set('user:123', { name: 'John' }, 3600);\n * const user = await cache.get<User>('user:123');\n * \n * // Cache-aside pattern\n * const user = await cache.getOrSet('user:123', \n * async () => db.findUser(123),\n * 3600\n * );\n * ```\n */\nexport class CacheService {\n private driver: CacheDriver;\n private prefix: string;\n private defaultTtl: number | undefined;\n\n constructor(config: CacheConfig = {}) {\n this.driver = config.driver || new MemoryDriver();\n this.prefix = config.prefix || '';\n this.defaultTtl = config.defaultTtl;\n }\n\n /**\n * Get the full key with prefix.\n */\n private key(key: string): string {\n return this.prefix ? `${this.prefix}:${key}` : key;\n }\n\n /**\n * Get a value from cache.\n */\n async get<T>(key: string): Promise<T | null> {\n return this.driver.get<T>(this.key(key));\n }\n\n /**\n * Set a value in cache.\n * @param ttl Time to live in seconds\n */\n async set<T>(key: string, value: T, ttl?: number): Promise<boolean> {\n return this.driver.set(this.key(key), value, ttl ?? this.defaultTtl);\n }\n\n /**\n * Delete a value from cache.\n */\n async del(key: string): Promise<boolean> {\n return this.driver.del(this.key(key));\n }\n\n /**\n * Check if key exists.\n */\n async has(key: string): Promise<boolean> {\n return this.driver.has(this.key(key));\n }\n\n /**\n * Clear all cached values.\n */\n async clear(): Promise<void> {\n return this.driver.clear();\n }\n\n /**\n * Get value from cache or compute and store it.\n * This is the cache-aside pattern - most commonly used method.\n * \n * @param key Cache key\n * @param cb Callback to compute value if not cached\n * @param ttl Time to live in seconds\n */\n async getOrSet<T>(key: string, cb: () => Promise<T>, ttl?: number): Promise<T> {\n const cached = await this.get<T>(key);\n\n if (cached !== null) {\n return cached;\n }\n\n const value = await cb();\n await this.set(key, value, ttl);\n\n return value;\n }\n\n /**\n * Get multiple values at once.\n */\n async getMany<T>(keys: string[]): Promise<(T | null)[]> {\n return Promise.all(keys.map(key => this.get<T>(key)));\n }\n\n /**\n * Set multiple values at once.\n */\n async setMany<T>(entries: Array<{ key: string; value: T; ttl?: number }>): Promise<boolean[]> {\n return Promise.all(\n entries.map(entry => this.set(entry.key, entry.value, entry.ttl))\n );\n }\n\n /**\n * Delete multiple values at once.\n */\n async delMany(keys: string[]): Promise<boolean[]> {\n return Promise.all(keys.map(key => this.del(key)));\n }\n\n /**\n * Close the cache driver connection.\n */\n async close(): Promise<void> {\n await this.driver.close?.();\n }\n\n /**\n * Get the underlying driver (for advanced use).\n */\n getDriver(): CacheDriver {\n return this.driver;\n }\n}\n",
69
+ "import { CONTROLLER_META, ROUTES_META } from '../metadata';\nimport type { ControllerOptions, ControllerMeta } from '../metadata';\n\n/**\n * Normalizes path or options to ControllerOptions.\n */\nfunction normalizeOptions(pathOrOptions?: string | ControllerOptions): ControllerOptions {\n if (!pathOrOptions) {\n return {};\n }\n\n if (typeof pathOrOptions === 'string') {\n return { path: pathOrOptions };\n }\n\n return pathOrOptions;\n}\n\n/**\n * Normalizes a path to start with / and not end with /.\n */\nfunction normalizePath(path: string): string {\n if (!path) return '';\n\n let normalized = path.startsWith('/') ? path : '/' + path;\n\n if (normalized !== '/' && normalized.endsWith('/')) {\n normalized = normalized.slice(0, -1);\n }\n\n return normalized;\n}\n\n/**\n * Marks a class as a controller with a base path.\n *\n * @example\n * // Simple path\n * @Controller('/users')\n *\n * @example\n * // With options\n * @Controller({ path: '/users', children: [ProfileController] })\n */\nexport function Controller(pathOrOptions?: string | ControllerOptions): ClassDecorator {\n return (target) => {\n const options = normalizeOptions(pathOrOptions);\n const path = normalizePath(options.path || '');\n\n const meta: ControllerMeta = {\n path,\n scope: options.scope,\n children: options.children\n };\n\n Reflect.defineMetadata(CONTROLLER_META, meta, target);\n\n // Ensure routes array exists\n if (!Reflect.hasMetadata(ROUTES_META, target)) {\n Reflect.defineMetadata(ROUTES_META, [], target);\n }\n };\n}\n",
70
+ "import { ROUTES_META, type RouteInfo } from '../metadata';\n\ntype HttpMethod = 'get' | 'post' | 'put' | 'delete' | 'patch' | 'head' | 'options';\n\n/**\n * Creates a method decorator for HTTP methods.\n * Supports both legacy decorators (experimentalDecorators) and TS5 stage 3 decorators.\n */\nfunction createMethodDecorator(method: HttpMethod) {\n return function (path: string = ''): any {\n return function (\n targetOrMethod: any,\n contextOrPropertyKey?: string | symbol | ClassMethodDecoratorContext,\n descriptor?: PropertyDescriptor\n ): any {\n // TS5 Stage 3 decorators: context is ClassMethodDecoratorContext\n if (contextOrPropertyKey && typeof contextOrPropertyKey === 'object' && 'kind' in contextOrPropertyKey) {\n const context = contextOrPropertyKey as ClassMethodDecoratorContext;\n\n context.addInitializer(function (this: any) {\n const constructor = this.constructor;\n const routes: RouteInfo[] = Reflect.getMetadata(ROUTES_META, constructor) || [];\n\n routes.push({\n method,\n path: path.startsWith('/') ? path : '/' + path,\n handlerName: String(context.name)\n });\n\n Reflect.defineMetadata(ROUTES_META, routes, constructor);\n });\n\n return targetOrMethod;\n }\n\n // Legacy decorators (experimentalDecorators: true)\n const constructor = targetOrMethod.constructor;\n const propertyKey = contextOrPropertyKey as string | symbol;\n const routes: RouteInfo[] = Reflect.getMetadata(ROUTES_META, constructor) || [];\n\n routes.push({\n method,\n path: path.startsWith('/') ? path : '/' + path,\n handlerName: String(propertyKey)\n });\n\n Reflect.defineMetadata(ROUTES_META, routes, constructor);\n };\n };\n}\n\nexport const Get = createMethodDecorator('get');\nexport const Post = createMethodDecorator('post');\nexport const Put = createMethodDecorator('put');\nexport const Delete = createMethodDecorator('delete');\nexport const Patch = createMethodDecorator('patch');\nexport const Head = createMethodDecorator('head');\nexport const Options = createMethodDecorator('options');\n",
71
+ "import { Controller } from './decorators/Controller';\nimport { Get } from './decorators/methods';\n\n/**\n * Default routes controller.\n * Auto-registered by Turbo for common endpoints.\n */\n@Controller()\nexport class DefaultRoutes {\n\n /**\n * Favicon - returns empty response to prevent 404.\n */\n @Get('/favicon.ico')\n favicon() {\n return new Response(null, { status: 204 });\n }\n}\n\n/**\n * Pre-compiled static responses for maximum performance.\n * Use these directly in Bun.serve static routes.\n */\nexport const DEFAULT_STATIC_ROUTES = {\n '/health': new Response('{\"status\":\"ok\"}', {\n status: 200,\n headers: { 'Content-Type': 'application/json' }\n }),\n '/ready': new Response('{\"ready\":true}', {\n status: 200,\n headers: { 'Content-Type': 'application/json' }\n }),\n '/favicon.ico': new Response(null, { status: 204 })\n};\n",
72
+ "import 'reflect-metadata';\n\nimport { CONTROLLER_META, ROUTES_META, PARAMS_META, MIDDLEWARE_META } from './metadata';\nimport type { RouteInfo, MiddlewareInfo, ControllerMeta } from './metadata';\nimport type { ParamMetadata } from './decorators/params';\n// RadixRouter removed - using Bun's native SIMD-accelerated router\nimport { compileHandler } from './compiler/JITCompiler';\nimport { Context } from './context/Context';\nimport { Container, Scope } from './container/Container';\nimport type { Token, ProviderConfig } from './container/Container';\nimport { CorsHandler, type CorsConfig } from './cors/CorsHandler';\nimport type { ValidatorAdapter } from './validation/ValidatorAdapter';\nimport { HttpException } from './exceptions/HttpException';\nimport { ValidationException } from './validation/ZodAdapter';\nimport { EventType, hasEventHandlers, getEventHandlers } from './events/Lifecycle';\nimport { CacheService } from './cache/CacheService';\nimport type { CacheConfig } from './cache/CacheDriver';\nimport { DEFAULT_STATIC_ROUTES } from './DefaultRoutes';\nimport { ZodAdapter } from './validation/ZodAdapter';\nimport type { CarnoMiddleware } from './middleware/CarnoMiddleware';\n\nexport type MiddlewareHandler = (ctx: Context) => Response | void | Promise<Response | void>;\n\n/**\n * Carno plugin configuration.\n */\nexport interface CarnoConfig {\n exports?: (Token | ProviderConfig)[];\n globalMiddlewares?: MiddlewareHandler[];\n disableStartupLog?: boolean;\n cors?: CorsConfig;\n validation?: ValidatorAdapter | boolean | (new (...args: any[]) => ValidatorAdapter);\n cache?: CacheConfig | boolean;\n}\n\n// CompiledRoute removed - handlers are registered directly in Bun's routes\n\nconst NOT_FOUND_RESPONSE = new Response('Not Found', { status: 404 });\n\n/**\n * Pre-computed response - frozen and reused.\n */\nconst TEXT_OPTS = Object.freeze({\n status: 200,\n headers: { 'Content-Type': 'text/plain' }\n});\n\nconst JSON_OPTS = Object.freeze({\n status: 200,\n headers: { 'Content-Type': 'application/json' }\n});\n\nconst INTERNAL_ERROR_RESPONSE = new Response(\n '{\"statusCode\":500,\"message\":\"Internal Server Error\"}',\n { status: 500, headers: { 'Content-Type': 'application/json' } }\n);\n\n// METHOD_MAP removed - Bun handles method routing natively\n\n/**\n * Carno Application - Ultra-aggressive performance.\n * \n * ZERO runtime work in hot path:\n * - All responses pre-created at startup\n * - Direct Bun native routes - no fetch fallback needed\n * - No function calls in hot path\n */\nexport class Carno {\n private _controllers: (new (...args: any[]) => any)[] = [];\n private _services: (Token | ProviderConfig)[] = [];\n private _middlewares: MiddlewareHandler[] = [];\n private routes: Record<string, Record<string, Response | Function> | Response | Function> = {};\n private container = new Container();\n private corsHandler: CorsHandler | null = null;\n private hasCors = false;\n private validator: ValidatorAdapter | null = null;\n private server: any;\n\n // Cached lifecycle event flags - checked once at startup\n private hasInitHooks = false;\n private hasBootHooks = false;\n private hasShutdownHooks = false;\n\n constructor(public config: CarnoConfig = {}) {\n this.config.exports = this.config.exports || [];\n this.config.globalMiddlewares = this.config.globalMiddlewares || [];\n\n // Initialize CORS handler if configured\n if (this.config.cors) {\n this.corsHandler = new CorsHandler(this.config.cors);\n this.hasCors = true;\n }\n\n // Initialize validator\n // Default: ZodAdapter if undefined or true\n if (this.config.validation === undefined || this.config.validation === true) {\n this.validator = new ZodAdapter();\n }\n // Constructor class passed directly\n else if (typeof this.config.validation === 'function') {\n const AdapterClass = this.config.validation as (new (...args: any[]) => ValidatorAdapter);\n this.validator = new AdapterClass();\n }\n // Instance passed directly\n else if (this.config.validation) {\n this.validator = this.config.validation as ValidatorAdapter;\n }\n }\n\n /**\n * Use a Carno plugin.\n * Imports controllers, services and global middlewares from another Carno instance.\n */\n use(plugin: Carno): this {\n // Import controllers from plugin\n if (plugin._controllers.length > 0) {\n this._controllers.push(...plugin._controllers);\n }\n\n // Import services from plugin exports\n for (const exported of plugin.config.exports || []) {\n const existingService = this.findServiceInPlugin(plugin, exported);\n const serviceToAdd = this.shouldCloneService(existingService)\n ? { ...existingService }\n : exported;\n\n this._services.push(serviceToAdd);\n }\n\n // Import services registered via .services() on the plugin\n if (plugin._services.length > 0) {\n this._services.push(...plugin._services);\n }\n\n // Import global middlewares\n if (plugin.config.globalMiddlewares) {\n this._middlewares.push(...plugin.config.globalMiddlewares);\n }\n\n // Import middlewares registered via .middlewares() on the plugin\n if (plugin._middlewares.length > 0) {\n this._middlewares.push(...plugin._middlewares);\n }\n\n return this;\n }\n\n private findServiceInPlugin(plugin: Carno, exported: any): any | undefined {\n return plugin._services.find(\n s => this.getServiceToken(s) === this.getServiceToken(exported)\n );\n }\n\n private getServiceToken(service: any): any {\n return service?.token || service;\n }\n\n private shouldCloneService(service: any): boolean {\n return !!(service?.useValue !== undefined || service?.useClass);\n }\n\n /**\n * Register one or more services/providers.\n */\n services(serviceClass: Token | ProviderConfig | (Token | ProviderConfig)[]): this {\n const items = Array.isArray(serviceClass) ? serviceClass : [serviceClass];\n this._services.push(...items);\n return this;\n }\n\n /**\n * Register one or more global middlewares.\n */\n middlewares(handler: MiddlewareHandler | MiddlewareHandler[]): this {\n const items = Array.isArray(handler) ? handler : [handler];\n this._middlewares.push(...items);\n return this;\n }\n\n /**\n * Register one or more controllers.\n */\n controllers(controllerClass: (new (...args: any[]) => any) | (new (...args: any[]) => any)[]): this {\n const items = Array.isArray(controllerClass) ? controllerClass : [controllerClass];\n this._controllers.push(...items);\n return this;\n }\n\n /**\n * Get a service instance from the container.\n */\n get<T>(token: Token<T>): T {\n return this.container.get(token);\n }\n\n listen(port: number = 3000): void {\n this.bootstrap();\n this.compileRoutes();\n\n // All routes go through Bun's native SIMD-accelerated router\n const config: any = {\n port,\n fetch: this.handleNotFound.bind(this),\n error: this.handleError.bind(this),\n routes: {\n ...DEFAULT_STATIC_ROUTES,\n ...this.routes\n }\n };\n\n this.server = Bun.serve(config);\n\n // Execute BOOT hooks after server is ready\n if (this.hasBootHooks) {\n this.executeLifecycleHooks(EventType.BOOT);\n }\n\n // Register shutdown handlers\n if (this.hasShutdownHooks) {\n this.registerShutdownHandlers();\n }\n\n if (!this.config.disableStartupLog) {\n console.log(`Carno running on port ${port}`);\n }\n }\n\n private bootstrap(): void {\n // Cache lifecycle event flags\n this.hasInitHooks = hasEventHandlers(EventType.INIT);\n this.hasBootHooks = hasEventHandlers(EventType.BOOT);\n this.hasShutdownHooks = hasEventHandlers(EventType.SHUTDOWN);\n\n // Register Container itself so it can be injected\n this.container.register({\n token: Container,\n useValue: this.container\n });\n\n // Always register CacheService (Memory by default)\n const cacheConfig = typeof this.config.cache === 'object' ? this.config.cache : {};\n this.container.register({\n token: CacheService,\n useValue: new CacheService(cacheConfig)\n });\n\n for (const service of this._services) {\n this.container.register(service);\n }\n\n for (const ControllerClass of this._controllers) {\n this.container.register(ControllerClass);\n }\n\n if (this.hasInitHooks) {\n this.executeLifecycleHooks(EventType.INIT);\n }\n\n for (const service of this._services) {\n const token = typeof service === 'function' ? service : service.token;\n const serviceConfig = typeof service === 'function' ? null : service;\n\n if (!serviceConfig || serviceConfig.scope !== Scope.REQUEST) {\n this.container.get(token);\n }\n }\n }\n\n private compileRoutes(): void {\n for (const ControllerClass of this._controllers) {\n this.compileController(ControllerClass);\n }\n }\n\n private compileController(\n ControllerClass: new (...args: any[]) => any,\n parentPath: string = '',\n inheritedMiddlewares: MiddlewareHandler[] = []\n ): void {\n const meta: ControllerMeta = Reflect.getMetadata(CONTROLLER_META, ControllerClass) || { path: '' };\n const basePath = parentPath + (meta.path || '');\n const routes: RouteInfo[] = Reflect.getMetadata(ROUTES_META, ControllerClass) || [];\n const middlewares: MiddlewareInfo[] = Reflect.getMetadata(MIDDLEWARE_META, ControllerClass) || [];\n const instance = this.container.get(ControllerClass);\n\n // Extract controller-level middlewares (applied to all routes of this controller)\n const controllerMiddlewares = middlewares\n .filter(m => !m.target)\n .map(m => m.handler as MiddlewareHandler);\n\n // Combine inherited middlewares with this controller's middlewares\n // This combined list is passed down to children and applied to current routes\n const scopedMiddlewares = [...inheritedMiddlewares, ...controllerMiddlewares];\n\n for (const route of routes) {\n const fullPath = this.normalizePath(basePath + route.path);\n const params: ParamMetadata[] = Reflect.getMetadata(PARAMS_META, ControllerClass, route.handlerName) || [];\n\n // Middlewares specific to this route handler\n const routeMiddlewares = middlewares\n .filter(m => m.target === route.handlerName)\n .map(m => m.handler as MiddlewareHandler);\n\n // Get parameter types for validation\n const paramTypes: any[] = Reflect.getMetadata('design:paramtypes', ControllerClass.prototype, route.handlerName) || [];\n\n // Find Body param with DTO that has @Schema for validation\n let bodyDtoType: any = null;\n for (const param of params) {\n if (param.type === 'body' && !param.key) {\n const dtoType = paramTypes[param.index];\n if (dtoType && this.validator?.hasValidation(dtoType)) {\n bodyDtoType = dtoType;\n }\n }\n }\n\n const compiled = compileHandler(instance, route.handlerName, params);\n\n const allMiddlewares = [\n ...(this.config.globalMiddlewares || []),\n ...this._middlewares,\n ...scopedMiddlewares,\n ...routeMiddlewares\n ];\n\n // Pre-resolve class-based middlewares at compile time for maximum performance\n const resolvedMiddlewares = allMiddlewares.map(m => this.resolveMiddleware(m));\n\n const hasMiddlewares = resolvedMiddlewares.length > 0;\n\n const method = route.method.toUpperCase();\n\n // Static response - no function needed\n if (compiled.isStatic && !hasMiddlewares) {\n this.registerRoute(fullPath, method, this.createStaticResponse(compiled.staticValue));\n } else {\n // Dynamic handler - compile to Bun-compatible function\n this.registerRoute(fullPath, method, this.createHandler(compiled, params, resolvedMiddlewares, bodyDtoType));\n }\n }\n\n // Compile child controllers with parent path and inherited middlewares\n if (meta.children) {\n for (const ChildController of meta.children) {\n if (!this.container.has(ChildController)) {\n this.container.register(ChildController);\n }\n\n this.compileController(ChildController, basePath, scopedMiddlewares);\n }\n }\n }\n\n /**\n * Register a route with Bun's native router format.\n * Path: \"/users/:id\", Method: \"GET\", Handler: Function or Response\n */\n private registerRoute(path: string, method: string, handler: Response | Function): void {\n if (!this.routes[path]) {\n this.routes[path] = {};\n }\n\n (this.routes[path] as Record<string, Response | Function>)[method] = handler;\n }\n\n private createStaticResponse(value: any): Response {\n const isString = typeof value === 'string';\n const body = isString ? value : JSON.stringify(value);\n const opts = isString ? TEXT_OPTS : JSON_OPTS;\n\n return new Response(body, opts);\n }\n\n private createHandler(\n compiled: { fn: Function; isAsync: boolean },\n params: ParamMetadata[],\n middlewares: MiddlewareHandler[],\n bodyDtoType?: any\n ): Function {\n const handler = compiled.fn;\n const hasMiddlewares = middlewares.length > 0;\n const hasParams = params.length > 0;\n const applyCors = this.hasCors ? this.applyCors.bind(this) : null;\n const validator = bodyDtoType ? this.validator : null;\n const needsValidation = !!validator;\n\n // Force middleware path when validation is needed\n const hasMiddlewaresOrValidation = hasMiddlewares || needsValidation;\n\n // No middlewares, no params - fastest path\n if (!hasMiddlewaresOrValidation && !hasParams) {\n if (compiled.isAsync) {\n return async (req: Request) => {\n const ctx = new Context(req);\n const result = await handler(ctx);\n const response = this.buildResponse(result);\n\n return applyCors ? applyCors(response, req) : response;\n };\n }\n\n return (req: Request) => {\n const ctx = new Context(req);\n const result = handler(ctx);\n const response = this.buildResponse(result);\n\n return applyCors ? applyCors(response, req) : response;\n };\n }\n\n // With params - use Bun's native req.params\n if (!hasMiddlewaresOrValidation && hasParams) {\n if (compiled.isAsync) {\n return async (req: Request) => {\n const ctx = new Context(req, (req as any).params);\n const result = await handler(ctx);\n const response = this.buildResponse(result);\n\n return applyCors ? applyCors(response, req) : response;\n };\n }\n\n return (req: Request) => {\n const ctx = new Context(req, (req as any).params);\n const result = handler(ctx);\n const response = this.buildResponse(result);\n\n return applyCors ? applyCors(response, req) : response;\n };\n }\n\n // With middlewares - full pipeline\n return async (req: Request) => {\n const ctx = new Context(req, (req as any).params || {});\n\n for (const middleware of middlewares) {\n const result = await middleware(ctx);\n\n if (result instanceof Response) {\n return applyCors ? applyCors(result, req) : result;\n }\n }\n\n // Validate body if validator is configured\n if (validator && bodyDtoType) {\n await ctx.parseBody();\n validator.validateOrThrow(bodyDtoType, ctx.body);\n }\n\n const result = compiled.isAsync\n ? await handler(ctx)\n : handler(ctx);\n\n const response = this.buildResponse(result);\n\n return applyCors ? applyCors(response, req) : response;\n };\n }\n\n private resolveMiddleware(middleware: any): MiddlewareHandler {\n // Check if it's a class with a handle method\n if (typeof middleware === 'function' && middleware.prototype?.handle) {\n // Instantiate via Container and bind the handle method\n const instance = this.container.get(middleware) as CarnoMiddleware;\n return (ctx: Context) => instance.handle(ctx, () => { });\n }\n\n // Already a function\n return middleware;\n }\n\n /**\n * Apply CORS headers to a response.\n */\n private applyCors(response: Response, req: Request): Response {\n const origin = req.headers.get('origin');\n\n if (origin && this.corsHandler) {\n return this.corsHandler.apply(response, origin);\n }\n\n return response;\n }\n\n /**\n * Fallback handler - only called for unmatched routes.\n * All matched routes go through Bun's native router.\n */\n private handleNotFound(req: Request): Response {\n // CORS preflight for unmatched routes\n if (this.hasCors && req.method === 'OPTIONS') {\n const origin = req.headers.get('origin');\n\n if (origin) {\n return this.corsHandler!.preflight(origin);\n }\n }\n\n return NOT_FOUND_RESPONSE;\n }\n\n private buildResponse(result: any): Response {\n if (result instanceof Response) {\n return result;\n }\n\n if (typeof result === 'string') {\n return new Response(result, TEXT_OPTS);\n }\n\n // Handle undefined/void return values - return empty 204 No Content\n if (result === undefined) {\n return new Response(null, { status: 204 });\n }\n\n return Response.json(result);\n }\n\n private normalizePath(path: string): string {\n if (!path.startsWith('/')) path = '/' + path;\n if (path !== '/' && path.endsWith('/')) path = path.slice(0, -1);\n\n return path.replace(/\\/+/g, '/');\n }\n\n private hasParams(path: string): boolean {\n return path.includes(':') || path.includes('*');\n }\n\n stop(): void {\n this.server?.stop?.();\n }\n\n /**\n * Error handler for Bun.serve.\n * Converts exceptions to proper HTTP responses.\n */\n private handleError(error: Error): Response {\n let response: Response;\n\n // HttpException - return custom response\n if (error instanceof HttpException) {\n response = error.toResponse();\n }\n // ValidationException - return 400 with errors\n else if (error instanceof ValidationException) {\n response = error.toResponse();\n }\n // Unknown error - return 500\n else {\n console.error('Unhandled error:', error);\n response = INTERNAL_ERROR_RESPONSE;\n }\n\n // Apply CORS headers if configured\n if (this.hasCors && this.corsHandler) {\n return this.corsHandler.apply(response, '*');\n }\n\n return response;\n }\n\n /**\n * Execute lifecycle hooks for a specific event type.\n */\n private executeLifecycleHooks(type: EventType): void {\n const handlers = getEventHandlers(type);\n\n for (const handler of handlers) {\n try {\n const instance = this.container.has(handler.target)\n ? this.container.get(handler.target)\n : null;\n\n if (instance && typeof (instance as any)[handler.methodName] === 'function') {\n const result = (instance as any)[handler.methodName]();\n\n // Handle async hooks\n if (result instanceof Promise) {\n result.catch((err: Error) =>\n console.error(`Error in ${type} hook ${handler.methodName}:`, err)\n );\n }\n }\n } catch (err) {\n console.error(`Error in ${type} hook ${handler.methodName}:`, err);\n }\n }\n }\n\n /**\n * Register SIGTERM/SIGINT handlers for graceful shutdown.\n */\n private registerShutdownHandlers(): void {\n const shutdown = () => {\n this.executeLifecycleHooks(EventType.SHUTDOWN);\n this.stop();\n process.exit(0);\n };\n\n process.on('SIGTERM', shutdown);\n process.on('SIGINT', shutdown);\n }\n}\n",
73
+ "import { PARAMS_META } from '../metadata';\n\nexport type ParamType = 'param' | 'query' | 'body' | 'header' | 'req' | 'ctx' | 'locals';\n\nexport interface ParamMetadata {\n type: ParamType;\n key?: string;\n index: number;\n}\n\nfunction createParamDecorator(type: ParamType, key?: string) {\n return function (target: any, propertyKey: string, index: number) {\n const params: ParamMetadata[] = Reflect.getMetadata(PARAMS_META, target.constructor, propertyKey) || [];\n\n params.push({ type, key, index });\n\n Reflect.defineMetadata(PARAMS_META, params, target.constructor, propertyKey);\n };\n}\n\nexport function Param(key?: string): ParameterDecorator {\n return createParamDecorator('param', key) as ParameterDecorator;\n}\n\nexport function Query(key?: string): ParameterDecorator {\n return createParamDecorator('query', key) as ParameterDecorator;\n}\n\nexport function Body(key?: string): ParameterDecorator {\n return createParamDecorator('body', key) as ParameterDecorator;\n}\n\nexport function Header(key?: string): ParameterDecorator {\n return createParamDecorator('header', key) as ParameterDecorator;\n}\n\nexport function Req(): ParameterDecorator {\n return createParamDecorator('req') as ParameterDecorator;\n}\n\nexport function Ctx(): ParameterDecorator {\n return createParamDecorator('ctx') as ParameterDecorator;\n}\n\nexport function Locals(key?: string): ParameterDecorator {\n return createParamDecorator('locals', key) as ParameterDecorator;\n}\n",
74
+ "import { MIDDLEWARE_META, type MiddlewareInfo } from '../metadata';\n\n/**\n * Middleware decorator.\n * Can be applied to controllers or individual methods.\n */\nexport function Use(...middlewares: Function[]): ClassDecorator & MethodDecorator {\n return function (target: any, propertyKey?: string) {\n const isMethod = propertyKey !== undefined;\n const metaTarget = isMethod ? target.constructor : target;\n const existing: MiddlewareInfo[] = Reflect.getMetadata(MIDDLEWARE_META, metaTarget) || [];\n\n for (const handler of middlewares) {\n existing.push({\n handler,\n target: isMethod ? propertyKey : undefined\n });\n }\n\n Reflect.defineMetadata(MIDDLEWARE_META, existing, metaTarget);\n } as ClassDecorator & MethodDecorator;\n}\n",
75
+ "import { SERVICE_META } from '../metadata';\nimport { Scope } from '../container/Container';\n\nexport interface ServiceOptions {\n scope?: Scope;\n}\n\n/**\n * Marks a class as an injectable service.\n * Services are singleton by default.\n */\nexport function Service(options: ServiceOptions = {}): ClassDecorator {\n return (target) => {\n Reflect.defineMetadata(SERVICE_META, {\n scope: options.scope ?? Scope.SINGLETON\n }, target);\n };\n}\n",
76
+ "import { INJECT_META } from '../metadata';\nimport type { Token } from '../container/Container';\n\n/**\n * Explicitly specifies which token to inject.\n * Useful for interfaces or when automatic detection fails.\n */\nexport function Inject(token: Token): ParameterDecorator {\n return (target, propertyKey, parameterIndex) => {\n const existing: Map<number, Token> = Reflect.getMetadata(INJECT_META, target) || new Map();\n\n existing.set(parameterIndex, token);\n\n Reflect.defineMetadata(INJECT_META, existing, target);\n };\n}\n",
77
+ "/**\n * Ultra-fast Radix Router for Turbo.\n * \n * Optimizations:\n * - Char code comparisons (no string allocations)\n * - Frozen empty params object\n * - O(1) method lookup via char code index\n * - Minimal allocations in hot path\n */\n\nconst EMPTY_PARAMS: Readonly<Record<string, string>> = Object.freeze({});\n\ninterface Node<T> {\n part: string;\n store: T | null;\n children: Map<number, Node<T>> | null;\n paramChild: ParamNode<T> | null;\n wildcardStore: T | null;\n}\n\ninterface ParamNode<T> {\n name: string;\n store: T | null;\n child: Node<T> | null;\n}\n\nexport interface RouteMatch<T> {\n store: T;\n params: Record<string, string>;\n}\n\nfunction createNode<T>(part: string): Node<T> {\n return {\n part,\n store: null,\n children: null,\n paramChild: null,\n wildcardStore: null\n };\n}\n\nexport class RadixRouter<T> {\n private roots: Record<string, Node<T>> = {};\n\n add(method: string, path: string, store: T): void {\n if (path === '') path = '/';\n if (path[0] !== '/') path = '/' + path;\n\n const isWildcard = path.endsWith('*');\n\n if (isWildcard) path = path.slice(0, -1);\n\n let node = this.roots[method];\n\n if (!node) {\n node = this.roots[method] = createNode('/');\n }\n\n let i = 0;\n const len = path.length;\n\n while (i < len) {\n const char = path.charCodeAt(i);\n\n if (char === 58) {\n const paramStart = i + 1;\n let paramEnd = paramStart;\n\n while (paramEnd < len && path.charCodeAt(paramEnd) !== 47) {\n paramEnd++;\n }\n\n const paramName = path.slice(paramStart, paramEnd);\n\n if (!node.paramChild) {\n node.paramChild = { name: paramName, store: null, child: null };\n }\n\n if (paramEnd >= len) {\n node.paramChild.store = store;\n return;\n }\n\n if (!node.paramChild.child) {\n node.paramChild.child = createNode(path.slice(paramEnd));\n }\n\n node = node.paramChild.child;\n i = paramEnd;\n continue;\n }\n\n let segmentEnd = i;\n\n while (segmentEnd < len && path.charCodeAt(segmentEnd) !== 47 && path.charCodeAt(segmentEnd) !== 58) {\n segmentEnd++;\n }\n\n if (segmentEnd < len && path.charCodeAt(segmentEnd) === 47) {\n segmentEnd++;\n }\n\n const segment = path.slice(i, segmentEnd);\n\n if (segment === node.part) {\n i = segmentEnd;\n continue;\n }\n\n if (!node.children) {\n node.children = new Map();\n }\n\n const firstChar = segment.charCodeAt(0);\n let child = node.children.get(firstChar);\n\n if (!child) {\n child = createNode(segment);\n node.children.set(firstChar, child);\n }\n\n node = child;\n i = segmentEnd;\n }\n\n if (isWildcard) {\n node.wildcardStore = store;\n } else {\n node.store = store;\n }\n }\n\n find(method: string, path: string): RouteMatch<T> | null {\n const root = this.roots[method];\n\n if (!root) return null;\n\n return this.matchPath(root, path, 0, path.length);\n }\n\n private matchPath(\n node: Node<T>,\n path: string,\n start: number,\n len: number\n ): RouteMatch<T> | null {\n const partLen = node.part.length;\n const end = start + partLen;\n\n if (partLen > 1) {\n if (end > len) return null;\n\n for (let i = 1, j = start + 1; i < partLen; i++, j++) {\n if (node.part.charCodeAt(i) !== path.charCodeAt(j)) {\n return null;\n }\n }\n }\n\n if (end === len) {\n if (node.store !== null) {\n return { store: node.store, params: EMPTY_PARAMS };\n }\n\n if (node.wildcardStore !== null) {\n return { store: node.wildcardStore, params: { '*': '' } };\n }\n\n return null;\n }\n\n if (node.children) {\n const child = node.children.get(path.charCodeAt(end));\n\n if (child) {\n const result = this.matchPath(child, path, end, len);\n\n if (result) return result;\n }\n }\n\n if (node.paramChild) {\n const param = node.paramChild;\n let paramEnd = end;\n\n while (paramEnd < len && path.charCodeAt(paramEnd) !== 47) {\n paramEnd++;\n }\n\n if (paramEnd === end) return null;\n\n const paramValue = path.slice(end, paramEnd);\n\n if (paramEnd >= len) {\n if (param.store !== null) {\n return {\n store: param.store,\n params: { [param.name]: paramValue }\n };\n }\n } else if (param.child) {\n const result = this.matchPath(param.child, path, paramEnd, len);\n\n if (result) {\n if (result.params === EMPTY_PARAMS) {\n result.params = { [param.name]: paramValue };\n } else {\n result.params[param.name] = paramValue;\n }\n\n return result;\n }\n }\n }\n\n if (node.wildcardStore !== null) {\n return {\n store: node.wildcardStore,\n params: { '*': path.slice(end) }\n };\n }\n\n return null;\n }\n}\n",
78
+ "import type { ValidatorAdapter, ValidationResult, ValidationError } from './ValidatorAdapter';\nimport { VALIDATION_SCHEMA, getSchema } from './ValidatorAdapter';\nimport { ValidationException } from './ZodAdapter';\n\n/**\n * Valibot Adapter for Turbo validation.\n * \n * Usage:\n * ```typescript\n * import * as v from 'valibot';\n * \n * @Schema(v.object({\n * name: v.pipe(v.string(), v.minLength(1)),\n * email: v.pipe(v.string(), v.email())\n * }))\n * class CreateUserDto {\n * name: string;\n * email: string;\n * }\n * ```\n */\nexport class ValibotAdapter implements ValidatorAdapter {\n readonly name = 'ValibotAdapter';\n\n private schemaCache = new Map<any, any>();\n private valibot: any = null;\n\n constructor() {\n // Lazy load valibot\n try {\n this.valibot = require('valibot');\n } catch {\n // Will be loaded on first use\n }\n }\n\n private ensureValibot(): any {\n if (!this.valibot) {\n this.valibot = require('valibot');\n }\n return this.valibot;\n }\n\n hasValidation(target: any): boolean {\n return getSchema(target) !== undefined;\n }\n\n validate<T>(target: any, value: unknown): ValidationResult<T> {\n const schema = this.getOrCacheSchema(target);\n\n if (!schema) {\n return { success: true, data: value as T };\n }\n\n const v = this.ensureValibot();\n const result = v.safeParse(schema, value);\n\n if (result.success) {\n return { success: true, data: result.output };\n }\n\n return {\n success: false,\n errors: this.formatErrors(result.issues)\n };\n }\n\n validateOrThrow<T>(target: any, value: unknown): T {\n const result = this.validate<T>(target, value);\n\n if (result.success) {\n return result.data!;\n }\n\n throw new ValidationException(result.errors!);\n }\n\n private getOrCacheSchema(target: any): any {\n let schema = this.schemaCache.get(target);\n\n if (schema === undefined) {\n schema = getSchema(target) ?? null;\n this.schemaCache.set(target, schema);\n }\n\n return schema;\n }\n\n private formatErrors(issues: any[]): ValidationError[] {\n return issues.map((issue: any) => ({\n path: issue.path?.map((p: any) => p.key).join('.') || '',\n message: issue.message\n }));\n }\n}\n",
79
+ "import type { CacheDriver } from './CacheDriver';\n\n/**\n * Redis Cache Driver Configuration.\n */\nexport interface RedisConfig {\n host?: string;\n port?: number;\n password?: string;\n db?: number;\n url?: string;\n}\n\n/**\n * Redis Cache Driver.\n * For distributed caching in multi-instance deployments.\n * \n * Uses Bun's native Redis client for maximum performance.\n */\nexport class RedisDriver implements CacheDriver {\n readonly name = 'RedisDriver';\n\n private client: any = null;\n private connected = false;\n\n constructor(private config: RedisConfig = {}) { }\n\n /**\n * Connect to Redis (lazy - connects on first use).\n */\n private async ensureConnected(): Promise<void> {\n if (this.connected) return;\n\n const url = this.config.url ||\n `redis://${this.config.host || 'localhost'}:${this.config.port || 6379}`;\n\n // Use Bun's native Redis client if available\n if (typeof Bun !== 'undefined' && (Bun as any).redis) {\n this.client = new (Bun as any).redis(url);\n } else {\n // Fallback to ioredis\n try {\n const Redis = require('ioredis');\n this.client = new Redis({\n host: this.config.host || 'localhost',\n port: this.config.port || 6379,\n password: this.config.password,\n db: this.config.db || 0\n });\n } catch {\n throw new Error('Redis client not available. Install ioredis or use Bun with Redis support.');\n }\n }\n\n this.connected = true;\n }\n\n async get<T>(key: string): Promise<T | null> {\n await this.ensureConnected();\n\n const value = await this.client.get(key);\n\n if (value === null) {\n return null;\n }\n\n try {\n return JSON.parse(value);\n } catch {\n return value as T;\n }\n }\n\n async set<T>(key: string, value: T, ttl?: number): Promise<boolean> {\n await this.ensureConnected();\n\n const serialized = typeof value === 'string' ? value : JSON.stringify(value);\n\n if (ttl) {\n await this.client.setex(key, ttl, serialized);\n } else {\n await this.client.set(key, serialized);\n }\n\n return true;\n }\n\n async del(key: string): Promise<boolean> {\n await this.ensureConnected();\n\n const result = await this.client.del(key);\n\n return result > 0;\n }\n\n async has(key: string): Promise<boolean> {\n await this.ensureConnected();\n\n const result = await this.client.exists(key);\n\n return result > 0;\n }\n\n async clear(): Promise<void> {\n await this.ensureConnected();\n\n await this.client.flushdb();\n }\n\n async close(): Promise<void> {\n if (this.client && this.connected) {\n await this.client.quit?.();\n this.connected = false;\n }\n }\n}\n",
80
+ "import type { Server } from 'bun';\nimport { Carno, type CarnoConfig } from '../Carno';\nimport { Container, type Token } from '../container/Container';\n\n/**\n * Test configuration options.\n */\nexport interface TestOptions {\n config?: CarnoConfig;\n listen?: boolean | number;\n port?: number;\n controllers?: (new (...args: any[]) => any)[];\n services?: (Token | any)[];\n}\n\n/**\n * Test harness - provides utilities for testing Carno applications.\n */\nexport interface TestHarness {\n /** The Carno app instance */\n app: Carno;\n\n /** The internal DI container */\n container: Container;\n\n /** The HTTP server (if listening) */\n server?: Server<any>;\n\n /** The port the server is running on */\n port?: number;\n\n /** Resolve a service from the container */\n resolve<T>(token: Token<T>): T;\n\n /** Make an HTTP request to the app */\n request(path: string, init?: RequestInit): Promise<Response>;\n\n /** Make a GET request */\n get(path: string, init?: Omit<RequestInit, 'method'>): Promise<Response>;\n\n /** Make a POST request */\n post(path: string, body?: any, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Response>;\n\n /** Make a PUT request */\n put(path: string, body?: any, init?: Omit<RequestInit, 'method' | 'body'>): Promise<Response>;\n\n /** Make a DELETE request */\n delete(path: string, init?: Omit<RequestInit, 'method'>): Promise<Response>;\n\n /** Close the test harness and cleanup */\n close(): Promise<void>;\n}\n\n/**\n * Create a test harness for Turbo applications.\n * \n * @example\n * ```typescript\n * const harness = await createTestHarness({\n * controllers: [UserController],\n * services: [UserService],\n * listen: true\n * });\n * \n * const response = await harness.get('/users');\n * expect(response.status).toBe(200);\n * \n * await harness.close();\n * ```\n */\nexport async function createTestHarness(options: TestOptions = {}): Promise<TestHarness> {\n const config: CarnoConfig = {\n ...options.config,\n disableStartupLog: true\n };\n\n const app = new Carno(config);\n\n // Register controllers\n if (options.controllers) {\n app.controllers(options.controllers);\n }\n\n // Register services\n if (options.services) {\n app.services(options.services);\n }\n\n const port = resolvePort(options);\n let server: Server<any> | undefined;\n\n if (shouldListen(options.listen)) {\n app.listen(port);\n server = (app as any).server;\n }\n\n const actualPort = server?.port ?? port;\n const container = (app as any).container as Container;\n\n // Pre-bind methods for performance\n const baseUrl = `http://127.0.0.1:${actualPort}`;\n\n const request = async (path: string, init?: RequestInit): Promise<Response> => {\n if (!server) {\n throw new Error('Server not running. Set listen: true in options.');\n }\n const url = path.startsWith('http') ? path : `${baseUrl}${path.startsWith('/') ? path : '/' + path}`;\n return fetch(url, init);\n };\n\n return {\n app,\n container,\n server,\n port: actualPort,\n\n resolve: <T>(token: Token<T>): T => container.get(token),\n\n request,\n\n get: (path, init) => request(path, { ...init, method: 'GET' }),\n\n post: (path, body, init) => request(path, {\n ...init,\n method: 'POST',\n body: body ? JSON.stringify(body) : undefined,\n headers: { 'Content-Type': 'application/json', ...init?.headers }\n }),\n\n put: (path, body, init) => request(path, {\n ...init,\n method: 'PUT',\n body: body ? JSON.stringify(body) : undefined,\n headers: { 'Content-Type': 'application/json', ...init?.headers }\n }),\n\n delete: (path, init) => request(path, { ...init, method: 'DELETE' }),\n\n close: async () => {\n app.stop();\n }\n };\n}\n\n/**\n * Run a test routine with automatic harness cleanup.\n * \n * @example\n * ```typescript\n * await withTestApp(async (harness) => {\n * const response = await harness.get('/health');\n * expect(response.status).toBe(200);\n * }, { controllers: [HealthController], listen: true });\n * ```\n */\nexport async function withTestApp(\n routine: (harness: TestHarness) => Promise<void>,\n options: TestOptions = {}\n): Promise<void> {\n const harness = await createTestHarness(options);\n\n try {\n await routine(harness);\n } finally {\n await harness.close();\n }\n}\n\nfunction shouldListen(value: TestOptions['listen']): boolean {\n return typeof value === 'number' || Boolean(value);\n}\n\nfunction resolvePort(options: TestOptions): number {\n if (typeof options.listen === 'number') return options.listen;\n if (typeof options.port === 'number') return options.port;\n return 0; // Random port\n}\n",
81
+ "/**\n * Utility class for handling metadata operations.\n * Wraps Reflect.getMetadata and Reflect.defineMetadata.\n */\nexport class Metadata {\n static get<T = any>(key: string | symbol, target: any): T | undefined {\n return Reflect.getMetadata(key, target);\n }\n\n static set(key: string | symbol, value: any, target: any): void {\n Reflect.defineMetadata(key, value, target);\n }\n\n static has(key: string | symbol, target: any): boolean {\n return Reflect.hasMetadata(key, target);\n }\n\n static delete(key: string | symbol, target: any): boolean {\n return Reflect.deleteMetadata(key, target);\n }\n\n static keys(target: any): (string | symbol)[] {\n return Reflect.getMetadataKeys(target);\n }\n\n static getType(target: any, propertyKey: string | symbol): any {\n return Reflect.getMetadata('design:type', target, propertyKey);\n }\n}\n\n/**\n * Type guard for checking if value is an object.\n */\nexport function isObject(value: unknown): value is Record<string, any> {\n return typeof value === 'object' && value !== null && !Array.isArray(value);\n}\n\n/**\n * Type guard for checking if value is a string.\n */\nexport function isString(value: unknown): value is string {\n return typeof value === 'string';\n}\n"
82
+ ],
83
+ "mappings": ";u4lBACA,IAAI,gBAAmB,SAAQ,QAAK,iBAAoB,QAAS,CAAC,IAAK,CACnE,OAAQ,KAAO,IAAI,WAAc,IAAM,CAAE,QAAW,GAAI,GAE5D,OAAO,eAAe,QAAS,aAAc,CAAE,MAAO,EAAK,CAAC,EAC5D,QAAQ,cAAgB,QAAQ,QAAU,QAAQ,OAAS,QAAQ,KAAY,OAC/E,IAAM,gBAAkB,kCAA0C,EAMlE,QAAQ,KAAO,OAAO,KAAK,gBAAgB,OAAO,EAClD,IAAM,MAAQ,CAAC,EACf,QAAQ,KAAK,QAAQ,CAAC,cAAgB,CAClC,MAAM,aAAe,gBAAgB,QAAQ,aAAa,MAAM,OAAO,QAAS,CAAC,OAAO,KAAM,CAE1F,OADA,OAAM,MAAQ,GACP,QACR,CAAC,CAAC,EACR,EAID,SAAS,MAAM,CAAC,YAAa,CACzB,OAAO,QAAQ,gBAAgB,QAAQ,YAAY,EAEvD,QAAQ,OAAS,OAMjB,SAAS,OAAO,CAAC,YAAa,KAAM,CAChC,GAAI,CAAC,MAAM,aACP,MAAU,MAAM,mBAAqB,WAAW,EAEpD,OAAO,QAAQ,MAAM,aAAa,KAAK,EAE3C,QAAQ,QAAU,QAUlB,SAAS,aAAa,CAAC,YAAa,KAAM,QAAS,CAC/C,IAAM,QAAU,gBAAgB,QAAQ,aACxC,GAAI,CAAC,QACD,MAAU,MAAM,mBAAqB,WAAW,EAEpD,GAAI,CAAC,MAAM,QAAQ,IAAI,EACnB,MAAU,MAAM,4BAA4B,EAEhD,IAAM,KAAO,CAAC,EACR,iBAAmB,QAAQ,SAAW,QAAQ,gBAAgB,EAC9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