hcloud-sdk 0.0.15 → 14.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/index.d.ts +72 -0
- package/lib/interfaces/{Auditor.js → auditor/index.js} +21 -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/auditor/internal/index.js +61 -0
- 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/index.js +31 -0
- 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 +36 -27
- package/lib/base.d.ts +0 -12
- package/lib/base.js +0 -8
- package/lib/hcloud.d.ts +0 -11
- package/lib/hcloud.js +0 -27
- package/lib/interfaces/Auditor.d.ts +0 -40
- package/lib/interfaces/Global.d.ts +0 -8
- package/lib/interfaces/IDP.d.ts +0 -9
- package/lib/service/Auditor.d.ts +0 -42
- package/lib/service/Auditor.js +0 -101
- 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/interfaces/{Global.js → agent/bundle/dev/index.js} +0 -0
- /package/lib/interfaces/{IDP.js → agent/context/index.js} +0 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../Base";
|
|
3
|
+
import { User } from "../../../interfaces/idp/user";
|
|
4
|
+
export declare class IdpInternal extends Base {
|
|
5
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
6
|
+
/**
|
|
7
|
+
* Creates an agent user for an organization.
|
|
8
|
+
*
|
|
9
|
+
* This is an internal endpoint and requires HCloud admin credentials to use.
|
|
10
|
+
*
|
|
11
|
+
* @param orgName Name of the organization
|
|
12
|
+
* @returns the created user and a pat token
|
|
13
|
+
*/
|
|
14
|
+
createAgentUser: (orgName: string) => Promise<{
|
|
15
|
+
user: User;
|
|
16
|
+
pat: string;
|
|
17
|
+
}>;
|
|
18
|
+
protected getEndpoint(endpoint: string): string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
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.IdpInternal = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
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* () {
|
|
26
|
+
const res = yield this.axios.post(this.getEndpoint(`/internal/v1/org/${orgName}/agent`));
|
|
27
|
+
return { user: res.data, pat: res.headers.authorization };
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
getEndpoint(endpoint) {
|
|
31
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.IdpInternal = IdpInternal;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../Base";
|
|
3
|
+
import { OAuthToken, OAuthTokenRequest } from "../../../interfaces/idp/oauth";
|
|
4
|
+
import { OAuthApp } from "../../../interfaces/idp/organization/settings/oauthApp";
|
|
5
|
+
export declare class IdpOAuth extends Base {
|
|
6
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
7
|
+
/**
|
|
8
|
+
* getAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
|
|
9
|
+
* It returns the redirect URL with the code, which is used to redirect to the client application,
|
|
10
|
+
* which can use the code for a back-channel request to get the access token.
|
|
11
|
+
* @param queryString expect the user's / browser's query string, containing the response_type, client_id,
|
|
12
|
+
* redirect_uri, scopes and optionally state.
|
|
13
|
+
* @returns the entire redirect uri including the authorization code if successful
|
|
14
|
+
*/
|
|
15
|
+
getAuthorizationCodeInsideRedirectUrl: (queryString: string, doNotRedirect?: boolean) => Promise<string>;
|
|
16
|
+
/**
|
|
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.
|
|
19
|
+
*
|
|
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.
|
|
22
|
+
* @see IdpOAuth.createScopesAndGetAuthorizationCodeInsideRedirectUrl
|
|
23
|
+
*
|
|
24
|
+
* @param queryString {string} - Query string containing the OAuth parameters: response_type, client_id, scope, state
|
|
25
|
+
* @param doNotRedirect [boolean] - Flag to make the request return a 200 instead of a 3xx status code
|
|
26
|
+
* @returns A string with the redirect URL if the user already consented to the specificied scope. Otherwise, an OAuthApp
|
|
27
|
+
* @see OAuthApp
|
|
28
|
+
*/
|
|
29
|
+
getInfoOrAuthorizationCodeInsideRedirectUrl: (queryString: string, doNotRedirect?: boolean) => Promise<string | OAuthApp>;
|
|
30
|
+
/**
|
|
31
|
+
* createScopesAndGetAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
|
|
32
|
+
* It returns the redirect URL with the code, which is used to redirect to the client application,
|
|
33
|
+
* which can use the code for a back-channel request to get the access token. It also adds the scopes for the user.
|
|
34
|
+
* @param queryString expect the user's / browser's query string, containing the response_type, client_id,
|
|
35
|
+
* redirect_uri, scopes and optionally state.
|
|
36
|
+
* @returns the entire redirect uri including the authorization code if successful
|
|
37
|
+
*/
|
|
38
|
+
createScopesAndGetAuthorizationCodeInsideRedirectUrl: (queryString: string, doNotRedirect?: boolean) => Promise<string>;
|
|
39
|
+
/**
|
|
40
|
+
* A valid code can be used to request a new API token.
|
|
41
|
+
* @param tokenRequest contains the code, client_id, client_secret and redirect_uri
|
|
42
|
+
*/
|
|
43
|
+
exchangeCodeForToken: (tokenRequest: OAuthTokenRequest) => Promise<OAuthToken>;
|
|
44
|
+
protected getEndpoint(endpoint: string): string;
|
|
45
|
+
}
|
|
@@ -0,0 +1,105 @@
|
|
|
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.IdpOAuth = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
class IdpOAuth extends Base_1.default {
|
|
15
|
+
constructor(options, axios) {
|
|
16
|
+
super(options, axios);
|
|
17
|
+
/**
|
|
18
|
+
* getAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
|
|
19
|
+
* It returns the redirect URL with the code, which is used to redirect to the client application,
|
|
20
|
+
* which can use the code for a back-channel request to get the access token.
|
|
21
|
+
* @param queryString expect the user's / browser's query string, containing the response_type, client_id,
|
|
22
|
+
* redirect_uri, scopes and optionally state.
|
|
23
|
+
* @returns the entire redirect uri including the authorization code if successful
|
|
24
|
+
*/
|
|
25
|
+
this.getAuthorizationCodeInsideRedirectUrl = (queryString, doNotRedirect) => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
if (!queryString.startsWith("?")) {
|
|
27
|
+
queryString = `?${queryString}`;
|
|
28
|
+
}
|
|
29
|
+
if (doNotRedirect) {
|
|
30
|
+
queryString += "&no_redirect=true";
|
|
31
|
+
}
|
|
32
|
+
const response = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/authorize${queryString}`), { maxRedirects: 0 });
|
|
33
|
+
if (doNotRedirect) {
|
|
34
|
+
return response.data.redirectUrl;
|
|
35
|
+
}
|
|
36
|
+
return response.headers.location;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Attempt to get information about a certain OAuth app. If the user has already consented to all the scopes required
|
|
40
|
+
* this request will instead return the redirect URL.
|
|
41
|
+
*
|
|
42
|
+
* If the user has not consented the return of this function will be an OAuthApp. To consent the
|
|
43
|
+
* createScopesAndGetAuthorizationCodeInsideRedirectUrl method should be used.
|
|
44
|
+
* @see IdpOAuth.createScopesAndGetAuthorizationCodeInsideRedirectUrl
|
|
45
|
+
*
|
|
46
|
+
* @param queryString {string} - Query string containing the OAuth parameters: response_type, client_id, scope, state
|
|
47
|
+
* @param doNotRedirect [boolean] - Flag to make the request return a 200 instead of a 3xx status code
|
|
48
|
+
* @returns A string with the redirect URL if the user already consented to the specificied scope. Otherwise, an OAuthApp
|
|
49
|
+
* @see OAuthApp
|
|
50
|
+
*/
|
|
51
|
+
this.getInfoOrAuthorizationCodeInsideRedirectUrl = (queryString, doNotRedirect) => __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
if (!queryString.startsWith("?")) {
|
|
53
|
+
queryString = `?${queryString}`;
|
|
54
|
+
}
|
|
55
|
+
if (doNotRedirect) {
|
|
56
|
+
queryString += "&no_redirect=true";
|
|
57
|
+
}
|
|
58
|
+
const response = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/info${queryString}`), {
|
|
59
|
+
maxRedirects: 0,
|
|
60
|
+
});
|
|
61
|
+
if (response.status < 300) {
|
|
62
|
+
if ("redirectUrl" in response.data) {
|
|
63
|
+
return response.data.redirectUrl;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return response.data;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return response.headers.location;
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* createScopesAndGetAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
|
|
73
|
+
* It returns the redirect URL with the code, which is used to redirect to the client application,
|
|
74
|
+
* which can use the code for a back-channel request to get the access token. It also adds the scopes for the user.
|
|
75
|
+
* @param queryString expect the user's / browser's query string, containing the response_type, client_id,
|
|
76
|
+
* redirect_uri, scopes and optionally state.
|
|
77
|
+
* @returns the entire redirect uri including the authorization code if successful
|
|
78
|
+
*/
|
|
79
|
+
this.createScopesAndGetAuthorizationCodeInsideRedirectUrl = (queryString, doNotRedirect) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
if (!queryString.startsWith("?")) {
|
|
81
|
+
queryString = `?${queryString}`;
|
|
82
|
+
}
|
|
83
|
+
if (doNotRedirect) {
|
|
84
|
+
queryString += "&no_redirect=true";
|
|
85
|
+
}
|
|
86
|
+
const response = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/authorize${queryString}`));
|
|
87
|
+
if (doNotRedirect) {
|
|
88
|
+
return response.data.redirectUrl;
|
|
89
|
+
}
|
|
90
|
+
return response.data;
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* A valid code can be used to request a new API token.
|
|
94
|
+
* @param tokenRequest contains the code, client_id, client_secret and redirect_uri
|
|
95
|
+
*/
|
|
96
|
+
this.exchangeCodeForToken = (tokenRequest) => __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
const response = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/access_token`), tokenRequest);
|
|
98
|
+
return response.data;
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
getEndpoint(endpoint) {
|
|
102
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.IdpOAuth = IdpOAuth;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../Base";
|
|
3
|
+
import { Organization, OrganizationQueryOptions } from "../../../interfaces/idp/organization";
|
|
4
|
+
import { IdpOrganizationLicense } from "./license";
|
|
5
|
+
import { IdpOrganizationMember } from "./member";
|
|
6
|
+
import IdpOrganizationSettings from "./settings";
|
|
7
|
+
import { IdpOrganizationTeams } from "./team";
|
|
8
|
+
export declare class IdpOrganization extends Base {
|
|
9
|
+
/**
|
|
10
|
+
* Handles everything around organization members
|
|
11
|
+
*/
|
|
12
|
+
member: IdpOrganizationMember;
|
|
13
|
+
/**
|
|
14
|
+
* Handles everything around organization settings
|
|
15
|
+
*/
|
|
16
|
+
settings: IdpOrganizationSettings;
|
|
17
|
+
/**
|
|
18
|
+
* Handles everything around teams of organizations.
|
|
19
|
+
*/
|
|
20
|
+
teams: IdpOrganizationTeams;
|
|
21
|
+
/**
|
|
22
|
+
* Handles everything around licenses.
|
|
23
|
+
*/
|
|
24
|
+
license: IdpOrganizationLicense;
|
|
25
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
26
|
+
/**
|
|
27
|
+
* Updates an Organization.
|
|
28
|
+
* @param orgName Current name of the Organization
|
|
29
|
+
* @param newName New name for the organization
|
|
30
|
+
* @param company (optional) New company name
|
|
31
|
+
* @returns The updated Organization
|
|
32
|
+
*/
|
|
33
|
+
updateOrganization: (orgName: string, newName: string, company?: string) => Promise<Organization>;
|
|
34
|
+
/**
|
|
35
|
+
* Creates a new Organization.
|
|
36
|
+
* @param name Name of the new Organization
|
|
37
|
+
* @param company (optional) Company name for the new Organization
|
|
38
|
+
* @returns The created Organization
|
|
39
|
+
*/
|
|
40
|
+
createOrganization: (name: string, company?: string) => Promise<Organization>;
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves an Organization by its name.
|
|
43
|
+
* @param orgName Name of the Organization
|
|
44
|
+
* @param options Defines query options to retrieve additional properties in the response
|
|
45
|
+
* @returns The requested Organization
|
|
46
|
+
*/
|
|
47
|
+
getOrganization(orgName: string, options?: OrganizationQueryOptions): Promise<Organization>;
|
|
48
|
+
/**
|
|
49
|
+
* Deletes an Organization. This will also delete all dependencies that the Organization has (Teams, Spaces, apps, ...).
|
|
50
|
+
* @param orgName Name of the Organization to be deleted
|
|
51
|
+
*/
|
|
52
|
+
deleteOrganization: (orgName: string) => Promise<void>;
|
|
53
|
+
protected getEndpoint(endpoint: string): string;
|
|
54
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
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.IdpOrganization = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
const license_1 = require("./license");
|
|
15
|
+
const member_1 = require("./member");
|
|
16
|
+
const settings_1 = require("./settings");
|
|
17
|
+
const team_1 = require("./team");
|
|
18
|
+
class IdpOrganization extends Base_1.default {
|
|
19
|
+
constructor(options, axios) {
|
|
20
|
+
super(options, axios);
|
|
21
|
+
/**
|
|
22
|
+
* Updates an Organization.
|
|
23
|
+
* @param orgName Current name of the Organization
|
|
24
|
+
* @param newName New name for the organization
|
|
25
|
+
* @param company (optional) New company name
|
|
26
|
+
* @returns The updated Organization
|
|
27
|
+
*/
|
|
28
|
+
this.updateOrganization = (orgName, newName, company) => __awaiter(this, void 0, void 0, function* () {
|
|
29
|
+
const organization = { name: newName, company: company };
|
|
30
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}`), organization);
|
|
31
|
+
return resp.data;
|
|
32
|
+
});
|
|
33
|
+
/**
|
|
34
|
+
* Creates a new Organization.
|
|
35
|
+
* @param name Name of the new Organization
|
|
36
|
+
* @param company (optional) Company name for the new Organization
|
|
37
|
+
* @returns The created Organization
|
|
38
|
+
*/
|
|
39
|
+
this.createOrganization = (name, company) => __awaiter(this, void 0, void 0, function* () {
|
|
40
|
+
const organization = { name: name, company: company };
|
|
41
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org`), organization);
|
|
42
|
+
return resp.data;
|
|
43
|
+
});
|
|
44
|
+
/**
|
|
45
|
+
* Deletes an Organization. This will also delete all dependencies that the Organization has (Teams, Spaces, apps, ...).
|
|
46
|
+
* @param orgName Name of the Organization to be deleted
|
|
47
|
+
*/
|
|
48
|
+
this.deleteOrganization = (orgName) => __awaiter(this, void 0, void 0, function* () {
|
|
49
|
+
yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}`));
|
|
50
|
+
});
|
|
51
|
+
this.member = new member_1.IdpOrganizationMember(this.options, this.axios);
|
|
52
|
+
this.teams = new team_1.IdpOrganizationTeams(this.options, this.axios);
|
|
53
|
+
this.settings = new settings_1.default(this.options, this.axios);
|
|
54
|
+
this.license = new license_1.IdpOrganizationLicense(this.options, this.axios);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Retrieves an Organization by its name.
|
|
58
|
+
* @param orgName Name of the Organization
|
|
59
|
+
* @param options Defines query options to retrieve additional properties in the response
|
|
60
|
+
* @returns The requested Organization
|
|
61
|
+
*/
|
|
62
|
+
getOrganization(orgName, options) {
|
|
63
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}`), {
|
|
65
|
+
params: {
|
|
66
|
+
teamsOfUser: options === null || options === void 0 ? void 0 : options.getTeamsOfUser,
|
|
67
|
+
totalMemberCount: options === null || options === void 0 ? void 0 : options.getTotalMemberCount,
|
|
68
|
+
membersSample: options === null || options === void 0 ? void 0 : options.getMembersSample,
|
|
69
|
+
license: options === null || options === void 0 ? void 0 : options.getLicense,
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
return resp.data;
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
getEndpoint(endpoint) {
|
|
76
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
exports.IdpOrganization = IdpOrganization;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import Base from "../../../../Base";
|
|
2
|
+
import { License } from "../../../../interfaces/idp/organization/license";
|
|
3
|
+
export declare class IdpOrganizationLicense extends Base {
|
|
4
|
+
getLicense: (orgName: string) => Promise<License>;
|
|
5
|
+
updateLicense: (orgName: string, token: string) => Promise<License>;
|
|
6
|
+
protected getEndpoint(endpoint: string): string;
|
|
7
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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.IdpOrganizationLicense = void 0;
|
|
13
|
+
const Base_1 = require("../../../../Base");
|
|
14
|
+
class IdpOrganizationLicense extends Base_1.default {
|
|
15
|
+
constructor() {
|
|
16
|
+
super(...arguments);
|
|
17
|
+
this.getLicense = (orgName) => __awaiter(this, void 0, void 0, function* () {
|
|
18
|
+
const res = yield this.axios.get(this.getEndpoint(`/org/${orgName}/license`));
|
|
19
|
+
return res.data;
|
|
20
|
+
});
|
|
21
|
+
this.updateLicense = (orgName, token) => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const res = yield this.axios.put(this.getEndpoint(`/org/${orgName}/license`), { identifier: token });
|
|
23
|
+
return res.data;
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
getEndpoint(endpoint) {
|
|
27
|
+
return `${this.options.server}/api/account/v1${endpoint}`;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.IdpOrganizationLicense = IdpOrganizationLicense;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../Base";
|
|
3
|
+
import { PaginatedResponse, SearchParams } from "../../../../interfaces/global";
|
|
4
|
+
import { OrganizationMember, OrgMemberPatch } from "../../../../interfaces/idp/organization/member";
|
|
5
|
+
import IdpOrganizationMemberInvitations from "./invitations";
|
|
6
|
+
export declare class IdpOrganizationMember extends Base {
|
|
7
|
+
invitations: IdpOrganizationMemberInvitations;
|
|
8
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves all organization members that match the provided search filter(s). Will return all members of the organization if no search filter is provided.
|
|
11
|
+
* @param orgName Name of the Organization
|
|
12
|
+
* @param filters (optional) Array of search filters
|
|
13
|
+
* @param excludeTeamByName (optional) Name of a team whos members shall be excluded
|
|
14
|
+
* @param sorting (optional) Sorting object
|
|
15
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
16
|
+
* @param page (optional) Page number to skip the first (page * limit) results (defaults to 0)
|
|
17
|
+
* @returns Object containing an array of Organization Members and the total number of results found in the database (independent of limit and page)
|
|
18
|
+
*/
|
|
19
|
+
searchOrganizationMembers: ({ orgName, filters, excludeTeamByName, sorting, limit, page, }: SearchParams & {
|
|
20
|
+
orgName: string;
|
|
21
|
+
excludeTeamByName?: string;
|
|
22
|
+
}) => Promise<PaginatedResponse<OrganizationMember>>;
|
|
23
|
+
/**
|
|
24
|
+
* Retrieves an organization member by its user ID.
|
|
25
|
+
* @param orgName Name of the organization
|
|
26
|
+
* @param userId ID of the user
|
|
27
|
+
* @returns The requested Organization Member
|
|
28
|
+
*/
|
|
29
|
+
getOrganizationMember: (orgName: string, userId: string) => Promise<OrganizationMember>;
|
|
30
|
+
/**
|
|
31
|
+
* Updates the role of a User in the specified Organization.
|
|
32
|
+
* @param orgName Name of the Organization
|
|
33
|
+
* @param userId ID of the User
|
|
34
|
+
* @param orgMemberPatch New role
|
|
35
|
+
* @returns The updated OrganizationMember
|
|
36
|
+
*/
|
|
37
|
+
patchOrganizationMemberRole: (orgName: string, userId: string, orgMemberPatch: OrgMemberPatch) => Promise<OrganizationMember>;
|
|
38
|
+
/**
|
|
39
|
+
* Updates the executionTarget flag of a User in the specified Organization.
|
|
40
|
+
* @param orgName Name of the Organization
|
|
41
|
+
* @param userId ID of the User
|
|
42
|
+
* @param executionTarget Boolean value to set
|
|
43
|
+
* @returns The updated OrganizationMember
|
|
44
|
+
*/
|
|
45
|
+
patchOrganizationExecutionTarget: (orgName: string, userId: string, executionTarget: boolean) => Promise<OrganizationMember>;
|
|
46
|
+
/**
|
|
47
|
+
* Removes a Member from an Organization.
|
|
48
|
+
* @param orgName Name of the Organization
|
|
49
|
+
* @param userId ID of the User
|
|
50
|
+
*/
|
|
51
|
+
removeOrganizationMember: (orgName: string, userId: string) => Promise<void>;
|
|
52
|
+
/**
|
|
53
|
+
* Member leaves the organization independently.
|
|
54
|
+
* @param orgName Name of the Organization
|
|
55
|
+
*/
|
|
56
|
+
leaveOrganization: (orgName: string) => Promise<void>;
|
|
57
|
+
protected getEndpoint(endpoint: string): string;
|
|
58
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
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.IdpOrganizationMember = void 0;
|
|
13
|
+
const Base_1 = require("../../../../Base");
|
|
14
|
+
const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
|
|
15
|
+
const searchFilter_1 = require("../../../../helper/searchFilter");
|
|
16
|
+
const invitations_1 = require("./invitations");
|
|
17
|
+
class IdpOrganizationMember extends Base_1.default {
|
|
18
|
+
constructor(options, axios) {
|
|
19
|
+
super(options, axios);
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves all organization members that match the provided search filter(s). Will return all members of the organization if no search filter is provided.
|
|
22
|
+
* @param orgName Name of the Organization
|
|
23
|
+
* @param filters (optional) Array of search filters
|
|
24
|
+
* @param excludeTeamByName (optional) Name of a team whos members shall be excluded
|
|
25
|
+
* @param sorting (optional) Sorting object
|
|
26
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
27
|
+
* @param page (optional) Page number to skip the first (page * limit) results (defaults to 0)
|
|
28
|
+
* @returns Object containing an array of Organization Members and the total number of results found in the database (independent of limit and page)
|
|
29
|
+
*/
|
|
30
|
+
this.searchOrganizationMembers = (_a) => __awaiter(this, [_a], void 0, function* ({ orgName, filters, excludeTeamByName, sorting, limit = 25, page = 0, }) {
|
|
31
|
+
const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => {
|
|
32
|
+
return new searchFilter_1.SearchFilterDTO(f);
|
|
33
|
+
});
|
|
34
|
+
const resp = yield this.axios.post(this.getEndpoint(`/${orgName}/members/search?limit=${limit}&page=${page}`), {
|
|
35
|
+
filters: filtersDTO,
|
|
36
|
+
sorting,
|
|
37
|
+
excludeTeamByName,
|
|
38
|
+
});
|
|
39
|
+
return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Retrieves an organization member by its user ID.
|
|
43
|
+
* @param orgName Name of the organization
|
|
44
|
+
* @param userId ID of the user
|
|
45
|
+
* @returns The requested Organization Member
|
|
46
|
+
*/
|
|
47
|
+
this.getOrganizationMember = (orgName, userId) => __awaiter(this, void 0, void 0, function* () {
|
|
48
|
+
const resp = yield this.axios.get(this.getEndpoint(`/${orgName}/members/${userId}`));
|
|
49
|
+
return resp.data;
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Updates the role of a User in the specified Organization.
|
|
53
|
+
* @param orgName Name of the Organization
|
|
54
|
+
* @param userId ID of the User
|
|
55
|
+
* @param orgMemberPatch New role
|
|
56
|
+
* @returns The updated OrganizationMember
|
|
57
|
+
*/
|
|
58
|
+
this.patchOrganizationMemberRole = (orgName, userId, orgMemberPatch) => __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/${orgName}/members/${userId}/role`), orgMemberPatch);
|
|
60
|
+
return resp.data;
|
|
61
|
+
});
|
|
62
|
+
/**
|
|
63
|
+
* Updates the executionTarget flag of a User in the specified Organization.
|
|
64
|
+
* @param orgName Name of the Organization
|
|
65
|
+
* @param userId ID of the User
|
|
66
|
+
* @param executionTarget Boolean value to set
|
|
67
|
+
* @returns The updated OrganizationMember
|
|
68
|
+
*/
|
|
69
|
+
this.patchOrganizationExecutionTarget = (orgName, userId, executionTarget) => __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/${orgName}/members/${userId}/executionTarget`), {
|
|
71
|
+
executionTarget,
|
|
72
|
+
});
|
|
73
|
+
return resp.data;
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Removes a Member from an Organization.
|
|
77
|
+
* @param orgName Name of the Organization
|
|
78
|
+
* @param userId ID of the User
|
|
79
|
+
*/
|
|
80
|
+
this.removeOrganizationMember = (orgName, userId) => __awaiter(this, void 0, void 0, function* () {
|
|
81
|
+
yield this.axios.delete(this.getEndpoint(`/${orgName}/members/${userId}`));
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Member leaves the organization independently.
|
|
85
|
+
* @param orgName Name of the Organization
|
|
86
|
+
*/
|
|
87
|
+
this.leaveOrganization = (orgName) => __awaiter(this, void 0, void 0, function* () {
|
|
88
|
+
yield this.axios.delete(this.getEndpoint(`/${orgName}/members`));
|
|
89
|
+
});
|
|
90
|
+
this.invitations = new invitations_1.default(options, axios);
|
|
91
|
+
}
|
|
92
|
+
getEndpoint(endpoint) {
|
|
93
|
+
return `${this.options.server}/api/account/v1/org${endpoint}`;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.IdpOrganizationMember = IdpOrganizationMember;
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import Base from "../../../../../Base";
|
|
2
|
+
import { PaginatedResponse, SearchFilter, Sorting } from "../../../../../interfaces/global";
|
|
3
|
+
import { OrganizationRole } from "../../../../../interfaces/idp";
|
|
4
|
+
import { OrganizationMemberInvitation } from "../../../../../interfaces/idp/organization/member/invitations";
|
|
5
|
+
export default class IdpOrganizationMemberInvitations extends Base {
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves all invitations sent out by the organization that match the provided search filter(s). Returns all invitations if no search filter is provided.
|
|
8
|
+
* @param orgName Name of the organization
|
|
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 invitations and the total number of results found in the database (independent of limit and page)
|
|
14
|
+
*/
|
|
15
|
+
search: (params: {
|
|
16
|
+
orgName: string;
|
|
17
|
+
filters: SearchFilter[];
|
|
18
|
+
sorting?: Sorting;
|
|
19
|
+
limit?: number;
|
|
20
|
+
page?: number;
|
|
21
|
+
}) => Promise<PaginatedResponse<OrganizationMemberInvitation>>;
|
|
22
|
+
/**
|
|
23
|
+
* Invites a User to an Organization.
|
|
24
|
+
*
|
|
25
|
+
* @param orgName Name of the Organization
|
|
26
|
+
* @param email Email of the person to be invited
|
|
27
|
+
* @param role The role they will have within the organization if they accept the invitation
|
|
28
|
+
* @param allowNonRegisteredUsers Flag to determine if the invitation should go through in the case that the email is not bound to an Helmut Cloud user.
|
|
29
|
+
* If this is set to true and the email is unbound, then an email will be sent asking the person to register.
|
|
30
|
+
* When they do they will automatically join the organization.
|
|
31
|
+
* @param targetUrl Optional url the link in the mail will point to
|
|
32
|
+
* @returns The created invitation
|
|
33
|
+
*/
|
|
34
|
+
create: (orgName: string, email: string, role: OrganizationRole, allowNonRegisteredUsers?: boolean, targetUrl?: string) => Promise<OrganizationMemberInvitation>;
|
|
35
|
+
/**
|
|
36
|
+
* Accept an invitation.
|
|
37
|
+
*
|
|
38
|
+
* Internally this calls respond.
|
|
39
|
+
*
|
|
40
|
+
* @param orgName Name of the Organization
|
|
41
|
+
* @param invitationId ID of the invitation
|
|
42
|
+
* @returns The patched invitation
|
|
43
|
+
*/
|
|
44
|
+
accept: (orgName: string, invitationId: string) => Promise<OrganizationMemberInvitation>;
|
|
45
|
+
/**
|
|
46
|
+
* Reject an invitation.
|
|
47
|
+
*
|
|
48
|
+
* Internally this calls respond.
|
|
49
|
+
*
|
|
50
|
+
* @param orgName Name of the Organization
|
|
51
|
+
* @param invitationId ID of the invitation
|
|
52
|
+
* @returns The patched invitation
|
|
53
|
+
*/
|
|
54
|
+
reject: (orgName: string, invitationId: string) => Promise<OrganizationMemberInvitation>;
|
|
55
|
+
/**
|
|
56
|
+
* Respond to an invitation.
|
|
57
|
+
*
|
|
58
|
+
* @param orgName Name of the Organization
|
|
59
|
+
* @param invitationId ID of the invitation
|
|
60
|
+
* @param accept Whether or not to accept the invitation
|
|
61
|
+
* @returns The patched invitation
|
|
62
|
+
*/
|
|
63
|
+
respond: (orgName: string, invitationId: string, accept: boolean) => Promise<OrganizationMemberInvitation>;
|
|
64
|
+
/**
|
|
65
|
+
* Resends an invitation email.
|
|
66
|
+
*
|
|
67
|
+
* @param orgName Name of the Organization
|
|
68
|
+
* @param invitationId ID of the invitation
|
|
69
|
+
*/
|
|
70
|
+
resendInvitationEmail: (orgName: string, invitationId: string) => Promise<void>;
|
|
71
|
+
/**
|
|
72
|
+
* Cancel/Delete an invitation.
|
|
73
|
+
*
|
|
74
|
+
* @param orgName Name of the Organization
|
|
75
|
+
* @param invitationId ID of the invitation
|
|
76
|
+
*/
|
|
77
|
+
delete: (orgName: string, invitationId: string) => Promise<void>;
|
|
78
|
+
protected getEndpoint(endpoint: string): string;
|
|
79
|
+
}
|