@budibase/backend-core 2.9.16 → 2.9.18

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 (435) hide show
  1. package/dist/index.js +12544 -0
  2. package/dist/index.js.map +7 -0
  3. package/dist/index.js.meta.json +1 -0
  4. package/dist/package.json +5 -5
  5. package/dist/plugins.js +288 -16
  6. package/dist/plugins.js.map +7 -1
  7. package/dist/plugins.js.meta.json +1 -0
  8. package/dist/tests.js +8476 -0
  9. package/dist/tests.js.map +7 -0
  10. package/dist/tests.js.meta.json +1 -0
  11. package/dist/tsconfig.build.tsbuildinfo +1 -1
  12. package/package.json +5 -5
  13. package/scripts/build.js +6 -0
  14. package/tsconfig.build.json +5 -1
  15. package/tsconfig.json +0 -8
  16. package/dist/jest.config.js +0 -25
  17. package/dist/jest.config.js.map +0 -1
  18. package/dist/plugins.d.ts +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 -92
  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 -189
  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 -76
  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 -120
  36. package/dist/src/cache/base/index.js.map +0 -1
  37. package/dist/src/cache/generic.js +0 -31
  38. package/dist/src/cache/generic.js.map +0 -1
  39. package/dist/src/cache/index.js +0 -35
  40. package/dist/src/cache/index.js.map +0 -1
  41. package/dist/src/cache/user.js +0 -108
  42. package/dist/src/cache/user.js.map +0 -1
  43. package/dist/src/cache/writethrough.js +0 -159
  44. package/dist/src/cache/writethrough.js.map +0 -1
  45. package/dist/src/configs/configs.js +0 -278
  46. package/dist/src/configs/configs.js.map +0 -1
  47. package/dist/src/configs/index.js +0 -18
  48. package/dist/src/configs/index.js.map +0 -1
  49. package/dist/src/constants/db.js +0 -67
  50. package/dist/src/constants/db.js.map +0 -1
  51. package/dist/src/constants/index.js +0 -19
  52. package/dist/src/constants/index.js.map +0 -1
  53. package/dist/src/constants/misc.js +0 -54
  54. package/dist/src/constants/misc.js.map +0 -1
  55. package/dist/src/context/Context.js +0 -14
  56. package/dist/src/context/Context.js.map +0 -1
  57. package/dist/src/context/identity.js +0 -72
  58. package/dist/src/context/identity.js.map +0 -1
  59. package/dist/src/context/index.js +0 -34
  60. package/dist/src/context/index.js.map +0 -1
  61. package/dist/src/context/mainContext.js +0 -331
  62. package/dist/src/context/mainContext.js.map +0 -1
  63. package/dist/src/context/types.js +0 -3
  64. package/dist/src/context/types.js.map +0 -1
  65. package/dist/src/db/Replication.js +0 -85
  66. package/dist/src/db/Replication.js.map +0 -1
  67. package/dist/src/db/constants.js +0 -13
  68. package/dist/src/db/constants.js.map +0 -1
  69. package/dist/src/db/couch/DatabaseImpl.js +0 -248
  70. package/dist/src/db/couch/DatabaseImpl.js.map +0 -1
  71. package/dist/src/db/couch/connections.js +0 -88
  72. package/dist/src/db/couch/connections.js.map +0 -1
  73. package/dist/src/db/couch/index.js +0 -27
  74. package/dist/src/db/couch/index.js.map +0 -1
  75. package/dist/src/db/couch/pouchDB.js +0 -108
  76. package/dist/src/db/couch/pouchDB.js.map +0 -1
  77. package/dist/src/db/couch/pouchDump.js +0 -2
  78. package/dist/src/db/couch/pouchDump.js.map +0 -1
  79. package/dist/src/db/couch/utils.js +0 -55
  80. package/dist/src/db/couch/utils.js.map +0 -1
  81. package/dist/src/db/db.js +0 -59
  82. package/dist/src/db/db.js.map +0 -1
  83. package/dist/src/db/errors.js +0 -22
  84. package/dist/src/db/errors.js.map +0 -1
  85. package/dist/src/db/index.js +0 -48
  86. package/dist/src/db/index.js.map +0 -1
  87. package/dist/src/db/lucene.js +0 -650
  88. package/dist/src/db/lucene.js.map +0 -1
  89. package/dist/src/db/searchIndexes/index.js +0 -18
  90. package/dist/src/db/searchIndexes/index.js.map +0 -1
  91. package/dist/src/db/searchIndexes/searchIndexes.js +0 -77
  92. package/dist/src/db/searchIndexes/searchIndexes.js.map +0 -1
  93. package/dist/src/db/utils.js +0 -213
  94. package/dist/src/db/utils.js.map +0 -1
  95. package/dist/src/db/views.js +0 -219
  96. package/dist/src/db/views.js.map +0 -1
  97. package/dist/src/docIds/conversions.js +0 -62
  98. package/dist/src/docIds/conversions.js.map +0 -1
  99. package/dist/src/docIds/ids.js +0 -112
  100. package/dist/src/docIds/ids.js.map +0 -1
  101. package/dist/src/docIds/index.js +0 -19
  102. package/dist/src/docIds/index.js.map +0 -1
  103. package/dist/src/docIds/newid.js +0 -9
  104. package/dist/src/docIds/newid.js.map +0 -1
  105. package/dist/src/docIds/params.js +0 -138
  106. package/dist/src/docIds/params.js.map +0 -1
  107. package/dist/src/docUpdates/index.js +0 -36
  108. package/dist/src/docUpdates/index.js.map +0 -1
  109. package/dist/src/environment.js +0 -110
  110. package/dist/src/environment.js.map +0 -1
  111. package/dist/src/errors/errors.js +0 -97
  112. package/dist/src/errors/errors.js.map +0 -1
  113. package/dist/src/errors/index.js +0 -18
  114. package/dist/src/errors/index.js.map +0 -1
  115. package/dist/src/events/analytics.js +0 -42
  116. package/dist/src/events/analytics.js.map +0 -1
  117. package/dist/src/events/asyncEvents/index.js +0 -19
  118. package/dist/src/events/asyncEvents/index.js.map +0 -1
  119. package/dist/src/events/asyncEvents/publisher.js +0 -27
  120. package/dist/src/events/asyncEvents/publisher.js.map +0 -1
  121. package/dist/src/events/asyncEvents/queue.js +0 -26
  122. package/dist/src/events/asyncEvents/queue.js.map +0 -1
  123. package/dist/src/events/backfill.js +0 -179
  124. package/dist/src/events/backfill.js.map +0 -1
  125. package/dist/src/events/documentId.js +0 -28
  126. package/dist/src/events/documentId.js.map +0 -1
  127. package/dist/src/events/events.js +0 -73
  128. package/dist/src/events/events.js.map +0 -1
  129. package/dist/src/events/identification.js +0 -300
  130. package/dist/src/events/identification.js.map +0 -1
  131. package/dist/src/events/index.js +0 -47
  132. package/dist/src/events/index.js.map +0 -1
  133. package/dist/src/events/processors/AnalyticsProcessor.js +0 -93
  134. package/dist/src/events/processors/AnalyticsProcessor.js.map +0 -1
  135. package/dist/src/events/processors/AuditLogsProcessor.js +0 -86
  136. package/dist/src/events/processors/AuditLogsProcessor.js.map +0 -1
  137. package/dist/src/events/processors/LoggingProcessor.js +0 -47
  138. package/dist/src/events/processors/LoggingProcessor.js.map +0 -1
  139. package/dist/src/events/processors/Processors.js +0 -52
  140. package/dist/src/events/processors/Processors.js.map +0 -1
  141. package/dist/src/events/processors/async/DocumentUpdateProcessor.js +0 -44
  142. package/dist/src/events/processors/async/DocumentUpdateProcessor.js.map +0 -1
  143. package/dist/src/events/processors/index.js +0 -23
  144. package/dist/src/events/processors/index.js.map +0 -1
  145. package/dist/src/events/processors/posthog/PosthogProcessor.js +0 -139
  146. package/dist/src/events/processors/posthog/PosthogProcessor.js.map +0 -1
  147. package/dist/src/events/processors/posthog/index.js +0 -8
  148. package/dist/src/events/processors/posthog/index.js.map +0 -1
  149. package/dist/src/events/processors/posthog/rateLimiting.js +0 -119
  150. package/dist/src/events/processors/posthog/rateLimiting.js.map +0 -1
  151. package/dist/src/events/processors/types.js +0 -3
  152. package/dist/src/events/processors/types.js.map +0 -1
  153. package/dist/src/events/publishers/account.js +0 -43
  154. package/dist/src/events/publishers/account.js.map +0 -1
  155. package/dist/src/events/publishers/app.js +0 -153
  156. package/dist/src/events/publishers/app.js.map +0 -1
  157. package/dist/src/events/publishers/auditLog.js +0 -34
  158. package/dist/src/events/publishers/auditLog.js.map +0 -1
  159. package/dist/src/events/publishers/auth.js +0 -80
  160. package/dist/src/events/publishers/auth.js.map +0 -1
  161. package/dist/src/events/publishers/automation.js +0 -117
  162. package/dist/src/events/publishers/automation.js.map +0 -1
  163. package/dist/src/events/publishers/backfill.js +0 -85
  164. package/dist/src/events/publishers/backfill.js.map +0 -1
  165. package/dist/src/events/publishers/backup.js +0 -41
  166. package/dist/src/events/publishers/backup.js.map +0 -1
  167. package/dist/src/events/publishers/datasource.js +0 -54
  168. package/dist/src/events/publishers/datasource.js.map +0 -1
  169. package/dist/src/events/publishers/email.js +0 -30
  170. package/dist/src/events/publishers/email.js.map +0 -1
  171. package/dist/src/events/publishers/environmentVariable.js +0 -44
  172. package/dist/src/events/publishers/environmentVariable.js.map +0 -1
  173. package/dist/src/events/publishers/group.js +0 -107
  174. package/dist/src/events/publishers/group.js.map +0 -1
  175. package/dist/src/events/publishers/index.js +0 -55
  176. package/dist/src/events/publishers/index.js.map +0 -1
  177. package/dist/src/events/publishers/installation.js +0 -52
  178. package/dist/src/events/publishers/installation.js.map +0 -1
  179. package/dist/src/events/publishers/layout.js +0 -34
  180. package/dist/src/events/publishers/layout.js.map +0 -1
  181. package/dist/src/events/publishers/license.js +0 -77
  182. package/dist/src/events/publishers/license.js.map +0 -1
  183. package/dist/src/events/publishers/org.js +0 -52
  184. package/dist/src/events/publishers/org.js.map +0 -1
  185. package/dist/src/events/publishers/plugin.js +0 -55
  186. package/dist/src/events/publishers/plugin.js.map +0 -1
  187. package/dist/src/events/publishers/query.js +0 -74
  188. package/dist/src/events/publishers/query.js.map +0 -1
  189. package/dist/src/events/publishers/role.js +0 -69
  190. package/dist/src/events/publishers/role.js.map +0 -1
  191. package/dist/src/events/publishers/rows.js +0 -32
  192. package/dist/src/events/publishers/rows.js.map +0 -1
  193. package/dist/src/events/publishers/screen.js +0 -46
  194. package/dist/src/events/publishers/screen.js.map +0 -1
  195. package/dist/src/events/publishers/serve.js +0 -47
  196. package/dist/src/events/publishers/serve.js.map +0 -1
  197. package/dist/src/events/publishers/table.js +0 -77
  198. package/dist/src/events/publishers/table.js.map +0 -1
  199. package/dist/src/events/publishers/user.js +0 -202
  200. package/dist/src/events/publishers/user.js.map +0 -1
  201. package/dist/src/events/publishers/view.js +0 -111
  202. package/dist/src/events/publishers/view.js.map +0 -1
  203. package/dist/src/featureFlags/index.js +0 -96
  204. package/dist/src/featureFlags/index.js.map +0 -1
  205. package/dist/src/helpers.js +0 -14
  206. package/dist/src/helpers.js.map +0 -1
  207. package/dist/src/index.js +0 -82
  208. package/dist/src/index.js.map +0 -1
  209. package/dist/src/installation.js +0 -138
  210. package/dist/src/installation.js.map +0 -1
  211. package/dist/src/logging/alerts.js +0 -24
  212. package/dist/src/logging/alerts.js.map +0 -1
  213. package/dist/src/logging/correlation/correlation.js +0 -17
  214. package/dist/src/logging/correlation/correlation.js.map +0 -1
  215. package/dist/src/logging/correlation/index.js +0 -18
  216. package/dist/src/logging/correlation/index.js.map +0 -1
  217. package/dist/src/logging/correlation/middleware.js +0 -17
  218. package/dist/src/logging/correlation/middleware.js.map +0 -1
  219. package/dist/src/logging/index.js +0 -35
  220. package/dist/src/logging/index.js.map +0 -1
  221. package/dist/src/logging/pino/logger.js +0 -218
  222. package/dist/src/logging/pino/logger.js.map +0 -1
  223. package/dist/src/logging/pino/middleware.js +0 -47
  224. package/dist/src/logging/pino/middleware.js.map +0 -1
  225. package/dist/src/logging/system.js +0 -101
  226. package/dist/src/logging/system.js.map +0 -1
  227. package/dist/src/middleware/adminOnly.js +0 -19
  228. package/dist/src/middleware/adminOnly.js.map +0 -1
  229. package/dist/src/middleware/auditLog.js +0 -16
  230. package/dist/src/middleware/auditLog.js.map +0 -1
  231. package/dist/src/middleware/authenticated.js +0 -204
  232. package/dist/src/middleware/authenticated.js.map +0 -1
  233. package/dist/src/middleware/builderOnly.js +0 -33
  234. package/dist/src/middleware/builderOnly.js.map +0 -1
  235. package/dist/src/middleware/builderOrAdmin.js +0 -33
  236. package/dist/src/middleware/builderOrAdmin.js.map +0 -1
  237. package/dist/src/middleware/csrf.js +0 -81
  238. package/dist/src/middleware/csrf.js.map +0 -1
  239. package/dist/src/middleware/errorHandling.js +0 -64
  240. package/dist/src/middleware/errorHandling.js.map +0 -1
  241. package/dist/src/middleware/index.js +0 -65
  242. package/dist/src/middleware/index.js.map +0 -1
  243. package/dist/src/middleware/internalApi.js +0 -30
  244. package/dist/src/middleware/internalApi.js.map +0 -1
  245. package/dist/src/middleware/joi-validator.js +0 -47
  246. package/dist/src/middleware/joi-validator.js.map +0 -1
  247. package/dist/src/middleware/matchers.js +0 -43
  248. package/dist/src/middleware/matchers.js.map +0 -1
  249. package/dist/src/middleware/passport/datasource/google.js +0 -95
  250. package/dist/src/middleware/passport/datasource/google.js.map +0 -1
  251. package/dist/src/middleware/passport/local.js +0 -81
  252. package/dist/src/middleware/passport/local.js.map +0 -1
  253. package/dist/src/middleware/passport/sso/google.js +0 -90
  254. package/dist/src/middleware/passport/sso/google.js.map +0 -1
  255. package/dist/src/middleware/passport/sso/oidc.js +0 -151
  256. package/dist/src/middleware/passport/sso/oidc.js.map +0 -1
  257. package/dist/src/middleware/passport/sso/sso.js +0 -165
  258. package/dist/src/middleware/passport/sso/sso.js.map +0 -1
  259. package/dist/src/middleware/passport/utils.js +0 -66
  260. package/dist/src/middleware/passport/utils.js.map +0 -1
  261. package/dist/src/middleware/querystringToBody.js +0 -29
  262. package/dist/src/middleware/querystringToBody.js.map +0 -1
  263. package/dist/src/middleware/tenancy.js +0 -37
  264. package/dist/src/middleware/tenancy.js.map +0 -1
  265. package/dist/src/migrations/definitions.js +0 -39
  266. package/dist/src/migrations/definitions.js.map +0 -1
  267. package/dist/src/migrations/index.js +0 -19
  268. package/dist/src/migrations/index.js.map +0 -1
  269. package/dist/src/migrations/migrations.js +0 -198
  270. package/dist/src/migrations/migrations.js.map +0 -1
  271. package/dist/src/objectStore/buckets/app.js +0 -73
  272. package/dist/src/objectStore/buckets/app.js.map +0 -1
  273. package/dist/src/objectStore/buckets/global.js +0 -58
  274. package/dist/src/objectStore/buckets/global.js.map +0 -1
  275. package/dist/src/objectStore/buckets/index.js +0 -20
  276. package/dist/src/objectStore/buckets/index.js.map +0 -1
  277. package/dist/src/objectStore/buckets/plugins.js +0 -95
  278. package/dist/src/objectStore/buckets/plugins.js.map +0 -1
  279. package/dist/src/objectStore/cloudfront.js +0 -40
  280. package/dist/src/objectStore/cloudfront.js.map +0 -1
  281. package/dist/src/objectStore/index.js +0 -20
  282. package/dist/src/objectStore/index.js.map +0 -1
  283. package/dist/src/objectStore/objectStore.js +0 -382
  284. package/dist/src/objectStore/objectStore.js.map +0 -1
  285. package/dist/src/objectStore/utils.js +0 -32
  286. package/dist/src/objectStore/utils.js.map +0 -1
  287. package/dist/src/platform/index.js +0 -33
  288. package/dist/src/platform/index.js.map +0 -1
  289. package/dist/src/platform/platformDb.js +0 -10
  290. package/dist/src/platform/platformDb.js.map +0 -1
  291. package/dist/src/platform/tenants.js +0 -139
  292. package/dist/src/platform/tenants.js.map +0 -1
  293. package/dist/src/platform/users.js +0 -96
  294. package/dist/src/platform/users.js.map +0 -1
  295. package/dist/src/plugin/index.js +0 -18
  296. package/dist/src/plugin/index.js.map +0 -1
  297. package/dist/src/plugin/utils.js +0 -145
  298. package/dist/src/plugin/utils.js.map +0 -1
  299. package/dist/src/queue/constants.js +0 -11
  300. package/dist/src/queue/constants.js.map +0 -1
  301. package/dist/src/queue/inMemoryQueue.js +0 -145
  302. package/dist/src/queue/inMemoryQueue.js.map +0 -1
  303. package/dist/src/queue/index.js +0 -19
  304. package/dist/src/queue/index.js.map +0 -1
  305. package/dist/src/queue/listeners.js +0 -186
  306. package/dist/src/queue/listeners.js.map +0 -1
  307. package/dist/src/queue/queue.js +0 -92
  308. package/dist/src/queue/queue.js.map +0 -1
  309. package/dist/src/redis/index.js +0 -37
  310. package/dist/src/redis/index.js.map +0 -1
  311. package/dist/src/redis/init.js +0 -138
  312. package/dist/src/redis/init.js.map +0 -1
  313. package/dist/src/redis/redis.js +0 -335
  314. package/dist/src/redis/redis.js.map +0 -1
  315. package/dist/src/redis/redlockImpl.js +0 -162
  316. package/dist/src/redis/redlockImpl.js.map +0 -1
  317. package/dist/src/redis/utils.js +0 -123
  318. package/dist/src/redis/utils.js.map +0 -1
  319. package/dist/src/security/encryption.js +0 -163
  320. package/dist/src/security/encryption.js.map +0 -1
  321. package/dist/src/security/permissions.js +0 -151
  322. package/dist/src/security/permissions.js.map +0 -1
  323. package/dist/src/security/roles.js +0 -388
  324. package/dist/src/security/roles.js.map +0 -1
  325. package/dist/src/security/sessions.js +0 -121
  326. package/dist/src/security/sessions.js.map +0 -1
  327. package/dist/src/tenancy/db.js +0 -10
  328. package/dist/src/tenancy/db.js.map +0 -1
  329. package/dist/src/tenancy/index.js +0 -19
  330. package/dist/src/tenancy/index.js.map +0 -1
  331. package/dist/src/tenancy/tenancy.js +0 -116
  332. package/dist/src/tenancy/tenancy.js.map +0 -1
  333. package/dist/src/timers/index.js +0 -18
  334. package/dist/src/timers/index.js.map +0 -1
  335. package/dist/src/timers/timers.js +0 -26
  336. package/dist/src/timers/timers.js.map +0 -1
  337. package/dist/src/users/db.js +0 -407
  338. package/dist/src/users/db.js.map +0 -1
  339. package/dist/src/users/events.js +0 -169
  340. package/dist/src/users/events.js.map +0 -1
  341. package/dist/src/users/index.js +0 -23
  342. package/dist/src/users/index.js.map +0 -1
  343. package/dist/src/users/lookup.js +0 -112
  344. package/dist/src/users/lookup.js.map +0 -1
  345. package/dist/src/users/users.js +0 -261
  346. package/dist/src/users/users.js.map +0 -1
  347. package/dist/src/users/utils.js +0 -92
  348. package/dist/src/users/utils.js.map +0 -1
  349. package/dist/src/utils/hashing.js +0 -47
  350. package/dist/src/utils/hashing.js.map +0 -1
  351. package/dist/src/utils/index.js +0 -20
  352. package/dist/src/utils/index.js.map +0 -1
  353. package/dist/src/utils/stringUtils.js +0 -9
  354. package/dist/src/utils/stringUtils.js.map +0 -1
  355. package/dist/src/utils/utils.js +0 -247
  356. package/dist/src/utils/utils.js.map +0 -1
  357. package/dist/tests/core/logging.js +0 -33
  358. package/dist/tests/core/logging.js.map +0 -1
  359. package/dist/tests/core/utilities/index.js +0 -37
  360. package/dist/tests/core/utilities/index.js.map +0 -1
  361. package/dist/tests/core/utilities/jestUtils.js +0 -21
  362. package/dist/tests/core/utilities/jestUtils.js.map +0 -1
  363. package/dist/tests/core/utilities/mocks/alerts.js +0 -30
  364. package/dist/tests/core/utilities/mocks/alerts.js.map +0 -1
  365. package/dist/tests/core/utilities/mocks/date.js +0 -6
  366. package/dist/tests/core/utilities/mocks/date.js.map +0 -1
  367. package/dist/tests/core/utilities/mocks/events.js +0 -143
  368. package/dist/tests/core/utilities/mocks/events.js.map +0 -1
  369. package/dist/tests/core/utilities/mocks/fetch.js +0 -15
  370. package/dist/tests/core/utilities/mocks/fetch.js.map +0 -1
  371. package/dist/tests/core/utilities/mocks/index.js +0 -43
  372. package/dist/tests/core/utilities/mocks/index.js.map +0 -1
  373. package/dist/tests/core/utilities/mocks/licenses.js +0 -97
  374. package/dist/tests/core/utilities/mocks/licenses.js.map +0 -1
  375. package/dist/tests/core/utilities/mocks/posthog.js +0 -9
  376. package/dist/tests/core/utilities/mocks/posthog.js.map +0 -1
  377. package/dist/tests/core/utilities/structures/Chance.js +0 -21
  378. package/dist/tests/core/utilities/structures/Chance.js.map +0 -1
  379. package/dist/tests/core/utilities/structures/accounts.js +0 -78
  380. package/dist/tests/core/utilities/structures/accounts.js.map +0 -1
  381. package/dist/tests/core/utilities/structures/apps.js +0 -24
  382. package/dist/tests/core/utilities/structures/apps.js.map +0 -1
  383. package/dist/tests/core/utilities/structures/common.js +0 -11
  384. package/dist/tests/core/utilities/structures/common.js.map +0 -1
  385. package/dist/tests/core/utilities/structures/db.js +0 -16
  386. package/dist/tests/core/utilities/structures/db.js.map +0 -1
  387. package/dist/tests/core/utilities/structures/documents/index.js +0 -18
  388. package/dist/tests/core/utilities/structures/documents/index.js.map +0 -1
  389. package/dist/tests/core/utilities/structures/documents/platform/index.js +0 -28
  390. package/dist/tests/core/utilities/structures/documents/platform/index.js.map +0 -1
  391. package/dist/tests/core/utilities/structures/documents/platform/installation.js +0 -38
  392. package/dist/tests/core/utilities/structures/documents/platform/installation.js.map +0 -1
  393. package/dist/tests/core/utilities/structures/generator.js +0 -9
  394. package/dist/tests/core/utilities/structures/generator.js.map +0 -1
  395. package/dist/tests/core/utilities/structures/index.js +0 -46
  396. package/dist/tests/core/utilities/structures/index.js.map +0 -1
  397. package/dist/tests/core/utilities/structures/koa.js +0 -10
  398. package/dist/tests/core/utilities/structures/koa.js.map +0 -1
  399. package/dist/tests/core/utilities/structures/licenses.js +0 -140
  400. package/dist/tests/core/utilities/structures/licenses.js.map +0 -1
  401. package/dist/tests/core/utilities/structures/plugins.js +0 -23
  402. package/dist/tests/core/utilities/structures/plugins.js.map +0 -1
  403. package/dist/tests/core/utilities/structures/quotas.js +0 -71
  404. package/dist/tests/core/utilities/structures/quotas.js.map +0 -1
  405. package/dist/tests/core/utilities/structures/scim.js +0 -63
  406. package/dist/tests/core/utilities/structures/scim.js.map +0 -1
  407. package/dist/tests/core/utilities/structures/shared.js +0 -14
  408. package/dist/tests/core/utilities/structures/shared.js.map +0 -1
  409. package/dist/tests/core/utilities/structures/sso.js +0 -132
  410. package/dist/tests/core/utilities/structures/sso.js.map +0 -1
  411. package/dist/tests/core/utilities/structures/tenants.js +0 -9
  412. package/dist/tests/core/utilities/structures/tenants.js.map +0 -1
  413. package/dist/tests/core/utilities/structures/userGroups.js +0 -13
  414. package/dist/tests/core/utilities/structures/userGroups.js.map +0 -1
  415. package/dist/tests/core/utilities/structures/users.js +0 -48
  416. package/dist/tests/core/utilities/structures/users.js.map +0 -1
  417. package/dist/tests/core/utilities/testContainerUtils.js +0 -84
  418. package/dist/tests/core/utilities/testContainerUtils.js.map +0 -1
  419. package/dist/tests/core/utilities/utils/index.js +0 -28
  420. package/dist/tests/core/utilities/utils/index.js.map +0 -1
  421. package/dist/tests/core/utilities/utils/time.js +0 -8
  422. package/dist/tests/core/utilities/utils/time.js.map +0 -1
  423. package/dist/tests/extra/DBTestConfiguration.js +0 -55
  424. package/dist/tests/extra/DBTestConfiguration.js.map +0 -1
  425. package/dist/tests/extra/index.js +0 -33
  426. package/dist/tests/extra/index.js.map +0 -1
  427. package/dist/tests/extra/testEnv.js +0 -127
  428. package/dist/tests/extra/testEnv.js.map +0 -1
  429. package/dist/tests/index.js +0 -18
  430. package/dist/tests/index.js.map +0 -1
  431. package/dist/tests/jestEnv.js +0 -8
  432. package/dist/tests/jestEnv.js.map +0 -1
  433. package/dist/tests/jestSetup.js +0 -28
  434. package/dist/tests/jestSetup.js.map +0 -1
  435. package/plugins.ts +0 -1
