hcloud-sdk 14.13.2 → 15.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 (161) hide show
  1. package/changelog.md +36 -800
  2. package/lib/Hcloud.d.ts +20 -10
  3. package/lib/Hcloud.js +60 -10
  4. package/lib/interfaces/bouncer/features/index.d.ts +3 -6
  5. package/lib/interfaces/frontend/featureflags/index.d.ts +7 -0
  6. package/lib/interfaces/frontend/featureflags/index.js +2 -0
  7. package/lib/interfaces/high5/space/event/stream/node/index.d.ts +2 -0
  8. package/lib/interfaces/high5/space/execution/index.d.ts +11 -0
  9. package/lib/interfaces/high5/wave/changelog.d.ts +30 -0
  10. package/lib/interfaces/high5/wave/changelog.js +18 -0
  11. package/lib/interfaces/high5/wave/index.d.ts +31 -1
  12. package/lib/interfaces/high5/wave/index.js +10 -1
  13. package/lib/interfaces/idp/user/GeneralSettings.d.ts +1 -0
  14. package/lib/interfaces/mothership/index.d.ts +1 -0
  15. package/lib/interfaces/nats/index.d.ts +8 -21
  16. package/lib/interfaces/nats/index.js +72 -90
  17. package/lib/service/agent/bundle/dev/index.d.ts +2 -2
  18. package/lib/service/agent/bundle/dev/index.js +14 -10
  19. package/lib/service/agent/context/index.d.ts +7 -9
  20. package/lib/service/agent/context/index.js +41 -32
  21. package/lib/service/agent/index.d.ts +9 -7
  22. package/lib/service/agent/index.js +23 -6
  23. package/lib/service/auditor/index.d.ts +6 -7
  24. package/lib/service/auditor/index.js +23 -17
  25. package/lib/service/auditor/internal/index.d.ts +2 -2
  26. package/lib/service/auditor/internal/index.js +24 -20
  27. package/lib/service/bouncer/features/index.d.ts +1 -1
  28. package/lib/service/bouncer/features/index.js +5 -3
  29. package/lib/service/bouncer/index.d.ts +3 -10
  30. package/lib/service/bouncer/index.js +6 -21
  31. package/lib/service/dali/DaliAvatar.d.ts +13 -9
  32. package/lib/service/dali/DaliAvatar.js +53 -8
  33. package/lib/service/dali/avatar/DaliFuseSpace.d.ts +4 -6
  34. package/lib/service/dali/avatar/DaliFuseSpace.js +26 -23
  35. package/lib/service/dali/avatar/DaliHigh5Space.d.ts +4 -6
  36. package/lib/service/dali/avatar/DaliHigh5Space.js +26 -23
  37. package/lib/service/dali/avatar/DaliOAuthApp.d.ts +4 -6
  38. package/lib/service/dali/avatar/DaliOAuthApp.js +26 -23
  39. package/lib/service/dali/avatar/DaliOrganization.d.ts +4 -6
  40. package/lib/service/dali/avatar/DaliOrganization.js +23 -20
  41. package/lib/service/dali/avatar/DaliTeam.d.ts +4 -6
  42. package/lib/service/dali/avatar/DaliTeam.js +26 -23
  43. package/lib/service/dali/avatar/DaliUser.d.ts +4 -6
  44. package/lib/service/dali/avatar/DaliUser.js +20 -17
  45. package/lib/service/dali/index.d.ts +4 -5
  46. package/lib/service/dali/index.js +14 -7
  47. package/lib/service/fuse/index.d.ts +8 -7
  48. package/lib/service/fuse/index.js +23 -9
  49. package/lib/service/fuse/internal/index.d.ts +3 -4
  50. package/lib/service/fuse/internal/index.js +5 -3
  51. package/lib/service/fuse/internal/space/cronjob/index.d.ts +3 -4
  52. package/lib/service/fuse/internal/space/cronjob/index.js +5 -3
  53. package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +2 -4
  54. package/lib/service/fuse/internal/space/cronjob/log/index.js +11 -12
  55. package/lib/service/fuse/internal/space/index.d.ts +5 -6
  56. package/lib/service/fuse/internal/space/index.js +24 -18
  57. package/lib/service/fuse/space/cronjob/index.d.ts +15 -15
  58. package/lib/service/fuse/space/cronjob/index.js +133 -105
  59. package/lib/service/fuse/space/cronjob/log/index.d.ts +3 -3
  60. package/lib/service/fuse/space/cronjob/log/index.js +24 -23
  61. package/lib/service/fuse/space/index.d.ts +13 -14
  62. package/lib/service/fuse/space/index.js +88 -70
  63. package/lib/service/high5/execution/index.d.ts +5 -5
  64. package/lib/service/high5/execution/index.js +11 -4
  65. package/lib/service/high5/execution/log/index.d.ts +2 -2
  66. package/lib/service/high5/execution/log/index.js +11 -12
  67. package/lib/service/high5/execution/status/index.d.ts +2 -2
  68. package/lib/service/high5/execution/status/index.js +11 -12
  69. package/lib/service/high5/index.d.ts +12 -9
  70. package/lib/service/high5/index.js +36 -12
  71. package/lib/service/high5/internal/index.d.ts +3 -4
  72. package/lib/service/high5/internal/index.js +5 -3
  73. package/lib/service/high5/internal/space/index.d.ts +2 -2
  74. package/lib/service/high5/internal/space/index.js +19 -15
  75. package/lib/service/high5/joinToken/index.d.ts +4 -4
  76. package/lib/service/high5/joinToken/index.js +36 -28
  77. package/lib/service/high5/space/event/index.d.ts +9 -10
  78. package/lib/service/high5/space/event/index.js +58 -46
  79. package/lib/service/high5/space/event/stream/design/index.d.ts +23 -8
  80. package/lib/service/high5/space/event/stream/design/index.js +60 -25
  81. package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +5 -5
  82. package/lib/service/high5/space/event/stream/design/snapshot/index.js +65 -58
  83. package/lib/service/high5/space/event/stream/index.d.ts +14 -15
  84. package/lib/service/high5/space/event/stream/index.js +125 -103
  85. package/lib/service/high5/space/execution/index.d.ts +9 -9
  86. package/lib/service/high5/space/execution/index.js +57 -42
  87. package/lib/service/high5/space/execution/log/index.d.ts +4 -6
  88. package/lib/service/high5/space/execution/log/index.js +22 -21
  89. package/lib/service/high5/space/execution/status/index.d.ts +1 -1
  90. package/lib/service/high5/space/execution/status/index.js +10 -8
  91. package/lib/service/high5/space/index.d.ts +25 -21
  92. package/lib/service/high5/space/index.js +131 -86
  93. package/lib/service/high5/space/secret/index.d.ts +6 -6
  94. package/lib/service/high5/space/secret/index.js +59 -49
  95. package/lib/service/high5/space/wave/index.d.ts +7 -9
  96. package/lib/service/high5/space/wave/index.js +40 -33
  97. package/lib/service/high5/space/webhook/index.d.ts +21 -14
  98. package/lib/service/high5/space/webhook/index.js +106 -73
  99. package/lib/service/high5/space/webhook/log/index.d.ts +2 -4
  100. package/lib/service/high5/space/webhook/log/index.js +11 -12
  101. package/lib/service/high5/wave/s3/index.d.ts +6 -6
  102. package/lib/service/high5/wave/s3/index.js +50 -38
  103. package/lib/service/idp/index.d.ts +17 -15
  104. package/lib/service/idp/index.js +104 -56
  105. package/lib/service/idp/internal/index.d.ts +2 -4
  106. package/lib/service/idp/internal/index.js +10 -11
  107. package/lib/service/idp/oauth/index.d.ts +16 -12
  108. package/lib/service/idp/oauth/index.js +55 -43
  109. package/lib/service/idp/organization/index.d.ts +12 -10
  110. package/lib/service/idp/organization/index.js +63 -28
  111. package/lib/service/idp/organization/license/index.d.ts +2 -2
  112. package/lib/service/idp/organization/license/index.js +5 -4
  113. package/lib/service/idp/organization/member/index.d.ts +10 -11
  114. package/lib/service/idp/organization/member/index.js +62 -48
  115. package/lib/service/idp/organization/member/invitations/index.d.ts +3 -3
  116. package/lib/service/idp/organization/member/invitations/index.js +47 -43
  117. package/lib/service/idp/organization/settings/domain/index.d.ts +7 -8
  118. package/lib/service/idp/organization/settings/domain/index.js +42 -29
  119. package/lib/service/idp/organization/settings/domain/saml/index.d.ts +5 -5
  120. package/lib/service/idp/organization/settings/domain/saml/index.js +58 -48
  121. package/lib/service/idp/organization/settings/index.d.ts +5 -5
  122. package/lib/service/idp/organization/settings/index.js +17 -4
  123. package/lib/service/idp/organization/settings/oauth/index.d.ts +9 -11
  124. package/lib/service/idp/organization/settings/oauth/index.js +67 -56
  125. package/lib/service/idp/organization/team/index.d.ts +8 -8
  126. package/lib/service/idp/organization/team/index.js +64 -55
  127. package/lib/service/idp/registration/index.d.ts +4 -6
  128. package/lib/service/idp/registration/index.js +37 -34
  129. package/lib/service/idp/user/index.d.ts +16 -15
  130. package/lib/service/idp/user/index.js +86 -51
  131. package/lib/service/idp/user/license/index.d.ts +2 -2
  132. package/lib/service/idp/user/license/index.js +5 -4
  133. package/lib/service/idp/user/password/index.d.ts +1 -1
  134. package/lib/service/idp/user/password/index.js +10 -11
  135. package/lib/service/idp/user/settings/connections/index.d.ts +2 -4
  136. package/lib/service/idp/user/settings/connections/index.js +9 -10
  137. package/lib/service/idp/user/settings/general/index.d.ts +10 -6
  138. package/lib/service/idp/user/settings/general/index.js +25 -13
  139. package/lib/service/idp/user/settings/index.d.ts +13 -9
  140. package/lib/service/idp/user/settings/index.js +53 -8
  141. package/lib/service/idp/user/settings/notifications/index.d.ts +3 -5
  142. package/lib/service/idp/user/settings/notifications/index.js +14 -13
  143. package/lib/service/idp/user/settings/oauthApps/index.d.ts +3 -5
  144. package/lib/service/idp/user/settings/oauthApps/index.js +17 -16
  145. package/lib/service/idp/user/settings/pats/index.d.ts +8 -10
  146. package/lib/service/idp/user/settings/pats/index.js +55 -44
  147. package/lib/service/idp/user/settings/twoFactor/index.d.ts +3 -4
  148. package/lib/service/idp/user/settings/twoFactor/index.js +8 -3
  149. package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +6 -8
  150. package/lib/service/idp/user/settings/twoFactor/totp/index.js +36 -29
  151. package/lib/service/mailer/index.d.ts +4 -5
  152. package/lib/service/mailer/index.js +12 -8
  153. package/lib/service/mailer/internal/index.d.ts +4 -4
  154. package/lib/service/mailer/internal/index.js +38 -33
  155. package/lib/service/mothership/index.d.ts +12 -12
  156. package/lib/service/mothership/index.js +92 -79
  157. package/lib/service/nats/index.d.ts +1 -3
  158. package/lib/service/nats/index.js +2 -2
  159. package/lib/utils/bouncer/features/Provider.d.ts +3 -0
  160. package/lib/utils/bouncer/features/Provider.js +20 -2
  161. package/package.json +1 -1
