hcloud-sdk 0.0.16 → 14.13.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/changelog.md +809 -0
- package/index.d.ts +3 -2
- package/index.js +5 -2
- package/lib/Base.d.ts +26 -0
- package/lib/Base.js +12 -0
- package/lib/Hcloud.d.ts +80 -0
- package/lib/Hcloud.js +134 -0
- package/lib/helper/ErrorHelper.d.ts +7 -0
- package/lib/helper/ErrorHelper.js +19 -0
- package/lib/helper/paginatedResponseHelper.d.ts +3 -0
- package/lib/helper/paginatedResponseHelper.js +9 -0
- package/lib/helper/searchFilter.d.ts +9 -0
- package/lib/helper/searchFilter.js +12 -0
- package/lib/interfaces/agent/bundle/dev/index.d.ts +3 -0
- package/lib/interfaces/agent/context/index.d.ts +19 -0
- package/lib/interfaces/agent/index.d.ts +21 -0
- package/lib/interfaces/agent/index.js +2 -0
- package/lib/interfaces/{Auditor.d.ts → auditor/index.d.ts} +31 -5
- package/lib/interfaces/{Auditor.js → auditor/index.js} +15 -5
- package/lib/interfaces/axios/index.d.ts +5 -0
- package/lib/interfaces/axios/index.js +8 -0
- package/lib/interfaces/bouncer/features/index.d.ts +10 -0
- package/lib/interfaces/bouncer/features/index.js +2 -0
- package/lib/interfaces/bouncer/index.d.ts +6 -0
- package/lib/interfaces/bouncer/index.js +17 -0
- package/lib/interfaces/dali/index.d.ts +3 -0
- package/lib/interfaces/dali/index.js +2 -0
- package/lib/interfaces/frontend/config/index.d.ts +33 -0
- package/lib/interfaces/frontend/config/index.js +10 -0
- package/lib/interfaces/fuse/index.d.ts +3 -0
- package/lib/interfaces/fuse/index.js +19 -0
- package/lib/interfaces/fuse/space/cronjob/Cronjob.d.ts +38 -0
- package/lib/interfaces/fuse/space/cronjob/Cronjob.js +8 -0
- package/lib/interfaces/fuse/space/cronjob/CronjobLog.d.ts +16 -0
- package/lib/interfaces/fuse/space/cronjob/CronjobLog.js +2 -0
- package/lib/interfaces/fuse/space/index.d.ts +21 -0
- package/lib/interfaces/fuse/space/index.js +11 -0
- package/lib/interfaces/global/HCloudError.d.ts +8 -0
- package/lib/interfaces/global/HCloudError.js +13 -0
- package/lib/interfaces/global/Header.d.ts +4 -0
- package/lib/interfaces/global/Header.js +2 -0
- package/lib/interfaces/global/HttpMethod.d.ts +7 -0
- package/lib/interfaces/global/HttpMethod.js +11 -0
- package/lib/interfaces/global/PaginatedResponse.d.ts +4 -0
- package/lib/interfaces/global/PaginatedResponse.js +2 -0
- package/lib/interfaces/global/Products.d.ts +11 -0
- package/lib/interfaces/global/Products.js +15 -0
- package/lib/interfaces/global/SearchFilters.d.ts +86 -0
- package/lib/interfaces/global/SearchFilters.js +49 -0
- package/lib/interfaces/global/Space.d.ts +20 -0
- package/lib/interfaces/global/Space.js +8 -0
- package/lib/interfaces/global/Version.d.ts +3 -0
- package/lib/interfaces/global/Version.js +2 -0
- package/lib/interfaces/global/Views.d.ts +8 -0
- package/lib/interfaces/global/Views.js +12 -0
- package/lib/interfaces/global/index.d.ts +9 -0
- package/lib/interfaces/global/index.js +25 -0
- package/lib/interfaces/high5/index.d.ts +16 -0
- package/lib/interfaces/high5/index.js +32 -0
- package/lib/interfaces/high5/joinToken/index.d.ts +10 -0
- package/lib/interfaces/high5/joinToken/index.js +2 -0
- package/lib/interfaces/high5/space/event/index.d.ts +15 -0
- package/lib/interfaces/high5/space/event/index.js +2 -0
- package/lib/interfaces/high5/space/event/stream/design/DesignOperation.d.ts +68 -0
- package/lib/interfaces/high5/space/event/stream/design/DesignOperation.js +20 -0
- package/lib/interfaces/high5/space/event/stream/design/StreamDesign.d.ts +92 -0
- package/lib/interfaces/high5/space/event/stream/design/StreamDesign.js +20 -0
- package/lib/interfaces/high5/space/event/stream/design/index.d.ts +22 -0
- package/lib/interfaces/high5/space/event/stream/design/index.js +2 -0
- package/lib/interfaces/high5/space/event/stream/design/snapshot/index.d.ts +30 -0
- package/lib/interfaces/high5/space/event/stream/design/snapshot/index.js +8 -0
- package/lib/interfaces/high5/space/event/stream/index.d.ts +77 -0
- package/lib/interfaces/high5/space/event/stream/index.js +13 -0
- package/lib/interfaces/high5/space/event/stream/node/index.d.ts +60 -0
- package/lib/interfaces/high5/space/event/stream/node/index.js +7 -0
- package/lib/interfaces/high5/space/execution/index.d.ts +137 -0
- package/lib/interfaces/high5/space/execution/index.js +21 -0
- package/lib/interfaces/high5/space/index.d.ts +23 -0
- package/lib/interfaces/high5/space/index.js +12 -0
- package/lib/interfaces/high5/space/secret/index.d.ts +12 -0
- package/lib/interfaces/high5/space/secret/index.js +2 -0
- package/lib/interfaces/high5/space/webhook/index.d.ts +75 -0
- package/lib/interfaces/high5/space/webhook/index.js +9 -0
- package/lib/interfaces/high5/wave/index.d.ts +171 -0
- package/lib/interfaces/high5/wave/index.js +52 -0
- package/lib/interfaces/idp/index.d.ts +26 -0
- package/lib/interfaces/idp/index.js +38 -0
- package/lib/interfaces/idp/oauth/index.d.ts +19 -0
- package/lib/interfaces/idp/oauth/index.js +8 -0
- package/lib/interfaces/idp/organization/index.d.ts +32 -0
- package/lib/interfaces/idp/organization/index.js +25 -0
- package/lib/interfaces/idp/organization/license/index.d.ts +84 -0
- package/lib/interfaces/idp/organization/license/index.js +15 -0
- package/lib/interfaces/idp/organization/member/index.d.ts +15 -0
- package/lib/interfaces/idp/organization/member/index.js +2 -0
- package/lib/interfaces/idp/organization/member/invitations/index.d.ts +26 -0
- package/lib/interfaces/idp/organization/member/invitations/index.js +18 -0
- package/lib/interfaces/idp/organization/settings/domain/index.d.ts +19 -0
- package/lib/interfaces/idp/organization/settings/domain/index.js +8 -0
- package/lib/interfaces/idp/organization/settings/domain/saml/index.d.ts +10 -0
- package/lib/interfaces/idp/organization/settings/domain/saml/index.js +2 -0
- package/lib/interfaces/idp/organization/settings/oauthApp/index.d.ts +37 -0
- package/lib/interfaces/idp/organization/settings/oauthApp/index.js +2 -0
- package/lib/interfaces/idp/organization/team/index.d.ts +24 -0
- package/lib/interfaces/idp/organization/team/index.js +9 -0
- package/lib/interfaces/idp/user/ConnectionSettings.d.ts +6 -0
- package/lib/interfaces/idp/user/ConnectionSettings.js +2 -0
- package/lib/interfaces/idp/user/GeneralSettings.d.ts +44 -0
- package/lib/interfaces/idp/user/GeneralSettings.js +38 -0
- package/lib/interfaces/idp/user/NotificationSettings.d.ts +8 -0
- package/lib/interfaces/idp/user/NotificationSettings.js +2 -0
- package/lib/interfaces/idp/user/Pat.d.ts +19 -0
- package/lib/interfaces/idp/user/Pat.js +2 -0
- package/lib/interfaces/idp/user/Scopes.d.ts +40 -0
- package/lib/interfaces/idp/user/Scopes.js +50 -0
- package/lib/interfaces/idp/user/SuccessfulAuth.d.ts +5 -0
- package/lib/interfaces/idp/user/SuccessfulAuth.js +2 -0
- package/lib/interfaces/idp/user/Totp.d.ts +20 -0
- package/lib/interfaces/idp/user/Totp.js +2 -0
- package/lib/interfaces/idp/user/index.d.ts +23 -0
- package/lib/interfaces/idp/user/index.js +2 -0
- package/lib/interfaces/mailer/index.d.ts +66 -0
- package/lib/interfaces/mailer/index.js +81 -0
- package/lib/interfaces/mothership/index.d.ts +27 -0
- package/lib/interfaces/mothership/index.js +8 -0
- package/lib/interfaces/nats/index.d.ts +252 -0
- package/lib/interfaces/nats/index.js +334 -0
- package/lib/service/agent/bundle/dev/index.d.ts +17 -0
- package/lib/service/agent/bundle/dev/index.js +40 -0
- package/lib/service/agent/bundle/index.d.ts +11 -0
- package/lib/service/agent/bundle/index.js +55 -0
- package/lib/service/agent/context/index.d.ts +37 -0
- package/lib/service/agent/context/index.js +81 -0
- package/lib/service/agent/index.d.ts +14 -0
- package/lib/service/agent/index.js +20 -0
- package/lib/service/agent/installer/index.d.ts +15 -0
- package/lib/service/agent/installer/index.js +97 -0
- package/lib/service/auditor/index.d.ts +26 -0
- package/lib/service/auditor/index.js +49 -0
- package/lib/service/auditor/internal/index.d.ts +27 -0
- package/lib/service/{AuditorInternal.js → auditor/internal/index.js} +20 -24
- package/lib/service/bouncer/features/index.d.ts +8 -0
- package/lib/service/bouncer/features/index.js +25 -0
- package/lib/service/bouncer/index.d.ts +14 -0
- package/lib/service/bouncer/index.js +31 -0
- package/lib/service/dali/DaliAvatar.d.ts +36 -0
- package/lib/service/dali/DaliAvatar.js +25 -0
- package/lib/service/dali/avatar/DaliFuseSpace.d.ts +28 -0
- package/lib/service/dali/avatar/DaliFuseSpace.js +55 -0
- package/lib/service/dali/avatar/DaliHigh5Space.d.ts +28 -0
- package/lib/service/dali/avatar/DaliHigh5Space.js +55 -0
- package/lib/service/dali/avatar/DaliOAuthApp.d.ts +28 -0
- package/lib/service/dali/avatar/DaliOAuthApp.js +55 -0
- package/lib/service/dali/avatar/DaliOrganization.d.ts +25 -0
- package/lib/service/dali/avatar/DaliOrganization.js +52 -0
- package/lib/service/dali/avatar/DaliTeam.d.ts +28 -0
- package/lib/service/dali/avatar/DaliTeam.js +55 -0
- package/lib/service/dali/avatar/DaliUser.d.ts +22 -0
- package/lib/service/dali/avatar/DaliUser.js +49 -0
- package/lib/service/dali/index.d.ts +16 -0
- package/lib/service/dali/index.js +30 -0
- package/lib/service/fuse/index.d.ts +17 -0
- package/lib/service/fuse/index.js +34 -0
- package/lib/service/fuse/internal/index.d.ts +9 -0
- package/lib/service/fuse/internal/index.js +29 -0
- package/lib/service/fuse/internal/space/cronjob/index.d.ts +8 -0
- package/lib/service/fuse/internal/space/cronjob/index.js +15 -0
- package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +17 -0
- package/lib/service/fuse/internal/space/cronjob/log/index.js +35 -0
- package/lib/service/fuse/internal/space/index.d.ts +23 -0
- package/lib/service/fuse/internal/space/index.js +43 -0
- package/lib/service/fuse/space/cronjob/index.d.ts +123 -0
- package/lib/service/fuse/space/cronjob/index.js +175 -0
- package/lib/service/fuse/space/cronjob/log/index.d.ts +31 -0
- package/lib/service/fuse/space/cronjob/log/index.js +57 -0
- package/lib/service/fuse/space/index.d.ts +82 -0
- package/lib/service/fuse/space/index.js +134 -0
- package/lib/service/high5/execution/index.d.ts +10 -0
- package/lib/service/high5/execution/index.js +17 -0
- package/lib/service/high5/execution/log/index.d.ts +19 -0
- package/lib/service/high5/execution/log/index.js +41 -0
- package/lib/service/high5/execution/status/index.d.ts +18 -0
- package/lib/service/high5/execution/status/index.js +41 -0
- package/lib/service/high5/index.d.ts +22 -0
- package/lib/service/high5/index.js +39 -0
- package/lib/service/high5/internal/index.d.ts +9 -0
- package/lib/service/high5/internal/index.js +29 -0
- package/lib/service/high5/internal/space/index.d.ts +21 -0
- package/lib/service/high5/internal/space/index.js +41 -0
- package/lib/service/high5/joinToken/index.d.ts +40 -0
- package/lib/service/high5/joinToken/index.js +64 -0
- package/lib/service/high5/space/event/index.d.ts +56 -0
- package/lib/service/high5/space/event/index.js +89 -0
- package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +31 -0
- package/lib/service/high5/space/event/stream/design/DesignOperations.js +117 -0
- package/lib/service/high5/space/event/stream/design/index.d.ts +38 -0
- package/lib/service/high5/space/event/stream/design/index.js +56 -0
- package/lib/service/high5/space/event/stream/design/snapshot/index.d.ts +62 -0
- package/lib/service/high5/space/event/stream/design/snapshot/index.js +100 -0
- package/lib/service/high5/space/event/stream/index.d.ts +114 -0
- package/lib/service/high5/space/event/stream/index.js +164 -0
- package/lib/service/high5/space/execution/index.d.ts +48 -0
- package/lib/service/high5/space/execution/index.js +74 -0
- package/lib/service/high5/space/execution/log/index.d.ts +31 -0
- package/lib/service/high5/space/execution/log/index.js +57 -0
- package/lib/service/high5/space/execution/status/index.d.ts +16 -0
- package/lib/service/high5/space/execution/status/index.js +34 -0
- package/lib/service/high5/space/index.d.ts +107 -0
- package/lib/service/high5/space/index.js +160 -0
- package/lib/service/high5/space/node/index.d.ts +58 -0
- package/lib/service/high5/space/node/index.js +116 -0
- package/lib/service/high5/space/secret/index.d.ts +60 -0
- package/lib/service/high5/space/secret/index.js +92 -0
- package/lib/service/high5/space/wave/index.d.ts +38 -0
- package/lib/service/high5/space/wave/index.js +66 -0
- package/lib/service/high5/space/webhook/index.d.ts +83 -0
- package/lib/service/high5/space/webhook/index.js +132 -0
- package/lib/service/high5/space/webhook/log/index.d.ts +18 -0
- package/lib/service/high5/space/webhook/log/index.js +38 -0
- package/lib/service/high5/wave/index.d.ts +8 -0
- package/lib/service/high5/wave/index.js +15 -0
- package/lib/service/high5/wave/s3/index.d.ts +48 -0
- package/lib/service/high5/wave/s3/index.js +88 -0
- package/lib/service/idp/index.d.ts +82 -0
- package/lib/service/idp/index.js +137 -0
- package/lib/service/idp/internal/index.d.ts +19 -0
- package/lib/service/idp/internal/index.js +34 -0
- package/lib/service/idp/oauth/index.d.ts +45 -0
- package/lib/service/idp/oauth/index.js +105 -0
- package/lib/service/idp/organization/index.d.ts +54 -0
- package/lib/service/idp/organization/index.js +79 -0
- package/lib/service/idp/organization/license/index.d.ts +7 -0
- package/lib/service/idp/organization/license/index.js +30 -0
- package/lib/service/idp/organization/member/index.d.ts +58 -0
- package/lib/service/idp/organization/member/index.js +96 -0
- package/lib/service/idp/organization/member/invitations/index.d.ts +79 -0
- package/lib/service/idp/organization/member/invitations/index.js +118 -0
- package/lib/service/idp/organization/settings/domain/index.d.ts +38 -0
- package/lib/service/idp/organization/settings/domain/index.js +63 -0
- package/lib/service/idp/organization/settings/domain/saml/index.d.ts +43 -0
- package/lib/service/idp/organization/settings/domain/saml/index.js +88 -0
- package/lib/service/idp/organization/settings/index.d.ts +16 -0
- package/lib/service/idp/organization/settings/index.js +16 -0
- package/lib/service/idp/organization/settings/oauth/index.d.ts +64 -0
- package/lib/service/idp/organization/settings/oauth/index.js +106 -0
- package/lib/service/idp/organization/team/index.d.ts +72 -0
- package/lib/service/idp/organization/team/index.js +115 -0
- package/lib/service/idp/registration/index.d.ts +39 -0
- package/lib/service/idp/registration/index.js +84 -0
- package/lib/service/idp/user/index.d.ts +82 -0
- package/lib/service/idp/user/index.js +125 -0
- package/lib/service/idp/user/license/index.d.ts +7 -0
- package/lib/service/idp/user/license/index.js +30 -0
- package/lib/service/idp/user/password/index.d.ts +19 -0
- package/lib/service/idp/user/password/index.js +52 -0
- package/lib/service/idp/user/settings/connections/index.d.ts +15 -0
- package/lib/service/idp/user/settings/connections/index.js +33 -0
- package/lib/service/idp/user/settings/general/index.d.ts +18 -0
- package/lib/service/idp/user/settings/general/index.js +39 -0
- package/lib/service/idp/user/settings/index.d.ts +36 -0
- package/lib/service/idp/user/settings/index.js +25 -0
- package/lib/service/idp/user/settings/notifications/index.d.ts +18 -0
- package/lib/service/idp/user/settings/notifications/index.js +39 -0
- package/lib/service/idp/user/settings/oauthApps/index.d.ts +22 -0
- package/lib/service/idp/user/settings/oauthApps/index.js +54 -0
- package/lib/service/idp/user/settings/pats/index.d.ts +50 -0
- package/lib/service/idp/user/settings/pats/index.js +93 -0
- package/lib/service/idp/user/settings/twoFactor/index.d.ts +11 -0
- package/lib/service/idp/user/settings/twoFactor/index.js +15 -0
- package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +34 -0
- package/lib/service/idp/user/settings/twoFactor/totp/index.js +65 -0
- package/lib/service/mailer/index.d.ts +14 -0
- package/lib/service/{Mailer.js → mailer/index.js} +9 -12
- package/lib/service/mailer/internal/index.d.ts +36 -0
- package/lib/service/mailer/internal/index.js +64 -0
- package/lib/service/mothership/index.d.ts +97 -0
- package/lib/service/mothership/index.js +136 -0
- package/lib/service/nats/index.d.ts +51 -0
- package/lib/service/nats/index.js +138 -0
- package/lib/utils/Types.d.ts +1 -0
- package/lib/utils/Types.js +2 -0
- package/lib/utils/bouncer/features/Provider.d.ts +16 -0
- package/lib/utils/bouncer/features/Provider.js +83 -0
- package/package.json +37 -29
- package/lib/base.d.ts +0 -12
- package/lib/base.js +0 -8
- package/lib/hcloud.d.ts +0 -13
- package/lib/hcloud.js +0 -29
- package/lib/interfaces/Global.d.ts +0 -8
- package/lib/interfaces/IDP.d.ts +0 -9
- package/lib/interfaces/Mail.d.ts +0 -29
- package/lib/interfaces/Mail.js +0 -8
- package/lib/service/Auditor.d.ts +0 -22
- package/lib/service/Auditor.js +0 -61
- package/lib/service/AuditorInternal.d.ts +0 -28
- package/lib/service/High5.d.ts +0 -4
- package/lib/service/High5.js +0 -9
- package/lib/service/IDP.d.ts +0 -39
- package/lib/service/IDP.js +0 -84
- package/lib/service/Mailer.d.ts +0 -13
- package/lib/service/MailerInternal.d.ts +0 -32
- package/lib/service/MailerInternal.js +0 -64
- /package/lib/interfaces/{Global.js → agent/bundle/dev/index.js} +0 -0
- /package/lib/interfaces/{IDP.js → agent/context/index.js} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
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.AgentBundle = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
const axios_1 = require("../../../interfaces/axios");
|
|
15
|
+
class AgentBundle extends Base_1.default {
|
|
16
|
+
constructor(options, axios) {
|
|
17
|
+
var _a;
|
|
18
|
+
super(options, axios);
|
|
19
|
+
this.sourceServer = ((_a = options.agent) === null || _a === void 0 ? void 0 : _a.server) || "https://agent.s3.helmut.cloud";
|
|
20
|
+
}
|
|
21
|
+
getVersions() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const resp = yield this.axios.get(this.getEndpoint("/bundles/index.json"), { headers: axios_1.disableCacheHeaders });
|
|
24
|
+
const registry = resp.data;
|
|
25
|
+
for (const v in registry.versions) {
|
|
26
|
+
setDev(registry.versions[v]);
|
|
27
|
+
}
|
|
28
|
+
return resp.data;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getLatestVersion() {
|
|
32
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
33
|
+
const resp = yield this.getVersions();
|
|
34
|
+
return setDev(resp.versions[resp.latest]);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
getVersion(version) {
|
|
38
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
39
|
+
const resp = yield this.getVersions();
|
|
40
|
+
return setDev(resp.versions[version]);
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
getEndpoint(endpoint) {
|
|
44
|
+
return this.sourceServer + endpoint;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
exports.AgentBundle = AgentBundle;
|
|
48
|
+
function setDev(v) {
|
|
49
|
+
// We check false because this way if there is a problem
|
|
50
|
+
// and the registry gets updated without a dev flag it will
|
|
51
|
+
// be undefined and therefore considered dev since false !== undefined
|
|
52
|
+
v.dev = v["dev-release"] !== false;
|
|
53
|
+
delete v["dev-release"];
|
|
54
|
+
return v;
|
|
55
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../Base";
|
|
3
|
+
import { Context } from "../../../interfaces/agent/context";
|
|
4
|
+
export declare class AgentContext extends Base {
|
|
5
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
6
|
+
/**
|
|
7
|
+
* Retrieves all contexts.
|
|
8
|
+
* @returns The requested contexts
|
|
9
|
+
*/
|
|
10
|
+
getContexts: () => Promise<Context[]>;
|
|
11
|
+
/**
|
|
12
|
+
* Add a new context.
|
|
13
|
+
* @returns The newly created context
|
|
14
|
+
*/
|
|
15
|
+
addContext: (server: string, email: string, token: string, enabled: boolean) => Promise<Context>;
|
|
16
|
+
/**
|
|
17
|
+
* Update an existing context.
|
|
18
|
+
* @returns The updated context
|
|
19
|
+
*/
|
|
20
|
+
updateContext: (uuid: string, server: string, email: string, token: string, enabled: boolean) => Promise<Context>;
|
|
21
|
+
/**
|
|
22
|
+
* Get an existing context.
|
|
23
|
+
* @returns The requested context
|
|
24
|
+
*/
|
|
25
|
+
getContext: (uuid: string) => Promise<Context>;
|
|
26
|
+
/**
|
|
27
|
+
* Delete a context.
|
|
28
|
+
* @returns void
|
|
29
|
+
*/
|
|
30
|
+
deleteContext: (uuid: string) => Promise<void>;
|
|
31
|
+
/**
|
|
32
|
+
* Patch the enabled property of a Context.
|
|
33
|
+
* @returns Updated Context
|
|
34
|
+
*/
|
|
35
|
+
patchContextEnabled: (uuid: string, enabled: boolean) => Promise<Context>;
|
|
36
|
+
protected getEndpoint(endpoint: string): string;
|
|
37
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
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.AgentContext = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
class AgentContext extends Base_1.default {
|
|
15
|
+
constructor(options, axios) {
|
|
16
|
+
super(options, axios);
|
|
17
|
+
/**
|
|
18
|
+
* Retrieves all contexts.
|
|
19
|
+
* @returns The requested contexts
|
|
20
|
+
*/
|
|
21
|
+
this.getContexts = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/context`));
|
|
23
|
+
return resp.data;
|
|
24
|
+
});
|
|
25
|
+
/**
|
|
26
|
+
* Add a new context.
|
|
27
|
+
* @returns The newly created context
|
|
28
|
+
*/
|
|
29
|
+
this.addContext = (server, email, token, enabled) => __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/context`), {
|
|
31
|
+
server,
|
|
32
|
+
email,
|
|
33
|
+
token,
|
|
34
|
+
enabled,
|
|
35
|
+
});
|
|
36
|
+
return resp.data;
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Update an existing context.
|
|
40
|
+
* @returns The updated context
|
|
41
|
+
*/
|
|
42
|
+
this.updateContext = (uuid, server, email, token, enabled) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/context/${uuid}`), {
|
|
44
|
+
server,
|
|
45
|
+
email,
|
|
46
|
+
token,
|
|
47
|
+
enabled,
|
|
48
|
+
});
|
|
49
|
+
return resp.data;
|
|
50
|
+
});
|
|
51
|
+
/**
|
|
52
|
+
* Get an existing context.
|
|
53
|
+
* @returns The requested context
|
|
54
|
+
*/
|
|
55
|
+
this.getContext = (uuid) => __awaiter(this, void 0, void 0, function* () {
|
|
56
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/context/${uuid}`));
|
|
57
|
+
return resp.data;
|
|
58
|
+
});
|
|
59
|
+
/**
|
|
60
|
+
* Delete a context.
|
|
61
|
+
* @returns void
|
|
62
|
+
*/
|
|
63
|
+
this.deleteContext = (uuid) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
yield this.axios.delete(this.getEndpoint(`/v1/context/${uuid}`));
|
|
65
|
+
});
|
|
66
|
+
/**
|
|
67
|
+
* Patch the enabled property of a Context.
|
|
68
|
+
* @returns Updated Context
|
|
69
|
+
*/
|
|
70
|
+
this.patchContextEnabled = (uuid, enabled) => __awaiter(this, void 0, void 0, function* () {
|
|
71
|
+
const res = yield this.axios.patch(this.getEndpoint(`/v1/context/${uuid}/enabled`), {
|
|
72
|
+
enabled,
|
|
73
|
+
});
|
|
74
|
+
return res.data;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getEndpoint(endpoint) {
|
|
78
|
+
return `${this.options.server}/api/agent${endpoint}`;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.AgentContext = AgentContext;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../Base";
|
|
3
|
+
import { AgentBundle } from "./bundle";
|
|
4
|
+
import { DevBundle } from "./bundle/dev";
|
|
5
|
+
import { AgentContext } from "./context";
|
|
6
|
+
import { AgentInstaller } from "./installer";
|
|
7
|
+
export default class Agent extends Base {
|
|
8
|
+
context: AgentContext;
|
|
9
|
+
bundle: AgentBundle;
|
|
10
|
+
devBundle: DevBundle;
|
|
11
|
+
installer: AgentInstaller;
|
|
12
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
13
|
+
protected getEndpoint(endpoint: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const Base_1 = require("../../Base");
|
|
4
|
+
const bundle_1 = require("./bundle");
|
|
5
|
+
const dev_1 = require("./bundle/dev");
|
|
6
|
+
const context_1 = require("./context");
|
|
7
|
+
const installer_1 = require("./installer");
|
|
8
|
+
class Agent extends Base_1.default {
|
|
9
|
+
constructor(options, axios) {
|
|
10
|
+
super(options, axios);
|
|
11
|
+
this.context = new context_1.AgentContext(this.options, this.axios);
|
|
12
|
+
this.bundle = new bundle_1.AgentBundle(this.options, this.axios);
|
|
13
|
+
this.devBundle = new dev_1.DevBundle(this.options, this.axios);
|
|
14
|
+
this.installer = new installer_1.AgentInstaller(this.options, this.axios);
|
|
15
|
+
}
|
|
16
|
+
getEndpoint(endpoint) {
|
|
17
|
+
return `${this.options.server}/api/agent${endpoint}`;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = Agent;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../Base";
|
|
3
|
+
import { AgentInstallerVersions, InstallerVersion } from "../../../interfaces/agent";
|
|
4
|
+
export declare class AgentInstaller extends Base {
|
|
5
|
+
private sourceServer;
|
|
6
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
7
|
+
getVersions(): Promise<AgentInstallerVersions>;
|
|
8
|
+
getLatestVersion(dev?: boolean): Promise<InstallerVersion[]>;
|
|
9
|
+
getLatestVersionDarwin(): Promise<InstallerVersion | null>;
|
|
10
|
+
getLatestVersionWindows(): Promise<InstallerVersion | null>;
|
|
11
|
+
getVersion(version: string): Promise<InstallerVersion[] | void>;
|
|
12
|
+
getVersionDarwin(version: string): Promise<InstallerVersion | null>;
|
|
13
|
+
getVersionWindows(version: string): Promise<InstallerVersion | null>;
|
|
14
|
+
protected getEndpoint(endpoint: string): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
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.AgentInstaller = void 0;
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
const axios_1 = require("../../../interfaces/axios");
|
|
15
|
+
class AgentInstaller extends Base_1.default {
|
|
16
|
+
constructor(options, axios) {
|
|
17
|
+
var _a;
|
|
18
|
+
super(options, axios);
|
|
19
|
+
this.sourceServer = ((_a = options.agent) === null || _a === void 0 ? void 0 : _a.server) || "https://agent.s3.helmut.cloud";
|
|
20
|
+
}
|
|
21
|
+
getVersions() {
|
|
22
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const resp = yield this.axios.get(this.getEndpoint("/install/index.json"), { headers: axios_1.disableCacheHeaders });
|
|
24
|
+
const registry = resp.data;
|
|
25
|
+
for (const version in registry.versions) {
|
|
26
|
+
setDev(registry.versions[version]);
|
|
27
|
+
}
|
|
28
|
+
return registry;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
getLatestVersion() {
|
|
32
|
+
return __awaiter(this, arguments, void 0, function* (dev = false) {
|
|
33
|
+
const resp = yield this.getVersions();
|
|
34
|
+
const releases = Object.values(resp.versions)
|
|
35
|
+
.flat()
|
|
36
|
+
.filter(r => r.dev === dev);
|
|
37
|
+
releases.sort((r1, r2) => r2.published_date - r1.published_date);
|
|
38
|
+
const windowsInstaller = releases.find(r => r.os === "windows");
|
|
39
|
+
const macInstaller = releases.find(r => r.os === "darwin");
|
|
40
|
+
const installers = [];
|
|
41
|
+
if (windowsInstaller) {
|
|
42
|
+
installers.push(windowsInstaller);
|
|
43
|
+
}
|
|
44
|
+
if (macInstaller) {
|
|
45
|
+
installers.push(macInstaller);
|
|
46
|
+
}
|
|
47
|
+
return installers;
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
getLatestVersionDarwin() {
|
|
51
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
52
|
+
var _a;
|
|
53
|
+
const versions = yield this.getLatestVersion();
|
|
54
|
+
return (_a = versions === null || versions === void 0 ? void 0 : versions.find(v => v.os === "darwin")) !== null && _a !== void 0 ? _a : null;
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
getLatestVersionWindows() {
|
|
58
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
59
|
+
var _a;
|
|
60
|
+
const versions = yield this.getLatestVersion();
|
|
61
|
+
return (_a = versions === null || versions === void 0 ? void 0 : versions.find(v => v.os === "windows")) !== null && _a !== void 0 ? _a : null;
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
getVersion(version) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
const resp = yield this.getVersions();
|
|
67
|
+
return resp.versions[version];
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
getVersionDarwin(version) {
|
|
71
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
72
|
+
var _a;
|
|
73
|
+
const versions = yield this.getVersion(version);
|
|
74
|
+
return (_a = versions === null || versions === void 0 ? void 0 : versions.find(v => v.os === "darwin")) !== null && _a !== void 0 ? _a : null;
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
getVersionWindows(version) {
|
|
78
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
79
|
+
var _a;
|
|
80
|
+
const versions = yield this.getVersion(version);
|
|
81
|
+
return (_a = versions === null || versions === void 0 ? void 0 : versions.find(v => v.os === "windows")) !== null && _a !== void 0 ? _a : null;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
getEndpoint(endpoint) {
|
|
85
|
+
return this.sourceServer + endpoint;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.AgentInstaller = AgentInstaller;
|
|
89
|
+
function setDev(vs) {
|
|
90
|
+
for (const v of vs) {
|
|
91
|
+
if (v.dev !== false) {
|
|
92
|
+
// This catches undefined, etc. even though it may seem dumb
|
|
93
|
+
v.dev = true;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
return vs;
|
|
97
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../Base";
|
|
3
|
+
import { AuditLog } from "../../interfaces/auditor";
|
|
4
|
+
import { PaginatedResponse, SearchParams, Version } from "../../interfaces/global";
|
|
5
|
+
import { AuditorInternal } from "./internal";
|
|
6
|
+
export default class Auditor extends Base {
|
|
7
|
+
internal: AuditorInternal;
|
|
8
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
9
|
+
/**
|
|
10
|
+
* @returns An object containing the endpoint version as a string
|
|
11
|
+
*/
|
|
12
|
+
version: () => Promise<Version>;
|
|
13
|
+
/**
|
|
14
|
+
* Returns all audit logs for an organization which match the search filter
|
|
15
|
+
* @param organizationName Name of the organization
|
|
16
|
+
* @param filters (optional) Array of search filters
|
|
17
|
+
* @param sorting (optional) Sorting object
|
|
18
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
19
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
20
|
+
* @returns Object containing an array of audit logs and the total number of results found in the database (independent of limit and page)
|
|
21
|
+
*/
|
|
22
|
+
searchAuditLogs: ({ organizationName, filters, sorting, limit, page, }: SearchParams & {
|
|
23
|
+
organizationName: string;
|
|
24
|
+
}) => Promise<PaginatedResponse<AuditLog>>;
|
|
25
|
+
protected getEndpoint(endpoint: string): string;
|
|
26
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
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
|
+
const Base_1 = require("../../Base");
|
|
13
|
+
const paginatedResponseHelper_1 = require("../../helper/paginatedResponseHelper");
|
|
14
|
+
const searchFilter_1 = require("../../helper/searchFilter");
|
|
15
|
+
const internal_1 = require("./internal");
|
|
16
|
+
class Auditor extends Base_1.default {
|
|
17
|
+
constructor(options, axios) {
|
|
18
|
+
super(options, axios);
|
|
19
|
+
/**
|
|
20
|
+
* @returns An object containing the endpoint version as a string
|
|
21
|
+
*/
|
|
22
|
+
this.version = () => __awaiter(this, void 0, void 0, function* () {
|
|
23
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/version"), {});
|
|
24
|
+
return resp.data;
|
|
25
|
+
});
|
|
26
|
+
/**
|
|
27
|
+
* Returns all audit logs for an organization which match the search filter
|
|
28
|
+
* @param organizationName Name of the organization
|
|
29
|
+
* @param filters (optional) Array of search filters
|
|
30
|
+
* @param sorting (optional) Sorting object
|
|
31
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
32
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
33
|
+
* @returns Object containing an array of audit logs and the total number of results found in the database (independent of limit and page)
|
|
34
|
+
*/
|
|
35
|
+
this.searchAuditLogs = (_a) => __awaiter(this, [_a], void 0, function* ({ organizationName, filters, sorting, limit = 25, page = 0, }) {
|
|
36
|
+
const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => new searchFilter_1.SearchFilterDTO(f));
|
|
37
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${organizationName}/logs/search?page=${page}&limit=${limit}`), {
|
|
38
|
+
filters: filtersDTO,
|
|
39
|
+
sorting: sorting,
|
|
40
|
+
});
|
|
41
|
+
return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
|
|
42
|
+
});
|
|
43
|
+
this.internal = new internal_1.AuditorInternal(this.options, this.axios);
|
|
44
|
+
}
|
|
45
|
+
getEndpoint(endpoint) {
|
|
46
|
+
return `${this.options.server}/api/auditor${endpoint}`;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.default = Auditor;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import Base from "../../../Base";
|
|
2
|
+
import { AuditLogCreate } from "../../../interfaces/auditor";
|
|
3
|
+
export declare class AuditorInternal extends Base {
|
|
4
|
+
private queueExecutionInterval;
|
|
5
|
+
private logQueue;
|
|
6
|
+
private logQueueTimer;
|
|
7
|
+
/**
|
|
8
|
+
* Adds log entries to a queue that will be processed periodically.
|
|
9
|
+
*
|
|
10
|
+
* No exceptions are thrown in case of an error as this function runs periodically asynchronous.
|
|
11
|
+
*
|
|
12
|
+
* This also comes with the downside of log timesstamps being inaccurate as they are created by the Auditor Server.
|
|
13
|
+
* Timestamps might differ as much as: this.options.auditor.queue.executionInterval || 500
|
|
14
|
+
* @param logs array (add multiple logs entries at once)
|
|
15
|
+
*/
|
|
16
|
+
queueAuditLogs: (logs: AuditLogCreate[]) => Promise<void>;
|
|
17
|
+
private startQueue;
|
|
18
|
+
/**
|
|
19
|
+
* Deletes all audit logs of an organization
|
|
20
|
+
*
|
|
21
|
+
* THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
|
|
22
|
+
* @param orgId the organizations's ID
|
|
23
|
+
* @returns void
|
|
24
|
+
*/
|
|
25
|
+
deleteAllAuditLogsOfOrganization: (orgId: string) => Promise<void>;
|
|
26
|
+
protected getEndpoint(endpoint: string): string;
|
|
27
|
+
}
|
|
@@ -10,35 +10,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.AuditorInternal = void 0;
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
class AuditorInternal extends base_1.default {
|
|
13
|
+
const Base_1 = require("../../../Base");
|
|
14
|
+
class AuditorInternal extends Base_1.default {
|
|
16
15
|
constructor() {
|
|
17
16
|
var _a, _b;
|
|
18
17
|
super(...arguments);
|
|
19
|
-
this.queueExecutionInterval = ((_b = (_a = this.
|
|
18
|
+
this.queueExecutionInterval = ((_b = (_a = this.options.auditor) === null || _a === void 0 ? void 0 : _a.queue) === null || _b === void 0 ? void 0 : _b.executionInterval) || 500;
|
|
20
19
|
this.logQueue = [];
|
|
21
20
|
/**
|
|
22
|
-
*
|
|
21
|
+
* Adds log entries to a queue that will be processed periodically.
|
|
23
22
|
*
|
|
24
|
-
*
|
|
23
|
+
* No exceptions are thrown in case of an error as this function runs periodically asynchronous.
|
|
25
24
|
*
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @returns AuditLog array
|
|
29
|
-
*/
|
|
30
|
-
this.addAuditLogs = (logs) => __awaiter(this, void 0, void 0, function* () {
|
|
31
|
-
const resp = yield axios_1.default.post(this.getEndpoint("/v1/logs"), logs).catch((err) => {
|
|
32
|
-
throw err;
|
|
33
|
-
});
|
|
34
|
-
return resp.data;
|
|
35
|
-
});
|
|
36
|
-
/**
|
|
37
|
-
* QueueAuditLogs adds log entries to a queue that will be processed periodically
|
|
38
|
-
*
|
|
39
|
-
* THIS COMES WITH DOWNSIDE OF LOG TIMESTAMPS BEING INACCURATE AS THEY ARE CREATED BY THE Auditor SERVER
|
|
40
|
-
*
|
|
41
|
-
* TIMESTAMPS MIGHT DIFFER AS MUCH AS: this.opts.auditor.queue.executionInterval || 500
|
|
25
|
+
* This also comes with the downside of log timesstamps being inaccurate as they are created by the Auditor Server.
|
|
26
|
+
* Timestamps might differ as much as: this.options.auditor.queue.executionInterval || 500
|
|
42
27
|
* @param logs array (add multiple logs entries at once)
|
|
43
28
|
*/
|
|
44
29
|
this.queueAuditLogs = (logs) => __awaiter(this, void 0, void 0, function* () {
|
|
@@ -47,19 +32,30 @@ class AuditorInternal extends base_1.default {
|
|
|
47
32
|
}
|
|
48
33
|
this.logQueue = this.logQueue.concat(logs);
|
|
49
34
|
});
|
|
35
|
+
/**
|
|
36
|
+
* Deletes all audit logs of an organization
|
|
37
|
+
*
|
|
38
|
+
* THIS IS AN INTERNAL ENDPOINT AND CAN ONLY BE USED FROM BACKENDS WITHIN THE HCLOUD DEPLOYMENT
|
|
39
|
+
* @param orgId the organizations's ID
|
|
40
|
+
* @returns void
|
|
41
|
+
*/
|
|
42
|
+
this.deleteAllAuditLogsOfOrganization = (orgId) => __awaiter(this, void 0, void 0, function* () {
|
|
43
|
+
yield this.axios.delete(this.getEndpoint(`/v1/org/${orgId}/logs`));
|
|
44
|
+
});
|
|
50
45
|
}
|
|
51
46
|
startQueue() {
|
|
52
47
|
if (!this.logQueueTimer) {
|
|
53
48
|
this.logQueueTimer = setTimeout(() => {
|
|
54
49
|
if (this.logQueue.length > 0) {
|
|
55
|
-
|
|
50
|
+
// DO NOT REMOVE THE IGNORE CATCH AS IT WOULD LEAD TO UNHANDLED PROMISE REJECTION IN OTHER ENDPOINTS AND THEIR CRASH
|
|
51
|
+
this.axios.post(this.getEndpoint("/v1/logs"), this.logQueue).catch(ignored => ignored);
|
|
56
52
|
this.logQueue = [];
|
|
57
53
|
}
|
|
58
54
|
}, this.queueExecutionInterval);
|
|
59
55
|
}
|
|
60
56
|
}
|
|
61
57
|
getEndpoint(endpoint) {
|
|
62
|
-
return `${this.
|
|
58
|
+
return `${this.options.server}/api/auditor/internal${endpoint}`;
|
|
63
59
|
}
|
|
64
60
|
}
|
|
65
61
|
exports.AuditorInternal = AuditorInternal;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../Base";
|
|
3
|
+
import { HcloudFeature } from "../../../interfaces/bouncer";
|
|
4
|
+
export default class BouncerFeatures extends Base {
|
|
5
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
6
|
+
getHcloudFeatures: () => Promise<HcloudFeature[]>;
|
|
7
|
+
protected getEndpoint(endpoint: string): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
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
|
+
const Base_1 = require("../../../Base");
|
|
13
|
+
class BouncerFeatures extends Base_1.default {
|
|
14
|
+
constructor(options, axios) {
|
|
15
|
+
super(options, axios);
|
|
16
|
+
this.getHcloudFeatures = () => __awaiter(this, void 0, void 0, function* () {
|
|
17
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/feature/hcloud"), {});
|
|
18
|
+
return resp.data;
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
getEndpoint(endpoint) {
|
|
22
|
+
return `${this.options.server}/api/bouncer${endpoint}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = BouncerFeatures;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../Base";
|
|
3
|
+
import { Version } from "../../interfaces/global";
|
|
4
|
+
import BouncerFeatures from "./features";
|
|
5
|
+
export default class Bouncer extends Base {
|
|
6
|
+
features: BouncerFeatures;
|
|
7
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
8
|
+
/**
|
|
9
|
+
* Requests the endpoint version
|
|
10
|
+
* @returns Version object
|
|
11
|
+
*/
|
|
12
|
+
version: () => Promise<Version>;
|
|
13
|
+
protected getEndpoint(endpoint: string): string;
|
|
14
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
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
|
+
const Base_1 = require("../../Base");
|
|
13
|
+
const features_1 = require("./features");
|
|
14
|
+
class Bouncer extends Base_1.default {
|
|
15
|
+
constructor(options, axios) {
|
|
16
|
+
super(options, axios);
|
|
17
|
+
/**
|
|
18
|
+
* Requests the endpoint version
|
|
19
|
+
* @returns Version object
|
|
20
|
+
*/
|
|
21
|
+
this.version = () => __awaiter(this, void 0, void 0, function* () {
|
|
22
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/version"), {});
|
|
23
|
+
return resp.data;
|
|
24
|
+
});
|
|
25
|
+
this.features = new features_1.default(options, axios);
|
|
26
|
+
}
|
|
27
|
+
getEndpoint(endpoint) {
|
|
28
|
+
return `${this.options.server}/api/bouncer${endpoint}`;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.default = Bouncer;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../Base";
|
|
3
|
+
import { DaliFuse } from "./avatar/DaliFuseSpace";
|
|
4
|
+
import { DaliHigh5 } from "./avatar/DaliHigh5Space";
|
|
5
|
+
import { DaliOAuthApp } from "./avatar/DaliOAuthApp";
|
|
6
|
+
import { DaliOrganization } from "./avatar/DaliOrganization";
|
|
7
|
+
import { DaliTeam } from "./avatar/DaliTeam";
|
|
8
|
+
import { DaliUser } from "./avatar/DaliUser";
|
|
9
|
+
export declare class DaliAvatar extends Base {
|
|
10
|
+
/**
|
|
11
|
+
* Handles everything around user avatars
|
|
12
|
+
*/
|
|
13
|
+
user: DaliUser;
|
|
14
|
+
/**
|
|
15
|
+
* Handles everything around team avatars
|
|
16
|
+
*/
|
|
17
|
+
team: DaliTeam;
|
|
18
|
+
/**
|
|
19
|
+
* Handles everything around organization avatars
|
|
20
|
+
*/
|
|
21
|
+
organization: DaliOrganization;
|
|
22
|
+
/**
|
|
23
|
+
* Handles everything around high5 spaces avatars
|
|
24
|
+
*/
|
|
25
|
+
high5Space: DaliHigh5;
|
|
26
|
+
/**
|
|
27
|
+
* Handles everything around fuse spaces avatars
|
|
28
|
+
*/
|
|
29
|
+
fuseSpace: DaliFuse;
|
|
30
|
+
/**
|
|
31
|
+
* Handles everything around OAuth applications avatars
|
|
32
|
+
*/
|
|
33
|
+
oauth: DaliOAuthApp;
|
|
34
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
35
|
+
protected getEndpoint(endpoint: string): string;
|
|
36
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DaliAvatar = void 0;
|
|
4
|
+
const Base_1 = require("../../Base");
|
|
5
|
+
const DaliFuseSpace_1 = require("./avatar/DaliFuseSpace");
|
|
6
|
+
const DaliHigh5Space_1 = require("./avatar/DaliHigh5Space");
|
|
7
|
+
const DaliOAuthApp_1 = require("./avatar/DaliOAuthApp");
|
|
8
|
+
const DaliOrganization_1 = require("./avatar/DaliOrganization");
|
|
9
|
+
const DaliTeam_1 = require("./avatar/DaliTeam");
|
|
10
|
+
const DaliUser_1 = require("./avatar/DaliUser");
|
|
11
|
+
class DaliAvatar extends Base_1.default {
|
|
12
|
+
constructor(options, axios) {
|
|
13
|
+
super(options, axios);
|
|
14
|
+
this.user = new DaliUser_1.DaliUser(this.options, this.axios);
|
|
15
|
+
this.team = new DaliTeam_1.DaliTeam(this.options, this.axios);
|
|
16
|
+
this.organization = new DaliOrganization_1.DaliOrganization(this.options, this.axios);
|
|
17
|
+
this.high5Space = new DaliHigh5Space_1.DaliHigh5(this.options, this.axios);
|
|
18
|
+
this.fuseSpace = new DaliFuseSpace_1.DaliFuse(this.options, this.axios);
|
|
19
|
+
this.oauth = new DaliOAuthApp_1.DaliOAuthApp(this.options, this.axios);
|
|
20
|
+
}
|
|
21
|
+
getEndpoint(endpoint) {
|
|
22
|
+
return `${this.options.server}/api/dali${endpoint}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.DaliAvatar = DaliAvatar;
|