hcloud-sdk 16.0.0 → 18.0.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 (291) hide show
  1. package/changelog.md +178 -51
  2. package/lib/Base.d.ts +2 -1
  3. package/lib/Hcloud.d.ts +6 -0
  4. package/lib/Hcloud.js +18 -0
  5. package/lib/helper/ValidationHelper.d.ts +74 -0
  6. package/lib/helper/ValidationHelper.js +360 -0
  7. package/lib/interfaces/auditor/index.d.ts +17 -2
  8. package/lib/interfaces/auditor/index.js +12 -0
  9. package/lib/interfaces/cosmo/asset/index.d.ts +185 -0
  10. package/lib/interfaces/cosmo/asset/index.js +82 -0
  11. package/lib/interfaces/cosmo/comment/index.d.ts +38 -0
  12. package/lib/interfaces/cosmo/comment/index.js +8 -0
  13. package/lib/interfaces/cosmo/event/index.d.ts +31 -0
  14. package/lib/interfaces/cosmo/event/index.js +17 -0
  15. package/lib/interfaces/cosmo/location/index.d.ts +4 -0
  16. package/lib/interfaces/cosmo/location/index.js +2 -0
  17. package/lib/interfaces/cosmo/namespace/index.d.ts +9 -0
  18. package/lib/interfaces/cosmo/namespace/index.js +9 -0
  19. package/lib/interfaces/cosmo/permissions.d.ts +96 -0
  20. package/lib/interfaces/cosmo/permissions.js +58 -0
  21. package/lib/interfaces/cosmo/share/index.d.ts +28 -0
  22. package/lib/interfaces/cosmo/share/index.js +2 -0
  23. package/lib/interfaces/cosmo/space/index.d.ts +25 -0
  24. package/lib/interfaces/cosmo/space/index.js +2 -0
  25. package/lib/interfaces/cosmo/tag/tag.d.ts +12 -0
  26. package/lib/interfaces/cosmo/tag/tag.js +2 -0
  27. package/lib/interfaces/frontend/config/index.d.ts +1 -0
  28. package/lib/interfaces/fuse/space/index.d.ts +1 -0
  29. package/lib/interfaces/global/Products.d.ts +3 -1
  30. package/lib/interfaces/global/Products.js +2 -0
  31. package/lib/interfaces/global/Views.d.ts +2 -1
  32. package/lib/interfaces/global/Views.js +1 -0
  33. package/lib/interfaces/high5/execution/index.d.ts +23 -2
  34. package/lib/interfaces/high5/execution/index.js +2 -0
  35. package/lib/interfaces/high5/index.d.ts +7 -7
  36. package/lib/interfaces/high5/index.js +7 -7
  37. package/lib/interfaces/high5/space/database/document/index.d.ts +34 -0
  38. package/lib/interfaces/high5/space/database/document/index.js +14 -0
  39. package/lib/interfaces/high5/space/database/index.d.ts +12 -0
  40. package/lib/interfaces/high5/space/database/index.js +2 -0
  41. package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +9 -2
  42. package/lib/interfaces/high5/space/event/stream/node/index.d.ts +10 -2
  43. package/lib/interfaces/high5/space/event/stream/node/index.js +6 -1
  44. package/lib/interfaces/high5/space/execution/index.d.ts +56 -2
  45. package/lib/interfaces/high5/space/execution/index.js +8 -0
  46. package/lib/interfaces/high5/space/index.d.ts +2 -0
  47. package/lib/interfaces/high5/space/job/JobLog.d.ts +16 -0
  48. package/lib/interfaces/high5/space/job/JobLog.js +2 -0
  49. package/lib/interfaces/high5/space/job/index.d.ts +38 -0
  50. package/lib/interfaces/high5/space/job/index.js +8 -0
  51. package/lib/interfaces/high5/space/pool/index.d.ts +5 -7
  52. package/lib/interfaces/high5/space/pool/index.js +0 -7
  53. package/lib/interfaces/high5/space/webhook/index.d.ts +3 -1
  54. package/lib/interfaces/high5/stats.d.ts +21 -0
  55. package/lib/interfaces/high5/stats.js +2 -0
  56. package/lib/interfaces/high5/wave/index.d.ts +8 -3
  57. package/lib/interfaces/idp/index.d.ts +1 -0
  58. package/lib/interfaces/idp/index.js +1 -0
  59. package/lib/interfaces/idp/oauth/index.d.ts +4 -3
  60. package/lib/interfaces/idp/organization/index.d.ts +1 -0
  61. package/lib/interfaces/idp/organization/index.js +1 -0
  62. package/lib/interfaces/idp/organization/license/index.d.ts +13 -0
  63. package/lib/interfaces/idp/organization/member/index.d.ts +2 -0
  64. package/lib/interfaces/idp/organization/service-accounts.d.ts +8 -0
  65. package/lib/interfaces/idp/organization/service-accounts.js +2 -0
  66. package/lib/interfaces/idp/organization/stats.d.ts +7 -0
  67. package/lib/interfaces/idp/organization/stats.js +2 -0
  68. package/lib/interfaces/idp/organization/team/index.d.ts +0 -1
  69. package/lib/interfaces/idp/user/GeneralSettings.d.ts +1 -0
  70. package/lib/interfaces/idp/user/GeneralSettings.js +1 -0
  71. package/lib/interfaces/idp/user/Message.d.ts +21 -0
  72. package/lib/interfaces/idp/user/Message.js +14 -0
  73. package/lib/interfaces/idp/user/NotificationSettings.d.ts +1 -0
  74. package/lib/interfaces/idp/user/Scopes.d.ts +8 -2
  75. package/lib/interfaces/idp/user/Scopes.js +9 -0
  76. package/lib/interfaces/idp/user/index.d.ts +2 -1
  77. package/lib/interfaces/mailer/index.d.ts +30 -1
  78. package/lib/interfaces/mailer/index.js +87 -1
  79. package/lib/interfaces/mothership/index.d.ts +3 -1
  80. package/lib/interfaces/mothership/index.js +15 -0
  81. package/lib/interfaces/mothership/stats.d.ts +4 -0
  82. package/lib/interfaces/mothership/stats.js +2 -0
  83. package/lib/interfaces/nats/index.d.ts +98 -9
  84. package/lib/interfaces/nats/index.js +136 -19
  85. package/lib/interfaces/shorts/index.d.ts +10 -0
  86. package/lib/interfaces/shorts/index.js +2 -0
  87. package/lib/service/agent/bundle/dev/index.d.ts +16 -6
  88. package/lib/service/agent/bundle/dev/index.js +12 -10
  89. package/lib/service/agent/bundle/index.d.ts +10 -4
  90. package/lib/service/agent/bundle/index.js +6 -6
  91. package/lib/service/agent/context/index.d.ts +26 -7
  92. package/lib/service/agent/context/index.js +27 -12
  93. package/lib/service/auditor/index.d.ts +8 -4
  94. package/lib/service/auditor/index.js +5 -5
  95. package/lib/service/auditor/internal/index.d.ts +27 -3
  96. package/lib/service/auditor/internal/index.js +34 -5
  97. package/lib/service/bouncer/features/index.d.ts +4 -2
  98. package/lib/service/bouncer/features/index.js +2 -2
  99. package/lib/service/cosmo/asset/index.d.ts +219 -0
  100. package/lib/service/cosmo/asset/index.js +314 -0
  101. package/lib/service/cosmo/comment/index.d.ts +122 -0
  102. package/lib/service/cosmo/comment/index.js +161 -0
  103. package/lib/service/cosmo/event/index.d.ts +23 -0
  104. package/lib/service/cosmo/event/index.js +40 -0
  105. package/lib/service/cosmo/folder/index.d.ts +27 -0
  106. package/lib/service/cosmo/folder/index.js +47 -0
  107. package/lib/service/cosmo/index.d.ts +49 -0
  108. package/lib/service/cosmo/index.js +119 -0
  109. package/lib/service/cosmo/internal/index.d.ts +7 -0
  110. package/lib/service/cosmo/internal/index.js +17 -0
  111. package/lib/service/cosmo/internal/space/index.d.ts +15 -0
  112. package/lib/service/cosmo/internal/space/index.js +34 -0
  113. package/lib/service/cosmo/location/index.d.ts +40 -0
  114. package/lib/service/cosmo/location/index.js +63 -0
  115. package/lib/service/cosmo/namespace/index.d.ts +42 -0
  116. package/lib/service/cosmo/namespace/index.js +65 -0
  117. package/lib/service/cosmo/organization/index.d.ts +47 -0
  118. package/lib/service/cosmo/organization/index.js +64 -0
  119. package/lib/service/cosmo/permissions/index.d.ts +131 -0
  120. package/lib/service/cosmo/permissions/index.js +181 -0
  121. package/lib/service/cosmo/production/index.d.ts +26 -0
  122. package/lib/service/cosmo/production/index.js +45 -0
  123. package/lib/service/cosmo/share/index.d.ts +161 -0
  124. package/lib/service/cosmo/share/index.js +215 -0
  125. package/lib/service/cosmo/space/index.d.ts +104 -0
  126. package/lib/service/cosmo/space/index.js +146 -0
  127. package/lib/service/cosmo/tag/index.d.ts +67 -0
  128. package/lib/service/cosmo/tag/index.js +93 -0
  129. package/lib/service/dali/DaliAvatar.d.ts +12 -0
  130. package/lib/service/dali/DaliAvatar.js +20 -0
  131. package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +32 -0
  132. package/lib/service/dali/avatar/DaliCosmoSpace.js +59 -0
  133. package/lib/service/dali/avatar/DaliFuseSpace.d.ts +10 -4
  134. package/lib/service/dali/avatar/DaliFuseSpace.js +7 -6
  135. package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +10 -4
  136. package/lib/service/dali/avatar/DaliHigh5Pool.js +7 -6
  137. package/lib/service/dali/avatar/DaliHigh5Space.d.ts +10 -4
  138. package/lib/service/dali/avatar/DaliHigh5Space.js +7 -6
  139. package/lib/service/dali/avatar/DaliOAuthApp.d.ts +10 -4
  140. package/lib/service/dali/avatar/DaliOAuthApp.js +7 -6
  141. package/lib/service/dali/avatar/DaliOrganization.d.ts +10 -4
  142. package/lib/service/dali/avatar/DaliOrganization.js +7 -6
  143. package/lib/service/dali/avatar/DaliServiceAccount.d.ts +32 -0
  144. package/lib/service/dali/avatar/DaliServiceAccount.js +59 -0
  145. package/lib/service/dali/avatar/DaliTeam.d.ts +10 -4
  146. package/lib/service/dali/avatar/DaliTeam.js +7 -6
  147. package/lib/service/dali/avatar/DaliUser.d.ts +10 -4
  148. package/lib/service/dali/avatar/DaliUser.js +7 -6
  149. package/lib/service/dali/index.d.ts +4 -5
  150. package/lib/service/dali/index.js +2 -5
  151. package/lib/service/fuse/index.d.ts +4 -2
  152. package/lib/service/fuse/index.js +2 -2
  153. package/lib/service/fuse/internal/index.d.ts +4 -2
  154. package/lib/service/fuse/internal/index.js +3 -2
  155. package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +4 -2
  156. package/lib/service/fuse/internal/space/cronjob/log/index.js +2 -2
  157. package/lib/service/fuse/internal/space/index.d.ts +7 -3
  158. package/lib/service/fuse/internal/space/index.js +6 -4
  159. package/lib/service/fuse/space/cronjob/index.d.ts +35 -13
  160. package/lib/service/fuse/space/cronjob/index.js +48 -50
  161. package/lib/service/fuse/space/cronjob/log/index.d.ts +8 -4
  162. package/lib/service/fuse/space/cronjob/log/index.js +5 -5
  163. package/lib/service/fuse/space/index.d.ts +27 -11
  164. package/lib/service/fuse/space/index.js +19 -18
  165. package/lib/service/high5/execution/index.d.ts +4 -2
  166. package/lib/service/high5/execution/index.js +3 -2
  167. package/lib/service/high5/execution/status/index.d.ts +5 -3
  168. package/lib/service/high5/execution/status/index.js +3 -3
  169. package/lib/service/high5/index.d.ts +7 -2
  170. package/lib/service/high5/index.js +9 -2
  171. package/lib/service/high5/internal/index.d.ts +4 -2
  172. package/lib/service/high5/internal/index.js +3 -2
  173. package/lib/service/high5/internal/space/index.d.ts +10 -3
  174. package/lib/service/high5/internal/space/index.js +13 -4
  175. package/lib/service/high5/internal/space/job/index.d.ts +7 -0
  176. package/lib/service/high5/internal/space/job/index.js +17 -0
  177. package/lib/service/high5/internal/space/job/log/index.d.ts +17 -0
  178. package/lib/service/high5/internal/space/job/log/index.js +34 -0
  179. package/lib/service/high5/joinToken/index.d.ts +14 -6
  180. package/lib/service/high5/joinToken/index.js +10 -9
  181. package/lib/service/high5/space/database/document/array/index.d.ts +73 -0
  182. package/lib/service/high5/space/database/document/array/index.js +102 -0
  183. package/lib/service/high5/space/database/document/index.d.ts +74 -0
  184. package/lib/service/high5/space/database/document/index.js +112 -0
  185. package/lib/service/high5/space/database/document/number/index.d.ts +51 -0
  186. package/lib/service/high5/space/database/document/number/index.js +77 -0
  187. package/lib/service/high5/space/database/index.d.ts +65 -0
  188. package/lib/service/high5/space/database/index.js +102 -0
  189. package/lib/service/high5/space/event/index.d.ts +17 -7
  190. package/lib/service/high5/space/event/index.js +12 -11
  191. package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +4 -2
  192. package/lib/service/high5/space/event/stream/design/DesignOperations.js +5 -3
  193. package/lib/service/high5/space/event/stream/design/index.d.ts +10 -4
  194. package/lib/service/high5/space/event/stream/design/index.js +7 -6
  195. package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +16 -6
  196. package/lib/service/high5/space/event/stream/design/snapshot/index.js +12 -10
  197. package/lib/service/high5/space/event/stream/index.d.ts +32 -12
  198. package/lib/service/high5/space/event/stream/index.js +22 -21
  199. package/lib/service/high5/space/execution/index.d.ts +22 -7
  200. package/lib/service/high5/space/execution/index.js +23 -12
  201. package/lib/service/high5/space/execution/log/index.d.ts +8 -4
  202. package/lib/service/high5/space/execution/log/index.js +5 -5
  203. package/lib/service/high5/space/execution/status/index.d.ts +18 -7
  204. package/lib/service/high5/space/execution/status/index.js +20 -8
  205. package/lib/service/high5/space/index.d.ts +56 -18
  206. package/lib/service/high5/space/index.js +65 -27
  207. package/lib/service/high5/space/job/index.d.ts +145 -0
  208. package/lib/service/high5/space/job/index.js +201 -0
  209. package/lib/service/high5/space/job/log/index.d.ts +35 -0
  210. package/lib/service/high5/space/job/log/index.js +58 -0
  211. package/lib/service/high5/space/node/index.d.ts +20 -8
  212. package/lib/service/high5/space/node/index.js +14 -13
  213. package/lib/service/high5/space/pool/index.d.ts +27 -11
  214. package/lib/service/high5/space/pool/index.js +19 -18
  215. package/lib/service/high5/space/secret/index.d.ts +17 -7
  216. package/lib/service/high5/space/secret/index.js +12 -11
  217. package/lib/service/high5/space/stat/index.d.ts +12 -0
  218. package/lib/service/high5/space/stat/index.js +31 -0
  219. package/lib/service/high5/space/wave/index.d.ts +16 -6
  220. package/lib/service/high5/space/wave/index.js +11 -10
  221. package/lib/service/high5/space/webhook/index.d.ts +32 -12
  222. package/lib/service/high5/space/webhook/index.js +25 -21
  223. package/lib/service/high5/space/webhook/log/index.d.ts +4 -2
  224. package/lib/service/high5/space/webhook/log/index.js +2 -2
  225. package/lib/service/high5/stat/index.d.ts +11 -0
  226. package/lib/service/high5/stat/index.js +30 -0
  227. package/lib/service/high5/wave/s3/index.d.ts +31 -8
  228. package/lib/service/high5/wave/s3/index.js +52 -24
  229. package/lib/service/idp/guest/index.d.ts +42 -0
  230. package/lib/service/idp/guest/index.js +66 -0
  231. package/lib/service/idp/index.d.ts +25 -7
  232. package/lib/service/idp/index.js +23 -12
  233. package/lib/service/idp/internal/index.d.ts +5 -3
  234. package/lib/service/idp/internal/index.js +5 -3
  235. package/lib/service/idp/oauth/index.d.ts +16 -6
  236. package/lib/service/idp/oauth/index.js +15 -15
  237. package/lib/service/idp/organization/index.d.ts +25 -5
  238. package/lib/service/idp/organization/index.js +29 -8
  239. package/lib/service/idp/organization/license/index.d.ts +7 -3
  240. package/lib/service/idp/organization/license/index.js +4 -4
  241. package/lib/service/idp/organization/member/index.d.ts +21 -8
  242. package/lib/service/idp/organization/member/index.js +16 -13
  243. package/lib/service/idp/organization/member/invitations/index.d.ts +23 -9
  244. package/lib/service/idp/organization/member/invitations/index.js +72 -59
  245. package/lib/service/idp/organization/service-accounts/index.d.ts +76 -0
  246. package/lib/service/idp/organization/service-accounts/index.js +109 -0
  247. package/lib/service/idp/organization/settings/domain/index.d.ts +13 -5
  248. package/lib/service/idp/organization/settings/domain/index.js +9 -8
  249. package/lib/service/idp/organization/settings/domain/saml/index.d.ts +16 -6
  250. package/lib/service/idp/organization/settings/domain/saml/index.js +19 -18
  251. package/lib/service/idp/organization/settings/oauth/index.d.ts +23 -9
  252. package/lib/service/idp/organization/settings/oauth/index.js +16 -15
  253. package/lib/service/idp/organization/stat/index.d.ts +11 -0
  254. package/lib/service/idp/organization/stat/index.js +30 -0
  255. package/lib/service/idp/organization/team/index.d.ts +22 -10
  256. package/lib/service/idp/organization/team/index.js +14 -13
  257. package/lib/service/idp/registration/index.d.ts +10 -4
  258. package/lib/service/idp/registration/index.js +15 -9
  259. package/lib/service/idp/user/index.d.ts +33 -11
  260. package/lib/service/idp/user/index.js +30 -16
  261. package/lib/service/idp/user/license/index.d.ts +7 -3
  262. package/lib/service/idp/user/license/index.js +4 -4
  263. package/lib/service/idp/user/message/index.d.ts +61 -0
  264. package/lib/service/idp/user/message/index.js +92 -0
  265. package/lib/service/idp/user/password/index.d.ts +4 -2
  266. package/lib/service/idp/user/password/index.js +3 -3
  267. package/lib/service/idp/user/settings/connections/index.d.ts +4 -2
  268. package/lib/service/idp/user/settings/connections/index.js +2 -2
  269. package/lib/service/idp/user/settings/general/index.d.ts +10 -4
  270. package/lib/service/idp/user/settings/general/index.js +6 -6
  271. package/lib/service/idp/user/settings/notifications/index.d.ts +7 -3
  272. package/lib/service/idp/user/settings/notifications/index.js +4 -4
  273. package/lib/service/idp/user/settings/oauthApps/index.d.ts +7 -3
  274. package/lib/service/idp/user/settings/oauthApps/index.js +6 -5
  275. package/lib/service/idp/user/settings/pats/index.d.ts +22 -8
  276. package/lib/service/idp/user/settings/pats/index.js +17 -15
  277. package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +16 -6
  278. package/lib/service/idp/user/settings/twoFactor/totp/index.js +13 -10
  279. package/lib/service/mailer/index.d.ts +4 -2
  280. package/lib/service/mailer/index.js +2 -2
  281. package/lib/service/mailer/internal/index.d.ts +13 -5
  282. package/lib/service/mailer/internal/index.js +8 -8
  283. package/lib/service/mothership/index.d.ts +35 -13
  284. package/lib/service/mothership/index.js +32 -18
  285. package/lib/service/nats/index.js +58 -44
  286. package/lib/service/shorts/index.d.ts +18 -0
  287. package/lib/service/shorts/index.js +38 -0
  288. package/lib/service/shorts/internal/index.d.ts +72 -0
  289. package/lib/service/shorts/internal/index.js +104 -0
  290. package/lib/utils/bouncer/features/Provider.js +0 -3
  291. package/package.json +22 -24
