hcloud-sdk 17.0.0 → 19.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 +87 -76
- package/lib/Base.d.ts +2 -1
- package/lib/Hcloud.d.ts +24 -6
- package/lib/Hcloud.js +127 -24
- package/lib/helper/ErrorHelper.js +5 -2
- package/lib/helper/ValidationHelper.d.ts +14 -4
- package/lib/helper/ValidationHelper.js +71 -11
- package/lib/interfaces/agent/logging/cloudwatch.d.ts +23 -0
- package/lib/interfaces/agent/logging/index.d.ts +2 -0
- package/lib/interfaces/{friday → agent/logging}/index.js +2 -3
- package/lib/interfaces/agent/logging/log-collector.d.ts +35 -0
- package/lib/interfaces/agent/module/index.d.ts +7 -0
- package/lib/interfaces/agent/module/index.js +2 -0
- package/lib/interfaces/auditor/index.d.ts +13 -3
- package/lib/interfaces/auditor/index.js +9 -2
- package/lib/interfaces/axios/index.d.ts +5 -0
- package/lib/interfaces/cosmo/asset/index.d.ts +216 -0
- package/lib/interfaces/cosmo/asset/index.js +90 -0
- package/lib/interfaces/cosmo/comment/index.d.ts +41 -0
- package/lib/interfaces/cosmo/comment/index.js +8 -0
- package/lib/interfaces/cosmo/event/index.d.ts +60 -0
- package/lib/interfaces/cosmo/event/index.js +31 -0
- package/lib/interfaces/cosmo/location/index.d.ts +4 -0
- package/lib/interfaces/cosmo/location/index.js +2 -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 +110 -0
- package/lib/interfaces/cosmo/share/index.js +23 -0
- package/lib/interfaces/cosmo/space/index.d.ts +31 -0
- package/lib/interfaces/cosmo/space/index.js +2 -0
- package/lib/interfaces/cosmo/stats/index.d.ts +11 -0
- package/lib/interfaces/cosmo/stats/index.js +2 -0
- package/lib/interfaces/cosmo/tag/tag.d.ts +13 -0
- package/lib/interfaces/cosmo/tag/tag.js +2 -0
- package/lib/interfaces/global/Products.d.ts +2 -3
- package/lib/interfaces/global/Products.js +1 -2
- package/lib/interfaces/global/Views.d.ts +0 -1
- package/lib/interfaces/global/Views.js +0 -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 +10 -2
- package/lib/interfaces/high5/space/event/stream/node/index.d.ts +1 -0
- package/lib/interfaces/high5/space/execution/index.d.ts +3 -1
- package/lib/interfaces/{fuse/space/cronjob/CronjobLog.d.ts → high5/space/job/JobLog.d.ts} +3 -3
- package/lib/interfaces/high5/space/job/JobLog.js +2 -0
- package/lib/interfaces/high5/space/job/index.d.ts +83 -0
- package/lib/interfaces/high5/space/job/index.js +11 -0
- package/lib/interfaces/high5/stats.d.ts +21 -0
- package/lib/interfaces/high5/stats.js +2 -0
- package/lib/interfaces/high5/wave/dependentInputs.d.ts +42 -0
- package/lib/interfaces/high5/wave/dependentInputs.js +144 -0
- package/lib/interfaces/high5/wave/dependentInputsValidation.d.ts +22 -0
- package/lib/interfaces/high5/wave/dependentInputsValidation.js +220 -0
- package/lib/interfaces/idp/index.d.ts +3 -3
- package/lib/interfaces/idp/index.js +3 -3
- package/lib/interfaces/idp/oauth/device.d.ts +18 -0
- package/lib/interfaces/idp/oauth/device.js +2 -0
- package/lib/interfaces/idp/oauth/index.d.ts +19 -5
- package/lib/interfaces/idp/organization/index.d.ts +2 -0
- package/lib/interfaces/idp/organization/index.js +2 -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/settings/oauthApp/index.d.ts +4 -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 +22 -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 -15
- package/lib/interfaces/idp/user/Scopes.js +0 -21
- package/lib/interfaces/idp/user/index.d.ts +5 -1
- package/lib/interfaces/mailer/index.d.ts +50 -2
- package/lib/interfaces/mailer/index.js +100 -2
- 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 +79 -51
- package/lib/interfaces/nats/index.js +140 -125
- package/lib/interfaces/shorts/index.d.ts +17 -0
- package/lib/interfaces/shorts/index.js +8 -0
- package/lib/service/agent/bundle/dev/index.d.ts +16 -6
- package/lib/service/agent/bundle/dev/index.js +16 -11
- package/lib/service/agent/bundle/index.d.ts +10 -4
- package/lib/service/agent/bundle/index.js +10 -7
- package/lib/service/agent/context/index.d.ts +22 -8
- package/lib/service/agent/context/index.js +19 -15
- package/lib/service/agent/index.d.ts +6 -0
- package/lib/service/agent/index.js +18 -1
- package/lib/service/agent/installer/index.js +4 -1
- package/lib/service/agent/logging/index.d.ts +69 -0
- package/lib/service/agent/logging/index.js +117 -0
- package/lib/service/agent/module/index.d.ts +36 -0
- package/lib/service/agent/module/index.js +65 -0
- package/lib/service/auditor/index.d.ts +8 -4
- package/lib/service/auditor/index.js +9 -6
- package/lib/service/auditor/internal/index.d.ts +27 -3
- package/lib/service/auditor/internal/index.js +38 -6
- package/lib/service/bouncer/features/index.d.ts +4 -2
- package/lib/service/bouncer/features/index.js +6 -3
- package/lib/service/bouncer/index.js +5 -2
- package/lib/service/cosmo/asset/index.d.ts +265 -0
- package/lib/service/cosmo/asset/index.js +420 -0
- package/lib/service/cosmo/comment/index.d.ts +93 -0
- package/lib/service/cosmo/comment/index.js +136 -0
- package/lib/service/cosmo/event/index.d.ts +23 -0
- package/lib/service/cosmo/event/index.js +43 -0
- package/lib/service/cosmo/folder/index.d.ts +27 -0
- package/lib/service/cosmo/folder/index.js +50 -0
- package/lib/service/cosmo/index.d.ts +52 -0
- package/lib/service/cosmo/index.js +129 -0
- package/lib/service/cosmo/internal/index.d.ts +7 -0
- package/lib/service/cosmo/internal/index.js +20 -0
- package/lib/service/cosmo/internal/space/index.d.ts +15 -0
- package/lib/service/cosmo/internal/space/index.js +37 -0
- package/lib/service/cosmo/location/index.d.ts +40 -0
- package/lib/service/cosmo/location/index.js +66 -0
- package/lib/service/cosmo/namespace/index.d.ts +56 -0
- package/lib/service/cosmo/namespace/index.js +85 -0
- package/lib/service/cosmo/organization/index.d.ts +47 -0
- package/lib/service/cosmo/organization/index.js +67 -0
- package/lib/service/cosmo/permissions/index.d.ts +131 -0
- package/lib/service/cosmo/permissions/index.js +184 -0
- package/lib/service/cosmo/production/index.d.ts +26 -0
- package/lib/service/cosmo/production/index.js +48 -0
- package/lib/service/cosmo/share/index.d.ts +169 -0
- package/lib/service/cosmo/share/index.js +227 -0
- package/lib/service/cosmo/space/index.d.ts +131 -0
- package/lib/service/cosmo/space/index.js +190 -0
- package/lib/service/cosmo/stats/index.d.ts +35 -0
- package/lib/service/cosmo/stats/index.js +58 -0
- package/lib/service/cosmo/tag/index.d.ts +67 -0
- package/lib/service/cosmo/tag/index.js +96 -0
- package/lib/service/dali/DaliAvatar.d.ts +0 -6
- package/lib/service/dali/DaliAvatar.js +4 -11
- package/lib/service/dali/avatar/DaliCosmoSpace.d.ts +10 -4
- package/lib/service/dali/avatar/DaliCosmoSpace.js +12 -8
- package/lib/service/dali/avatar/DaliHigh5Pool.d.ts +11 -4
- package/lib/service/dali/avatar/DaliHigh5Pool.js +12 -8
- package/lib/service/dali/avatar/DaliHigh5Space.d.ts +11 -4
- package/lib/service/dali/avatar/DaliHigh5Space.js +12 -8
- package/lib/service/dali/avatar/DaliOAuthApp.d.ts +11 -4
- package/lib/service/dali/avatar/DaliOAuthApp.js +12 -8
- package/lib/service/dali/avatar/DaliOrganization.d.ts +11 -4
- package/lib/service/dali/avatar/DaliOrganization.js +12 -8
- package/lib/service/dali/avatar/DaliServiceAccount.d.ts +10 -4
- package/lib/service/dali/avatar/DaliServiceAccount.js +12 -8
- package/lib/service/dali/avatar/DaliTeam.d.ts +11 -4
- package/lib/service/dali/avatar/DaliTeam.js +12 -8
- package/lib/service/dali/avatar/DaliUser.d.ts +11 -4
- package/lib/service/dali/avatar/DaliUser.js +12 -8
- package/lib/service/dali/index.d.ts +4 -5
- package/lib/service/dali/index.js +6 -6
- package/lib/service/high5/execution/index.d.ts +4 -2
- package/lib/service/high5/execution/index.js +7 -3
- package/lib/service/high5/execution/log/index.js +4 -1
- package/lib/service/high5/execution/status/index.d.ts +5 -3
- package/lib/service/high5/execution/status/index.js +7 -4
- package/lib/service/high5/index.d.ts +7 -2
- package/lib/service/high5/index.js +13 -3
- package/lib/service/high5/internal/index.d.ts +4 -2
- package/lib/service/high5/internal/index.js +7 -3
- package/lib/service/high5/internal/space/index.d.ts +10 -3
- package/lib/service/high5/internal/space/index.js +17 -5
- package/lib/service/high5/internal/space/job/index.d.ts +7 -0
- package/lib/service/high5/internal/space/job/index.js +20 -0
- package/lib/service/high5/internal/space/job/log/index.d.ts +17 -0
- package/lib/service/{fuse/internal/space/cronjob → high5/internal/space/job}/log/index.js +13 -10
- package/lib/service/high5/joinToken/index.d.ts +14 -6
- package/lib/service/high5/joinToken/index.js +14 -10
- package/lib/service/high5/space/database/document/array/index.d.ts +73 -0
- package/lib/service/high5/space/database/document/array/index.js +105 -0
- package/lib/service/{friday → high5}/space/database/document/index.d.ts +26 -10
- package/lib/service/{friday → high5}/space/database/document/index.js +35 -17
- package/lib/service/high5/space/database/document/number/index.d.ts +51 -0
- package/lib/service/high5/space/database/document/number/index.js +80 -0
- package/lib/service/{friday → high5}/space/database/index.d.ts +22 -12
- package/lib/service/{friday → high5}/space/database/index.js +22 -18
- package/lib/service/high5/space/event/index.d.ts +17 -7
- package/lib/service/high5/space/event/index.js +16 -12
- package/lib/service/high5/space/event/stream/design/DesignOperations.d.ts +4 -2
- package/lib/service/high5/space/event/stream/design/DesignOperations.js +6 -3
- package/lib/service/high5/space/event/stream/design/index.d.ts +10 -4
- package/lib/service/high5/space/event/stream/design/index.js +13 -9
- 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 +16 -11
- package/lib/service/high5/space/event/stream/index.d.ts +32 -12
- package/lib/service/high5/space/event/stream/index.js +26 -22
- package/lib/service/high5/space/execution/index.d.ts +19 -7
- package/lib/service/high5/space/execution/index.js +21 -13
- package/lib/service/high5/space/execution/log/index.d.ts +8 -4
- package/lib/service/high5/space/execution/log/index.js +9 -6
- package/lib/service/high5/space/execution/status/index.d.ts +7 -3
- package/lib/service/high5/space/execution/status/index.js +8 -5
- package/lib/service/high5/space/index.d.ts +53 -14
- package/lib/service/high5/space/index.js +70 -28
- package/lib/service/{fuse/space/cronjob → high5/space/job}/index.d.ts +57 -35
- package/lib/service/{fuse/space/cronjob → high5/space/job}/index.js +88 -87
- package/lib/service/{fuse/space/cronjob → high5/space/job}/log/index.d.ts +15 -11
- package/lib/service/{fuse/space/cronjob → high5/space/job}/log/index.js +19 -16
- package/lib/service/high5/space/node/index.d.ts +20 -8
- package/lib/service/high5/space/node/index.js +18 -14
- package/lib/service/high5/space/pool/index.d.ts +38 -11
- package/lib/service/high5/space/pool/index.js +41 -19
- package/lib/service/high5/space/secret/index.d.ts +17 -7
- package/lib/service/high5/space/secret/index.js +16 -12
- package/lib/service/high5/space/stat/index.d.ts +12 -0
- package/lib/service/high5/space/stat/index.js +34 -0
- package/lib/service/high5/space/wave/index.d.ts +16 -6
- package/lib/service/high5/space/wave/index.js +15 -11
- package/lib/service/high5/space/webhook/index.d.ts +32 -12
- package/lib/service/high5/space/webhook/index.js +29 -22
- package/lib/service/high5/space/webhook/log/index.d.ts +4 -2
- package/lib/service/high5/space/webhook/log/index.js +6 -3
- package/lib/service/high5/stat/index.d.ts +11 -0
- package/lib/service/{fuse/internal → high5/stat}/index.js +16 -14
- package/lib/service/high5/wave/index.js +4 -1
- package/lib/service/high5/wave/s3/index.d.ts +31 -8
- package/lib/service/high5/wave/s3/index.js +47 -23
- package/lib/service/idp/guest/index.d.ts +42 -0
- package/lib/service/idp/guest/index.js +69 -0
- package/lib/service/idp/index.d.ts +25 -7
- package/lib/service/idp/index.js +27 -13
- package/lib/service/idp/internal/index.d.ts +5 -3
- package/lib/service/idp/internal/index.js +9 -4
- package/lib/service/idp/oauth/device.d.ts +131 -0
- package/lib/service/idp/oauth/device.js +177 -0
- package/lib/service/idp/oauth/index.d.ts +19 -6
- package/lib/service/idp/oauth/index.js +26 -16
- package/lib/service/idp/organization/index.d.ts +28 -5
- package/lib/service/idp/organization/index.js +41 -11
- package/lib/service/idp/organization/license/index.d.ts +7 -3
- package/lib/service/idp/organization/license/index.js +8 -5
- package/lib/service/idp/organization/member/index.d.ts +20 -8
- package/lib/service/idp/organization/member/index.js +20 -15
- package/lib/service/idp/organization/member/invitations/index.d.ts +42 -9
- package/lib/service/idp/organization/member/invitations/index.js +94 -59
- package/lib/service/idp/organization/service-accounts/index.d.ts +31 -9
- package/lib/service/idp/organization/service-accounts/index.js +35 -14
- package/lib/service/idp/organization/settings/domain/index.d.ts +13 -5
- package/lib/service/idp/organization/settings/domain/index.js +13 -9
- package/lib/service/idp/organization/settings/domain/saml/index.d.ts +16 -6
- package/lib/service/idp/organization/settings/domain/saml/index.js +23 -19
- package/lib/service/idp/organization/settings/index.js +4 -1
- package/lib/service/idp/organization/settings/oauth/index.d.ts +33 -9
- package/lib/service/idp/organization/settings/oauth/index.js +37 -16
- package/lib/service/idp/organization/stat/index.d.ts +11 -0
- package/lib/service/idp/organization/stat/index.js +33 -0
- package/lib/service/idp/organization/team/index.d.ts +32 -10
- package/lib/service/idp/organization/team/index.js +35 -14
- package/lib/service/idp/registration/index.d.ts +10 -4
- package/lib/service/idp/registration/index.js +19 -10
- package/lib/service/idp/user/index.d.ts +41 -11
- package/lib/service/idp/user/index.js +49 -19
- package/lib/service/idp/user/license/index.d.ts +7 -3
- package/lib/service/idp/user/license/index.js +8 -5
- package/lib/service/idp/user/message/index.d.ts +62 -0
- package/lib/service/idp/user/message/index.js +95 -0
- package/lib/service/idp/user/password/index.d.ts +4 -2
- package/lib/service/idp/user/password/index.js +6 -3
- package/lib/service/idp/user/settings/connections/index.d.ts +4 -2
- package/lib/service/idp/user/settings/connections/index.js +6 -3
- package/lib/service/idp/user/settings/general/index.d.ts +10 -4
- package/lib/service/idp/user/settings/general/index.js +10 -7
- package/lib/service/idp/user/settings/index.js +4 -1
- package/lib/service/idp/user/settings/notifications/index.d.ts +7 -3
- package/lib/service/idp/user/settings/notifications/index.js +8 -5
- package/lib/service/idp/user/settings/oauthApps/index.d.ts +7 -3
- package/lib/service/idp/user/settings/oauthApps/index.js +10 -6
- package/lib/service/idp/user/settings/pats/index.d.ts +22 -8
- package/lib/service/idp/user/settings/pats/index.js +21 -16
- package/lib/service/idp/user/settings/twoFactor/index.js +4 -1
- package/lib/service/idp/user/settings/twoFactor/totp/index.d.ts +16 -6
- package/lib/service/idp/user/settings/twoFactor/totp/index.js +17 -11
- package/lib/service/mailer/index.d.ts +4 -2
- package/lib/service/mailer/index.js +7 -4
- package/lib/service/mailer/internal/index.d.ts +14 -6
- package/lib/service/mailer/internal/index.js +12 -9
- package/lib/service/mothership/index.d.ts +35 -13
- package/lib/service/mothership/index.js +36 -18
- package/lib/service/nats/index.d.ts +7 -0
- package/lib/service/nats/index.js +77 -44
- package/lib/service/shorts/index.d.ts +18 -0
- package/lib/service/{friday → shorts}/index.js +17 -11
- package/lib/service/shorts/internal/index.d.ts +75 -0
- package/lib/service/shorts/internal/index.js +118 -0
- package/lib/utils/bouncer/features/Provider.js +0 -1
- package/package.json +2 -2
- package/lib/interfaces/friday/index.d.ts +0 -3
- package/lib/interfaces/friday/space/index.d.ts +0 -21
- package/lib/interfaces/friday/space/index.js +0 -11
- package/lib/interfaces/fuse/index.d.ts +0 -3
- package/lib/interfaces/fuse/index.js +0 -19
- package/lib/interfaces/fuse/space/cronjob/Cronjob.d.ts +0 -38
- package/lib/interfaces/fuse/space/cronjob/Cronjob.js +0 -8
- package/lib/interfaces/fuse/space/index.d.ts +0 -22
- package/lib/interfaces/fuse/space/index.js +0 -11
- package/lib/service/dali/avatar/DaliFuseSpace.d.ts +0 -26
- package/lib/service/dali/avatar/DaliFuseSpace.js +0 -58
- 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/service/fuse/index.d.ts +0 -18
- package/lib/service/fuse/index.js +0 -48
- package/lib/service/fuse/internal/index.d.ts +0 -8
- package/lib/service/fuse/internal/space/cronjob/index.d.ts +0 -7
- package/lib/service/fuse/internal/space/cronjob/index.js +0 -17
- package/lib/service/fuse/internal/space/cronjob/log/index.d.ts +0 -15
- package/lib/service/fuse/internal/space/index.d.ts +0 -22
- package/lib/service/fuse/internal/space/index.js +0 -49
- package/lib/service/fuse/space/index.d.ts +0 -81
- package/lib/service/fuse/space/index.js +0 -152
- /package/lib/interfaces/{friday/space/database/index.js → agent/logging/cloudwatch.js} +0 -0
- /package/lib/interfaces/{fuse/space/cronjob/CronjobLog.js → agent/logging/log-collector.js} +0 -0
- /package/lib/interfaces/{friday → high5}/space/database/index.d.ts +0 -0
|
@@ -8,11 +8,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.S3 = void 0;
|
|
13
|
-
const axios_1 = require("axios");
|
|
16
|
+
const axios_1 = __importDefault(require("axios"));
|
|
14
17
|
const package_json_1 = require("../../../../../package.json");
|
|
15
|
-
const Base_1 = require("../../../../Base");
|
|
18
|
+
const Base_1 = __importDefault(require("../../../../Base"));
|
|
16
19
|
const axios_2 = require("../../../../interfaces/axios");
|
|
17
20
|
const sdkVersion = "hcloud-sdk-js/v" + package_json_1.version;
|
|
18
21
|
/**
|
|
@@ -27,12 +30,12 @@ class S3 extends Base_1.default {
|
|
|
27
30
|
* @param waveBucketUrl Public base url to S3 bucket
|
|
28
31
|
* @returns registry.json
|
|
29
32
|
*/
|
|
30
|
-
getCatalogRegistry(waveBucketUrl) {
|
|
33
|
+
getCatalogRegistry(waveBucketUrl, raw) {
|
|
31
34
|
return __awaiter(this, void 0, void 0, function* () {
|
|
32
35
|
const resp = yield axios_1.default.get(`${waveBucketUrl}/catalogs/registry.json`, {
|
|
33
|
-
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
|
|
36
|
+
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }),
|
|
34
37
|
});
|
|
35
|
-
return resp.data;
|
|
38
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
36
39
|
});
|
|
37
40
|
}
|
|
38
41
|
/**
|
|
@@ -40,12 +43,12 @@ class S3 extends Base_1.default {
|
|
|
40
43
|
* @param waveBucketUrl Public base url to S3 bucket
|
|
41
44
|
* @returns registry.json
|
|
42
45
|
*/
|
|
43
|
-
getEngineRegistry(waveBucketUrl) {
|
|
46
|
+
getEngineRegistry(waveBucketUrl, raw) {
|
|
44
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
48
|
const resp = yield axios_1.default.get(`${waveBucketUrl}/engines/registry.json`, {
|
|
46
|
-
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
|
|
49
|
+
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }),
|
|
47
50
|
});
|
|
48
|
-
return resp.data;
|
|
51
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
49
52
|
});
|
|
50
53
|
}
|
|
51
54
|
/**
|
|
@@ -53,10 +56,12 @@ class S3 extends Base_1.default {
|
|
|
53
56
|
* @param catalogUrl Public url of the catalog
|
|
54
57
|
* @returns index.json of catalog
|
|
55
58
|
*/
|
|
56
|
-
getCatalog(catalogUrl) {
|
|
59
|
+
getCatalog(catalogUrl, raw) {
|
|
57
60
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
const resp = yield axios_1.default.get(`${catalogUrl}`, {
|
|
59
|
-
|
|
61
|
+
const resp = yield axios_1.default.get(`${catalogUrl}`, {
|
|
62
|
+
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }),
|
|
63
|
+
});
|
|
64
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
60
65
|
});
|
|
61
66
|
}
|
|
62
67
|
/**
|
|
@@ -64,10 +69,12 @@ class S3 extends Base_1.default {
|
|
|
64
69
|
* @param catalogUrl Public url of the catalog
|
|
65
70
|
* @returns index.json of catalog
|
|
66
71
|
*/
|
|
67
|
-
getEngine(engineUrl) {
|
|
72
|
+
getEngine(engineUrl, raw) {
|
|
68
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
69
|
-
const resp = yield axios_1.default.get(`${engineUrl}`, {
|
|
70
|
-
|
|
74
|
+
const resp = yield axios_1.default.get(`${engineUrl}`, {
|
|
75
|
+
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }),
|
|
76
|
+
});
|
|
77
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
71
78
|
});
|
|
72
79
|
}
|
|
73
80
|
/**
|
|
@@ -76,12 +83,12 @@ class S3 extends Base_1.default {
|
|
|
76
83
|
* @param engineVersion Version of the enigne
|
|
77
84
|
* @returns Wildcards.json list of available wildcards
|
|
78
85
|
*/
|
|
79
|
-
getWildcardsOfEngine(engineUrl, engineVersion) {
|
|
86
|
+
getWildcardsOfEngine(engineUrl, engineVersion, raw) {
|
|
80
87
|
return __awaiter(this, void 0, void 0, function* () {
|
|
81
88
|
const resp = yield axios_1.default.get(`${engineUrl.replace("/index.json", "")}/${engineVersion}/wildcards.json`, {
|
|
82
|
-
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
|
|
89
|
+
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }),
|
|
83
90
|
});
|
|
84
|
-
return resp.data;
|
|
91
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
85
92
|
});
|
|
86
93
|
}
|
|
87
94
|
/**
|
|
@@ -90,13 +97,13 @@ class S3 extends Base_1.default {
|
|
|
90
97
|
* @param version The catalog version
|
|
91
98
|
* @returns StreamNodeSpecification[] | StreamNodeSpecificationWrappedWithEngineVersion an array of all node specification of that catalog version, maybe wrapped in an object with the engine version
|
|
92
99
|
*/
|
|
93
|
-
getCatalogVersion(catalogUrl, version) {
|
|
100
|
+
getCatalogVersion(catalogUrl, version, raw) {
|
|
94
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
95
102
|
const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + "/" + version + "/specification.json";
|
|
96
103
|
const resp = yield axios_1.default.get(specificationUrl, {
|
|
97
|
-
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion }),
|
|
104
|
+
headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }),
|
|
98
105
|
});
|
|
99
|
-
return resp.data;
|
|
106
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
100
107
|
});
|
|
101
108
|
}
|
|
102
109
|
/**
|
|
@@ -105,13 +112,30 @@ class S3 extends Base_1.default {
|
|
|
105
112
|
* @param version The catalog version
|
|
106
113
|
* @returns string the markdown documentation of the node
|
|
107
114
|
*/
|
|
108
|
-
getNodeDocumentation(catalogUrl, version, nodeName) {
|
|
115
|
+
getNodeDocumentation(catalogUrl, version, nodeName, raw) {
|
|
109
116
|
return __awaiter(this, void 0, void 0, function* () {
|
|
110
117
|
const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + `/${version}/docs/${nodeName}.md`;
|
|
111
|
-
const resp = yield axios_1.default
|
|
118
|
+
const resp = yield axios_1.default
|
|
119
|
+
.get(specificationUrl, { headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }) })
|
|
120
|
+
.catch(err => {
|
|
121
|
+
throw new Error(`Node documentation not found: ${err}`);
|
|
122
|
+
});
|
|
123
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
124
|
+
});
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get the catalogs changelog from the S3 bucket
|
|
128
|
+
* @param catalogUrl Public url of the catalog
|
|
129
|
+
* @returns string the changelog.json of the node
|
|
130
|
+
*/
|
|
131
|
+
getChangelog(catalogUrl, raw) {
|
|
132
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
133
|
+
const resp = yield axios_1.default
|
|
134
|
+
.get(catalogUrl + "changelog.json", { headers: Object.assign(Object.assign({}, axios_2.disableCacheHeaders), { "x-hcloud-user-agent": sdkVersion, Authorization: undefined }) })
|
|
135
|
+
.catch(err => {
|
|
112
136
|
throw new Error(`Node documentation not found: ${err}`);
|
|
113
137
|
});
|
|
114
|
-
return resp.data;
|
|
138
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
115
139
|
});
|
|
116
140
|
}
|
|
117
141
|
getEndpoint() {
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { SuccessfulAuth } from "../../../interfaces/idp";
|
|
3
|
+
export declare class IdpGuest extends Base {
|
|
4
|
+
/**
|
|
5
|
+
* Creates a new guest user account.
|
|
6
|
+
*
|
|
7
|
+
* @param email - The email address of the guest to create.
|
|
8
|
+
* @param name - The display name of the guest user.
|
|
9
|
+
* @param emailHMAC - An HMAC signature of the email, used for validation.
|
|
10
|
+
* @returns A promise resolving to a `SuccessfulAuth` object containing:
|
|
11
|
+
* - `user`: The created `User` object.
|
|
12
|
+
* - `token`: An authorization token returned by the API.
|
|
13
|
+
*/
|
|
14
|
+
createGuest<R extends boolean = false>(email: string, name: string, emailHMAC: string, raw?: {
|
|
15
|
+
raw: R;
|
|
16
|
+
}): Promise<MaybeRaw<R, SuccessfulAuth>>;
|
|
17
|
+
/**
|
|
18
|
+
* Logs in as an existing guest user.
|
|
19
|
+
*
|
|
20
|
+
* @param email - The email address of the guest to log in.
|
|
21
|
+
* @param emailHMAC - An HMAC signature of the email, used for validation.
|
|
22
|
+
* @returns A promise resolving to a `SuccessfulAuth` object containing:
|
|
23
|
+
* - `user`: The authenticated `User` object.
|
|
24
|
+
* - `token`: An authorization token returned by the API.
|
|
25
|
+
*/
|
|
26
|
+
loginAsGuest<R extends boolean = false>(email: string, emailHMAC: string, raw?: {
|
|
27
|
+
raw: R;
|
|
28
|
+
}): Promise<MaybeRaw<R, SuccessfulAuth>>;
|
|
29
|
+
/**
|
|
30
|
+
* Checks whether an email corresponds to a guest account.
|
|
31
|
+
*
|
|
32
|
+
* @param email - The email address to check.
|
|
33
|
+
* @returns A promise resolving to one of:
|
|
34
|
+
* - `"no user"` → No user exists with the given email.
|
|
35
|
+
* - `"not guest"` → A user exists but is not a guest.
|
|
36
|
+
* - `"guest"` → The email belongs to a guest account.
|
|
37
|
+
*/
|
|
38
|
+
isGuest<R extends boolean = false>(email: string, raw?: {
|
|
39
|
+
raw: R;
|
|
40
|
+
}): Promise<MaybeRaw<R, "no user" | "not guest" | "guest">>;
|
|
41
|
+
protected getEndpoint(endpoint: string): string;
|
|
42
|
+
}
|
|
@@ -0,0 +1,69 @@
|
|
|
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
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.IdpGuest = void 0;
|
|
16
|
+
const Base_1 = __importDefault(require("../../../Base"));
|
|
17
|
+
class IdpGuest extends Base_1.default {
|
|
18
|
+
/**
|
|
19
|
+
* Creates a new guest user account.
|
|
20
|
+
*
|
|
21
|
+
* @param email - The email address of the guest to create.
|
|
22
|
+
* @param name - The display name of the guest user.
|
|
23
|
+
* @param emailHMAC - An HMAC signature of the email, used for validation.
|
|
24
|
+
* @returns A promise resolving to a `SuccessfulAuth` object containing:
|
|
25
|
+
* - `user`: The created `User` object.
|
|
26
|
+
* - `token`: An authorization token returned by the API.
|
|
27
|
+
*/
|
|
28
|
+
createGuest(email, name, emailHMAC, raw) {
|
|
29
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
30
|
+
const resp = yield this.axios.post(this.getEndpoint("/v1/guest"), { email, name, hmac: emailHMAC });
|
|
31
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw)
|
|
32
|
+
? Object.assign(Object.assign({}, resp), { data: { user: resp.data, token: resp.headers.authorization } }) : { user: resp.data, token: resp.headers.authorization });
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Logs in as an existing guest user.
|
|
37
|
+
*
|
|
38
|
+
* @param email - The email address of the guest to log in.
|
|
39
|
+
* @param emailHMAC - An HMAC signature of the email, used for validation.
|
|
40
|
+
* @returns A promise resolving to a `SuccessfulAuth` object containing:
|
|
41
|
+
* - `user`: The authenticated `User` object.
|
|
42
|
+
* - `token`: An authorization token returned by the API.
|
|
43
|
+
*/
|
|
44
|
+
loginAsGuest(email, emailHMAC, raw) {
|
|
45
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const res = yield this.axios.put(this.getEndpoint("/v1/guest"), { email, hmac: emailHMAC });
|
|
47
|
+
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 });
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Checks whether an email corresponds to a guest account.
|
|
52
|
+
*
|
|
53
|
+
* @param email - The email address to check.
|
|
54
|
+
* @returns A promise resolving to one of:
|
|
55
|
+
* - `"no user"` → No user exists with the given email.
|
|
56
|
+
* - `"not guest"` → A user exists but is not a guest.
|
|
57
|
+
* - `"guest"` → The email belongs to a guest account.
|
|
58
|
+
*/
|
|
59
|
+
isGuest(email, raw) {
|
|
60
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
61
|
+
const res = yield this.axios.get(this.getEndpoint(`/v1/guest/email/${email}`));
|
|
62
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? res : res.data);
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
getEndpoint(endpoint) {
|
|
66
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
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
|
@@ -8,8 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
-
const Base_1 = require("../../Base");
|
|
15
|
+
const Base_1 = __importDefault(require("../../Base"));
|
|
16
|
+
const guest_1 = require("./guest");
|
|
13
17
|
const internal_1 = require("./internal");
|
|
14
18
|
const oauth_1 = require("./oauth");
|
|
15
19
|
const organization_1 = require("./organization");
|
|
@@ -52,6 +56,15 @@ class Idp extends Base_1.default {
|
|
|
52
56
|
}
|
|
53
57
|
return this._user;
|
|
54
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* Handles everything around a guest
|
|
61
|
+
*/
|
|
62
|
+
get guest() {
|
|
63
|
+
if (this._guest === undefined) {
|
|
64
|
+
this._guest = new guest_1.IdpGuest(this.options, this.axios);
|
|
65
|
+
}
|
|
66
|
+
return this._guest;
|
|
67
|
+
}
|
|
55
68
|
/**
|
|
56
69
|
* Handles everything around idp's internal endpoints
|
|
57
70
|
*/
|
|
@@ -65,10 +78,10 @@ class Idp extends Base_1.default {
|
|
|
65
78
|
* Requests the endpoint version
|
|
66
79
|
* @returns Version object
|
|
67
80
|
*/
|
|
68
|
-
version() {
|
|
81
|
+
version(raw) {
|
|
69
82
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
83
|
const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
|
|
71
|
-
return resp.data;
|
|
84
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
72
85
|
});
|
|
73
86
|
}
|
|
74
87
|
/**
|
|
@@ -78,7 +91,7 @@ class Idp extends Base_1.default {
|
|
|
78
91
|
* @param token (optional) token if 2FA-TOTP is enabled
|
|
79
92
|
* @returns SuccessfulAuth object holding the token and the user
|
|
80
93
|
*/
|
|
81
|
-
login(email, password, token) {
|
|
94
|
+
login(email, password, token, raw) {
|
|
82
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
83
96
|
var _a;
|
|
84
97
|
let body = { email: email, password: password };
|
|
@@ -90,7 +103,7 @@ class Idp extends Base_1.default {
|
|
|
90
103
|
token: ((_a = resp.headers["authorization"]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
|
|
91
104
|
user: resp.data,
|
|
92
105
|
};
|
|
93
|
-
return authed;
|
|
106
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? Object.assign(Object.assign({}, resp), { data: authed }) : authed);
|
|
94
107
|
});
|
|
95
108
|
}
|
|
96
109
|
/**
|
|
@@ -101,7 +114,7 @@ class Idp extends Base_1.default {
|
|
|
101
114
|
* @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
|
|
102
115
|
* @returns URL that must be accessed via a browser to continue the login process.
|
|
103
116
|
*/
|
|
104
|
-
loginWithOIDC(origin, oidcProvider, hint) {
|
|
117
|
+
loginWithOIDC(origin, oidcProvider, hint, raw) {
|
|
105
118
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
119
|
const resp = yield this.axios.get(this.getEndpoint("/v1/login/oidc"), {
|
|
107
120
|
params: {
|
|
@@ -118,7 +131,7 @@ class Idp extends Base_1.default {
|
|
|
118
131
|
if (!location) {
|
|
119
132
|
throw new Error("Location header is undefined.");
|
|
120
133
|
}
|
|
121
|
-
return location;
|
|
134
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : location);
|
|
122
135
|
});
|
|
123
136
|
}
|
|
124
137
|
/**
|
|
@@ -127,7 +140,7 @@ class Idp extends Base_1.default {
|
|
|
127
140
|
* @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
141
|
* @returns URL that must be accessed via a browser to continue the login process.
|
|
129
142
|
*/
|
|
130
|
-
loginWithSAML(origin, email) {
|
|
143
|
+
loginWithSAML(origin, email, raw) {
|
|
131
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
132
145
|
const resp = yield this.axios.get(this.getEndpoint("/v1/login/saml"), {
|
|
133
146
|
params: {
|
|
@@ -143,7 +156,7 @@ class Idp extends Base_1.default {
|
|
|
143
156
|
if (!location) {
|
|
144
157
|
throw new Error("Location header is undefined.");
|
|
145
158
|
}
|
|
146
|
-
return location;
|
|
159
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : location);
|
|
147
160
|
});
|
|
148
161
|
}
|
|
149
162
|
/**
|
|
@@ -155,7 +168,7 @@ class Idp extends Base_1.default {
|
|
|
155
168
|
* @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
|
|
156
169
|
* or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
|
|
157
170
|
*/
|
|
158
|
-
preLogin(email, origin) {
|
|
171
|
+
preLogin(email, origin, raw) {
|
|
159
172
|
return __awaiter(this, void 0, void 0, function* () {
|
|
160
173
|
const resp = yield this.axios.get(this.getEndpoint("/v1/login/pre"), {
|
|
161
174
|
params: {
|
|
@@ -163,7 +176,7 @@ class Idp extends Base_1.default {
|
|
|
163
176
|
email,
|
|
164
177
|
},
|
|
165
178
|
});
|
|
166
|
-
return resp.data;
|
|
179
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : resp.data);
|
|
167
180
|
});
|
|
168
181
|
}
|
|
169
182
|
/**
|
|
@@ -173,9 +186,10 @@ class Idp extends Base_1.default {
|
|
|
173
186
|
* @param captcha Valid google reCAPTCHAV2
|
|
174
187
|
* @param targetUrl Optional url the link in the mail will point to
|
|
175
188
|
*/
|
|
176
|
-
resetPassword(email, captcha, targetUrl) {
|
|
189
|
+
resetPassword(email, captcha, targetUrl, raw) {
|
|
177
190
|
return __awaiter(this, void 0, void 0, function* () {
|
|
178
|
-
yield this.axios.post(this.getEndpoint("/v1/login/forgot_password"), { email, captcha, targetUrl });
|
|
191
|
+
const resp = yield this.axios.post(this.getEndpoint("/v1/login/forgot_password"), { email, captcha, targetUrl });
|
|
192
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw) ? resp : undefined);
|
|
179
193
|
});
|
|
180
194
|
}
|
|
181
195
|
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
|
}
|
|
@@ -8,9 +8,12 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
12
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
13
|
+
};
|
|
11
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
15
|
exports.IdpInternal = void 0;
|
|
13
|
-
const Base_1 = require("../../../Base");
|
|
16
|
+
const Base_1 = __importDefault(require("../../../Base"));
|
|
14
17
|
class IdpInternal extends Base_1.default {
|
|
15
18
|
/**
|
|
16
19
|
* Creates an agent user for an organization.
|
|
@@ -20,10 +23,12 @@ class IdpInternal extends Base_1.default {
|
|
|
20
23
|
* @param orgName Name of the organization
|
|
21
24
|
* @returns the created user and a pat token
|
|
22
25
|
*/
|
|
23
|
-
createAgentUser(orgName) {
|
|
26
|
+
createAgentUser(orgName, raw) {
|
|
24
27
|
return __awaiter(this, void 0, void 0, function* () {
|
|
25
|
-
|
|
26
|
-
|
|
28
|
+
var _a, _b;
|
|
29
|
+
const resp = yield this.axios.post(this.getEndpoint(`/internal/v1/org/${orgName}/agent`));
|
|
30
|
+
return ((raw === null || raw === void 0 ? void 0 : raw.raw)
|
|
31
|
+
? 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
32
|
});
|
|
28
33
|
}
|
|
29
34
|
getEndpoint(endpoint) {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import Base, { MaybeRaw } from "../../../Base";
|
|
2
|
+
import { OAuthAppPublicInfo, Scope } from "../../../interfaces/idp";
|
|
3
|
+
import { OAuthDeviceAuthorizationResponse, OAuthDeviceTokenResponse } from "../../../interfaces/idp/oauth/device";
|
|
4
|
+
/**
|
|
5
|
+
* IdpOAuthDevice
|
|
6
|
+
*
|
|
7
|
+
* Client wrapper for OAuth 2.0 Device Authorization Grant (RFC 8628).
|
|
8
|
+
*
|
|
9
|
+
* This class provides methods to:
|
|
10
|
+
* - Initiate a device authorization request
|
|
11
|
+
* - Validate a user-provided code
|
|
12
|
+
* - Approve or reject a device authorization
|
|
13
|
+
* - Exchange a device code for an access token
|
|
14
|
+
*
|
|
15
|
+
* All methods support returning either the parsed response body or the raw Axios
|
|
16
|
+
* response via the `{ raw: true }` option.
|
|
17
|
+
*
|
|
18
|
+
* @extends Base
|
|
19
|
+
*/
|
|
20
|
+
export default class IdpOAuthDevice extends Base {
|
|
21
|
+
/**
|
|
22
|
+
* Initiates the OAuth Device Authorization flow.
|
|
23
|
+
*
|
|
24
|
+
* This endpoint returns a `device_code` and `user_code` which should be:
|
|
25
|
+
* - Displayed to the user on the device
|
|
26
|
+
* - Entered by the user on a separate verification page
|
|
27
|
+
*
|
|
28
|
+
* @typeParam R - Whether to return the raw Axios response
|
|
29
|
+
*
|
|
30
|
+
* @param clientId - OAuth client identifier
|
|
31
|
+
* @param scope - Optional OAuth scope string (space-delimited)
|
|
32
|
+
* @param raw - Optional flag to return the raw Axios response
|
|
33
|
+
*
|
|
34
|
+
* @returns Device authorization response or raw Axios response
|
|
35
|
+
*/
|
|
36
|
+
authorize<R extends boolean = false>(clientId: string, scope?: string, raw?: {
|
|
37
|
+
raw: R;
|
|
38
|
+
}): Promise<MaybeRaw<R, OAuthDeviceAuthorizationResponse>>;
|
|
39
|
+
/**
|
|
40
|
+
* Validates a user-entered device code.
|
|
41
|
+
*
|
|
42
|
+
* This is typically called by the authorization UI after the user enters
|
|
43
|
+
* the `user_code`. It returns public information about the requesting
|
|
44
|
+
* application and the requested scopes.
|
|
45
|
+
*
|
|
46
|
+
* @typeParam R - Whether to return the raw Axios response
|
|
47
|
+
*
|
|
48
|
+
* @param clientId - OAuth client identifier
|
|
49
|
+
* @param userCode - User-facing verification code
|
|
50
|
+
* @param raw - Optional flag to return the raw Axios response
|
|
51
|
+
*
|
|
52
|
+
* @returns Application public info and requested scopes
|
|
53
|
+
*/
|
|
54
|
+
validateUserCode<R extends boolean = false>(clientId: string, userCode: string, raw?: {
|
|
55
|
+
raw: R;
|
|
56
|
+
}): Promise<MaybeRaw<R, {
|
|
57
|
+
app: OAuthAppPublicInfo;
|
|
58
|
+
scopes: Scope[];
|
|
59
|
+
}>>;
|
|
60
|
+
/**
|
|
61
|
+
* Approves or rejects a device authorization request.
|
|
62
|
+
*
|
|
63
|
+
* ⚠️ This endpoint requires an `Authorization` header to be set
|
|
64
|
+
* on the HCloud instance (e.g., a logged-in user session or access token).
|
|
65
|
+
*
|
|
66
|
+
* @typeParam R - Whether to return the raw Axios response
|
|
67
|
+
*
|
|
68
|
+
* @param clientId - OAuth client identifier
|
|
69
|
+
* @param userCode - User-facing verification code
|
|
70
|
+
* @param status - Authorization decision (`APPROVED` or `REJECTED`)
|
|
71
|
+
* @param raw - Optional flag to return the raw Axios response
|
|
72
|
+
*
|
|
73
|
+
* @throws Error if the Authorization header is not set
|
|
74
|
+
*
|
|
75
|
+
* @returns Void response or raw Axios response
|
|
76
|
+
*/
|
|
77
|
+
decide<R extends boolean = false>(clientId: string, userCode: string, status: "APPROVED" | "REJECTED", raw?: {
|
|
78
|
+
raw: R;
|
|
79
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
80
|
+
/**
|
|
81
|
+
* Approves a device authorization request.
|
|
82
|
+
*
|
|
83
|
+
* Shorthand for {@link decide} with status `"APPROVED"`.
|
|
84
|
+
*
|
|
85
|
+
* @typeParam R - Whether to return the raw Axios response
|
|
86
|
+
*
|
|
87
|
+
* @param clientId - OAuth client identifier
|
|
88
|
+
* @param userCode - User-facing verification code
|
|
89
|
+
* @param raw - Optional flag to return the raw Axios response
|
|
90
|
+
*
|
|
91
|
+
* @returns Void response or raw Axios response
|
|
92
|
+
*/
|
|
93
|
+
approve<R extends boolean = false>(clientId: string, userCode: string, raw?: {
|
|
94
|
+
raw: R;
|
|
95
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
96
|
+
/**
|
|
97
|
+
* Rejects a device authorization request.
|
|
98
|
+
*
|
|
99
|
+
* Shorthand for {@link decide} with status `"REJECTED"`.
|
|
100
|
+
*
|
|
101
|
+
* @typeParam R - Whether to return the raw Axios response
|
|
102
|
+
*
|
|
103
|
+
* @param clientId - OAuth client identifier
|
|
104
|
+
* @param userCode - User-facing verification code
|
|
105
|
+
* @param raw - Optional flag to return the raw Axios response
|
|
106
|
+
*
|
|
107
|
+
* @returns Void response or raw Axios response
|
|
108
|
+
*/
|
|
109
|
+
reject<R extends boolean = false>(clientId: string, userCode: string, raw?: {
|
|
110
|
+
raw: R;
|
|
111
|
+
}): Promise<MaybeRaw<R, void>>;
|
|
112
|
+
/**
|
|
113
|
+
* Exchanges a device code for an access token.
|
|
114
|
+
*
|
|
115
|
+
* This endpoint may return HTTP 400 responses for non-fatal OAuth states
|
|
116
|
+
* such as `authorization_pending` or `slow_down`. These responses are
|
|
117
|
+
* returned normally and should be handled by the caller.
|
|
118
|
+
*
|
|
119
|
+
* @typeParam R - Whether to return the raw Axios response
|
|
120
|
+
*
|
|
121
|
+
* @param clientId - OAuth client identifier
|
|
122
|
+
* @param deviceCode - Device code obtained from {@link authorize}
|
|
123
|
+
* @param raw - Optional flag to return the raw Axios response
|
|
124
|
+
*
|
|
125
|
+
* @returns Device token response or raw Axios response
|
|
126
|
+
*/
|
|
127
|
+
token<R extends boolean = false>(clientId: string, deviceCode: string, raw?: {
|
|
128
|
+
raw: R;
|
|
129
|
+
}): Promise<MaybeRaw<R, OAuthDeviceTokenResponse>>;
|
|
130
|
+
protected getEndpoint(endpoint: string): string;
|
|
131
|
+
}
|