@things-factory/auth-base 8.0.38 → 9.0.0-9.0.0-beta.59.0

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 (489) hide show
  1. package/config/config.development.js +46 -0
  2. package/config/config.production.js +45 -0
  3. package/dist-client/bootstrap.d.ts +1 -1
  4. package/dist-client/bootstrap.js +4 -4
  5. package/dist-client/bootstrap.js.map +1 -1
  6. package/dist-client/directive/privileged.d.ts +1 -1
  7. package/dist-client/directive/privileged.js +1 -1
  8. package/dist-client/directive/privileged.js.map +1 -1
  9. package/dist-client/index.d.ts +4 -3
  10. package/dist-client/index.js +4 -3
  11. package/dist-client/index.js.map +1 -1
  12. package/dist-client/profiled.js +1 -1
  13. package/dist-client/profiled.js.map +1 -1
  14. package/dist-client/reducers/auth.js +1 -1
  15. package/dist-client/reducers/auth.js.map +1 -1
  16. package/dist-client/tsconfig.tsbuildinfo +1 -1
  17. package/dist-client/verify-webauthn.d.ts +13 -0
  18. package/dist-client/verify-webauthn.js +72 -0
  19. package/dist-client/verify-webauthn.js.map +1 -0
  20. package/dist-server/controllers/auth.d.ts +5 -5
  21. package/dist-server/controllers/auth.js +5 -5
  22. package/dist-server/controllers/auth.js.map +1 -1
  23. package/dist-server/controllers/change-pwd.js +19 -19
  24. package/dist-server/controllers/change-pwd.js.map +1 -1
  25. package/dist-server/controllers/checkin.js +4 -4
  26. package/dist-server/controllers/checkin.js.map +1 -1
  27. package/dist-server/controllers/delete-user.js +10 -15
  28. package/dist-server/controllers/delete-user.js.map +1 -1
  29. package/dist-server/controllers/invitation.js +20 -25
  30. package/dist-server/controllers/invitation.js.map +1 -1
  31. package/dist-server/controllers/profile.d.ts +5 -5
  32. package/dist-server/controllers/profile.js +10 -10
  33. package/dist-server/controllers/profile.js.map +1 -1
  34. package/dist-server/controllers/reset-password.js +24 -24
  35. package/dist-server/controllers/reset-password.js.map +1 -1
  36. package/dist-server/controllers/signin.d.ts +1 -1
  37. package/dist-server/controllers/signin.js +25 -30
  38. package/dist-server/controllers/signin.js.map +1 -1
  39. package/dist-server/controllers/signup.d.ts +1 -1
  40. package/dist-server/controllers/signup.js +14 -19
  41. package/dist-server/controllers/signup.js.map +1 -1
  42. package/dist-server/controllers/unlock-user.js +17 -17
  43. package/dist-server/controllers/unlock-user.js.map +1 -1
  44. package/dist-server/controllers/utils/password-rule.js +4 -4
  45. package/dist-server/controllers/utils/password-rule.js.map +1 -1
  46. package/dist-server/controllers/utils/save-invitation-token.d.ts +1 -1
  47. package/dist-server/controllers/utils/save-invitation-token.js +2 -2
  48. package/dist-server/controllers/utils/save-invitation-token.js.map +1 -1
  49. package/dist-server/controllers/utils/save-verification-token.d.ts +1 -1
  50. package/dist-server/controllers/utils/save-verification-token.js +3 -3
  51. package/dist-server/controllers/utils/save-verification-token.js.map +1 -1
  52. package/dist-server/controllers/verification.js +23 -23
  53. package/dist-server/controllers/verification.js.map +1 -1
  54. package/dist-server/errors/auth-error.js +1 -1
  55. package/dist-server/errors/auth-error.js.map +1 -1
  56. package/dist-server/errors/index.d.ts +2 -2
  57. package/dist-server/errors/index.js +2 -2
  58. package/dist-server/errors/index.js.map +1 -1
  59. package/dist-server/errors/user-domain-not-match-error.d.ts +1 -1
  60. package/dist-server/errors/user-domain-not-match-error.js +8 -8
  61. package/dist-server/errors/user-domain-not-match-error.js.map +1 -1
  62. package/dist-server/index.d.ts +16 -16
  63. package/dist-server/index.js +18 -18
  64. package/dist-server/index.js.map +1 -1
  65. package/dist-server/middlewares/authenticate-401-middleware.js +11 -11
  66. package/dist-server/middlewares/authenticate-401-middleware.js.map +1 -1
  67. package/dist-server/middlewares/bypass-signin-middleware.d.ts +1 -0
  68. package/dist-server/middlewares/bypass-signin-middleware.js +20 -0
  69. package/dist-server/middlewares/bypass-signin-middleware.js.map +1 -0
  70. package/dist-server/middlewares/domain-authenticate-middleware.d.ts +1 -1
  71. package/dist-server/middlewares/domain-authenticate-middleware.js +9 -9
  72. package/dist-server/middlewares/domain-authenticate-middleware.js.map +1 -1
  73. package/dist-server/middlewares/graphql-authenticate-middleware.js +4 -4
  74. package/dist-server/middlewares/graphql-authenticate-middleware.js.map +1 -1
  75. package/dist-server/middlewares/index.d.ts +5 -5
  76. package/dist-server/middlewares/index.js +24 -19
  77. package/dist-server/middlewares/index.js.map +1 -1
  78. package/dist-server/middlewares/jwt-authenticate-middleware.js +15 -15
  79. package/dist-server/middlewares/jwt-authenticate-middleware.js.map +1 -1
  80. package/dist-server/middlewares/signin-middleware.js +2 -2
  81. package/dist-server/middlewares/signin-middleware.js.map +1 -1
  82. package/dist-server/middlewares/verify-recaptcha-middleware.d.ts +3 -0
  83. package/dist-server/middlewares/verify-recaptcha-middleware.js +95 -0
  84. package/dist-server/middlewares/verify-recaptcha-middleware.js.map +1 -0
  85. package/dist-server/middlewares/webauthn-middleware.js +7 -7
  86. package/dist-server/middlewares/webauthn-middleware.js.map +1 -1
  87. package/dist-server/migrations/1548206416130-SeedUser.js +6 -6
  88. package/dist-server/migrations/1548206416130-SeedUser.js.map +1 -1
  89. package/dist-server/migrations/1566805283882-SeedPrivilege.js +2 -2
  90. package/dist-server/migrations/1566805283882-SeedPrivilege.js.map +1 -1
  91. package/dist-server/migrations/index.js.map +1 -1
  92. package/dist-server/router/auth-checkin-router.js +17 -20
  93. package/dist-server/router/auth-checkin-router.js.map +1 -1
  94. package/dist-server/router/auth-private-process-router.js +16 -23
  95. package/dist-server/router/auth-private-process-router.js.map +1 -1
  96. package/dist-server/router/auth-public-process-router.js +30 -35
  97. package/dist-server/router/auth-public-process-router.js.map +1 -1
  98. package/dist-server/router/auth-signin-router.js +7 -13
  99. package/dist-server/router/auth-signin-router.js.map +1 -1
  100. package/dist-server/router/auth-signup-router.js +13 -9
  101. package/dist-server/router/auth-signup-router.js.map +1 -1
  102. package/dist-server/router/index.d.ts +9 -9
  103. package/dist-server/router/index.js +9 -9
  104. package/dist-server/router/index.js.map +1 -1
  105. package/dist-server/router/oauth2/index.d.ts +2 -2
  106. package/dist-server/router/oauth2/index.js +2 -2
  107. package/dist-server/router/oauth2/index.js.map +1 -1
  108. package/dist-server/router/oauth2/oauth2-authorize-router.js +6 -6
  109. package/dist-server/router/oauth2/oauth2-authorize-router.js.map +1 -1
  110. package/dist-server/router/oauth2/oauth2-router.d.ts +1 -1
  111. package/dist-server/router/oauth2/oauth2-router.js +21 -21
  112. package/dist-server/router/oauth2/oauth2-router.js.map +1 -1
  113. package/dist-server/router/oauth2/oauth2-server.js +21 -21
  114. package/dist-server/router/oauth2/oauth2-server.js.map +1 -1
  115. package/dist-server/router/site-root-router.js +4 -4
  116. package/dist-server/router/site-root-router.js.map +1 -1
  117. package/dist-server/router/webauthn-router.js +58 -8
  118. package/dist-server/router/webauthn-router.js.map +1 -1
  119. package/dist-server/routes.js +75 -50
  120. package/dist-server/routes.js.map +1 -1
  121. package/dist-server/service/app-binding/app-binding-mutation.js +4 -4
  122. package/dist-server/service/app-binding/app-binding-mutation.js.map +1 -1
  123. package/dist-server/service/app-binding/app-binding-query.d.ts +4 -4
  124. package/dist-server/service/app-binding/app-binding-query.js +22 -22
  125. package/dist-server/service/app-binding/app-binding-query.js.map +1 -1
  126. package/dist-server/service/app-binding/app-binding-types.d.ts +1 -1
  127. package/dist-server/service/app-binding/app-binding-types.js +2 -2
  128. package/dist-server/service/app-binding/app-binding-types.js.map +1 -1
  129. package/dist-server/service/app-binding/app-binding.d.ts +2 -2
  130. package/dist-server/service/app-binding/app-binding.js +4 -4
  131. package/dist-server/service/app-binding/app-binding.js.map +1 -1
  132. package/dist-server/service/app-binding/index.d.ts +2 -2
  133. package/dist-server/service/app-binding/index.js +3 -3
  134. package/dist-server/service/app-binding/index.js.map +1 -1
  135. package/dist-server/service/appliance/appliance-mutation.d.ts +2 -2
  136. package/dist-server/service/appliance/appliance-mutation.js +32 -45
  137. package/dist-server/service/appliance/appliance-mutation.js.map +1 -1
  138. package/dist-server/service/appliance/appliance-query.d.ts +3 -3
  139. package/dist-server/service/appliance/appliance-query.js +17 -17
  140. package/dist-server/service/appliance/appliance-query.js.map +1 -1
  141. package/dist-server/service/appliance/appliance-types.d.ts +1 -1
  142. package/dist-server/service/appliance/appliance-types.js +2 -2
  143. package/dist-server/service/appliance/appliance-types.js.map +1 -1
  144. package/dist-server/service/appliance/appliance.d.ts +3 -1
  145. package/dist-server/service/appliance/appliance.js +51 -8
  146. package/dist-server/service/appliance/appliance.js.map +1 -1
  147. package/dist-server/service/appliance/index.d.ts +3 -3
  148. package/dist-server/service/appliance/index.js +5 -5
  149. package/dist-server/service/appliance/index.js.map +1 -1
  150. package/dist-server/service/application/application-mutation.d.ts +8 -8
  151. package/dist-server/service/application/application-mutation.js +20 -20
  152. package/dist-server/service/application/application-mutation.js.map +1 -1
  153. package/dist-server/service/application/application-query.d.ts +2 -2
  154. package/dist-server/service/application/application-query.js +16 -16
  155. package/dist-server/service/application/application-query.js.map +1 -1
  156. package/dist-server/service/application/application-types.d.ts +1 -1
  157. package/dist-server/service/application/application-types.js +4 -4
  158. package/dist-server/service/application/application-types.js.map +1 -1
  159. package/dist-server/service/application/application.d.ts +1 -1
  160. package/dist-server/service/application/application.js +12 -12
  161. package/dist-server/service/application/application.js.map +1 -1
  162. package/dist-server/service/application/index.d.ts +3 -3
  163. package/dist-server/service/application/index.js +5 -5
  164. package/dist-server/service/application/index.js.map +1 -1
  165. package/dist-server/service/auth-provider/auth-provider-mutation.d.ts +2 -2
  166. package/dist-server/service/auth-provider/auth-provider-mutation.js +20 -20
  167. package/dist-server/service/auth-provider/auth-provider-mutation.js.map +1 -1
  168. package/dist-server/service/auth-provider/auth-provider-query.d.ts +3 -3
  169. package/dist-server/service/auth-provider/auth-provider-query.js +20 -20
  170. package/dist-server/service/auth-provider/auth-provider-query.js.map +1 -1
  171. package/dist-server/service/auth-provider/auth-provider-type.d.ts +1 -1
  172. package/dist-server/service/auth-provider/auth-provider-type.js +2 -2
  173. package/dist-server/service/auth-provider/auth-provider-type.js.map +1 -1
  174. package/dist-server/service/auth-provider/auth-provider.d.ts +3 -3
  175. package/dist-server/service/auth-provider/auth-provider.js +12 -12
  176. package/dist-server/service/auth-provider/auth-provider.js.map +1 -1
  177. package/dist-server/service/auth-provider/index.d.ts +3 -3
  178. package/dist-server/service/auth-provider/index.js +5 -5
  179. package/dist-server/service/auth-provider/index.js.map +1 -1
  180. package/dist-server/service/domain-generator/domain-generator-mutation.d.ts +1 -1
  181. package/dist-server/service/domain-generator/domain-generator-mutation.js +11 -11
  182. package/dist-server/service/domain-generator/domain-generator-mutation.js.map +1 -1
  183. package/dist-server/service/domain-generator/domain-generator-types.d.ts +1 -1
  184. package/dist-server/service/domain-generator/domain-generator-types.js +3 -3
  185. package/dist-server/service/domain-generator/domain-generator-types.js.map +1 -1
  186. package/dist-server/service/domain-generator/index.d.ts +1 -1
  187. package/dist-server/service/domain-generator/index.js +2 -2
  188. package/dist-server/service/domain-generator/index.js.map +1 -1
  189. package/dist-server/service/domain-link/domain-link-mutation.d.ts +9 -0
  190. package/dist-server/service/domain-link/domain-link-mutation.js +116 -0
  191. package/dist-server/service/domain-link/domain-link-mutation.js.map +1 -0
  192. package/dist-server/service/domain-link/domain-link-query.d.ts +11 -0
  193. package/dist-server/service/domain-link/domain-link-query.js +75 -0
  194. package/dist-server/service/domain-link/domain-link-query.js.map +1 -0
  195. package/dist-server/service/domain-link/domain-link-types.d.ts +18 -0
  196. package/dist-server/service/domain-link/domain-link-types.js +66 -0
  197. package/dist-server/service/domain-link/domain-link-types.js.map +1 -0
  198. package/dist-server/service/domain-link/domain-link.d.ts +28 -0
  199. package/dist-server/service/domain-link/domain-link.js +105 -0
  200. package/dist-server/service/domain-link/domain-link.js.map +1 -0
  201. package/dist-server/service/domain-link/index.d.ts +6 -0
  202. package/dist-server/service/domain-link/index.js +10 -0
  203. package/dist-server/service/domain-link/index.js.map +1 -0
  204. package/dist-server/service/granted-role/granted-role-mutation.d.ts +3 -3
  205. package/dist-server/service/granted-role/granted-role-mutation.js +17 -17
  206. package/dist-server/service/granted-role/granted-role-mutation.js.map +1 -1
  207. package/dist-server/service/granted-role/granted-role-query.d.ts +2 -2
  208. package/dist-server/service/granted-role/granted-role-query.js +13 -13
  209. package/dist-server/service/granted-role/granted-role-query.js.map +1 -1
  210. package/dist-server/service/granted-role/granted-role.d.ts +1 -1
  211. package/dist-server/service/granted-role/granted-role.js +3 -3
  212. package/dist-server/service/granted-role/granted-role.js.map +1 -1
  213. package/dist-server/service/granted-role/index.d.ts +3 -3
  214. package/dist-server/service/granted-role/index.js +5 -5
  215. package/dist-server/service/granted-role/index.js.map +1 -1
  216. package/dist-server/service/index.d.ts +27 -25
  217. package/dist-server/service/index.js +75 -70
  218. package/dist-server/service/index.js.map +1 -1
  219. package/dist-server/service/invitation/index.d.ts +3 -3
  220. package/dist-server/service/invitation/index.js +5 -5
  221. package/dist-server/service/invitation/index.js.map +1 -1
  222. package/dist-server/service/invitation/invitation-mutation.d.ts +2 -2
  223. package/dist-server/service/invitation/invitation-mutation.js +10 -10
  224. package/dist-server/service/invitation/invitation-mutation.js.map +1 -1
  225. package/dist-server/service/invitation/invitation-query.d.ts +1 -1
  226. package/dist-server/service/invitation/invitation-query.js +7 -7
  227. package/dist-server/service/invitation/invitation-query.js.map +1 -1
  228. package/dist-server/service/invitation/invitation-types.d.ts +1 -1
  229. package/dist-server/service/invitation/invitation-types.js +2 -2
  230. package/dist-server/service/invitation/invitation-types.js.map +1 -1
  231. package/dist-server/service/invitation/invitation.d.ts +1 -1
  232. package/dist-server/service/invitation/invitation.js +5 -5
  233. package/dist-server/service/invitation/invitation.js.map +1 -1
  234. package/dist-server/service/login-history/index.d.ts +2 -2
  235. package/dist-server/service/login-history/index.js +4 -4
  236. package/dist-server/service/login-history/index.js.map +1 -1
  237. package/dist-server/service/login-history/login-history-query.d.ts +3 -3
  238. package/dist-server/service/login-history/login-history-query.js +11 -11
  239. package/dist-server/service/login-history/login-history-query.js.map +1 -1
  240. package/dist-server/service/login-history/login-history-type.d.ts +1 -1
  241. package/dist-server/service/login-history/login-history-type.js +2 -2
  242. package/dist-server/service/login-history/login-history-type.js.map +1 -1
  243. package/dist-server/service/login-history/login-history.d.ts +1 -1
  244. package/dist-server/service/login-history/login-history.js +4 -4
  245. package/dist-server/service/login-history/login-history.js.map +1 -1
  246. package/dist-server/service/partner/index.d.ts +3 -3
  247. package/dist-server/service/partner/index.js +5 -5
  248. package/dist-server/service/partner/index.js.map +1 -1
  249. package/dist-server/service/partner/partner-mutation.js +8 -8
  250. package/dist-server/service/partner/partner-mutation.js.map +1 -1
  251. package/dist-server/service/partner/partner-query.d.ts +3 -3
  252. package/dist-server/service/partner/partner-query.js +17 -17
  253. package/dist-server/service/partner/partner-query.js.map +1 -1
  254. package/dist-server/service/partner/partner-types.d.ts +1 -1
  255. package/dist-server/service/partner/partner-types.js +2 -2
  256. package/dist-server/service/partner/partner-types.js.map +1 -1
  257. package/dist-server/service/partner/partner.d.ts +1 -1
  258. package/dist-server/service/partner/partner.js +5 -5
  259. package/dist-server/service/partner/partner.js.map +1 -1
  260. package/dist-server/service/password-history/index.d.ts +1 -1
  261. package/dist-server/service/password-history/index.js +2 -2
  262. package/dist-server/service/password-history/index.js.map +1 -1
  263. package/dist-server/service/privilege/index.d.ts +3 -3
  264. package/dist-server/service/privilege/index.js +5 -5
  265. package/dist-server/service/privilege/index.js.map +1 -1
  266. package/dist-server/service/privilege/privilege-directive.js +2 -2
  267. package/dist-server/service/privilege/privilege-directive.js.map +1 -1
  268. package/dist-server/service/privilege/privilege-mutation.d.ts +2 -2
  269. package/dist-server/service/privilege/privilege-mutation.js +15 -15
  270. package/dist-server/service/privilege/privilege-mutation.js.map +1 -1
  271. package/dist-server/service/privilege/privilege-query.d.ts +4 -4
  272. package/dist-server/service/privilege/privilege-query.js +20 -20
  273. package/dist-server/service/privilege/privilege-query.js.map +1 -1
  274. package/dist-server/service/privilege/privilege-types.d.ts +1 -1
  275. package/dist-server/service/privilege/privilege-types.js +2 -2
  276. package/dist-server/service/privilege/privilege-types.js.map +1 -1
  277. package/dist-server/service/privilege/privilege.d.ts +2 -2
  278. package/dist-server/service/privilege/privilege.js +10 -10
  279. package/dist-server/service/privilege/privilege.js.map +1 -1
  280. package/dist-server/service/role/index.d.ts +3 -3
  281. package/dist-server/service/role/index.js +5 -5
  282. package/dist-server/service/role/index.js.map +1 -1
  283. package/dist-server/service/role/role-mutation.d.ts +2 -2
  284. package/dist-server/service/role/role-mutation.js +19 -19
  285. package/dist-server/service/role/role-mutation.js.map +1 -1
  286. package/dist-server/service/role/role-query.d.ts +9 -5
  287. package/dist-server/service/role/role-query.js +38 -31
  288. package/dist-server/service/role/role-query.js.map +1 -1
  289. package/dist-server/service/role/role-types.d.ts +1 -1
  290. package/dist-server/service/role/role-types.js +2 -2
  291. package/dist-server/service/role/role-types.js.map +1 -1
  292. package/dist-server/service/role/role.d.ts +2 -2
  293. package/dist-server/service/role/role.js +12 -12
  294. package/dist-server/service/role/role.js.map +1 -1
  295. package/dist-server/service/user/domain-query.d.ts +1 -1
  296. package/dist-server/service/user/domain-query.js +3 -3
  297. package/dist-server/service/user/domain-query.js.map +1 -1
  298. package/dist-server/service/user/index.d.ts +4 -4
  299. package/dist-server/service/user/index.js +6 -6
  300. package/dist-server/service/user/index.js.map +1 -1
  301. package/dist-server/service/user/user-mutation.d.ts +3 -3
  302. package/dist-server/service/user/user-mutation.js +49 -84
  303. package/dist-server/service/user/user-mutation.js.map +1 -1
  304. package/dist-server/service/user/user-query.d.ts +4 -3
  305. package/dist-server/service/user/user-query.js +31 -21
  306. package/dist-server/service/user/user-query.js.map +1 -1
  307. package/dist-server/service/user/user-types.d.ts +1 -1
  308. package/dist-server/service/user/user-types.js +2 -2
  309. package/dist-server/service/user/user-types.js.map +1 -1
  310. package/dist-server/service/user/user.d.ts +3 -3
  311. package/dist-server/service/user/user.js +41 -46
  312. package/dist-server/service/user/user.js.map +1 -1
  313. package/dist-server/service/users-auth-providers/index.d.ts +1 -1
  314. package/dist-server/service/users-auth-providers/index.js +2 -2
  315. package/dist-server/service/users-auth-providers/index.js.map +1 -1
  316. package/dist-server/service/users-auth-providers/users-auth-providers.d.ts +2 -2
  317. package/dist-server/service/users-auth-providers/users-auth-providers.js +8 -8
  318. package/dist-server/service/users-auth-providers/users-auth-providers.js.map +1 -1
  319. package/dist-server/service/verification-token/index.d.ts +1 -1
  320. package/dist-server/service/verification-token/index.js +2 -2
  321. package/dist-server/service/verification-token/index.js.map +1 -1
  322. package/dist-server/service/web-auth-credential/index.d.ts +1 -1
  323. package/dist-server/service/web-auth-credential/index.js +2 -2
  324. package/dist-server/service/web-auth-credential/index.js.map +1 -1
  325. package/dist-server/service/web-auth-credential/web-auth-credential.d.ts +1 -1
  326. package/dist-server/service/web-auth-credential/web-auth-credential.js +10 -10
  327. package/dist-server/service/web-auth-credential/web-auth-credential.js.map +1 -1
  328. package/dist-server/tsconfig.tsbuildinfo +1 -1
  329. package/dist-server/types.d.ts +1 -1
  330. package/dist-server/types.js.map +1 -1
  331. package/dist-server/utils/access-token-cookie.js +2 -2
  332. package/dist-server/utils/access-token-cookie.js.map +1 -1
  333. package/dist-server/utils/check-permission.d.ts +2 -2
  334. package/dist-server/utils/check-permission.js +3 -3
  335. package/dist-server/utils/check-permission.js.map +1 -1
  336. package/dist-server/utils/check-user-belongs-domain.d.ts +1 -1
  337. package/dist-server/utils/check-user-belongs-domain.js +2 -2
  338. package/dist-server/utils/check-user-belongs-domain.js.map +1 -1
  339. package/dist-server/utils/get-domain-users.d.ts +1 -1
  340. package/dist-server/utils/get-domain-users.js +2 -2
  341. package/dist-server/utils/get-domain-users.js.map +1 -1
  342. package/dist-server/utils/get-user-domains.d.ts +2 -2
  343. package/dist-server/utils/get-user-domains.js +7 -5
  344. package/dist-server/utils/get-user-domains.js.map +1 -1
  345. package/helps/config/recaptcha.ja.md +49 -0
  346. package/helps/config/recaptcha.ko.md +49 -0
  347. package/helps/config/recaptcha.md +49 -0
  348. package/helps/config/recaptcha.ms.md +49 -0
  349. package/helps/config/recaptcha.zh.md +49 -0
  350. package/package.json +7 -6
  351. package/client/actions/auth.ts +0 -24
  352. package/client/auth.ts +0 -268
  353. package/client/bootstrap.ts +0 -47
  354. package/client/directive/privileged.ts +0 -28
  355. package/client/index.ts +0 -3
  356. package/client/profiled.ts +0 -83
  357. package/client/reducers/auth.ts +0 -31
  358. package/server/constants/error-code.ts +0 -22
  359. package/server/constants/error-message.ts +0 -0
  360. package/server/constants/max-age.ts +0 -1
  361. package/server/controllers/auth.ts +0 -5
  362. package/server/controllers/change-pwd.ts +0 -100
  363. package/server/controllers/checkin.ts +0 -21
  364. package/server/controllers/delete-user.ts +0 -76
  365. package/server/controllers/invitation.ts +0 -168
  366. package/server/controllers/profile.ts +0 -55
  367. package/server/controllers/reset-password.ts +0 -126
  368. package/server/controllers/signin.ts +0 -103
  369. package/server/controllers/signup.ts +0 -77
  370. package/server/controllers/unlock-user.ts +0 -62
  371. package/server/controllers/utils/make-invitation-token.ts +0 -5
  372. package/server/controllers/utils/make-verification-token.ts +0 -4
  373. package/server/controllers/utils/password-rule.ts +0 -120
  374. package/server/controllers/utils/save-invitation-token.ts +0 -10
  375. package/server/controllers/utils/save-verification-token.ts +0 -12
  376. package/server/controllers/verification.ts +0 -84
  377. package/server/errors/auth-error.ts +0 -24
  378. package/server/errors/index.ts +0 -2
  379. package/server/errors/user-domain-not-match-error.ts +0 -29
  380. package/server/index.ts +0 -37
  381. package/server/middlewares/authenticate-401-middleware.ts +0 -114
  382. package/server/middlewares/domain-authenticate-middleware.ts +0 -73
  383. package/server/middlewares/graphql-authenticate-middleware.ts +0 -13
  384. package/server/middlewares/index.ts +0 -67
  385. package/server/middlewares/jwt-authenticate-middleware.ts +0 -84
  386. package/server/middlewares/signin-middleware.ts +0 -56
  387. package/server/middlewares/webauthn-middleware.ts +0 -131
  388. package/server/migrations/1548206416130-SeedUser.ts +0 -60
  389. package/server/migrations/1566805283882-SeedPrivilege.ts +0 -28
  390. package/server/migrations/index.ts +0 -9
  391. package/server/router/auth-checkin-router.ts +0 -115
  392. package/server/router/auth-private-process-router.ts +0 -127
  393. package/server/router/auth-public-process-router.ts +0 -319
  394. package/server/router/auth-signin-router.ts +0 -76
  395. package/server/router/auth-signup-router.ts +0 -95
  396. package/server/router/index.ts +0 -9
  397. package/server/router/oauth2/index.ts +0 -2
  398. package/server/router/oauth2/oauth2-authorize-router.ts +0 -81
  399. package/server/router/oauth2/oauth2-router.ts +0 -165
  400. package/server/router/oauth2/oauth2-server.ts +0 -262
  401. package/server/router/oauth2/passport-oauth2-client-password.ts +0 -87
  402. package/server/router/oauth2/passport-refresh-token.ts +0 -87
  403. package/server/router/path-base-domain-router.ts +0 -8
  404. package/server/router/site-root-router.ts +0 -48
  405. package/server/router/webauthn-router.ts +0 -85
  406. package/server/routes.ts +0 -89
  407. package/server/service/app-binding/app-binding-mutation.ts +0 -22
  408. package/server/service/app-binding/app-binding-query.ts +0 -92
  409. package/server/service/app-binding/app-binding-types.ts +0 -11
  410. package/server/service/app-binding/app-binding.ts +0 -17
  411. package/server/service/app-binding/index.ts +0 -4
  412. package/server/service/appliance/appliance-mutation.ts +0 -113
  413. package/server/service/appliance/appliance-query.ts +0 -76
  414. package/server/service/appliance/appliance-types.ts +0 -56
  415. package/server/service/appliance/appliance.ts +0 -133
  416. package/server/service/appliance/index.ts +0 -6
  417. package/server/service/application/application-mutation.ts +0 -104
  418. package/server/service/application/application-query.ts +0 -98
  419. package/server/service/application/application-types.ts +0 -76
  420. package/server/service/application/application.ts +0 -216
  421. package/server/service/application/index.ts +0 -6
  422. package/server/service/auth-provider/auth-provider-mutation.ts +0 -159
  423. package/server/service/auth-provider/auth-provider-parameter-spec.ts +0 -24
  424. package/server/service/auth-provider/auth-provider-query.ts +0 -88
  425. package/server/service/auth-provider/auth-provider-type.ts +0 -67
  426. package/server/service/auth-provider/auth-provider.ts +0 -155
  427. package/server/service/auth-provider/index.ts +0 -7
  428. package/server/service/domain-generator/domain-generator-mutation.ts +0 -117
  429. package/server/service/domain-generator/domain-generator-types.ts +0 -46
  430. package/server/service/domain-generator/index.ts +0 -3
  431. package/server/service/granted-role/granted-role-mutation.ts +0 -156
  432. package/server/service/granted-role/granted-role-query.ts +0 -60
  433. package/server/service/granted-role/granted-role.ts +0 -27
  434. package/server/service/granted-role/index.ts +0 -6
  435. package/server/service/index.ts +0 -90
  436. package/server/service/invitation/index.ts +0 -6
  437. package/server/service/invitation/invitation-mutation.ts +0 -78
  438. package/server/service/invitation/invitation-query.ts +0 -33
  439. package/server/service/invitation/invitation-types.ts +0 -11
  440. package/server/service/invitation/invitation.ts +0 -63
  441. package/server/service/login-history/index.ts +0 -5
  442. package/server/service/login-history/login-history-query.ts +0 -51
  443. package/server/service/login-history/login-history-type.ts +0 -12
  444. package/server/service/login-history/login-history.ts +0 -45
  445. package/server/service/partner/index.ts +0 -6
  446. package/server/service/partner/partner-mutation.ts +0 -61
  447. package/server/service/partner/partner-query.ts +0 -102
  448. package/server/service/partner/partner-types.ts +0 -11
  449. package/server/service/partner/partner.ts +0 -57
  450. package/server/service/password-history/index.ts +0 -3
  451. package/server/service/password-history/password-history.ts +0 -16
  452. package/server/service/privilege/index.ts +0 -6
  453. package/server/service/privilege/privilege-directive.ts +0 -77
  454. package/server/service/privilege/privilege-mutation.ts +0 -92
  455. package/server/service/privilege/privilege-query.ts +0 -94
  456. package/server/service/privilege/privilege-types.ts +0 -60
  457. package/server/service/privilege/privilege.ts +0 -102
  458. package/server/service/role/index.ts +0 -6
  459. package/server/service/role/role-mutation.ts +0 -109
  460. package/server/service/role/role-query.ts +0 -155
  461. package/server/service/role/role-types.ts +0 -81
  462. package/server/service/role/role.ts +0 -72
  463. package/server/service/user/domain-query.ts +0 -24
  464. package/server/service/user/index.ts +0 -7
  465. package/server/service/user/user-mutation.ts +0 -517
  466. package/server/service/user/user-query.ts +0 -145
  467. package/server/service/user/user-types.ts +0 -100
  468. package/server/service/user/user.ts +0 -386
  469. package/server/service/users-auth-providers/index.ts +0 -5
  470. package/server/service/users-auth-providers/users-auth-providers.ts +0 -71
  471. package/server/service/verification-token/index.ts +0 -3
  472. package/server/service/verification-token/verification-token.ts +0 -60
  473. package/server/service/web-auth-credential/index.ts +0 -3
  474. package/server/service/web-auth-credential/web-auth-credential.ts +0 -66
  475. package/server/templates/account-unlock-email.ts +0 -65
  476. package/server/templates/invitation-email.ts +0 -66
  477. package/server/templates/reset-password-email.ts +0 -65
  478. package/server/templates/verification-email.ts +0 -66
  479. package/server/types.ts +0 -21
  480. package/server/utils/accepts.ts +0 -11
  481. package/server/utils/access-token-cookie.ts +0 -50
  482. package/server/utils/check-permission.ts +0 -52
  483. package/server/utils/check-user-belongs-domain.ts +0 -19
  484. package/server/utils/check-user-has-role.ts +0 -29
  485. package/server/utils/encrypt-state.ts +0 -22
  486. package/server/utils/get-aes-256-key.ts +0 -13
  487. package/server/utils/get-domain-users.ts +0 -38
  488. package/server/utils/get-secret.ts +0 -13
  489. package/server/utils/get-user-domains.ts +0 -115
