@budibase/backend-core 3.2.26 → 3.2.27

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 (466) hide show
  1. package/dist/index.js +62 -23
  2. package/dist/index.js.map +4 -4
  3. package/dist/index.js.meta.json +1 -1
  4. package/dist/package.json +7 -7
  5. package/dist/plugins.js.map +2 -2
  6. package/dist/plugins.js.meta.json +1 -1
  7. package/dist/src/events/processors/types.d.ts +1 -1
  8. package/dist/src/events/publishers/index.d.ts +1 -0
  9. package/dist/src/events/publishers/rowAction.d.ts +6 -0
  10. package/dist/src/events/publishers/table.d.ts +2 -2
  11. package/dist/src/events/publishers/view.d.ts +17 -6
  12. package/dist/src/index.d.ts +11 -11
  13. package/dist/src/platform/platformDb.d.ts +1 -1
  14. package/dist/src/queue/queue.d.ts +1 -1
  15. package/dist/src/tenancy/db.d.ts +1 -1
  16. package/package.json +7 -7
  17. package/dist/jest.config.js +0 -25
  18. package/dist/jest.config.js.map +0 -1
  19. package/dist/src/accounts/accounts.js +0 -83
  20. package/dist/src/accounts/accounts.js.map +0 -1
  21. package/dist/src/accounts/api.js +0 -102
  22. package/dist/src/accounts/api.js.map +0 -1
  23. package/dist/src/accounts/index.js +0 -18
  24. package/dist/src/accounts/index.js.map +0 -1
  25. package/dist/src/auth/auth.js +0 -198
  26. package/dist/src/auth/auth.js.map +0 -1
  27. package/dist/src/auth/index.js +0 -18
  28. package/dist/src/auth/index.js.map +0 -1
  29. package/dist/src/blacklist/blacklist.js +0 -75
  30. package/dist/src/blacklist/blacklist.js.map +0 -1
  31. package/dist/src/blacklist/index.js +0 -18
  32. package/dist/src/blacklist/index.js.map +0 -1
  33. package/dist/src/cache/appMetadata.js +0 -96
  34. package/dist/src/cache/appMetadata.js.map +0 -1
  35. package/dist/src/cache/base/index.js +0 -189
  36. package/dist/src/cache/base/index.js.map +0 -1
  37. package/dist/src/cache/docWritethrough.js +0 -123
  38. package/dist/src/cache/docWritethrough.js.map +0 -1
  39. package/dist/src/cache/generic.js +0 -37
  40. package/dist/src/cache/generic.js.map +0 -1
  41. package/dist/src/cache/index.js +0 -48
  42. package/dist/src/cache/index.js.map +0 -1
  43. package/dist/src/cache/invite.js +0 -128
  44. package/dist/src/cache/invite.js.map +0 -1
  45. package/dist/src/cache/passwordReset.js +0 -92
  46. package/dist/src/cache/passwordReset.js.map +0 -1
  47. package/dist/src/cache/user.js +0 -183
  48. package/dist/src/cache/user.js.map +0 -1
  49. package/dist/src/cache/writethrough.js +0 -170
  50. package/dist/src/cache/writethrough.js.map +0 -1
  51. package/dist/src/configs/configs.js +0 -294
  52. package/dist/src/configs/configs.js.map +0 -1
  53. package/dist/src/configs/index.js +0 -18
  54. package/dist/src/configs/index.js.map +0 -1
  55. package/dist/src/constants/db.js +0 -75
  56. package/dist/src/constants/db.js.map +0 -1
  57. package/dist/src/constants/index.js +0 -19
  58. package/dist/src/constants/index.js.map +0 -1
  59. package/dist/src/constants/misc.js +0 -40
  60. package/dist/src/constants/misc.js.map +0 -1
  61. package/dist/src/context/Context.js +0 -14
  62. package/dist/src/context/Context.js.map +0 -1
  63. package/dist/src/context/identity.js +0 -81
  64. package/dist/src/context/identity.js.map +0 -1
  65. package/dist/src/context/index.js +0 -44
  66. package/dist/src/context/index.js.map +0 -1
  67. package/dist/src/context/mainContext.js +0 -446
  68. package/dist/src/context/mainContext.js.map +0 -1
  69. package/dist/src/context/types.js +0 -3
  70. package/dist/src/context/types.js.map +0 -1
  71. package/dist/src/db/Replication.js +0 -90
  72. package/dist/src/db/Replication.js.map +0 -1
  73. package/dist/src/db/couch/DatabaseImpl.js +0 -475
  74. package/dist/src/db/couch/DatabaseImpl.js.map +0 -1
  75. package/dist/src/db/couch/connections.js +0 -101
  76. package/dist/src/db/couch/connections.js.map +0 -1
  77. package/dist/src/db/couch/index.js +0 -26
  78. package/dist/src/db/couch/index.js.map +0 -1
  79. package/dist/src/db/couch/pouchDB.js +0 -108
  80. package/dist/src/db/couch/pouchDB.js.map +0 -1
  81. package/dist/src/db/couch/pouchDump.js +0 -2
  82. package/dist/src/db/couch/pouchDump.js.map +0 -1
  83. package/dist/src/db/couch/utils.js +0 -60
  84. package/dist/src/db/couch/utils.js.map +0 -1
  85. package/dist/src/db/db.js +0 -47
  86. package/dist/src/db/db.js.map +0 -1
  87. package/dist/src/db/errors.js +0 -21
  88. package/dist/src/db/errors.js.map +0 -1
  89. package/dist/src/db/index.js +0 -58
  90. package/dist/src/db/index.js.map +0 -1
  91. package/dist/src/db/instrumentation.js +0 -202
  92. package/dist/src/db/instrumentation.js.map +0 -1
  93. package/dist/src/db/lucene.js +0 -638
  94. package/dist/src/db/lucene.js.map +0 -1
  95. package/dist/src/db/searchIndexes/index.js +0 -18
  96. package/dist/src/db/searchIndexes/index.js.map +0 -1
  97. package/dist/src/db/searchIndexes/searchIndexes.js +0 -76
  98. package/dist/src/db/searchIndexes/searchIndexes.js.map +0 -1
  99. package/dist/src/db/utils.js +0 -212
  100. package/dist/src/db/utils.js.map +0 -1
  101. package/dist/src/db/views.js +0 -224
  102. package/dist/src/db/views.js.map +0 -1
  103. package/dist/src/docIds/conversions.js +0 -62
  104. package/dist/src/docIds/conversions.js.map +0 -1
  105. package/dist/src/docIds/ids.js +0 -125
  106. package/dist/src/docIds/ids.js.map +0 -1
  107. package/dist/src/docIds/index.js +0 -19
  108. package/dist/src/docIds/index.js.map +0 -1
  109. package/dist/src/docIds/newid.js +0 -8
  110. package/dist/src/docIds/newid.js.map +0 -1
  111. package/dist/src/docIds/params.js +0 -141
  112. package/dist/src/docIds/params.js.map +0 -1
  113. package/dist/src/docUpdates/index.js +0 -35
  114. package/dist/src/docUpdates/index.js.map +0 -1
  115. package/dist/src/environment.js +0 -182
  116. package/dist/src/environment.js.map +0 -1
  117. package/dist/src/errors/errors.js +0 -97
  118. package/dist/src/errors/errors.js.map +0 -1
  119. package/dist/src/errors/index.js +0 -18
  120. package/dist/src/errors/index.js.map +0 -1
  121. package/dist/src/events/analytics.js +0 -52
  122. package/dist/src/events/analytics.js.map +0 -1
  123. package/dist/src/events/asyncEvents/index.js +0 -19
  124. package/dist/src/events/asyncEvents/index.js.map +0 -1
  125. package/dist/src/events/asyncEvents/publisher.js +0 -26
  126. package/dist/src/events/asyncEvents/publisher.js.map +0 -1
  127. package/dist/src/events/asyncEvents/queue.js +0 -26
  128. package/dist/src/events/asyncEvents/queue.js.map +0 -1
  129. package/dist/src/events/backfill.js +0 -189
  130. package/dist/src/events/backfill.js.map +0 -1
  131. package/dist/src/events/documentId.js +0 -27
  132. package/dist/src/events/documentId.js.map +0 -1
  133. package/dist/src/events/events.js +0 -87
  134. package/dist/src/events/events.js.map +0 -1
  135. package/dist/src/events/identification.js +0 -299
  136. package/dist/src/events/identification.js.map +0 -1
  137. package/dist/src/events/index.js +0 -59
  138. package/dist/src/events/index.js.map +0 -1
  139. package/dist/src/events/processors/AnalyticsProcessor.js +0 -103
  140. package/dist/src/events/processors/AnalyticsProcessor.js.map +0 -1
  141. package/dist/src/events/processors/AuditLogsProcessor.js +0 -86
  142. package/dist/src/events/processors/AuditLogsProcessor.js.map +0 -1
  143. package/dist/src/events/processors/LoggingProcessor.js +0 -47
  144. package/dist/src/events/processors/LoggingProcessor.js.map +0 -1
  145. package/dist/src/events/processors/Processors.js +0 -52
  146. package/dist/src/events/processors/Processors.js.map +0 -1
  147. package/dist/src/events/processors/async/DocumentUpdateProcessor.js +0 -44
  148. package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +0 -1
  149. package/dist/src/events/processors/index.js +0 -23
  150. package/dist/src/events/processors/index.js.map +0 -1
  151. package/dist/src/events/processors/posthog/PosthogProcessor.js +0 -149
  152. package/dist/src/events/processors/posthog/PosthogProcessor.js.map +0 -1
  153. package/dist/src/events/processors/posthog/index.js +0 -8
  154. package/dist/src/events/processors/posthog/index.js.map +0 -1
  155. package/dist/src/events/processors/posthog/rateLimiting.js +0 -129
  156. package/dist/src/events/processors/posthog/rateLimiting.js.map +0 -1
  157. package/dist/src/events/processors/types.js +0 -3
  158. package/dist/src/events/processors/types.js.map +0 -1
  159. package/dist/src/events/publishers/account.js +0 -43
  160. package/dist/src/events/publishers/account.js.map +0 -1
  161. package/dist/src/events/publishers/ai.js +0 -30
  162. package/dist/src/events/publishers/ai.js.map +0 -1
  163. package/dist/src/events/publishers/app.js +0 -166
  164. package/dist/src/events/publishers/app.js.map +0 -1
  165. package/dist/src/events/publishers/auditLog.js +0 -34
  166. package/dist/src/events/publishers/auditLog.js.map +0 -1
  167. package/dist/src/events/publishers/auth.js +0 -80
  168. package/dist/src/events/publishers/auth.js.map +0 -1
  169. package/dist/src/events/publishers/automation.js +0 -117
  170. package/dist/src/events/publishers/automation.js.map +0 -1
  171. package/dist/src/events/publishers/backfill.js +0 -85
  172. package/dist/src/events/publishers/backfill.js.map +0 -1
  173. package/dist/src/events/publishers/backup.js +0 -41
  174. package/dist/src/events/publishers/backup.js.map +0 -1
  175. package/dist/src/events/publishers/datasource.js +0 -54
  176. package/dist/src/events/publishers/datasource.js.map +0 -1
  177. package/dist/src/events/publishers/email.js +0 -30
  178. package/dist/src/events/publishers/email.js.map +0 -1
  179. package/dist/src/events/publishers/environmentVariable.js +0 -44
  180. package/dist/src/events/publishers/environmentVariable.js.map +0 -1
  181. package/dist/src/events/publishers/group.js +0 -107
  182. package/dist/src/events/publishers/group.js.map +0 -1
  183. package/dist/src/events/publishers/index.js +0 -57
  184. package/dist/src/events/publishers/index.js.map +0 -1
  185. package/dist/src/events/publishers/installation.js +0 -52
  186. package/dist/src/events/publishers/installation.js.map +0 -1
  187. package/dist/src/events/publishers/layout.js +0 -34
  188. package/dist/src/events/publishers/layout.js.map +0 -1
  189. package/dist/src/events/publishers/license.js +0 -77
  190. package/dist/src/events/publishers/license.js.map +0 -1
  191. package/dist/src/events/publishers/org.js +0 -52
  192. package/dist/src/events/publishers/org.js.map +0 -1
  193. package/dist/src/events/publishers/plugin.js +0 -55
  194. package/dist/src/events/publishers/plugin.js.map +0 -1
  195. package/dist/src/events/publishers/query.js +0 -74
  196. package/dist/src/events/publishers/query.js.map +0 -1
  197. package/dist/src/events/publishers/role.js +0 -69
  198. package/dist/src/events/publishers/role.js.map +0 -1
  199. package/dist/src/events/publishers/rows.js +0 -32
  200. package/dist/src/events/publishers/rows.js.map +0 -1
  201. package/dist/src/events/publishers/screen.js +0 -46
  202. package/dist/src/events/publishers/screen.js.map +0 -1
  203. package/dist/src/events/publishers/serve.js +0 -47
  204. package/dist/src/events/publishers/serve.js.map +0 -1
  205. package/dist/src/events/publishers/table.js +0 -77
  206. package/dist/src/events/publishers/table.js.map +0 -1
  207. package/dist/src/events/publishers/user.js +0 -201
  208. package/dist/src/events/publishers/user.js.map +0 -1
  209. package/dist/src/events/publishers/view.js +0 -111
  210. package/dist/src/events/publishers/view.js.map +0 -1
  211. package/dist/src/features/features.js +0 -271
  212. package/dist/src/features/features.js.map +0 -1
  213. package/dist/src/features/index.js +0 -42
  214. package/dist/src/features/index.js.map +0 -1
  215. package/dist/src/features/tests/utils.js +0 -56
  216. package/dist/src/features/tests/utils.js.map +0 -1
  217. package/dist/src/helpers.js +0 -13
  218. package/dist/src/helpers.js.map +0 -1
  219. package/dist/src/index.js +0 -99
  220. package/dist/src/index.js.map +0 -1
  221. package/dist/src/installation.js +0 -159
  222. package/dist/src/installation.js.map +0 -1
  223. package/dist/src/logging/alerts.js +0 -23
  224. package/dist/src/logging/alerts.js.map +0 -1
  225. package/dist/src/logging/correlation/correlation.js +0 -18
  226. package/dist/src/logging/correlation/correlation.js.map +0 -1
  227. package/dist/src/logging/correlation/index.js +0 -18
  228. package/dist/src/logging/correlation/index.js.map +0 -1
  229. package/dist/src/logging/correlation/middleware.js +0 -17
  230. package/dist/src/logging/correlation/middleware.js.map +0 -1
  231. package/dist/src/logging/index.js +0 -45
  232. package/dist/src/logging/index.js.map +0 -1
  233. package/dist/src/logging/pino/logger.js +0 -234
  234. package/dist/src/logging/pino/logger.js.map +0 -1
  235. package/dist/src/logging/pino/middleware.js +0 -46
  236. package/dist/src/logging/pino/middleware.js.map +0 -1
  237. package/dist/src/logging/system.js +0 -110
  238. package/dist/src/logging/system.js.map +0 -1
  239. package/dist/src/middleware/adminOnly.js +0 -19
  240. package/dist/src/middleware/adminOnly.js.map +0 -1
  241. package/dist/src/middleware/auditLog.js +0 -18
  242. package/dist/src/middleware/auditLog.js.map +0 -1
  243. package/dist/src/middleware/authenticated.js +0 -254
  244. package/dist/src/middleware/authenticated.js.map +0 -1
  245. package/dist/src/middleware/builderOnly.js +0 -33
  246. package/dist/src/middleware/builderOnly.js.map +0 -1
  247. package/dist/src/middleware/builderOrAdmin.js +0 -33
  248. package/dist/src/middleware/builderOrAdmin.js.map +0 -1
  249. package/dist/src/middleware/contentSecurityPolicy.js +0 -124
  250. package/dist/src/middleware/contentSecurityPolicy.js.map +0 -1
  251. package/dist/src/middleware/csrf.js +0 -81
  252. package/dist/src/middleware/csrf.js.map +0 -1
  253. package/dist/src/middleware/errorHandling.js +0 -88
  254. package/dist/src/middleware/errorHandling.js.map +0 -1
  255. package/dist/src/middleware/index.js +0 -79
  256. package/dist/src/middleware/index.js.map +0 -1
  257. package/dist/src/middleware/internalApi.js +0 -30
  258. package/dist/src/middleware/internalApi.js.map +0 -1
  259. package/dist/src/middleware/ip.js +0 -23
  260. package/dist/src/middleware/ip.js.map +0 -1
  261. package/dist/src/middleware/joi-validator.js +0 -53
  262. package/dist/src/middleware/joi-validator.js.map +0 -1
  263. package/dist/src/middleware/matchers.js +0 -36
  264. package/dist/src/middleware/matchers.js.map +0 -1
  265. package/dist/src/middleware/passport/datasource/google.js +0 -107
  266. package/dist/src/middleware/passport/datasource/google.js.map +0 -1
  267. package/dist/src/middleware/passport/local.js +0 -91
  268. package/dist/src/middleware/passport/local.js.map +0 -1
  269. package/dist/src/middleware/passport/sso/google.js +0 -98
  270. package/dist/src/middleware/passport/sso/google.js.map +0 -1
  271. package/dist/src/middleware/passport/sso/oidc.js +0 -158
  272. package/dist/src/middleware/passport/sso/oidc.js.map +0 -1
  273. package/dist/src/middleware/passport/sso/sso.js +0 -150
  274. package/dist/src/middleware/passport/sso/sso.js.map +0 -1
  275. package/dist/src/middleware/passport/utils.js +0 -75
  276. package/dist/src/middleware/passport/utils.js.map +0 -1
  277. package/dist/src/middleware/querystringToBody.js +0 -29
  278. package/dist/src/middleware/querystringToBody.js.map +0 -1
  279. package/dist/src/middleware/tenancy.js +0 -37
  280. package/dist/src/middleware/tenancy.js.map +0 -1
  281. package/dist/src/migrations/definitions.js +0 -39
  282. package/dist/src/migrations/definitions.js.map +0 -1
  283. package/dist/src/migrations/index.js +0 -19
  284. package/dist/src/migrations/index.js.map +0 -1
  285. package/dist/src/migrations/migrations.js +0 -203
  286. package/dist/src/migrations/migrations.js.map +0 -1
  287. package/dist/src/objectStore/buckets/app.js +0 -95
  288. package/dist/src/objectStore/buckets/app.js.map +0 -1
  289. package/dist/src/objectStore/buckets/global.js +0 -68
  290. package/dist/src/objectStore/buckets/global.js.map +0 -1
  291. package/dist/src/objectStore/buckets/index.js +0 -20
  292. package/dist/src/objectStore/buckets/index.js.map +0 -1
  293. package/dist/src/objectStore/buckets/plugins.js +0 -104
  294. package/dist/src/objectStore/buckets/plugins.js.map +0 -1
  295. package/dist/src/objectStore/cloudfront.js +0 -73
  296. package/dist/src/objectStore/cloudfront.js.map +0 -1
  297. package/dist/src/objectStore/index.js +0 -20
  298. package/dist/src/objectStore/index.js.map +0 -1
  299. package/dist/src/objectStore/objectStore.js +0 -509
  300. package/dist/src/objectStore/objectStore.js.map +0 -1
  301. package/dist/src/objectStore/utils.js +0 -148
  302. package/dist/src/objectStore/utils.js.map +0 -1
  303. package/dist/src/platform/index.js +0 -43
  304. package/dist/src/platform/index.js.map +0 -1
  305. package/dist/src/platform/platformDb.js +0 -9
  306. package/dist/src/platform/platformDb.js.map +0 -1
  307. package/dist/src/platform/tenants.js +0 -149
  308. package/dist/src/platform/tenants.js.map +0 -1
  309. package/dist/src/platform/users.js +0 -118
  310. package/dist/src/platform/users.js.map +0 -1
  311. package/dist/src/plugin/index.js +0 -18
  312. package/dist/src/plugin/index.js.map +0 -1
  313. package/dist/src/plugin/utils.js +0 -158
  314. package/dist/src/plugin/utils.js.map +0 -1
  315. package/dist/src/queue/constants.js +0 -13
  316. package/dist/src/queue/constants.js.map +0 -1
  317. package/dist/src/queue/inMemoryQueue.js +0 -192
  318. package/dist/src/queue/inMemoryQueue.js.map +0 -1
  319. package/dist/src/queue/index.js +0 -19
  320. package/dist/src/queue/index.js.map +0 -1
  321. package/dist/src/queue/listeners.js +0 -199
  322. package/dist/src/queue/listeners.js.map +0 -1
  323. package/dist/src/queue/queue.js +0 -124
  324. package/dist/src/queue/queue.js.map +0 -1
  325. package/dist/src/redis/index.js +0 -47
  326. package/dist/src/redis/index.js.map +0 -1
  327. package/dist/src/redis/init.js +0 -184
  328. package/dist/src/redis/init.js.map +0 -1
  329. package/dist/src/redis/redis.js +0 -396
  330. package/dist/src/redis/redis.js.map +0 -1
  331. package/dist/src/redis/redlockImpl.js +0 -181
  332. package/dist/src/redis/redlockImpl.js.map +0 -1
  333. package/dist/src/redis/utils.js +0 -131
  334. package/dist/src/redis/utils.js.map +0 -1
  335. package/dist/src/security/auth.js +0 -26
  336. package/dist/src/security/auth.js.map +0 -1
  337. package/dist/src/security/encryption.js +0 -169
  338. package/dist/src/security/encryption.js.map +0 -1
  339. package/dist/src/security/index.js +0 -18
  340. package/dist/src/security/index.js.map +0 -1
  341. package/dist/src/security/permissions.js +0 -147
  342. package/dist/src/security/permissions.js.map +0 -1
  343. package/dist/src/security/roles.js +0 -566
  344. package/dist/src/security/roles.js.map +0 -1
  345. package/dist/src/security/secrets.js +0 -53
  346. package/dist/src/security/secrets.js.map +0 -1
  347. package/dist/src/security/sessions.js +0 -156
  348. package/dist/src/security/sessions.js.map +0 -1
  349. package/dist/src/sql/designDoc.js +0 -19
  350. package/dist/src/sql/designDoc.js.map +0 -1
  351. package/dist/src/sql/index.js +0 -47
  352. package/dist/src/sql/index.js.map +0 -1
  353. package/dist/src/sql/sql.js +0 -1536
  354. package/dist/src/sql/sql.js.map +0 -1
  355. package/dist/src/sql/sqlTable.js +0 -256
  356. package/dist/src/sql/sqlTable.js.map +0 -1
  357. package/dist/src/sql/utils.js +0 -179
  358. package/dist/src/sql/utils.js.map +0 -1
  359. package/dist/src/tenancy/db.js +0 -9
  360. package/dist/src/tenancy/db.js.map +0 -1
  361. package/dist/src/tenancy/index.js +0 -19
  362. package/dist/src/tenancy/index.js.map +0 -1
  363. package/dist/src/tenancy/tenancy.js +0 -125
  364. package/dist/src/tenancy/tenancy.js.map +0 -1
  365. package/dist/src/timers/index.js +0 -18
  366. package/dist/src/timers/index.js.map +0 -1
  367. package/dist/src/timers/timers.js +0 -25
  368. package/dist/src/timers/timers.js.map +0 -1
  369. package/dist/src/users/db.js +0 -489
  370. package/dist/src/users/db.js.map +0 -1
  371. package/dist/src/users/events.js +0 -179
  372. package/dist/src/users/events.js.map +0 -1
  373. package/dist/src/users/index.js +0 -23
  374. package/dist/src/users/index.js.map +0 -1
  375. package/dist/src/users/lookup.js +0 -126
  376. package/dist/src/users/lookup.js.map +0 -1
  377. package/dist/src/users/users.js +0 -376
  378. package/dist/src/users/users.js.map +0 -1
  379. package/dist/src/users/utils.js +0 -127
  380. package/dist/src/users/utils.js.map +0 -1
  381. package/dist/src/utils/Duration.js +0 -54
  382. package/dist/src/utils/Duration.js.map +0 -1
  383. package/dist/src/utils/hashing.js +0 -46
  384. package/dist/src/utils/hashing.js.map +0 -1
  385. package/dist/src/utils/index.js +0 -21
  386. package/dist/src/utils/index.js.map +0 -1
  387. package/dist/src/utils/stringUtils.js +0 -8
  388. package/dist/src/utils/stringUtils.js.map +0 -1
  389. package/dist/src/utils/utils.js +0 -267
  390. package/dist/src/utils/utils.js.map +0 -1
  391. package/dist/tests/core/logging.js +0 -33
  392. package/dist/tests/core/logging.js.map +0 -1
  393. package/dist/tests/core/utilities/index.js +0 -48
  394. package/dist/tests/core/utilities/index.js.map +0 -1
  395. package/dist/tests/core/utilities/jestUtils.js +0 -21
  396. package/dist/tests/core/utilities/jestUtils.js.map +0 -1
  397. package/dist/tests/core/utilities/mocks/alerts.js +0 -40
  398. package/dist/tests/core/utilities/mocks/alerts.js.map +0 -1
  399. package/dist/tests/core/utilities/mocks/date.js +0 -6
  400. package/dist/tests/core/utilities/mocks/date.js.map +0 -1
  401. package/dist/tests/core/utilities/mocks/events.js +0 -154
  402. package/dist/tests/core/utilities/mocks/events.js.map +0 -1
  403. package/dist/tests/core/utilities/mocks/index.js +0 -47
  404. package/dist/tests/core/utilities/mocks/index.js.map +0 -1
  405. package/dist/tests/core/utilities/mocks/licenses.js +0 -109
  406. package/dist/tests/core/utilities/mocks/licenses.js.map +0 -1
  407. package/dist/tests/core/utilities/queue.js +0 -21
  408. package/dist/tests/core/utilities/queue.js.map +0 -1
  409. package/dist/tests/core/utilities/structures/Chance.js +0 -21
  410. package/dist/tests/core/utilities/structures/Chance.js.map +0 -1
  411. package/dist/tests/core/utilities/structures/accounts.js +0 -43
  412. package/dist/tests/core/utilities/structures/accounts.js.map +0 -1
  413. package/dist/tests/core/utilities/structures/apps.js +0 -23
  414. package/dist/tests/core/utilities/structures/apps.js.map +0 -1
  415. package/dist/tests/core/utilities/structures/common.js +0 -11
  416. package/dist/tests/core/utilities/structures/common.js.map +0 -1
  417. package/dist/tests/core/utilities/structures/db.js +0 -15
  418. package/dist/tests/core/utilities/structures/db.js.map +0 -1
  419. package/dist/tests/core/utilities/structures/documents/index.js +0 -18
  420. package/dist/tests/core/utilities/structures/documents/index.js.map +0 -1
  421. package/dist/tests/core/utilities/structures/documents/platform/index.js +0 -38
  422. package/dist/tests/core/utilities/structures/documents/platform/index.js.map +0 -1
  423. package/dist/tests/core/utilities/structures/documents/platform/installation.js +0 -47
  424. package/dist/tests/core/utilities/structures/documents/platform/installation.js.map +0 -1
  425. package/dist/tests/core/utilities/structures/generator.js +0 -9
  426. package/dist/tests/core/utilities/structures/generator.js.map +0 -1
  427. package/dist/tests/core/utilities/structures/index.js +0 -56
  428. package/dist/tests/core/utilities/structures/index.js.map +0 -1
  429. package/dist/tests/core/utilities/structures/koa.js +0 -10
  430. package/dist/tests/core/utilities/structures/koa.js.map +0 -1
  431. package/dist/tests/core/utilities/structures/licenses.js +0 -157
  432. package/dist/tests/core/utilities/structures/licenses.js.map +0 -1
  433. package/dist/tests/core/utilities/structures/plugins.js +0 -22
  434. package/dist/tests/core/utilities/structures/plugins.js.map +0 -1
  435. package/dist/tests/core/utilities/structures/quotas.js +0 -73
  436. package/dist/tests/core/utilities/structures/quotas.js.map +0 -1
  437. package/dist/tests/core/utilities/structures/scim.js +0 -62
  438. package/dist/tests/core/utilities/structures/scim.js.map +0 -1
  439. package/dist/tests/core/utilities/structures/sso.js +0 -140
  440. package/dist/tests/core/utilities/structures/sso.js.map +0 -1
  441. package/dist/tests/core/utilities/structures/tenants.js +0 -8
  442. package/dist/tests/core/utilities/structures/tenants.js.map +0 -1
  443. package/dist/tests/core/utilities/structures/userGroups.js +0 -12
  444. package/dist/tests/core/utilities/structures/userGroups.js.map +0 -1
  445. package/dist/tests/core/utilities/structures/users.js +0 -53
  446. package/dist/tests/core/utilities/structures/users.js.map +0 -1
  447. package/dist/tests/core/utilities/testContainerUtils.js +0 -161
  448. package/dist/tests/core/utilities/testContainerUtils.js.map +0 -1
  449. package/dist/tests/core/utilities/utils/index.js +0 -39
  450. package/dist/tests/core/utilities/utils/index.js.map +0 -1
  451. package/dist/tests/core/utilities/utils/queue.js +0 -37
  452. package/dist/tests/core/utilities/utils/queue.js.map +0 -1
  453. package/dist/tests/core/utilities/utils/time.js +0 -7
  454. package/dist/tests/core/utilities/utils/time.js.map +0 -1
  455. package/dist/tests/extra/DBTestConfiguration.js +0 -65
  456. package/dist/tests/extra/DBTestConfiguration.js.map +0 -1
  457. package/dist/tests/extra/index.js +0 -43
  458. package/dist/tests/extra/index.js.map +0 -1
  459. package/dist/tests/extra/testEnv.js +0 -136
  460. package/dist/tests/extra/testEnv.js.map +0 -1
  461. package/dist/tests/index.js +0 -19
  462. package/dist/tests/index.js.map +0 -1
  463. package/dist/tests/jestEnv.js +0 -12
  464. package/dist/tests/jestEnv.js.map +0 -1
  465. package/dist/tests/jestSetup.js +0 -33
  466. package/dist/tests/jestSetup.js.map +0 -1
