config.ts 6.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. import { EventEmitterModuleOptions } from '@nestjs/event-emitter/dist/interfaces';
  2. import { AxiosRequestConfig } from 'axios';
  3. import { BackOffPolicy, RetryOptions } from 'typescript-retry-decorator';
  4. import {
  5. ChannelNames,
  6. Licenses,
  7. ForumCategoryToDiscordChannelMap,
  8. } from './src/types';
  9. export const database = 'joy_dao';
  10. // wg bot
  11. export const channelNames: ChannelNames = {
  12. // Discussion
  13. general: '💬|general',
  14. announcement: '📢|announcements',
  15. techSupport: '💻|tech-support',
  16. atlasFeedback: '🛫|atlas-testing',
  17. offTopic: '🍻|off-topic',
  18. // DAO
  19. // groups https://github.com/Joystream/joystream/blob/c57054eebe5da4f683134dbdaaecf50263ec7336/cli/src/Types.ts#L53-L63
  20. operationsWorkingGroupAlpha: '👷|builders',
  21. validators: '✅|validator',
  22. storageWorkingGroup: '💿|storage-provider',
  23. distributionWorkingGroup: '🔌|distributors',
  24. contentWorkingGroup: '▶|content-curator',
  25. contentCreator: '💻|content-creator',
  26. operationsWorkingGroupGamma: '📈|marketing',
  27. operationsWorkingGroupBeta: '👨|human-resources',
  28. forumWorkingGroup: '📋|forum',
  29. council: '🏛|council',
  30. proposals: '📋|proposals',
  31. bounties: '💻|active-bounties',
  32. app: '💾|apps',
  33. // Work
  34. atlasGeneral: 'atlas-general',
  35. pioneerGeneral: 'pioneer-general',
  36. // BOTS
  37. videos: '🤖|video-bot',
  38. forumBot: '🤖|forum-bot',
  39. };
  40. export const identityValidatedRole = 'on-chain identity verified';
  41. export const councilMemberRole = 'Council Member';
  42. export const foundingMemberRole = 'founding member';
  43. //mapping of group Id coming from Query node to server role name
  44. export const wgToRoleMap: ChannelNames = {
  45. contentWorkingGroup: 'Content Worker',
  46. storageWorkingGroup: 'Storage Worker',
  47. forumWorkingGroup: 'Forum Worker',
  48. distributionWorkingGroup: 'Distribution Worker',
  49. operationsWorkingGroupAlpha: 'Builder Worker',
  50. operationsWorkingGroupGamma: 'Marketing Worker',
  51. operationsWorkingGroupBeta: 'HR Worker',
  52. contentWorkingGroupLead: 'Content Lead',
  53. storageWorkingGroupLead: 'Storage Lead',
  54. forumWorkingGroupLead: 'Forum Lead',
  55. distributionWorkingGroupLead: 'Distribution Lead',
  56. operationsWorkingGroupAlphaLead: 'Builder Lead',
  57. operationsWorkingGroupGammaLead: 'Marketing Lead',
  58. operationsWorkingGroupBetaLead: 'HR Lead',
  59. councilMemberRole,
  60. foundingMemberRole,
  61. };
  62. export const wgEvents = [
  63. 'ApplicationTerminated',
  64. 'ApplicationWithdrawn',
  65. 'AppliedOnOpening',
  66. 'LeaderSet',
  67. 'LeaderUnset',
  68. 'BudgetSet',
  69. 'UpdatedWorkingGroupBudget', //unlike all others, this event comes in a dedicated section 'joystreamUtility'
  70. 'OpeningAdded',
  71. 'OpeningCanceled',
  72. 'RewardPaid',
  73. 'OpeningFilled',
  74. 'StakeDecreased',
  75. 'StakeIncreased',
  76. 'StakeSlashed',
  77. 'TerminatedLeader',
  78. 'TerminatedWorker',
  79. 'WorkerExited',
  80. 'WorkerRewardAmountUpdated',
  81. ];
  82. export const licenses: Licenses = {
  83. '1000': 'Custom',
  84. '1001': 'PDM',
  85. '1002': 'CC0',
  86. '1003': 'CC_BY',
  87. '1004': 'CC_BY_SA',
  88. '1005': 'CC_BY_ND',
  89. '1006': 'CC_BY_NC',
  90. '1007': 'CC_BY_NC_SA',
  91. '1008': 'CC_BY_NC_ND',
  92. };
  93. export const forumCategoriesToChannels: ForumCategoryToDiscordChannelMap[] = [
  94. {
  95. category: {
  96. id: 1,
  97. name: 'Joystream General',
  98. },
  99. channels: [channelNames.forumBot],
  100. },
  101. {
  102. category: {
  103. id: 2,
  104. name: 'Governance',
  105. },
  106. channels: [channelNames.council],
  107. },
  108. {
  109. category: {
  110. id: 3,
  111. name: 'Joystream DApps',
  112. },
  113. channels: [channelNames.app],
  114. },
  115. {
  116. category: {
  117. id: 4,
  118. name: 'Technical Discussion',
  119. },
  120. channels: [channelNames.techSupport],
  121. },
  122. {
  123. category: {
  124. id: 7,
  125. name: 'Council Reports',
  126. },
  127. channels: [channelNames.council],
  128. },
  129. {
  130. category: {
  131. id: 8,
  132. name: 'Pre-proposals',
  133. },
  134. channels: [channelNames.proposals],
  135. },
  136. {
  137. category: {
  138. id: 10,
  139. name: 'Important Announcements',
  140. },
  141. channels: [channelNames.announcement],
  142. },
  143. {
  144. category: {
  145. id: 13,
  146. name: 'Gleev',
  147. },
  148. channels: [channelNames.app],
  149. },
  150. {
  151. category: {
  152. id: 14,
  153. name: 'l1.media',
  154. },
  155. channels: [channelNames.app],
  156. },
  157. {
  158. category: {
  159. id: 15,
  160. name: 'Atlas',
  161. },
  162. channels: [channelNames.atlasGeneral],
  163. },
  164. {
  165. category: {
  166. id: 16,
  167. name: 'Pioneer',
  168. },
  169. channels: [channelNames.pioneerGeneral],
  170. },
  171. {
  172. category: {
  173. id: 33,
  174. name: 'Working Groups (Technical)',
  175. },
  176. channels: [channelNames.council],
  177. },
  178. {
  179. category: {
  180. id: 34,
  181. name: 'Working Groups (Non-Technical)',
  182. },
  183. channels: [channelNames.council],
  184. },
  185. {
  186. category: {
  187. id: 35,
  188. name: 'Media Releases',
  189. },
  190. channels: [channelNames.operationsWorkingGroupGamma],
  191. },
  192. {
  193. category: {
  194. id: 36,
  195. name: 'Community Guide',
  196. },
  197. channels: [channelNames.techSupport],
  198. },
  199. {
  200. category: {
  201. id: 37,
  202. name: 'Off Topic',
  203. },
  204. channels: [channelNames.offTopic],
  205. },
  206. {
  207. category: {
  208. id: 38,
  209. name: 'Storage',
  210. },
  211. channels: [channelNames.storageWorkingGroup],
  212. },
  213. {
  214. category: {
  215. id: 39,
  216. name: 'Distribution',
  217. },
  218. channels: [channelNames.distributionWorkingGroup],
  219. },
  220. {
  221. category: {
  222. id: 40,
  223. name: 'Builders',
  224. },
  225. channels: [channelNames.operationsWorkingGroupAlpha],
  226. },
  227. {
  228. category: {
  229. id: 41,
  230. name: 'Apps WG',
  231. },
  232. channels: [channelNames.app],
  233. },
  234. {
  235. category: {
  236. id: 42,
  237. name: 'HR',
  238. },
  239. channels: [channelNames.operationsWorkingGroupBeta],
  240. },
  241. {
  242. category: {
  243. id: 44,
  244. name: 'Marketing',
  245. },
  246. channels: [channelNames.operationsWorkingGroupGamma],
  247. },
  248. {
  249. category: {
  250. id: 45,
  251. name: 'Forum',
  252. },
  253. channels: [channelNames.forumWorkingGroup],
  254. },
  255. {
  256. category: {
  257. id: 46,
  258. name: 'Content',
  259. },
  260. channels: [channelNames.contentWorkingGroup],
  261. },
  262. {
  263. category: {
  264. id: 47,
  265. name: 'Council Dialogue',
  266. },
  267. channels: [channelNames.council],
  268. },
  269. {
  270. category: {
  271. id: 48,
  272. name: 'Council Candidate Manifesto',
  273. },
  274. channels: [channelNames.council],
  275. },
  276. {
  277. category: {
  278. id: 49,
  279. name: 'Archives',
  280. },
  281. channels: [channelNames.forumWorkingGroup],
  282. },
  283. {
  284. category: {
  285. id: 50,
  286. name: 'Validators',
  287. },
  288. channels: [channelNames.validators],
  289. },
  290. ];
  291. export const globalRetryConfig: RetryOptions = {
  292. maxAttempts: 3,
  293. backOffPolicy: BackOffPolicy.ExponentialBackOffPolicy,
  294. backOff: 1000,
  295. exponentialOption: { maxInterval: 4000, multiplier: 3 },
  296. };
  297. export const globalEventingConfig: EventEmitterModuleOptions = {
  298. global: true,
  299. wildcard: true,
  300. maxListeners: 32,
  301. };
  302. export const axiosConfig: AxiosRequestConfig = {
  303. timeout: 10000, // 10 sec in milliseconds
  304. };
  305. export const joystreamBlue = '#4038FF'; // official joystream blue, see https://www.joystream.org/brand/guides/