@@ -4,17 +4,17 @@ exports.ApplicationMutation = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
6
  const shell_1 = require("@things-factory/shell");
7
- const user_1 = require("../user/user");
8
- const application_1 = require("./application");
9
- const application_types_1 = require("./application-types");
7
+ const user_js_1 = require("../user/user.js");
8
+ const application_js_1 = require("./application.js");
9
+ const application_types_js_1 = require("./application-types.js");
10
10
  let ApplicationMutation = class ApplicationMutation {
11
11
  async createApplication(application, context) {
12
12
  const { domain } = context.state;
13
- return await (0, shell_1.getRepository)(application_1.Application).save(Object.assign(Object.assign({}, application), { domain, appKey: application_1.Application.generateAppKey(), appSecret: application_1.Application.generateAppSecret(), creator: context.state.user, updater: context.state.user }));
13
+ return await (0, shell_1.getRepository)(application_js_1.Application).save(Object.assign(Object.assign({}, application), { domain, appKey: application_js_1.Application.generateAppKey(), appSecret: application_js_1.Application.generateAppSecret(), creator: context.state.user, updater: context.state.user }));
14
14
  }
15
15
  async deleteApplication(id, context) {
16
16
  const { domain } = context.state;
17
- await (0, shell_1.getRepository)(application_1.Application).delete({
17
+ await (0, shell_1.getRepository)(application_js_1.Application).delete({
18
18
  domain: { id: domain.id },
19
19
  id
20
20
  });
@@ -22,34 +22,34 @@ let ApplicationMutation = class ApplicationMutation {
22
22
  }
23
23
  async generateApplicationSecret(id, context) {
24
24
  const { domain } = context.state;
25
- const repository = (0, shell_1.getRepository)(application_1.Application);
25
+ const repository = (0, shell_1.getRepository)(application_js_1.Application);
26
26
  const application = await repository.findOneBy({ domain: { id: domain.id }, id });
27
- return await repository.save(Object.assign(Object.assign({}, application), { appSecret: application_1.Application.generateAppSecret(), updater: context.state.user }));
27
+ return await repository.save(Object.assign(Object.assign({}, application), { appSecret: application_js_1.Application.generateAppSecret(), updater: context.state.user }));
28
28
  }
29
29
  async renewApplicationAccessToken(id, context, scope) {
30
30
  const { domain } = context.state;
31
- var appuser = await (0, shell_1.getRepository)(user_1.User).findOneBy({
31
+ var appuser = await (0, shell_1.getRepository)(user_js_1.User).findOneBy({
32
32
  id,
33
33
  userType: 'application'
34
34
  });
35
35
  if (!appuser) {
36
36
  throw new Error('application is not bound');
37
37
  }
38
- const repository = (0, shell_1.getRepository)(application_1.Application);
38
+ const repository = (0, shell_1.getRepository)(application_js_1.Application);
39
39
  const application = await repository.findOneBy({ id: appuser.reference });
40
40
  if (!application) {
41
41
  throw new Error('application not found');
42
42
  }
43
- var accessToken = application_1.Application.generateAccessToken(domain, appuser, application.appSecret, scope || '');
44
- var refreshToken = application_1.Application.generateRefreshToken(domain, appuser, application.appSecret, scope || '');
45
- await (0, shell_1.getRepository)(user_1.User).save(Object.assign(Object.assign({}, appuser), { password: refreshToken }));
43
+ var accessToken = application_js_1.Application.generateAccessToken(domain, appuser, application.appSecret, scope || '');
44
+ var refreshToken = application_js_1.Application.generateRefreshToken(domain, appuser, application.appSecret, scope || '');
45
+ await (0, shell_1.getRepository)(user_js_1.User).save(Object.assign(Object.assign({}, appuser), { password: refreshToken }));
46
46
  return {
47
47
  accessToken,
48
48
  refreshToken
49
49
  };
50
50
  }
51
51
  async updateApplication(id, patch, context) {
52
- const repository = (0, shell_1.getRepository)(application_1.Application);
52
+ const repository = (0, shell_1.getRepository)(application_js_1.Application);
53
53
  const application = await repository.findOneBy({ id });
54
54
  return await repository.save(Object.assign(Object.assign(Object.assign({}, application), patch), { updater: context.state.user }));
55
55
  }
@@ -57,11 +57,11 @@ let ApplicationMutation = class ApplicationMutation {
57
57
  exports.ApplicationMutation = ApplicationMutation;
58
58
  tslib_1.__decorate([
59
59
  (0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
60
- (0, type_graphql_1.Mutation)(returns => application_1.Application, { description: 'To create new application' }),
60
+ (0, type_graphql_1.Mutation)(returns => application_js_1.Application, { description: 'To create new application' }),
61
61
  tslib_1.__param(0, (0, type_graphql_1.Arg)('application')),
62
62
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
63
63
  tslib_1.__metadata("design:type", Function),
64
- tslib_1.__metadata("design:paramtypes", [application_types_1.NewApplication, Object]),
64
+ tslib_1.__metadata("design:paramtypes", [application_types_js_1.NewApplication, Object]),
65
65
  tslib_1.__metadata("design:returntype", Promise)
66
66
  ], ApplicationMutation.prototype, "createApplication", null);
67
67
  tslib_1.__decorate([
@@ -75,7 +75,7 @@ tslib_1.__decorate([
75
75
  ], ApplicationMutation.prototype, "deleteApplication", null);
76
76
  tslib_1.__decorate([
77
77
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "mutation", domainOwnerGranted: true)'),
78
- (0, type_graphql_1.Mutation)(returns => application_1.Application),
78
+ (0, type_graphql_1.Mutation)(returns => application_js_1.Application),
79
79
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
80
80
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
81
81
  tslib_1.__metadata("design:type", Function),
@@ -84,7 +84,7 @@ tslib_1.__decorate([
84
84
  ], ApplicationMutation.prototype, "generateApplicationSecret", null);
85
85
  tslib_1.__decorate([
86
86
  (0, type_graphql_1.Directive)('@privilege(category: "security", privilege: "mutation", domainOwnerGranted: true)'),
87
- (0, type_graphql_1.Mutation)(returns => application_types_1.AccessToken),
87
+ (0, type_graphql_1.Mutation)(returns => application_types_js_1.AccessToken),
88
88
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
89
89
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
90
90
  tslib_1.__param(2, (0, type_graphql_1.Arg)('scope')),
@@ -94,15 +94,15 @@ tslib_1.__decorate([
94
94
  ], ApplicationMutation.prototype, "renewApplicationAccessToken", null);
95
95
  tslib_1.__decorate([
96
96
  (0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "mutation", domainOwnerGranted: true)'),
97
- (0, type_graphql_1.Mutation)(returns => application_1.Application),
97
+ (0, type_graphql_1.Mutation)(returns => application_js_1.Application),
98
98
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
99
99
  tslib_1.__param(1, (0, type_graphql_1.Arg)('patch')),
100
100
  tslib_1.__param(2, (0, type_graphql_1.Ctx)()),
101
101
  tslib_1.__metadata("design:type", Function),
102
- tslib_1.__metadata("design:paramtypes", [String, application_types_1.ApplicationPatch, Object]),
102
+ tslib_1.__metadata("design:paramtypes", [String, application_types_js_1.ApplicationPatch, Object]),
103
103
  tslib_1.__metadata("design:returntype", Promise)
104
104
  ], ApplicationMutation.prototype, "updateApplication", null);
105
105
  exports.ApplicationMutation = ApplicationMutation = tslib_1.__decorate([
106
- (0, type_graphql_1.Resolver)(application_1.Application)
106
+ (0, type_graphql_1.Resolver)(application_js_1.Application)
107
107
  ], ApplicationMutation);
108
108
  //# sourceMappingURL=application-mutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"application-mutation.js","sourceRoot":"","sources":["../../../server/service/application/application-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAAqD;AAErD,uCAAmC;AACnC,+CAA2C;AAC3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;AAIK;IAFL,IAAA,wBAAS,EAAC,+EAA+E,CAAC;IAC1F,IAAA,uBAAQ,EAAC,OAAO,CAAC,EAAE,CAAC,yBAAW,CAAC;IAE9B,mBAAA,IAAA,kBAAG,EAAC,IAAI,CAAC,CAAA;IACT,mBAAA,IAAA,kBAAG,EAAC,OAAO,CAAC,CAAA;IACZ,mBAAA,IAAA,kBAAG,GAAE,CAAA;;qDADe,oCAAgB;;4DAWtC;8BA7FU,mBAAmB;IAD/B,IAAA,uBAAQ,EAAC,yBAAW,CAAC;GACT,mBAAmB,CA8F/B","sourcesContent":["import { Directive, Arg, Ctx, Mutation, Resolver } from 'type-graphql'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { User } from '../user/user'\nimport { Application } from './application'\nimport { AccessToken, ApplicationPatch, NewApplication } from './application-types'\n\n@Resolver(Application)\nexport class ApplicationMutation {\n @Directive('@privilege(category: \"user\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Application, { description: 'To create new application' })\n async createApplication(@Arg('application') application: NewApplication, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n return await getRepository(Application).save({\n ...application,\n domain,\n appKey: Application.generateAppKey(),\n appSecret: Application.generateAppSecret(),\n creator: context.state.user,\n updater: context.state.user\n })\n }\n\n @Directive('@privilege(category: \"user\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete application' })\n async deleteApplication(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n await getRepository(Application).delete({\n domain: { id: domain.id },\n id\n })\n return true\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Application)\n async generateApplicationSecret(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n const repository = getRepository(Application)\n const application = await repository.findOneBy({ domain: { id: domain.id }, id })\n\n return await repository.save({\n ...application,\n appSecret: Application.generateAppSecret(),\n updater: context.state.user\n })\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccessToken)\n async renewApplicationAccessToken(\n @Arg('id') id: string,\n @Ctx() context: ResolverContext,\n @Arg('scope') scope?: string\n ) {\n const { domain } = context.state\n\n var appuser: User = await getRepository(User).findOneBy({\n id,\n userType: 'application'\n })\n\n if (!appuser) {\n throw new Error('application is not bound')\n }\n\n const repository = getRepository(Application)\n const application = await repository.findOneBy({ id: appuser.reference })\n if (!application) {\n throw new Error('application not found')\n }\n\n var accessToken = Application.generateAccessToken(domain, appuser, application.appSecret, scope || '')\n var refreshToken = Application.generateRefreshToken(domain, appuser, application.appSecret, scope || '')\n\n await getRepository(User).save({\n ...(appuser as any),\n password: refreshToken\n })\n\n return {\n accessToken,\n refreshToken\n }\n }\n\n @Directive('@privilege(category: \"user\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Application)\n async updateApplication(\n @Arg('id') id: string,\n @Arg('patch') patch: ApplicationPatch,\n @Ctx() context: ResolverContext\n ) {\n const repository = getRepository(Application)\n const application = await repository.findOneBy({ id })\n\n return await repository.save({\n ...application,\n ...patch,\n updater: context.state.user\n })\n }\n}\n"]}
1
+ {"version":3,"file":"application-mutation.js","sourceRoot":"","sources":["../../../server/service/application/application-mutation.ts"],"names":[],"mappings":";;;;AAAA,+CAAsE;AAEtE,iDAAqD;AAErD,6CAAsC;AACtC,qDAA8C;AAC9C,iEAAsF;AAG/E,IAAM,mBAAmB,GAAzB,MAAM,mBAAmB;IAGxB,AAAN,KAAK,CAAC,iBAAiB,CAAqB,WAA2B,EAAS,OAAwB;QACtG,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC,KAAK,CAAA;QAChC,OAAO,MAAM,IAAA,qBAAa,EAAC,4BAAW,CAAC,CAAC,IAAI,iCACvC,WAAW,KACd,MAAM,EACN,MAAM,EAAE,4BAAW,CAAC,cAAc,EAAE,EACpC,SAAS,EAAE,4BAAW,CAAC,iBAAiB,E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B,CA8F/B","sourcesContent":["import { Directive, Arg, Ctx, Mutation, Resolver } from 'type-graphql'\n\nimport { getRepository } from '@things-factory/shell'\n\nimport { User } from '../user/user.js'\nimport { Application } from './application.js'\nimport { AccessToken, ApplicationPatch, NewApplication } from './application-types.js'\n\n@Resolver(Application)\nexport class ApplicationMutation {\n @Directive('@privilege(category: \"user\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Application, { description: 'To create new application' })\n async createApplication(@Arg('application') application: NewApplication, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n return await getRepository(Application).save({\n ...application,\n domain,\n appKey: Application.generateAppKey(),\n appSecret: Application.generateAppSecret(),\n creator: context.state.user,\n updater: context.state.user\n })\n }\n\n @Directive('@privilege(category: \"user\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Boolean, { description: 'To delete application' })\n async deleteApplication(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n await getRepository(Application).delete({\n domain: { id: domain.id },\n id\n })\n return true\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Application)\n async generateApplicationSecret(@Arg('id') id: string, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n const repository = getRepository(Application)\n const application = await repository.findOneBy({ domain: { id: domain.id }, id })\n\n return await repository.save({\n ...application,\n appSecret: Application.generateAppSecret(),\n updater: context.state.user\n })\n }\n\n @Directive('@privilege(category: \"security\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => AccessToken)\n async renewApplicationAccessToken(\n @Arg('id') id: string,\n @Ctx() context: ResolverContext,\n @Arg('scope') scope?: string\n ) {\n const { domain } = context.state\n\n var appuser: User = await getRepository(User).findOneBy({\n id,\n userType: 'application'\n })\n\n if (!appuser) {\n throw new Error('application is not bound')\n }\n\n const repository = getRepository(Application)\n const application = await repository.findOneBy({ id: appuser.reference })\n if (!application) {\n throw new Error('application not found')\n }\n\n var accessToken = Application.generateAccessToken(domain, appuser, application.appSecret, scope || '')\n var refreshToken = Application.generateRefreshToken(domain, appuser, application.appSecret, scope || '')\n\n await getRepository(User).save({\n ...(appuser as any),\n password: refreshToken\n })\n\n return {\n accessToken,\n refreshToken\n }\n }\n\n @Directive('@privilege(category: \"user\", privilege: \"mutation\", domainOwnerGranted: true)')\n @Mutation(returns => Application)\n async updateApplication(\n @Arg('id') id: string,\n @Arg('patch') patch: ApplicationPatch,\n @Ctx() context: ResolverContext\n ) {\n const repository = getRepository(Application)\n const application = await repository.findOneBy({ id })\n\n return await repository.save({\n ...application,\n ...patch,\n updater: context.state.user\n })\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { Domain, ListParam } from '@things-factory/shell';
2
- import { User } from '../user/user';
3
- import { Application } from './application';
2
+ import { User } from '../user/user.js';
3
+ import { Application } from './application.js';
4
4
  export declare class ApplicationQuery {
5
5
  application(id: string, context: ResolverContext): Promise<Application>;
6
6
  applications(params: ListParam, context: ResolverContext): Promise<{
@@ -6,14 +6,14 @@ const type_graphql_1 = require("type-graphql");
6
6
  const url_1 = require("url");
7
7
  const env_1 = require("@things-factory/env");
8
8
  const shell_1 = require("@things-factory/shell");
9
- const role_1 = require("../role/role");
10
- const user_1 = require("../user/user");
11
- const application_1 = require("./application");
12
- const application_types_1 = require("./application-types");
9
+ const role_js_1 = require("../role/role.js");
10
+ const user_js_1 = require("../user/user.js");
11
+ const application_js_1 = require("./application.js");
12
+ const application_types_js_1 = require("./application-types.js");
13
13
  const protocol = env_1.config.get('protocol');
14
14
  let ApplicationQuery = class ApplicationQuery {
15
15
  async application(id, context) {
16
- const repository = (0, shell_1.getRepository)(application_1.Application);
16
+ const repository = (0, shell_1.getRepository)(application_js_1.Application);
17
17
  return await repository.findOneBy({ id });
18
18
  }
19
19
  async applications(params, context) {
@@ -21,7 +21,7 @@ let ApplicationQuery = class ApplicationQuery {
21
21
  const queryBuilder = (0, shell_1.getQueryBuilderFromListParams)({
22
22
  domain,
23
23
  params,
24
- repository: (0, shell_1.getRepository)(application_1.Application),
24
+ repository: (0, shell_1.getRepository)(application_js_1.Application),
25
25
  alias: 'application',
26
26
  searchables: ['name', 'description']
27
27
  });
@@ -30,7 +30,7 @@ let ApplicationQuery = class ApplicationQuery {
30
30
  }
31
31
  async availableScopes(context) {
32
32
  const { domain } = context.state;
33
- const roles = await (0, shell_1.getRepository)(role_1.Role).findBy({ domain: { id: domain.id } });
33
+ const roles = await (0, shell_1.getRepository)(role_js_1.Role).findBy({ domain: { id: domain.id } });
34
34
  return roles.map((role) => role.name).join(' ');
35
35
  }
36
36
  async accessTokenUrl(context) {
@@ -43,16 +43,16 @@ let ApplicationQuery = class ApplicationQuery {
43
43
  return context.state.domain;
44
44
  }
45
45
  async updater(application) {
46
- return await (0, shell_1.getRepository)(user_1.User).findOneBy({ id: application.updaterId });
46
+ return await (0, shell_1.getRepository)(user_js_1.User).findOneBy({ id: application.updaterId });
47
47
  }
48
48
  async creator(application) {
49
- return await (0, shell_1.getRepository)(user_1.User).findOneBy({ id: application.creatorId });
49
+ return await (0, shell_1.getRepository)(user_js_1.User).findOneBy({ id: application.creatorId });
50
50
  }
51
51
  };
52
52
  exports.ApplicationQuery = ApplicationQuery;
53
53
  tslib_1.__decorate([
54
54
  (0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
55
- (0, type_graphql_1.Query)(returns => application_1.Application, { description: 'To fetch application' }),
55
+ (0, type_graphql_1.Query)(returns => application_js_1.Application, { description: 'To fetch application' }),
56
56
  tslib_1.__param(0, (0, type_graphql_1.Arg)('id')),
57
57
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
58
58
  tslib_1.__metadata("design:type", Function),
@@ -61,7 +61,7 @@ tslib_1.__decorate([
61
61
  ], ApplicationQuery.prototype, "application", null);
62
62
  tslib_1.__decorate([
63
63
  (0, type_graphql_1.Directive)('@privilege(category: "user", privilege: "query", domainOwnerGranted: true, superUserGranted: true)'),
64
- (0, type_graphql_1.Query)(returns => application_types_1.ApplicationList, { description: 'To fetch multiple application' }),
64
+ (0, type_graphql_1.Query)(returns => application_types_js_1.ApplicationList, { description: 'To fetch multiple application' }),
65
65
  tslib_1.__param(0, (0, type_graphql_1.Args)(type => shell_1.ListParam)),
66
66
  tslib_1.__param(1, (0, type_graphql_1.Ctx)()),
67
67
  tslib_1.__metadata("design:type", Function),
@@ -97,21 +97,21 @@ tslib_1.__decorate([
97
97
  tslib_1.__metadata("design:returntype", Promise)
98
98
  ], ApplicationQuery.prototype, "domain", null);
99
99
  tslib_1.__decorate([
100
- (0, type_graphql_1.FieldResolver)(type => user_1.User),
100
+ (0, type_graphql_1.FieldResolver)(type => user_js_1.User),
101
101
  tslib_1.__param(0, (0, type_graphql_1.Root)()),
102
102
  tslib_1.__metadata("design:type", Function),
103
- tslib_1.__metadata("design:paramtypes", [application_1.Application]),
103
+ tslib_1.__metadata("design:paramtypes", [application_js_1.Application]),
104
104
  tslib_1.__metadata("design:returntype", Promise)
105
105
  ], ApplicationQuery.prototype, "updater", null);
106
106
  tslib_1.__decorate([
107
- (0, type_graphql_1.FieldResolver)(type => user_1.User),
107
+ (0, type_graphql_1.FieldResolver)(type => user_js_1.User),
108
108
  tslib_1.__param(0, (0, type_graphql_1.Root)()),
109
109
  tslib_1.__metadata("design:type", Function),
110
- tslib_1.__metadata("design:paramtypes", [application_1.Application]),
110
+ tslib_1.__metadata("design:paramtypes", [application_js_1.Application]),
111
111
  tslib_1.__metadata("design:returntype", Promise)
112
112
  ], ApplicationQuery.prototype, "creator", null);
113
113
  exports.ApplicationQuery = ApplicationQuery = tslib_1.__decorate([
114
- (0, type_graphql_1.Resolver)(application_1.Application)
114
+ (0, type_graphql_1.Resolver)(application_js_1.Application)
115
115
  ], ApplicationQuery);
116
116
  function buildAuthURL(pathname, context) {
117
117
  const originalProtocol = context.headers['x-forwarded-proto'];
@@ -1 +1 @@
1
- {"version":3,"file":"application-query.js","sourceRoot":"","sources":["../../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E,CAAC;QACrC,IAAI,GAAG,GAAQ,IAAI,SAAG,CAAC,GAAG,gBAAgB,MAAM,YAAY,EAAE,CAAC,CAAA;QAC/D,IAAI,YAAY,EAAE,CAAC;YACjB,GAAG,CAAC,IAAI,GAAG,YAAY,CAAA;QACzB,CAAC;IACH,CAAC;SAAM,CAAC;QACN,IAAI,GAAG,GAAQ,IAAI,SAAG,CAAC,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,CAAA;IAChD,CAAC;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACzB,CAAC;IAED,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAEvB,OAAO,GAAG,CAAC,IAAI,CAAA;AACjB,CAAC","sourcesContent":["import { Directive, Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\nimport { SelectQueryBuilder } from 'typeorm'\nimport { URL } from 'url'\n\nimport { config } from '@things-factory/env'\nimport { getQueryBuilderFromListParams, Domain, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Role } from '../role/role'\nimport { User } from '../user/user'\nimport { Application } from './application'\nimport { ApplicationList } from './application-types'\n\nconst protocol: string = config.get('protocol')\n\n@Resolver(Application)\nexport class ApplicationQuery {\n @Directive('@privilege(category: \"user\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => Application, { description: 'To fetch application' })\n async application(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Application> {\n const repository = getRepository(Application)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(category: \"user\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ApplicationList, { description: 'To fetch multiple application' })\n async applications(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: getRepository(Application),\n alias: 'application',\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async availableScopes(@Ctx() context: ResolverContext): Promise<string> {\n const { domain } = context.state\n const roles = await getRepository(Role).findBy({ domain: { id: domain.id } })\n\n return roles.map((role: Role) => role.name).join(' ')\n }\n\n @FieldResolver(type => String)\n async accessTokenUrl(@Ctx() context: ResolverContext): Promise<string> {\n return buildAuthURL('/oauth/access-token', context)\n }\n\n @FieldResolver(type => String)\n async authUrl(@Ctx() context: ResolverContext): Promise<string> {\n return buildAuthURL('/oauth/authorize', context)\n }\n\n @FieldResolver(type => Domain)\n async domain(@Ctx() context: ResolverContext) {\n return context.state.domain\n }\n\n @FieldResolver(type => User)\n async updater(@Root() application: Application): Promise<User> {\n return await getRepository(User).findOneBy({ id: application.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() application: Application): Promise<User> {\n return await getRepository(User).findOneBy({ id: application.creatorId })\n }\n}\n\nfunction buildAuthURL(pathname: string, context: ResolverContext): string {\n const originalProtocol = context.headers['x-forwarded-proto']\n const originalHost = context.headers['x-forwarded-host']\n const originalPort = context.headers['x-forwarded-port']\n\n if (originalProtocol && originalHost) {\n var url: URL = new URL(`${originalProtocol}://${originalHost}`)\n if (originalPort) {\n url.port = originalPort\n }\n } else {\n var url: URL = new URL(context.request.origin)\n }\n\n if (protocol) {\n url.protocol = protocol\n }\n\n url.pathname = pathname\n\n return url.href\n}\n"]}
1
+ {"version":3,"file":"application-query.js","sourceRoot":"","sources":["../../../server/service/application/application-query.ts"],"names":[],"mappings":";;;;AAAA,+CAA8F;AAC9F,6BAAyB;AAEzB,6CAA4C;AAC5C,iDAAuG;AAEvG,6CAAsC;AACtC,6CAAsC;AACtC,qDAA8C;AAC9C,iEAAwD;AAExD,MAAM,QAAQ,GAAW,YAAM,CAAC,GAAG,CAAC,UAAU,CAAC,CAAA;AAGxC,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;IAGrB,AAAN,KAAK,CAAC,WAAW,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C;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;IACzB,CAAC;IAED,GAAG,CAAC,QAAQ,GAAG,QAAQ,CAAA;IAEvB,OAAO,GAAG,CAAC,IAAI,CAAA;AACjB,CAAC","sourcesContent":["import { Directive, Arg, Args, Ctx, FieldResolver, Query, Resolver, Root } from 'type-graphql'\nimport { URL } from 'url'\n\nimport { config } from '@things-factory/env'\nimport { getQueryBuilderFromListParams, Domain, getRepository, ListParam } from '@things-factory/shell'\n\nimport { Role } from '../role/role.js'\nimport { User } from '../user/user.js'\nimport { Application } from './application.js'\nimport { ApplicationList } from './application-types.js'\n\nconst protocol: string = config.get('protocol')\n\n@Resolver(Application)\nexport class ApplicationQuery {\n @Directive('@privilege(category: \"user\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => Application, { description: 'To fetch application' })\n async application(@Arg('id') id: string, @Ctx() context: ResolverContext): Promise<Application> {\n const repository = getRepository(Application)\n\n return await repository.findOneBy({ id })\n }\n\n @Directive('@privilege(category: \"user\", privilege: \"query\", domainOwnerGranted: true, superUserGranted: true)')\n @Query(returns => ApplicationList, { description: 'To fetch multiple application' })\n async applications(@Args(type => ListParam) params: ListParam, @Ctx() context: ResolverContext) {\n const { domain } = context.state\n\n const queryBuilder = getQueryBuilderFromListParams({\n domain,\n params,\n repository: getRepository(Application),\n alias: 'application',\n searchables: ['name', 'description']\n })\n\n const [items, total] = await queryBuilder.getManyAndCount()\n\n return { items, total }\n }\n\n @FieldResolver(type => String)\n async availableScopes(@Ctx() context: ResolverContext): Promise<string> {\n const { domain } = context.state\n const roles = await getRepository(Role).findBy({ domain: { id: domain.id } })\n\n return roles.map((role: Role) => role.name).join(' ')\n }\n\n @FieldResolver(type => String)\n async accessTokenUrl(@Ctx() context: ResolverContext): Promise<string> {\n return buildAuthURL('/oauth/access-token', context)\n }\n\n @FieldResolver(type => String)\n async authUrl(@Ctx() context: ResolverContext): Promise<string> {\n return buildAuthURL('/oauth/authorize', context)\n }\n\n @FieldResolver(type => Domain)\n async domain(@Ctx() context: ResolverContext) {\n return context.state.domain\n }\n\n @FieldResolver(type => User)\n async updater(@Root() application: Application): Promise<User> {\n return await getRepository(User).findOneBy({ id: application.updaterId })\n }\n\n @FieldResolver(type => User)\n async creator(@Root() application: Application): Promise<User> {\n return await getRepository(User).findOneBy({ id: application.creatorId })\n }\n}\n\nfunction buildAuthURL(pathname: string, context: ResolverContext): string {\n const originalProtocol = context.headers['x-forwarded-proto']\n const originalHost = context.headers['x-forwarded-host']\n const originalPort = context.headers['x-forwarded-port']\n\n if (originalProtocol && originalHost) {\n var url: URL = new URL(`${originalProtocol}://${originalHost}`)\n if (originalPort) {\n url.port = originalPort\n }\n } else {\n var url: URL = new URL(context.request.origin)\n }\n\n if (protocol) {\n url.protocol = protocol\n }\n\n url.pathname = pathname\n\n return url.href\n}\n"]}
@@ -1,4 +1,4 @@
1
- import { Application, ApplicationType } from './application';
1
+ import { Application, ApplicationType } from './application.js';
2
2
  export declare class AccessToken {
3
3
  accesToken: string;
4
4
  refreshToken: string;
@@ -4,7 +4,7 @@ exports.NewApplication = exports.ApplicationPatch = exports.ApplicationList = ex
4
4
  const tslib_1 = require("tslib");
5
5
  const type_graphql_1 = require("type-graphql");
6
6
  const graphql_scalars_1 = require("graphql-scalars");
7
- const application_1 = require("./application");
7
+ const application_js_1 = require("./application.js");
8
8
  let AccessToken = class AccessToken {
9
9
  };
10
10
  exports.AccessToken = AccessToken;
@@ -23,7 +23,7 @@ let ApplicationList = class ApplicationList {
23
23
  };
24
24
  exports.ApplicationList = ApplicationList;
25
25
  tslib_1.__decorate([
26
- (0, type_graphql_1.Field)(type => [application_1.Application], { nullable: true }),
26
+ (0, type_graphql_1.Field)(type => [application_js_1.Application], { nullable: true }),
27
27
  tslib_1.__metadata("design:type", Array)
28
28
  ], ApplicationList.prototype, "items", void 0);
29
29
  tslib_1.__decorate([
@@ -65,7 +65,7 @@ tslib_1.__decorate([
65
65
  tslib_1.__metadata("design:type", String)
66
66
  ], ApplicationPatch.prototype, "webhook", void 0);
67
67
  tslib_1.__decorate([
68
- (0, type_graphql_1.Field)(type => application_1.ApplicationType, { nullable: true }),
68
+ (0, type_graphql_1.Field)(type => application_js_1.ApplicationType, { nullable: true }),
69
69
  tslib_1.__metadata("design:type", String)
70
70
  ], ApplicationPatch.prototype, "type", void 0);
71
71
  exports.ApplicationPatch = ApplicationPatch = tslib_1.__decorate([
@@ -103,7 +103,7 @@ tslib_1.__decorate([
103
103
  tslib_1.__metadata("design:type", String)
104
104
  ], NewApplication.prototype, "webhook", void 0);
105
105
  tslib_1.__decorate([
106
- (0, type_graphql_1.Field)(type => application_1.ApplicationType, { nullable: true }),
106
+ (0, type_graphql_1.Field)(type => application_js_1.ApplicationType, { nullable: true }),
107
107
  tslib_1.__metadata("design:type", String)
108
108
  ], NewApplication.prototype, "type", void 0);
109
109
  exports.NewApplication = NewApplication = tslib_1.__decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"application-types.js","sourceRoot":"","sources":["../../../server/service/application/application-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qDAAqD;AAErD,+CAA4D;AAGrD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,GAAE;;+CACU;AAGlB;IADC,IAAA,oBAAK,GAAE;;iDACY;sBALT,WAAW;IADvB,IAAA,yBAAU,GAAE;GACA,WAAW,CAMvB;AAGM,IAAM,eAAe,GAArB,MAAM,eAAe;CAM3B,CAAA;AANY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,yBAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC5B;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAA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AAE,IAAI,EAAE,CAAC;;2CACd;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,6BAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC7B;yBAvBX,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAwB1B","sourcesContent":["import { Field, InputType, Int, ObjectType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\n\nimport { Application, ApplicationType } from './application'\n\n@ObjectType()\nexport class AccessToken {\n @Field()\n accesToken: string\n\n @Field()\n refreshToken: string\n}\n\n@ObjectType()\nexport class ApplicationList {\n @Field(type => [Application], { nullable: true })\n items?: Application[]\n\n @Field(type => Int, { nullable: true })\n total?: number\n}\n\n@InputType()\nexport class ApplicationPatch {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n url?: string\n\n @Field({ nullable: true })\n icon?: string\n\n @Field({ nullable: true })\n redirectUrl?: string\n\n @Field({ nullable: true })\n webhook?: string\n\n @Field(type => ApplicationType, { nullable: true })\n type?: ApplicationType\n}\n\n@InputType()\nexport class NewApplication {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n url?: string\n\n @Field({ nullable: true })\n icon?: string\n\n @Field({ nullable: true })\n redirectUrl?: string\n\n @Field({ nullable: true })\n webhook?: string\n\n @Field(type => ApplicationType, { nullable: true })\n type?: ApplicationType\n}\n"]}
1
+ {"version":3,"file":"application-types.js","sourceRoot":"","sources":["../../../server/service/application/application-types.ts"],"names":[],"mappings":";;;;AAAA,+CAAgE;AAChE,qDAAqD;AAErD,qDAA+D;AAGxD,IAAM,WAAW,GAAjB,MAAM,WAAW;CAMvB,CAAA;AANY,kCAAW;AAEtB;IADC,IAAA,oBAAK,GAAE;;+CACU;AAGlB;IADC,IAAA,oBAAK,GAAE;;iDACY;sBALT,WAAW;IADvB,IAAA,yBAAU,GAAE;GACA,WAAW,CAMvB;AAGM,IAAM,eAAe,GAArB,MAAM,eAAe;CAM3B,CAAA;AANY,0CAAe;AAE1B;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,CAAC,4BAAW,CAAC,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC5B;AAGrB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,kBAAG,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACzB;0BALH,eAAe;IAD3B,IAAA,yBAAU,GAAE;GACA,eAAe,CAM3B;AAGM,IAAM,gBAAgB,GAAtB,MAAM,gBAAgB;CAwB5B,CAAA;AAxBY,4CAAgB;AAE3B;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,qCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACzC;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACd;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;qDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;iDACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gCAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;8CAC7B;2BAvBX,gBAAgB;IAD5B,IAAA,wBAAS,GAAE;GACC,gBAAgB,CAwB5B;AAGM,IAAM,cAAc,GAApB,MAAM,cAAc;CAwB1B,CAAA;AAxBY,wCAAc;AAEzB;IADC,IAAA,oBAAK,GAAE;;4CACI;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,qCAAmB,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;6CACzC;AAGd;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;2CACd;AAGZ;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CACb;AAGb;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;mDACN;AAGpB;IADC,IAAA,oBAAK,EAAC,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;+CACV;AAGhB;IADC,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,gCAAe,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;;4CAC7B;yBAvBX,cAAc;IAD1B,IAAA,wBAAS,GAAE;GACC,cAAc,CAwB1B","sourcesContent":["import { Field, InputType, Int, ObjectType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\n\nimport { Application, ApplicationType } from './application.js'\n\n@ObjectType()\nexport class AccessToken {\n @Field()\n accesToken: string\n\n @Field()\n refreshToken: string\n}\n\n@ObjectType()\nexport class ApplicationList {\n @Field(type => [Application], { nullable: true })\n items?: Application[]\n\n @Field(type => Int, { nullable: true })\n total?: number\n}\n\n@InputType()\nexport class ApplicationPatch {\n @Field({ nullable: true })\n name?: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n url?: string\n\n @Field({ nullable: true })\n icon?: string\n\n @Field({ nullable: true })\n redirectUrl?: string\n\n @Field({ nullable: true })\n webhook?: string\n\n @Field(type => ApplicationType, { nullable: true })\n type?: ApplicationType\n}\n\n@InputType()\nexport class NewApplication {\n @Field()\n name: string\n\n @Field({ nullable: true })\n description?: string\n\n @Field(type => GraphQLEmailAddress, { nullable: true })\n email?: string\n\n @Field({ nullable: true })\n url?: string\n\n @Field({ nullable: true })\n icon?: string\n\n @Field({ nullable: true })\n redirectUrl?: string\n\n @Field({ nullable: true })\n webhook?: string\n\n @Field(type => ApplicationType, { nullable: true })\n type?: ApplicationType\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import jwt from 'jsonwebtoken';
2
2
  import { Domain } from '@things-factory/shell';
3
- import { User } from '../user/user';
3
+ import { User } from '../user/user.js';
4
4
  export declare enum ApplicationStatus {
5
5
  DRAFT = "DRAFT",
6
6
  ACTIVATED = "ACTIVATED"
@@ -9,8 +9,8 @@ const graphql_scalars_1 = require("graphql-scalars");
9
9
  const typeorm_1 = require("typeorm");
10
10
  const env_1 = require("@things-factory/env");
11
11
  const shell_1 = require("@things-factory/shell");
12
- const get_secret_1 = require("../../utils/get-secret");
13
- const user_1 = require("../user/user");
12
+ const get_secret_js_1 = require("../../utils/get-secret.js");
13
+ const user_js_1 = require("../user/user.js");
14
14
  const ORMCONFIG = env_1.config.get('ormconfig', {});
15
15
  const DATABASE_TYPE = ORMCONFIG.type;
16
16
  var ApplicationStatus;
@@ -51,13 +51,13 @@ let Application = class Application {
51
51
  application: {
52
52
  appKey
53
53
  },
54
- status: user_1.UserStatus.ACTIVATED,
54
+ status: user_js_1.UserStatus.ACTIVATED,
55
55
  domain: {
56
56
  subdomain: domain.subdomain
57
57
  },
58
58
  scope
59
59
  };
60
- return jsonwebtoken_1.default.sign(application, get_secret_1.SECRET, {
60
+ return jsonwebtoken_1.default.sign(application, get_secret_js_1.SECRET, {
61
61
  expiresIn,
62
62
  issuer: 'hatiolab.com',
63
63
  subject
@@ -80,13 +80,13 @@ let Application = class Application {
80
80
  scopes,
81
81
  state
82
82
  };
83
- return jsonwebtoken_1.default.sign(credential, get_secret_1.SECRET, {
83
+ return jsonwebtoken_1.default.sign(credential, get_secret_js_1.SECRET, {
84
84
  expiresIn: '1m'
85
85
  });
86
86
  }
87
87
  /* auth-code signing for jsonwebtoken */
88
88
  static verifyAuthCode(authcode) {
89
- return jsonwebtoken_1.default.verify(authcode, get_secret_1.SECRET);
89
+ return jsonwebtoken_1.default.verify(authcode, get_secret_js_1.SECRET);
90
90
  }
91
91
  };
92
92
  exports.Application = Application;
@@ -194,18 +194,18 @@ tslib_1.__decorate([
194
194
  tslib_1.__metadata("design:type", Date)
195
195
  ], Application.prototype, "updatedAt", void 0);
196
196
  tslib_1.__decorate([
197
- (0, typeorm_1.ManyToOne)(type => user_1.User, { nullable: true }),
198
- (0, type_graphql_1.Field)(type => user_1.User, { nullable: true }),
199
- tslib_1.__metadata("design:type", user_1.User)
197
+ (0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
198
+ (0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true }),
199
+ tslib_1.__metadata("design:type", user_js_1.User)
200
200
  ], Application.prototype, "creator", void 0);
201
201
  tslib_1.__decorate([
202
202
  (0, typeorm_1.RelationId)((application) => application.creator),
203
203
  tslib_1.__metadata("design:type", String)
204
204
  ], Application.prototype, "creatorId", void 0);
205
205
  tslib_1.__decorate([
206
- (0, typeorm_1.ManyToOne)(type => user_1.User, { nullable: true }),
207
- (0, type_graphql_1.Field)(type => user_1.User, { nullable: true }),
208
- tslib_1.__metadata("design:type", user_1.User)
206
+ (0, typeorm_1.ManyToOne)(type => user_js_1.User, { nullable: true }),
207
+ (0, type_graphql_1.Field)(type => user_js_1.User, { nullable: true }),
208
+ tslib_1.__metadata("design:type", user_js_1.User)
209
209
  ], Application.prototype, "updater", void 0);
210
210
  tslib_1.__decorate([
211
211
  (0, typeorm_1.RelationId)((application) => application.updater),
@@ -1 +1 @@
1
- {"version":3,"file":"application.js","sourceRoot":"","sources":["../../../server/service/application/application.ts"],"names":[],"mappings":";;;;AAAA,4DAA2B;AAC3B,wEAA8B;AAC9B,+CAAiF;AACjF,qDAAqD;AACrD,qCASgB;AAEhB,6CAA4C;AAC5C,iDAA8C;AAE9C,uDAA+C;AAC/C,uCAA+C;AAE/C,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,4CAAuB,CAAA;AACzB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAA,+BAAgB,EAAC,iBAAiB,EAAE;IAClC,IAAI,EAAE,mBAAmB;IACzB,WAAW,EAAE,oCAAoC;CAClD,CAAC,CAAA;AAEF,IAAY,eAOX;AAPD,WAAY,eAAe;IACzB,8CAA2B,CAAA;IAC3B,oCAAiB,CAAA;IACjB,8BAAW,CAAA;IACX,gCAAa,CAAA;IACb,oCAAiB,CAAA;IACjB,gCAAa,CAAA;AACf,CAAC,EAPW,eAAe,+BAAf,eAAe,QAO1B;AAED,IAAA,+BAAgB,EAAC,eAAe,EAAE;IAChC,IAAI,EAAE,iBAAiB;IACvB,WAAW,EAAE,oCAAoC;CAClD,CAAC,CAAA;AAIK,IAAM,WAAW,GAAjB,MAAM,WAAW;IAyGtB,uBAAuB;IACvB,MAAM,CAAC,iBAAiB;QACtB,OAAO,gBAAM,CAAC,WAAW,C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,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC/F,IAAA,yBAAU,GAAE;GACA,WAAW,CAqKvB","sourcesContent":["import crypto from 'crypto'\nimport jwt from 'jsonwebtoken'\nimport { Directive, Field, ID, ObjectType, registerEnumType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { SECRET } from '../../utils/get-secret'\nimport { User, UserStatus } from '../user/user'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum ApplicationStatus {\n DRAFT = 'DRAFT',\n ACTIVATED = 'ACTIVATED'\n}\n\nregisterEnumType(ApplicationStatus, {\n name: 'ApplicationStatus',\n description: 'state enumeration of a application'\n})\n\nexport enum ApplicationType {\n SELLERCRAFT = 'SELLERCRAFT',\n XILNEX = 'XILNEX',\n MMS = 'MMS',\n XERO = 'XERO',\n OTHERS = 'OTHERS',\n SFTP = 'SFTP'\n}\n\nregisterEnumType(ApplicationType, {\n name: 'ApplicationType',\n description: 'state enumeration of a application'\n})\n@Entity()\n@Index('ix_application_0', (application: Application) => [application.appKey], { unique: true })\n@ObjectType()\nexport class Application {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id?: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((application: Application) => application.domain)\n domainId?: string\n\n @Column()\n @Field()\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column()\n @Field(type => GraphQLEmailAddress)\n email?: string\n\n @Column()\n @Field()\n url?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n icon?: string\n\n @Column()\n @Field()\n redirectUrl?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n webhook?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n appKey?: string\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined\n })\n @Field({ nullable: true })\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n appSecret?: string\n\n @Column({ default: ApplicationStatus.DRAFT })\n @Field()\n status?: ApplicationStatus\n\n @Column({\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? ApplicationType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 32,\n default: ApplicationType.OTHERS\n })\n @Field()\n type?: ApplicationType\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((application: Application) => application.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((application: Application) => application.updater)\n updaterId?: string\n\n /* generateAppSecret */\n static generateAppSecret() {\n return crypto.randomBytes(16).toString('hex')\n }\n\n static generateAppKey() {\n return crypto.randomBytes(16).toString('hex')\n }\n\n /* signing for jsonwebtoken */\n static sign(subject, expiresIn, domain, user, appKey, scope) {\n var application = {\n id: user.id,\n userType: 'application',\n application: {\n appKey\n },\n status: UserStatus.ACTIVATED,\n domain: {\n subdomain: domain.subdomain\n },\n scope\n }\n\n return jwt.sign(application, SECRET, {\n expiresIn,\n issuer: 'hatiolab.com',\n subject\n })\n }\n\n static generateAccessToken(domain, user, appKey, scope) {\n /* how to set expiresIn https://github.com/vercel/ms */\n return this.sign('access-token', '30d', domain, user, appKey, scope)\n }\n\n static generateRefreshToken(domain, user, appKey, scope) {\n /* how to set expiresIn https://github.com/vercel/ms */\n return this.sign('refresh-token', '1y', domain, user, appKey, scope)\n }\n\n /* auth-code signing for jsonwebtoken */\n static generateAuthCode(email, appKey, subdomain, scopes, state) {\n var credential = {\n email,\n appKey,\n subdomain,\n scopes,\n state\n }\n\n return jwt.sign(credential, SECRET, {\n expiresIn: '1m'\n })\n }\n\n /* auth-code signing for jsonwebtoken */\n static verifyAuthCode(authcode) {\n return jwt.verify(authcode, SECRET)\n }\n}\n"]}
1
+ {"version":3,"file":"application.js","sourceRoot":"","sources":["../../../server/service/application/application.ts"],"names":[],"mappings":";;;;AAAA,4DAA2B;AAC3B,wEAA8B;AAC9B,+CAAiF;AACjF,qDAAqD;AACrD,qCASgB;AAEhB,6CAA4C;AAC5C,iDAA8C;AAE9C,6DAAkD;AAClD,6CAAkD;AAElD,MAAM,SAAS,GAAG,YAAM,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,CAAC,CAAA;AAC7C,MAAM,aAAa,GAAG,SAAS,CAAC,IAAI,CAAA;AAEpC,IAAY,iBAGX;AAHD,WAAY,iBAAiB;IAC3B,oCAAe,CAAA;IACf,4CAAuB,CAAA;AACzB,CAAC,EAHW,iBAAiB,iCAAjB,iBAAiB,QAG5B;AAED,IAAA,+BAAgB,EAAC,iBAAiB,EAAE;IAClC,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IAAI,EAAE,CAAC;sCAC9B,cAAI;4CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;8CAC5C;AAIlB;IAFC,IAAA,mBAAS,EAAC,IAAI,CAAC,EAAE,CAAC,cAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3C,IAAA,oBAAK,EAAC,IAAI,CAAC,EAAE,CAAC,cAAI,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;sCAC9B,cAAI;4CAAA;AAGd;IADC,IAAA,oBAAU,EAAC,CAAC,WAAwB,EAAE,EAAE,CAAC,WAAW,CAAC,OAAO,CAAC;;8CAC5C;sBAvGP,WAAW;IAHvB,IAAA,gBAAM,GAAE;IACR,IAAA,eAAK,EAAC,kBAAkB,EAAE,CAAC,WAAwB,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC;IAC/F,IAAA,yBAAU,GAAE;GACA,WAAW,CAqKvB","sourcesContent":["import crypto from 'crypto'\nimport jwt from 'jsonwebtoken'\nimport { Directive, Field, ID, ObjectType, registerEnumType } from 'type-graphql'\nimport { GraphQLEmailAddress } from 'graphql-scalars'\nimport {\n Column,\n CreateDateColumn,\n Entity,\n Index,\n ManyToOne,\n PrimaryGeneratedColumn,\n RelationId,\n UpdateDateColumn\n} from 'typeorm'\n\nimport { config } from '@things-factory/env'\nimport { Domain } from '@things-factory/shell'\n\nimport { SECRET } from '../../utils/get-secret.js'\nimport { User, UserStatus } from '../user/user.js'\n\nconst ORMCONFIG = config.get('ormconfig', {})\nconst DATABASE_TYPE = ORMCONFIG.type\n\nexport enum ApplicationStatus {\n DRAFT = 'DRAFT',\n ACTIVATED = 'ACTIVATED'\n}\n\nregisterEnumType(ApplicationStatus, {\n name: 'ApplicationStatus',\n description: 'state enumeration of a application'\n})\n\nexport enum ApplicationType {\n SELLERCRAFT = 'SELLERCRAFT',\n XILNEX = 'XILNEX',\n MMS = 'MMS',\n XERO = 'XERO',\n OTHERS = 'OTHERS',\n SFTP = 'SFTP'\n}\n\nregisterEnumType(ApplicationType, {\n name: 'ApplicationType',\n description: 'state enumeration of a application'\n})\n@Entity()\n@Index('ix_application_0', (application: Application) => [application.appKey], { unique: true })\n@ObjectType()\nexport class Application {\n @PrimaryGeneratedColumn('uuid')\n @Field(type => ID)\n readonly id?: string\n\n @ManyToOne(type => Domain)\n @Field(type => Domain)\n domain?: Domain\n\n @RelationId((application: Application) => application.domain)\n domainId?: string\n\n @Column()\n @Field()\n name?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n description?: string\n\n @Column()\n @Field(type => GraphQLEmailAddress)\n email?: string\n\n @Column()\n @Field()\n url?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n icon?: string\n\n @Column()\n @Field()\n redirectUrl?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n webhook?: string\n\n @Column({ nullable: true })\n @Field({ nullable: true })\n appKey?: string\n\n @Column({\n nullable: true,\n type:\n DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'longtext'\n : DATABASE_TYPE == 'oracle'\n ? 'clob'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n length: DATABASE_TYPE == 'mssql' ? 'MAX' : undefined\n })\n @Field({ nullable: true })\n @Directive('@privilege(category: \"security\", privilege: \"query\", domainOwnerGranted: true)')\n appSecret?: string\n\n @Column({ default: ApplicationStatus.DRAFT })\n @Field()\n status?: ApplicationStatus\n\n @Column({\n type:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? 'enum'\n : DATABASE_TYPE == 'oracle'\n ? 'varchar2'\n : DATABASE_TYPE == 'mssql'\n ? 'nvarchar'\n : 'varchar',\n enum:\n DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb'\n ? ApplicationType\n : undefined,\n length: DATABASE_TYPE == 'postgres' || DATABASE_TYPE == 'mysql' || DATABASE_TYPE == 'mariadb' ? undefined : 32,\n default: ApplicationType.OTHERS\n })\n @Field()\n type?: ApplicationType\n\n @CreateDateColumn()\n @Field({ nullable: true })\n createdAt?: Date\n\n @UpdateDateColumn()\n @Field({ nullable: true })\n updatedAt?: Date\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n creator?: User\n\n @RelationId((application: Application) => application.creator)\n creatorId?: string\n\n @ManyToOne(type => User, { nullable: true })\n @Field(type => User, { nullable: true })\n updater?: User\n\n @RelationId((application: Application) => application.updater)\n updaterId?: string\n\n /* generateAppSecret */\n static generateAppSecret() {\n return crypto.randomBytes(16).toString('hex')\n }\n\n static generateAppKey() {\n return crypto.randomBytes(16).toString('hex')\n }\n\n /* signing for jsonwebtoken */\n static sign(subject, expiresIn, domain, user, appKey, scope) {\n var application = {\n id: user.id,\n userType: 'application',\n application: {\n appKey\n },\n status: UserStatus.ACTIVATED,\n domain: {\n subdomain: domain.subdomain\n },\n scope\n }\n\n return jwt.sign(application, SECRET, {\n expiresIn,\n issuer: 'hatiolab.com',\n subject\n })\n }\n\n static generateAccessToken(domain, user, appKey, scope) {\n /* how to set expiresIn https://github.com/vercel/ms */\n return this.sign('access-token', '30d', domain, user, appKey, scope)\n }\n\n static generateRefreshToken(domain, user, appKey, scope) {\n /* how to set expiresIn https://github.com/vercel/ms */\n return this.sign('refresh-token', '1y', domain, user, appKey, scope)\n }\n\n /* auth-code signing for jsonwebtoken */\n static generateAuthCode(email, appKey, subdomain, scopes, state) {\n var credential = {\n email,\n appKey,\n subdomain,\n scopes,\n state\n }\n\n return jwt.sign(credential, SECRET, {\n expiresIn: '1m'\n })\n }\n\n /* auth-code signing for jsonwebtoken */\n static verifyAuthCode(authcode) {\n return jwt.verify(authcode, SECRET)\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
- import { Application } from './application';
2
- import { ApplicationQuery } from './application-query';
3
- import { ApplicationMutation } from './application-mutation';
1
+ import { Application } from './application.js';
2
+ import { ApplicationQuery } from './application-query.js';
3
+ import { ApplicationMutation } from './application-mutation.js';
4
4
  export declare const entities: (typeof Application)[];
5
5
  export declare const resolvers: (typeof ApplicationQuery | typeof ApplicationMutation)[];
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.resolvers = exports.entities = void 0;
4
- const application_1 = require("./application");
5
- const application_query_1 = require("./application-query");
6
- const application_mutation_1 = require("./application-mutation");
7
- exports.entities = [application_1.Application];
8
- exports.resolvers = [application_query_1.ApplicationQuery, application_mutation_1.ApplicationMutation];
4
+ const application_js_1 = require("./application.js");
5
+ const application_query_js_1 = require("./application-query.js");
6
+ const application_mutation_js_1 = require("./application-mutation.js");
7
+ exports.entities = [application_js_1.Application];
8
+ exports.resolvers = [application_query_js_1.ApplicationQuery, application_mutation_js_1.ApplicationMutation];
9
9
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/application/index.ts"],"names":[],"mappings":";;;AAAA,+CAA2C;AAC3C,2DAAsD;AACtD,iEAA4D;AAE/C,QAAA,QAAQ,GAAG,CAAC,yBAAW,CAAC,CAAA;AACxB,QAAA,SAAS,GAAG,CAAC,oCAAgB,EAAE,0CAAmB,CAAC,CAAA","sourcesContent":["import { Application } from './application'\nimport { ApplicationQuery } from './application-query'\nimport { ApplicationMutation } from './application-mutation'\n\nexport const entities = [Application]\nexport const resolvers = [ApplicationQuery, ApplicationMutation]\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../server/service/application/index.ts"],"names":[],"mappings":";;;AAAA,qDAA8C;AAC9C,iEAAyD;AACzD,uEAA+D;AAElD,QAAA,QAAQ,GAAG,CAAC,4BAAW,CAAC,CAAA;AACxB,QAAA,SAAS,GAAG,CAAC,uCAAgB,EAAE,6CAAmB,CAAC,CAAA","sourcesContent":["import { Application } from './application.js'\nimport { ApplicationQuery } from './application-query.js'\nimport { ApplicationMutation } from './application-mutation.js'\n\nexport const entities = [Application]\nexport const resolvers = [ApplicationQuery, ApplicationMutation]\n"]}
@@ -1,5 +1,5 @@
1
- import { AuthProvider } from './auth-provider';
2
- import { NewAuthProvider, AuthProviderPatch } from './auth-provider-type';
1
+ import { AuthProvider } from './auth-provider.js';
2
+ import { NewAuthProvider, AuthProviderPatch } from './auth-provider-type.js';
3
3
  export declare class AuthProviderMutation {
4
4
  createAuthProvider(authProvider: NewAuthProvider, context: ResolverContext): Promise<AuthProvider>;
5
5
  updateAuthProvider(id: string, patch: AuthProviderPatch, context: ResolverContext): Promise<AuthProvider>;