hcloud-sdk 0.0.15 → 14.13.2

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 (300) hide show
  1. package/README.md +1 -0
  2. package/changelog.md +809 -0
  3. package/index.d.ts +3 -2
  4. package/index.js +5 -2
  5. package/lib/Base.d.ts +26 -0
  6. package/lib/Base.js +12 -0
  7. package/lib/Hcloud.d.ts +80 -0
  8. package/lib/Hcloud.js +134 -0
  9. package/lib/helper/ErrorHelper.d.ts +7 -0
  10. package/lib/helper/ErrorHelper.js +19 -0
  11. package/lib/helper/paginatedResponseHelper.d.ts +3 -0
  12. package/lib/helper/paginatedResponseHelper.js +9 -0
  13. package/lib/helper/searchFilter.d.ts +9 -0
  14. package/lib/helper/searchFilter.js +12 -0
  15. package/lib/interfaces/agent/bundle/dev/index.d.ts +3 -0
  16. package/lib/interfaces/agent/context/index.d.ts +19 -0
  17. package/lib/interfaces/agent/index.d.ts +21 -0
  18. package/lib/interfaces/agent/index.js +2 -0
  19. package/lib/interfaces/auditor/index.d.ts +72 -0
  20. package/lib/interfaces/{Auditor.js → auditor/index.js} +21 -5
  21. package/lib/interfaces/axios/index.d.ts +5 -0
  22. package/lib/interfaces/axios/index.js +8 -0
  23. package/lib/interfaces/bouncer/features/index.d.ts +10 -0
  24. package/lib/interfaces/bouncer/features/index.js +2 -0
  25. package/lib/interfaces/bouncer/index.d.ts +6 -0
  26. package/lib/interfaces/bouncer/index.js +17 -0
  27. package/lib/interfaces/dali/index.d.ts +3 -0
  28. package/lib/interfaces/dali/index.js +2 -0
  29. package/lib/interfaces/frontend/config/index.d.ts +33 -0
  30. package/lib/interfaces/frontend/config/index.js +10 -0
  31. package/lib/interfaces/fuse/index.d.ts +3 -0
  32. package/lib/interfaces/fuse/index.js +19 -0
  33. package/lib/interfaces/fuse/space/cronjob/Cronjob.d.ts +38 -0
  34. package/lib/interfaces/fuse/space/cronjob/Cronjob.js +8 -0
  35. package/lib/interfaces/fuse/space/cronjob/CronjobLog.d.ts +16 -0
  36. package/lib/interfaces/fuse/space/cronjob/CronjobLog.js +2 -0
  37. package/lib/interfaces/fuse/space/index.d.ts +21 -0
  38. package/lib/interfaces/fuse/space/index.js +11 -0
  39. package/lib/interfaces/global/HCloudError.d.ts +8 -0
  40. package/lib/interfaces/global/HCloudError.js +13 -0
  41. package/lib/interfaces/global/Header.d.ts +4 -0
  42. package/lib/interfaces/global/Header.js +2 -0
  43. package/lib/interfaces/global/HttpMethod.d.ts +7 -0
  44. package/lib/interfaces/global/HttpMethod.js +11 -0
  45. package/lib/interfaces/global/PaginatedResponse.d.ts +4 -0
  46. package/lib/interfaces/global/PaginatedResponse.js +2 -0
  47. package/lib/interfaces/global/Products.d.ts +11 -0
  48. package/lib/interfaces/global/Products.js +15 -0
  49. package/lib/interfaces/global/SearchFilters.d.ts +86 -0
  50. package/lib/interfaces/global/SearchFilters.js +49 -0
  51. package/lib/interfaces/global/Space.d.ts +20 -0
  52. package/lib/interfaces/global/Space.js +8 -0
  53. package/lib/interfaces/global/Version.d.ts +3 -0
  54. package/lib/interfaces/global/Version.js +2 -0
  55. package/lib/interfaces/global/Views.d.ts +8 -0
  56. package/lib/interfaces/global/Views.js +12 -0
  57. package/lib/interfaces/global/index.d.ts +9 -0
  58. package/lib/interfaces/global/index.js +25 -0
  59. package/lib/interfaces/high5/index.d.ts +16 -0
  60. package/lib/interfaces/high5/index.js +32 -0
  61. package/lib/interfaces/high5/joinToken/index.d.ts +10 -0
  62. package/lib/interfaces/high5/joinToken/index.js +2 -0
  63. package/lib/interfaces/high5/space/event/index.d.ts +15 -0
  64. package/lib/interfaces/high5/space/event/index.js +2 -0
  65. package/lib/interfaces/high5/space/event/stream/design/DesignOperation.d.ts +68 -0
  66. package/lib/interfaces/high5/space/event/stream/design/DesignOperation.js +20 -0
  67. package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +92 -0
  68. package/lib/interfaces/high5/space/event/stream/design/StreamDesign.js +20 -0
  69. package/lib/interfaces/high5/space/event/stream/design/index.d.ts +22 -0
  70. package/lib/interfaces/high5/space/event/stream/design/index.js +2 -0
  71. package/lib/interfaces/high5/space/event/stream/design/snapshot/index.d.ts +30 -0
  72. package/lib/interfaces/high5/space/event/stream/design/snapshot/index.js +8 -0
  73. package/lib/interfaces/high5/space/event/stream/index.d.ts +77 -0
  74. package/lib/interfaces/high5/space/event/stream/index.js +13 -0
  75. package/lib/interfaces/high5/space/event/stream/node/index.d.ts +60 -0
  76. package/lib/interfaces/high5/space/event/stream/node/index.js +7 -0
  77. package/lib/interfaces/high5/space/execution/index.d.ts +137 -0
  78. package/lib/interfaces/high5/space/execution/index.js +21 -0
  79. package/lib/interfaces/high5/space/index.d.ts +23 -0
  80. package/lib/interfaces/high5/space/index.js +12 -0
  81. package/lib/interfaces/high5/space/secret/index.d.ts +12 -0
  82. package/lib/interfaces/high5/space/secret/index.js +2 -0
  83. package/lib/interfaces/high5/space/webhook/index.d.ts +75 -0
  84. package/lib/interfaces/high5/space/webhook/index.js +9 -0
  85. package/lib/interfaces/high5/wave/index.d.ts +171 -0
  86. package/lib/interfaces/high5/wave/index.js +52 -0
  87. package/lib/interfaces/idp/index.d.ts +26 -0
  88. package/lib/interfaces/idp/index.js +38 -0
  89. package/lib/interfaces/idp/oauth/index.d.ts +19 -0
  90. package/lib/interfaces/idp/oauth/index.js +8 -0
  91. package/lib/interfaces/idp/organization/index.d.ts +32 -0
  92. package/lib/interfaces/idp/organization/index.js +25 -0
  93. package/lib/interfaces/idp/organization/license/index.d.ts +84 -0
  94. package/lib/interfaces/idp/organization/license/index.js +15 -0
  95. package/lib/interfaces/idp/organization/member/index.d.ts +15 -0
  96. package/lib/interfaces/idp/organization/member/index.js +2 -0
  97. package/lib/interfaces/idp/organization/member/invitations/index.d.ts +26 -0
  98. package/lib/interfaces/idp/organization/member/invitations/index.js +18 -0
  99. package/lib/interfaces/idp/organization/settings/domain/index.d.ts +19 -0
  100. package/lib/interfaces/idp/organization/settings/domain/index.js +8 -0
  101. package/lib/interfaces/idp/organization/settings/domain/saml/index.d.ts +10 -0
  102. package/lib/interfaces/idp/organization/settings/domain/saml/index.js +2 -0
  103. package/lib/interfaces/idp/organization/settings/oauthApp/index.d.ts +37 -0
  104. package/lib/interfaces/idp/organization/settings/oauthApp/index.js +2 -0
  105. package/lib/interfaces/idp/organization/team/index.d.ts +24 -0
  106. package/lib/interfaces/idp/organization/team/index.js +9 -0
  107. package/lib/interfaces/idp/user/ConnectionSettings.d.ts +6 -0
  108. package/lib/interfaces/idp/user/ConnectionSettings.js +2 -0
  109. package/lib/interfaces/idp/user/GeneralSettings.d.ts +44 -0
  110. package/lib/interfaces/idp/user/GeneralSettings.js +38 -0
  111. package/lib/interfaces/idp/user/NotificationSettings.d.ts +8 -0
  112. package/lib/interfaces/idp/user/NotificationSettings.js +2 -0
  113. package/lib/interfaces/idp/user/Pat.d.ts +19 -0
  114. package/lib/interfaces/idp/user/Pat.js +2 -0
  115. package/lib/interfaces/idp/user/Scopes.d.ts +40 -0
  116. package/lib/interfaces/idp/user/Scopes.js +50 -0
  117. package/lib/interfaces/idp/user/SuccessfulAuth.d.ts +5 -0
  118. package/lib/interfaces/idp/user/SuccessfulAuth.js +2 -0
  119. package/lib/interfaces/idp/user/Totp.d.ts +20 -0
  120. package/lib/interfaces/idp/user/Totp.js +2 -0
  121. package/lib/interfaces/idp/user/index.d.ts +23 -0
  122. package/lib/interfaces/idp/user/index.js +2 -0
  123. package/lib/interfaces/mailer/index.d.ts +66 -0
  124. package/lib/interfaces/mailer/index.js +81 -0
  125. package/lib/interfaces/mothership/index.d.ts +27 -0
  126. package/lib/interfaces/mothership/index.js +8 -0
  127. package/lib/interfaces/nats/index.d.ts +252 -0
  128. package/lib/interfaces/nats/index.js +334 -0
  129. package/lib/service/agent/bundle/dev/index.d.ts +17 -0
  130. package/lib/service/agent/bundle/dev/index.js +40 -0
  131. package/lib/service/agent/bundle/index.d.ts +11 -0
  132. package/lib/service/agent/bundle/index.js +55 -0
  133. package/lib/service/agent/context/index.d.ts +37 -0
  134. package/lib/service/agent/context/index.js +81 -0
  135. package/lib/service/agent/index.d.ts +14 -0
  136. package/lib/service/agent/index.js +20 -0
  137. package/lib/service/agent/installer/index.d.ts +15 -0
  138. package/lib/service/agent/installer/index.js +97 -0
  139. package/lib/service/auditor/index.d.ts +26 -0
  140. package/lib/service/auditor/index.js +49 -0
  141. package/lib/service/auditor/internal/index.d.ts +27 -0
  142. package/lib/service/auditor/internal/index.js +61 -0
  143. package/lib/service/bouncer/features/index.d.ts +8 -0
  144. package/lib/service/bouncer/features/index.js +25 -0
  145. package/lib/service/bouncer/index.d.ts +14 -0
  146. package/lib/service/bouncer/index.js +31 -0
  147. package/lib/service/dali/DaliAvatar.d.ts +36 -0
  148. package/lib/service/dali/DaliAvatar.js +25 -0
  149. package/lib/service/dali/avatar/DaliFuseSpace.d.ts +28 -0
  150. package/lib/service/dali/avatar/DaliFuseSpace.js +55 -0
  151. package/lib/service/dali/avatar/DaliHigh5Space.d.ts +28 -0
  152. package/lib/service/dali/avatar/DaliHigh5Space.js +55 -0
  153. package/lib/service/dali/avatar/DaliOAuthApp.d.ts +28 -0
  154. package/lib/service/dali/avatar/DaliOAuthApp.js +55 -0
  155. package/lib/service/dali/avatar/DaliOrganization.d.ts +25 -0
  156. package/lib/service/dali/avatar/DaliOrganization.js +52 -0
  157. package/lib/service/dali/avatar/DaliTeam.d.ts +28 -0
  158. package/lib/service/dali/avatar/DaliTeam.js +55 -0
  159. package/lib/service/dali/avatar/DaliUser.d.ts +22 -0
  160. package/lib/service/dali/avatar/DaliUser.js +49 -0
  161. package/lib/service/dali/index.d.ts +16 -0
  162. package/lib/service/dali/index.js +30 -0
  163. package/lib/service/fuse/index.d.ts +17 -0
  164. package/lib/service/fuse/index.js +34 -0
  165. package/lib/service/fuse/internal/index.d.ts +9 -0
  166. package/lib/service/fuse/internal/index.js +29 -0
  167. package/lib/service/fuse/internal/space/cronjob/index.d.ts +8 -0
  168. package/lib/service/fuse/internal/space/cronjob/index.js +15 -0
  169. package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +17 -0
  170. package/lib/service/fuse/internal/space/cronjob/log/index.js +35 -0
  171. package/lib/service/fuse/internal/space/index.d.ts +23 -0
  172. package/lib/service/fuse/internal/space/index.js +43 -0
  173. package/lib/service/fuse/space/cronjob/index.d.ts +123 -0
  174. package/lib/service/fuse/space/cronjob/index.js +175 -0
  175. package/lib/service/fuse/space/cronjob/log/index.d.ts +31 -0
  176. package/lib/service/fuse/space/cronjob/log/index.js +57 -0
  177. package/lib/service/fuse/space/index.d.ts +82 -0
  178. package/lib/service/fuse/space/index.js +134 -0
  179. package/lib/service/high5/execution/index.d.ts +10 -0
  180. package/lib/service/high5/execution/index.js +17 -0
  181. package/lib/service/high5/execution/log/index.d.ts +19 -0
  182. package/lib/service/high5/execution/log/index.js +41 -0
  183. package/lib/service/high5/execution/status/index.d.ts +18 -0
  184. package/lib/service/high5/execution/status/index.js +41 -0
  185. package/lib/service/high5/index.d.ts +22 -0
  186. package/lib/service/high5/index.js +39 -0
  187. package/lib/service/high5/internal/index.d.ts +9 -0
  188. package/lib/service/high5/internal/index.js +29 -0
  189. package/lib/service/high5/internal/space/index.d.ts +21 -0
  190. package/lib/service/high5/internal/space/index.js +41 -0
  191. package/lib/service/high5/joinToken/index.d.ts +40 -0
  192. package/lib/service/high5/joinToken/index.js +64 -0
  193. package/lib/service/high5/space/event/index.d.ts +56 -0
  194. package/lib/service/high5/space/event/index.js +89 -0
  195. package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +31 -0
  196. package/lib/service/high5/space/event/stream/design/DesignOperations.js +117 -0
  197. package/lib/service/high5/space/event/stream/design/index.d.ts +38 -0
  198. package/lib/service/high5/space/event/stream/design/index.js +56 -0
  199. package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +62 -0
  200. package/lib/service/high5/space/event/stream/design/snapshot/index.js +100 -0
  201. package/lib/service/high5/space/event/stream/index.d.ts +114 -0
  202. package/lib/service/high5/space/event/stream/index.js +164 -0
  203. package/lib/service/high5/space/execution/index.d.ts +48 -0
  204. package/lib/service/high5/space/execution/index.js +74 -0
  205. package/lib/service/high5/space/execution/log/index.d.ts +31 -0
  206. package/lib/service/high5/space/execution/log/index.js +57 -0
  207. package/lib/service/high5/space/execution/status/index.d.ts +16 -0
  208. package/lib/service/high5/space/execution/status/index.js +34 -0
  209. package/lib/service/high5/space/index.d.ts +107 -0
  210. package/lib/service/high5/space/index.js +160 -0
  211. package/lib/service/high5/space/node/index.d.ts +58 -0
  212. package/lib/service/high5/space/node/index.js +116 -0
  213. package/lib/service/high5/space/secret/index.d.ts +60 -0
  214. package/lib/service/high5/space/secret/index.js +92 -0
  215. package/lib/service/high5/space/wave/index.d.ts +38 -0
  216. package/lib/service/high5/space/wave/index.js +66 -0
  217. package/lib/service/high5/space/webhook/index.d.ts +83 -0
  218. package/lib/service/high5/space/webhook/index.js +132 -0
  219. package/lib/service/high5/space/webhook/log/index.d.ts +18 -0
  220. package/lib/service/high5/space/webhook/log/index.js +38 -0
  221. package/lib/service/high5/wave/index.d.ts +8 -0
  222. package/lib/service/high5/wave/index.js +15 -0
  223. package/lib/service/high5/wave/s3/index.d.ts +48 -0
  224. package/lib/service/high5/wave/s3/index.js +88 -0
  225. package/lib/service/idp/index.d.ts +82 -0
  226. package/lib/service/idp/index.js +137 -0
  227. package/lib/service/idp/internal/index.d.ts +19 -0
  228. package/lib/service/idp/internal/index.js +34 -0
  229. package/lib/service/idp/oauth/index.d.ts +45 -0
  230. package/lib/service/idp/oauth/index.js +105 -0
  231. package/lib/service/idp/organization/index.d.ts +54 -0
  232. package/lib/service/idp/organization/index.js +79 -0
  233. package/lib/service/idp/organization/license/index.d.ts +7 -0
  234. package/lib/service/idp/organization/license/index.js +30 -0
  235. package/lib/service/idp/organization/member/index.d.ts +58 -0
  236. package/lib/service/idp/organization/member/index.js +96 -0
  237. package/lib/service/idp/organization/member/invitations/index.d.ts +79 -0
  238. package/lib/service/idp/organization/member/invitations/index.js +118 -0
  239. package/lib/service/idp/organization/settings/domain/index.d.ts +38 -0
  240. package/lib/service/idp/organization/settings/domain/index.js +63 -0
  241. package/lib/service/idp/organization/settings/domain/saml/index.d.ts +43 -0
  242. package/lib/service/idp/organization/settings/domain/saml/index.js +88 -0
  243. package/lib/service/idp/organization/settings/index.d.ts +16 -0
  244. package/lib/service/idp/organization/settings/index.js +16 -0
  245. package/lib/service/idp/organization/settings/oauth/index.d.ts +64 -0
  246. package/lib/service/idp/organization/settings/oauth/index.js +106 -0
  247. package/lib/service/idp/organization/team/index.d.ts +72 -0
  248. package/lib/service/idp/organization/team/index.js +115 -0
  249. package/lib/service/idp/registration/index.d.ts +39 -0
  250. package/lib/service/idp/registration/index.js +84 -0
  251. package/lib/service/idp/user/index.d.ts +82 -0
  252. package/lib/service/idp/user/index.js +125 -0
  253. package/lib/service/idp/user/license/index.d.ts +7 -0
  254. package/lib/service/idp/user/license/index.js +30 -0
  255. package/lib/service/idp/user/password/index.d.ts +19 -0
  256. package/lib/service/idp/user/password/index.js +52 -0
  257. package/lib/service/idp/user/settings/connections/index.d.ts +15 -0
  258. package/lib/service/idp/user/settings/connections/index.js +33 -0
  259. package/lib/service/idp/user/settings/general/index.d.ts +18 -0
  260. package/lib/service/idp/user/settings/general/index.js +39 -0
  261. package/lib/service/idp/user/settings/index.d.ts +36 -0
  262. package/lib/service/idp/user/settings/index.js +25 -0
  263. package/lib/service/idp/user/settings/notifications/index.d.ts +18 -0
  264. package/lib/service/idp/user/settings/notifications/index.js +39 -0
  265. package/lib/service/idp/user/settings/oauthApps/index.d.ts +22 -0
  266. package/lib/service/idp/user/settings/oauthApps/index.js +54 -0
  267. package/lib/service/idp/user/settings/pats/index.d.ts +50 -0
  268. package/lib/service/idp/user/settings/pats/index.js +93 -0
  269. package/lib/service/idp/user/settings/twoFactor/index.d.ts +11 -0
  270. package/lib/service/idp/user/settings/twoFactor/index.js +15 -0
  271. package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +34 -0
  272. package/lib/service/idp/user/settings/twoFactor/totp/index.js +65 -0
  273. package/lib/service/mailer/index.d.ts +14 -0
  274. package/lib/service/mailer/index.js +31 -0
  275. package/lib/service/mailer/internal/index.d.ts +36 -0
  276. package/lib/service/mailer/internal/index.js +64 -0
  277. package/lib/service/mothership/index.d.ts +97 -0
  278. package/lib/service/mothership/index.js +136 -0
  279. package/lib/service/nats/index.d.ts +51 -0
  280. package/lib/service/nats/index.js +138 -0
  281. package/lib/utils/Types.d.ts +1 -0
  282. package/lib/utils/Types.js +2 -0
  283. package/lib/utils/bouncer/features/Provider.d.ts +16 -0
  284. package/lib/utils/bouncer/features/Provider.js +83 -0
  285. package/package.json +36 -27
  286. package/lib/base.d.ts +0 -12
  287. package/lib/base.js +0 -8
  288. package/lib/hcloud.d.ts +0 -11
  289. package/lib/hcloud.js +0 -27
  290. package/lib/interfaces/Auditor.d.ts +0 -40
  291. package/lib/interfaces/Global.d.ts +0 -8
  292. package/lib/interfaces/IDP.d.ts +0 -9
  293. package/lib/service/Auditor.d.ts +0 -42
  294. package/lib/service/Auditor.js +0 -101
  295. package/lib/service/High5.d.ts +0 -4
  296. package/lib/service/High5.js +0 -9
  297. package/lib/service/IDP.d.ts +0 -39
  298. package/lib/service/IDP.js +0 -84
  299. /package/lib/interfaces/{Global.js → agent/bundle/dev/index.js} +0 -0
  300. /package/lib/interfaces/{IDP.js → agent/context/index.js} +0 -0
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const Base_1 = require("../../../Base");
13
+ class MailerInternal extends Base_1.default {
14
+ constructor() {
15
+ super(...arguments);
16
+ /**
17
+ * Sends a new mail based on a mailjet template.
18
+ *
19
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
20
+ * @param mail MailjetMailDTO
21
+ */
22
+ this.sendMailMailjet = (mail) => __awaiter(this, void 0, void 0, function* () {
23
+ const resp = yield this.axios.post(this.getEndpoint("/v1/send/mailjet"), mail);
24
+ return resp.data;
25
+ });
26
+ /**
27
+ * Sends a new mail based on a mustache html body.
28
+ *
29
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
30
+ * @param mail TemplateMail
31
+ * @deprecated in favor of sendMailMailjet
32
+ */
33
+ this.sendMailMustache = (mail) => __awaiter(this, void 0, void 0, function* () {
34
+ const resp = yield this.axios.post(this.getEndpoint("/v1/send/mustache"), mail);
35
+ return resp.data;
36
+ });
37
+ /**
38
+ * Sends a new mail based on a html body.
39
+ *
40
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
41
+ * @param mail TemplateMail
42
+ * @deprecated in favor of sendMailMailjet
43
+ */
44
+ this.sendMailHtml = (mail) => __awaiter(this, void 0, void 0, function* () {
45
+ const resp = yield this.axios.post(this.getEndpoint("/v1/send/html"), mail);
46
+ return resp.data;
47
+ });
48
+ /**
49
+ * Sends a new mail based on an existing template.
50
+ *
51
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
52
+ * @param mail TemplateMail
53
+ * @deprecated in favor of sendMailMailjet
54
+ */
55
+ this.sendMailTemplate = (mail) => __awaiter(this, void 0, void 0, function* () {
56
+ const resp = yield this.axios.post(this.getEndpoint("/v1/send/template"), mail);
57
+ return resp.data;
58
+ });
59
+ }
60
+ getEndpoint(endpoint) {
61
+ return `${this.options.server}/api/mailer/internal${endpoint}`;
62
+ }
63
+ }
64
+ exports.default = MailerInternal;
@@ -0,0 +1,97 @@
1
+ import { AxiosInstance } from "axios";
2
+ import Base, { Options } from "../../Base";
3
+ import { PaginatedResponse, SearchParams, Version } from "../../interfaces/global";
4
+ import { Agent, TargetAgent } from "../../interfaces/mothership";
5
+ type RecurrentInfo = Pick<Agent, "uptime" | "cpuUtilization" | "memoryUsed" | "status">;
6
+ type HelloInfo = RecurrentInfo & {
7
+ nickname?: string;
8
+ bundleVersion: string;
9
+ };
10
+ export default class MothershipService extends Base {
11
+ constructor(options: Options, axios: AxiosInstance);
12
+ /**
13
+ * Requests the endpoint version
14
+ * @returns Version object
15
+ */
16
+ version: () => Promise<Version>;
17
+ /**
18
+ * Say hello as an agent to the mothership
19
+ *
20
+ * @param uuid Agent's UUID
21
+ * @param uuidSignature HMAC-SHA256 hash of the Agent's UUID using the Agent's secret as the key
22
+ * @param info Information about the agent's uuid, hardware and nickname
23
+ * @return an Agent object
24
+ */
25
+ hello: (uuid: string, uuidSignature: string, info: HelloInfo) => Promise<{
26
+ agent: Agent;
27
+ token: string;
28
+ }>;
29
+ /**
30
+ * Say hello again as an agent to the mothership.
31
+ *
32
+ * This call should only be made after an initial hello.
33
+ *
34
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
35
+ *
36
+ * @param info Information about the agent's system resources.
37
+ * @return an Agent object
38
+ */
39
+ helloAgain: (info: RecurrentInfo) => Promise<Agent>;
40
+ /**
41
+ * Register an agent to the mothership.
42
+ *
43
+ * This call should only be made once per agent, not once per agent session.
44
+ *
45
+ * @param uuid UUID of the Agent
46
+ * @param info Information about the agent's hardware and nickname.
47
+ * @param publicKey the public key of the agent that will be used for cryptography. The agent should remember its private key.
48
+ * @return an object holding a secret encrypted with the public key. The agent must decrypt it using its private key in order to use the /hello endpoint.
49
+ */
50
+ register: (uuid: string, info: Pick<Agent, Exclude<keyof Agent, "uuid" | "createDate" | "modifyDate" | "_id" | "ip">>, publicKey: string | Buffer) => Promise<{
51
+ secret: string;
52
+ }>;
53
+ /**
54
+ * Connect to an organization.
55
+ *
56
+ * This call should only be made after an initial hello.
57
+ *
58
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
59
+ *
60
+ * @param orgName Name of the organization
61
+ * @param memberToken JWT assigned to a member of the organization
62
+ * @param email Email of the user owner of the JWT
63
+ */
64
+ connect: (orgName: string, memberToken: string, email: string) => Promise<void>;
65
+ /**
66
+ * Disconnect from an organization.
67
+ *
68
+ * This call should only be made after an initial hello.
69
+ *
70
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
71
+ *
72
+ * @param orgName Name of the organization
73
+ * @param email Email of the user
74
+ */
75
+ disconnect: (orgName: string, email: string) => Promise<void>;
76
+ /**
77
+ * Disconnect as a target.
78
+ *
79
+ * This call should only be made after an initial hello.
80
+ *
81
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
82
+ *
83
+ * @param email Email of the target
84
+ */
85
+ disconnectTarget: (email: string) => Promise<void>;
86
+ /**
87
+ * Search among the available targets for a given organization.
88
+ *
89
+ * @param orgName Name of the organization
90
+ * @returns Object containing an array of retrieved agents and the total number of available found in the database (independent of limit and page)
91
+ */
92
+ searchAvailableTargets: ({ orgName, filters, sorting, limit, page, }: SearchParams & {
93
+ orgName: string;
94
+ }) => Promise<PaginatedResponse<TargetAgent>>;
95
+ protected getEndpoint(endpoint: string): string;
96
+ }
97
+ export {};
@@ -0,0 +1,136 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const Base_1 = require("../../Base");
13
+ const paginatedResponseHelper_1 = require("../../helper/paginatedResponseHelper");
14
+ const searchFilter_1 = require("../../helper/searchFilter");
15
+ class MothershipService extends Base_1.default {
16
+ constructor(options, axios) {
17
+ super(options, axios);
18
+ /**
19
+ * Requests the endpoint version
20
+ * @returns Version object
21
+ */
22
+ this.version = () => __awaiter(this, void 0, void 0, function* () {
23
+ const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
24
+ return resp.data;
25
+ });
26
+ /**
27
+ * Say hello as an agent to the mothership
28
+ *
29
+ * @param uuid Agent's UUID
30
+ * @param uuidSignature HMAC-SHA256 hash of the Agent's UUID using the Agent's secret as the key
31
+ * @param info Information about the agent's uuid, hardware and nickname
32
+ * @return an Agent object
33
+ */
34
+ this.hello = (uuid, uuidSignature, info) => __awaiter(this, void 0, void 0, function* () {
35
+ const resp = yield this.axios.post(this.getEndpoint("/v1/hello"), info, {
36
+ headers: {
37
+ Authorization: `Bearer ${uuid}.${uuidSignature}`,
38
+ },
39
+ });
40
+ return { agent: resp.data, token: resp.headers.authorization };
41
+ });
42
+ /**
43
+ * Say hello again as an agent to the mothership.
44
+ *
45
+ * This call should only be made after an initial hello.
46
+ *
47
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
48
+ *
49
+ * @param info Information about the agent's system resources.
50
+ * @return an Agent object
51
+ */
52
+ this.helloAgain = (info) => __awaiter(this, void 0, void 0, function* () {
53
+ const resp = yield this.axios.patch(this.getEndpoint("/v1/hello/again"), info);
54
+ return resp.data;
55
+ });
56
+ /**
57
+ * Register an agent to the mothership.
58
+ *
59
+ * This call should only be made once per agent, not once per agent session.
60
+ *
61
+ * @param uuid UUID of the Agent
62
+ * @param info Information about the agent's hardware and nickname.
63
+ * @param publicKey the public key of the agent that will be used for cryptography. The agent should remember its private key.
64
+ * @return an object holding a secret encrypted with the public key. The agent must decrypt it using its private key in order to use the /hello endpoint.
65
+ */
66
+ // eslint-disable-next-line complexity
67
+ this.register = (uuid, info, publicKey) => __awaiter(this, void 0, void 0, function* () {
68
+ if (typeof publicKey !== "string") {
69
+ publicKey = publicKey.toString("hex");
70
+ }
71
+ const resp = yield this.axios.post(this.getEndpoint("/v1/register"), Object.assign({ uuid, publicKey }, info));
72
+ return resp.data;
73
+ });
74
+ /**
75
+ * Connect to an organization.
76
+ *
77
+ * This call should only be made after an initial hello.
78
+ *
79
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
80
+ *
81
+ * @param orgName Name of the organization
82
+ * @param memberToken JWT assigned to a member of the organization
83
+ * @param email Email of the user owner of the JWT
84
+ */
85
+ this.connect = (orgName, memberToken, email) => __awaiter(this, void 0, void 0, function* () {
86
+ yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/connect`), { memberToken, email });
87
+ });
88
+ /**
89
+ * Disconnect from an organization.
90
+ *
91
+ * This call should only be made after an initial hello.
92
+ *
93
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
94
+ *
95
+ * @param orgName Name of the organization
96
+ * @param email Email of the user
97
+ */
98
+ this.disconnect = (orgName, email) => __awaiter(this, void 0, void 0, function* () {
99
+ yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/connect/${email}`));
100
+ });
101
+ /**
102
+ * Disconnect as a target.
103
+ *
104
+ * This call should only be made after an initial hello.
105
+ *
106
+ * The session token obtained in the hello endpoint must be used here. Use the setAuthToken method to do so.
107
+ *
108
+ * @param email Email of the target
109
+ */
110
+ this.disconnectTarget = (email) => __awaiter(this, void 0, void 0, function* () {
111
+ yield this.axios.delete(this.getEndpoint(`/v1/connect/${email}`));
112
+ });
113
+ /**
114
+ * Search among the available targets for a given organization.
115
+ *
116
+ * @param orgName Name of the organization
117
+ * @returns Object containing an array of retrieved agents and the total number of available found in the database (independent of limit and page)
118
+ */
119
+ this.searchAvailableTargets = (_a) => __awaiter(this, [_a], void 0, function* ({ orgName, filters, sorting, limit = 25, page = 0, }) {
120
+ const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
121
+ return new searchFilter_1.SearchFilterDTO(f);
122
+ });
123
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/connect/search`), {
124
+ filters: filtersDTO,
125
+ sorting,
126
+ }, {
127
+ params: { limit, page },
128
+ });
129
+ return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
130
+ });
131
+ }
132
+ getEndpoint(endpoint) {
133
+ return `${this.options.server}/api/mothership${endpoint}`;
134
+ }
135
+ }
136
+ exports.default = MothershipService;
@@ -0,0 +1,51 @@
1
+ import { AxiosInstance } from "axios";
2
+ import { Msg, NatsConnection, PublishOptions, RequestOptions, Subscription, SubscriptionOptions } from "nats";
3
+ import Base, { Options } from "../../Base";
4
+ import { NatsCallback, NatsMessageType, NatsObject, NatsObjectType, RawMsg } from "../../interfaces/nats";
5
+ /**
6
+ * Connect and authenticate using email and jwt
7
+ *
8
+ * to use websocket from within node, forceWebsocket can be used.
9
+ * A websocket library is required to be pre-installed and needs to be set as global:
10
+ * import WebSocket from "ws";
11
+ * Object.assign(global, { WebSocket: WebSocket });
12
+ */
13
+ type ConnectParamsJwt = {
14
+ email: string;
15
+ jwt: string;
16
+ servers?: string[];
17
+ debug?: boolean;
18
+ forceWebsocket?: boolean;
19
+ };
20
+ /**
21
+ * Connect and authenticate using username and password
22
+ * Can only be used with the CUSTOM_AUTH admin!
23
+ *
24
+ * to use websocket from within node, forceWebsocket can be used.
25
+ * A websocket library is required to be pre-installed and needs to be set as global:
26
+ * import WebSocket from "ws";
27
+ * Object.assign(global, { WebSocket: WebSocket });
28
+ */
29
+ type ConnectParamsPassword = {
30
+ username: string;
31
+ password: string;
32
+ servers?: string[];
33
+ debug?: boolean;
34
+ forceWebsocket?: boolean;
35
+ };
36
+ declare class Nats extends Base {
37
+ private natsConnection;
38
+ private subMap;
39
+ private connection;
40
+ constructor(options: Options, axios: AxiosInstance);
41
+ connect(params: ConnectParamsJwt | ConnectParamsPassword): Promise<NatsConnection>;
42
+ getConnection: () => NatsConnection | undefined;
43
+ sub(subject: string, callback: NatsCallback, options?: SubscriptionOptions): Promise<Subscription>;
44
+ unsub(subject: string | Subscription): void;
45
+ publish(subject: string, type: NatsMessageType, objectType: NatsObjectType, object: NatsObject, options?: PublishOptions): void;
46
+ request(subject: string, type: NatsMessageType, objectType: NatsObjectType, object: unknown, options?: RequestOptions): void;
47
+ requestAndWaitForResponse(subject: string, type: NatsMessageType, objectType: NatsObjectType, object: unknown, options?: RequestOptions): Promise<Msg | undefined>;
48
+ respond(msg: Msg | RawMsg, data: unknown): void;
49
+ protected getEndpoint(endpoint: string): string;
50
+ }
51
+ export default Nats;
@@ -0,0 +1,138 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ const nats_1 = require("nats");
13
+ const nats_ws_1 = require("nats.ws");
14
+ const Base_1 = require("../../Base");
15
+ const isBrowser = typeof window !== "undefined";
16
+ class Nats extends Base_1.default {
17
+ constructor(options, axios) {
18
+ super(options, axios);
19
+ this.subMap = [];
20
+ this.connection = isBrowser ? nats_ws_1.connect : nats_1.connect;
21
+ this.getConnection = () => {
22
+ return this.natsConnection;
23
+ };
24
+ }
25
+ // eslint-disable-next-line complexity
26
+ connect(params) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ if (params.forceWebsocket) {
29
+ this.connection = nats_ws_1.connect;
30
+ }
31
+ if (!params.servers) {
32
+ // set defaults if servers array is empty
33
+ if (isBrowser) {
34
+ // default via traefik exposed servers
35
+ params.servers = [this.getEndpoint("/v1/0"), this.getEndpoint("/v1/1"), this.getEndpoint("/v1/2")];
36
+ }
37
+ else {
38
+ // default kubernetes internal servers
39
+ params.servers = ["hcloud-nats-0.hcloud-nats:4222", "hcloud-nats-1.hcloud-nats:4222", "hcloud-nats-2.hcloud-nats:4222"];
40
+ }
41
+ }
42
+ this.natsConnection = yield this.connection({
43
+ debug: params.debug,
44
+ maxReconnectAttempts: -1,
45
+ servers: params.servers,
46
+ pingInterval: 55 * 1000, //ping every 55 seconds
47
+ user: params.email !== undefined ? params.email : params.username,
48
+ pass: params.jwt !== undefined ? params.jwt : params.password,
49
+ });
50
+ return this.natsConnection;
51
+ });
52
+ }
53
+ sub(subject, callback, options) {
54
+ var _a;
55
+ let delay = 0;
56
+ if (!this.getConnection() || ((_a = this.getConnection()) === null || _a === void 0 ? void 0 : _a.isClosed())) {
57
+ delay = 3000;
58
+ }
59
+ // add delay just in case the connection has not been established yet
60
+ return new Promise((resolve, reject) => {
61
+ const newOptions = Object.assign(Object.assign({}, options), { callback: (err, msg) => {
62
+ if (err !== null) {
63
+ try {
64
+ callback(err);
65
+ }
66
+ catch (ignored) {
67
+ // ignore callback errors
68
+ }
69
+ return;
70
+ }
71
+ let parsedData;
72
+ try {
73
+ const data = new TextDecoder("utf-8").decode(msg.data);
74
+ parsedData = JSON.parse(data);
75
+ }
76
+ catch (e) {
77
+ callback(e);
78
+ return;
79
+ }
80
+ try {
81
+ callback(null, parsedData, msg);
82
+ }
83
+ catch (ignored) {
84
+ // ignore callback errors
85
+ }
86
+ } });
87
+ setTimeout(() => {
88
+ var _a, _b;
89
+ if (!this.getConnection() || !((_a = this.getConnection()) === null || _a === void 0 ? void 0 : _a.isClosed)) {
90
+ reject(new Error("connection not established, can not subscribe"));
91
+ }
92
+ const sub = (_b = this.getConnection()) === null || _b === void 0 ? void 0 : _b.subscribe(subject, newOptions);
93
+ if (sub) {
94
+ this.subMap.push({ subject, sub: sub });
95
+ return resolve(sub);
96
+ }
97
+ return reject(new Error("could not subscribe"));
98
+ }, delay);
99
+ });
100
+ }
101
+ unsub(subject) {
102
+ if (typeof subject === "string") {
103
+ this.subMap.forEach((s) => {
104
+ if (s.subject === subject) {
105
+ s.sub.unsubscribe();
106
+ }
107
+ });
108
+ }
109
+ else {
110
+ subject === null || subject === void 0 ? void 0 : subject.unsubscribe();
111
+ }
112
+ }
113
+ publish(subject, type, objectType, object, options) {
114
+ var _a;
115
+ const data = new TextEncoder().encode(JSON.stringify({ type: type, objectType: objectType, object: object }));
116
+ (_a = this.getConnection()) === null || _a === void 0 ? void 0 : _a.publish(subject, data, options);
117
+ }
118
+ request(subject, type, objectType, object, options) {
119
+ var _a;
120
+ const data = new TextEncoder().encode(JSON.stringify({ type: type, objectType: objectType, object: object }));
121
+ (_a = this.getConnection()) === null || _a === void 0 ? void 0 : _a.request(subject, data, options);
122
+ }
123
+ requestAndWaitForResponse(subject, type, objectType, object, options) {
124
+ return __awaiter(this, void 0, void 0, function* () {
125
+ var _a;
126
+ const data = new TextEncoder().encode(JSON.stringify({ type: type, objectType: objectType, object: object }));
127
+ return ((_a = this.getConnection()) === null || _a === void 0 ? void 0 : _a.request(subject, data, options)) || undefined;
128
+ });
129
+ }
130
+ respond(msg, data) {
131
+ const encodedData = new TextEncoder().encode(JSON.stringify(data));
132
+ msg.respond(encodedData);
133
+ }
134
+ getEndpoint(endpoint) {
135
+ return `${this.options.server}/ws/nats${endpoint}`;
136
+ }
137
+ }
138
+ exports.default = Nats;
@@ -0,0 +1 @@
1
+ export type Select<T, Mandatory extends keyof T, Optional extends keyof T> = Pick<T, Mandatory> & Partial<Pick<T, Optional>>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,16 @@
1
+ import { BouncerContext, HcloudFeature } from "../../../interfaces/bouncer";
2
+ export type BouncerProviderLogger = (featureName: string, defaultValue: boolean, result: boolean, context?: BouncerContext, feature?: HcloudFeature) => void;
3
+ export declare class BouncerProvider {
4
+ private features;
5
+ private context?;
6
+ private logger?;
7
+ constructor(features: HcloudFeature[], context?: BouncerContext, logger?: BouncerProviderLogger);
8
+ isEnabled(featureName: string, defaultValue: boolean, context?: BouncerContext): boolean;
9
+ addFeature(feature: HcloudFeature): void;
10
+ setFeatures(features: HcloudFeature[]): void;
11
+ setContext(context: BouncerContext): void;
12
+ updateContext({ region, email, organization }: BouncerContext): void;
13
+ private doesMatchRegion;
14
+ private doesMatchUser;
15
+ private doesMatchOrganization;
16
+ }
@@ -0,0 +1,83 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.BouncerProvider = void 0;
4
+ class BouncerProvider {
5
+ constructor(features, context, logger) {
6
+ this.features = features;
7
+ this.context = context;
8
+ this.logger = logger;
9
+ }
10
+ /* eslint-disable complexity */
11
+ isEnabled(featureName, defaultValue, context) {
12
+ const feature = this.features.find(f => f.feature.name === featureName);
13
+ let result = defaultValue;
14
+ if (feature) {
15
+ result =
16
+ feature.feature.enabled &&
17
+ this.doesMatchOrganization(feature, context !== null && context !== void 0 ? context : this.context) &&
18
+ this.doesMatchUser(feature, context !== null && context !== void 0 ? context : this.context) &&
19
+ this.doesMatchRegion(feature, context !== null && context !== void 0 ? context : this.context);
20
+ }
21
+ if (this.logger) {
22
+ this.logger(featureName, defaultValue, result, context !== null && context !== void 0 ? context : this.context, feature);
23
+ }
24
+ return result;
25
+ }
26
+ addFeature(feature) {
27
+ this.features.push(feature);
28
+ }
29
+ setFeatures(features) {
30
+ this.features = features;
31
+ }
32
+ setContext(context) {
33
+ this.context = context;
34
+ }
35
+ updateContext({ region, email, organization }) {
36
+ if (!this.context) {
37
+ this.context = {
38
+ email,
39
+ organization,
40
+ region,
41
+ };
42
+ }
43
+ else {
44
+ this.context.email = email !== null && email !== void 0 ? email : this.context.email;
45
+ this.context.organization = organization !== null && organization !== void 0 ? organization : this.context.organization;
46
+ this.context.region = region !== null && region !== void 0 ? region : this.context.region;
47
+ }
48
+ }
49
+ /* eslint-disable @typescript-eslint/no-non-null-assertion*/
50
+ doesMatchRegion(feature, context) {
51
+ if (feature.regions.length) {
52
+ if (context === null || context === void 0 ? void 0 : context.region) {
53
+ return (feature.regions.map(r => r.replace("*", "(.+)")).find(r => r === (context === null || context === void 0 ? void 0 : context.region) || new RegExp(r).test(context.region)) !==
54
+ undefined);
55
+ }
56
+ return false;
57
+ }
58
+ return true;
59
+ }
60
+ /* eslint-disable @typescript-eslint/no-non-null-assertion*/
61
+ doesMatchUser(feature, context) {
62
+ if (feature.users.length) {
63
+ if (context === null || context === void 0 ? void 0 : context.email) {
64
+ return (feature.users.map(u => u.replace("*", "(.+)")).find(u => u === context.email || new RegExp(u).test(context.email)) !== undefined);
65
+ }
66
+ return false;
67
+ }
68
+ return true;
69
+ }
70
+ /* eslint-disable @typescript-eslint/no-non-null-assertion*/
71
+ doesMatchOrganization(feature, context) {
72
+ if (feature.organizations.length) {
73
+ if (context === null || context === void 0 ? void 0 : context.organization) {
74
+ return (feature.organizations
75
+ .map(o => o.replace("*", "(.+)"))
76
+ .find(o => o === context.organization || new RegExp(o).test(context.organization)) !== undefined);
77
+ }
78
+ return false;
79
+ }
80
+ return true;
81
+ }
82
+ }
83
+ exports.BouncerProvider = BouncerProvider;