@budibase/backend-core 2.5.6-alpha.5 → 2.5.6

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 (396) hide show
  1. package/dist/package.json +10 -12
  2. package/dist/src/cache/writethrough.js +1 -1
  3. package/dist/src/cache/writethrough.js.map +1 -1
  4. package/dist/src/configs/configs.d.ts +1 -2
  5. package/dist/src/configs/configs.js +1 -9
  6. package/dist/src/configs/configs.js.map +1 -1
  7. package/dist/src/constants/misc.d.ts +2 -4
  8. package/dist/src/constants/misc.js +0 -2
  9. package/dist/src/constants/misc.js.map +1 -1
  10. package/dist/src/context/mainContext.d.ts +1 -4
  11. package/dist/src/context/mainContext.js +3 -20
  12. package/dist/src/context/mainContext.js.map +1 -1
  13. package/dist/src/context/types.d.ts +0 -1
  14. package/dist/src/db/conversions.js.map +1 -0
  15. package/dist/src/db/couch/DatabaseImpl.js +1 -1
  16. package/dist/src/db/couch/DatabaseImpl.js.map +1 -1
  17. package/dist/src/db/index.d.ts +1 -2
  18. package/dist/src/db/index.js +2 -15
  19. package/dist/src/db/index.js.map +1 -1
  20. package/dist/src/db/lucene.d.ts +14 -8
  21. package/dist/src/db/lucene.js +86 -152
  22. package/dist/src/db/lucene.js.map +1 -1
  23. package/dist/src/db/utils.d.ts +126 -5
  24. package/dist/src/db/utils.js +232 -20
  25. package/dist/src/db/utils.js.map +1 -1
  26. package/dist/src/db/views.js +1 -16
  27. package/dist/src/db/views.js.map +1 -1
  28. package/dist/src/environment.d.ts +2 -2
  29. package/dist/src/environment.js +2 -9
  30. package/dist/src/environment.js.map +1 -1
  31. package/dist/src/errors/errors.d.ts +0 -3
  32. package/dist/src/errors/errors.js +1 -8
  33. package/dist/src/errors/errors.js.map +1 -1
  34. package/dist/src/events/events.js +0 -9
  35. package/dist/src/events/events.js.map +1 -1
  36. package/dist/src/events/identification.js +0 -1
  37. package/dist/src/events/identification.js.map +1 -1
  38. package/dist/src/events/index.d.ts +0 -1
  39. package/dist/src/events/index.js +1 -3
  40. package/dist/src/events/index.js.map +1 -1
  41. package/dist/src/events/processors/LoggingProcessor.js +17 -3
  42. package/dist/src/events/processors/LoggingProcessor.js.map +1 -1
  43. package/dist/src/events/processors/Processors.js +3 -9
  44. package/dist/src/events/processors/Processors.js.map +1 -1
  45. package/dist/src/events/processors/types.d.ts +11 -1
  46. package/dist/src/events/processors/types.js +6 -0
  47. package/dist/src/events/processors/types.js.map +1 -1
  48. package/dist/src/events/publishers/group.js +0 -6
  49. package/dist/src/events/publishers/group.js.map +1 -1
  50. package/dist/src/events/publishers/user.js +0 -4
  51. package/dist/src/events/publishers/user.js.map +1 -1
  52. package/dist/src/index.d.ts +1 -5
  53. package/dist/src/index.js +1 -2
  54. package/dist/src/index.js.map +1 -1
  55. package/dist/src/{logging/alerts.d.ts → logging.d.ts} +5 -0
  56. package/dist/src/logging.js +56 -0
  57. package/dist/src/logging.js.map +1 -0
  58. package/dist/src/middleware/authenticated.js +2 -5
  59. package/dist/src/middleware/authenticated.js.map +1 -1
  60. package/dist/src/middleware/errorHandling.js +7 -5
  61. package/dist/src/middleware/errorHandling.js.map +1 -1
  62. package/dist/src/middleware/index.d.ts +1 -2
  63. package/dist/src/middleware/index.js +3 -5
  64. package/dist/src/middleware/index.js.map +1 -1
  65. package/dist/src/middleware/logging.d.ts +2 -0
  66. package/dist/src/middleware/logging.js +106 -0
  67. package/dist/src/middleware/logging.js.map +1 -0
  68. package/dist/src/middleware/passport/sso/oidc.js +5 -2
  69. package/dist/src/middleware/passport/sso/oidc.js.map +1 -1
  70. package/dist/src/migrations/migrations.js +4 -4
  71. package/dist/src/migrations/migrations.js.map +1 -1
  72. package/dist/src/newid.js.map +1 -0
  73. package/dist/src/objectStore/objectStore.js +3 -3
  74. package/dist/src/objectStore/objectStore.js.map +1 -1
  75. package/dist/src/plugin/utils.js +2 -53
  76. package/dist/src/plugin/utils.js.map +1 -1
  77. package/dist/src/queue/constants.d.ts +1 -2
  78. package/dist/src/queue/constants.js +0 -1
  79. package/dist/src/queue/constants.js.map +1 -1
  80. package/dist/src/security/encryption.d.ts +0 -1
  81. package/dist/src/security/encryption.js +1 -2
  82. package/dist/src/security/encryption.js.map +1 -1
  83. package/dist/src/security/permissions.d.ts +2 -35
  84. package/dist/src/security/permissions.js +6 -9
  85. package/dist/src/security/permissions.js.map +1 -1
  86. package/dist/src/tenancy/tenancy.js +5 -1
  87. package/dist/src/tenancy/tenancy.js.map +1 -1
  88. package/dist/src/users.d.ts +1 -10
  89. package/dist/src/users.js +1 -35
  90. package/dist/src/users.js.map +1 -1
  91. package/dist/src/utils/hashing.d.ts +1 -1
  92. package/dist/src/utils/hashing.js +1 -1
  93. package/dist/src/utils/hashing.js.map +1 -1
  94. package/dist/src/utils/index.d.ts +0 -1
  95. package/dist/src/utils/index.js +0 -1
  96. package/dist/src/utils/index.js.map +1 -1
  97. package/dist/tests/index.d.ts +1 -1
  98. package/dist/tests/index.js +1 -1
  99. package/dist/tests/index.js.map +1 -1
  100. package/dist/tests/jestEnv.js +1 -0
  101. package/dist/tests/jestEnv.js.map +1 -1
  102. package/dist/tests/jestSetup.d.ts +1 -1
  103. package/dist/tests/jestSetup.js +2 -2
  104. package/dist/tests/jestSetup.js.map +1 -1
  105. package/dist/tests/logging.js.map +1 -0
  106. package/dist/tests/{extra → utilities}/DBTestConfiguration.d.ts +1 -1
  107. package/dist/tests/{extra → utilities}/DBTestConfiguration.js +2 -2
  108. package/dist/tests/utilities/DBTestConfiguration.js.map +1 -0
  109. package/dist/tests/{core/utilities → utilities}/index.d.ts +2 -0
  110. package/dist/tests/{core/utilities → utilities}/index.js +7 -1
  111. package/dist/tests/utilities/index.js.map +1 -0
  112. package/dist/tests/utilities/jestUtils.js.map +1 -0
  113. package/dist/tests/utilities/mocks/date.js.map +1 -0
  114. package/dist/tests/utilities/mocks/events.d.ts +1 -0
  115. package/dist/tests/utilities/mocks/events.js +126 -0
  116. package/dist/tests/utilities/mocks/events.js.map +1 -0
  117. package/dist/tests/utilities/mocks/fetch.d.ts +31 -0
  118. package/dist/tests/utilities/mocks/fetch.js +8 -0
  119. package/dist/tests/utilities/mocks/fetch.js.map +1 -0
  120. package/dist/tests/{core/utilities → utilities}/mocks/index.d.ts +3 -4
  121. package/dist/tests/{core/utilities → utilities}/mocks/index.js +3 -7
  122. package/dist/tests/utilities/mocks/index.js.map +1 -0
  123. package/dist/tests/{core/utilities → utilities}/mocks/licenses.d.ts +0 -1
  124. package/dist/tests/{core/utilities → utilities}/mocks/licenses.js +1 -5
  125. package/dist/tests/utilities/mocks/licenses.js.map +1 -0
  126. package/dist/tests/utilities/mocks/posthog.js.map +1 -0
  127. package/dist/tests/{core/utilities → utilities}/structures/accounts.js +25 -2
  128. package/dist/tests/utilities/structures/accounts.js.map +1 -0
  129. package/dist/tests/{core/utilities → utilities}/structures/apps.js +1 -1
  130. package/dist/tests/utilities/structures/apps.js.map +1 -0
  131. package/dist/tests/utilities/structures/common.js.map +1 -0
  132. package/dist/tests/{core/utilities → utilities}/structures/db.js +1 -1
  133. package/dist/tests/utilities/structures/db.js.map +1 -0
  134. package/dist/tests/utilities/structures/generator.js.map +1 -0
  135. package/dist/tests/{core/utilities → utilities}/structures/index.d.ts +0 -1
  136. package/dist/tests/{core/utilities → utilities}/structures/index.js +1 -2
  137. package/dist/tests/utilities/structures/index.js.map +1 -0
  138. package/dist/tests/utilities/structures/koa.js.map +1 -0
  139. package/dist/tests/utilities/structures/licenses.js.map +1 -0
  140. package/dist/tests/utilities/structures/plugins.js.map +1 -0
  141. package/dist/tests/utilities/structures/shared.js.map +1 -0
  142. package/dist/tests/utilities/structures/sso.js.map +1 -0
  143. package/dist/tests/{core/utilities → utilities}/structures/tenants.js +1 -1
  144. package/dist/tests/utilities/structures/tenants.js.map +1 -0
  145. package/dist/tests/utilities/structures/userGroups.js.map +1 -0
  146. package/dist/tests/utilities/structures/users.js.map +1 -0
  147. package/dist/tests/utilities/testContainerUtils.js.map +1 -0
  148. package/dist/tests/{extra → utilities}/testEnv.js +1 -1
  149. package/dist/tests/utilities/testEnv.js.map +1 -0
  150. package/dist/tsconfig.build.tsbuildinfo +1 -1
  151. package/package.json +10 -12
  152. package/src/auth/tests/auth.spec.ts +1 -2
  153. package/src/cache/tests/writethrough.spec.ts +3 -4
  154. package/src/cache/writethrough.ts +2 -1
  155. package/src/configs/configs.ts +0 -9
  156. package/src/configs/tests/configs.spec.ts +6 -2
  157. package/src/constants/misc.ts +0 -2
  158. package/src/context/mainContext.ts +2 -19
  159. package/src/context/tests/index.spec.ts +3 -16
  160. package/src/context/types.ts +0 -1
  161. package/src/db/couch/DatabaseImpl.ts +1 -1
  162. package/src/db/index.ts +1 -2
  163. package/src/db/lucene.ts +88 -143
  164. package/src/db/tests/lucene.spec.ts +1 -101
  165. package/src/db/tests/utils.spec.ts +1 -1
  166. package/src/db/utils.ts +275 -7
  167. package/src/db/views.ts +2 -18
  168. package/src/environment.ts +2 -11
  169. package/src/errors/errors.ts +0 -8
  170. package/src/events/events.ts +1 -10
  171. package/src/events/identification.ts +0 -1
  172. package/src/events/index.ts +0 -2
  173. package/src/events/processors/LoggingProcessor.ts +22 -3
  174. package/src/events/processors/Processors.ts +3 -9
  175. package/src/events/processors/posthog/tests/PosthogProcessor.spec.ts +1 -1
  176. package/src/events/processors/types.ts +18 -1
  177. package/src/events/publishers/group.ts +1 -6
  178. package/src/events/publishers/user.ts +0 -4
  179. package/src/index.ts +0 -1
  180. package/src/logging.ts +60 -0
  181. package/src/middleware/authenticated.ts +2 -8
  182. package/src/middleware/errorHandling.ts +4 -4
  183. package/src/middleware/index.ts +1 -2
  184. package/src/middleware/logging.ts +90 -0
  185. package/src/middleware/passport/sso/oidc.ts +9 -2
  186. package/src/middleware/passport/sso/tests/sso.spec.ts +1 -2
  187. package/src/migrations/migrations.ts +8 -4
  188. package/src/migrations/tests/__snapshots__/migrations.spec.ts.snap +1 -1
  189. package/src/migrations/tests/migrations.spec.ts +1 -1
  190. package/src/objectStore/buckets/tests/app.spec.ts +1 -1
  191. package/src/objectStore/buckets/tests/global.spec.ts +1 -1
  192. package/src/objectStore/buckets/tests/plugins.spec.ts +1 -2
  193. package/src/objectStore/objectStore.ts +3 -3
  194. package/src/platform/tests/tenants.spec.ts +1 -2
  195. package/src/plugin/utils.ts +3 -63
  196. package/src/queue/constants.ts +0 -1
  197. package/src/security/encryption.ts +1 -1
  198. package/src/security/permissions.ts +5 -5
  199. package/src/tenancy/tenancy.ts +2 -2
  200. package/src/users.ts +1 -41
  201. package/src/utils/hashing.ts +1 -1
  202. package/src/utils/index.ts +0 -1
  203. package/src/utils/tests/utils.spec.ts +1 -2
  204. package/tests/index.ts +1 -1
  205. package/tests/jestEnv.ts +1 -0
  206. package/tests/jestSetup.ts +2 -2
  207. package/tests/{extra → utilities}/DBTestConfiguration.ts +2 -2
  208. package/tests/{core/utilities → utilities}/index.ts +3 -0
  209. package/tests/utilities/mocks/events.ts +122 -0
  210. package/tests/utilities/mocks/fetch.ts +10 -0
  211. package/tests/{core/utilities → utilities}/mocks/index.ts +3 -4
  212. package/tests/{core/utilities → utilities}/mocks/licenses.ts +0 -4
  213. package/tests/{core/utilities → utilities}/structures/accounts.ts +2 -2
  214. package/tests/{core/utilities → utilities}/structures/apps.ts +1 -1
  215. package/tests/{core/utilities → utilities}/structures/db.ts +1 -1
  216. package/tests/{core/utilities → utilities}/structures/index.ts +0 -1
  217. package/tests/{core/utilities → utilities}/structures/tenants.ts +1 -1
  218. package/tests/{extra → utilities}/testEnv.ts +1 -1
  219. package/dist/src/db/searchIndexes/index.d.ts +0 -1
  220. package/dist/src/db/searchIndexes/index.js +0 -18
  221. package/dist/src/db/searchIndexes/index.js.map +0 -1
  222. package/dist/src/db/searchIndexes/searchIndexes.d.ts +0 -1
  223. package/dist/src/db/searchIndexes/searchIndexes.js +0 -77
  224. package/dist/src/db/searchIndexes/searchIndexes.js.map +0 -1
  225. package/dist/src/docIds/conversions.js.map +0 -1
  226. package/dist/src/docIds/ids.d.ts +0 -53
  227. package/dist/src/docIds/ids.js +0 -101
  228. package/dist/src/docIds/ids.js.map +0 -1
  229. package/dist/src/docIds/index.d.ts +0 -2
  230. package/dist/src/docIds/index.js +0 -19
  231. package/dist/src/docIds/index.js.map +0 -1
  232. package/dist/src/docIds/newid.js.map +0 -1
  233. package/dist/src/docIds/params.d.ts +0 -69
  234. package/dist/src/docIds/params.js +0 -138
  235. package/dist/src/docIds/params.js.map +0 -1
  236. package/dist/src/docUpdates/index.d.ts +0 -2
  237. package/dist/src/docUpdates/index.js +0 -36
  238. package/dist/src/docUpdates/index.js.map +0 -1
  239. package/dist/src/events/asyncEvents/index.d.ts +0 -2
  240. package/dist/src/events/asyncEvents/index.js +0 -19
  241. package/dist/src/events/asyncEvents/index.js.map +0 -1
  242. package/dist/src/events/asyncEvents/publisher.d.ts +0 -2
  243. package/dist/src/events/asyncEvents/publisher.js +0 -27
  244. package/dist/src/events/asyncEvents/publisher.js.map +0 -1
  245. package/dist/src/events/asyncEvents/queue.d.ts +0 -11
  246. package/dist/src/events/asyncEvents/queue.js +0 -26
  247. package/dist/src/events/asyncEvents/queue.js.map +0 -1
  248. package/dist/src/events/documentId.d.ts +0 -2
  249. package/dist/src/events/documentId.js +0 -28
  250. package/dist/src/events/documentId.js.map +0 -1
  251. package/dist/src/events/processors/async/DocumentUpdateProcessor.d.ts +0 -13
  252. package/dist/src/events/processors/async/DocumentUpdateProcessor.js +0 -44
  253. package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +0 -1
  254. package/dist/src/logging/alerts.js +0 -24
  255. package/dist/src/logging/alerts.js.map +0 -1
  256. package/dist/src/logging/correlation/correlation.d.ts +0 -2
  257. package/dist/src/logging/correlation/correlation.js +0 -17
  258. package/dist/src/logging/correlation/correlation.js.map +0 -1
  259. package/dist/src/logging/correlation/index.d.ts +0 -1
  260. package/dist/src/logging/correlation/index.js +0 -18
  261. package/dist/src/logging/correlation/index.js.map +0 -1
  262. package/dist/src/logging/correlation/middleware.d.ts +0 -2
  263. package/dist/src/logging/correlation/middleware.js +0 -17
  264. package/dist/src/logging/correlation/middleware.js.map +0 -1
  265. package/dist/src/logging/index.d.ts +0 -4
  266. package/dist/src/logging/index.js +0 -37
  267. package/dist/src/logging/index.js.map +0 -1
  268. package/dist/src/logging/pino/logger.d.ts +0 -3
  269. package/dist/src/logging/pino/logger.js +0 -181
  270. package/dist/src/logging/pino/logger.js.map +0 -1
  271. package/dist/src/logging/pino/middleware.d.ts +0 -4
  272. package/dist/src/logging/pino/middleware.js +0 -47
  273. package/dist/src/logging/pino/middleware.js.map +0 -1
  274. package/dist/src/utils/stringUtils.d.ts +0 -1
  275. package/dist/src/utils/stringUtils.js +0 -9
  276. package/dist/src/utils/stringUtils.js.map +0 -1
  277. package/dist/tests/core/logging.js.map +0 -1
  278. package/dist/tests/core/utilities/index.js.map +0 -1
  279. package/dist/tests/core/utilities/jestUtils.js.map +0 -1
  280. package/dist/tests/core/utilities/mocks/alerts.d.ts +0 -3
  281. package/dist/tests/core/utilities/mocks/alerts.js +0 -30
  282. package/dist/tests/core/utilities/mocks/alerts.js.map +0 -1
  283. package/dist/tests/core/utilities/mocks/date.js.map +0 -1
  284. package/dist/tests/core/utilities/mocks/events.d.ts +0 -0
  285. package/dist/tests/core/utilities/mocks/events.js +0 -136
  286. package/dist/tests/core/utilities/mocks/events.js.map +0 -1
  287. package/dist/tests/core/utilities/mocks/fetch.d.ts +0 -33
  288. package/dist/tests/core/utilities/mocks/fetch.js +0 -15
  289. package/dist/tests/core/utilities/mocks/fetch.js.map +0 -1
  290. package/dist/tests/core/utilities/mocks/index.js.map +0 -1
  291. package/dist/tests/core/utilities/mocks/licenses.js.map +0 -1
  292. package/dist/tests/core/utilities/mocks/posthog.js.map +0 -1
  293. package/dist/tests/core/utilities/structures/accounts.js.map +0 -1
  294. package/dist/tests/core/utilities/structures/apps.js.map +0 -1
  295. package/dist/tests/core/utilities/structures/common.js.map +0 -1
  296. package/dist/tests/core/utilities/structures/db.js.map +0 -1
  297. package/dist/tests/core/utilities/structures/generator.js.map +0 -1
  298. package/dist/tests/core/utilities/structures/index.js.map +0 -1
  299. package/dist/tests/core/utilities/structures/koa.js.map +0 -1
  300. package/dist/tests/core/utilities/structures/licenses.js.map +0 -1
  301. package/dist/tests/core/utilities/structures/plugins.js.map +0 -1
  302. package/dist/tests/core/utilities/structures/scim.d.ts +0 -14
  303. package/dist/tests/core/utilities/structures/scim.js +0 -67
  304. package/dist/tests/core/utilities/structures/scim.js.map +0 -1
  305. package/dist/tests/core/utilities/structures/shared.js.map +0 -1
  306. package/dist/tests/core/utilities/structures/sso.js.map +0 -1
  307. package/dist/tests/core/utilities/structures/tenants.js.map +0 -1
  308. package/dist/tests/core/utilities/structures/userGroups.js.map +0 -1
  309. package/dist/tests/core/utilities/structures/users.js.map +0 -1
  310. package/dist/tests/core/utilities/testContainerUtils.js.map +0 -1
  311. package/dist/tests/extra/DBTestConfiguration.js.map +0 -1
  312. package/dist/tests/extra/index.d.ts +0 -2
  313. package/dist/tests/extra/index.js +0 -33
  314. package/dist/tests/extra/index.js.map +0 -1
  315. package/dist/tests/extra/testEnv.js.map +0 -1
  316. package/src/db/searchIndexes/index.ts +0 -1
  317. package/src/db/searchIndexes/searchIndexes.ts +0 -62
  318. package/src/docIds/ids.ts +0 -102
  319. package/src/docIds/index.ts +0 -2
  320. package/src/docIds/params.ts +0 -174
  321. package/src/docUpdates/index.ts +0 -29
  322. package/src/events/asyncEvents/index.ts +0 -2
  323. package/src/events/asyncEvents/publisher.ts +0 -12
  324. package/src/events/asyncEvents/queue.ts +0 -22
  325. package/src/events/documentId.ts +0 -56
  326. package/src/events/processors/async/DocumentUpdateProcessor.ts +0 -43
  327. package/src/logging/alerts.ts +0 -26
  328. package/src/logging/correlation/correlation.ts +0 -13
  329. package/src/logging/correlation/index.ts +0 -1
  330. package/src/logging/correlation/middleware.ts +0 -17
  331. package/src/logging/index.ts +0 -6
  332. package/src/logging/pino/logger.ts +0 -188
  333. package/src/logging/pino/middleware.ts +0 -45
  334. package/src/plugin/tests/validation.spec.ts +0 -83
  335. package/src/security/tests/encryption.spec.ts +0 -31
  336. package/src/security/tests/permissions.spec.ts +0 -145
  337. package/src/tenancy/tests/tenancy.spec.ts +0 -184
  338. package/src/utils/stringUtils.ts +0 -8
  339. package/tests/core/utilities/mocks/alerts.ts +0 -3
  340. package/tests/core/utilities/mocks/events.ts +0 -123
  341. package/tests/core/utilities/mocks/fetch.ts +0 -17
  342. package/tests/core/utilities/structures/scim.ts +0 -81
  343. package/tests/extra/index.ts +0 -2
  344. /package/dist/src/{docIds → db}/conversions.d.ts +0 -0
  345. /package/dist/src/{docIds → db}/conversions.js +0 -0
  346. /package/dist/src/{docIds/newid.d.ts → newid.d.ts} +0 -0
  347. /package/dist/src/{docIds/newid.js → newid.js} +0 -0
  348. /package/dist/tests/{core/logging.d.ts → logging.d.ts} +0 -0
  349. /package/dist/tests/{core/logging.js → logging.js} +0 -0
  350. /package/dist/tests/{core/utilities → utilities}/jestUtils.d.ts +0 -0
  351. /package/dist/tests/{core/utilities → utilities}/jestUtils.js +0 -0
  352. /package/dist/tests/{core/utilities → utilities}/mocks/date.d.ts +0 -0
  353. /package/dist/tests/{core/utilities → utilities}/mocks/date.js +0 -0
  354. /package/dist/tests/{core/utilities → utilities}/mocks/posthog.d.ts +0 -0
  355. /package/dist/tests/{core/utilities → utilities}/mocks/posthog.js +0 -0
  356. /package/dist/tests/{core/utilities → utilities}/structures/accounts.d.ts +0 -0
  357. /package/dist/tests/{core/utilities → utilities}/structures/apps.d.ts +0 -0
  358. /package/dist/tests/{core/utilities → utilities}/structures/common.d.ts +0 -0
  359. /package/dist/tests/{core/utilities → utilities}/structures/common.js +0 -0
  360. /package/dist/tests/{core/utilities → utilities}/structures/db.d.ts +0 -0
  361. /package/dist/tests/{core/utilities → utilities}/structures/generator.d.ts +0 -0
  362. /package/dist/tests/{core/utilities → utilities}/structures/generator.js +0 -0
  363. /package/dist/tests/{core/utilities → utilities}/structures/koa.d.ts +0 -0
  364. /package/dist/tests/{core/utilities → utilities}/structures/koa.js +0 -0
  365. /package/dist/tests/{core/utilities → utilities}/structures/licenses.d.ts +0 -0
  366. /package/dist/tests/{core/utilities → utilities}/structures/licenses.js +0 -0
  367. /package/dist/tests/{core/utilities → utilities}/structures/plugins.d.ts +0 -0
  368. /package/dist/tests/{core/utilities → utilities}/structures/plugins.js +0 -0
  369. /package/dist/tests/{core/utilities → utilities}/structures/shared.d.ts +0 -0
  370. /package/dist/tests/{core/utilities → utilities}/structures/shared.js +0 -0
  371. /package/dist/tests/{core/utilities → utilities}/structures/sso.d.ts +0 -0
  372. /package/dist/tests/{core/utilities → utilities}/structures/sso.js +0 -0
  373. /package/dist/tests/{core/utilities → utilities}/structures/tenants.d.ts +0 -0
  374. /package/dist/tests/{core/utilities → utilities}/structures/userGroups.d.ts +0 -0
  375. /package/dist/tests/{core/utilities → utilities}/structures/userGroups.js +0 -0
  376. /package/dist/tests/{core/utilities → utilities}/structures/users.d.ts +0 -0
  377. /package/dist/tests/{core/utilities → utilities}/structures/users.js +0 -0
  378. /package/dist/tests/{core/utilities → utilities}/testContainerUtils.d.ts +0 -0
  379. /package/dist/tests/{core/utilities → utilities}/testContainerUtils.js +0 -0
  380. /package/dist/tests/{extra → utilities}/testEnv.d.ts +0 -0
  381. /package/src/{docIds → db}/conversions.ts +0 -0
  382. /package/src/{docIds/newid.ts → newid.ts} +0 -0
  383. /package/tests/{core/logging.ts → logging.ts} +0 -0
  384. /package/tests/{core/utilities → utilities}/jestUtils.ts +0 -0
  385. /package/tests/{core/utilities → utilities}/mocks/date.ts +0 -0
  386. /package/tests/{core/utilities → utilities}/mocks/posthog.ts +0 -0
  387. /package/tests/{core/utilities → utilities}/structures/common.ts +0 -0
  388. /package/tests/{core/utilities → utilities}/structures/generator.ts +0 -0
  389. /package/tests/{core/utilities → utilities}/structures/koa.ts +0 -0
  390. /package/tests/{core/utilities → utilities}/structures/licenses.ts +0 -0
  391. /package/tests/{core/utilities → utilities}/structures/plugins.ts +0 -0
  392. /package/tests/{core/utilities → utilities}/structures/shared.ts +0 -0
  393. /package/tests/{core/utilities → utilities}/structures/sso.ts +0 -0
  394. /package/tests/{core/utilities → utilities}/structures/userGroups.ts +0 -0
  395. /package/tests/{core/utilities → utilities}/structures/users.ts +0 -0
  396. /package/tests/{core/utilities → utilities}/testContainerUtils.ts +0 -0
