hcloud-sdk 0.0.16 → 14.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/changelog.md +809 -0
- package/index.d.ts +3 -2
- package/index.js +5 -2
- package/lib/Base.d.ts +26 -0
- package/lib/Base.js +12 -0
- package/lib/Hcloud.d.ts +80 -0
- package/lib/Hcloud.js +134 -0
- package/lib/helper/ErrorHelper.d.ts +7 -0
- package/lib/helper/ErrorHelper.js +19 -0
- package/lib/helper/paginatedResponseHelper.d.ts +3 -0
- package/lib/helper/paginatedResponseHelper.js +9 -0
- package/lib/helper/searchFilter.d.ts +9 -0
- package/lib/helper/searchFilter.js +12 -0
- package/lib/interfaces/agent/bundle/dev/index.d.ts +3 -0
- package/lib/interfaces/agent/context/index.d.ts +19 -0
- package/lib/interfaces/agent/index.d.ts +21 -0
- package/lib/interfaces/agent/index.js +2 -0
- package/lib/interfaces/{Auditor.d.ts → auditor/index.d.ts} +31 -5
- package/lib/interfaces/{Auditor.js → auditor/index.js} +15 -5
- package/lib/interfaces/axios/index.d.ts +5 -0
- package/lib/interfaces/axios/index.js +8 -0
- package/lib/interfaces/bouncer/features/index.d.ts +10 -0
- package/lib/interfaces/bouncer/features/index.js +2 -0
- package/lib/interfaces/bouncer/index.d.ts +6 -0
- package/lib/interfaces/bouncer/index.js +17 -0
- package/lib/interfaces/dali/index.d.ts +3 -0
- package/lib/interfaces/dali/index.js +2 -0
- package/lib/interfaces/frontend/config/index.d.ts +33 -0
- package/lib/interfaces/frontend/config/index.js +10 -0
- package/lib/interfaces/fuse/index.d.ts +3 -0
- package/lib/interfaces/fuse/index.js +19 -0
- package/lib/interfaces/fuse/space/cronjob/Cronjob.d.ts +38 -0
- package/lib/interfaces/fuse/space/cronjob/Cronjob.js +8 -0
- package/lib/interfaces/fuse/space/cronjob/CronjobLog.d.ts +16 -0
- package/lib/interfaces/fuse/space/cronjob/CronjobLog.js +2 -0
- package/lib/interfaces/fuse/space/index.d.ts +21 -0
- package/lib/interfaces/fuse/space/index.js +11 -0
- package/lib/interfaces/global/HCloudError.d.ts +8 -0
- package/lib/interfaces/global/HCloudError.js +13 -0
- package/lib/interfaces/global/Header.d.ts +4 -0
- package/lib/interfaces/global/Header.js +2 -0
- package/lib/interfaces/global/HttpMethod.d.ts +7 -0
- package/lib/interfaces/global/HttpMethod.js +11 -0
- package/lib/interfaces/global/PaginatedResponse.d.ts +4 -0
- package/lib/interfaces/global/PaginatedResponse.js +2 -0
- package/lib/interfaces/global/Products.d.ts +11 -0
- package/lib/interfaces/global/Products.js +15 -0
- package/lib/interfaces/global/SearchFilters.d.ts +86 -0
- package/lib/interfaces/global/SearchFilters.js +49 -0
- package/lib/interfaces/global/Space.d.ts +20 -0
- package/lib/interfaces/global/Space.js +8 -0
- package/lib/interfaces/global/Version.d.ts +3 -0
- package/lib/interfaces/global/Version.js +2 -0
- package/lib/interfaces/global/Views.d.ts +8 -0
- package/lib/interfaces/global/Views.js +12 -0
- package/lib/interfaces/global/index.d.ts +9 -0
- package/lib/interfaces/global/index.js +25 -0
- package/lib/interfaces/high5/index.d.ts +16 -0
- package/lib/interfaces/high5/index.js +32 -0
- package/lib/interfaces/high5/joinToken/index.d.ts +10 -0
- package/lib/interfaces/high5/joinToken/index.js +2 -0
- package/lib/interfaces/high5/space/event/index.d.ts +15 -0
- package/lib/interfaces/high5/space/event/index.js +2 -0
- package/lib/interfaces/high5/space/event/stream/design/DesignOperation.d.ts +68 -0
- package/lib/interfaces/high5/space/event/stream/design/DesignOperation.js +20 -0
- package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +92 -0
- package/lib/interfaces/high5/space/event/stream/design/StreamDesign.js +20 -0
- package/lib/interfaces/high5/space/event/stream/design/index.d.ts +22 -0
- package/lib/interfaces/high5/space/event/stream/design/index.js +2 -0
- package/lib/interfaces/high5/space/event/stream/design/snapshot/index.d.ts +30 -0
- package/lib/interfaces/high5/space/event/stream/design/snapshot/index.js +8 -0
- package/lib/interfaces/high5/space/event/stream/index.d.ts +77 -0
- package/lib/interfaces/high5/space/event/stream/index.js +13 -0
- package/lib/interfaces/high5/space/event/stream/node/index.d.ts +60 -0
- package/lib/interfaces/high5/space/event/stream/node/index.js +7 -0
- package/lib/interfaces/high5/space/execution/index.d.ts +137 -0
- package/lib/interfaces/high5/space/execution/index.js +21 -0
- package/lib/interfaces/high5/space/index.d.ts +23 -0
- package/lib/interfaces/high5/space/index.js +12 -0
- package/lib/interfaces/high5/space/secret/index.d.ts +12 -0
- package/lib/interfaces/high5/space/secret/index.js +2 -0
- package/lib/interfaces/high5/space/webhook/index.d.ts +75 -0
- package/lib/interfaces/high5/space/webhook/index.js +9 -0
- package/lib/interfaces/high5/wave/index.d.ts +171 -0
- package/lib/interfaces/high5/wave/index.js +52 -0
- package/lib/interfaces/idp/index.d.ts +26 -0
- package/lib/interfaces/idp/index.js +38 -0
- package/lib/interfaces/idp/oauth/index.d.ts +19 -0
- package/lib/interfaces/idp/oauth/index.js +8 -0
- package/lib/interfaces/idp/organization/index.d.ts +32 -0
- package/lib/interfaces/idp/organization/index.js +25 -0
- package/lib/interfaces/idp/organization/license/index.d.ts +84 -0
- package/lib/interfaces/idp/organization/license/index.js +15 -0
- package/lib/interfaces/idp/organization/member/index.d.ts +15 -0
- package/lib/interfaces/idp/organization/member/index.js +2 -0
- package/lib/interfaces/idp/organization/member/invitations/index.d.ts +26 -0
- package/lib/interfaces/idp/organization/member/invitations/index.js +18 -0
- package/lib/interfaces/idp/organization/settings/domain/index.d.ts +19 -0
- package/lib/interfaces/idp/organization/settings/domain/index.js +8 -0
- package/lib/interfaces/idp/organization/settings/domain/saml/index.d.ts +10 -0
- package/lib/interfaces/idp/organization/settings/domain/saml/index.js +2 -0
- package/lib/interfaces/idp/organization/settings/oauthApp/index.d.ts +37 -0
- package/lib/interfaces/idp/organization/settings/oauthApp/index.js +2 -0
- package/lib/interfaces/idp/organization/team/index.d.ts +24 -0
- package/lib/interfaces/idp/organization/team/index.js +9 -0
- package/lib/interfaces/idp/user/ConnectionSettings.d.ts +6 -0
- package/lib/interfaces/idp/user/ConnectionSettings.js +2 -0
- package/lib/interfaces/idp/user/GeneralSettings.d.ts +44 -0
- package/lib/interfaces/idp/user/GeneralSettings.js +38 -0
- package/lib/interfaces/idp/user/NotificationSettings.d.ts +8 -0
- package/lib/interfaces/idp/user/NotificationSettings.js +2 -0
- package/lib/interfaces/idp/user/Pat.d.ts +19 -0
- package/lib/interfaces/idp/user/Pat.js +2 -0
- package/lib/interfaces/idp/user/Scopes.d.ts +40 -0
- package/lib/interfaces/idp/user/Scopes.js +50 -0
- package/lib/interfaces/idp/user/SuccessfulAuth.d.ts +5 -0
- package/lib/interfaces/idp/user/SuccessfulAuth.js +2 -0
- package/lib/interfaces/idp/user/Totp.d.ts +20 -0
- package/lib/interfaces/idp/user/Totp.js +2 -0
- package/lib/interfaces/idp/user/index.d.ts +23 -0
- package/lib/interfaces/idp/user/index.js +2 -0
- package/lib/interfaces/mailer/index.d.ts +66 -0
- package/lib/interfaces/mailer/index.js +81 -0
- package/lib/interfaces/mothership/index.d.ts +27 -0
- package/lib/interfaces/mothership/index.js +8 -0
- package/lib/interfaces/nats/index.d.ts +252 -0
- package/lib/interfaces/nats/index.js +334 -0
- package/lib/service/agent/bundle/dev/index.d.ts +17 -0
- package/lib/service/agent/bundle/dev/index.js +40 -0
- package/lib/service/agent/bundle/index.d.ts +11 -0
- package/lib/service/agent/bundle/index.js +55 -0
- package/lib/service/agent/context/index.d.ts +37 -0
- package/lib/service/agent/context/index.js +81 -0
- package/lib/service/agent/index.d.ts +14 -0
- package/lib/service/agent/index.js +20 -0
- package/lib/service/agent/installer/index.d.ts +15 -0
- package/lib/service/agent/installer/index.js +97 -0
- package/lib/service/auditor/index.d.ts +26 -0
- package/lib/service/auditor/index.js +49 -0
- package/lib/service/auditor/internal/index.d.ts +27 -0
- package/lib/service/{AuditorInternal.js → auditor/internal/index.js} +20 -24
- package/lib/service/bouncer/features/index.d.ts +8 -0
- package/lib/service/bouncer/features/index.js +25 -0
- package/lib/service/bouncer/index.d.ts +14 -0
- package/lib/service/bouncer/index.js +31 -0
- package/lib/service/dali/DaliAvatar.d.ts +36 -0
- package/lib/service/dali/DaliAvatar.js +25 -0
- package/lib/service/dali/avatar/DaliFuseSpace.d.ts +28 -0
- package/lib/service/dali/avatar/DaliFuseSpace.js +55 -0
- package/lib/service/dali/avatar/DaliHigh5Space.d.ts +28 -0
- package/lib/service/dali/avatar/DaliHigh5Space.js +55 -0
- package/lib/service/dali/avatar/DaliOAuthApp.d.ts +28 -0
- package/lib/service/dali/avatar/DaliOAuthApp.js +55 -0
- package/lib/service/dali/avatar/DaliOrganization.d.ts +25 -0
- package/lib/service/dali/avatar/DaliOrganization.js +52 -0
- package/lib/service/dali/avatar/DaliTeam.d.ts +28 -0
- package/lib/service/dali/avatar/DaliTeam.js +55 -0
- package/lib/service/dali/avatar/DaliUser.d.ts +22 -0
- package/lib/service/dali/avatar/DaliUser.js +49 -0
- package/lib/service/dali/index.d.ts +16 -0
- package/lib/service/dali/index.js +30 -0
- package/lib/service/fuse/index.d.ts +17 -0
- package/lib/service/fuse/index.js +34 -0
- package/lib/service/fuse/internal/index.d.ts +9 -0
- package/lib/service/fuse/internal/index.js +29 -0
- package/lib/service/fuse/internal/space/cronjob/index.d.ts +8 -0
- package/lib/service/fuse/internal/space/cronjob/index.js +15 -0
- package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +17 -0
- package/lib/service/fuse/internal/space/cronjob/log/index.js +35 -0
- package/lib/service/fuse/internal/space/index.d.ts +23 -0
- package/lib/service/fuse/internal/space/index.js +43 -0
- package/lib/service/fuse/space/cronjob/index.d.ts +123 -0
- package/lib/service/fuse/space/cronjob/index.js +175 -0
- package/lib/service/fuse/space/cronjob/log/index.d.ts +31 -0
- package/lib/service/fuse/space/cronjob/log/index.js +57 -0
- package/lib/service/fuse/space/index.d.ts +82 -0
- package/lib/service/fuse/space/index.js +134 -0
- package/lib/service/high5/execution/index.d.ts +10 -0
- package/lib/service/high5/execution/index.js +17 -0
- package/lib/service/high5/execution/log/index.d.ts +19 -0
- package/lib/service/high5/execution/log/index.js +41 -0
- package/lib/service/high5/execution/status/index.d.ts +18 -0
- package/lib/service/high5/execution/status/index.js +41 -0
- package/lib/service/high5/index.d.ts +22 -0
- package/lib/service/high5/index.js +39 -0
- package/lib/service/high5/internal/index.d.ts +9 -0
- package/lib/service/high5/internal/index.js +29 -0
- package/lib/service/high5/internal/space/index.d.ts +21 -0
- package/lib/service/high5/internal/space/index.js +41 -0
- package/lib/service/high5/joinToken/index.d.ts +40 -0
- package/lib/service/high5/joinToken/index.js +64 -0
- package/lib/service/high5/space/event/index.d.ts +56 -0
- package/lib/service/high5/space/event/index.js +89 -0
- package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +31 -0
- package/lib/service/high5/space/event/stream/design/DesignOperations.js +117 -0
- package/lib/service/high5/space/event/stream/design/index.d.ts +38 -0
- package/lib/service/high5/space/event/stream/design/index.js +56 -0
- package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +62 -0
- package/lib/service/high5/space/event/stream/design/snapshot/index.js +100 -0
- package/lib/service/high5/space/event/stream/index.d.ts +114 -0
- package/lib/service/high5/space/event/stream/index.js +164 -0
- package/lib/service/high5/space/execution/index.d.ts +48 -0
- package/lib/service/high5/space/execution/index.js +74 -0
- package/lib/service/high5/space/execution/log/index.d.ts +31 -0
- package/lib/service/high5/space/execution/log/index.js +57 -0
- package/lib/service/high5/space/execution/status/index.d.ts +16 -0
- package/lib/service/high5/space/execution/status/index.js +34 -0
- package/lib/service/high5/space/index.d.ts +107 -0
- package/lib/service/high5/space/index.js +160 -0
- package/lib/service/high5/space/node/index.d.ts +58 -0
- package/lib/service/high5/space/node/index.js +116 -0
- package/lib/service/high5/space/secret/index.d.ts +60 -0
- package/lib/service/high5/space/secret/index.js +92 -0
- package/lib/service/high5/space/wave/index.d.ts +38 -0
- package/lib/service/high5/space/wave/index.js +66 -0
- package/lib/service/high5/space/webhook/index.d.ts +83 -0
- package/lib/service/high5/space/webhook/index.js +132 -0
- package/lib/service/high5/space/webhook/log/index.d.ts +18 -0
- package/lib/service/high5/space/webhook/log/index.js +38 -0
- package/lib/service/high5/wave/index.d.ts +8 -0
- package/lib/service/high5/wave/index.js +15 -0
- package/lib/service/high5/wave/s3/index.d.ts +48 -0
- package/lib/service/high5/wave/s3/index.js +88 -0
- package/lib/service/idp/index.d.ts +82 -0
- package/lib/service/idp/index.js +137 -0
- package/lib/service/idp/internal/index.d.ts +19 -0
- package/lib/service/idp/internal/index.js +34 -0
- package/lib/service/idp/oauth/index.d.ts +45 -0
- package/lib/service/idp/oauth/index.js +105 -0
- package/lib/service/idp/organization/index.d.ts +54 -0
- package/lib/service/idp/organization/index.js +79 -0
- package/lib/service/idp/organization/license/index.d.ts +7 -0
- package/lib/service/idp/organization/license/index.js +30 -0
- package/lib/service/idp/organization/member/index.d.ts +58 -0
- package/lib/service/idp/organization/member/index.js +96 -0
- package/lib/service/idp/organization/member/invitations/index.d.ts +79 -0
- package/lib/service/idp/organization/member/invitations/index.js +118 -0
- package/lib/service/idp/organization/settings/domain/index.d.ts +38 -0
- package/lib/service/idp/organization/settings/domain/index.js +63 -0
- package/lib/service/idp/organization/settings/domain/saml/index.d.ts +43 -0
- package/lib/service/idp/organization/settings/domain/saml/index.js +88 -0
- package/lib/service/idp/organization/settings/index.d.ts +16 -0
- package/lib/service/idp/organization/settings/index.js +16 -0
- package/lib/service/idp/organization/settings/oauth/index.d.ts +64 -0
- package/lib/service/idp/organization/settings/oauth/index.js +106 -0
- package/lib/service/idp/organization/team/index.d.ts +72 -0
- package/lib/service/idp/organization/team/index.js +115 -0
- package/lib/service/idp/registration/index.d.ts +39 -0
- package/lib/service/idp/registration/index.js +84 -0
- package/lib/service/idp/user/index.d.ts +82 -0
- package/lib/service/idp/user/index.js +125 -0
- package/lib/service/idp/user/license/index.d.ts +7 -0
- package/lib/service/idp/user/license/index.js +30 -0
- package/lib/service/idp/user/password/index.d.ts +19 -0
- package/lib/service/idp/user/password/index.js +52 -0
- package/lib/service/idp/user/settings/connections/index.d.ts +15 -0
- package/lib/service/idp/user/settings/connections/index.js +33 -0
- package/lib/service/idp/user/settings/general/index.d.ts +18 -0
- package/lib/service/idp/user/settings/general/index.js +39 -0
- package/lib/service/idp/user/settings/index.d.ts +36 -0
- package/lib/service/idp/user/settings/index.js +25 -0
- package/lib/service/idp/user/settings/notifications/index.d.ts +18 -0
- package/lib/service/idp/user/settings/notifications/index.js +39 -0
- package/lib/service/idp/user/settings/oauthApps/index.d.ts +22 -0
- package/lib/service/idp/user/settings/oauthApps/index.js +54 -0
- package/lib/service/idp/user/settings/pats/index.d.ts +50 -0
- package/lib/service/idp/user/settings/pats/index.js +93 -0
- package/lib/service/idp/user/settings/twoFactor/index.d.ts +11 -0
- package/lib/service/idp/user/settings/twoFactor/index.js +15 -0
- package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +34 -0
- package/lib/service/idp/user/settings/twoFactor/totp/index.js +65 -0
- package/lib/service/mailer/index.d.ts +14 -0
- package/lib/service/{Mailer.js → mailer/index.js} +9 -12
- package/lib/service/mailer/internal/index.d.ts +36 -0
- package/lib/service/mailer/internal/index.js +64 -0
- package/lib/service/mothership/index.d.ts +97 -0
- package/lib/service/mothership/index.js +136 -0
- package/lib/service/nats/index.d.ts +51 -0
- package/lib/service/nats/index.js +138 -0
- package/lib/utils/Types.d.ts +1 -0
- package/lib/utils/Types.js +2 -0
- package/lib/utils/bouncer/features/Provider.d.ts +16 -0
- package/lib/utils/bouncer/features/Provider.js +83 -0
- package/package.json +37 -29
- package/lib/base.d.ts +0 -12
- package/lib/base.js +0 -8
- package/lib/hcloud.d.ts +0 -13
- package/lib/hcloud.js +0 -29
- package/lib/interfaces/Global.d.ts +0 -8
- package/lib/interfaces/IDP.d.ts +0 -9
- package/lib/interfaces/Mail.d.ts +0 -29
- package/lib/interfaces/Mail.js +0 -8
- package/lib/service/Auditor.d.ts +0 -22
- package/lib/service/Auditor.js +0 -61
- package/lib/service/AuditorInternal.d.ts +0 -28
- package/lib/service/High5.d.ts +0 -4
- package/lib/service/High5.js +0 -9
- package/lib/service/IDP.d.ts +0 -39
- package/lib/service/IDP.js +0 -84
- package/lib/service/Mailer.d.ts +0 -13
- package/lib/service/MailerInternal.d.ts +0 -32
- package/lib/service/MailerInternal.js +0 -64
- /package/lib/interfaces/{Global.js → agent/bundle/dev/index.js} +0 -0
- /package/lib/interfaces/{IDP.js → agent/context/index.js} +0 -0
|
@@ -0,0 +1,39 @@
|
|
|
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.IdpGeneral = void 0;
|
|
13
|
+
const Base_1 = require("../../../../../Base");
|
|
14
|
+
class IdpGeneral extends Base_1.default {
|
|
15
|
+
constructor(options, axios) {
|
|
16
|
+
super(options, axios);
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the current active user settings.
|
|
19
|
+
* @returns the current active user settings
|
|
20
|
+
*/
|
|
21
|
+
this.getGeneralSettings = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/user/settings/general`));
|
|
23
|
+
return resp.data;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Changes the user settings.
|
|
27
|
+
* @param generalSettingsPatch Object containing the new user settings
|
|
28
|
+
* @returns the updated user settings
|
|
29
|
+
*/
|
|
30
|
+
this.patchGeneralSettings = (generalSettingsPatch) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/general`), generalSettingsPatch);
|
|
32
|
+
return resp.data;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getEndpoint(endpoint) {
|
|
36
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.IdpGeneral = IdpGeneral;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../Base";
|
|
3
|
+
import { IdpConnections } from "./connections";
|
|
4
|
+
import { IdpGeneral } from "./general";
|
|
5
|
+
import { IdpNotifications } from "./notifications";
|
|
6
|
+
import { IdpOAuthApps } from "./oauthApps";
|
|
7
|
+
import { IdpPat } from "./pats";
|
|
8
|
+
import { IdpTwoFactor } from "./twoFactor";
|
|
9
|
+
export declare class IdpSettings extends Base {
|
|
10
|
+
/**
|
|
11
|
+
* Handles everything around a user's pats (Personal Access Tokens)
|
|
12
|
+
*/
|
|
13
|
+
pat: IdpPat;
|
|
14
|
+
/**
|
|
15
|
+
* Handles everything around general user settings
|
|
16
|
+
*/
|
|
17
|
+
general: IdpGeneral;
|
|
18
|
+
/**
|
|
19
|
+
* Handles everything around notification settings of user
|
|
20
|
+
*/
|
|
21
|
+
notifications: IdpNotifications;
|
|
22
|
+
/**
|
|
23
|
+
* Manages user's OAuth applications
|
|
24
|
+
*/
|
|
25
|
+
oAuthApps: IdpOAuthApps;
|
|
26
|
+
/**
|
|
27
|
+
* Handles everything around a user's two factor authentication
|
|
28
|
+
*/
|
|
29
|
+
twoFactor: IdpTwoFactor;
|
|
30
|
+
/**
|
|
31
|
+
* Handles everything around a user's two factor authentication
|
|
32
|
+
*/
|
|
33
|
+
connections: IdpConnections;
|
|
34
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
35
|
+
protected getEndpoint(endpoint: string): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdpSettings = void 0;
|
|
4
|
+
const Base_1 = require("../../../../Base");
|
|
5
|
+
const connections_1 = require("./connections");
|
|
6
|
+
const general_1 = require("./general");
|
|
7
|
+
const notifications_1 = require("./notifications");
|
|
8
|
+
const oauthApps_1 = require("./oauthApps");
|
|
9
|
+
const pats_1 = require("./pats");
|
|
10
|
+
const twoFactor_1 = require("./twoFactor");
|
|
11
|
+
class IdpSettings extends Base_1.default {
|
|
12
|
+
constructor(options, axios) {
|
|
13
|
+
super(options, axios);
|
|
14
|
+
this.pat = new pats_1.IdpPat(options, axios);
|
|
15
|
+
this.twoFactor = new twoFactor_1.IdpTwoFactor(options, axios);
|
|
16
|
+
this.general = new general_1.IdpGeneral(options, axios);
|
|
17
|
+
this.notifications = new notifications_1.IdpNotifications(options, axios);
|
|
18
|
+
this.oAuthApps = new oauthApps_1.IdpOAuthApps(options, axios);
|
|
19
|
+
this.connections = new connections_1.IdpConnections(options, axios);
|
|
20
|
+
}
|
|
21
|
+
getEndpoint(endpoint) {
|
|
22
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.IdpSettings = IdpSettings;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../../Base";
|
|
3
|
+
import { NotificationSettings, NotificationSettingsPatch } from "../../../../../interfaces/idp/user/NotificationSettings";
|
|
4
|
+
export declare class IdpNotifications extends Base {
|
|
5
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves the notification settings of the requesting user.
|
|
8
|
+
* @returns general settings of requesting user
|
|
9
|
+
*/
|
|
10
|
+
getNotificationSettingsOfUser: () => Promise<NotificationSettings>;
|
|
11
|
+
/**
|
|
12
|
+
* Updates the notification settings of the requesting user.
|
|
13
|
+
* @param notificationSettingsPatch Object containing the new notification settings
|
|
14
|
+
* @returns the updated notification settings
|
|
15
|
+
*/
|
|
16
|
+
patchNotificationSettings: (notificationSettingsPatch: NotificationSettingsPatch) => Promise<NotificationSettings>;
|
|
17
|
+
protected getEndpoint(endpoint: string): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
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.IdpNotifications = void 0;
|
|
13
|
+
const Base_1 = require("../../../../../Base");
|
|
14
|
+
class IdpNotifications extends Base_1.default {
|
|
15
|
+
constructor(options, axios) {
|
|
16
|
+
super(options, axios);
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves the notification settings of the requesting user.
|
|
19
|
+
* @returns general settings of requesting user
|
|
20
|
+
*/
|
|
21
|
+
this.getNotificationSettingsOfUser = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/user/settings/notifications`));
|
|
23
|
+
return resp.data;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Updates the notification settings of the requesting user.
|
|
27
|
+
* @param notificationSettingsPatch Object containing the new notification settings
|
|
28
|
+
* @returns the updated notification settings
|
|
29
|
+
*/
|
|
30
|
+
this.patchNotificationSettings = (notificationSettingsPatch) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/notifications`), notificationSettingsPatch);
|
|
32
|
+
return resp.data;
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
getEndpoint(endpoint) {
|
|
36
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
exports.IdpNotifications = IdpNotifications;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../../Base";
|
|
3
|
+
import { PaginatedResponse, SearchParams } from "../../../../../interfaces/global";
|
|
4
|
+
import { OAuthAppWithConsent } from "../../../../../interfaces/idp/organization/settings/oauthApp";
|
|
5
|
+
export declare class IdpOAuthApps extends Base {
|
|
6
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves all OAuth apps of the requesting User that match the provided search filter(s). Returns all OAuth apps if no search filter is provided.
|
|
9
|
+
* @param filters (optional) Array of search filters
|
|
10
|
+
* @param sorting (optional) Sorting object
|
|
11
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
12
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
13
|
+
* @returns Object containing an array of OAuth apps and the total number of results found in the database (independent of limit and page)
|
|
14
|
+
*/
|
|
15
|
+
searchOAuthApps: ({ filters, sorting, limit, page }: SearchParams) => Promise<PaginatedResponse<OAuthAppWithConsent>>;
|
|
16
|
+
/**
|
|
17
|
+
* Revokes user access from the provided OAuth app.
|
|
18
|
+
* @param oAuthAppId ID of the OAuth app
|
|
19
|
+
*/
|
|
20
|
+
revokeOAuthAppAccess: (oAuthAppId: string) => Promise<void>;
|
|
21
|
+
protected getEndpoint(endpoint: string): string;
|
|
22
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
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.IdpOAuthApps = void 0;
|
|
13
|
+
const Base_1 = require("../../../../../Base");
|
|
14
|
+
const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
|
|
15
|
+
const searchFilter_1 = require("../../../../../helper/searchFilter");
|
|
16
|
+
class IdpOAuthApps extends Base_1.default {
|
|
17
|
+
constructor(options, axios) {
|
|
18
|
+
super(options, axios);
|
|
19
|
+
/**
|
|
20
|
+
* Retrieves all OAuth apps of the requesting User that match the provided search filter(s). Returns all OAuth apps if no search filter is provided.
|
|
21
|
+
* @param filters (optional) Array of search filters
|
|
22
|
+
* @param sorting (optional) Sorting object
|
|
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 OAuth apps and the total number of results found in the database (independent of limit and page)
|
|
26
|
+
*/
|
|
27
|
+
this.searchOAuthApps = (_a) => __awaiter(this, [_a], void 0, function* ({ filters, sorting, limit = 25, page = 0 }) {
|
|
28
|
+
const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
|
|
29
|
+
return new searchFilter_1.SearchFilterDTO(f);
|
|
30
|
+
});
|
|
31
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/user/settings/oauth/search`), {
|
|
32
|
+
filters: filtersDTO,
|
|
33
|
+
sorting: sorting,
|
|
34
|
+
}, {
|
|
35
|
+
params: {
|
|
36
|
+
limit,
|
|
37
|
+
page,
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
|
|
41
|
+
});
|
|
42
|
+
/**
|
|
43
|
+
* Revokes user access from the provided OAuth app.
|
|
44
|
+
* @param oAuthAppId ID of the OAuth app
|
|
45
|
+
*/
|
|
46
|
+
this.revokeOAuthAppAccess = (oAuthAppId) => __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
yield this.axios.delete(this.getEndpoint(`/v1/user/settings/oauth/${oAuthAppId}/revoke`));
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getEndpoint(endpoint) {
|
|
51
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
exports.IdpOAuthApps = IdpOAuthApps;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../../Base";
|
|
3
|
+
import { PaginatedResponse, SearchParams } from "../../../../../interfaces/global";
|
|
4
|
+
import { Pat, PatCreate, PatUpdate } from "../../../../../interfaces/idp/user/Pat";
|
|
5
|
+
export declare class IdpPat extends Base {
|
|
6
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
7
|
+
/**
|
|
8
|
+
* Search all personal access tokens (PATs) of the requesting user.
|
|
9
|
+
* @returns Paginated response of PAT objects
|
|
10
|
+
*/
|
|
11
|
+
searchPats: ({ filters, sorting, limit, page }: SearchParams) => Promise<PaginatedResponse<Pat>>;
|
|
12
|
+
/**
|
|
13
|
+
* Retrieves a single personal access token (PAT) by ID.
|
|
14
|
+
* @param patId ID of the PAT
|
|
15
|
+
* @returns The requested PAT object
|
|
16
|
+
*/
|
|
17
|
+
getPat: (patId: string) => Promise<Pat>;
|
|
18
|
+
/**
|
|
19
|
+
* Regenerates a personal access token (PAT).
|
|
20
|
+
* @param patId ID of the PAT
|
|
21
|
+
* @returns PAT object holding the updated token
|
|
22
|
+
*/
|
|
23
|
+
regeneratePat: (patId: string, token?: string) => Promise<Pat>;
|
|
24
|
+
/**
|
|
25
|
+
* Creates a new personal access token (PAT) for requesting user
|
|
26
|
+
* @param patCreate Object with informations needed to create a PAT: Name, expiration and scopes
|
|
27
|
+
* @returns the created PAT object
|
|
28
|
+
*/
|
|
29
|
+
generatePat: (patCreate: PatCreate) => Promise<Pat>;
|
|
30
|
+
/**
|
|
31
|
+
* Updates an existing PAT object.
|
|
32
|
+
*
|
|
33
|
+
* Use an expiration value of -1 to remove the token's expiration date.
|
|
34
|
+
*
|
|
35
|
+
* @param patId ID of the pat object
|
|
36
|
+
* @param patUpdate Object containing new name, expiration and scopes
|
|
37
|
+
* @returns the updated PAT object
|
|
38
|
+
*/
|
|
39
|
+
updatePat: (patId: string, patUpdate: PatUpdate) => Promise<Pat>;
|
|
40
|
+
/**
|
|
41
|
+
* Deletes a personal access token (PAT) of the requesting User.
|
|
42
|
+
* @param patId Id of the PAT
|
|
43
|
+
*/
|
|
44
|
+
deletePat: (patId: string) => Promise<void>;
|
|
45
|
+
/**
|
|
46
|
+
* Deletes all personal access tokens (PATs) of the requesting User.
|
|
47
|
+
*/
|
|
48
|
+
deleteAllPats: () => Promise<void>;
|
|
49
|
+
protected getEndpoint(endpoint: string): string;
|
|
50
|
+
}
|
|
@@ -0,0 +1,93 @@
|
|
|
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.IdpPat = void 0;
|
|
13
|
+
const Base_1 = require("../../../../../Base");
|
|
14
|
+
const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
|
|
15
|
+
const searchFilter_1 = require("../../../../../helper/searchFilter");
|
|
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 }) {
|
|
24
|
+
const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
|
|
25
|
+
return new searchFilter_1.SearchFilterDTO(f);
|
|
26
|
+
});
|
|
27
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/user/settings/pats/search`), {
|
|
28
|
+
filters: filtersDTO,
|
|
29
|
+
sorting,
|
|
30
|
+
}, {
|
|
31
|
+
params: { limit, page },
|
|
32
|
+
});
|
|
33
|
+
return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
|
|
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
|
+
this.getPat = (patId) => __awaiter(this, void 0, void 0, function* () {
|
|
41
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/user/settings/pats/${patId}`));
|
|
42
|
+
return resp.data;
|
|
43
|
+
});
|
|
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* () {
|
|
50
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/pats/${patId}/regenerate`), { token });
|
|
51
|
+
return resp.data;
|
|
52
|
+
});
|
|
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* () {
|
|
59
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/user/settings/pats`), patCreate);
|
|
60
|
+
return resp.data;
|
|
61
|
+
});
|
|
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* () {
|
|
72
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/pats/${patId}`), patUpdate);
|
|
73
|
+
return resp.data;
|
|
74
|
+
});
|
|
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* () {
|
|
80
|
+
yield this.axios.delete(this.getEndpoint(`/v1/user/settings/pats/${patId}`));
|
|
81
|
+
});
|
|
82
|
+
/**
|
|
83
|
+
* Deletes all personal access tokens (PATs) of the requesting User.
|
|
84
|
+
*/
|
|
85
|
+
this.deleteAllPats = () => __awaiter(this, void 0, void 0, function* () {
|
|
86
|
+
yield this.axios.delete(this.getEndpoint(`/v1/user/settings/pats`));
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
getEndpoint(endpoint) {
|
|
90
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.IdpPat = IdpPat;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../../Base";
|
|
3
|
+
import { IdpTotp } from "./totp";
|
|
4
|
+
export declare class IdpTwoFactor extends Base {
|
|
5
|
+
/**
|
|
6
|
+
* Handles everything around a user's pats (Personal Access Tokens)
|
|
7
|
+
*/
|
|
8
|
+
totp: IdpTotp;
|
|
9
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
10
|
+
protected getEndpoint(endpoint: string): string;
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.IdpTwoFactor = void 0;
|
|
4
|
+
const Base_1 = require("../../../../../Base");
|
|
5
|
+
const totp_1 = require("./totp");
|
|
6
|
+
class IdpTwoFactor extends Base_1.default {
|
|
7
|
+
constructor(options, axios) {
|
|
8
|
+
super(options, axios);
|
|
9
|
+
this.totp = new totp_1.IdpTotp(options, axios);
|
|
10
|
+
}
|
|
11
|
+
getEndpoint(endpoint) {
|
|
12
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.IdpTwoFactor = IdpTwoFactor;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../../../Base";
|
|
3
|
+
import { ActivatedTotp, DeactivatedTotp, UserTotp } from "../../../../../../interfaces/idp/user/Totp";
|
|
4
|
+
export declare class IdpTotp extends Base {
|
|
5
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
6
|
+
/**
|
|
7
|
+
* Creates a new TOTP for the requesting User.
|
|
8
|
+
* @returns A deactivated TOTP object containing a QR code and the OTPAuth URL
|
|
9
|
+
*/
|
|
10
|
+
createTotp: () => Promise<DeactivatedTotp>;
|
|
11
|
+
/**
|
|
12
|
+
* Activates a previously created TOTP.
|
|
13
|
+
* @returns Object containing a list of recover codes in case of TOTP authenticator loss
|
|
14
|
+
*/
|
|
15
|
+
activateTotp: (token: string) => Promise<ActivatedTotp>;
|
|
16
|
+
/**
|
|
17
|
+
* Verifies a TOTP.
|
|
18
|
+
* @param userTotp TOTP to verify
|
|
19
|
+
*/
|
|
20
|
+
verifyTotp: (userTotp: UserTotp) => Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Deactivates (deletes) a previously activated TOTP.
|
|
23
|
+
* @param token TOTP to deactivate
|
|
24
|
+
*/
|
|
25
|
+
deactivateTotp: (token: string) => Promise<void>;
|
|
26
|
+
/**
|
|
27
|
+
* Deactivates (deletes) a previously activated TOTP by using a recovery code.
|
|
28
|
+
* @param email Email of the User
|
|
29
|
+
* @param password Password
|
|
30
|
+
* @param code Recovery code
|
|
31
|
+
*/
|
|
32
|
+
deactivateTotpByRecoverCode: (email: string, password: string, code: string) => Promise<void>;
|
|
33
|
+
protected getEndpoint(endpoint: string): string;
|
|
34
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
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.IdpTotp = void 0;
|
|
13
|
+
const Base_1 = require("../../../../../../Base");
|
|
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* () {
|
|
22
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/user/settings/security/2fa/totp`));
|
|
23
|
+
return resp.data;
|
|
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
|
+
this.activateTotp = (token) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/user/settings/security/2fa/totp/activate`), { token });
|
|
31
|
+
return resp.data;
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Verifies a TOTP.
|
|
35
|
+
* @param userTotp TOTP to verify
|
|
36
|
+
*/
|
|
37
|
+
this.verifyTotp = (userTotp) => __awaiter(this, void 0, void 0, function* () {
|
|
38
|
+
yield this.axios.patch(this.getEndpoint(`/v1/login/verify/totp`), {
|
|
39
|
+
userTotp,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
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* () {
|
|
47
|
+
yield this.axios.delete(this.getEndpoint(`/v1/user/settings/security/2fa/totp`), { data: { token } });
|
|
48
|
+
});
|
|
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* () {
|
|
56
|
+
yield this.axios.delete(this.getEndpoint(`/v1/user/recover/totp`), {
|
|
57
|
+
data: { email, password, code },
|
|
58
|
+
});
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getEndpoint(endpoint) {
|
|
62
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
exports.IdpTotp = IdpTotp;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../Base";
|
|
3
|
+
import { Version } from "../../interfaces/global";
|
|
4
|
+
import MailerInternal from "./internal";
|
|
5
|
+
export default class Mailer extends Base {
|
|
6
|
+
internal: MailerInternal;
|
|
7
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
8
|
+
/**
|
|
9
|
+
* Requests the endpoint version
|
|
10
|
+
* @returns Version object
|
|
11
|
+
*/
|
|
12
|
+
version: () => Promise<Version>;
|
|
13
|
+
protected getEndpoint(endpoint: string): string;
|
|
14
|
+
}
|
|
@@ -9,26 +9,23 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
super(opts);
|
|
12
|
+
const Base_1 = require("../../Base");
|
|
13
|
+
const internal_1 = require("./internal");
|
|
14
|
+
class Mailer extends Base_1.default {
|
|
15
|
+
constructor(options, axios) {
|
|
16
|
+
super(options, axios);
|
|
18
17
|
/**
|
|
19
|
-
*
|
|
18
|
+
* Requests the endpoint version
|
|
20
19
|
* @returns Version object
|
|
21
20
|
*/
|
|
22
21
|
this.version = () => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
-
const resp = yield
|
|
24
|
-
throw err;
|
|
25
|
-
});
|
|
22
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/version"), {});
|
|
26
23
|
return resp.data;
|
|
27
24
|
});
|
|
28
|
-
this.
|
|
25
|
+
this.internal = new internal_1.default(this.options, this.axios);
|
|
29
26
|
}
|
|
30
27
|
getEndpoint(endpoint) {
|
|
31
|
-
return `${this.
|
|
28
|
+
return `${this.options.server}/api/mailer${endpoint}`;
|
|
32
29
|
}
|
|
33
30
|
}
|
|
34
31
|
exports.default = Mailer;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import Base from "../../../Base";
|
|
2
|
+
import { HtmlMail, MailjetMailDTO, MustacheMail, TemplateMail } from "../../../interfaces/mailer";
|
|
3
|
+
export default class MailerInternal extends Base {
|
|
4
|
+
/**
|
|
5
|
+
* Sends a new mail based on a mailjet template.
|
|
6
|
+
*
|
|
7
|
+
* THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
|
|
8
|
+
* @param mail MailjetMailDTO
|
|
9
|
+
*/
|
|
10
|
+
sendMailMailjet: (mail: MailjetMailDTO) => Promise<void>;
|
|
11
|
+
/**
|
|
12
|
+
* Sends a new mail based on a mustache html body.
|
|
13
|
+
*
|
|
14
|
+
* THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
|
|
15
|
+
* @param mail TemplateMail
|
|
16
|
+
* @deprecated in favor of sendMailMailjet
|
|
17
|
+
*/
|
|
18
|
+
sendMailMustache: (mail: MustacheMail) => Promise<void>;
|
|
19
|
+
/**
|
|
20
|
+
* Sends a new mail based on a html body.
|
|
21
|
+
*
|
|
22
|
+
* THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
|
|
23
|
+
* @param mail TemplateMail
|
|
24
|
+
* @deprecated in favor of sendMailMailjet
|
|
25
|
+
*/
|
|
26
|
+
sendMailHtml: (mail: HtmlMail) => Promise<void>;
|
|
27
|
+
/**
|
|
28
|
+
* Sends a new mail based on an existing template.
|
|
29
|
+
*
|
|
30
|
+
* THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
|
|
31
|
+
* @param mail TemplateMail
|
|
32
|
+
* @deprecated in favor of sendMailMailjet
|
|
33
|
+
*/
|
|
34
|
+
sendMailTemplate: (mail: TemplateMail) => Promise<void>;
|
|
35
|
+
protected getEndpoint(endpoint: string): string;
|
|
36
|
+
}
|