@@ -1,32 +1,30 @@
1
- import { AxiosInstance } from "axios";
2
- import Base, { Options } from "../../../../../Base";
1
+ import Base from "../../../../../Base";
3
2
  import { PaginatedResponse, SearchParams } from "../../../../../interfaces/global";
4
3
  import { Pat, PatCreate, PatUpdate } from "../../../../../interfaces/idp/user/Pat";
5
4
  export declare class IdpPat extends Base {
6
- constructor(options: Options, axios: AxiosInstance);
7
5
  /**
8
6
  * Search all personal access tokens (PATs) of the requesting user.
9
7
  * @returns Paginated response of PAT objects
10
8
  */
11
- searchPats: ({ filters, sorting, limit, page }: SearchParams) => Promise<PaginatedResponse<Pat>>;
9
+ searchPats({ filters, sorting, limit, page }: SearchParams): Promise<PaginatedResponse<Pat>>;
12
10
  /**
13
11
  * Retrieves a single personal access token (PAT) by ID.
14
12
  * @param patId ID of the PAT
15
13
  * @returns The requested PAT object
16
14
  */
17
- getPat: (patId: string) => Promise<Pat>;
15
+ getPat(patId: string): Promise<Pat>;
18
16
  /**
19
17
  * Regenerates a personal access token (PAT).
20
18
  * @param patId ID of the PAT
21
19
  * @returns PAT object holding the updated token
22
20
  */
23
- regeneratePat: (patId: string, token?: string) => Promise<Pat>;
21
+ regeneratePat(patId: string, token?: string): Promise<Pat>;
24
22
  /**
25
23
  * Creates a new personal access token (PAT) for requesting user
26
24
  * @param patCreate Object with informations needed to create a PAT: Name, expiration and scopes
27
25
  * @returns the created PAT object
28
26
  */
29
- generatePat: (patCreate: PatCreate) => Promise<Pat>;
27
+ generatePat(patCreate: PatCreate): Promise<Pat>;
30
28
  /**
31
29
  * Updates an existing PAT object.
32
30
  *
@@ -36,15 +34,15 @@ export declare class IdpPat extends Base {
36
34
  * @param patUpdate Object containing new name, expiration and scopes
37
35
  * @returns the updated PAT object
38
36
  */
39
- updatePat: (patId: string, patUpdate: PatUpdate) => Promise<Pat>;
37
+ updatePat(patId: string, patUpdate: PatUpdate): Promise<Pat>;
40
38
  /**
41
39
  * Deletes a personal access token (PAT) of the requesting User.
42
40
  * @param patId Id of the PAT
43
41
  */
44
- deletePat: (patId: string) => Promise<void>;
42
+ deletePat(patId: string): Promise<void>;
45
43
  /**
46
44
  * Deletes all personal access tokens (PATs) of the requesting User.
47
45
  */
48
- deleteAllPats: () => Promise<void>;
46
+ deleteAllPats(): Promise<void>;
49
47
  protected getEndpoint(endpoint: string): string;
50
48
  }