@@ -1,138 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getPluginParams = exports.getStartEndKeyURL = exports.getRoleParams = exports.getTemplateParams = exports.getUsersByAppParams = exports.getUserMetadataParams = exports.getGlobalUserParams = exports.getWorkspaceParams = exports.isDatasourceId = exports.isTableId = exports.getQueryIndex = exports.getRowParams = exports.getDocParams = void 0;
4
- const constants_1 = require("../constants");
5
- const conversions_1 = require("./conversions");
6
- /**
7
- * If creating DB allDocs/query params with only a single top level ID this can be used, this
8
- * is usually the case as most of our docs are top level e.g. tables, automations, users and so on.
9
- * More complex cases such as link docs and rows which have multiple levels of IDs that their
10
- * ID consists of need their own functions to build the allDocs parameters.
11
- * @param {string} docType The type of document which input params are being built for, e.g. user,
12
- * link, app, table and so on.
13
- * @param {string|null} docId The ID of the document minus its type - this is only needed if looking
14
- * for a singular document.
15
- * @param {object} otherProps Add any other properties onto the request, e.g. include_docs.
16
- * @returns {object} Parameters which can then be used with an allDocs request.
17
- */
18
- function getDocParams(docType, docId, otherProps = {}) {
19
- if (docId == null) {
20
- docId = "";
21
- }
22
- return Object.assign(Object.assign({}, otherProps), { startkey: `${docType}${constants_1.SEPARATOR}${docId}`, endkey: `${docType}${constants_1.SEPARATOR}${docId}${constants_1.UNICODE_MAX}` });
23
- }
24
- exports.getDocParams = getDocParams;
25
- /**
26
- * Gets the DB allDocs/query params for retrieving a row.
27
- * @param {string|null} tableId The table in which the rows have been stored.
28
- * @param {string|null} rowId The ID of the row which is being specifically queried for. This can be
29
- * left null to get all the rows in the table.
30
- * @param {object} otherProps Any other properties to add to the request.
31
- * @returns {object} Parameters which can then be used with an allDocs request.
32
- */
33
- function getRowParams(tableId, rowId, otherProps = {}) {
34
- if (tableId == null) {
35
- return getDocParams(constants_1.DocumentType.ROW, null, otherProps);
36
- }
37
- const endOfKey = rowId == null ? `${tableId}${constants_1.SEPARATOR}` : rowId;
38
- return getDocParams(constants_1.DocumentType.ROW, endOfKey, otherProps);
39
- }
40
- exports.getRowParams = getRowParams;
41
- /**
42
- * Retrieve the correct index for a view based on default design DB.
43
- */
44
- function getQueryIndex(viewName) {
45
- return `database/${viewName}`;
46
- }
47
- exports.getQueryIndex = getQueryIndex;
48
- /**
49
- * Check if a given ID is that of a table.
50
- * @returns {boolean}
51
- */
52
- const isTableId = (id) => {
53
- // this includes datasource plus tables
54
- return (id &&
55
- (id.startsWith(`${constants_1.DocumentType.TABLE}${constants_1.SEPARATOR}`) ||
56
- id.startsWith(`${constants_1.DocumentType.DATASOURCE_PLUS}${constants_1.SEPARATOR}`)));
57
- };
58
- exports.isTableId = isTableId;
59
- /**
60
- * Check if a given ID is that of a datasource or datasource plus.
61
- * @returns {boolean}
62
- */
63
- const isDatasourceId = (id) => {
64
- // this covers both datasources and datasource plus
65
- return id && id.startsWith(`${constants_1.DocumentType.DATASOURCE}${constants_1.SEPARATOR}`);
66
- };
67
- exports.isDatasourceId = isDatasourceId;
68
- /**
69
- * Gets parameters for retrieving workspaces.
70
- */
71
- function getWorkspaceParams(id = "", otherProps = {}) {
72
- return Object.assign(Object.assign({}, otherProps), { startkey: `${constants_1.DocumentType.WORKSPACE}${constants_1.SEPARATOR}${id}`, endkey: `${constants_1.DocumentType.WORKSPACE}${constants_1.SEPARATOR}${id}${constants_1.UNICODE_MAX}` });
73
- }
74
- exports.getWorkspaceParams = getWorkspaceParams;
75
- /**
76
- * Gets parameters for retrieving users.
77
- */
78
- function getGlobalUserParams(globalId, otherProps = {}) {
79
- if (!globalId) {
80
- globalId = "";
81
- }
82
- const startkey = otherProps === null || otherProps === void 0 ? void 0 : otherProps.startkey;
83
- return Object.assign(Object.assign({}, otherProps), {
84
- // need to include this incase pagination
85
- startkey: startkey
86
- ? startkey
87
- : `${constants_1.DocumentType.USER}${constants_1.SEPARATOR}${globalId}`, endkey: `${constants_1.DocumentType.USER}${constants_1.SEPARATOR}${globalId}${constants_1.UNICODE_MAX}` });
88
- }
89
- exports.getGlobalUserParams = getGlobalUserParams;
90
- /**
91
- * Gets parameters for retrieving users, this is a utility function for the getDocParams function.
92
- */
93
- function getUserMetadataParams(userId, otherProps = {}) {
94
- return getRowParams(constants_1.InternalTable.USER_METADATA, userId, otherProps);
95
- }
96
- exports.getUserMetadataParams = getUserMetadataParams;
97
- function getUsersByAppParams(appId, otherProps = {}) {
98
- const prodAppId = (0, conversions_1.getProdAppID)(appId);
99
- return Object.assign(Object.assign({}, otherProps), { startkey: prodAppId, endkey: `${prodAppId}${constants_1.UNICODE_MAX}` });
100
- }
101
- exports.getUsersByAppParams = getUsersByAppParams;
102
- /**
103
- * Gets parameters for retrieving templates. Owner ID must be specified, either global or a workspace level.
104
- */
105
- function getTemplateParams(ownerId, templateId, otherProps = {}) {
106
- if (!templateId) {
107
- templateId = "";
108
- }
109
- let final;
110
- if (templateId) {
111
- final = templateId;
112
- }
113
- else {
114
- final = `${constants_1.DocumentType.TEMPLATE}${constants_1.SEPARATOR}${ownerId}${constants_1.SEPARATOR}`;
115
- }
116
- return Object.assign(Object.assign({}, otherProps), { startkey: final, endkey: `${final}${constants_1.UNICODE_MAX}` });
117
- }
118
- exports.getTemplateParams = getTemplateParams;
119
- /**
120
- * Gets parameters for retrieving a role, this is a utility function for the getDocParams function.
121
- */
122
- function getRoleParams(roleId, otherProps = {}) {
123
- return getDocParams(constants_1.DocumentType.ROLE, roleId, otherProps);
124
- }
125
- exports.getRoleParams = getRoleParams;
126
- function getStartEndKeyURL(baseKey, tenantId) {
127
- const tenancy = tenantId ? `${constants_1.SEPARATOR}${tenantId}` : "";
128
- return `startkey="${baseKey}${tenancy}"&endkey="${baseKey}${tenancy}${constants_1.UNICODE_MAX}"`;
129
- }
130
- exports.getStartEndKeyURL = getStartEndKeyURL;
131
- /**
132
- * Gets parameters for retrieving automations, this is a utility function for the getDocParams function.
133
- */
134
- const getPluginParams = (pluginId, otherProps = {}) => {
135
- return getDocParams(constants_1.DocumentType.PLUGIN, pluginId, otherProps);
136
- };
137
- exports.getPluginParams = getPluginParams;
138
- //# sourceMappingURL=params.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"params.js","sourceRoot":"","sources":["../../../src/docIds/params.ts"],"names":[],"mappings":"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"}
@@ -1,2 +0,0 @@
1
- import { ProcessorMap } from "../events/processors/async/DocumentUpdateProcessor";
2
- export declare function init(processors: ProcessorMap): void;
@@ -1,36 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __importDefault = (this && this.__importDefault) || function (mod) {
12
- return (mod && mod.__esModule) ? mod : { "default": mod };
13
- };
14
- Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.init = void 0;
16
- const asyncEvents_1 = require("../events/asyncEvents");
17
- const DocumentUpdateProcessor_1 = __importDefault(require("../events/processors/async/DocumentUpdateProcessor"));
18
- let processingPromise;
19
- let documentProcessor;
20
- function init(processors) {
21
- if (!asyncEvents_1.asyncEventQueue) {
22
- (0, asyncEvents_1.init)();
23
- }
24
- if (!documentProcessor) {
25
- documentProcessor = new DocumentUpdateProcessor_1.default(processors);
26
- }
27
- // if not processing in this instance, kick it off
28
- if (!processingPromise) {
29
- processingPromise = asyncEvents_1.asyncEventQueue.process((job) => __awaiter(this, void 0, void 0, function* () {
30
- const { event, identity, properties, timestamp } = job.data;
31
- yield documentProcessor.processEvent(event, identity, properties, timestamp);
32
- }));
33
- }
34
- }
35
- exports.init = init;
36
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/docUpdates/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,uDAA0E;AAC1E,iHAG2D;AAE3D,IAAI,iBAAgC,CAAA;AACpC,IAAI,iBAA0C,CAAA;AAE9C,SAAgB,IAAI,CAAC,UAAwB;IAC3C,IAAI,CAAC,6BAAe,EAAE;QACpB,IAAA,kBAAS,GAAE,CAAA;KACZ;IACD,IAAI,CAAC,iBAAiB,EAAE;QACtB,iBAAiB,GAAG,IAAI,iCAAuB,CAAC,UAAU,CAAC,CAAA;KAC5D;IACD,kDAAkD;IAClD,IAAI,CAAC,iBAAiB,EAAE;QACtB,iBAAiB,GAAG,6BAAe,CAAC,OAAO,CAAC,CAAM,GAAG,EAAC,EAAE;YACtD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,EAAE,GAAG,GAAG,CAAC,IAAI,CAAA;YAC3D,MAAM,iBAAiB,CAAC,YAAY,CAClC,KAAK,EACL,QAAQ,EACR,UAAU,EACV,SAAS,CACV,CAAA;QACH,CAAC,CAAA,CAAC,CAAA;KACH;AACH,CAAC;AAnBD,oBAmBC"}
@@ -1,2 +0,0 @@
1
- export * from "./queue";
2
- export * from "./publisher";
@@ -1,19 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./queue"), exports);
18
- __exportStar(require("./publisher"), exports);
19
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/events/asyncEvents/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAuB;AACvB,8CAA2B"}
@@ -1,2 +0,0 @@
1
- import { EventPayload } from "./queue";
2
- export declare function publishAsyncEvent(payload: EventPayload): Promise<void>;
@@ -1,27 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.publishAsyncEvent = void 0;
13
- const types_1 = require("@budibase/types");
14
- const queue_1 = require("./queue");
15
- function publishAsyncEvent(payload) {
16
- return __awaiter(this, void 0, void 0, function* () {
17
- if (!queue_1.asyncEventQueue) {
18
- (0, queue_1.init)();
19
- }
20
- const { event, identity } = payload;
21
- if (types_1.AsyncEvents.indexOf(event) !== -1 && identity.tenantId) {
22
- yield queue_1.asyncEventQueue.add(payload);
23
- }
24
- });
25
- }
26
- exports.publishAsyncEvent = publishAsyncEvent;
27
- //# sourceMappingURL=publisher.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"publisher.js","sourceRoot":"","sources":["../../../../src/events/asyncEvents/publisher.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA6C;AAC7C,mCAA6D;AAE7D,SAAsB,iBAAiB,CAAC,OAAqB;;QAC3D,IAAI,CAAC,uBAAe,EAAE;YACpB,IAAA,YAAI,GAAE,CAAA;SACP;QACD,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,OAAO,CAAA;QACnC,IAAI,mBAAW,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,IAAI,QAAQ,CAAC,QAAQ,EAAE;YAC1D,MAAM,uBAAe,CAAC,GAAG,CAAC,OAAO,CAAC,CAAA;SACnC;IACH,CAAC;CAAA;AARD,8CAQC"}
@@ -1,11 +0,0 @@
1
- import BullQueue from "bull";
2
- import { Event, Identity } from "@budibase/types";
3
- export interface EventPayload {
4
- event: Event;
5
- identity: Identity;
6
- properties: any;
7
- timestamp?: string | number;
8
- }
9
- export declare let asyncEventQueue: BullQueue.Queue;
10
- export declare function init(): void;
11
- export declare function shutdown(): Promise<void>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.shutdown = exports.init = exports.asyncEventQueue = void 0;
13
- const queue_1 = require("../../queue");
14
- function init() {
15
- exports.asyncEventQueue = (0, queue_1.createQueue)(queue_1.JobQueue.SYSTEM_EVENT_QUEUE);
16
- }
17
- exports.init = init;
18
- function shutdown() {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- if (exports.asyncEventQueue) {
21
- yield exports.asyncEventQueue.close();
22
- }
23
- });
24
- }
25
- exports.shutdown = shutdown;
26
- //# sourceMappingURL=queue.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"queue.js","sourceRoot":"","sources":["../../../../src/events/asyncEvents/queue.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,uCAAmD;AAYnD,SAAgB,IAAI;IAClB,uBAAe,GAAG,IAAA,mBAAW,EAAe,gBAAQ,CAAC,kBAAkB,CAAC,CAAA;AAC1E,CAAC;AAFD,oBAEC;AAED,SAAsB,QAAQ;;QAC5B,IAAI,uBAAe,EAAE;YACnB,MAAM,uBAAe,CAAC,KAAK,EAAE,CAAA;SAC9B;IACH,CAAC;CAAA;AAJD,4BAIC"}
@@ -1,2 +0,0 @@
1
- import { Event } from "@budibase/types";
2
- export declare function getDocumentId(event: Event, properties: any): string | undefined;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getDocumentId = void 0;
4
- const types_1 = require("@budibase/types");
5
- const getEventProperties = {
6
- [types_1.Event.USER_CREATED]: (properties) => properties.userId,
7
- [types_1.Event.USER_UPDATED]: (properties) => properties.userId,
8
- [types_1.Event.USER_DELETED]: (properties) => properties.userId,
9
- [types_1.Event.USER_PERMISSION_ADMIN_ASSIGNED]: (properties) => properties.userId,
10
- [types_1.Event.USER_PERMISSION_ADMIN_REMOVED]: (properties) => properties.userId,
11
- [types_1.Event.USER_PERMISSION_BUILDER_ASSIGNED]: (properties) => properties.userId,
12
- [types_1.Event.USER_PERMISSION_BUILDER_REMOVED]: (properties) => properties.userId,
13
- [types_1.Event.USER_GROUP_CREATED]: (properties) => properties.groupId,
14
- [types_1.Event.USER_GROUP_UPDATED]: (properties) => properties.groupId,
15
- [types_1.Event.USER_GROUP_DELETED]: (properties) => properties.groupId,
16
- [types_1.Event.USER_GROUP_USERS_ADDED]: (properties) => properties.groupId,
17
- [types_1.Event.USER_GROUP_USERS_REMOVED]: (properties) => properties.groupId,
18
- [types_1.Event.USER_GROUP_PERMISSIONS_EDITED]: (properties) => properties.groupId,
19
- };
20
- function getDocumentId(event, properties) {
21
- const extractor = getEventProperties[event];
22
- if (!extractor) {
23
- throw new Error("Event does not have a method of document ID extraction");
24
- }
25
- return extractor(properties);
26
- }
27
- exports.getDocumentId = getDocumentId;
28
- //# sourceMappingURL=documentId.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"documentId.js","sourceRoot":"","sources":["../../../src/events/documentId.ts"],"names":[],"mappings":";;;AAAA,2CAawB;AAExB,MAAM,kBAAkB,GAGpB;IACF,CAAC,aAAK,CAAC,YAAY,CAAC,EAAE,CAAC,UAA4B,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM;IACzE,CAAC,aAAK,CAAC,YAAY,CAAC,EAAE,CAAC,UAA4B,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM;IACzE,CAAC,aAAK,CAAC,YAAY,CAAC,EAAE,CAAC,UAA4B,EAAE,EAAE,CAAC,UAAU,CAAC,MAAM;IACzE,CAAC,aAAK,CAAC,8BAA8B,CAAC,EAAE,CACtC,UAAuC,EACvC,EAAE,CAAC,UAAU,CAAC,MAAM;IACtB,CAAC,aAAK,CAAC,6BAA6B,CAAC,EAAE,CACrC,UAAsC,EACtC,EAAE,CAAC,UAAU,CAAC,MAAM;IACtB,CAAC,aAAK,CAAC,gCAAgC,CAAC,EAAE,CACxC,UAAuC,EACvC,EAAE,CAAC,UAAU,CAAC,MAAM;IACtB,CAAC,aAAK,CAAC,+BAA+B,CAAC,EAAE,CACvC,UAAsC,EACtC,EAAE,CAAC,UAAU,CAAC,MAAM;IACtB,CAAC,aAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAA6B,EAAE,EAAE,CAC5D,UAAU,CAAC,OAAO;IACpB,CAAC,aAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAA6B,EAAE,EAAE,CAC5D,UAAU,CAAC,OAAO;IACpB,CAAC,aAAK,CAAC,kBAAkB,CAAC,EAAE,CAAC,UAA6B,EAAE,EAAE,CAC5D,UAAU,CAAC,OAAO;IACpB,CAAC,aAAK,CAAC,sBAAsB,CAAC,EAAE,CAAC,UAAgC,EAAE,EAAE,CACnE,UAAU,CAAC,OAAO;IACpB,CAAC,aAAK,CAAC,wBAAwB,CAAC,EAAE,CAAC,UAAkC,EAAE,EAAE,CACvE,UAAU,CAAC,OAAO;IACpB,CAAC,aAAK,CAAC,6BAA6B,CAAC,EAAE,CACrC,UAAuC,EACvC,EAAE,CAAC,UAAU,CAAC,OAAO;CACxB,CAAA;AAED,SAAgB,aAAa,CAAC,KAAY,EAAE,UAAe;IACzD,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAA;IAC3C,IAAI,CAAC,SAAS,EAAE;QACd,MAAM,IAAI,KAAK,CAAC,wDAAwD,CAAC,CAAA;KAC1E;IACD,OAAO,SAAS,CAAC,UAAU,CAAC,CAAA;AAC9B,CAAC;AAND,sCAMC"}
@@ -1,13 +0,0 @@
1
- import { EventProcessor } from "../types";
2
- import { Event, Identity, DocUpdateEvent } from "@budibase/types";
3
- export declare type Processor = (update: DocUpdateEvent) => Promise<void>;
4
- export declare type ProcessorMap = {
5
- events: Event[];
6
- processor: Processor;
7
- }[];
8
- export default class DocumentUpdateProcessor implements EventProcessor {
9
- processors: ProcessorMap;
10
- constructor(processors: ProcessorMap);
11
- processEvent(event: Event, identity: Identity, properties: any, timestamp?: string | number): Promise<void>;
12
- shutdown(): Promise<void>;
13
- }
@@ -1,44 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- Object.defineProperty(exports, "__esModule", { value: true });
12
- const context_1 = require("../../../context");
13
- const documentId_1 = require("../../documentId");
14
- const asyncEvents_1 = require("../../asyncEvents");
15
- class DocumentUpdateProcessor {
16
- constructor(processors) {
17
- this.processors = [];
18
- this.processors = processors;
19
- }
20
- processEvent(event, identity, properties, timestamp) {
21
- return __awaiter(this, void 0, void 0, function* () {
22
- const tenantId = identity.realTenantId;
23
- const docId = (0, documentId_1.getDocumentId)(event, properties);
24
- if (!tenantId || !docId) {
25
- return;
26
- }
27
- for (let { events, processor } of this.processors) {
28
- if (events.includes(event)) {
29
- yield (0, context_1.doInTenant)(tenantId, () => __awaiter(this, void 0, void 0, function* () {
30
- yield processor({
31
- id: docId,
32
- tenantId,
33
- });
34
- }));
35
- }
36
- }
37
- });
38
- }
39
- shutdown() {
40
- return (0, asyncEvents_1.shutdown)();
41
- }
42
- }
43
- exports.default = DocumentUpdateProcessor;
44
- //# sourceMappingURL=DocumentUpdateProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"DocumentUpdateProcessor.js","sourceRoot":"","sources":["../../../../../src/events/processors/async/DocumentUpdateProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;AAEA,8CAA6C;AAC7C,iDAAgD;AAChD,mDAA4C;AAK5C,MAAqB,uBAAuB;IAG1C,YAAY,UAAwB;QAFpC,eAAU,GAAiB,EAAE,CAAA;QAG3B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAEK,YAAY,CAChB,KAAY,EACZ,QAAkB,EAClB,UAAe,EACf,SAA2B;;YAE3B,MAAM,QAAQ,GAAG,QAAQ,CAAC,YAAY,CAAA;YACtC,MAAM,KAAK,GAAG,IAAA,0BAAa,EAAC,KAAK,EAAE,UAAU,CAAC,CAAA;YAC9C,IAAI,CAAC,QAAQ,IAAI,CAAC,KAAK,EAAE;gBACvB,OAAM;aACP;YACD,KAAK,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,IAAI,IAAI,CAAC,UAAU,EAAE;gBACjD,IAAI,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,EAAE;oBAC1B,MAAM,IAAA,oBAAU,EAAC,QAAQ,EAAE,GAAS,EAAE;wBACpC,MAAM,SAAS,CAAC;4BACd,EAAE,EAAE,KAAK;4BACT,QAAQ;yBACT,CAAC,CAAA;oBACJ,CAAC,CAAA,CAAC,CAAA;iBACH;aACF;QACH,CAAC;KAAA;IAED,QAAQ;QACN,OAAO,IAAA,sBAAQ,GAAE,CAAA;IACnB,CAAC;CACF;AAjCD,0CAiCC"}
@@ -1,24 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.logWarn = exports.logAlertWithInfo = exports.logAlert = void 0;
4
- const NonErrors = ["AccountError"];
5
- function isSuppressed(e) {
6
- return e && e["suppressAlert"];
7
- }
8
- function logAlert(message, e) {
9
- if (e && NonErrors.includes(e.name) && isSuppressed(e)) {
10
- return;
11
- }
12
- console.error(`bb-alert: ${message}`, e);
13
- }
14
- exports.logAlert = logAlert;
15
- function logAlertWithInfo(message, db, id, error) {
16
- message = `${message} - db: ${db} - doc: ${id} - error: `;
17
- logAlert(message, error);
18
- }
19
- exports.logAlertWithInfo = logAlertWithInfo;
20
- function logWarn(message) {
21
- console.warn(`bb-warn: ${message}`);
22
- }
23
- exports.logWarn = logWarn;
24
- //# sourceMappingURL=alerts.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"alerts.js","sourceRoot":"","sources":["../../../src/logging/alerts.ts"],"names":[],"mappings":";;;AAAA,MAAM,SAAS,GAAG,CAAC,cAAc,CAAC,CAAA;AAElC,SAAS,YAAY,CAAC,CAAO;IAC3B,OAAO,CAAC,IAAI,CAAC,CAAC,eAAe,CAAC,CAAA;AAChC,CAAC;AAED,SAAgB,QAAQ,CAAC,OAAe,EAAE,CAAO;IAC/C,IAAI,CAAC,IAAI,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,YAAY,CAAC,CAAC,CAAC,EAAE;QACtD,OAAM;KACP;IACD,OAAO,CAAC,KAAK,CAAC,aAAa,OAAO,EAAE,EAAE,CAAC,CAAC,CAAA;AAC1C,CAAC;AALD,4BAKC;AAED,SAAgB,gBAAgB,CAC9B,OAAe,EACf,EAAU,EACV,EAAU,EACV,KAAU;IAEV,OAAO,GAAG,GAAG,OAAO,UAAU,EAAE,WAAW,EAAE,YAAY,CAAA;IACzD,QAAQ,CAAC,OAAO,EAAE,KAAK,CAAC,CAAA;AAC1B,CAAC;AARD,4CAQC;AAED,SAAgB,OAAO,CAAC,OAAe;IACrC,OAAO,CAAC,IAAI,CAAC,YAAY,OAAO,EAAE,CAAC,CAAA;AACrC,CAAC;AAFD,0BAEC"}
@@ -1,2 +0,0 @@
1
- export declare const setHeader: (headers: any) => void;
2
- export declare function getId(): any;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getId = exports.setHeader = void 0;
4
- const constants_1 = require("../../constants");
5
- const correlator = require("correlation-id");
6
- const setHeader = (headers) => {
7
- const correlationId = correlator.getId();
8
- if (correlationId) {
9
- headers[constants_1.Header.CORRELATION_ID] = correlationId;
10
- }
11
- };
12
- exports.setHeader = setHeader;
13
- function getId() {
14
- return correlator.getId();
15
- }
16
- exports.getId = getId;
17
- //# sourceMappingURL=correlation.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"correlation.js","sourceRoot":"","sources":["../../../../src/logging/correlation/correlation.ts"],"names":[],"mappings":";;;AAAA,+CAAwC;AACxC,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAErC,MAAM,SAAS,GAAG,CAAC,OAAY,EAAE,EAAE;IACxC,MAAM,aAAa,GAAG,UAAU,CAAC,KAAK,EAAE,CAAA;IACxC,IAAI,aAAa,EAAE;QACjB,OAAO,CAAC,kBAAM,CAAC,cAAc,CAAC,GAAG,aAAa,CAAA;KAC/C;AACH,CAAC,CAAA;AALY,QAAA,SAAS,aAKrB;AAED,SAAgB,KAAK;IACnB,OAAO,UAAU,CAAC,KAAK,EAAE,CAAA;AAC3B,CAAC;AAFD,sBAEC"}
@@ -1 +0,0 @@
1
- export * from "./correlation";
@@ -1,18 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./correlation"), exports);
18
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/logging/correlation/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA6B"}
@@ -1,2 +0,0 @@
1
- declare const correlation: (ctx: any, next: any) => any;
2
- export default correlation;
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const constants_1 = require("../../constants");
4
- const uuid_1 = require("uuid");
5
- const correlator = require("correlation-id");
6
- const correlation = (ctx, next) => {
7
- // use the provided correlation id header if present
8
- let correlationId = ctx.headers[constants_1.Header.CORRELATION_ID];
9
- if (!correlationId) {
10
- correlationId = (0, uuid_1.v4)();
11
- }
12
- return correlator.withId(correlationId, () => {
13
- return next();
14
- });
15
- };
16
- exports.default = correlation;
17
- //# sourceMappingURL=middleware.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"middleware.js","sourceRoot":"","sources":["../../../../src/logging/correlation/middleware.ts"],"names":[],"mappings":";;AAAA,+CAAwC;AACxC,+BAAiC;AACjC,MAAM,UAAU,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAA;AAE5C,MAAM,WAAW,GAAG,CAAC,GAAQ,EAAE,IAAS,EAAE,EAAE;IAC1C,oDAAoD;IACpD,IAAI,aAAa,GAAG,GAAG,CAAC,OAAO,CAAC,kBAAM,CAAC,cAAc,CAAC,CAAA;IACtD,IAAI,CAAC,aAAa,EAAE;QAClB,aAAa,GAAG,IAAA,SAAI,GAAE,CAAA;KACvB;IAED,OAAO,UAAU,CAAC,MAAM,CAAC,aAAa,EAAE,GAAG,EAAE;QAC3C,OAAO,IAAI,EAAE,CAAA;IACf,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA;AAED,kBAAe,WAAW,CAAA"}
@@ -1,4 +0,0 @@
1
- export * as correlation from "./correlation/correlation";
2
- export { logger, disableLogger } from "./pino/logger";
3
- export * from "./alerts";
4
- export declare let LOG_CONTEXT: boolean;
@@ -1,37 +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 (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
26
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.LOG_CONTEXT = exports.disableLogger = exports.logger = exports.correlation = void 0;
30
- exports.correlation = __importStar(require("./correlation/correlation"));
31
- var logger_1 = require("./pino/logger");
32
- Object.defineProperty(exports, "logger", { enumerable: true, get: function () { return logger_1.logger; } });
33
- Object.defineProperty(exports, "disableLogger", { enumerable: true, get: function () { return logger_1.disableLogger; } });
34
- __exportStar(require("./alerts"), exports);
35
- // turn off or on context logging i.e. tenantId, appId etc
36
- exports.LOG_CONTEXT = true;
37
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/logging/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yEAAwD;AACxD,wCAAqD;AAA5C,gGAAA,MAAM,OAAA;AAAE,uGAAA,aAAa,OAAA;AAC9B,2CAAwB;AAExB,0DAA0D;AAC/C,QAAA,WAAW,GAAG,IAAI,CAAA"}
@@ -1,3 +0,0 @@
1
- import { LoggerOptions } from "pino";
2
- export declare const logger: import("pino").Logger<LoggerOptions>;
3
- export declare function disableLogger(): void;