@@ -1,300 +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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.getUniqueTenantId = void 0;
39
- const context = __importStar(require("../context"));
40
- const identityCtx = __importStar(require("../context/identity"));
41
- const environment_1 = __importDefault(require("../environment"));
42
- const types_1 = require("@budibase/types");
43
- const processors_1 = require("./processors");
44
- const utils_1 = require("../utils");
45
- const installation = __importStar(require("../installation"));
46
- const configs = __importStar(require("../configs"));
47
- const users = __importStar(require("../users"));
48
- const generic_1 = require("../cache/generic");
49
- /**
50
- * An identity can be:
51
- * - account user (Self host)
52
- * - budibase user
53
- * - tenant
54
- * - installation
55
- */
56
- const getCurrentIdentity = () => __awaiter(void 0, void 0, void 0, function* () {
57
- let identityContext = identityCtx.getIdentity();
58
- const environment = getDeploymentEnvironment();
59
- let identityType;
60
- if (!identityContext) {
61
- identityType = types_1.IdentityType.TENANT;
62
- }
63
- else {
64
- identityType = identityContext.type;
65
- }
66
- if (identityType === types_1.IdentityType.INSTALLATION) {
67
- const installationId = yield getInstallationId();
68
- const hosting = getHostingFromEnv();
69
- return {
70
- id: formatDistinctId(installationId, identityType),
71
- hosting,
72
- type: identityType,
73
- installationId,
74
- environment,
75
- };
76
- }
77
- else if (identityType === types_1.IdentityType.TENANT) {
78
- const installationId = yield getInstallationId();
79
- const tenantId = yield getEventTenantId(context.getTenantId());
80
- const hosting = getHostingFromEnv();
81
- return {
82
- id: formatDistinctId(tenantId, identityType),
83
- type: identityType,
84
- hosting,
85
- installationId,
86
- tenantId,
87
- realTenantId: context.getTenantId(),
88
- environment,
89
- };
90
- }
91
- else if (identityType === types_1.IdentityType.USER) {
92
- const userContext = identityContext;
93
- const tenantId = yield getEventTenantId(context.getTenantId());
94
- const installationId = yield getInstallationId();
95
- const account = userContext.account;
96
- let hosting;
97
- if (account) {
98
- hosting = account.hosting;
99
- }
100
- else {
101
- hosting = getHostingFromEnv();
102
- }
103
- return {
104
- id: userContext._id,
105
- type: identityType,
106
- hosting,
107
- installationId,
108
- tenantId,
109
- environment,
110
- realTenantId: context.getTenantId(),
111
- hostInfo: userContext.hostInfo,
112
- };
113
- }
114
- else {
115
- throw new Error("Unknown identity type");
116
- }
117
- });
118
- const identifyInstallationGroup = (installId, timestamp) => __awaiter(void 0, void 0, void 0, function* () {
119
- const id = installId;
120
- const type = types_1.IdentityType.INSTALLATION;
121
- const hosting = getHostingFromEnv();
122
- const version = environment_1.default.VERSION;
123
- const environment = getDeploymentEnvironment();
124
- const group = {
125
- id,
126
- type,
127
- hosting,
128
- version,
129
- environment,
130
- };
131
- yield identifyGroup(group, timestamp);
132
- // need to create a normal identity for the group to be able to query it globally
133
- // match the posthog syntax to link this identity to the empty auto generated one
134
- yield identify(Object.assign(Object.assign({}, group), { id: `$${type}_${id}` }), timestamp);
135
- });
136
- const identifyTenantGroup = (tenantId, account, timestamp) => __awaiter(void 0, void 0, void 0, function* () {
137
- const id = yield getEventTenantId(tenantId);
138
- const type = types_1.IdentityType.TENANT;
139
- const installationId = yield getInstallationId();
140
- const environment = getDeploymentEnvironment();
141
- let hosting;
142
- let profession;
143
- let companySize;
144
- if (account) {
145
- profession = account.profession;
146
- companySize = account.size;
147
- hosting = account.hosting;
148
- }
149
- else {
150
- hosting = getHostingFromEnv();
151
- }
152
- const group = {
153
- id,
154
- type,
155
- hosting,
156
- environment,
157
- installationId,
158
- profession,
159
- companySize,
160
- };
161
- yield identifyGroup(group, timestamp);
162
- // need to create a normal identity for the group to be able to query it globally
163
- // match the posthog syntax to link this identity to the auto generated one
164
- yield identify(Object.assign(Object.assign({}, group), { id: `$${type}_${id}` }), timestamp);
165
- });
166
- const identifyUser = (user, account, timestamp) => __awaiter(void 0, void 0, void 0, function* () {
167
- const id = user._id;
168
- const tenantId = yield getEventTenantId(user.tenantId);
169
- const type = types_1.IdentityType.USER;
170
- let builder = users.hasBuilderPermissions(user);
171
- let admin = users.hasAdminPermissions(user);
172
- let providerType;
173
- if ((0, types_1.isSSOUser)(user)) {
174
- providerType = user.providerType;
175
- }
176
- const accountHolder = (account === null || account === void 0 ? void 0 : account.budibaseUserId) === user._id || false;
177
- const verified = account && (account === null || account === void 0 ? void 0 : account.budibaseUserId) === user._id ? account.verified : false;
178
- const installationId = yield getInstallationId();
179
- const hosting = account ? account.hosting : getHostingFromEnv();
180
- const environment = getDeploymentEnvironment();
181
- const identity = {
182
- id,
183
- type,
184
- hosting,
185
- installationId,
186
- tenantId,
187
- verified,
188
- accountHolder,
189
- providerType,
190
- builder,
191
- admin,
192
- environment,
193
- };
194
- yield identify(identity, timestamp);
195
- });
196
- const identifyAccount = (account) => __awaiter(void 0, void 0, void 0, function* () {
197
- let id = account.accountId;
198
- const tenantId = account.tenantId;
199
- let type = types_1.IdentityType.USER;
200
- let providerType = (0, types_1.isSSOAccount)(account) ? account.providerType : undefined;
201
- const verified = account.verified;
202
- const accountHolder = true;
203
- const hosting = account.hosting;
204
- const installationId = yield getInstallationId();
205
- const environment = getDeploymentEnvironment();
206
- if ((0, types_1.isCloudAccount)(account)) {
207
- if (account.budibaseUserId) {
208
- // use the budibase user as the id if set
209
- id = account.budibaseUserId;
210
- }
211
- }
212
- const identity = {
213
- id,
214
- type,
215
- hosting,
216
- installationId,
217
- tenantId,
218
- providerType,
219
- verified,
220
- accountHolder,
221
- environment,
222
- };
223
- yield identify(identity);
224
- });
225
- const identify = (identity, timestamp) => __awaiter(void 0, void 0, void 0, function* () {
226
- yield processors_1.processors.identify(identity, timestamp);
227
- });
228
- const identifyGroup = (group, timestamp) => __awaiter(void 0, void 0, void 0, function* () {
229
- yield processors_1.processors.identifyGroup(group, timestamp);
230
- });
231
- const getDeploymentEnvironment = () => {
232
- if (environment_1.default.isDev()) {
233
- return "development";
234
- }
235
- else {
236
- return environment_1.default.DEPLOYMENT_ENVIRONMENT;
237
- }
238
- };
239
- const getHostingFromEnv = () => {
240
- return environment_1.default.SELF_HOSTED ? types_1.Hosting.SELF : types_1.Hosting.CLOUD;
241
- };
242
- const getInstallationId = () => __awaiter(void 0, void 0, void 0, function* () {
243
- if (isAccountPortal()) {
244
- return "account-portal";
245
- }
246
- const install = yield installation.getInstall();
247
- return install.installId;
248
- });
249
- const getEventTenantId = (tenantId) => __awaiter(void 0, void 0, void 0, function* () {
250
- if (environment_1.default.SELF_HOSTED) {
251
- return (0, exports.getUniqueTenantId)(tenantId);
252
- }
253
- else {
254
- // tenant id's in the cloud are already unique
255
- return tenantId;
256
- }
257
- });
258
- const getUniqueTenantId = (tenantId) => __awaiter(void 0, void 0, void 0, function* () {
259
- // make sure this tenantId always matches the tenantId in context
260
- return context.doInTenant(tenantId, () => {
261
- return (0, generic_1.withCache)(generic_1.CacheKey.UNIQUE_TENANT_ID, generic_1.TTL.ONE_DAY, () => __awaiter(void 0, void 0, void 0, function* () {
262
- const db = context.getGlobalDB();
263
- const config = yield configs.getSettingsConfigDoc();
264
- let uniqueTenantId;
265
- if (config.config.uniqueTenantId) {
266
- return config.config.uniqueTenantId;
267
- }
268
- else {
269
- uniqueTenantId = `${(0, utils_1.newid)()}_${tenantId}`;
270
- config.config.uniqueTenantId = uniqueTenantId;
271
- yield db.put(config);
272
- return uniqueTenantId;
273
- }
274
- }));
275
- });
276
- });
277
- exports.getUniqueTenantId = getUniqueTenantId;
278
- const isAccountPortal = () => {
279
- return environment_1.default.SERVICE === "account-portal";
280
- };
281
- const formatDistinctId = (id, type) => {
282
- if (type === types_1.IdentityType.INSTALLATION || type === types_1.IdentityType.TENANT) {
283
- return `$${type}_${id}`;
284
- }
285
- else {
286
- return id;
287
- }
288
- };
289
- exports.default = {
290
- getCurrentIdentity,
291
- identifyInstallationGroup,
292
- identifyTenantGroup,
293
- identifyUser,
294
- identifyAccount,
295
- identify,
296
- identifyGroup,
297
- getInstallationId,
298
- getUniqueTenantId: exports.getUniqueTenantId,
299
- };
300
- //# sourceMappingURL=identification.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"identification.js","sourceRoot":"","sources":["../../../src/events/identification.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,oDAAqC;AACrC,iEAAkD;AAClD,iEAAgC;AAChC,2CAewB;AACxB,6CAAyC;AACzC,oCAAgC;AAChC,8DAA+C;AAC/C,oDAAqC;AACrC,gDAAiC;AACjC,8CAA2D;AAE3D;;;;;;GAMG;AACH,MAAM,kBAAkB,GAAG,GAA4B,EAAE;IACvD,IAAI,eAAe,GAAG,WAAW,CAAC,WAAW,EAAE,CAAA;IAC/C,MAAM,WAAW,GAAG,wBAAwB,EAAE,CAAA;IAE9C,IAAI,YAAY,CAAA;IAEhB,IAAI,CAAC,eAAe,EAAE;QACpB,YAAY,GAAG,oBAAY,CAAC,MAAM,CAAA;KACnC;SAAM;QACL,YAAY,GAAG,eAAe,CAAC,IAAI,CAAA;KACpC;IAED,IAAI,YAAY,KAAK,oBAAY,CAAC,YAAY,EAAE;QAC9C,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAA;QAChD,MAAM,OAAO,GAAG,iBAAiB,EAAE,CAAA;QACnC,OAAO;YACL,EAAE,EAAE,gBAAgB,CAAC,cAAc,EAAE,YAAY,CAAC;YAClD,OAAO;YACP,IAAI,EAAE,YAAY;YAClB,cAAc;YACd,WAAW;SACZ,CAAA;KACF;SAAM,IAAI,YAAY,KAAK,oBAAY,CAAC,MAAM,EAAE;QAC/C,MAAM,cAAc,GAAG,MAAM,iBAAiB,EAAE,CAAA;QAChD,MAAM,QAAQ,GAAG,MAAM,gBAAgB,CAAC,OAAO,CAAC,WAAW,EAAE,CAAC,CAAA;QAC9D,MAAM,OAAO,GAAG,iBAAiB,EAA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;iBAAM;gBACL,cAAc,GAAG,GAAG,IAAA,aAAK,GAAE,IAAI,QAAQ,EAAE,CAAA;gBACzC,MAAM,CAAC,MAAM,CAAC,cAAc,GAAG,cAAc,CAAA;gBAC7C,MAAM,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAA;gBACpB,OAAO,cAAc,CAAA;aACtB;QACH,CAAC,CAAA,CAAC,CAAA;IACJ,CAAC,CAAC,CAAA;AACJ,CAAC,CAAA,CAAA;AAlBY,QAAA,iBAAiB,qBAkB7B;AAED,MAAM,eAAe,GAAG,GAAG,EAAE;IAC3B,OAAO,qBAAG,CAAC,OAAO,KAAK,gBAAgB,CAAA;AACzC,CAAC,CAAA;AAED,MAAM,gBAAgB,GAAG,CAAC,EAAU,EAAE,IAAkB,EAAE,EAAE;IAC1D,IAAI,IAAI,KAAK,oBAAY,CAAC,YAAY,IAAI,IAAI,KAAK,oBAAY,CAAC,MAAM,EAAE;QACtE,OAAO,IAAI,IAAI,IAAI,EAAE,EAAE,CAAA;KACxB;SAAM;QACL,OAAO,EAAE,CAAA;KACV;AACH,CAAC,CAAA;AAED,kBAAe;IACb,kBAAkB;IAClB,yBAAyB;IACzB,mBAAmB;IACnB,YAAY;IACZ,eAAe;IACf,QAAQ;IACR,aAAa;IACb,iBAAiB;IACjB,iBAAiB,EAAjB,yBAAiB;CAClB,CAAA"}
@@ -1,47 +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 __exportStar = (this && this.__exportStar) || function(m, exports) {
19
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
- };
21
- var __importStar = (this && this.__importStar) || function (mod) {
22
- if (mod && mod.__esModule) return mod;
23
- var result = {};
24
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
25
- __setModuleDefault(result, mod);
26
- return result;
27
- };
28
- var __importDefault = (this && this.__importDefault) || function (mod) {
29
- return (mod && mod.__esModule) ? mod : { "default": mod };
30
- };
31
- Object.defineProperty(exports, "__esModule", { value: true });
32
- exports.shutdown = exports.initAsyncEvents = exports.backfillCache = exports.identification = exports.analytics = exports.processors = void 0;
33
- __exportStar(require("./publishers"), exports);
34
- exports.processors = __importStar(require("./processors"));
35
- exports.analytics = __importStar(require("./analytics"));
36
- var identification_1 = require("./identification");
37
- Object.defineProperty(exports, "identification", { enumerable: true, get: function () { return __importDefault(identification_1).default; } });
38
- exports.backfillCache = __importStar(require("./backfill"));
39
- const processors_1 = require("./processors");
40
- function initAsyncEvents() { }
41
- exports.initAsyncEvents = initAsyncEvents;
42
- const shutdown = () => {
43
- processors_1.processors.shutdown();
44
- console.log("Events shutdown");
45
- };
46
- exports.shutdown = shutdown;
47
- //# sourceMappingURL=index.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/events/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAA4B;AAC5B,2DAA0C;AAC1C,yDAAwC;AACxC,mDAA4D;AAAnD,iIAAA,OAAO,OAAkB;AAClC,4DAA2C;AAE3C,6CAAyC;AAEzC,SAAgB,eAAe,KAAI,CAAC;AAApC,0CAAoC;AAE7B,MAAM,QAAQ,GAAG,GAAG,EAAE;IAC3B,uBAAU,CAAC,QAAQ,EAAE,CAAA;IACrB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;AAChC,CAAC,CAAA;AAHY,QAAA,QAAQ,YAGpB"}
@@ -1,93 +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 __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
26
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
27
- return new (P || (P = Promise))(function (resolve, reject) {
28
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
29
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
30
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
31
- step((generator = generator.apply(thisArg, _arguments || [])).next());
32
- });
33
- };
34
- var __importDefault = (this && this.__importDefault) || function (mod) {
35
- return (mod && mod.__esModule) ? mod : { "default": mod };
36
- };
37
- Object.defineProperty(exports, "__esModule", { value: true });
38
- const types_1 = require("@budibase/types");
39
- const environment_1 = __importDefault(require("../../environment"));
40
- const analytics = __importStar(require("../analytics"));
41
- const posthog_1 = __importDefault(require("./posthog"));
42
- /**
43
- * Events that are always captured.
44
- */
45
- const EVENT_WHITELIST = [
46
- types_1.Event.INSTALLATION_VERSION_UPGRADED,
47
- types_1.Event.INSTALLATION_VERSION_DOWNGRADED,
48
- ];
49
- const IDENTITY_WHITELIST = [types_1.IdentityType.INSTALLATION, types_1.IdentityType.TENANT];
50
- class AnalyticsProcessor {
51
- constructor() {
52
- if (environment_1.default.POSTHOG_TOKEN && !environment_1.default.isTest()) {
53
- this.posthog = new posthog_1.default(environment_1.default.POSTHOG_TOKEN);
54
- }
55
- }
56
- processEvent(event, identity, properties, timestamp) {
57
- return __awaiter(this, void 0, void 0, function* () {
58
- if (!EVENT_WHITELIST.includes(event) && !(yield analytics.enabled())) {
59
- return;
60
- }
61
- if (this.posthog) {
62
- yield this.posthog.processEvent(event, identity, properties, timestamp);
63
- }
64
- });
65
- }
66
- identify(identity, timestamp) {
67
- return __awaiter(this, void 0, void 0, function* () {
68
- // Group indentifications (tenant and installation) always on
69
- if (!IDENTITY_WHITELIST.includes(identity.type) &&
70
- !(yield analytics.enabled())) {
71
- return;
72
- }
73
- if (this.posthog) {
74
- yield this.posthog.identify(identity, timestamp);
75
- }
76
- });
77
- }
78
- identifyGroup(group, timestamp) {
79
- return __awaiter(this, void 0, void 0, function* () {
80
- // Group indentifications (tenant and installation) always on
81
- if (this.posthog) {
82
- yield this.posthog.identifyGroup(group, timestamp);
83
- }
84
- });
85
- }
86
- shutdown() {
87
- if (this.posthog) {
88
- this.posthog.shutdown();
89
- }
90
- }
91
- }
92
- exports.default = AnalyticsProcessor;
93
- //# sourceMappingURL=AnalyticsProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AnalyticsProcessor.js","sourceRoot":"","sources":["../../../../src/events/processors/AnalyticsProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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IAAI,CAAC,OAAO,EAAE;gBAChB,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,CAAC,KAAK,EAAE,SAAS,CAAC,CAAA;aACnD;QACH,CAAC;KAAA;IAED,QAAQ;QACN,IAAI,IAAI,CAAC,OAAO,EAAE;YAChB,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAA;SACxB;IACH,CAAC;CACF;AAhDD,qCAgDC"}
@@ -1,86 +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
- const types_1 = require("@budibase/types");
16
- const context_1 = require("../../context");
17
- const queue_1 = require("../../queue");
18
- const utils_1 = require("../../utils");
19
- const environment_1 = __importDefault(require("../../environment"));
20
- class AuditLogsProcessor {
21
- // can't use constructor as need to return promise
22
- static init(fn) {
23
- AuditLogsProcessor.auditLogsEnabled = true;
24
- const writeAuditLogs = fn;
25
- AuditLogsProcessor.auditLogQueue = (0, queue_1.createQueue)(queue_1.JobQueue.AUDIT_LOG);
26
- return AuditLogsProcessor.auditLogQueue.process((job) => __awaiter(this, void 0, void 0, function* () {
27
- return (0, context_1.doInTenant)(job.data.tenantId, () => __awaiter(this, void 0, void 0, function* () {
28
- let properties = job.data.properties;
29
- if (properties.audited) {
30
- properties = Object.assign(Object.assign({}, properties), properties.audited);
31
- delete properties.audited;
32
- }
33
- // this feature is disabled by default due to privacy requirements
34
- // in some countries - available as env var in-case it is desired
35
- // in self host deployments
36
- let hostInfo = {};
37
- if (environment_1.default.ENABLE_AUDIT_LOG_IP_ADDR) {
38
- hostInfo = job.data.opts.hostInfo;
39
- }
40
- yield writeAuditLogs(job.data.event, properties, {
41
- userId: job.data.opts.userId,
42
- timestamp: job.data.opts.timestamp,
43
- appId: job.data.opts.appId,
44
- hostInfo,
45
- });
46
- }));
47
- }));
48
- }
49
- processEvent(event, identity, properties, timestamp) {
50
- return __awaiter(this, void 0, void 0, function* () {
51
- if (AuditLogsProcessor.auditLogsEnabled && (0, utils_1.isAudited)(event)) {
52
- // only audit log actual events, don't include backfills
53
- const userId = identity.type === types_1.IdentityType.USER ? identity.id : undefined;
54
- // add to the event queue, rather than just writing immediately
55
- yield AuditLogsProcessor.auditLogQueue.add({
56
- event,
57
- properties,
58
- opts: {
59
- userId,
60
- timestamp,
61
- appId: (0, context_1.getAppId)(),
62
- hostInfo: identity.hostInfo,
63
- },
64
- tenantId: (0, context_1.getTenantId)(),
65
- });
66
- }
67
- });
68
- }
69
- identify(identity, timestamp) {
70
- return __awaiter(this, void 0, void 0, function* () {
71
- // no-op
72
- });
73
- }
74
- identifyGroup(group, timestamp) {
75
- return __awaiter(this, void 0, void 0, function* () {
76
- // no-op
77
- });
78
- }
79
- shutdown() {
80
- var _a;
81
- (_a = AuditLogsProcessor.auditLogQueue) === null || _a === void 0 ? void 0 : _a.close();
82
- }
83
- }
84
- exports.default = AuditLogsProcessor;
85
- AuditLogsProcessor.auditLogsEnabled = false;
86
- //# sourceMappingURL=AuditLogsProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"AuditLogsProcessor.js","sourceRoot":"","sources":["../../../../src/events/processors/AuditLogsProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAAA,2CAQwB;AAExB,2CAAiE;AAEjE,uCAAmD;AACnD,uCAAuC;AACvC,oEAAmC;AAEnC,MAAqB,kBAAkB;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,CAAC,gBAAgB,IAAI,IAAA,iBAAS,EAAC,KAAK,CAAC,EAAE;gBAC3D,wDAAwD;gBACxD,MAAM,MAAM,GACV,QAAQ,CAAC,IAAI,KAAK,oBAAY,CAAC,IAAI,CAAC,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;gBAC/D,+DAA+D;gBAC/D,MAAM,kBAAkB,CAAC,aAAa,CAAC,GAAG,CAAC;oBACzC,KAAK;oBACL,UAAU;oBACV,IAAI,EAAE;wBACJ,MAAM;wBACN,SAAS;wBACT,KAAK,EAAE,IAAA,kBAAQ,GAAE;wBACjB,QAAQ,EAAE,QAAQ,CAAC,QAAQ;qBAC5B;oBACD,QAAQ,EAAE,IAAA,qBAAW,GAAE;iBACxB,CAAC,CAAA;aACH;QACH,CAAC;KAAA;IAEK,QAAQ,CAAC,QAAkB,EAAE,SAA2B;;YAC5D,QAAQ;QACV,CAAC;KAAA;IAEK,aAAa,CAAC,KAAY,EAAE,SAA2B;;YAC3D,QAAQ;QACV,CAAC;KAAA;IAED,QAAQ;;QACN,MAAA,kBAAkB,CAAC,aAAa,0CAAE,KAAK,EAAE,CAAA;IAC3C,CAAC;;AA3EH,qCA4EC;AA3EQ,mCAAgB,GAAG,KAAK,CAAA"}
@@ -1,47 +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
- const environment_1 = __importDefault(require("../../environment"));
16
- const skipLogging = environment_1.default.SELF_HOSTED && !environment_1.default.isDev();
17
- class LoggingProcessor {
18
- processEvent(event, identity, properties, timestamp) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- if (skipLogging) {
21
- return;
22
- }
23
- console.log(`[audit] [identityType=${identity.type}] ${event}`, properties);
24
- });
25
- }
26
- identify(identity, timestamp) {
27
- return __awaiter(this, void 0, void 0, function* () {
28
- if (skipLogging) {
29
- return;
30
- }
31
- console.log(`[audit] identified`, identity);
32
- });
33
- }
34
- identifyGroup(group, timestamp) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- if (skipLogging) {
37
- return;
38
- }
39
- console.log(`[audit] group identified`, group);
40
- });
41
- }
42
- shutdown() {
43
- // no-op
44
- }
45
- }
46
- exports.default = LoggingProcessor;
47
- //# sourceMappingURL=LoggingProcessor.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"LoggingProcessor.js","sourceRoot":"","sources":["../../../../src/events/processors/LoggingProcessor.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,oEAAmC;AAEnC,MAAM,WAAW,GAAG,qBAAG,CAAC,WAAW,IAAI,CAAC,qBAAG,CAAC,KAAK,EAAE,CAAA;AAEnD,MAAqB,gBAAgB;IAC7B,YAAY,CAChB,KAAY,EACZ,QAAkB,EAClB,UAAe,EACf,SAAkB;;YAElB,IAAI,WAAW,EAAE;gBACf,OAAM;aACP;YACD,OAAO,CAAC,GAAG,CAAC,yBAAyB,QAAQ,CAAC,IAAI,KAAK,KAAK,EAAE,EAAE,UAAU,CAAC,CAAA;QAC7E,CAAC;KAAA;IAEK,QAAQ,CAAC,QAAkB,EAAE,SAA2B;;YAC5D,IAAI,WAAW,EAAE;gBACf,OAAM;aACP;YACD,OAAO,CAAC,GAAG,CAAC,oBAAoB,EAAE,QAAQ,CAAC,CAAA;QAC7C,CAAC;KAAA;IAEK,aAAa,CAAC,KAAY,EAAE,SAA2B;;YAC3D,IAAI,WAAW,EAAE;gBACf,OAAM;aACP;YACD,OAAO,CAAC,GAAG,CAAC,0BAA0B,EAAE,KAAK,CAAC,CAAA;QAChD,CAAC;KAAA;IAED,QAAQ;QACN,QAAQ;IACV,CAAC;CACF;AA9BD,mCA8BC"}
@@ -1,52 +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
- class Processor {
13
- constructor(processors) {
14
- this.initialised = false;
15
- this.processors = [];
16
- this.processors = processors;
17
- }
18
- processEvent(event, identity, properties, timestamp) {
19
- return __awaiter(this, void 0, void 0, function* () {
20
- for (const eventProcessor of this.processors) {
21
- yield eventProcessor.processEvent(event, identity, properties, timestamp);
22
- }
23
- });
24
- }
25
- identify(identity, timestamp) {
26
- return __awaiter(this, void 0, void 0, function* () {
27
- for (const eventProcessor of this.processors) {
28
- if (eventProcessor.identify) {
29
- yield eventProcessor.identify(identity, timestamp);
30
- }
31
- }
32
- });
33
- }
34
- identifyGroup(identity, timestamp) {
35
- return __awaiter(this, void 0, void 0, function* () {
36
- for (const eventProcessor of this.processors) {
37
- if (eventProcessor.identifyGroup) {
38
- yield eventProcessor.identifyGroup(identity, timestamp);
39
- }
40
- }
41
- });
42
- }
43
- shutdown() {
44
- for (const eventProcessor of this.processors) {
45
- if (eventProcessor.shutdown) {
46
- eventProcessor.shutdown();
47
- }
48
- }
49
- }
50
- }
51
- exports.default = Processor;
52
- //# sourceMappingURL=Processors.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Processors.js","sourceRoot":"","sources":["../../../../src/events/processors/Processors.ts"],"names":[],"mappings":";;;;;;;;;;;AAGA,MAAqB,SAAS;IAI5B,YAAY,UAA4B;QAHxC,gBAAW,GAAY,KAAK,CAAA;QAC5B,eAAU,GAAqB,EAAE,CAAA;QAG/B,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;IAC9B,CAAC;IAEK,YAAY,CAChB,KAAY,EACZ,QAAkB,EAClB,UAAe,EACf,SAA2B;;YAE3B,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,UAAU,EAAE;gBAC5C,MAAM,cAAc,CAAC,YAAY,CAAC,KAAK,EAAE,QAAQ,EAAE,UAAU,EAAE,SAAS,CAAC,CAAA;aAC1E;QACH,CAAC;KAAA;IAEK,QAAQ,CACZ,QAAkB,EAClB,SAA2B;;YAE3B,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,UAAU,EAAE;gBAC5C,IAAI,cAAc,CAAC,QAAQ,EAAE;oBAC3B,MAAM,cAAc,CAAC,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;iBACnD;aACF;QACH,CAAC;KAAA;IAEK,aAAa,CACjB,QAAe,EACf,SAA2B;;YAE3B,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,UAAU,EAAE;gBAC5C,IAAI,cAAc,CAAC,aAAa,EAAE;oBAChC,MAAM,cAAc,CAAC,aAAa,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAA;iBACxD;aACF;QACH,CAAC;KAAA;IAED,QAAQ;QACN,KAAK,MAAM,cAAc,IAAI,IAAI,CAAC,UAAU,EAAE;YAC5C,IAAI,cAAc,CAAC,QAAQ,EAAE;gBAC3B,cAAc,CAAC,QAAQ,EAAE,CAAA;aAC1B;SACF;IACH,CAAC;CACF;AAhDD,4BAgDC"}