@@ -1,184 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.init = init;
49
- exports.shutdown = shutdown;
50
- exports.getUserClient = getUserClient;
51
- exports.getSessionClient = getSessionClient;
52
- exports.getAppClient = getAppClient;
53
- exports.getCacheClient = getCacheClient;
54
- exports.getWritethroughClient = getWritethroughClient;
55
- exports.getLockClient = getLockClient;
56
- exports.getSocketClient = getSocketClient;
57
- exports.getInviteClient = getInviteClient;
58
- exports.getPasswordResetClient = getPasswordResetClient;
59
- exports.getDocWritethroughClient = getDocWritethroughClient;
60
- const redis_1 = __importDefault(require("./redis"));
61
- const utils = __importStar(require("./utils"));
62
- let userClient, sessionClient, appClient, cacheClient, writethroughClient, lockClient, socketClient, inviteClient, passwordResetClient, docWritethroughClient;
63
- function init() {
64
- return __awaiter(this, void 0, void 0, function* () {
65
- userClient = yield new redis_1.default(utils.Databases.USER_CACHE).init();
66
- sessionClient = yield new redis_1.default(utils.Databases.SESSIONS).init();
67
- appClient = yield new redis_1.default(utils.Databases.APP_METADATA).init();
68
- cacheClient = yield new redis_1.default(utils.Databases.GENERIC_CACHE).init();
69
- lockClient = yield new redis_1.default(utils.Databases.LOCKS).init();
70
- writethroughClient = yield new redis_1.default(utils.Databases.WRITE_THROUGH).init();
71
- inviteClient = yield new redis_1.default(utils.Databases.INVITATIONS).init();
72
- passwordResetClient = yield new redis_1.default(utils.Databases.PW_RESETS).init();
73
- socketClient = yield new redis_1.default(utils.Databases.SOCKET_IO, utils.SelectableDatabase.SOCKET_IO).init();
74
- docWritethroughClient = yield new redis_1.default(utils.Databases.DOC_WRITE_THROUGH).init();
75
- });
76
- }
77
- function shutdown() {
78
- return __awaiter(this, void 0, void 0, function* () {
79
- if (userClient)
80
- yield userClient.finish();
81
- if (sessionClient)
82
- yield sessionClient.finish();
83
- if (appClient)
84
- yield appClient.finish();
85
- if (cacheClient)
86
- yield cacheClient.finish();
87
- if (writethroughClient)
88
- yield writethroughClient.finish();
89
- if (lockClient)
90
- yield lockClient.finish();
91
- if (inviteClient)
92
- yield inviteClient.finish();
93
- if (passwordResetClient)
94
- yield passwordResetClient.finish();
95
- if (socketClient)
96
- yield socketClient.finish();
97
- if (docWritethroughClient)
98
- yield docWritethroughClient.finish();
99
- });
100
- }
101
- process.on("exit", () => __awaiter(void 0, void 0, void 0, function* () {
102
- yield shutdown();
103
- }));
104
- function getUserClient() {
105
- return __awaiter(this, void 0, void 0, function* () {
106
- if (!userClient) {
107
- yield init();
108
- }
109
- return userClient;
110
- });
111
- }
112
- function getSessionClient() {
113
- return __awaiter(this, void 0, void 0, function* () {
114
- if (!sessionClient) {
115
- yield init();
116
- }
117
- return sessionClient;
118
- });
119
- }
120
- function getAppClient() {
121
- return __awaiter(this, void 0, void 0, function* () {
122
- if (!appClient) {
123
- yield init();
124
- }
125
- return appClient;
126
- });
127
- }
128
- function getCacheClient() {
129
- return __awaiter(this, void 0, void 0, function* () {
130
- if (!cacheClient) {
131
- yield init();
132
- }
133
- return cacheClient;
134
- });
135
- }
136
- function getWritethroughClient() {
137
- return __awaiter(this, void 0, void 0, function* () {
138
- if (!writethroughClient) {
139
- yield init();
140
- }
141
- return writethroughClient;
142
- });
143
- }
144
- function getLockClient() {
145
- return __awaiter(this, void 0, void 0, function* () {
146
- if (!lockClient) {
147
- yield init();
148
- }
149
- return lockClient;
150
- });
151
- }
152
- function getSocketClient() {
153
- return __awaiter(this, void 0, void 0, function* () {
154
- if (!socketClient) {
155
- yield init();
156
- }
157
- return socketClient;
158
- });
159
- }
160
- function getInviteClient() {
161
- return __awaiter(this, void 0, void 0, function* () {
162
- if (!inviteClient) {
163
- yield init();
164
- }
165
- return inviteClient;
166
- });
167
- }
168
- function getPasswordResetClient() {
169
- return __awaiter(this, void 0, void 0, function* () {
170
- if (!passwordResetClient) {
171
- yield init();
172
- }
173
- return passwordResetClient;
174
- });
175
- }
176
- function getDocWritethroughClient() {
177
- return __awaiter(this, void 0, void 0, function* () {
178
- if (!writethroughClient) {
179
- yield init();
180
- }
181
- return writethroughClient;
182
- });
183
- }
184
- //# sourceMappingURL=init.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"init.js","sourceRoot":"","sources":["../../../src/redis/init.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAcA,oBAgBC;AAED,4BAWC;AAMD,sCAKC;AAED,4CAKC;AAED,oCAKC;AAED,wCAKC;AAED,sDAKC;AAED,sCAKC;AAED,0CAKC;AAED,0CAKC;AAED,wDAKC;AAED,4DAKC;AArHD,oDAA4B;AAC5B,+CAAgC;AAEhC,IAAI,UAAkB,EACpB,aAAqB,EACrB,SAAiB,EACjB,WAAmB,EACnB,kBAA0B,EAC1B,UAAkB,EAClB,YAAoB,EACpB,YAAoB,EACpB,mBAA2B,EAC3B,qBAA6B,CAAA;AAE/B,SAAsB,IAAI;;QACxB,UAAU,GAAG,MAAM,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,UAAU,CAAC,CAAC,IAAI,EAAE,CAAA;QAChE,aAAa,GAAG,MAAM,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,CAAA;QACjE,SAAS,GAAG,MAAM,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC,IAAI,EAAE,CAAA;QACjE,WAAW,GAAG,MAAM,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,aAAa,CAAC,CAAC,IAAI,EAAE,CAAA;QACpE,UAAU,GAAG,MAAM,IAAI,eAAM,CAAC,KAAK,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC,IAAI,EAA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C;CAAA;AAED,SAAsB,sBAAsB;;QAC1C,IAAI,CAAC,mBAAmB,EAAE,CAAC;YACzB,MAAM,IAAI,EAAE,CAAA;QACd,CAAC;QACD,OAAO,mBAAmB,CAAA;IAC5B,CAAC;CAAA;AAED,SAAsB,wBAAwB;;QAC5C,IAAI,CAAC,kBAAkB,EAAE,CAAC;YACxB,MAAM,IAAI,EAAE,CAAA;QACd,CAAC;QACD,OAAO,kBAAkB,CAAA;IAC3B,CAAC;CAAA"}
@@ -1,396 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || (function () {
19
- var ownKeys = function(o) {
20
- ownKeys = Object.getOwnPropertyNames || function (o) {
21
- var ar = [];
22
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
23
- return ar;
24
- };
25
- return ownKeys(o);
26
- };
27
- return function (mod) {
28
- if (mod && mod.__esModule) return mod;
29
- var result = {};
30
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
31
- __setModuleDefault(result, mod);
32
- return result;
33
- };
34
- })();
35
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
36
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
37
- return new (P || (P = Promise))(function (resolve, reject) {
38
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
39
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
40
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
41
- step((generator = generator.apply(thisArg, _arguments || [])).next());
42
- });
43
- };
44
- var __importDefault = (this && this.__importDefault) || function (mod) {
45
- return (mod && mod.__esModule) ? mod : { "default": mod };
46
- };
47
- Object.defineProperty(exports, "__esModule", { value: true });
48
- exports.closeAll = closeAll;
49
- const environment_1 = __importDefault(require("../environment"));
50
- const ioredis_1 = __importDefault(require("ioredis"));
51
- // mock-redis doesn't have any typing
52
- let MockRedis;
53
- if (environment_1.default.MOCK_REDIS) {
54
- try {
55
- // ioredis mock is all in memory
56
- MockRedis = require("ioredis-mock");
57
- }
58
- catch (err) {
59
- console.log("Mock redis unavailable");
60
- }
61
- }
62
- const utils_1 = require("./utils");
63
- const logging_1 = require("../logging");
64
- const timers = __importStar(require("../timers"));
65
- const RETRY_PERIOD_MS = 2000;
66
- const STARTUP_TIMEOUT_MS = 5000;
67
- const CLUSTERED = environment_1.default.REDIS_CLUSTERED;
68
- const DEFAULT_SELECT_DB = utils_1.SelectableDatabase.DEFAULT;
69
- // for testing just generate the client once
70
- let CLOSED = false;
71
- const CLIENTS = {};
72
- let CONNECTED = false;
73
- // mock redis always connected
74
- if (environment_1.default.MOCK_REDIS) {
75
- CONNECTED = true;
76
- }
77
- function pickClient(selectDb) {
78
- return CLIENTS[selectDb];
79
- }
80
- function connectionError(timeout, err) {
81
- // manually shut down, ignore errors
82
- if (CLOSED) {
83
- return;
84
- }
85
- CLOSED = true;
86
- // always clear this on error
87
- clearTimeout(timeout);
88
- CONNECTED = false;
89
- (0, logging_1.logAlert)("Redis connection failed", err);
90
- setTimeout(() => {
91
- init();
92
- }, RETRY_PERIOD_MS);
93
- }
94
- /**
95
- * Inits the system, will error if unable to connect to redis cluster (may take up to 10 seconds) otherwise
96
- * will return the ioredis client which will be ready to use.
97
- */
98
- function init(selectDb = DEFAULT_SELECT_DB) {
99
- const RedisCore = environment_1.default.MOCK_REDIS && MockRedis ? MockRedis : ioredis_1.default;
100
- let timeout;
101
- CLOSED = false;
102
- let client = pickClient(selectDb);
103
- // already connected, ignore
104
- if (client && CONNECTED) {
105
- return;
106
- }
107
- // testing uses a single in memory client
108
- if (environment_1.default.MOCK_REDIS) {
109
- CLIENTS[selectDb] = new RedisCore((0, utils_1.getRedisOptions)());
110
- }
111
- // start the timer - only allowed 5 seconds to connect
112
- timeout = setTimeout(() => {
113
- if (!CONNECTED) {
114
- connectionError(timeout, "Did not successfully connect in timeout");
115
- }
116
- }, STARTUP_TIMEOUT_MS);
117
- // disconnect any lingering client
118
- if (client) {
119
- client.disconnect();
120
- }
121
- const { host, port } = (0, utils_1.getRedisConnectionDetails)();
122
- const opts = (0, utils_1.getRedisOptions)();
123
- if (CLUSTERED) {
124
- client = new RedisCore.Cluster([{ host, port }], opts);
125
- }
126
- else {
127
- client = new RedisCore(opts);
128
- }
129
- // attach handlers
130
- client.on("end", (err) => {
131
- if (environment_1.default.isTest()) {
132
- // don't try to re-connect in test env
133
- // allow the process to exit
134
- return;
135
- }
136
- connectionError(timeout, err);
137
- });
138
- client.on("error", (err) => {
139
- connectionError(timeout, err);
140
- });
141
- client.on("connect", () => {
142
- console.log(`Connected to Redis DB: ${selectDb}`);
143
- clearTimeout(timeout);
144
- CONNECTED = true;
145
- });
146
- CLIENTS[selectDb] = client;
147
- }
148
- function closeAll() {
149
- Object.values(CLIENTS).forEach(client => client.disconnect());
150
- }
151
- function waitForConnection(selectDb = DEFAULT_SELECT_DB) {
152
- return new Promise(resolve => {
153
- if (pickClient(selectDb) == null) {
154
- init();
155
- }
156
- else if (CONNECTED) {
157
- resolve("");
158
- return;
159
- }
160
- // check if the connection is ready
161
- const interval = timers.set(() => {
162
- if (CONNECTED) {
163
- timers.clear(interval);
164
- resolve("");
165
- }
166
- }, 500);
167
- });
168
- }
169
- /**
170
- * Utility function, takes a redis stream and converts it to a promisified response -
171
- * this can only be done with redis streams because they will have an end.
172
- * @param stream A redis stream, specifically as this type of stream will have an end.
173
- * @param client The client to use for further lookups.
174
- * @return The final output of the stream
175
- */
176
- function promisifyStream(stream, client) {
177
- return new Promise((resolve, reject) => {
178
- const outputKeys = new Set();
179
- stream.on("data", (keys) => {
180
- keys.forEach(key => {
181
- outputKeys.add(key);
182
- });
183
- });
184
- stream.on("error", (err) => {
185
- reject(err);
186
- });
187
- stream.on("end", () => __awaiter(this, void 0, void 0, function* () {
188
- const keysArray = Array.from(outputKeys);
189
- try {
190
- let getPromises = [];
191
- for (let key of keysArray) {
192
- getPromises.push(client.get(key));
193
- }
194
- const jsonArray = yield Promise.all(getPromises);
195
- resolve(keysArray.map(key => ({
196
- key: (0, utils_1.removeDbPrefix)(key),
197
- value: JSON.parse(jsonArray.shift()),
198
- })));
199
- }
200
- catch (err) {
201
- reject(err);
202
- }
203
- }));
204
- });
205
- }
206
- class RedisWrapper {
207
- constructor(db, selectDb = null) {
208
- this._db = db;
209
- this._select = selectDb || DEFAULT_SELECT_DB;
210
- }
211
- getClient() {
212
- return pickClient(this._select);
213
- }
214
- init() {
215
- return __awaiter(this, void 0, void 0, function* () {
216
- CLOSED = false;
217
- init(this._select);
218
- yield waitForConnection(this._select);
219
- if (this._select && !environment_1.default.isTest()) {
220
- this.getClient().select(this._select);
221
- }
222
- return this;
223
- });
224
- }
225
- finish() {
226
- return __awaiter(this, void 0, void 0, function* () {
227
- CLOSED = true;
228
- this.getClient().disconnect();
229
- });
230
- }
231
- scan() {
232
- return __awaiter(this, arguments, void 0, function* (key = "") {
233
- const db = this._db;
234
- key = `${db}${utils_1.SEPARATOR}${key}`;
235
- let stream;
236
- if (CLUSTERED) {
237
- let node = this.getClient().nodes("master");
238
- stream = node[0].scanStream({ match: key + "*", count: 100 });
239
- }
240
- else {
241
- stream = this.getClient().scanStream({
242
- match: key + "*",
243
- count: 100,
244
- });
245
- }
246
- return promisifyStream(stream, this.getClient());
247
- });
248
- }
249
- keys(pattern) {
250
- return __awaiter(this, void 0, void 0, function* () {
251
- const db = this._db;
252
- return this.getClient().keys((0, utils_1.addDbPrefix)(db, pattern));
253
- });
254
- }
255
- exists(key) {
256
- return __awaiter(this, void 0, void 0, function* () {
257
- const db = this._db;
258
- return yield this.getClient().exists((0, utils_1.addDbPrefix)(db, key));
259
- });
260
- }
261
- get(key) {
262
- return __awaiter(this, void 0, void 0, function* () {
263
- const db = this._db;
264
- const response = yield this.getClient().get((0, utils_1.addDbPrefix)(db, key));
265
- // overwrite the prefixed key
266
- // @ts-ignore
267
- if (response != null && response.key) {
268
- // @ts-ignore
269
- response.key = key;
270
- }
271
- // if its not an object just return the response
272
- try {
273
- return JSON.parse(response);
274
- }
275
- catch (err) {
276
- return response;
277
- }
278
- });
279
- }
280
- bulkGet(keys) {
281
- return __awaiter(this, void 0, void 0, function* () {
282
- const db = this._db;
283
- if (keys.length === 0) {
284
- return {};
285
- }
286
- const prefixedKeys = keys.map(key => (0, utils_1.addDbPrefix)(db, key));
287
- let response = yield this.getClient().mget(prefixedKeys);
288
- if (Array.isArray(response)) {
289
- let final = {};
290
- let count = 0;
291
- for (let result of response) {
292
- if (result) {
293
- let parsed;
294
- try {
295
- parsed = JSON.parse(result);
296
- }
297
- catch (err) {
298
- parsed = result;
299
- }
300
- final[keys[count]] = parsed;
301
- }
302
- count++;
303
- }
304
- return final;
305
- }
306
- else {
307
- throw new Error(`Invalid response: ${response}`);
308
- }
309
- });
310
- }
311
- store(key_1, value_1) {
312
- return __awaiter(this, arguments, void 0, function* (key, value, expirySeconds = null) {
313
- const db = this._db;
314
- if (typeof value === "object") {
315
- value = JSON.stringify(value);
316
- }
317
- const prefixedKey = (0, utils_1.addDbPrefix)(db, key);
318
- yield this.getClient().set(prefixedKey, value);
319
- if (expirySeconds) {
320
- yield this.getClient().expire(prefixedKey, expirySeconds);
321
- }
322
- });
323
- }
324
- bulkStore(data_1) {
325
- return __awaiter(this, arguments, void 0, function* (data, expirySeconds = null) {
326
- const client = this.getClient();
327
- const dataToStore = Object.entries(data).reduce((acc, [key, value]) => {
328
- acc[(0, utils_1.addDbPrefix)(this._db, key)] =
329
- typeof value === "object" ? JSON.stringify(value) : value;
330
- return acc;
331
- }, {});
332
- const pipeline = client.pipeline();
333
- pipeline.mset(dataToStore);
334
- if (expirySeconds !== null) {
335
- for (const key of Object.keys(dataToStore)) {
336
- pipeline.expire(key, expirySeconds);
337
- }
338
- }
339
- yield pipeline.exec();
340
- });
341
- }
342
- getTTL(key) {
343
- return __awaiter(this, void 0, void 0, function* () {
344
- const db = this._db;
345
- const prefixedKey = (0, utils_1.addDbPrefix)(db, key);
346
- return this.getClient().ttl(prefixedKey);
347
- });
348
- }
349
- setExpiry(key, expirySeconds) {
350
- return __awaiter(this, void 0, void 0, function* () {
351
- const db = this._db;
352
- const prefixedKey = (0, utils_1.addDbPrefix)(db, key);
353
- yield this.getClient().expire(prefixedKey, expirySeconds);
354
- });
355
- }
356
- delete(key) {
357
- return __awaiter(this, void 0, void 0, function* () {
358
- const db = this._db;
359
- yield this.getClient().del((0, utils_1.addDbPrefix)(db, key));
360
- });
361
- }
362
- bulkDelete(keys) {
363
- return __awaiter(this, void 0, void 0, function* () {
364
- const db = this._db;
365
- yield this.getClient().del(keys.map(key => (0, utils_1.addDbPrefix)(db, key)));
366
- });
367
- }
368
- clear() {
369
- return __awaiter(this, void 0, void 0, function* () {
370
- let items = yield this.scan();
371
- yield Promise.all(items.map((obj) => this.delete(obj.key)));
372
- });
373
- }
374
- increment(key) {
375
- return __awaiter(this, void 0, void 0, function* () {
376
- const result = yield this.getClient().incr((0, utils_1.addDbPrefix)(this._db, key));
377
- if (isNaN(result)) {
378
- throw new Error(`Redis ${key} does not contain a number`);
379
- }
380
- return result;
381
- });
382
- }
383
- deleteIfValue(key, value) {
384
- return __awaiter(this, void 0, void 0, function* () {
385
- const client = this.getClient();
386
- const luaScript = `
387
- if redis.call('GET', KEYS[1]) == ARGV[1] then
388
- redis.call('DEL', KEYS[1])
389
- end
390
- `;
391
- yield client.eval(luaScript, 1, (0, utils_1.addDbPrefix)(this._db, key), value);
392
- });
393
- }
394
- }
395
- exports.default = RedisWrapper;
396
- //# sourceMappingURL=redis.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"redis.js","sourceRoot":"","sources":["../../../src/redis/redis.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiHA,4BAEC;AAnHD,iEAAgC;AAChC,sDAAwC;AACxC,qCAAqC;AACrC,IAAI,SAA0B,CAAA;AAC9B,IAAI,qBAAG,CAAC,UAAU,EAAE,CAAC;IACnB,IAAI,CAAC;QACH,gCAAgC;QAChC,SAAS,GAAG,OAAO,CAAC,cAAc,CAAC,CAAA;IACrC,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,GAAG,CAAC,wBAAwB,CAAC,CAAA;IACvC,CAAC;AACH,CAAC;AACD,mCAOgB;AAChB,wCAAqC;AACrC,kDAAmC;AAEnC,MAAM,eAAe,GAAG,IAAI,CAAA;AAC5B,MAAM,kBAAkB,GAAG,IAAI,CAAA;AAC/B,MAAM,SAAS,GAAG,qBAAG,CAAC,eAAe,CAAA;AACrC,MAAM,iBAAiB,GAAG,0BAAkB,CAAC,OAAO,CAAA;AAEpD,4CAA4C;AAC5C,IAAI,MAAM,GAAG,KAAK,CAAA;AAClB,MAAM,OAAO,GAA0B,EAAE,CAAA;AACzC,IAAI,SAAS,GAAG,KAAK,CAAA;AAErB,8BAA8B;AAC9B,IAAI,qBAAG,CAAC,UAAU,EAAE,CAAC;IACnB,SAAS,GAAG,IAAI,CAAA;AAClB,CAAC;AAED,SAAS,UAAU,CAAC,QAAgB;IAClC,OAAO,OAAO,CAAC,QAAQ,CAAC,CAAA;AAC1B,CAAC;AAED,SAAS,eAAe,CAAC,OAAuB,EAAE,GAAm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