hcloud-sdk 17.0.0 → 18.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/changelog.md +176 -76
- package/lib/Base.d.ts +2 -1
- package/lib/Hcloud.d.ts +6 -3
- package/lib/Hcloud.js +16 -5
- package/lib/helper/ValidationHelper.d.ts +10 -2
- package/lib/helper/ValidationHelper.js +55 -7
- package/lib/interfaces/auditor/index.d.ts +13 -2
- package/lib/interfaces/auditor/index.js +9 -1
- package/lib/interfaces/cosmo/asset/index.d.ts +185 -0
- package/lib/interfaces/cosmo/asset/index.js +82 -0
- package/lib/interfaces/cosmo/comment/index.d.ts +38 -0
- package/lib/interfaces/cosmo/comment/index.js +8 -0
- package/lib/interfaces/cosmo/event/index.d.ts +31 -0
- package/lib/interfaces/cosmo/event/index.js +17 -0
- package/lib/interfaces/cosmo/location/index.d.ts +4 -0
- package/lib/interfaces/cosmo/namespace/index.d.ts +9 -0
- package/lib/interfaces/cosmo/namespace/index.js +9 -0
- package/lib/interfaces/cosmo/permissions.d.ts +96 -0
- package/lib/interfaces/cosmo/permissions.js +58 -0
- package/lib/interfaces/cosmo/share/index.d.ts +28 -0
- package/lib/interfaces/cosmo/share/index.js +2 -0
- package/lib/interfaces/cosmo/space/index.d.ts +25 -0
- package/lib/interfaces/cosmo/space/index.js +2 -0
- package/lib/interfaces/cosmo/tag/tag.d.ts +12 -0
- package/lib/interfaces/cosmo/tag/tag.js +2 -0
- package/lib/interfaces/global/Products.d.ts +2 -2
- package/lib/interfaces/global/Products.js +1 -1
- package/lib/interfaces/high5/index.d.ts +7 -7
- package/lib/interfaces/high5/index.js +7 -7
- package/lib/interfaces/{friday → high5}/space/database/document/index.d.ts +1 -1
- package/lib/interfaces/{friday → high5}/space/database/document/index.js +2 -1
- package/lib/interfaces/high5/space/database/index.js +2 -0
- package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +9 -2
- package/lib/interfaces/high5/space/execution/index.d.ts +2 -1
- package/lib/interfaces/high5/space/job/JobLog.d.ts +16 -0
- package/lib/interfaces/high5/space/job/JobLog.js +2 -0
- package/lib/interfaces/high5/space/job/index.d.ts +38 -0
- package/lib/interfaces/high5/space/job/index.js +8 -0
- package/lib/interfaces/high5/stats.d.ts +21 -0
- package/lib/interfaces/high5/stats.js +2 -0
- package/lib/interfaces/idp/oauth/index.d.ts +4 -3
- package/lib/interfaces/idp/organization/index.d.ts +1 -0
- package/lib/interfaces/idp/organization/index.js +1 -0
- package/lib/interfaces/idp/organization/license/index.d.ts +13 -11
- package/lib/interfaces/idp/organization/member/index.d.ts +1 -0
- package/lib/interfaces/idp/organization/stats.d.ts +7 -0
- package/lib/interfaces/idp/organization/stats.js +2 -0
- package/lib/interfaces/idp/organization/team/index.d.ts +0 -1
- package/lib/interfaces/idp/user/Message.d.ts +21 -0
- package/lib/interfaces/idp/user/Message.js +14 -0
- package/lib/interfaces/idp/user/NotificationSettings.d.ts +1 -0
- package/lib/interfaces/idp/user/Scopes.d.ts +1 -7
- package/lib/interfaces/idp/user/Scopes.js +0 -9
- package/lib/interfaces/idp/user/index.d.ts +2 -1
- package/lib/interfaces/mailer/index.d.ts +30 -1
- package/lib/interfaces/mailer/index.js +87 -1
- package/lib/interfaces/mothership/index.d.ts +3 -1
- package/lib/interfaces/mothership/index.js +15 -0
- package/lib/interfaces/mothership/stats.d.ts +4 -0
- package/lib/interfaces/mothership/stats.js +2 -0
- package/lib/interfaces/nats/index.d.ts +54 -24
- package/lib/interfaces/nats/index.js +87 -58
- package/lib/interfaces/shorts/index.d.ts +10 -0
- package/lib/interfaces/shorts/index.js +2 -0
- package/lib/service/agent/bundle/dev/index.d.ts +16 -6
- package/lib/service/agent/bundle/dev/index.js +12 -10
- package/lib/service/agent/bundle/index.d.ts +10 -4
- package/lib/service/agent/bundle/index.js +6 -6
- package/lib/service/agent/context/index.d.ts +22 -8
- package/lib/service/agent/context/index.js +15 -14
- package/lib/service/auditor/index.d.ts +8 -4
- package/lib/service/auditor/index.js +5 -5
- package/lib/service/auditor/internal/index.d.ts +27 -3
- package/lib/service/auditor/internal/index.js +34 -5
- package/lib/service/bouncer/features/index.d.ts +4 -2
- package/lib/service/bouncer/features/index.js +2 -2
- package/lib/service/cosmo/asset/index.d.ts +219 -0
- package/lib/service/cosmo/asset/index.js +314 -0
- package/lib/service/cosmo/comment/index.d.ts +122 -0
- package/lib/service/cosmo/comment/index.js +161 -0
- package/lib/service/cosmo/event/index.d.ts +23 -0
- package/lib/service/cosmo/event/index.js +40 -0
- package/lib/service/cosmo/folder/index.d.ts +27 -0
- package/lib/service/cosmo/folder/index.js +47 -0
- package/lib/service/cosmo/index.d.ts +49 -0
- package/lib/service/cosmo/index.js +119 -0
- package/lib/service/cosmo/internal/index.d.ts +7 -0
- package/lib/service/cosmo/internal/index.js +17 -0
- package/lib/service/cosmo/internal/space/index.d.ts +15 -0
- package/lib/service/cosmo/internal/space/index.js +34 -0
- package/lib/service/cosmo/location/index.d.ts +40 -0
- package/lib/service/cosmo/location/index.js +63 -0
- package/lib/service/cosmo/namespace/index.d.ts +42 -0
- package/lib/service/cosmo/namespace/index.js +65 -0
- package/lib/service/cosmo/organization/index.d.ts +47 -0
- package/lib/service/cosmo/organization/index.js +64 -0
- package/lib/service/cosmo/permissions/index.d.ts +131 -0
- package/lib/service/cosmo/permissions/index.js +181 -0
- package/lib/service/cosmo/production/index.d.ts +26 -0
- package/lib/service/cosmo/production/index.js +45 -0
- package/lib/service/cosmo/share/index.d.ts +161 -0
- package/lib/service/cosmo/share/index.js +215 -0
- package/lib/service/cosmo/space/index.d.ts +104 -0
- package/lib/service/cosmo/space/index.js +146 -0
- package/lib/service/cosmo/tag/index.d.ts +67 -0
- package/lib/service/cosmo/tag/index.js +93 -0
- package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +10 -4
- package/lib/service/dali/avatar/DaliCosmoSpace.js +8 -7
- package/lib/service/dali/avatar/DaliFuseSpace.d.ts +10 -4
- package/lib/service/dali/avatar/DaliFuseSpace.js +7 -6
- package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +10 -4
- package/lib/service/dali/avatar/DaliHigh5Pool.js +7 -6
- package/lib/service/dali/avatar/DaliHigh5Space.d.ts +10 -4
- package/lib/service/dali/avatar/DaliHigh5Space.js +7 -6
- package/lib/service/dali/avatar/DaliOAuthApp.d.ts +10 -4
- package/lib/service/dali/avatar/DaliOAuthApp.js +7 -6
- package/lib/service/dali/avatar/DaliOrganization.d.ts +10 -4
- package/lib/service/dali/avatar/DaliOrganization.js +7 -6
- package/lib/service/dali/avatar/DaliServiceAccount.d.ts +10 -4
- package/lib/service/dali/avatar/DaliServiceAccount.js +7 -6
- package/lib/service/dali/avatar/DaliTeam.d.ts +10 -4
- package/lib/service/dali/avatar/DaliTeam.js +7 -6
- package/lib/service/dali/avatar/DaliUser.d.ts +10 -4
- package/lib/service/dali/avatar/DaliUser.js +7 -6
- package/lib/service/dali/index.d.ts +4 -5
- package/lib/service/dali/index.js +2 -5
- package/lib/service/fuse/index.d.ts +4 -2
- package/lib/service/fuse/index.js +2 -2
- package/lib/service/fuse/internal/index.d.ts +4 -2
- package/lib/service/fuse/internal/index.js +3 -2
- package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +4 -2
- package/lib/service/fuse/internal/space/cronjob/log/index.js +2 -2
- package/lib/service/fuse/internal/space/index.d.ts +7 -3
- package/lib/service/fuse/internal/space/index.js +6 -4
- package/lib/service/fuse/space/cronjob/index.d.ts +35 -13
- package/lib/service/fuse/space/cronjob/index.js +48 -50
- package/lib/service/fuse/space/cronjob/log/index.d.ts +8 -4
- package/lib/service/fuse/space/cronjob/log/index.js +5 -5
- package/lib/service/fuse/space/index.d.ts +27 -11
- package/lib/service/fuse/space/index.js +19 -18
- package/lib/service/high5/execution/index.d.ts +4 -2
- package/lib/service/high5/execution/index.js +3 -2
- package/lib/service/high5/execution/status/index.d.ts +5 -3
- package/lib/service/high5/execution/status/index.js +3 -3
- package/lib/service/high5/index.d.ts +7 -2
- package/lib/service/high5/index.js +9 -2
- package/lib/service/high5/internal/index.d.ts +4 -2
- package/lib/service/high5/internal/index.js +3 -2
- package/lib/service/high5/internal/space/index.d.ts +10 -3
- package/lib/service/high5/internal/space/index.js +13 -4
- package/lib/service/high5/internal/space/job/index.d.ts +7 -0
- package/lib/service/high5/internal/space/job/index.js +17 -0
- package/lib/service/high5/internal/space/job/log/index.d.ts +17 -0
- package/lib/service/high5/internal/space/job/log/index.js +34 -0
- package/lib/service/high5/joinToken/index.d.ts +14 -6
- package/lib/service/high5/joinToken/index.js +10 -9
- package/lib/service/high5/space/database/document/array/index.d.ts +73 -0
- package/lib/service/high5/space/database/document/array/index.js +102 -0
- package/lib/service/{friday → high5}/space/database/document/index.d.ts +26 -10
- package/lib/service/{friday → high5}/space/database/document/index.js +31 -16
- package/lib/service/high5/space/database/document/number/index.d.ts +51 -0
- package/lib/service/high5/space/database/document/number/index.js +77 -0
- package/lib/service/{friday → high5}/space/database/index.d.ts +22 -12
- package/lib/service/{friday → high5}/space/database/index.js +18 -17
- package/lib/service/high5/space/event/index.d.ts +17 -7
- package/lib/service/high5/space/event/index.js +12 -11
- package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +4 -2
- package/lib/service/high5/space/event/stream/design/DesignOperations.js +2 -2
- package/lib/service/high5/space/event/stream/design/index.d.ts +10 -4
- package/lib/service/high5/space/event/stream/design/index.js +7 -6
- package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +16 -6
- package/lib/service/high5/space/event/stream/design/snapshot/index.js +12 -10
- package/lib/service/high5/space/event/stream/index.d.ts +32 -12
- package/lib/service/high5/space/event/stream/index.js +22 -21
- package/lib/service/high5/space/execution/index.d.ts +19 -7
- package/lib/service/high5/space/execution/index.js +17 -12
- package/lib/service/high5/space/execution/log/index.d.ts +8 -4
- package/lib/service/high5/space/execution/log/index.js +5 -5
- package/lib/service/high5/space/execution/status/index.d.ts +7 -3
- package/lib/service/high5/space/execution/status/index.js +4 -4
- package/lib/service/high5/space/index.d.ts +43 -14
- package/lib/service/high5/space/index.js +45 -23
- package/lib/service/high5/space/job/index.d.ts +145 -0
- package/lib/service/high5/space/job/index.js +201 -0
- package/lib/service/high5/space/job/log/index.d.ts +35 -0
- package/lib/service/high5/space/job/log/index.js +58 -0
- package/lib/service/high5/space/node/index.d.ts +20 -8
- package/lib/service/high5/space/node/index.js +14 -13
- package/lib/service/high5/space/pool/index.d.ts +27 -11
- package/lib/service/high5/space/pool/index.js +19 -18
- package/lib/service/high5/space/secret/index.d.ts +17 -7
- package/lib/service/high5/space/secret/index.js +12 -11
- package/lib/service/high5/space/stat/index.d.ts +12 -0
- package/lib/service/high5/space/stat/index.js +31 -0
- package/lib/service/high5/space/wave/index.d.ts +16 -6
- package/lib/service/high5/space/wave/index.js +11 -10
- package/lib/service/high5/space/webhook/index.d.ts +32 -12
- package/lib/service/high5/space/webhook/index.js +25 -21
- package/lib/service/high5/space/webhook/log/index.d.ts +4 -2
- package/lib/service/high5/space/webhook/log/index.js +2 -2
- package/lib/service/high5/stat/index.d.ts +11 -0
- package/lib/service/high5/stat/index.js +30 -0
- package/lib/service/high5/wave/s3/index.d.ts +31 -8
- package/lib/service/high5/wave/s3/index.js +42 -21
- package/lib/service/idp/guest/index.d.ts +42 -0
- package/lib/service/idp/guest/index.js +66 -0
- package/lib/service/idp/index.d.ts +25 -7
- package/lib/service/idp/index.js +23 -12
- package/lib/service/idp/internal/index.d.ts +5 -3
- package/lib/service/idp/internal/index.js +5 -3
- package/lib/service/idp/oauth/index.d.ts +16 -6
- package/lib/service/idp/oauth/index.js +15 -15
- package/lib/service/idp/organization/index.d.ts +19 -5
- package/lib/service/idp/organization/index.js +19 -8
- package/lib/service/idp/organization/license/index.d.ts +7 -3
- package/lib/service/idp/organization/license/index.js +4 -4
- package/lib/service/idp/organization/member/index.d.ts +20 -8
- package/lib/service/idp/organization/member/index.js +15 -13
- package/lib/service/idp/organization/member/invitations/index.d.ts +23 -9
- package/lib/service/idp/organization/member/invitations/index.js +72 -59
- package/lib/service/idp/organization/service-accounts/index.d.ts +20 -8
- package/lib/service/idp/organization/service-accounts/index.js +13 -12
- package/lib/service/idp/organization/settings/domain/index.d.ts +13 -5
- package/lib/service/idp/organization/settings/domain/index.js +9 -8
- package/lib/service/idp/organization/settings/domain/saml/index.d.ts +16 -6
- package/lib/service/idp/organization/settings/domain/saml/index.js +19 -18
- package/lib/service/idp/organization/settings/oauth/index.d.ts +23 -9
- package/lib/service/idp/organization/settings/oauth/index.js +16 -15
- package/lib/service/idp/organization/stat/index.d.ts +11 -0
- package/lib/service/idp/organization/stat/index.js +30 -0
- package/lib/service/idp/organization/team/index.d.ts +22 -10
- package/lib/service/idp/organization/team/index.js +14 -13
- package/lib/service/idp/registration/index.d.ts +10 -4
- package/lib/service/idp/registration/index.js +15 -9
- package/lib/service/idp/user/index.d.ts +33 -11
- package/lib/service/idp/user/index.js +29 -16
- package/lib/service/idp/user/license/index.d.ts +7 -3
- package/lib/service/idp/user/license/index.js +4 -4
- package/lib/service/idp/user/message/index.d.ts +61 -0
- package/lib/service/idp/user/message/index.js +92 -0
- package/lib/service/idp/user/password/index.d.ts +4 -2
- package/lib/service/idp/user/password/index.js +2 -2
- package/lib/service/idp/user/settings/connections/index.d.ts +4 -2
- package/lib/service/idp/user/settings/connections/index.js +2 -2
- package/lib/service/idp/user/settings/general/index.d.ts +10 -4
- package/lib/service/idp/user/settings/general/index.js +6 -6
- package/lib/service/idp/user/settings/notifications/index.d.ts +7 -3
- package/lib/service/idp/user/settings/notifications/index.js +4 -4
- package/lib/service/idp/user/settings/oauthApps/index.d.ts +7 -3
- package/lib/service/idp/user/settings/oauthApps/index.js +6 -5
- package/lib/service/idp/user/settings/pats/index.d.ts +22 -8
- package/lib/service/idp/user/settings/pats/index.js +17 -15
- package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +16 -6
- package/lib/service/idp/user/settings/twoFactor/totp/index.js +13 -10
- package/lib/service/mailer/index.d.ts +4 -2
- package/lib/service/mailer/index.js +2 -2
- package/lib/service/mailer/internal/index.d.ts +13 -5
- package/lib/service/mailer/internal/index.js +8 -8
- package/lib/service/mothership/index.d.ts +35 -13
- package/lib/service/mothership/index.js +32 -17
- package/lib/service/nats/index.js +58 -43
- package/lib/service/shorts/index.d.ts +18 -0
- package/lib/service/{friday → shorts}/index.js +13 -10
- package/lib/service/shorts/internal/index.d.ts +72 -0
- package/lib/service/shorts/internal/index.js +104 -0
- package/package.json +1 -1
- package/lib/interfaces/friday/index.d.ts +0 -3
- package/lib/interfaces/friday/index.js +0 -19
- package/lib/interfaces/friday/space/index.d.ts +0 -21
- package/lib/interfaces/friday/space/index.js +0 -11
- package/lib/service/friday/index.d.ts +0 -13
- package/lib/service/friday/space/index.d.ts +0 -81
- package/lib/service/friday/space/index.js +0 -150
- /package/lib/interfaces/{friday/space/database → cosmo/location}/index.js +0 -0
- /package/lib/interfaces/{friday → high5}/space/database/index.d.ts +0 -0
|
@@ -0,0 +1,66 @@
|
|
|
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.IdpGuest = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
class IdpGuest extends Base_1.default {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new guest user account.
|
|
17
|
+
*
|
|
18
|
+
* @param email - The email address of the guest to create.
|
|
19
|
+
* @param name - The display name of the guest user.
|
|
20
|
+
* @param emailHMAC - An HMAC signature of the email, used for validation.
|
|
21
|
+
* @returns A promise resolving to a `SuccessfulAuth` object containing:
|
|
22
|
+
* - `user`: The created `User` object.
|
|
23
|
+
* - `token`: An authorization token returned by the API.
|
|
24
|
+
*/
|
|
25
|
+
createGuest(email, name, emailHMAC, raw) {
|
|
26
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const resp = yield this.axios.post(this.getEndpoint("/v1/guest"), { email, name, hmac: emailHMAC });
|
|
28
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw)
|
|
29
|
+
? Object.assign(Object.assign({}, resp), { data: { user: resp.data, token: resp.headers.authorization } }) : { user: resp.data, token: resp.headers.authorization });
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Logs in as an existing guest user.
|
|
34
|
+
*
|
|
35
|
+
* @param email - The email address of the guest to log in.
|
|
36
|
+
* @param emailHMAC - An HMAC signature of the email, used for validation.
|
|
37
|
+
* @returns A promise resolving to a `SuccessfulAuth` object containing:
|
|
38
|
+
* - `user`: The authenticated `User` object.
|
|
39
|
+
* - `token`: An authorization token returned by the API.
|
|
40
|
+
*/
|
|
41
|
+
loginAsGuest(email, emailHMAC, raw) {
|
|
42
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const res = yield this.axios.put(this.getEndpoint("/v1/guest"), { email, hmac: emailHMAC });
|
|
44
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? Object.assign(Object.assign({}, res), { data: { user: res.data, token: res.headers.authorization } }) : { user: res.data, token: res.headers.authorization });
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Checks whether an email corresponds to a guest account.
|
|
49
|
+
*
|
|
50
|
+
* @param email - The email address to check.
|
|
51
|
+
* @returns A promise resolving to one of:
|
|
52
|
+
* - `"no user"` → No user exists with the given email.
|
|
53
|
+
* - `"not guest"` → A user exists but is not a guest.
|
|
54
|
+
* - `"guest"` → The email belongs to a guest account.
|
|
55
|
+
*/
|
|
56
|
+
isGuest(email, raw) {
|
|
57
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const res = yield this.axios.get(this.getEndpoint(`/v1/guest/email/${email}`));
|
|
59
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
getEndpoint(endpoint) {
|
|
63
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
exports.IdpGuest = IdpGuest;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import Base from "../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../Base";
|
|
2
2
|
import { Version } from "../../interfaces/global";
|
|
3
3
|
import { PreLoginResponse } from "../../interfaces/idp";
|
|
4
4
|
import { SuccessfulAuth } from "../../interfaces/idp/user/SuccessfulAuth";
|
|
5
|
+
import { IdpGuest } from "./guest";
|
|
5
6
|
import { IdpInternal } from "./internal";
|
|
6
7
|
import { IdpOAuth } from "./oauth";
|
|
7
8
|
import { IdpOrganization } from "./organization";
|
|
@@ -28,6 +29,11 @@ export default class Idp extends Base {
|
|
|
28
29
|
*/
|
|
29
30
|
get user(): IdpUser;
|
|
30
31
|
private _user?;
|
|
32
|
+
/**
|
|
33
|
+
* Handles everything around a guest
|
|
34
|
+
*/
|
|
35
|
+
get guest(): IdpGuest;
|
|
36
|
+
private _guest?;
|
|
31
37
|
/**
|
|
32
38
|
* Handles everything around idp's internal endpoints
|
|
33
39
|
*/
|
|
@@ -37,7 +43,9 @@ export default class Idp extends Base {
|
|
|
37
43
|
* Requests the endpoint version
|
|
38
44
|
* @returns Version object
|
|
39
45
|
*/
|
|
40
|
-
version(
|
|
46
|
+
version<R extends boolean = false>(raw?: {
|
|
47
|
+
raw: R;
|
|
48
|
+
}): Promise<MaybeRaw<R, Version>>;
|
|
41
49
|
/**
|
|
42
50
|
* Authenticates against the identity provider with a given email and password.
|
|
43
51
|
* @param email Email of the user
|
|
@@ -45,7 +53,9 @@ export default class Idp extends Base {
|
|
|
45
53
|
* @param token (optional) token if 2FA-TOTP is enabled
|
|
46
54
|
* @returns SuccessfulAuth object holding the token and the user
|
|
47
55
|
*/
|
|
48
|
-
login(email: string, password: string, token?: string
|
|
56
|
+
login<R extends boolean = false>(email: string, password: string, token?: string, raw?: {
|
|
57
|
+
raw: R;
|
|
58
|
+
}): Promise<MaybeRaw<R, SuccessfulAuth>>;
|
|
49
59
|
/**
|
|
50
60
|
* Starts the login process via OIDC
|
|
51
61
|
* @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
|
|
@@ -54,14 +64,18 @@ export default class Idp extends Base {
|
|
|
54
64
|
* @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
|
|
55
65
|
* @returns URL that must be accessed via a browser to continue the login process.
|
|
56
66
|
*/
|
|
57
|
-
loginWithOIDC(origin: string, oidcProvider?: string, hint?: string
|
|
67
|
+
loginWithOIDC<R extends boolean = false>(origin: string, oidcProvider?: string, hint?: string, raw?: {
|
|
68
|
+
raw: R;
|
|
69
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
58
70
|
/**
|
|
59
71
|
* Starts the login process via SAML 2.0
|
|
60
72
|
* @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
|
|
61
73
|
* @param email Email of the user. The email domain will be used to determine the appropriate SAML 2.0 provider to use going forward.
|
|
62
74
|
* @returns URL that must be accessed via a browser to continue the login process.
|
|
63
75
|
*/
|
|
64
|
-
loginWithSAML(origin: string, email: string
|
|
76
|
+
loginWithSAML<R extends boolean = false>(origin: string, email: string, raw?: {
|
|
77
|
+
raw: R;
|
|
78
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
65
79
|
/**
|
|
66
80
|
* Determine if/how the given email can authenticate.
|
|
67
81
|
*
|
|
@@ -71,7 +85,9 @@ export default class Idp extends Base {
|
|
|
71
85
|
* @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
|
|
72
86
|
* or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
|
|
73
87
|
*/
|
|
74
|
-
preLogin(email: string, origin: string
|
|
88
|
+
preLogin<R extends boolean = false>(email: string, origin: string, raw?: {
|
|
89
|
+
raw: R;
|
|
90
|
+
}): Promise<MaybeRaw<R, PreLoginResponse>>;
|
|
75
91
|
/**
|
|
76
92
|
* Initiate the password reset process. An email will be sent to the user to move to the next phase.
|
|
77
93
|
*
|
|
@@ -79,6 +95,8 @@ export default class Idp extends Base {
|
|
|
79
95
|
* @param captcha Valid google reCAPTCHAV2
|
|
80
96
|
* @param targetUrl Optional url the link in the mail will point to
|
|
81
97
|
*/
|
|
82
|
-
resetPassword(email: string, captcha: string, targetUrl?: string
|
|
98
|
+
resetPassword<R extends boolean = false>(email: string, captcha: string, targetUrl?: string, raw?: {
|
|
99
|
+
raw: R;
|
|
100
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
83
101
|
protected getEndpoint(endpoint: string): string;
|
|
84
102
|
}
|
package/lib/service/idp/index.js
CHANGED
|
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const Base_1 = require("../../Base");
|
|
13
|
+
const guest_1 = require("./guest");
|
|
13
14
|
const internal_1 = require("./internal");
|
|
14
15
|
const oauth_1 = require("./oauth");
|
|
15
16
|
const organization_1 = require("./organization");
|
|
@@ -52,6 +53,15 @@ class Idp extends Base_1.default {
|
|
|
52
53
|
}
|
|
53
54
|
return this._user;
|
|
54
55
|
}
|
|
56
|
+
/**
|
|
57
|
+
* Handles everything around a guest
|
|
58
|
+
*/
|
|
59
|
+
get guest() {
|
|
60
|
+
if (this._guest === undefined) {
|
|
61
|
+
this._guest = new guest_1.IdpGuest(this.options, this.axios);
|
|
62
|
+
}
|
|
63
|
+
return this._guest;
|
|
64
|
+
}
|
|
55
65
|
/**
|
|
56
66
|
* Handles everything around idp's internal endpoints
|
|
57
67
|
*/
|
|
@@ -65,10 +75,10 @@ class Idp extends Base_1.default {
|
|
|
65
75
|
* Requests the endpoint version
|
|
66
76
|
* @returns Version object
|
|
67
77
|
*/
|
|
68
|
-
version() {
|
|
78
|
+
version(raw) {
|
|
69
79
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
80
|
const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
|
|
71
|
-
return resp.data;
|
|
81
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
72
82
|
});
|
|
73
83
|
}
|
|
74
84
|
/**
|
|
@@ -78,7 +88,7 @@ class Idp extends Base_1.default {
|
|
|
78
88
|
* @param token (optional) token if 2FA-TOTP is enabled
|
|
79
89
|
* @returns SuccessfulAuth object holding the token and the user
|
|
80
90
|
*/
|
|
81
|
-
login(email, password, token) {
|
|
91
|
+
login(email, password, token, raw) {
|
|
82
92
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
93
|
var _a;
|
|
84
94
|
let body = { email: email, password: password };
|
|
@@ -90,7 +100,7 @@ class Idp extends Base_1.default {
|
|
|
90
100
|
token: ((_a = resp.headers["authorization"]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
|
|
91
101
|
user: resp.data,
|
|
92
102
|
};
|
|
93
|
-
return authed;
|
|
103
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? Object.assign(Object.assign({}, resp), { data: authed }) : authed);
|
|
94
104
|
});
|
|
95
105
|
}
|
|
96
106
|
/**
|
|
@@ -101,7 +111,7 @@ class Idp extends Base_1.default {
|
|
|
101
111
|
* @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
|
|
102
112
|
* @returns URL that must be accessed via a browser to continue the login process.
|
|
103
113
|
*/
|
|
104
|
-
loginWithOIDC(origin, oidcProvider, hint) {
|
|
114
|
+
loginWithOIDC(origin, oidcProvider, hint, raw) {
|
|
105
115
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
116
|
const resp = yield this.axios.get(this.getEndpoint("/v1/login/oidc"), {
|
|
107
117
|
params: {
|
|
@@ -118,7 +128,7 @@ class Idp extends Base_1.default {
|
|
|
118
128
|
if (!location) {
|
|
119
129
|
throw new Error("Location header is undefined.");
|
|
120
130
|
}
|
|
121
|
-
return location;
|
|
131
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : location);
|
|
122
132
|
});
|
|
123
133
|
}
|
|
124
134
|
/**
|
|
@@ -127,7 +137,7 @@ class Idp extends Base_1.default {
|
|
|
127
137
|
* @param email Email of the user. The email domain will be used to determine the appropriate SAML 2.0 provider to use going forward.
|
|
128
138
|
* @returns URL that must be accessed via a browser to continue the login process.
|
|
129
139
|
*/
|
|
130
|
-
loginWithSAML(origin, email) {
|
|
140
|
+
loginWithSAML(origin, email, raw) {
|
|
131
141
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
142
|
const resp = yield this.axios.get(this.getEndpoint("/v1/login/saml"), {
|
|
133
143
|
params: {
|
|
@@ -143,7 +153,7 @@ class Idp extends Base_1.default {
|
|
|
143
153
|
if (!location) {
|
|
144
154
|
throw new Error("Location header is undefined.");
|
|
145
155
|
}
|
|
146
|
-
return location;
|
|
156
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : location);
|
|
147
157
|
});
|
|
148
158
|
}
|
|
149
159
|
/**
|
|
@@ -155,7 +165,7 @@ class Idp extends Base_1.default {
|
|
|
155
165
|
* @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
|
|
156
166
|
* or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
|
|
157
167
|
*/
|
|
158
|
-
preLogin(email, origin) {
|
|
168
|
+
preLogin(email, origin, raw) {
|
|
159
169
|
return __awaiter(this, void 0, void 0, function* () {
|
|
160
170
|
const resp = yield this.axios.get(this.getEndpoint("/v1/login/pre"), {
|
|
161
171
|
params: {
|
|
@@ -163,7 +173,7 @@ class Idp extends Base_1.default {
|
|
|
163
173
|
email,
|
|
164
174
|
},
|
|
165
175
|
});
|
|
166
|
-
return resp.data;
|
|
176
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
167
177
|
});
|
|
168
178
|
}
|
|
169
179
|
/**
|
|
@@ -173,9 +183,10 @@ class Idp extends Base_1.default {
|
|
|
173
183
|
* @param captcha Valid google reCAPTCHAV2
|
|
174
184
|
* @param targetUrl Optional url the link in the mail will point to
|
|
175
185
|
*/
|
|
176
|
-
resetPassword(email, captcha, targetUrl) {
|
|
186
|
+
resetPassword(email, captcha, targetUrl, raw) {
|
|
177
187
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
yield this.axios.post(this.getEndpoint("/v1/login/forgot_password"), { email, captcha, targetUrl });
|
|
188
|
+
const resp = yield this.axios.post(this.getEndpoint("/v1/login/forgot_password"), { email, captcha, targetUrl });
|
|
189
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
179
190
|
});
|
|
180
191
|
}
|
|
181
192
|
getEndpoint(endpoint) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Base from "../../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
2
|
import { User } from "../../../interfaces/idp/user";
|
|
3
3
|
export declare class IdpInternal extends Base {
|
|
4
4
|
/**
|
|
@@ -9,9 +9,11 @@ export declare class IdpInternal extends Base {
|
|
|
9
9
|
* @param orgName Name of the organization
|
|
10
10
|
* @returns the created user and a pat token
|
|
11
11
|
*/
|
|
12
|
-
createAgentUser(orgName: string
|
|
12
|
+
createAgentUser<R extends boolean = false>(orgName: string, raw?: {
|
|
13
|
+
raw: R;
|
|
14
|
+
}): Promise<MaybeRaw<R, {
|
|
13
15
|
user: User;
|
|
14
16
|
pat: string;
|
|
15
|
-
}
|
|
17
|
+
}>>;
|
|
16
18
|
protected getEndpoint(endpoint: string): string;
|
|
17
19
|
}
|
|
@@ -20,10 +20,12 @@ class IdpInternal extends Base_1.default {
|
|
|
20
20
|
* @param orgName Name of the organization
|
|
21
21
|
* @returns the created user and a pat token
|
|
22
22
|
*/
|
|
23
|
-
createAgentUser(orgName) {
|
|
23
|
+
createAgentUser(orgName, raw) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
|
|
25
|
+
var _a, _b;
|
|
26
|
+
const resp = yield this.axios.post(this.getEndpoint(`/internal/v1/org/${orgName}/agent`));
|
|
27
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw)
|
|
28
|
+
? Object.assign(Object.assign({}, resp), { data: { user: resp.data, pat: (_a = resp.headers["x-pat-token"]) !== null && _a !== void 0 ? _a : "" } }) : { user: resp.data, pat: (_b = resp.headers["x-pat-token"]) !== null && _b !== void 0 ? _b : "" });
|
|
27
29
|
});
|
|
28
30
|
}
|
|
29
31
|
getEndpoint(endpoint) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import Base from "../../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
2
|
import { OAuthToken, OAuthTokenRequest } from "../../../interfaces/idp/oauth";
|
|
3
3
|
import { OAuthAppPublicInfo } from "../../../interfaces/idp/organization/settings/oauthApp";
|
|
4
4
|
export declare class IdpOAuth extends Base {
|
|
@@ -10,7 +10,9 @@ export declare class IdpOAuth extends Base {
|
|
|
10
10
|
* redirect_uri, scopes and optionally state.
|
|
11
11
|
* @returns the entire redirect uri including the authorization code if successful
|
|
12
12
|
*/
|
|
13
|
-
getAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean
|
|
13
|
+
getAuthorizationCodeInsideRedirectUrl<R extends boolean = false>(queryString: string, doNotRedirect?: boolean, raw?: {
|
|
14
|
+
raw: R;
|
|
15
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
14
16
|
/**
|
|
15
17
|
* Check if the user has consented to specified scopes. If the user has already consented this request
|
|
16
18
|
* will return the redirect URL, otherwise, it will be a consent.not.given error.
|
|
@@ -23,7 +25,9 @@ export declare class IdpOAuth extends Base {
|
|
|
23
25
|
* @returns A string with the redirect URL if the user already consented to the specificied scope. Otherwise, an OAuthApp
|
|
24
26
|
* @see OAuthApp
|
|
25
27
|
*/
|
|
26
|
-
getInfoOrAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean
|
|
28
|
+
getInfoOrAuthorizationCodeInsideRedirectUrl<R extends boolean = false>(queryString: string, doNotRedirect?: boolean, raw?: {
|
|
29
|
+
raw: R;
|
|
30
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
27
31
|
/**
|
|
28
32
|
* createScopesAndGetAuthorizationCodeInsideRedirectUrl throws for an invalid request (query params do not match OAuthApp).
|
|
29
33
|
* It returns the redirect URL with the code, which is used to redirect to the client application,
|
|
@@ -32,18 +36,24 @@ export declare class IdpOAuth extends Base {
|
|
|
32
36
|
* redirect_uri, scopes and optionally state.
|
|
33
37
|
* @returns the entire redirect uri including the authorization code if successful
|
|
34
38
|
*/
|
|
35
|
-
createScopesAndGetAuthorizationCodeInsideRedirectUrl(queryString: string, doNotRedirect?: boolean
|
|
39
|
+
createScopesAndGetAuthorizationCodeInsideRedirectUrl<R extends boolean = false>(queryString: string, doNotRedirect?: boolean, raw?: {
|
|
40
|
+
raw: R;
|
|
41
|
+
}): Promise<MaybeRaw<R, string>>;
|
|
36
42
|
/**
|
|
37
43
|
* A valid code can be used to request a new API token.
|
|
38
44
|
* @param tokenRequest contains the code, client_id, client_secret and redirect_uri
|
|
39
45
|
*/
|
|
40
|
-
exchangeCodeForToken(tokenRequest: OAuthTokenRequest
|
|
46
|
+
exchangeCodeForToken<R extends boolean = false>(tokenRequest: OAuthTokenRequest, raw?: {
|
|
47
|
+
raw: R;
|
|
48
|
+
}): Promise<MaybeRaw<R, OAuthToken>>;
|
|
41
49
|
/**
|
|
42
50
|
* Get OAuth app public information via client ID
|
|
43
51
|
*
|
|
44
52
|
* @param clientId {string} - Client ID of the OAuth app
|
|
45
53
|
* @returns Public OAuth app information
|
|
46
54
|
*/
|
|
47
|
-
getOAuthAppInfo(clientId: string
|
|
55
|
+
getOAuthAppInfo<R extends boolean = false>(clientId: string, raw?: {
|
|
56
|
+
raw: R;
|
|
57
|
+
}): Promise<MaybeRaw<R, OAuthAppPublicInfo>>;
|
|
48
58
|
protected getEndpoint(endpoint: string): string;
|
|
49
59
|
}
|
|
@@ -20,7 +20,7 @@ class IdpOAuth extends Base_1.default {
|
|
|
20
20
|
* redirect_uri, scopes and optionally state.
|
|
21
21
|
* @returns the entire redirect uri including the authorization code if successful
|
|
22
22
|
*/
|
|
23
|
-
getAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect) {
|
|
23
|
+
getAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect, raw) {
|
|
24
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
25
|
if (!queryString.startsWith("?")) {
|
|
26
26
|
queryString = `?${queryString}`;
|
|
@@ -28,11 +28,11 @@ class IdpOAuth extends Base_1.default {
|
|
|
28
28
|
if (doNotRedirect) {
|
|
29
29
|
queryString += "&no_redirect=true";
|
|
30
30
|
}
|
|
31
|
-
const
|
|
31
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/authorize${queryString}`), { maxRedirects: 0 });
|
|
32
32
|
if (doNotRedirect) {
|
|
33
|
-
return
|
|
33
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data.redirectUrl);
|
|
34
34
|
}
|
|
35
|
-
return
|
|
35
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.headers.location);
|
|
36
36
|
});
|
|
37
37
|
}
|
|
38
38
|
/**
|
|
@@ -47,7 +47,7 @@ class IdpOAuth extends Base_1.default {
|
|
|
47
47
|
* @returns A string with the redirect URL if the user already consented to the specificied scope. Otherwise, an OAuthApp
|
|
48
48
|
* @see OAuthApp
|
|
49
49
|
*/
|
|
50
|
-
getInfoOrAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect) {
|
|
50
|
+
getInfoOrAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect, raw) {
|
|
51
51
|
return __awaiter(this, void 0, void 0, function* () {
|
|
52
52
|
if (!queryString.startsWith("?")) {
|
|
53
53
|
queryString = `?${queryString}`;
|
|
@@ -59,9 +59,9 @@ class IdpOAuth extends Base_1.default {
|
|
|
59
59
|
maxRedirects: 0,
|
|
60
60
|
});
|
|
61
61
|
if (response.status < 300) {
|
|
62
|
-
return response.data.redirectUrl;
|
|
62
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.data.redirectUrl);
|
|
63
63
|
}
|
|
64
|
-
return response.headers.location;
|
|
64
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.headers.location);
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
@@ -72,7 +72,7 @@ class IdpOAuth extends Base_1.default {
|
|
|
72
72
|
* redirect_uri, scopes and optionally state.
|
|
73
73
|
* @returns the entire redirect uri including the authorization code if successful
|
|
74
74
|
*/
|
|
75
|
-
createScopesAndGetAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect) {
|
|
75
|
+
createScopesAndGetAuthorizationCodeInsideRedirectUrl(queryString, doNotRedirect, raw) {
|
|
76
76
|
return __awaiter(this, void 0, void 0, function* () {
|
|
77
77
|
if (!queryString.startsWith("?")) {
|
|
78
78
|
queryString = `?${queryString}`;
|
|
@@ -80,21 +80,21 @@ class IdpOAuth extends Base_1.default {
|
|
|
80
80
|
if (doNotRedirect) {
|
|
81
81
|
queryString += "&no_redirect=true";
|
|
82
82
|
}
|
|
83
|
-
const
|
|
83
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/authorize${queryString}`));
|
|
84
84
|
if (doNotRedirect) {
|
|
85
|
-
return
|
|
85
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data.redirectUrl);
|
|
86
86
|
}
|
|
87
|
-
return
|
|
87
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
88
88
|
});
|
|
89
89
|
}
|
|
90
90
|
/**
|
|
91
91
|
* A valid code can be used to request a new API token.
|
|
92
92
|
* @param tokenRequest contains the code, client_id, client_secret and redirect_uri
|
|
93
93
|
*/
|
|
94
|
-
exchangeCodeForToken(tokenRequest) {
|
|
94
|
+
exchangeCodeForToken(tokenRequest, raw) {
|
|
95
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
96
96
|
const response = yield this.axios.post(this.getEndpoint(`/v1/login/oauth/access_token`), tokenRequest);
|
|
97
|
-
return response.data;
|
|
97
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.data);
|
|
98
98
|
});
|
|
99
99
|
}
|
|
100
100
|
/**
|
|
@@ -103,10 +103,10 @@ class IdpOAuth extends Base_1.default {
|
|
|
103
103
|
* @param clientId {string} - Client ID of the OAuth app
|
|
104
104
|
* @returns Public OAuth app information
|
|
105
105
|
*/
|
|
106
|
-
getOAuthAppInfo(clientId) {
|
|
106
|
+
getOAuthAppInfo(clientId, raw) {
|
|
107
107
|
return __awaiter(this, void 0, void 0, function* () {
|
|
108
108
|
const response = yield this.axios.get(this.getEndpoint(`/v1/login/oauth/app/${clientId}`));
|
|
109
|
-
return response.data;
|
|
109
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? response : response.data);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
112
112
|
getEndpoint(endpoint) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import Base from "../../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
2
|
import { Organization, OrganizationQueryOptions } from "../../../interfaces/idp/organization";
|
|
3
3
|
import { IdpOrganizationLicense } from "./license";
|
|
4
4
|
import { IdpOrganizationMember } from "./member";
|
|
5
5
|
import IdpOrganizationServiceAccounts from "./service-accounts";
|
|
6
6
|
import IdpOrganizationSettings from "./settings";
|
|
7
|
+
import { IdpOrganizationStat } from "./stat";
|
|
7
8
|
import { IdpOrganizationTeams } from "./team";
|
|
8
9
|
export declare class IdpOrganization extends Base {
|
|
9
10
|
/**
|
|
@@ -31,6 +32,11 @@ export declare class IdpOrganization extends Base {
|
|
|
31
32
|
*/
|
|
32
33
|
get serviceAccounts(): IdpOrganizationServiceAccounts;
|
|
33
34
|
private _serviceAccounts?;
|
|
35
|
+
/**
|
|
36
|
+
* Handles everything around organization statistics.
|
|
37
|
+
*/
|
|
38
|
+
get stat(): IdpOrganizationStat;
|
|
39
|
+
private _stat?;
|
|
34
40
|
/**
|
|
35
41
|
* Updates an Organization.
|
|
36
42
|
* @param orgName Current name of the Organization
|
|
@@ -38,25 +44,33 @@ export declare class IdpOrganization extends Base {
|
|
|
38
44
|
* @param company (optional) New company name
|
|
39
45
|
* @returns The updated Organization
|
|
40
46
|
*/
|
|
41
|
-
updateOrganization(orgName: string, newName: string, company?: string
|
|
47
|
+
updateOrganization<R extends boolean = false>(orgName: string, newName: string, company?: string, raw?: {
|
|
48
|
+
raw: R;
|
|
49
|
+
}): Promise<MaybeRaw<R, Organization>>;
|
|
42
50
|
/**
|
|
43
51
|
* Creates a new Organization.
|
|
44
52
|
* @param name Name of the new Organization
|
|
45
53
|
* @param company (optional) Company name for the new Organization
|
|
46
54
|
* @returns The created Organization
|
|
47
55
|
*/
|
|
48
|
-
createOrganization(name: string, company?: string
|
|
56
|
+
createOrganization<R extends boolean = false>(name: string, company?: string, raw?: {
|
|
57
|
+
raw: R;
|
|
58
|
+
}): Promise<MaybeRaw<R, Organization>>;
|
|
49
59
|
/**
|
|
50
60
|
* Retrieves an Organization by its name.
|
|
51
61
|
* @param orgName Name of the Organization
|
|
52
62
|
* @param options Defines query options to retrieve additional properties in the response
|
|
53
63
|
* @returns The requested Organization
|
|
54
64
|
*/
|
|
55
|
-
getOrganization(orgName: string, options?: OrganizationQueryOptions
|
|
65
|
+
getOrganization<R extends boolean = false>(orgName: string, options?: OrganizationQueryOptions, raw?: {
|
|
66
|
+
raw: R;
|
|
67
|
+
}): Promise<MaybeRaw<R, Organization>>;
|
|
56
68
|
/**
|
|
57
69
|
* Deletes an Organization. This will also delete all dependencies that the Organization has (Teams, Spaces, apps, ...).
|
|
58
70
|
* @param orgName Name of the Organization to be deleted
|
|
59
71
|
*/
|
|
60
|
-
deleteOrganization(orgName: string
|
|
72
|
+
deleteOrganization<R extends boolean = false>(orgName: string, raw?: {
|
|
73
|
+
raw: R;
|
|
74
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
61
75
|
protected getEndpoint(endpoint: string): string;
|
|
62
76
|
}
|
|
@@ -15,6 +15,7 @@ const license_1 = require("./license");
|
|
|
15
15
|
const member_1 = require("./member");
|
|
16
16
|
const service_accounts_1 = require("./service-accounts");
|
|
17
17
|
const settings_1 = require("./settings");
|
|
18
|
+
const stat_1 = require("./stat");
|
|
18
19
|
const team_1 = require("./team");
|
|
19
20
|
class IdpOrganization extends Base_1.default {
|
|
20
21
|
/**
|
|
@@ -62,6 +63,15 @@ class IdpOrganization extends Base_1.default {
|
|
|
62
63
|
}
|
|
63
64
|
return this._serviceAccounts;
|
|
64
65
|
}
|
|
66
|
+
/**
|
|
67
|
+
* Handles everything around organization statistics.
|
|
68
|
+
*/
|
|
69
|
+
get stat() {
|
|
70
|
+
if (this._stat === undefined) {
|
|
71
|
+
this._stat = new stat_1.IdpOrganizationStat(this.options, this.axios);
|
|
72
|
+
}
|
|
73
|
+
return this._stat;
|
|
74
|
+
}
|
|
65
75
|
/**
|
|
66
76
|
* Updates an Organization.
|
|
67
77
|
* @param orgName Current name of the Organization
|
|
@@ -69,11 +79,11 @@ class IdpOrganization extends Base_1.default {
|
|
|
69
79
|
* @param company (optional) New company name
|
|
70
80
|
* @returns The updated Organization
|
|
71
81
|
*/
|
|
72
|
-
updateOrganization(orgName, newName, company) {
|
|
82
|
+
updateOrganization(orgName, newName, company, raw) {
|
|
73
83
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
84
|
const organization = { name: newName, company: company };
|
|
75
85
|
const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}`), organization);
|
|
76
|
-
return resp.data;
|
|
86
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
77
87
|
});
|
|
78
88
|
}
|
|
79
89
|
/**
|
|
@@ -82,11 +92,11 @@ class IdpOrganization extends Base_1.default {
|
|
|
82
92
|
* @param company (optional) Company name for the new Organization
|
|
83
93
|
* @returns The created Organization
|
|
84
94
|
*/
|
|
85
|
-
createOrganization(name, company) {
|
|
95
|
+
createOrganization(name, company, raw) {
|
|
86
96
|
return __awaiter(this, void 0, void 0, function* () {
|
|
87
97
|
const organization = { name: name, company: company };
|
|
88
98
|
const resp = yield this.axios.post(this.getEndpoint(`/v1/org`), organization);
|
|
89
|
-
return resp.data;
|
|
99
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
90
100
|
});
|
|
91
101
|
}
|
|
92
102
|
/**
|
|
@@ -95,7 +105,7 @@ class IdpOrganization extends Base_1.default {
|
|
|
95
105
|
* @param options Defines query options to retrieve additional properties in the response
|
|
96
106
|
* @returns The requested Organization
|
|
97
107
|
*/
|
|
98
|
-
getOrganization(orgName, options) {
|
|
108
|
+
getOrganization(orgName, options, raw) {
|
|
99
109
|
return __awaiter(this, void 0, void 0, function* () {
|
|
100
110
|
const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}`), {
|
|
101
111
|
params: {
|
|
@@ -105,16 +115,17 @@ class IdpOrganization extends Base_1.default {
|
|
|
105
115
|
license: options === null || options === void 0 ? void 0 : options.getLicense,
|
|
106
116
|
},
|
|
107
117
|
});
|
|
108
|
-
return resp.data;
|
|
118
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
109
119
|
});
|
|
110
120
|
}
|
|
111
121
|
/**
|
|
112
122
|
* Deletes an Organization. This will also delete all dependencies that the Organization has (Teams, Spaces, apps, ...).
|
|
113
123
|
* @param orgName Name of the Organization to be deleted
|
|
114
124
|
*/
|
|
115
|
-
deleteOrganization(orgName) {
|
|
125
|
+
deleteOrganization(orgName, raw) {
|
|
116
126
|
return __awaiter(this, void 0, void 0, function* () {
|
|
117
|
-
yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}`));
|
|
127
|
+
const resp = yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}`));
|
|
128
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
118
129
|
});
|
|
119
130
|
}
|
|
120
131
|
getEndpoint(endpoint) {
|
|
@@ -1,7 +1,11 @@
|
|
|
1
|
-
import Base from "../../../../Base";
|
|
1
|
+
import Base, { MaybeRaw } from "../../../../Base";
|
|
2
2
|
import { License } from "../../../../interfaces/idp/organization/license";
|
|
3
3
|
export declare class IdpOrganizationLicense extends Base {
|
|
4
|
-
getLicense(orgName: string
|
|
5
|
-
|
|
4
|
+
getLicense<R extends boolean = false>(orgName: string, raw?: {
|
|
5
|
+
raw: R;
|
|
6
|
+
}): Promise<MaybeRaw<R, License>>;
|
|
7
|
+
updateLicense<R extends boolean = false>(orgName: string, token: string, raw?: {
|
|
8
|
+
raw: R;
|
|
9
|
+
}): Promise<MaybeRaw<R, License>>;
|
|
6
10
|
protected getEndpoint(endpoint: string): string;
|
|
7
11
|
}
|
|
@@ -12,16 +12,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
12
12
|
exports.IdpOrganizationLicense = void 0;
|
|
13
13
|
const Base_1 = require("../../../../Base");
|
|
14
14
|
class IdpOrganizationLicense extends Base_1.default {
|
|
15
|
-
getLicense(orgName) {
|
|
15
|
+
getLicense(orgName, raw) {
|
|
16
16
|
return __awaiter(this, void 0, void 0, function* () {
|
|
17
17
|
const res = yield this.axios.get(this.getEndpoint(`/org/${orgName}/license`));
|
|
18
|
-
return res.data;
|
|
18
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
-
updateLicense(orgName, token) {
|
|
21
|
+
updateLicense(orgName, token, raw) {
|
|
22
22
|
return __awaiter(this, void 0, void 0, function* () {
|
|
23
23
|
const res = yield this.axios.put(this.getEndpoint(`/org/${orgName}/license`), { identifier: token });
|
|
24
|
-
return res.data;
|
|
24
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
25
25
|
});
|
|
26
26
|
}
|
|
27
27
|
getEndpoint(endpoint) {
|