@@ -14,13 +14,12 @@ const Base_1 = require("../../../../../Base");
14
14
  const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
15
15
  const searchFilter_1 = require("../../../../../helper/searchFilter");
16
16
  class IdpPat extends Base_1.default {
17
- constructor(options, axios) {
18
- super(options, axios);
19
- /**
20
- * Search all personal access tokens (PATs) of the requesting user.
21
- * @returns Paginated response of PAT objects
22
- */
23
- this.searchPats = (_a) => __awaiter(this, [_a], void 0, function* ({ filters, sorting, limit = 25, page = 0 }) {
17
+ /**
18
+ * Search all personal access tokens (PATs) of the requesting user.
19
+ * @returns Paginated response of PAT objects
20
+ */
21
+ searchPats(_a) {
22
+ return __awaiter(this, arguments, void 0, function* ({ filters, sorting, limit = 25, page = 0 }) {
24
23
  const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
25
24
  return new searchFilter_1.SearchFilterDTO(f);
26
25
  });
@@ -32,57 +31,69 @@ class IdpPat extends Base_1.default {
32
31
  });
33
32
  return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
34
33
  });
35
- /**
36
- * Retrieves a single personal access token (PAT) by ID.
37
- * @param patId ID of the PAT
38
- * @returns The requested PAT object
39
- */
40
- this.getPat = (patId) => __awaiter(this, void 0, void 0, function* () {
34
+ }
35
+ /**
36
+ * Retrieves a single personal access token (PAT) by ID.
37
+ * @param patId ID of the PAT
38
+ * @returns The requested PAT object
39
+ */
40
+ getPat(patId) {
41
+ return __awaiter(this, void 0, void 0, function* () {
41
42
  const resp = yield this.axios.get(this.getEndpoint(`/v1/user/settings/pats/${patId}`));
42
43
  return resp.data;
43
44
  });
44
- /**
45
- * Regenerates a personal access token (PAT).
46
- * @param patId ID of the PAT
47
- * @returns PAT object holding the updated token
48
- */
49
- this.regeneratePat = (patId, token) => __awaiter(this, void 0, void 0, function* () {
45
+ }
46
+ /**
47
+ * Regenerates a personal access token (PAT).
48
+ * @param patId ID of the PAT
49
+ * @returns PAT object holding the updated token
50
+ */
51
+ regeneratePat(patId, token) {
52
+ return __awaiter(this, void 0, void 0, function* () {
50
53
  const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/pats/${patId}/regenerate`), { token });
51
54
  return resp.data;
52
55
  });
53
- /**
54
- * Creates a new personal access token (PAT) for requesting user
55
- * @param patCreate Object with informations needed to create a PAT: Name, expiration and scopes
56
- * @returns the created PAT object
57
- */
58
- this.generatePat = (patCreate) => __awaiter(this, void 0, void 0, function* () {
56
+ }
57
+ /**
58
+ * Creates a new personal access token (PAT) for requesting user
59
+ * @param patCreate Object with informations needed to create a PAT: Name, expiration and scopes
60
+ * @returns the created PAT object
61
+ */
62
+ generatePat(patCreate) {
63
+ return __awaiter(this, void 0, void 0, function* () {
59
64
  const resp = yield this.axios.post(this.getEndpoint(`/v1/user/settings/pats`), patCreate);
60
65
  return resp.data;
61
66
  });
62
- /**
63
- * Updates an existing PAT object.
64
- *
65
- * Use an expiration value of -1 to remove the token's expiration date.
66
- *
67
- * @param patId ID of the pat object
68
- * @param patUpdate Object containing new name, expiration and scopes
69
- * @returns the updated PAT object
70
- */
71
- this.updatePat = (patId, patUpdate) => __awaiter(this, void 0, void 0, function* () {
67
+ }
68
+ /**
69
+ * Updates an existing PAT object.
70
+ *
71
+ * Use an expiration value of -1 to remove the token's expiration date.
72
+ *
73
+ * @param patId ID of the pat object
74
+ * @param patUpdate Object containing new name, expiration and scopes
75
+ * @returns the updated PAT object
76
+ */
77
+ updatePat(patId, patUpdate) {
78
+ return __awaiter(this, void 0, void 0, function* () {
72
79
  const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/pats/${patId}`), patUpdate);
73
80
  return resp.data;
74
81
  });
75
- /**
76
- * Deletes a personal access token (PAT) of the requesting User.
77
- * @param patId Id of the PAT
78
- */
79
- this.deletePat = (patId) => __awaiter(this, void 0, void 0, function* () {
82
+ }
83
+ /**
84
+ * Deletes a personal access token (PAT) of the requesting User.
85
+ * @param patId Id of the PAT
86
+ */
87
+ deletePat(patId) {
88
+ return __awaiter(this, void 0, void 0, function* () {
80
89
  yield this.axios.delete(this.getEndpoint(`/v1/user/settings/pats/${patId}`));
81
90
  });
82
- /**
83
- * Deletes all personal access tokens (PATs) of the requesting User.
84
- */
85
- this.deleteAllPats = () => __awaiter(this, void 0, void 0, function* () {
91
+ }
92
+ /**
93
+ * Deletes all personal access tokens (PATs) of the requesting User.
94
+ */
95
+ deleteAllPats() {
96
+ return __awaiter(this, void 0, void 0, function* () {
86
97
  yield this.axios.delete(this.getEndpoint(`/v1/user/settings/pats`));
87
98
  });
88
99
  }
@@ -1,11 +1,10 @@
1
- import { AxiosInstance } from "axios";
2
- import Base, { Options } from "../../../../../Base";
1
+ import Base from "../../../../../Base";
3
2
  import { IdpTotp } from "./totp";
4
3
  export declare class IdpTwoFactor extends Base {
5
4
  /**
6
5
  * Handles everything around a user's pats (Personal Access Tokens)
7
6
  */
8
- totp: IdpTotp;
9
- constructor(options: Options, axios: AxiosInstance);
7
+ get totp(): IdpTotp;
8
+ private _totp?;
10
9
  protected getEndpoint(endpoint: string): string;
11
10
  }
@@ -4,9 +4,14 @@ exports.IdpTwoFactor = void 0;
4
4
  const Base_1 = require("../../../../../Base");
5
5
  const totp_1 = require("./totp");
6
6
  class IdpTwoFactor extends Base_1.default {
7
- constructor(options, axios) {
8
- super(options, axios);
9
- this.totp = new totp_1.IdpTotp(options, axios);
7
+ /**
8
+ * Handles everything around a user's pats (Personal Access Tokens)
9
+ */
10
+ get totp() {
11
+ if (this._totp === undefined) {
12
+ this._totp = new totp_1.IdpTotp(this.options, this.axios);
13
+ }
14
+ return this._totp;
10
15
  }
11
16
  getEndpoint(endpoint) {
12
17
  return `${this.options.server}/api/account${endpoint}`;
@@ -1,34 +1,32 @@
1
- import { AxiosInstance } from "axios";
2
- import Base, { Options } from "../../../../../../Base";
1
+ import Base from "../../../../../../Base";
3
2
  import { ActivatedTotp, DeactivatedTotp, UserTotp } from "../../../../../../interfaces/idp/user/Totp";
4
3
  export declare class IdpTotp extends Base {
5
- constructor(options: Options, axios: AxiosInstance);
6
4
  /**
7
5
  * Creates a new TOTP for the requesting User.
8
6
  * @returns A deactivated TOTP object containing a QR code and the OTPAuth URL
9
7
  */
10
- createTotp: () => Promise<DeactivatedTotp>;
8
+ createTotp(): Promise<DeactivatedTotp>;
11
9
  /**
12
10
  * Activates a previously created TOTP.
13
11
  * @returns Object containing a list of recover codes in case of TOTP authenticator loss
14
12
  */
15
- activateTotp: (token: string) => Promise<ActivatedTotp>;
13
+ activateTotp(token: string): Promise<ActivatedTotp>;
16
14
  /**
17
15
  * Verifies a TOTP.
18
16
  * @param userTotp TOTP to verify
19
17
  */
20
- verifyTotp: (userTotp: UserTotp) => Promise<void>;
18
+ verifyTotp(userTotp: UserTotp): Promise<void>;
21
19
  /**
22
20
  * Deactivates (deletes) a previously activated TOTP.
23
21
  * @param token TOTP to deactivate
24
22
  */
25
- deactivateTotp: (token: string) => Promise<void>;
23
+ deactivateTotp(token: string): Promise<void>;
26
24
  /**
27
25
  * Deactivates (deletes) a previously activated TOTP by using a recovery code.
28
26
  * @param email Email of the User
29
27
  * @param password Password
30
28
  * @param code Recovery code
31
29
  */
32
- deactivateTotpByRecoverCode: (email: string, password: string, code: string) => Promise<void>;
30
+ deactivateTotpByRecoverCode(email: string, password: string, code: string): Promise<void>;
33
31
  protected getEndpoint(endpoint: string): string;
34
32
  }
@@ -12,47 +12,54 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.IdpTotp = void 0;
13
13
  const Base_1 = require("../../../../../../Base");
14
14
  class IdpTotp extends Base_1.default {
15
- constructor(options, axios) {
16
- super(options, axios);
17
- /**
18
- * Creates a new TOTP for the requesting User.
19
- * @returns A deactivated TOTP object containing a QR code and the OTPAuth URL
20
- */
21
- this.createTotp = () => __awaiter(this, void 0, void 0, function* () {
15
+ /**
16
+ * Creates a new TOTP for the requesting User.
17
+ * @returns A deactivated TOTP object containing a QR code and the OTPAuth URL
18
+ */
19
+ createTotp() {
20
+ return __awaiter(this, void 0, void 0, function* () {
22
21
  const resp = yield this.axios.post(this.getEndpoint(`/v1/user/settings/security/2fa/totp`));
23
22
  return resp.data;
24
23
  });
25
- /**
26
- * Activates a previously created TOTP.
27
- * @returns Object containing a list of recover codes in case of TOTP authenticator loss
28
- */
29
- this.activateTotp = (token) => __awaiter(this, void 0, void 0, function* () {
24
+ }
25
+ /**
26
+ * Activates a previously created TOTP.
27
+ * @returns Object containing a list of recover codes in case of TOTP authenticator loss
28
+ */
29
+ activateTotp(token) {
30
+ return __awaiter(this, void 0, void 0, function* () {
30
31
  const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/security/2fa/totp/activate`), { token });
31
32
  return resp.data;
32
33
  });
33
- /**
34
- * Verifies a TOTP.
35
- * @param userTotp TOTP to verify
36
- */
37
- this.verifyTotp = (userTotp) => __awaiter(this, void 0, void 0, function* () {
34
+ }
35
+ /**
36
+ * Verifies a TOTP.
37
+ * @param userTotp TOTP to verify
38
+ */
39
+ verifyTotp(userTotp) {
40
+ return __awaiter(this, void 0, void 0, function* () {
38
41
  yield this.axios.patch(this.getEndpoint(`/v1/login/verify/totp`), {
39
42
  userTotp,
40
43
  });
41
44
  });
42
- /**
43
- * Deactivates (deletes) a previously activated TOTP.
44
- * @param token TOTP to deactivate
45
- */
46
- this.deactivateTotp = (token) => __awaiter(this, void 0, void 0, function* () {
45
+ }
46
+ /**
47
+ * Deactivates (deletes) a previously activated TOTP.
48
+ * @param token TOTP to deactivate
49
+ */
50
+ deactivateTotp(token) {
51
+ return __awaiter(this, void 0, void 0, function* () {
47
52
  yield this.axios.delete(this.getEndpoint(`/v1/user/settings/security/2fa/totp`), { data: { token } });
48
53
  });
49
- /**
50
- * Deactivates (deletes) a previously activated TOTP by using a recovery code.
51
- * @param email Email of the User
52
- * @param password Password
53
- * @param code Recovery code
54
- */
55
- this.deactivateTotpByRecoverCode = (email, password, code) => __awaiter(this, void 0, void 0, function* () {
54
+ }
55
+ /**
56
+ * Deactivates (deletes) a previously activated TOTP by using a recovery code.
57
+ * @param email Email of the User
58
+ * @param password Password
59
+ * @param code Recovery code
60
+ */
61
+ deactivateTotpByRecoverCode(email, password, code) {
62
+ return __awaiter(this, void 0, void 0, function* () {
56
63
  yield this.axios.delete(this.getEndpoint(`/v1/user/recover/totp`), {
57
64
  data: { email, password, code },
58
65
  });
@@ -1,14 +1,13 @@
1
- import { AxiosInstance } from "axios";
2
- import Base, { Options } from "../../Base";
1
+ import Base from "../../Base";
3
2
  import { Version } from "../../interfaces/global";
4
3
  import MailerInternal from "./internal";
5
4
  export default class Mailer extends Base {
6
- internal: MailerInternal;
7
- constructor(options: Options, axios: AxiosInstance);
5
+ get internal(): MailerInternal;
6
+ private _internal?;
8
7
  /**
9
8
  * Requests the endpoint version
10
9
  * @returns Version object
11
10
  */
12
- version: () => Promise<Version>;
11
+ version(): Promise<Version>;
13
12
  protected getEndpoint(endpoint: string): string;
14
13
  }
@@ -12,17 +12,21 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const Base_1 = require("../../Base");
13
13
  const internal_1 = require("./internal");
14
14
  class Mailer extends Base_1.default {
15
- constructor(options, axios) {
16
- super(options, axios);
17
- /**
18
- * Requests the endpoint version
19
- * @returns Version object
20
- */
21
- this.version = () => __awaiter(this, void 0, void 0, function* () {
15
+ get internal() {
16
+ if (this._internal === undefined) {
17
+ this._internal = new internal_1.default(this.options, this.axios);
18
+ }
19
+ return this._internal;
20
+ }
21
+ /**
22
+ * Requests the endpoint version
23
+ * @returns Version object
24
+ */
25
+ version() {
26
+ return __awaiter(this, void 0, void 0, function* () {
22
27
  const resp = yield this.axios.get(this.getEndpoint("/v1/version"), {});
23
28
  return resp.data;
24
29
  });
25
- this.internal = new internal_1.default(this.options, this.axios);
26
30
  }
27
31
  getEndpoint(endpoint) {
28
32
  return `${this.options.server}/api/mailer${endpoint}`;
@@ -7,7 +7,7 @@ export default class MailerInternal extends Base {
7
7
  * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
8
8
  * @param mail MailjetMailDTO
9
9
  */
10
- sendMailMailjet: (mail: MailjetMailDTO) => Promise<void>;
10
+ sendMailMailjet(mail: MailjetMailDTO): Promise<void>;
11
11
  /**
12
12
  * Sends a new mail based on a mustache html body.
13
13
  *
@@ -15,7 +15,7 @@ export default class MailerInternal extends Base {
15
15
  * @param mail TemplateMail
16
16
  * @deprecated in favor of sendMailMailjet
17
17
  */
18
- sendMailMustache: (mail: MustacheMail) => Promise<void>;
18
+ sendMailMustache(mail: MustacheMail): Promise<void>;
19
19
  /**
20
20
  * Sends a new mail based on a html body.
21
21
  *
@@ -23,7 +23,7 @@ export default class MailerInternal extends Base {
23
23
  * @param mail TemplateMail
24
24
  * @deprecated in favor of sendMailMailjet
25
25
  */
26
- sendMailHtml: (mail: HtmlMail) => Promise<void>;
26
+ sendMailHtml(mail: HtmlMail): Promise<void>;
27
27
  /**
28
28
  * Sends a new mail based on an existing template.
29
29
  *
@@ -31,6 +31,6 @@ export default class MailerInternal extends Base {
31
31
  * @param mail TemplateMail
32
32
  * @deprecated in favor of sendMailMailjet
33
33
  */
34
- sendMailTemplate: (mail: TemplateMail) => Promise<void>;
34
+ sendMailTemplate(mail: TemplateMail): Promise<void>;
35
35
  protected getEndpoint(endpoint: string): string;
36
36
  }
@@ -11,48 +11,53 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
12
  const Base_1 = require("../../../Base");
13
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* () {
14
+ /**
15
+ * Sends a new mail based on a mailjet template.
16
+ *
17
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
18
+ * @param mail MailjetMailDTO
19
+ */
20
+ sendMailMailjet(mail) {
21
+ return __awaiter(this, void 0, void 0, function* () {
23
22
  const resp = yield this.axios.post(this.getEndpoint("/v1/send/mailjet"), mail);
24
23
  return resp.data;
25
24
  });
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* () {
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
+ sendMailMustache(mail) {
34
+ return __awaiter(this, void 0, void 0, function* () {
34
35
  const resp = yield this.axios.post(this.getEndpoint("/v1/send/mustache"), mail);
35
36
  return resp.data;
36
37
  });
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* () {
38
+ }
39
+ /**
40
+ * Sends a new mail based on a html body.
41
+ *
42
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
43
+ * @param mail TemplateMail
44
+ * @deprecated in favor of sendMailMailjet
45
+ */
46
+ sendMailHtml(mail) {
47
+ return __awaiter(this, void 0, void 0, function* () {
45
48
  const resp = yield this.axios.post(this.getEndpoint("/v1/send/html"), mail);
46
49
  return resp.data;
47
50
  });
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* () {
51
+ }
52
+ /**
53
+ * Sends a new mail based on an existing template.
54
+ *
55
+ * THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
56
+ * @param mail TemplateMail
57
+ * @deprecated in favor of sendMailMailjet
58
+ */
59
+ sendMailTemplate(mail) {
60
+ return __awaiter(this, void 0, void 0, function* () {
56
61
  const resp = yield this.axios.post(this.getEndpoint("/v1/send/template"), mail);
57
62
  return resp.data;
58
63
  });
@@ -1,19 +1,19 @@
1
- import { AxiosInstance } from "axios";
2
- import Base, { Options } from "../../Base";
1
+ import Base from "../../Base";
3
2
  import { PaginatedResponse, SearchParams, Version } from "../../interfaces/global";
4
3
  import { Agent, TargetAgent } from "../../interfaces/mothership";
5
4
  type RecurrentInfo = Pick<Agent, "uptime" | "cpuUtilization" | "memoryUsed" | "status">;
6
5
  type HelloInfo = RecurrentInfo & {
7
6
  nickname?: string;
8
7
  bundleVersion: string;
8
+ installerVersion?: string;
9
+ ip?: string;
9
10
  };
10
11
  export default class MothershipService extends Base {
11
- constructor(options: Options, axios: AxiosInstance);
12
12
  /**
13
13
  * Requests the endpoint version
14
14
  * @returns Version object
15
15
  */
16
- version: () => Promise<Version>;
16
+ version(): Promise<Version>;
17
17
  /**
18
18
  * Say hello as an agent to the mothership
19
19
  *
@@ -22,7 +22,7 @@ export default class MothershipService extends Base {
22
22
  * @param info Information about the agent's uuid, hardware and nickname
23
23
  * @return an Agent object
24
24
  */
25
- hello: (uuid: string, uuidSignature: string, info: HelloInfo) => Promise<{
25
+ hello(uuid: string, uuidSignature: string, info: HelloInfo): Promise<{
26
26
  agent: Agent;
27
27
  token: string;
28
28
  }>;
@@ -36,7 +36,7 @@ export default class MothershipService extends Base {
36
36
  * @param info Information about the agent's system resources.
37
37
  * @return an Agent object
38
38
  */
39
- helloAgain: (info: RecurrentInfo) => Promise<Agent>;
39
+ helloAgain(info: RecurrentInfo): Promise<Agent>;
40
40
  /**
41
41
  * Register an agent to the mothership.
42
42
  *
@@ -47,7 +47,7 @@ export default class MothershipService extends Base {
47
47
  * @param publicKey the public key of the agent that will be used for cryptography. The agent should remember its private key.
48
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
49
  */
50
- register: (uuid: string, info: Pick<Agent, Exclude<keyof Agent, "uuid" | "createDate" | "modifyDate" | "_id" | "ip">>, publicKey: string | Buffer) => Promise<{
50
+ register(uuid: string, info: Pick<Agent, Exclude<keyof Agent, "uuid" | "createDate" | "modifyDate" | "_id" | "ip">>, publicKey: string | Buffer): Promise<{
51
51
  secret: string;
52
52
  }>;
53
53
  /**
@@ -61,7 +61,7 @@ export default class MothershipService extends Base {
61
61
  * @param memberToken JWT assigned to a member of the organization
62
62
  * @param email Email of the user owner of the JWT
63
63
  */
64
- connect: (orgName: string, memberToken: string, email: string) => Promise<void>;
64
+ connect(orgName: string, memberToken: string, email: string): Promise<void>;
65
65
  /**
66
66
  * Disconnect from an organization.
67
67
  *
@@ -72,7 +72,7 @@ export default class MothershipService extends Base {
72
72
  * @param orgName Name of the organization
73
73
  * @param email Email of the user
74
74
  */
75
- disconnect: (orgName: string, email: string) => Promise<void>;
75
+ disconnect(orgName: string, email: string): Promise<void>;
76
76
  /**
77
77
  * Disconnect as a target.
78
78
  *
@@ -82,16 +82,16 @@ export default class MothershipService extends Base {
82
82
  *
83
83
  * @param email Email of the target
84
84
  */
85
- disconnectTarget: (email: string) => Promise<void>;
85
+ disconnectTarget(email: string): Promise<void>;
86
86
  /**
87
87
  * Search among the available targets for a given organization.
88
88
  *
89
89
  * @param orgName Name of the organization
90
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
91
  */
92
- searchAvailableTargets: ({ orgName, filters, sorting, limit, page, }: SearchParams & {
92
+ searchAvailableTargets({ orgName, filters, sorting, limit, page, }: SearchParams & {
93
93
  orgName: string;
94
- }) => Promise<PaginatedResponse<TargetAgent>>;
94
+ }): Promise<PaginatedResponse<TargetAgent>>;
95
95
  protected getEndpoint(endpoint: string): string;
96
96
  }
97
97
  export {};