@@ -17,10 +17,10 @@ class MothershipService extends Base_1.default {
17
17
  * Requests the endpoint version
18
18
  * @returns Version object
19
19
  */
20
- version() {
20
+ version(raw) {
21
21
  return __awaiter(this, void 0, void 0, function* () {
22
22
  const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
23
- return resp.data;
23
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
24
24
  });
25
25
  }
26
26
  /**
@@ -31,14 +31,15 @@ class MothershipService extends Base_1.default {
31
31
  * @param info Information about the agent's uuid, hardware and nickname
32
32
  * @return an Agent object
33
33
  */
34
- hello(uuid, uuidSignature, info) {
34
+ hello(uuid, uuidSignature, info, raw) {
35
35
  return __awaiter(this, void 0, void 0, function* () {
36
36
  const resp = yield this.axios.post(this.getEndpoint("/v1/hello"), info, {
37
37
  headers: {
38
38
  Authorization: `Bearer ${uuid}.${uuidSignature}`,
39
39
  },
40
40
  });
41
- return { agent: resp.data, token: resp.headers.authorization };
41
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw)
42
+ ? Object.assign(Object.assign({}, resp), { data: { agent: resp.data, token: resp.headers.authorization } }) : { agent: resp.data, token: resp.headers.authorization });
42
43
  });
43
44
  }
44
45
  /**
@@ -51,10 +52,10 @@ class MothershipService extends Base_1.default {
51
52
  * @param info Information about the agent's system resources.
52
53
  * @return an Agent object
53
54
  */
54
- helloAgain(info) {
55
+ helloAgain(info, raw) {
55
56
  return __awaiter(this, void 0, void 0, function* () {
56
57
  const resp = yield this.axios.patch(this.getEndpoint("/v1/hello/again"), info);
57
- return resp.data;
58
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
58
59
  });
59
60
  }
60
61
  /**
@@ -67,14 +68,13 @@ class MothershipService extends Base_1.default {
67
68
  * @param publicKey the public key of the agent that will be used for cryptography. The agent should remember its private key.
68
69
  * @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.
69
70
  */
70
- // eslint-disable-next-line complexity
71
- register(uuid, info, publicKey) {
71
+ register(uuid, info, publicKey, raw) {
72
72
  return __awaiter(this, void 0, void 0, function* () {
73
73
  if (typeof publicKey !== "string") {
74
74
  publicKey = publicKey.toString("hex");
75
75
  }
76
76
  const resp = yield this.axios.post(this.getEndpoint("/v1/register"), Object.assign({ uuid, publicKey }, info));
77
- return resp.data;
77
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
78
78
  });
79
79
  }
80
80
  /**
@@ -88,9 +88,10 @@ class MothershipService extends Base_1.default {
88
88
  * @param memberToken JWT assigned to a member of the organization
89
89
  * @param email Email of the user owner of the JWT
90
90
  */
91
- connect(orgName, memberToken, email) {
91
+ connect(orgName, memberToken, email, raw) {
92
92
  return __awaiter(this, void 0, void 0, function* () {
93
- yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/connect`), { memberToken, email });
93
+ const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/connect`), { memberToken, email });
94
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
94
95
  });
95
96
  }
96
97
  /**
@@ -103,9 +104,10 @@ class MothershipService extends Base_1.default {
103
104
  * @param orgName Name of the organization
104
105
  * @param email Email of the user
105
106
  */
106
- disconnect(orgName, email) {
107
+ disconnect(orgName, email, raw) {
107
108
  return __awaiter(this, void 0, void 0, function* () {
108
- yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/connect/${email}`));
109
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/connect/${email}`));
110
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
109
111
  });
110
112
  }
111
113
  /**
@@ -117,9 +119,10 @@ class MothershipService extends Base_1.default {
117
119
  *
118
120
  * @param email Email of the target
119
121
  */
120
- disconnectTarget(email) {
122
+ disconnectTarget(email, raw) {
121
123
  return __awaiter(this, void 0, void 0, function* () {
122
- yield this.axios.delete(this.getEndpoint(`/v1/connect/${email}`));
124
+ const resp = yield this.axios.delete(this.getEndpoint(`/v1/connect/${email}`));
125
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
123
126
  });
124
127
  }
125
128
  /**
@@ -128,8 +131,8 @@ class MothershipService extends Base_1.default {
128
131
  * @param orgName Name of the organization
129
132
  * @returns Object containing an array of retrieved agents and the total number of available found in the database (independent of limit and page)
130
133
  */
131
- searchAvailableTargets(_a) {
132
- return __awaiter(this, arguments, void 0, function* ({ orgName, filters, sorting, limit = 25, page = 0, }) {
134
+ searchAvailableTargets(_a, raw_1) {
135
+ return __awaiter(this, arguments, void 0, function* ({ orgName, filters, sorting, limit = 25, page = 0 }, raw) {
133
136
  const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
134
137
  return new searchFilter_1.SearchFilterDTO(f);
135
138
  });
@@ -139,7 +142,18 @@ class MothershipService extends Base_1.default {
139
142
  }, {
140
143
  params: { limit, page },
141
144
  });
142
- return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
145
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? Object.assign(Object.assign({}, resp), { data: (0, paginatedResponseHelper_1.createPaginatedResponse)(resp) }) : (0, paginatedResponseHelper_1.createPaginatedResponse)(resp));
146
+ });
147
+ }
148
+ /**
149
+ * Retrieves usage statistics for a specific organization.
150
+ * @param orgName Name of the organization
151
+ * @returns Statistics information
152
+ */
153
+ getStats(orgName) {
154
+ return __awaiter(this, void 0, void 0, function* () {
155
+ const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/stats`));
156
+ return resp.data;
143
157
  });
144
158
  }
145
159
  getEndpoint(endpoint) {
@@ -22,9 +22,14 @@ class Nats extends Base_1.default {
22
22
  return this.natsConnection;
23
23
  };
24
24
  }
25
- // eslint-disable-next-line complexity
26
25
  connect(params) {
27
26
  return __awaiter(this, void 0, void 0, function* () {
27
+ let previousSubs = [];
28
+ if (this.natsConnection && !this.natsConnection.isClosed()) {
29
+ previousSubs = [...this.subMap];
30
+ yield this.natsConnection.close();
31
+ this.subMap = [];
32
+ }
28
33
  if (params.forceWebsocket) {
29
34
  this.connection = nats_ws_1.connect;
30
35
  }
@@ -47,55 +52,64 @@ class Nats extends Base_1.default {
47
52
  user: params.email !== undefined ? params.email : params.username,
48
53
  pass: params.jwt !== undefined ? params.jwt : params.password,
49
54
  });
55
+ for (const entry of previousSubs) {
56
+ yield this.sub(entry.subject, (err, data, msg) => {
57
+ var _a, _b;
58
+ (_b = (_a = entry.sub).callback) === null || _b === void 0 ? void 0 : _b.call(_a, err, msg ? msg : {});
59
+ });
60
+ }
50
61
  return this.natsConnection;
51
62
  });
52
63
  }
53
64
  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"));
65
+ return __awaiter(this, void 0, void 0, function* () {
66
+ const delay = 500;
67
+ const trySubscribe = () => __awaiter(this, void 0, void 0, function* () {
68
+ const conn = this.getConnection();
69
+ // if connection not ready, retry after delay
70
+ if (!conn || conn.isClosed()) {
71
+ yield new Promise(res => setTimeout(res, delay));
72
+ return trySubscribe();
73
+ }
74
+ try {
75
+ const newOptions = Object.assign(Object.assign({}, options), { callback: (err, msg) => {
76
+ if (err) {
77
+ try {
78
+ callback(err);
79
+ }
80
+ catch (_a) {
81
+ // ignore callback errors
82
+ }
83
+ return;
84
+ }
85
+ let parsedData;
86
+ try {
87
+ const data = new TextDecoder("utf-8").decode(msg.data);
88
+ parsedData = JSON.parse(data);
89
+ }
90
+ catch (e) {
91
+ callback(e);
92
+ return;
93
+ }
94
+ try {
95
+ callback(null, parsedData, msg);
96
+ }
97
+ catch (_b) {
98
+ // ignore callback errors
99
+ }
100
+ } });
101
+ const sub = conn.subscribe(subject, newOptions);
102
+ this.subMap.push({ subject, sub });
103
+ return sub;
91
104
  }
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);
105
+ catch (err) {
106
+ err;
107
+ // if subscription fails, retry after delay
108
+ yield new Promise(res => setTimeout(res, delay));
109
+ return trySubscribe();
96
110
  }
97
- return reject(new Error("could not subscribe"));
98
- }, delay);
111
+ });
112
+ return trySubscribe();
99
113
  });
100
114
  }
101
115
  unsub(subject) {
@@ -0,0 +1,18 @@
1
+ import Base, { MaybeRaw } from "../../Base";
2
+ import { Version } from "../../interfaces/global";
3
+ import { ShortsInternal } from "./internal";
4
+ export default class Shorts extends Base {
5
+ /**
6
+ * Handles everything around internal endpoints
7
+ */
8
+ get internal(): ShortsInternal;
9
+ private _internal?;
10
+ /**
11
+ * Requests the endpoint version
12
+ * @returns Version object
13
+ */
14
+ version<R extends boolean = false>(raw?: {
15
+ raw: R;
16
+ }): Promise<MaybeRaw<R, Version>>;
17
+ protected getEndpoint(endpoint: string): string;
18
+ }
@@ -0,0 +1,38 @@
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 internal_1 = require("./internal");
14
+ class Shorts extends Base_1.default {
15
+ /**
16
+ * Handles everything around internal endpoints
17
+ */
18
+ get internal() {
19
+ if (this._internal === undefined) {
20
+ this._internal = new internal_1.ShortsInternal(this.options, this.axios);
21
+ }
22
+ return this._internal;
23
+ }
24
+ /**
25
+ * Requests the endpoint version
26
+ * @returns Version object
27
+ */
28
+ version(raw) {
29
+ return __awaiter(this, void 0, void 0, function* () {
30
+ const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
31
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
32
+ });
33
+ }
34
+ getEndpoint(endpoint) {
35
+ return `${this.options.server}/api/shorts${endpoint}`;
36
+ }
37
+ }
38
+ exports.default = Shorts;
@@ -0,0 +1,72 @@
1
+ import Base, { MaybeRaw } from "../../../Base";
2
+ import { Short } from "../../../interfaces/shorts";
3
+ export declare class ShortsInternal extends Base {
4
+ /**
5
+ * Generates a shortened alias for the provided long URL and sets a maximum number of allowed visits.
6
+ *
7
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
8
+ *
9
+ * @param organizationId ID of the organization
10
+ * @param spaceId ID of the space
11
+ * @param url Original long URL that needs to be shortened
12
+ * @param visitsLimit Maximum number of times the shortened link can be accessed
13
+ * @returns the created short url
14
+ */
15
+ createShort<R extends boolean = false>(organizationId: string, spaceId: string, url: string, visitsLimit: number, raw?: {
16
+ raw: R;
17
+ }): Promise<MaybeRaw<R, Short>>;
18
+ /**
19
+ * Retrieves the full data associated with a shortened URL slug, including the original long URL, the current number of visits, and the maximum allowed visit limit.
20
+ *
21
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
22
+ *
23
+ * @param slug Unique identifier or alias representing the shortened version of a URL
24
+ * @returns detailed information about this short url slug
25
+ */
26
+ getShort<R extends boolean = false>(slug: string, raw?: {
27
+ raw: R;
28
+ }): Promise<MaybeRaw<R, Short>>;
29
+ /**
30
+ * Updates the maximum allowed visit limit for a shortened URL identified by its slug.
31
+ *
32
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
33
+ *
34
+ * @param slug Unique identifier representing the shortened version of a URL
35
+ * @param visitsLimit New maximum number of allowed visits for this shortened URL
36
+ * @returns The updated Short object with the new visit limit
37
+ */
38
+ updateVisitsLimit<R extends boolean = false>(slug: string, visitsLimit: number, raw?: {
39
+ raw: R;
40
+ }): Promise<MaybeRaw<R, Short>>;
41
+ /**
42
+ * Deletes the shortened URL associated with the given slug.
43
+ *
44
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
45
+ *
46
+ * @param slug Unique identifier representing the shortened version of a URL
47
+ */
48
+ deleteShort<R extends boolean = false>(slug: string, raw?: {
49
+ raw: R;
50
+ }): Promise<MaybeRaw<R, void>>;
51
+ /**
52
+ * Deletes all shortened URLs associated with the given space ID.
53
+ *
54
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
55
+ *
56
+ * @param spaceId ID of the space whose shortened URLs should be deleted
57
+ */
58
+ deleteSpaceShorts<R extends boolean = false>(spaceId: string, raw?: {
59
+ raw: R;
60
+ }): Promise<MaybeRaw<R, void>>;
61
+ /**
62
+ * Deletes all shortened URLs associated with the given organization ID.
63
+ *
64
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
65
+ *
66
+ * @param orgId ID of the organization whose shortened URLs should be deleted
67
+ */
68
+ deleteOrganizationShorts<R extends boolean = false>(orgId: string, raw?: {
69
+ raw: R;
70
+ }): Promise<MaybeRaw<R, void>>;
71
+ protected getEndpoint(endpoint: string): string;
72
+ }
@@ -0,0 +1,104 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.ShortsInternal = void 0;
13
+ const Base_1 = require("../../../Base");
14
+ class ShortsInternal extends Base_1.default {
15
+ /**
16
+ * Generates a shortened alias for the provided long URL and sets a maximum number of allowed visits.
17
+ *
18
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
19
+ *
20
+ * @param organizationId ID of the organization
21
+ * @param spaceId ID of the space
22
+ * @param url Original long URL that needs to be shortened
23
+ * @param visitsLimit Maximum number of times the shortened link can be accessed
24
+ * @returns the created short url
25
+ */
26
+ createShort(organizationId, spaceId, url, visitsLimit, raw) {
27
+ return __awaiter(this, void 0, void 0, function* () {
28
+ const res = yield this.axios.post(this.getEndpoint(`/internal/v1/short`), { url, visitsLimit, organizationId, spaceId });
29
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
30
+ });
31
+ }
32
+ /**
33
+ * Retrieves the full data associated with a shortened URL slug, including the original long URL, the current number of visits, and the maximum allowed visit limit.
34
+ *
35
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
36
+ *
37
+ * @param slug Unique identifier or alias representing the shortened version of a URL
38
+ * @returns detailed information about this short url slug
39
+ */
40
+ getShort(slug, raw) {
41
+ return __awaiter(this, void 0, void 0, function* () {
42
+ const res = yield this.axios.get(this.getEndpoint(`/internal/v1/short/${slug}`));
43
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
44
+ });
45
+ }
46
+ /**
47
+ * Updates the maximum allowed visit limit for a shortened URL identified by its slug.
48
+ *
49
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
50
+ *
51
+ * @param slug Unique identifier representing the shortened version of a URL
52
+ * @param visitsLimit New maximum number of allowed visits for this shortened URL
53
+ * @returns The updated Short object with the new visit limit
54
+ */
55
+ updateVisitsLimit(slug, visitsLimit, raw) {
56
+ return __awaiter(this, void 0, void 0, function* () {
57
+ const resp = yield this.axios.patch(this.getEndpoint(`/internal/v1/short/${slug}/limit`), { visitsLimit });
58
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
59
+ });
60
+ }
61
+ /**
62
+ * Deletes the shortened URL associated with the given slug.
63
+ *
64
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
65
+ *
66
+ * @param slug Unique identifier representing the shortened version of a URL
67
+ */
68
+ deleteShort(slug, raw) {
69
+ return __awaiter(this, void 0, void 0, function* () {
70
+ const resp = yield this.axios.delete(this.getEndpoint(`/internal/v1/short/${slug}`));
71
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
72
+ });
73
+ }
74
+ /**
75
+ * Deletes all shortened URLs associated with the given space ID.
76
+ *
77
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
78
+ *
79
+ * @param spaceId ID of the space whose shortened URLs should be deleted
80
+ */
81
+ deleteSpaceShorts(spaceId, raw) {
82
+ return __awaiter(this, void 0, void 0, function* () {
83
+ const resp = yield this.axios.delete(this.getEndpoint(`/internal/v1/short/space/${spaceId}`));
84
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
85
+ });
86
+ }
87
+ /**
88
+ * Deletes all shortened URLs associated with the given organization ID.
89
+ *
90
+ * This is an internal endpoint and can only be used from backends within the hcloud deployment.
91
+ *
92
+ * @param orgId ID of the organization whose shortened URLs should be deleted
93
+ */
94
+ deleteOrganizationShorts(orgId, raw) {
95
+ return __awaiter(this, void 0, void 0, function* () {
96
+ const resp = yield this.axios.delete(this.getEndpoint(`/internal/v1/short/org/${orgId}`));
97
+ return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
98
+ });
99
+ }
100
+ getEndpoint(endpoint) {
101
+ return `${this.options.server}/api/account${endpoint}`;
102
+ }
103
+ }
104
+ exports.ShortsInternal = ShortsInternal;
@@ -64,7 +64,6 @@ class BouncerProvider {
64
64
  }
65
65
  this.processRefs();
66
66
  }
67
- /* eslint-disable @typescript-eslint/no-non-null-assertion*/
68
67
  doesMatchRegion(feature, context) {
69
68
  if (feature.regions.length) {
70
69
  if (context === null || context === void 0 ? void 0 : context.region) {
@@ -75,7 +74,6 @@ class BouncerProvider {
75
74
  }
76
75
  return true;
77
76
  }
78
- /* eslint-disable @typescript-eslint/no-non-null-assertion*/
79
77
  doesMatchUser(feature, context) {
80
78
  if (feature.users.length) {
81
79
  if (context === null || context === void 0 ? void 0 : context.email) {
@@ -85,7 +83,6 @@ class BouncerProvider {
85
83
  }
86
84
  return true;
87
85
  }
88
- /* eslint-disable @typescript-eslint/no-non-null-assertion*/
89
86
  doesMatchOrganization(feature, context) {
90
87
  if (feature.organizations.length) {
91
88
  if (context === null || context === void 0 ? void 0 : context.organization) {
package/package.json CHANGED
@@ -1,13 +1,12 @@
1
1
  {
2
2
  "name": "hcloud-sdk",
3
- "version": "16.0.0",
3
+ "version": "18.0.0",
4
4
  "description": "hcloud platform sdk",
5
5
  "main": "index.js",
6
6
  "types": "index.d.ts",
7
7
  "scripts": {
8
- "test": "mocha -r ts-node/register tests/**/*.test.ts",
9
- "format": "prettier --write \"src/**/*.ts\" \"tests/**/*.test.ts\"",
10
- "lint": "eslint --max-warnings=0 --fix src/ tests/ --ext .ts",
8
+ "format": "prettier --write \"src/**/*.ts\"",
9
+ "lint": "eslint --max-warnings=0 --fix src/",
11
10
  "doc:build": "vuepress build _docs/src",
12
11
  "doc:dev": "vuepress dev _docs/src",
13
12
  "doc:export": "vuepress export _docs/src",
@@ -28,32 +27,31 @@
28
27
  "author": "moovit-sp-gmbh",
29
28
  "homepage": "https://github.com/moovit-sp-gmbh/hcloud-sdk-js#readme",
30
29
  "devDependencies": {
31
- "@commitlint/cli": "^18.6.1",
32
- "@commitlint/config-conventional": "^18.6.3",
30
+ "@commitlint/cli": "^19.8.1",
31
+ "@commitlint/config-conventional": "^19.8.1",
32
+ "@eslint/compat": "^1.2.9",
33
+ "@eslint/eslintrc": "^3.3.1",
34
+ "@eslint/js": "^9.27.0",
33
35
  "@semantic-release/changelog": "^6.0.3",
34
36
  "@semantic-release/git": "^10.0.1",
35
- "@trivago/prettier-plugin-sort-imports": "^4.3.0",
36
- "@types/chai": "^4.3.17",
37
- "@types/mocha": "^10.0.7",
38
- "@types/node": "^20.14.8",
39
- "@typescript-eslint/eslint-plugin": "^7.0.2",
40
- "@typescript-eslint/parser": "^7.0.2",
41
- "chai": "^4.5.0",
37
+ "@trivago/prettier-plugin-sort-imports": "^5.2.2",
38
+ "@types/node": "^22.15.19",
39
+ "@typescript-eslint/eslint-plugin": "^8.32.1",
40
+ "@typescript-eslint/parser": "^8.32.1",
42
41
  "conventional-changelog-conventionalcommits": "^8.0.0",
43
- "dayjs": "^1.11.12",
44
- "eslint": "^8.57.0",
45
- "eslint-config-prettier": "^8.10.0",
46
- "eslint-plugin-import": "^2.29.1",
47
- "mocha": "^10.7.3",
48
- "prettier": "^3.3.3",
49
- "semantic-release": "^23.1.1",
42
+ "eslint": "^9.27.0",
43
+ "eslint-config-prettier": "^10.1.5",
44
+ "eslint-plugin-import": "^2.31.0",
45
+ "globals": "^16.1.0",
46
+ "prettier": "^3.5.3",
47
+ "semantic-release": "^24.2.4",
50
48
  "semantic-release-telegram": "^1.6.2",
51
49
  "ts-node": "^10.9.2",
52
- "typescript": "^5.5.4"
50
+ "typescript": "^5.8.3"
53
51
  },
54
52
  "dependencies": {
55
- "axios": "^1.7.3",
56
- "nats": "^2.28.2",
57
- "nats.ws": "^1.29.2"
53
+ "axios": "^1.9.0",
54
+ "nats": "^2.29.3",
55
+ "nats.ws": "^1.30.3"
58
56
  }
59
57
  }