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,83 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../Base";
|
|
3
|
+
import { PaginatedResponse, SearchParams } from "../../../../interfaces/global";
|
|
4
|
+
import { KeyValuePair, Webhook, WebhookCreate, WebhookUpdate } from "../../../../interfaces/high5/space/webhook";
|
|
5
|
+
import { High5WebhookLog } from "./log";
|
|
6
|
+
export declare class High5Webhook extends Base {
|
|
7
|
+
log: High5WebhookLog;
|
|
8
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves all Webhooks of the specified space that match the provided search filter(s). Will return all Webhooks if no search filter is provided.
|
|
11
|
+
* @param orgName Name of the organization
|
|
12
|
+
* @param spaceName Name of the space
|
|
13
|
+
* @param filters (optional) Array of search filters
|
|
14
|
+
* @param sorting (optional) Sorting object
|
|
15
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
16
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
17
|
+
* @returns Object containing an array of Webhooks and the total number of results found in the database (independent of limit and page)
|
|
18
|
+
*/
|
|
19
|
+
searchWebhooks: ({ orgName, spaceName, filters, sorting, limit, page, }: SearchParams & {
|
|
20
|
+
orgName: string;
|
|
21
|
+
spaceName: string;
|
|
22
|
+
}) => Promise<PaginatedResponse<Webhook>>;
|
|
23
|
+
/**
|
|
24
|
+
* Requests a Webhhok by its ID.
|
|
25
|
+
* @param orgName Name of the Organization
|
|
26
|
+
* @param spaceName Name of the Space
|
|
27
|
+
* @param webhookId ID of the Webhook
|
|
28
|
+
* @returns The requested Webhook
|
|
29
|
+
*/
|
|
30
|
+
getWebhook: (orgName: string, spaceName: string, webhookId: string) => Promise<Webhook>;
|
|
31
|
+
/**
|
|
32
|
+
* Generates a new URL for the specified Webhook. This is suggested if a leak of the current URL is likely.
|
|
33
|
+
* @param orgName Name of the Organization
|
|
34
|
+
* @param spaceName Name of the Space
|
|
35
|
+
* @param webhookId ID of the Webhook
|
|
36
|
+
* @returns The updated Webhook
|
|
37
|
+
*/
|
|
38
|
+
regenerateWebhookUrl: (orgName: string, spaceName: string, webhookId: string) => Promise<Webhook>;
|
|
39
|
+
/**
|
|
40
|
+
* Creates a new Webhook in the specified High5 space.
|
|
41
|
+
* @param orgName Name of the Organization
|
|
42
|
+
* @param spaceName Name of the Space
|
|
43
|
+
* @param WebhookCreate Object/JSON containing the name, token, eventId, spaceId, target and (optionally) security headers for the new webhook
|
|
44
|
+
* @returns The created Webhook
|
|
45
|
+
*/
|
|
46
|
+
createWebhook: (orgName: string, spaceName: string, WebhookCreate: WebhookCreate) => Promise<Webhook>;
|
|
47
|
+
/**
|
|
48
|
+
* Updates an existing Webhook.
|
|
49
|
+
* @param orgName Name of the Organization
|
|
50
|
+
* @param spaceName Name of the Space
|
|
51
|
+
* @param webhookId ID of the Webhook to be updated
|
|
52
|
+
* @param WebhookCreate Object/JSON containing the name, token, eventId, spaceId, target and (optionally) security headers for the updated webhook
|
|
53
|
+
* @returns the updated Webhook
|
|
54
|
+
*/
|
|
55
|
+
updateWebhook: (orgName: string, spaceName: string, webhookId: string, webhookUpdate: WebhookUpdate) => Promise<Webhook>;
|
|
56
|
+
/**
|
|
57
|
+
* Deletes a Webhook by its ID.
|
|
58
|
+
* @param orgName Name of the Organization
|
|
59
|
+
* @param spaceName Name of the Space
|
|
60
|
+
* @param webhookId ID of the webhook to be deleted
|
|
61
|
+
*/
|
|
62
|
+
deleteWebhook: (orgName: string, spaceName: string, webhookId: string) => Promise<void>;
|
|
63
|
+
/**
|
|
64
|
+
* Executes all Events and Streams connected to the specified Webhook.
|
|
65
|
+
* @param webhookUrl URL of the webhook to be triggered / executed
|
|
66
|
+
*/
|
|
67
|
+
triggerWebhook: (webhookUrl: string) => Promise<void>;
|
|
68
|
+
/**
|
|
69
|
+
* Executes a webhook by its URL.
|
|
70
|
+
* @param webhookUrl Webhook URL to be triggered / executed (your hcloud domain + webhook.relativeUrl)
|
|
71
|
+
* @param payload Payload to be used in the event execution that will be triggered by the webhook, as JSON.
|
|
72
|
+
* @param headers (optional) Security headers.
|
|
73
|
+
*/
|
|
74
|
+
executeWebhookByUrl: (webhookUrl: string, payload: unknown, headers?: KeyValuePair<string>) => Promise<void>;
|
|
75
|
+
/**
|
|
76
|
+
* Validates the provided webhook URL by sending a challenge query parameter.
|
|
77
|
+
* @param url Webhook URL to be validated (your hcloud domain + webhook.relativeUrl)
|
|
78
|
+
* @param challenge String to be returned
|
|
79
|
+
* @returns The provided challenge string as plaint text
|
|
80
|
+
*/
|
|
81
|
+
validateWebhookUrl: (webhookUrl: string, challenge: string) => Promise<string>;
|
|
82
|
+
protected getEndpoint(endpoint: string): string;
|
|
83
|
+
}
|
|
@@ -0,0 +1,132 @@
|
|
|
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.High5Webhook = void 0;
|
|
13
|
+
const Base_1 = require("../../../../Base");
|
|
14
|
+
const paginatedResponseHelper_1 = require("../../../../helper/paginatedResponseHelper");
|
|
15
|
+
const searchFilter_1 = require("../../../../helper/searchFilter");
|
|
16
|
+
const log_1 = require("./log");
|
|
17
|
+
class High5Webhook extends Base_1.default {
|
|
18
|
+
constructor(options, axios) {
|
|
19
|
+
super(options, axios);
|
|
20
|
+
/**
|
|
21
|
+
* Retrieves all Webhooks of the specified space that match the provided search filter(s). Will return all Webhooks if no search filter is provided.
|
|
22
|
+
* @param orgName Name of the organization
|
|
23
|
+
* @param spaceName Name of the space
|
|
24
|
+
* @param filters (optional) Array of search filters
|
|
25
|
+
* @param sorting (optional) Sorting object
|
|
26
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
27
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
28
|
+
* @returns Object containing an array of Webhooks and the total number of results found in the database (independent of limit and page)
|
|
29
|
+
*/
|
|
30
|
+
this.searchWebhooks = (_a) => __awaiter(this, [_a], void 0, function* ({ orgName, spaceName, filters, sorting, limit = 25, page = 0, }) {
|
|
31
|
+
const filtersDTO = filters === null || filters === void 0 ? void 0 : filters.map((f) => new searchFilter_1.SearchFilterDTO(f));
|
|
32
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks/search?limit=${limit}&page=${page}`), {
|
|
33
|
+
filters: filtersDTO,
|
|
34
|
+
sorting: sorting,
|
|
35
|
+
});
|
|
36
|
+
return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
|
|
37
|
+
});
|
|
38
|
+
/**
|
|
39
|
+
* Requests a Webhhok by its ID.
|
|
40
|
+
* @param orgName Name of the Organization
|
|
41
|
+
* @param spaceName Name of the Space
|
|
42
|
+
* @param webhookId ID of the Webhook
|
|
43
|
+
* @returns The requested Webhook
|
|
44
|
+
*/
|
|
45
|
+
this.getWebhook = (orgName, spaceName, webhookId) => __awaiter(this, void 0, void 0, function* () {
|
|
46
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks/${webhookId}`));
|
|
47
|
+
return resp.data;
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Generates a new URL for the specified Webhook. This is suggested if a leak of the current URL is likely.
|
|
51
|
+
* @param orgName Name of the Organization
|
|
52
|
+
* @param spaceName Name of the Space
|
|
53
|
+
* @param webhookId ID of the Webhook
|
|
54
|
+
* @returns The updated Webhook
|
|
55
|
+
*/
|
|
56
|
+
this.regenerateWebhookUrl = (orgName, spaceName, webhookId) => __awaiter(this, void 0, void 0, function* () {
|
|
57
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks/${webhookId}/regenerateUrl`));
|
|
58
|
+
return resp.data;
|
|
59
|
+
});
|
|
60
|
+
/**
|
|
61
|
+
* Creates a new Webhook in the specified High5 space.
|
|
62
|
+
* @param orgName Name of the Organization
|
|
63
|
+
* @param spaceName Name of the Space
|
|
64
|
+
* @param WebhookCreate Object/JSON containing the name, token, eventId, spaceId, target and (optionally) security headers for the new webhook
|
|
65
|
+
* @returns The created Webhook
|
|
66
|
+
*/
|
|
67
|
+
this.createWebhook = (orgName, spaceName, WebhookCreate) => __awaiter(this, void 0, void 0, function* () {
|
|
68
|
+
const resp = yield this.axios.post(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks`), WebhookCreate);
|
|
69
|
+
return resp.data;
|
|
70
|
+
});
|
|
71
|
+
/**
|
|
72
|
+
* Updates an existing Webhook.
|
|
73
|
+
* @param orgName Name of the Organization
|
|
74
|
+
* @param spaceName Name of the Space
|
|
75
|
+
* @param webhookId ID of the Webhook to be updated
|
|
76
|
+
* @param WebhookCreate Object/JSON containing the name, token, eventId, spaceId, target and (optionally) security headers for the updated webhook
|
|
77
|
+
* @returns the updated Webhook
|
|
78
|
+
*/
|
|
79
|
+
this.updateWebhook = (orgName, spaceName, webhookId, webhookUpdate) => __awaiter(this, void 0, void 0, function* () {
|
|
80
|
+
const resp = yield this.axios.patch(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks/${webhookId}`), webhookUpdate);
|
|
81
|
+
return resp.data;
|
|
82
|
+
});
|
|
83
|
+
/**
|
|
84
|
+
* Deletes a Webhook by its ID.
|
|
85
|
+
* @param orgName Name of the Organization
|
|
86
|
+
* @param spaceName Name of the Space
|
|
87
|
+
* @param webhookId ID of the webhook to be deleted
|
|
88
|
+
*/
|
|
89
|
+
this.deleteWebhook = (orgName, spaceName, webhookId) => __awaiter(this, void 0, void 0, function* () {
|
|
90
|
+
yield this.axios.delete(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks/${webhookId}`));
|
|
91
|
+
});
|
|
92
|
+
/**
|
|
93
|
+
* Executes all Events and Streams connected to the specified Webhook.
|
|
94
|
+
* @param webhookUrl URL of the webhook to be triggered / executed
|
|
95
|
+
*/
|
|
96
|
+
this.triggerWebhook = (webhookUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
97
|
+
yield this.axios.post(this.getEndpoint(webhookUrl));
|
|
98
|
+
});
|
|
99
|
+
/**
|
|
100
|
+
* Executes a webhook by its URL.
|
|
101
|
+
* @param webhookUrl Webhook URL to be triggered / executed (your hcloud domain + webhook.relativeUrl)
|
|
102
|
+
* @param payload Payload to be used in the event execution that will be triggered by the webhook, as JSON.
|
|
103
|
+
* @param headers (optional) Security headers.
|
|
104
|
+
*/
|
|
105
|
+
this.executeWebhookByUrl = (webhookUrl, payload, headers) => __awaiter(this, void 0, void 0, function* () {
|
|
106
|
+
const h = {};
|
|
107
|
+
if (headers) {
|
|
108
|
+
Object.keys(headers).forEach((key) => {
|
|
109
|
+
h[key] = headers[key];
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
yield this.axios.post(this.getEndpoint(webhookUrl), payload, {
|
|
113
|
+
headers: h,
|
|
114
|
+
});
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* Validates the provided webhook URL by sending a challenge query parameter.
|
|
118
|
+
* @param url Webhook URL to be validated (your hcloud domain + webhook.relativeUrl)
|
|
119
|
+
* @param challenge String to be returned
|
|
120
|
+
* @returns The provided challenge string as plaint text
|
|
121
|
+
*/
|
|
122
|
+
this.validateWebhookUrl = (webhookUrl, challenge) => __awaiter(this, void 0, void 0, function* () {
|
|
123
|
+
const resp = yield this.axios.get(this.getEndpoint(`${webhookUrl}?challenge=${challenge}`));
|
|
124
|
+
return resp.data;
|
|
125
|
+
});
|
|
126
|
+
this.log = new log_1.High5WebhookLog(this.options, this.axios);
|
|
127
|
+
}
|
|
128
|
+
getEndpoint(endpoint) {
|
|
129
|
+
return `${this.options.server}/api/high5${endpoint}`;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.High5Webhook = High5Webhook;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../../Base";
|
|
3
|
+
import { PaginatedResponse } from "../../../../../interfaces/global";
|
|
4
|
+
import { WebhookLog } from "../../../../../interfaces/high5/space/webhook";
|
|
5
|
+
export declare class High5WebhookLog extends Base {
|
|
6
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
7
|
+
/**
|
|
8
|
+
* Retrieves all Webhook logs for the specified Webhook.
|
|
9
|
+
* @param orgName Name of the Organization
|
|
10
|
+
* @param spaceName Name of the Space
|
|
11
|
+
* @param webhookId ID of the Webhook
|
|
12
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
13
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
14
|
+
* @returns Object containing an array of Webhook logs and the total number of results found in the database (independent of limit and page)
|
|
15
|
+
*/
|
|
16
|
+
getWebhookLogs: (orgName: string, spaceName: string, webhookId: string, limit?: number, page?: number) => Promise<PaginatedResponse<WebhookLog>>;
|
|
17
|
+
protected getEndpoint(endpoint: string): string;
|
|
18
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
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.High5WebhookLog = void 0;
|
|
13
|
+
const Base_1 = require("../../../../../Base");
|
|
14
|
+
const paginatedResponseHelper_1 = require("../../../../../helper/paginatedResponseHelper");
|
|
15
|
+
class High5WebhookLog extends Base_1.default {
|
|
16
|
+
constructor(options, axios) {
|
|
17
|
+
super(options, axios);
|
|
18
|
+
/**
|
|
19
|
+
* Retrieves all Webhook logs for the specified Webhook.
|
|
20
|
+
* @param orgName Name of the Organization
|
|
21
|
+
* @param spaceName Name of the Space
|
|
22
|
+
* @param webhookId ID of the Webhook
|
|
23
|
+
* @param limit (optional) Max number of results (1-100; defaults to 25)
|
|
24
|
+
* @param page (optional) Page number: Skip the first (page * limit) results (defaults to 0)
|
|
25
|
+
* @returns Object containing an array of Webhook logs and the total number of results found in the database (independent of limit and page)
|
|
26
|
+
*/
|
|
27
|
+
this.getWebhookLogs = (orgName, spaceName, webhookId, limit, page) => __awaiter(this, void 0, void 0, function* () {
|
|
28
|
+
limit = limit || 25;
|
|
29
|
+
page = page || 0;
|
|
30
|
+
const resp = yield this.axios.get(this.getEndpoint(`/v1/org/${orgName}/spaces/${spaceName}/webhooks/${webhookId}/logs?limit=${limit}&page=${page}`));
|
|
31
|
+
return (0, paginatedResponseHelper_1.createPaginatedResponse)(resp);
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
getEndpoint(endpoint) {
|
|
35
|
+
return `${this.options.server}/api/high5${endpoint}`;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.High5WebhookLog = High5WebhookLog;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../Base";
|
|
3
|
+
import { S3 } from "./s3";
|
|
4
|
+
export declare class High5Wave extends Base {
|
|
5
|
+
s3: S3;
|
|
6
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
7
|
+
protected getEndpoint(endpoint: string): string;
|
|
8
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.High5Wave = void 0;
|
|
4
|
+
const Base_1 = require("../../../Base");
|
|
5
|
+
const s3_1 = require("./s3");
|
|
6
|
+
class High5Wave extends Base_1.default {
|
|
7
|
+
constructor(options, axios) {
|
|
8
|
+
super(options, axios);
|
|
9
|
+
this.s3 = new s3_1.S3(this.options, this.axios);
|
|
10
|
+
}
|
|
11
|
+
getEndpoint(endpoint) {
|
|
12
|
+
return `${this.options.server}/api/high5${endpoint}`;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
exports.High5Wave = High5Wave;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../../../Base";
|
|
3
|
+
import { Catalog, CatalogRegistry, Engine, EngineRegistry, StreamNodeSpecifications, StreamNodeSpecificationWrappedWithEngineVersion } from "../../../../interfaces/high5";
|
|
4
|
+
/**
|
|
5
|
+
* Class for reading the S3 bucket of a wave engine and catalogs
|
|
6
|
+
*/
|
|
7
|
+
export declare class S3 extends Base {
|
|
8
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
9
|
+
/**
|
|
10
|
+
* Get the registry.json of the default wave catalog from the S3 bucket
|
|
11
|
+
* @param waveBucketUrl Public base url to S3 bucket
|
|
12
|
+
* @returns registry.json
|
|
13
|
+
*/
|
|
14
|
+
getCatalogRegistry: (waveBucketUrl: string) => Promise<CatalogRegistry>;
|
|
15
|
+
/**
|
|
16
|
+
* Get the registry.json of the default wave engine from the S3 bucket
|
|
17
|
+
* @param waveBucketUrl Public base url to S3 bucket
|
|
18
|
+
* @returns registry.json
|
|
19
|
+
*/
|
|
20
|
+
getEngineRegistry: (waveBucketUrl: string) => Promise<EngineRegistry>;
|
|
21
|
+
/**
|
|
22
|
+
* Get the catalog.json from the S3 bucket
|
|
23
|
+
* @param catalogUrl Public url of the catalog
|
|
24
|
+
* @returns index.json of catalog
|
|
25
|
+
*/
|
|
26
|
+
getCatalog: (catalogUrl: string) => Promise<Catalog>;
|
|
27
|
+
/**
|
|
28
|
+
* Get the catalog.json from the S3 bucket
|
|
29
|
+
* @param catalogUrl Public url of the catalog
|
|
30
|
+
* @returns index.json of catalog
|
|
31
|
+
*/
|
|
32
|
+
getEngine: (engineUrl: string) => Promise<Engine>;
|
|
33
|
+
/**
|
|
34
|
+
* Get the node specifications of all nodes of a specific catalog version from the S3 bucket
|
|
35
|
+
* @param catalogUrl Public url of the catalog
|
|
36
|
+
* @param version The catalog version
|
|
37
|
+
* @returns StreamNodeSpecification[] | StreamNodeSpecificationWrappedWithEngineVersion an array of all node specification of that catalog version, maybe wrapped in an object with the engine version
|
|
38
|
+
*/
|
|
39
|
+
getCatalogVersion: (catalogUrl: string, version: string) => Promise<StreamNodeSpecifications[] | StreamNodeSpecificationWrappedWithEngineVersion>;
|
|
40
|
+
/**
|
|
41
|
+
* Get the node documentation from the S3 bucket
|
|
42
|
+
* @param catalogUrl Public url of the catalog
|
|
43
|
+
* @param version The catalog version
|
|
44
|
+
* @returns string the markdown documentation of the node
|
|
45
|
+
*/
|
|
46
|
+
getNodeDocumentation: (catalogUrl: string, version: string, nodeName: string) => Promise<string>;
|
|
47
|
+
protected getEndpoint(): string;
|
|
48
|
+
}
|
|
@@ -0,0 +1,88 @@
|
|
|
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.S3 = void 0;
|
|
13
|
+
const Base_1 = require("../../../../Base");
|
|
14
|
+
const axios_1 = require("../../../../interfaces/axios");
|
|
15
|
+
/**
|
|
16
|
+
* Class for reading the S3 bucket of a wave engine and catalogs
|
|
17
|
+
*/
|
|
18
|
+
class S3 extends Base_1.default {
|
|
19
|
+
constructor(options, axios) {
|
|
20
|
+
super(options, axios);
|
|
21
|
+
/**
|
|
22
|
+
* Get the registry.json of the default wave catalog from the S3 bucket
|
|
23
|
+
* @param waveBucketUrl Public base url to S3 bucket
|
|
24
|
+
* @returns registry.json
|
|
25
|
+
*/
|
|
26
|
+
this.getCatalogRegistry = (waveBucketUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
27
|
+
const resp = yield this.axios.get(`${waveBucketUrl}/catalogs/registry.json`, { headers: axios_1.disableCacheHeaders });
|
|
28
|
+
return resp.data;
|
|
29
|
+
});
|
|
30
|
+
/**
|
|
31
|
+
* Get the registry.json of the default wave engine from the S3 bucket
|
|
32
|
+
* @param waveBucketUrl Public base url to S3 bucket
|
|
33
|
+
* @returns registry.json
|
|
34
|
+
*/
|
|
35
|
+
this.getEngineRegistry = (waveBucketUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
36
|
+
const resp = yield this.axios.get(`${waveBucketUrl}/engines/registry.json`, { headers: axios_1.disableCacheHeaders });
|
|
37
|
+
return resp.data;
|
|
38
|
+
});
|
|
39
|
+
/**
|
|
40
|
+
* Get the catalog.json from the S3 bucket
|
|
41
|
+
* @param catalogUrl Public url of the catalog
|
|
42
|
+
* @returns index.json of catalog
|
|
43
|
+
*/
|
|
44
|
+
this.getCatalog = (catalogUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
45
|
+
const resp = yield this.axios.get(`${catalogUrl}`, { headers: axios_1.disableCacheHeaders });
|
|
46
|
+
return resp.data;
|
|
47
|
+
});
|
|
48
|
+
/**
|
|
49
|
+
* Get the catalog.json from the S3 bucket
|
|
50
|
+
* @param catalogUrl Public url of the catalog
|
|
51
|
+
* @returns index.json of catalog
|
|
52
|
+
*/
|
|
53
|
+
this.getEngine = (engineUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
54
|
+
const resp = yield this.axios.get(`${engineUrl}`, { headers: axios_1.disableCacheHeaders });
|
|
55
|
+
return resp.data;
|
|
56
|
+
});
|
|
57
|
+
/**
|
|
58
|
+
* Get the node specifications of all nodes of a specific catalog version from the S3 bucket
|
|
59
|
+
* @param catalogUrl Public url of the catalog
|
|
60
|
+
* @param version The catalog version
|
|
61
|
+
* @returns StreamNodeSpecification[] | StreamNodeSpecificationWrappedWithEngineVersion an array of all node specification of that catalog version, maybe wrapped in an object with the engine version
|
|
62
|
+
*/
|
|
63
|
+
this.getCatalogVersion = (catalogUrl, version) => __awaiter(this, void 0, void 0, function* () {
|
|
64
|
+
const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + "/" + version + "/specification.json";
|
|
65
|
+
const resp = yield this.axios.get(specificationUrl, {
|
|
66
|
+
headers: axios_1.disableCacheHeaders,
|
|
67
|
+
});
|
|
68
|
+
return resp.data;
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Get the node documentation from the S3 bucket
|
|
72
|
+
* @param catalogUrl Public url of the catalog
|
|
73
|
+
* @param version The catalog version
|
|
74
|
+
* @returns string the markdown documentation of the node
|
|
75
|
+
*/
|
|
76
|
+
this.getNodeDocumentation = (catalogUrl, version, nodeName) => __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const specificationUrl = catalogUrl.split("/").slice(0, -1).join("/") + `/${version}/docs/${nodeName}.md`;
|
|
78
|
+
const resp = yield this.axios.get(specificationUrl).catch(err => {
|
|
79
|
+
throw new Error(`Node documentation not found: ${err}`);
|
|
80
|
+
});
|
|
81
|
+
return resp.data;
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
getEndpoint() {
|
|
85
|
+
throw new Error("Method not implemented.");
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
exports.S3 = S3;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { AxiosInstance } from "axios";
|
|
2
|
+
import Base, { Options } from "../../Base";
|
|
3
|
+
import { Version } from "../../interfaces/global";
|
|
4
|
+
import { PreLoginResponse } from "../../interfaces/idp";
|
|
5
|
+
import { SuccessfulAuth } from "../../interfaces/idp/user/SuccessfulAuth";
|
|
6
|
+
import { IdpInternal } from "./internal";
|
|
7
|
+
import { IdpOAuth } from "./oauth";
|
|
8
|
+
import { IdpOrganization } from "./organization";
|
|
9
|
+
import { IdpRegistration } from "./registration";
|
|
10
|
+
import { IdpUser } from "./user";
|
|
11
|
+
export default class Idp extends Base {
|
|
12
|
+
/**
|
|
13
|
+
* Handles everything around organizations
|
|
14
|
+
*/
|
|
15
|
+
organization: IdpOrganization;
|
|
16
|
+
/**
|
|
17
|
+
* Handles everything around registration
|
|
18
|
+
*/
|
|
19
|
+
registration: IdpRegistration;
|
|
20
|
+
/**
|
|
21
|
+
* Handles everything around open authorization and openId requests
|
|
22
|
+
*/
|
|
23
|
+
oAuth: IdpOAuth;
|
|
24
|
+
/**
|
|
25
|
+
* Handles everything around a user
|
|
26
|
+
*/
|
|
27
|
+
user: IdpUser;
|
|
28
|
+
/**
|
|
29
|
+
* Handles everything around idp's internal endpoints
|
|
30
|
+
*/
|
|
31
|
+
internal: IdpInternal;
|
|
32
|
+
constructor(options: Options, axios: AxiosInstance);
|
|
33
|
+
/**
|
|
34
|
+
* Requests the endpoint version
|
|
35
|
+
* @returns Version object
|
|
36
|
+
*/
|
|
37
|
+
version: () => Promise<Version>;
|
|
38
|
+
/**
|
|
39
|
+
* Authenticates against the identity provider with a given email and password.
|
|
40
|
+
* @param email Email of the user
|
|
41
|
+
* @param password Password of the user
|
|
42
|
+
* @param token (optional) token if 2FA-TOTP is enabled
|
|
43
|
+
* @returns SuccessfulAuth object holding the token and the user
|
|
44
|
+
*/
|
|
45
|
+
login: (email: string, password: string, token?: string) => Promise<SuccessfulAuth>;
|
|
46
|
+
/**
|
|
47
|
+
* Starts the login process via OIDC
|
|
48
|
+
* @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
|
|
49
|
+
* @param oidcProvider The provider to use for the process. Only optional if the user is part of an organization that has a preferred
|
|
50
|
+
* OIDC provider and an associated email that matches the user's. The list of available providers can be found in the public config endpoint.
|
|
51
|
+
* @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
|
|
52
|
+
* @returns URL that must be accessed via a browser to continue the login process.
|
|
53
|
+
*/
|
|
54
|
+
loginWithOIDC: (origin: string, oidcProvider?: string, hint?: string) => Promise<string>;
|
|
55
|
+
/**
|
|
56
|
+
* Starts the login process via SAML 2.0
|
|
57
|
+
* @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
|
|
58
|
+
* @param email Email of the user. The email domain will be used to determine the appropriate SAML 2.0 provider to use going forward.
|
|
59
|
+
* @returns URL that must be accessed via a browser to continue the login process.
|
|
60
|
+
*/
|
|
61
|
+
loginWithSAML: (origin: string, email: string) => Promise<string>;
|
|
62
|
+
/**
|
|
63
|
+
* Determine if/how the given email can authenticate.
|
|
64
|
+
*
|
|
65
|
+
* @param email Email of the user
|
|
66
|
+
* @param origin The starting URL of the process. If the authentication process bound to this email is SAML or OIDC,
|
|
67
|
+
* then the response's location property will include this origin.
|
|
68
|
+
* @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
|
|
69
|
+
* or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
|
|
70
|
+
*/
|
|
71
|
+
preLogin: (email: string, origin: string) => Promise<PreLoginResponse>;
|
|
72
|
+
/**
|
|
73
|
+
* Initiate the password reset process. An email will be sent to the user to move to the next phase.
|
|
74
|
+
*
|
|
75
|
+
* @param email Email of the user
|
|
76
|
+
* @param captcha Valid google reCAPTCHAV2
|
|
77
|
+
* @param regionId Optional region id to use for the password reset email
|
|
78
|
+
* @param targetUrl Optional url the link in the mail will point to
|
|
79
|
+
*/
|
|
80
|
+
resetPassword: (email: string, captcha: string, regionId?: string, targetUrl?: string) => Promise<void>;
|
|
81
|
+
protected getEndpoint(endpoint: string): string;
|
|
82
|
+
}
|
|
@@ -0,0 +1,137 @@
|
|
|
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 internal_1 = require("./internal");
|
|
14
|
+
const oauth_1 = require("./oauth");
|
|
15
|
+
const organization_1 = require("./organization");
|
|
16
|
+
const registration_1 = require("./registration");
|
|
17
|
+
const user_1 = require("./user");
|
|
18
|
+
class Idp extends Base_1.default {
|
|
19
|
+
constructor(options, axios) {
|
|
20
|
+
super(options, axios);
|
|
21
|
+
/**
|
|
22
|
+
* Requests the endpoint version
|
|
23
|
+
* @returns Version object
|
|
24
|
+
*/
|
|
25
|
+
this.version = () => __awaiter(this, void 0, void 0, function* () {
|
|
26
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/version"));
|
|
27
|
+
return resp.data;
|
|
28
|
+
});
|
|
29
|
+
/**
|
|
30
|
+
* Authenticates against the identity provider with a given email and password.
|
|
31
|
+
* @param email Email of the user
|
|
32
|
+
* @param password Password of the user
|
|
33
|
+
* @param token (optional) token if 2FA-TOTP is enabled
|
|
34
|
+
* @returns SuccessfulAuth object holding the token and the user
|
|
35
|
+
*/
|
|
36
|
+
this.login = (email, password, token) => __awaiter(this, void 0, void 0, function* () {
|
|
37
|
+
var _a;
|
|
38
|
+
let body = { email: email, password: password };
|
|
39
|
+
if (token) {
|
|
40
|
+
body = Object.assign(Object.assign({}, body), { token: token });
|
|
41
|
+
}
|
|
42
|
+
const resp = yield this.axios.post(this.getEndpoint("/v1/login"), body);
|
|
43
|
+
const authed = {
|
|
44
|
+
token: ((_a = resp.headers["authorization"]) === null || _a === void 0 ? void 0 : _a.toString()) || "",
|
|
45
|
+
user: resp.data,
|
|
46
|
+
};
|
|
47
|
+
return authed;
|
|
48
|
+
});
|
|
49
|
+
/**
|
|
50
|
+
* Starts the login process via OIDC
|
|
51
|
+
* @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
|
|
52
|
+
* @param oidcProvider The provider to use for the process. Only optional if the user is part of an organization that has a preferred
|
|
53
|
+
* OIDC provider and an associated email that matches the user's. The list of available providers can be found in the public config endpoint.
|
|
54
|
+
* @param hint Valid email address of the user that wants to login. Hint must be defined when provider is not.
|
|
55
|
+
* @returns URL that must be accessed via a browser to continue the login process.
|
|
56
|
+
*/
|
|
57
|
+
this.loginWithOIDC = (origin, oidcProvider, hint) => __awaiter(this, void 0, void 0, function* () {
|
|
58
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/login/oidc"), {
|
|
59
|
+
params: {
|
|
60
|
+
origin,
|
|
61
|
+
provider: oidcProvider,
|
|
62
|
+
hint,
|
|
63
|
+
},
|
|
64
|
+
maxRedirects: 0,
|
|
65
|
+
validateStatus: status => {
|
|
66
|
+
return status >= 300 && status < 400;
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
const location = resp.headers.location;
|
|
70
|
+
if (!location) {
|
|
71
|
+
throw new Error("Location header is undefined.");
|
|
72
|
+
}
|
|
73
|
+
return location;
|
|
74
|
+
});
|
|
75
|
+
/**
|
|
76
|
+
* Starts the login process via SAML 2.0
|
|
77
|
+
* @param origin The starting URL of the process. After obtaining the credentials, the user will be redirected back to this url.
|
|
78
|
+
* @param email Email of the user. The email domain will be used to determine the appropriate SAML 2.0 provider to use going forward.
|
|
79
|
+
* @returns URL that must be accessed via a browser to continue the login process.
|
|
80
|
+
*/
|
|
81
|
+
this.loginWithSAML = (origin, email) => __awaiter(this, void 0, void 0, function* () {
|
|
82
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/login/saml"), {
|
|
83
|
+
params: {
|
|
84
|
+
origin,
|
|
85
|
+
email,
|
|
86
|
+
},
|
|
87
|
+
maxRedirects: 0,
|
|
88
|
+
validateStatus: status => {
|
|
89
|
+
return status >= 300 && status < 400;
|
|
90
|
+
},
|
|
91
|
+
});
|
|
92
|
+
const location = resp.headers.location;
|
|
93
|
+
if (!location) {
|
|
94
|
+
throw new Error("Location header is undefined.");
|
|
95
|
+
}
|
|
96
|
+
return location;
|
|
97
|
+
});
|
|
98
|
+
/**
|
|
99
|
+
* Determine if/how the given email can authenticate.
|
|
100
|
+
*
|
|
101
|
+
* @param email Email of the user
|
|
102
|
+
* @param origin The starting URL of the process. If the authentication process bound to this email is SAML or OIDC,
|
|
103
|
+
* then the response's location property will include this origin.
|
|
104
|
+
* @returns object that dictates if: the user needs to REGISTER; the user needs to VERIFY_EMAIL; the user can LOGIN using this email;
|
|
105
|
+
* or the authentication process should continue via an EXTERNAL provider that can be found via the location property.
|
|
106
|
+
*/
|
|
107
|
+
this.preLogin = (email, origin) => __awaiter(this, void 0, void 0, function* () {
|
|
108
|
+
const resp = yield this.axios.get(this.getEndpoint("/v1/login/pre"), {
|
|
109
|
+
params: {
|
|
110
|
+
origin,
|
|
111
|
+
email,
|
|
112
|
+
},
|
|
113
|
+
});
|
|
114
|
+
return resp.data;
|
|
115
|
+
});
|
|
116
|
+
/**
|
|
117
|
+
* Initiate the password reset process. An email will be sent to the user to move to the next phase.
|
|
118
|
+
*
|
|
119
|
+
* @param email Email of the user
|
|
120
|
+
* @param captcha Valid google reCAPTCHAV2
|
|
121
|
+
* @param regionId Optional region id to use for the password reset email
|
|
122
|
+
* @param targetUrl Optional url the link in the mail will point to
|
|
123
|
+
*/
|
|
124
|
+
this.resetPassword = (email, captcha, regionId, targetUrl) => __awaiter(this, void 0, void 0, function* () {
|
|
125
|
+
yield this.axios.post(this.getEndpoint("/v1/login/forgot_password"), { email, captcha, regionId, targetUrl });
|
|
126
|
+
});
|
|
127
|
+
this.organization = new organization_1.IdpOrganization(this.options, this.axios);
|
|
128
|
+
this.user = new user_1.IdpUser(this.options, this.axios);
|
|
129
|
+
this.registration = new registration_1.IdpRegistration(this.options, this.axios);
|
|
130
|
+
this.oAuth = new oauth_1.IdpOAuth(this.options, this.axios);
|
|
131
|
+
this.internal = new internal_1.IdpInternal(this.options, this.axios);
|
|
132
|
+
}
|
|
133
|
+
getEndpoint(endpoint) {
|
|
134
|
+
return `${this.options.server}/api/account${endpoint}`;
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
exports.default = Idp;
|