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
@@ -13,18 +13,17 @@ exports.High5WebhookLog = void 0;
13
13
  const Base_1 = require("../../../../../Base");
14
14
  const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
15
15
  class High5WebhookLog extends Base_1.default {
16
- constructor(options, axios) {
17
- super(options, axios);
18
- /**
19
- * Retrieves all Webhook logs for the specified Webhook.
20
- * @param orgName Name of the Organization
21
- * @param spaceName Name of the Space
22
- * @param webhookId ID of the Webhook
23
- * @param limit (optional) Max number of results (1-100; defaults to 25)
24
- * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
25
- * @returns Object containing an array of Webhook logs and the total number of results found in the database (independent of limit and page)
26
- */
27
- this.getWebhookLogs = (orgName, spaceName, webhookId, limit, page) => __awaiter(this, void 0, void 0, function* () {
16
+ /**
17
+ * Retrieves all Webhook logs for the specified Webhook.
18
+ * @param orgName Name of the Organization
19
+ * @param spaceName Name of the Space
20
+ * @param webhookId ID of the Webhook
21
+ * @param limit (optional) Max number of results (1-100; defaults to 25)
22
+ * @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
23
+ * @returns Object containing an array of Webhook logs and the total number of results found in the database (independent of limit and page)
24
+ */
25
+ getWebhookLogs(orgName, spaceName, webhookId, limit, page) {
26
+ return __awaiter(this, void 0, void 0, function* () {
28
27
  limit = limit || 25;
29
28
  page = page || 0;
30
29
  const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks/${webhookId}/logs?limit=${limit}&page=${page}`));
@@ -11,38 +11,38 @@ export declare class S3 extends Base {
11
11
  * @param waveBucketUrl Public base url to S3 bucket
12
12
  * @returns registry.json
13
13
  */
14
- getCatalogRegistry: (waveBucketUrl: string) => Promise<CatalogRegistry>;
14
+ getCatalogRegistry(waveBucketUrl: string): Promise<CatalogRegistry>;
15
15
  /**
16
16
  * Get the registry.json of the default wave engine from the S3 bucket
17
17
  * @param waveBucketUrl Public base url to S3 bucket
18
18
  * @returns registry.json
19
19
  */
20
- getEngineRegistry: (waveBucketUrl: string) => Promise<EngineRegistry>;
20
+ getEngineRegistry(waveBucketUrl: string): Promise<EngineRegistry>;
21
21
  /**
22
22
  * Get the catalog.json from the S3 bucket
23
23
  * @param catalogUrl Public url of the catalog
24
24
  * @returns index.json of catalog
25
25
  */
26
- getCatalog: (catalogUrl: string) => Promise<Catalog>;
26
+ getCatalog(catalogUrl: string): Promise<Catalog>;
27
27
  /**
28
28
  * Get the catalog.json from the S3 bucket
29
29
  * @param catalogUrl Public url of the catalog
30
30
  * @returns index.json of catalog
31
31
  */
32
- getEngine: (engineUrl: string) => Promise<Engine>;
32
+ getEngine(engineUrl: string): Promise<Engine>;
33
33
  /**
34
34
  * Get the node specifications of all nodes of a specific catalog version from the S3 bucket
35
35
  * @param catalogUrl Public url of the catalog
36
36
  * @param version The catalog version
37
37
  * @returns StreamNodeSpecification[] | StreamNodeSpecificationWrappedWithEngineVersion an array of all node specification of that catalog version, maybe wrapped in an object with the engine version
38
38
  */
39
- getCatalogVersion: (catalogUrl: string, version: string) => Promise<StreamNodeSpecifications[] | StreamNodeSpecificationWrappedWithEngineVersion>;
39
+ getCatalogVersion(catalogUrl: string, version: string): Promise<StreamNodeSpecifications[] | StreamNodeSpecificationWrappedWithEngineVersion>;
40
40
  /**
41
41
  * Get the node documentation from the S3 bucket
42
42
  * @param catalogUrl Public url of the catalog
43
43
  * @param version The catalog version
44
44
  * @returns string the markdown documentation of the node
45
45
  */
46
- getNodeDocumentation: (catalogUrl: string, version: string, nodeName: string) => Promise<string>;
46
+ getNodeDocumentation(catalogUrl: string, version: string, nodeName: string): Promise<string>;
47
47
  protected getEndpoint(): string;
48
48
  }
@@ -18,62 +18,74 @@ const axios_1 = require("../../../../interfaces/axios");
18
18
  class S3 extends Base_1.default {
19
19
  constructor(options, axios) {
20
20
  super(options, axios);
21
- /**
22
- * Get the registry.json of the default wave catalog from the S3 bucket
23
- * @param waveBucketUrl Public base url to S3 bucket
24
- * @returns registry.json
25
- */
26
- this.getCatalogRegistry = (waveBucketUrl) => __awaiter(this, void 0, void 0, function* () {
21
+ }
22
+ /**
23
+ * Get the registry.json of the default wave catalog from the S3 bucket
24
+ * @param waveBucketUrl Public base url to S3 bucket
25
+ * @returns registry.json
26
+ */
27
+ getCatalogRegistry(waveBucketUrl) {
28
+ return __awaiter(this, void 0, void 0, function* () {
27
29
  const resp = yield this.axios.get(`${waveBucketUrl}/catalogs/registry.json`, { headers: axios_1.disableCacheHeaders });
28
30
  return resp.data;
29
31
  });
30
- /**
31
- * Get the registry.json of the default wave engine from the S3 bucket
32
- * @param waveBucketUrl Public base url to S3 bucket
33
- * @returns registry.json
34
- */
35
- this.getEngineRegistry = (waveBucketUrl) => __awaiter(this, void 0, void 0, function* () {
32
+ }
33
+ /**
34
+ * Get the registry.json of the default wave engine from the S3 bucket
35
+ * @param waveBucketUrl Public base url to S3 bucket
36
+ * @returns registry.json
37
+ */
38
+ getEngineRegistry(waveBucketUrl) {
39
+ return __awaiter(this, void 0, void 0, function* () {
36
40
  const resp = yield this.axios.get(`${waveBucketUrl}/engines/registry.json`, { headers: axios_1.disableCacheHeaders });
37
41
  return resp.data;
38
42
  });
39
- /**
40
- * Get the catalog.json from the S3 bucket
41
- * @param catalogUrl Public url of the catalog
42
- * @returns index.json of catalog
43
- */
44
- this.getCatalog = (catalogUrl) => __awaiter(this, void 0, void 0, function* () {
43
+ }
44
+ /**
45
+ * Get the catalog.json from the S3 bucket
46
+ * @param catalogUrl Public url of the catalog
47
+ * @returns index.json of catalog
48
+ */
49
+ getCatalog(catalogUrl) {
50
+ return __awaiter(this, void 0, void 0, function* () {
45
51
  const resp = yield this.axios.get(`${catalogUrl}`, { headers: axios_1.disableCacheHeaders });
46
52
  return resp.data;
47
53
  });
48
- /**
49
- * Get the catalog.json from the S3 bucket
50
- * @param catalogUrl Public url of the catalog
51
- * @returns index.json of catalog
52
- */
53
- this.getEngine = (engineUrl) => __awaiter(this, void 0, void 0, function* () {
54
+ }
55
+ /**
56
+ * Get the catalog.json from the S3 bucket
57
+ * @param catalogUrl Public url of the catalog
58
+ * @returns index.json of catalog
59
+ */
60
+ getEngine(engineUrl) {
61
+ return __awaiter(this, void 0, void 0, function* () {
54
62
  const resp = yield this.axios.get(`${engineUrl}`, { headers: axios_1.disableCacheHeaders });
55
63
  return resp.data;
56
64
  });
57
- /**
58
- * Get the node specifications of all nodes of a specific catalog version from the S3 bucket
59
- * @param catalogUrl Public url of the catalog
60
- * @param version The catalog version
61
- * @returns StreamNodeSpecification[] | StreamNodeSpecificationWrappedWithEngineVersion an array of all node specification of that catalog version, maybe wrapped in an object with the engine version
62
- */
63
- this.getCatalogVersion = (catalogUrl, version) => __awaiter(this, void 0, void 0, function* () {
65
+ }
66
+ /**
67
+ * Get the node specifications of all nodes of a specific catalog version from the S3 bucket
68
+ * @param catalogUrl Public url of the catalog
69
+ * @param version The catalog version
70
+ * @returns StreamNodeSpecification[] | StreamNodeSpecificationWrappedWithEngineVersion an array of all node specification of that catalog version, maybe wrapped in an object with the engine version
71
+ */
72
+ getCatalogVersion(catalogUrl, version) {
73
+ return __awaiter(this, void 0, void 0, function* () {
64
74
  const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + "/" + version + "/specification.json";
65
75
  const resp = yield this.axios.get(specificationUrl, {
66
76
  headers: axios_1.disableCacheHeaders,
67
77
  });
68
78
  return resp.data;
69
79
  });
70
- /**
71
- * Get the node documentation from the S3 bucket
72
- * @param catalogUrl Public url of the catalog
73
- * @param version The catalog version
74
- * @returns string the markdown documentation of the node
75
- */
76
- this.getNodeDocumentation = (catalogUrl, version, nodeName) => __awaiter(this, void 0, void 0, function* () {
80
+ }
81
+ /**
82
+ * Get the node documentation from the S3 bucket
83
+ * @param catalogUrl Public url of the catalog
84
+ * @param version The catalog version
85
+ * @returns string the markdown documentation of the node
86
+ */
87
+ getNodeDocumentation(catalogUrl, version, nodeName) {
88
+ return __awaiter(this, void 0, void 0, function* () {
77
89
  const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + `/${version}/docs/${nodeName}.md`;
78
90
  const resp = yield this.axios.get(specificationUrl).catch(err => {
79
91
  throw new Error(`Node documentation not found: ${err}`);
@@ -1,5 +1,4 @@
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 { PreLoginResponse } from "../../interfaces/idp";
5
4
  import { SuccessfulAuth } from "../../interfaces/idp/user/SuccessfulAuth";
@@ -12,29 +11,33 @@ export default class Idp extends Base {
12
11
  /**
13
12
  * Handles everything around organizations
14
13
  */
15
- organization: IdpOrganization;
14
+ get organization(): IdpOrganization;
15
+ private _organization?;
16
16
  /**
17
17
  * Handles everything around registration
18
18
  */
19
- registration: IdpRegistration;
19
+ get registration(): IdpRegistration;
20
+ private _registration?;
20
21
  /**
21
22
  * Handles everything around open authorization and openId requests
22
23
  */
23
- oAuth: IdpOAuth;
24
+ get oAuth(): IdpOAuth;
25
+ private _oAuth?;
24
26
  /**
25
27
  * Handles everything around a user
26
28
  */
27
- user: IdpUser;
29
+ get user(): IdpUser;
30
+ private _user?;
28
31
  /**
29
32
  * Handles everything around idp's internal endpoints
30
33
  */
31
- internal: IdpInternal;
32
- constructor(options: Options, axios: AxiosInstance);
34
+ get internal(): IdpInternal;
35
+ private _internal?;
33
36
  /**
34
37
  * Requests the endpoint version
35
38
  * @returns Version object
36
39
  */
37
- version: () => Promise<Version>;
40
+ version(): Promise<Version>;
38
41
  /**
39
42
  * Authenticates against the identity provider with a given email and password.
40
43
  * @param email Email of the user
@@ -42,7 +45,7 @@ export default class Idp extends Base {
42
45
  * @param token (optional) token if 2FA-TOTP is enabled
43
46
  * @returns SuccessfulAuth object holding the token and the user
44
47
  */
45
- login: (email: string, password: string, token?: string) => Promise<SuccessfulAuth>;
48
+ login(email: string, password: string, token?: string): Promise<SuccessfulAuth>;
46
49
  /**
47
50
  * Starts the login process via OIDC
48
51
  * @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
@@ -51,14 +54,14 @@ export default class Idp extends Base {
51
54
  * @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
52
55
  * @returns URL that must be accessed via a browser to continue the login process.
53
56
  */
54
- loginWithOIDC: (origin: string, oidcProvider?: string, hint?: string) => Promise<string>;
57
+ loginWithOIDC(origin: string, oidcProvider?: string, hint?: string): Promise<string>;
55
58
  /**
56
59
  * Starts the login process via SAML 2.0
57
60
  * @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
58
61
  * @param email Email of the user. The email domain will be used to determine the appropriate SAML 2.0 provider to use going forward.
59
62
  * @returns URL that must be accessed via a browser to continue the login process.
60
63
  */
61
- loginWithSAML: (origin: string, email: string) => Promise<string>;
64
+ loginWithSAML(origin: string, email: string): Promise<string>;
62
65
  /**
63
66
  * Determine if/how the given email can authenticate.
64
67
  *
@@ -68,15 +71,14 @@ export default class Idp extends Base {
68
71
  * @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
69
72
  * or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
70
73
  */
71
- preLogin: (email: string, origin: string) => Promise<PreLoginResponse>;
74
+ preLogin(email: string, origin: string): Promise<PreLoginResponse>;
72
75
  /**
73
76
  * Initiate the password reset process. An email will be sent to the user to move to the next phase.
74
77
  *
75
78
  * @param email Email of the user
76
79
  * @param captcha Valid google reCAPTCHAV2
77
- * @param regionId Optional region id to use for the password reset email
78
80
  * @param targetUrl Optional url the link in the mail will point to
79
81
  */
80
- resetPassword: (email: string, captcha: string, regionId?: string, targetUrl?: string) => Promise<void>;
82
+ resetPassword(email: string, captcha: string, targetUrl?: string): Promise<void>;
81
83
  protected getEndpoint(endpoint: string): string;
82
84
  }
@@ -16,24 +16,70 @@ const organization_1 = require("./organization");
16
16
  const registration_1 = require("./registration");
17
17
  const user_1 = require("./user");
18
18
  class Idp extends Base_1.default {
19
- constructor(options, axios) {
20
- super(options, axios);
21
- /**
22
- * Requests the endpoint version
23
- * @returns Version object
24
- */
25
- this.version = () => __awaiter(this, void 0, void 0, function* () {
19
+ /**
20
+ * Handles everything around organizations
21
+ */
22
+ get organization() {
23
+ if (this._organization === undefined) {
24
+ this._organization = new organization_1.IdpOrganization(this.options, this.axios);
25
+ }
26
+ return this._organization;
27
+ }
28
+ /**
29
+ * Handles everything around registration
30
+ */
31
+ get registration() {
32
+ if (this._registration === undefined) {
33
+ this._registration = new registration_1.IdpRegistration(this.options, this.axios);
34
+ }
35
+ return this._registration;
36
+ }
37
+ /**
38
+ * Handles everything around open authorization and openId requests
39
+ */
40
+ get oAuth() {
41
+ if (this._oAuth === undefined) {
42
+ this._oAuth = new oauth_1.IdpOAuth(this.options, this.axios);
43
+ }
44
+ return this._oAuth;
45
+ }
46
+ /**
47
+ * Handles everything around a user
48
+ */
49
+ get user() {
50
+ if (this._user === undefined) {
51
+ this._user = new user_1.IdpUser(this.options, this.axios);
52
+ }
53
+ return this._user;
54
+ }
55
+ /**
56
+ * Handles everything around idp's internal endpoints
57
+ */
58
+ get internal() {
59
+ if (this._internal === undefined) {
60
+ this._internal = new internal_1.IdpInternal(this.options, this.axios);
61
+ }
62
+ return this._internal;
63
+ }
64
+ /**
65
+ * Requests the endpoint version
66
+ * @returns Version object
67
+ */
68
+ version() {
69
+ return __awaiter(this, void 0, void 0, function* () {
26
70
  const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
27
71
  return resp.data;
28
72
  });
29
- /**
30
- * Authenticates against the identity provider with a given email and password.
31
- * @param email Email of the user
32
- * @param password Password of the user
33
- * @param token (optional) token if 2FA-TOTP is enabled
34
- * @returns SuccessfulAuth object holding the token and the user
35
- */
36
- this.login = (email, password, token) => __awaiter(this, void 0, void 0, function* () {
73
+ }
74
+ /**
75
+ * Authenticates against the identity provider with a given email and password.
76
+ * @param email Email of the user
77
+ * @param password Password of the user
78
+ * @param token (optional) token if 2FA-TOTP is enabled
79
+ * @returns SuccessfulAuth object holding the token and the user
80
+ */
81
+ login(email, password, token) {
82
+ return __awaiter(this, void 0, void 0, function* () {
37
83
  var _a;
38
84
  let body = { email: email, password: password };
39
85
  if (token) {
@@ -46,15 +92,17 @@ class Idp extends Base_1.default {
46
92
  };
47
93
  return authed;
48
94
  });
49
- /**
50
- * Starts the login process via OIDC
51
- * @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
52
- * @param oidcProvider The provider to use for the process. Only optional if the user is part of an organization that has a preferred
53
- * OIDC provider and an associated email that matches the user's. The list of available providers can be found in the public config endpoint.
54
- * @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
55
- * @returns URL that must be accessed via a browser to continue the login process.
56
- */
57
- this.loginWithOIDC = (origin, oidcProvider, hint) => __awaiter(this, void 0, void 0, function* () {
95
+ }
96
+ /**
97
+ * Starts the login process via OIDC
98
+ * @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
99
+ * @param oidcProvider The provider to use for the process. Only optional if the user is part of an organization that has a preferred
100
+ * OIDC provider and an associated email that matches the user's. The list of available providers can be found in the public config endpoint.
101
+ * @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
102
+ * @returns URL that must be accessed via a browser to continue the login process.
103
+ */
104
+ loginWithOIDC(origin, oidcProvider, hint) {
105
+ return __awaiter(this, void 0, void 0, function* () {
58
106
  const resp = yield this.axios.get(this.getEndpoint("/v1/login/oidc"), {
59
107
  params: {
60
108
  origin,
@@ -72,13 +120,15 @@ class Idp extends Base_1.default {
72
120
  }
73
121
  return location;
74
122
  });
75
- /**
76
- * Starts the login process via SAML 2.0
77
- * @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
78
- * @param email Email of the user. The email domain will be used to determine the appropriate SAML 2.0 provider to use going forward.
79
- * @returns URL that must be accessed via a browser to continue the login process.
80
- */
81
- this.loginWithSAML = (origin, email) => __awaiter(this, void 0, void 0, function* () {
123
+ }
124
+ /**
125
+ * Starts the login process via SAML 2.0
126
+ * @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
127
+ * @param email Email of the user. The email domain will be used to determine the appropriate SAML 2.0 provider to use going forward.
128
+ * @returns URL that must be accessed via a browser to continue the login process.
129
+ */
130
+ loginWithSAML(origin, email) {
131
+ return __awaiter(this, void 0, void 0, function* () {
82
132
  const resp = yield this.axios.get(this.getEndpoint("/v1/login/saml"), {
83
133
  params: {
84
134
  origin,
@@ -95,16 +145,18 @@ class Idp extends Base_1.default {
95
145
  }
96
146
  return location;
97
147
  });
98
- /**
99
- * Determine if/how the given email can authenticate.
100
- *
101
- * @param email Email of the user
102
- * @param origin The starting URL of the process. If the authentication process bound to this email is SAML or OIDC,
103
- * then the response's location property will include this origin.
104
- * @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
105
- * or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
106
- */
107
- this.preLogin = (email, origin) => __awaiter(this, void 0, void 0, function* () {
148
+ }
149
+ /**
150
+ * Determine if/how the given email can authenticate.
151
+ *
152
+ * @param email Email of the user
153
+ * @param origin The starting URL of the process. If the authentication process bound to this email is SAML or OIDC,
154
+ * then the response's location property will include this origin.
155
+ * @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
156
+ * or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
157
+ */
158
+ preLogin(email, origin) {
159
+ return __awaiter(this, void 0, void 0, function* () {
108
160
  const resp = yield this.axios.get(this.getEndpoint("/v1/login/pre"), {
109
161
  params: {
110
162
  origin,
@@ -113,22 +165,18 @@ class Idp extends Base_1.default {
113
165
  });
114
166
  return resp.data;
115
167
  });
116
- /**
117
- * Initiate the password reset process. An email will be sent to the user to move to the next phase.
118
- *
119
- * @param email Email of the user
120
- * @param captcha Valid google reCAPTCHAV2
121
- * @param regionId Optional region id to use for the password reset email
122
- * @param targetUrl Optional url the link in the mail will point to
123
- */
124
- this.resetPassword = (email, captcha, regionId, targetUrl) => __awaiter(this, void 0, void 0, function* () {
125
- yield this.axios.post(this.getEndpoint("/v1/login/forgot_password"), { email, captcha, regionId, targetUrl });
168
+ }
169
+ /**
170
+ * Initiate the password reset process. An email will be sent to the user to move to the next phase.
171
+ *
172
+ * @param email Email of the user
173
+ * @param captcha Valid google reCAPTCHAV2
174
+ * @param targetUrl Optional url the link in the mail will point to
175
+ */
176
+ resetPassword(email, captcha, targetUrl) {
177
+ return __awaiter(this, void 0, void 0, function* () {
178
+ yield this.axios.post(this.getEndpoint("/v1/login/forgot_password"), { email, captcha, targetUrl });
126
179
  });
127
- this.organization = new organization_1.IdpOrganization(this.options, this.axios);
128
- this.user = new user_1.IdpUser(this.options, this.axios);
129
- this.registration = new registration_1.IdpRegistration(this.options, this.axios);
130
- this.oAuth = new oauth_1.IdpOAuth(this.options, this.axios);
131
- this.internal = new internal_1.IdpInternal(this.options, this.axios);
132
180
  }
133
181
  getEndpoint(endpoint) {
134
182
  return `${this.options.server}/api/account${endpoint}`;
@@ -1,8 +1,6 @@
1
- import { AxiosInstance } from "axios";
2
- import Base, { Options } from "../../../Base";
1
+ import Base from "../../../Base";
3
2
  import { User } from "../../../interfaces/idp/user";
4
3
  export declare class IdpInternal extends Base {
5
- constructor(options: Options, axios: AxiosInstance);
6
4
  /**
7
5
  * Creates an agent user for an organization.
8
6
  *
@@ -11,7 +9,7 @@ export declare class IdpInternal extends Base {
11
9
  * @param orgName Name of the organization
12
10
  * @returns the created user and a pat token
13
11
  */
14
- createAgentUser: (orgName: string) => Promise<{
12
+ createAgentUser(orgName: string): Promise<{
15
13
  user: User;
16
14
  pat: string;
17
15
  }>;
@@ -12,17 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
12
12
  exports.IdpInternal = void 0;
13
13
  const Base_1 = require("../../../Base");
14
14
  class IdpInternal extends Base_1.default {
15
- constructor(options, axios) {
16
- super(options, axios);
17
- /**
18
- * Creates an agent user for an organization.
19
- *
20
- * This is an internal endpoint and requires HCloud admin credentials to use.
21
- *
22
- * @param orgName Name of the organization
23
- * @returns the created user and a pat token
24
- */
25
- this.createAgentUser = (orgName) => __awaiter(this, void 0, void 0, function* () {
15
+ /**
16
+ * Creates an agent user for an organization.
17
+ *
18
+ * This is an internal endpoint and requires HCloud admin credentials to use.
19
+ *
20
+ * @param orgName Name of the organization
21
+ * @returns the created user and a pat token
22
+ */
23
+ createAgentUser(orgName) {
24
+ return __awaiter(this, void 0, void 0, function* () {
26
25
  const res = yield this.axios.post(this.getEndpoint(`/internal/v1/org/${orgName}/agent`));
27
26
  return { user: res.data, pat: res.headers.authorization };
28
27
  });
@@ -1,9 +1,7 @@
1
- import { AxiosInstance } from "axios";
2
- import Base, { Options } from "../../../Base";
1
+ import Base from "../../../Base";
3
2
  import { OAuthToken, OAuthTokenRequest } from "../../../interfaces/idp/oauth";
4
- import { OAuthApp } from "../../../interfaces/idp/organization/settings/oauthApp";
3
+ import { OAuthAppWithConsent } from "../../../interfaces/idp/organization/settings/oauthApp";
5
4
  export declare class IdpOAuth extends Base {
6
- constructor(options: Options, axios: AxiosInstance);
7
5
  /**
8
6
  * getAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
9
7
  * It returns the redirect URL with the code, which is used to redirect to the client application,
@@ -12,13 +10,12 @@ export declare class IdpOAuth extends Base {
12
10
  * redirect_uri, scopes and optionally state.
13
11
  * @returns the entire redirect uri including the authorization code if successful
14
12
  */
15
- getAuthorizationCodeInsideRedirectUrl: (queryString: string, doNotRedirect?: boolean) => Promise<string>;
13
+ getAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean): Promise<string>;
16
14
  /**
17
- * Attempt to get information about a certain OAuth app. If the user has already consented to all the scopes required
18
- * this request will instead return the redirect URL.
15
+ * Check if the user has consented to specified scopes. If the user has already consented this request
16
+ * will return the redirect URL, otherwise, it will be a consent.not.given error.
19
17
  *
20
- * If the user has not consented the return of this function will be an OAuthApp. To consent the
21
- * createScopesAndGetAuthorizationCodeInsideRedirectUrl method should be used.
18
+ * To consent the createScopesAndGetAuthorizationCodeInsideRedirectUrl method should be used.
22
19
  * @see IdpOAuth.createScopesAndGetAuthorizationCodeInsideRedirectUrl
23
20
  *
24
21
  * @param queryString {string} - Query string containing the OAuth parameters: response_type, client_id, scope, state
@@ -26,7 +23,7 @@ export declare class IdpOAuth extends Base {
26
23
  * @returns A string with the redirect URL if the user already consented to the specificied scope. Otherwise, an OAuthApp
27
24
  * @see OAuthApp
28
25
  */
29
- getInfoOrAuthorizationCodeInsideRedirectUrl: (queryString: string, doNotRedirect?: boolean) => Promise<string | OAuthApp>;
26
+ getInfoOrAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean): Promise<string>;
30
27
  /**
31
28
  * createScopesAndGetAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
32
29
  * It returns the redirect URL with the code, which is used to redirect to the client application,
@@ -35,11 +32,18 @@ export declare class IdpOAuth extends Base {
35
32
  * redirect_uri, scopes and optionally state.
36
33
  * @returns the entire redirect uri including the authorization code if successful
37
34
  */
38
- createScopesAndGetAuthorizationCodeInsideRedirectUrl: (queryString: string, doNotRedirect?: boolean) => Promise<string>;
35
+ createScopesAndGetAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean): Promise<string>;
39
36
  /**
40
37
  * A valid code can be used to request a new API token.
41
38
  * @param tokenRequest contains the code, client_id, client_secret and redirect_uri
42
39
  */
43
- exchangeCodeForToken: (tokenRequest: OAuthTokenRequest) => Promise<OAuthToken>;
40
+ exchangeCodeForToken(tokenRequest: OAuthTokenRequest): Promise<OAuthToken>;
41
+ /**
42
+ * Get OAuth app public information via client ID
43
+ *
44
+ * @param clientId {string} - Client ID of the OAuth app
45
+ * @returns Public OAuth app information
46
+ */
47
+ getOAuthAppInfo: (clientId: string) => Promise<OAuthAppWithConsent>;
44
48
  protected getEndpoint(endpoint: string): string;
45
49
  }