attlaz-client 1.9.70 → 1.10.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/dist/Client.d.ts +31 -31
- package/dist/Client.js +73 -72
- package/dist/Core/MetaDataAware.js +2 -5
- package/dist/Http/Data/Header.js +1 -2
- package/dist/Http/Data/Parameters.js +1 -2
- package/dist/Http/Data/QueryString.js +2 -8
- package/dist/Http/HttpClient.d.ts +2 -2
- package/dist/Http/HttpClient.js +22 -24
- package/dist/Http/HttpClientRequest.js +12 -14
- package/dist/Http/HttpClientResponse.js +4 -6
- package/dist/Http/OAuthClient.d.ts +3 -3
- package/dist/Http/OAuthClient.js +25 -30
- package/dist/Http/OAuthClientOptions.d.ts +1 -1
- package/dist/Http/OAuthClientOptions.js +10 -10
- package/dist/Http/OAuthClientToken.js +6 -10
- package/dist/Model/Adapter/Adapter.js +11 -5
- package/dist/Model/Adapter/AdapterConfiguration.js +7 -5
- package/dist/Model/Adapter/AdapterConnection.d.ts +1 -1
- package/dist/Model/Adapter/AdapterConnection.js +9 -8
- package/dist/Model/Config.d.ts +1 -1
- package/dist/Model/Config.js +16 -15
- package/dist/Model/DataValue.js +3 -5
- package/dist/Model/DataValueCollection.d.ts +2 -2
- package/dist/Model/DataValueCollection.js +7 -14
- package/dist/Model/Deployment/CodeSource.d.ts +2 -2
- package/dist/Model/Deployment/CodeSource.js +12 -10
- package/dist/Model/Deployment/CodeSourceAccount.js +7 -5
- package/dist/Model/Deployment/CodeSourceBuildStrategy.d.ts +2 -2
- package/dist/Model/Deployment/CodeSourceBuildStrategy.js +7 -10
- package/dist/Model/Deployment/CodeSourceRunStrategy.d.ts +9 -0
- package/dist/Model/Deployment/CodeSourceRunStrategy.js +15 -0
- package/dist/Model/Deployment/SourcesAccountRepository.js +3 -5
- package/dist/Model/Deployment/SourcesAccountRepositoryBranch.js +2 -5
- package/dist/Model/Error/ClientError.js +19 -19
- package/dist/Model/Event/EventType.js +2 -5
- package/dist/Model/Flow/Flow.d.ts +3 -3
- package/dist/Model/Flow/Flow.js +19 -21
- package/dist/Model/Flow/FlowRun.d.ts +3 -3
- package/dist/Model/Flow/FlowRun.js +20 -18
- package/dist/Model/Flow/FlowRunHistory.d.ts +1 -1
- package/dist/Model/Flow/FlowRunHistory.js +8 -9
- package/dist/Model/Flow/FlowRunPriority.js +5 -8
- package/dist/Model/Flow/FlowRunResponse.js +5 -5
- package/dist/Model/Flow/FlowRunStats.js +13 -17
- package/dist/Model/Flow/FlowRunStatus.js +5 -8
- package/dist/Model/Flow/FlowRunSummary.d.ts +2 -2
- package/dist/Model/Flow/FlowRunSummary.js +11 -15
- package/dist/Model/Flow/FlowSummary.d.ts +2 -2
- package/dist/Model/Flow/FlowSummary.js +12 -19
- package/dist/Model/HealthAlert/HealthAlert.d.ts +3 -3
- package/dist/Model/HealthAlert/HealthAlert.js +11 -11
- package/dist/Model/HealthAlert/HealthAlertStatus.js +5 -8
- package/dist/Model/HealthAlert/HealthTestType.js +5 -8
- package/dist/Model/JsonSerializable.js +1 -5
- package/dist/Model/Log/Log.d.ts +4 -4
- package/dist/Model/Log/Log.js +21 -18
- package/dist/Model/Log/LogItemFilter.d.ts +2 -2
- package/dist/Model/Log/LogItemFilter.js +3 -9
- package/dist/Model/Log/LogLevel.js +5 -8
- package/dist/Model/Log/LogQuery.d.ts +3 -3
- package/dist/Model/Log/LogQuery.js +9 -11
- package/dist/Model/Log/LogStatus.js +5 -8
- package/dist/Model/Log/LogStream.d.ts +1 -1
- package/dist/Model/Log/LogStream.js +3 -5
- package/dist/Model/Log/LogStreamId.js +2 -5
- package/dist/Model/Log/LogStreamInformation.d.ts +3 -3
- package/dist/Model/Log/LogStreamInformation.js +8 -9
- package/dist/Model/Messaging/Channel/Channel.d.ts +4 -4
- package/dist/Model/Messaging/Channel/Channel.js +17 -16
- package/dist/Model/Messaging/Channel/ChannelData.d.ts +1 -1
- package/dist/Model/Messaging/Channel/ChannelData.js +2 -5
- package/dist/Model/Messaging/Channel/ChannelType.js +5 -8
- package/dist/Model/Messaging/Channel/EmailChannelData.js +5 -8
- package/dist/Model/Messaging/Channel/PushChannelData.d.ts +1 -1
- package/dist/Model/Messaging/Channel/PushChannelData.js +9 -8
- package/dist/Model/Messaging/Channel/SlackChannelData.d.ts +1 -1
- package/dist/Model/Messaging/Channel/SlackChannelData.js +10 -8
- package/dist/Model/Messaging/Channel/SmsChannelData.d.ts +1 -1
- package/dist/Model/Messaging/Channel/SmsChannelData.js +5 -8
- package/dist/Model/Messaging/Channel/WebhookChannelData.d.ts +1 -1
- package/dist/Model/Messaging/Channel/WebhookChannelData.js +6 -8
- package/dist/Model/Messaging/ChannelHistory.js +11 -8
- package/dist/Model/Messaging/Subscriber.d.ts +5 -5
- package/dist/Model/Messaging/Subscriber.js +16 -13
- package/dist/Model/Notification.js +10 -10
- package/dist/Model/Pagination/CursorPagination.js +4 -10
- package/dist/Model/Project/CodeDeploy.d.ts +2 -2
- package/dist/Model/Project/CodeDeploy.js +24 -24
- package/dist/Model/Project/CodeDeployStatus.js +5 -8
- package/dist/Model/Project/PlatformLanguage.d.ts +2 -2
- package/dist/Model/Project/PlatformLanguage.js +7 -9
- package/dist/Model/Project/Project.d.ts +2 -2
- package/dist/Model/Project/Project.js +9 -8
- package/dist/Model/Project/ProjectDeployCommit.js +6 -5
- package/dist/Model/Project/ProjectEnvironment.d.ts +2 -2
- package/dist/Model/Project/ProjectEnvironment.js +13 -15
- package/dist/Model/Queue/QueueStatus.js +7 -10
- package/dist/Model/Result/CollectionResult.js +3 -6
- package/dist/Model/Result/DataResult.d.ts +1 -1
- package/dist/Model/Result/DataResult.js +3 -5
- package/dist/Model/Result/ObjectResult.js +2 -5
- package/dist/Model/Result/ObjectWrapper.js +1 -5
- package/dist/Model/Result/ResultError.js +2 -5
- package/dist/Model/Search/SearchResult.d.ts +7 -7
- package/dist/Model/Search/SearchResult.js +17 -17
- package/dist/Model/State.js +5 -8
- package/dist/Model/StateAware.d.ts +1 -1
- package/dist/Model/StateAware.js +1 -2
- package/dist/Model/Storage/StorageInformation.js +5 -5
- package/dist/Model/Storage/StorageItem.js +7 -7
- package/dist/Model/Storage/StorageItemInformation.js +6 -7
- package/dist/Model/Storage/StorageType.js +5 -8
- package/dist/Model/Trigger/ApiTrigger.d.ts +2 -2
- package/dist/Model/Trigger/ApiTrigger.js +4 -8
- package/dist/Model/Trigger/ApiTriggerData.d.ts +1 -1
- package/dist/Model/Trigger/ApiTriggerData.js +2 -6
- package/dist/Model/Trigger/ScheduleTrigger.d.ts +2 -2
- package/dist/Model/Trigger/ScheduleTrigger.js +4 -8
- package/dist/Model/Trigger/ScheduleTriggerData.d.ts +1 -1
- package/dist/Model/Trigger/ScheduleTriggerData.js +3 -6
- package/dist/Model/Trigger/Trigger.d.ts +4 -4
- package/dist/Model/Trigger/Trigger.js +24 -22
- package/dist/Model/Trigger/TriggerData.js +1 -5
- package/dist/Model/Trigger/TriggerType.js +5 -8
- package/dist/Model/Trigger/WebhookTrigger.d.ts +2 -2
- package/dist/Model/Trigger/WebhookTrigger.js +4 -8
- package/dist/Model/Trigger/WebhookTriggerData.d.ts +1 -1
- package/dist/Model/Trigger/WebhookTriggerData.js +3 -6
- package/dist/Model/User/UserAction.d.ts +1 -1
- package/dist/Model/User/UserAction.js +12 -5
- package/dist/Model/User/UserAuthProvider.d.ts +2 -2
- package/dist/Model/User/UserAuthProvider.js +12 -13
- package/dist/Model/User.d.ts +2 -2
- package/dist/Model/User.js +14 -10
- package/dist/Model/Worker/Platform.d.ts +2 -2
- package/dist/Model/Worker/Platform.js +14 -14
- package/dist/Model/Worker/PlatformImage.d.ts +2 -2
- package/dist/Model/Worker/PlatformImage.js +12 -12
- package/dist/Model/Worker/Worker.d.ts +2 -2
- package/dist/Model/Worker/Worker.js +13 -11
- package/dist/Model/Worker/WorkerConfig.d.ts +1 -1
- package/dist/Model/Worker/WorkerConfig.js +13 -14
- package/dist/Model/Worker/WorkerInstance.d.ts +1 -1
- package/dist/Model/Worker/WorkerInstance.js +4 -7
- package/dist/Model/Worker/WorkerInstanceState.js +5 -8
- package/dist/Model/Worker/WorkerState.js +5 -8
- package/dist/Model/Workspace/Workspace.d.ts +2 -2
- package/dist/Model/Workspace/Workspace.js +6 -7
- package/dist/Model/Workspace/WorkspaceMember.d.ts +3 -3
- package/dist/Model/Workspace/WorkspaceMember.js +8 -8
- package/dist/Model/Workspace/WorkspaceMemberInvite.d.ts +2 -2
- package/dist/Model/Workspace/WorkspaceMemberInvite.js +12 -9
- package/dist/Model/Workspace/WorkspaceMemberInvite2.d.ts +1 -1
- package/dist/Model/Workspace/WorkspaceMemberInvite2.js +9 -7
- package/dist/Model/Workspace/WorkspaceMemberInviteState.js +5 -8
- package/dist/Model/Workspace/WorkspaceMemberRole.js +5 -8
- package/dist/Service/AdapterEndpoint.d.ts +5 -5
- package/dist/Service/AdapterEndpoint.js +15 -19
- package/dist/Service/ChannelEndpoint.d.ts +4 -4
- package/dist/Service/ChannelEndpoint.js +11 -15
- package/dist/Service/CodeDeployEndpoint.d.ts +3 -3
- package/dist/Service/CodeDeployEndpoint.js +7 -11
- package/dist/Service/CodeSourceStrategiesEndpoint.d.ts +8 -0
- package/dist/Service/CodeSourceStrategiesEndpoint.js +17 -0
- package/dist/Service/ConfigEndpoint.d.ts +3 -3
- package/dist/Service/ConfigEndpoint.js +9 -13
- package/dist/Service/Endpoint.d.ts +6 -6
- package/dist/Service/Endpoint.js +23 -26
- package/dist/Service/FirewallEndpoint.d.ts +1 -1
- package/dist/Service/FirewallEndpoint.js +5 -9
- package/dist/Service/FlowEndpoint.d.ts +4 -4
- package/dist/Service/FlowEndpoint.js +16 -20
- package/dist/Service/FlowRunEndpoint.d.ts +7 -7
- package/dist/Service/FlowRunEndpoint.js +13 -17
- package/dist/Service/FlowRunRequestEndpoint.d.ts +3 -3
- package/dist/Service/FlowRunRequestEndpoint.js +5 -9
- package/dist/Service/FlowRunStatsEndpoint.d.ts +2 -2
- package/dist/Service/FlowRunStatsEndpoint.js +5 -9
- package/dist/Service/HealthAlertEndpoint.d.ts +3 -3
- package/dist/Service/HealthAlertEndpoint.js +5 -9
- package/dist/Service/LogEndpoint.d.ts +9 -9
- package/dist/Service/LogEndpoint.js +17 -21
- package/dist/Service/NotificationsEndpoint.d.ts +3 -3
- package/dist/Service/NotificationsEndpoint.js +5 -9
- package/dist/Service/PlatformEndpoint.d.ts +4 -4
- package/dist/Service/PlatformEndpoint.js +8 -12
- package/dist/Service/PlatformLanguageEndpoint.d.ts +3 -3
- package/dist/Service/PlatformLanguageEndpoint.js +4 -8
- package/dist/Service/ProjectEndpoint.d.ts +4 -4
- package/dist/Service/ProjectEndpoint.js +10 -14
- package/dist/Service/ProjectEnvironmentEndpoint.d.ts +3 -3
- package/dist/Service/ProjectEnvironmentEndpoint.js +8 -12
- package/dist/Service/QueueEndpoint.d.ts +2 -2
- package/dist/Service/QueueEndpoint.js +5 -9
- package/dist/Service/SearchEndpoint.d.ts +3 -3
- package/dist/Service/SearchEndpoint.js +4 -8
- package/dist/Service/SourcesAccountEndpoint.d.ts +6 -6
- package/dist/Service/SourcesAccountEndpoint.js +19 -23
- package/dist/Service/StorageEndpoint.d.ts +6 -6
- package/dist/Service/StorageEndpoint.js +10 -14
- package/dist/Service/SubscriberEndpoint.d.ts +3 -3
- package/dist/Service/SubscriberEndpoint.js +9 -13
- package/dist/Service/TriggerEndpoint.d.ts +3 -3
- package/dist/Service/TriggerEndpoint.js +8 -12
- package/dist/Service/UserEndpoint.d.ts +5 -5
- package/dist/Service/UserEndpoint.js +12 -16
- package/dist/Service/WorkerConfigEndpoint.d.ts +3 -3
- package/dist/Service/WorkerConfigEndpoint.js +5 -9
- package/dist/Service/WorkerEndpoint.d.ts +2 -2
- package/dist/Service/WorkerEndpoint.js +4 -8
- package/dist/Service/WorkspaceEndpoint.d.ts +3 -3
- package/dist/Service/WorkspaceEndpoint.js +4 -8
- package/dist/Service/WorkspaceMemberEndpoint.d.ts +6 -6
- package/dist/Service/WorkspaceMemberEndpoint.js +20 -24
- package/dist/Utils.js +1 -5
- package/dist/index.d.ts +116 -116
- package/dist/index.js +116 -237
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -4
- package/package.json +24 -8
- package/dist/Service/CodeSourceBuildStrategyEndpoint.d.ts +0 -6
- package/dist/Service/CodeSourceBuildStrategyEndpoint.js +0 -14
package/dist/Client.d.ts
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { OAuthClientToken } from './Http/OAuthClientToken';
|
|
2
|
-
import { WorkerEndpoint } from './Service/WorkerEndpoint';
|
|
3
|
-
import { AdapterEndpoint } from './Service/AdapterEndpoint';
|
|
4
|
-
import { ProjectEnvironmentEndpoint } from './Service/ProjectEnvironmentEndpoint';
|
|
5
|
-
import { ProjectEndpoint } from './Service/ProjectEndpoint';
|
|
6
|
-
import { FlowRunRequestEndpoint } from './Service/FlowRunRequestEndpoint';
|
|
7
|
-
import { OAuthClient } from './Http/OAuthClient';
|
|
8
|
-
import { WorkerConfigEndpoint } from './Service/WorkerConfigEndpoint';
|
|
9
|
-
import { WorkspaceEndpoint } from './Service/WorkspaceEndpoint';
|
|
10
|
-
import { UserEndpoint } from './Service/UserEndpoint';
|
|
11
|
-
import { ConfigEndpoint } from './Service/ConfigEndpoint';
|
|
12
|
-
import { SubscriberEndpoint } from './Service/SubscriberEndpoint';
|
|
13
|
-
import { FlowEndpoint } from './Service/FlowEndpoint';
|
|
14
|
-
import { WorkspaceMemberEndpoint } from './Service/WorkspaceMemberEndpoint';
|
|
15
|
-
import { StorageEndpoint } from './Service/StorageEndpoint';
|
|
16
|
-
import { QueueEndpoint } from './Service/QueueEndpoint';
|
|
17
|
-
import { NotificationsEndpoint } from './Service/NotificationsEndpoint';
|
|
18
|
-
import { CodeDeployEndpoint } from './Service/CodeDeployEndpoint';
|
|
19
|
-
import { SourcesAccountEndpoint } from './Service/SourcesAccountEndpoint';
|
|
20
|
-
import { PlatformLanguageEndpoint } from './Service/PlatformLanguageEndpoint';
|
|
21
|
-
import { ChannelEndpoint } from './Service/ChannelEndpoint';
|
|
22
|
-
import { HealthAlertEndpoint } from './Service/HealthAlertEndpoint';
|
|
23
|
-
import { FlowRunEndpoint } from './Service/FlowRunEndpoint';
|
|
24
|
-
import { LogEndpoint } from './Service/LogEndpoint';
|
|
25
|
-
import { TriggerEndpoint } from './Service/TriggerEndpoint';
|
|
26
|
-
import { PlatformEndpoint } from './Service/PlatformEndpoint';
|
|
27
|
-
import { FlowRunStatsEndpoint } from './Service/FlowRunStatsEndpoint';
|
|
28
|
-
import { FirewallEndpoint } from './Service/FirewallEndpoint';
|
|
29
|
-
import {
|
|
30
|
-
import { SearchEndpoint } from './Service/SearchEndpoint';
|
|
1
|
+
import { OAuthClientToken } from './Http/OAuthClientToken.js';
|
|
2
|
+
import { WorkerEndpoint } from './Service/WorkerEndpoint.js';
|
|
3
|
+
import { AdapterEndpoint } from './Service/AdapterEndpoint.js';
|
|
4
|
+
import { ProjectEnvironmentEndpoint } from './Service/ProjectEnvironmentEndpoint.js';
|
|
5
|
+
import { ProjectEndpoint } from './Service/ProjectEndpoint.js';
|
|
6
|
+
import { FlowRunRequestEndpoint } from './Service/FlowRunRequestEndpoint.js';
|
|
7
|
+
import { OAuthClient } from './Http/OAuthClient.js';
|
|
8
|
+
import { WorkerConfigEndpoint } from './Service/WorkerConfigEndpoint.js';
|
|
9
|
+
import { WorkspaceEndpoint } from './Service/WorkspaceEndpoint.js';
|
|
10
|
+
import { UserEndpoint } from './Service/UserEndpoint.js';
|
|
11
|
+
import { ConfigEndpoint } from './Service/ConfigEndpoint.js';
|
|
12
|
+
import { SubscriberEndpoint } from './Service/SubscriberEndpoint.js';
|
|
13
|
+
import { FlowEndpoint } from './Service/FlowEndpoint.js';
|
|
14
|
+
import { WorkspaceMemberEndpoint } from './Service/WorkspaceMemberEndpoint.js';
|
|
15
|
+
import { StorageEndpoint } from './Service/StorageEndpoint.js';
|
|
16
|
+
import { QueueEndpoint } from './Service/QueueEndpoint.js';
|
|
17
|
+
import { NotificationsEndpoint } from './Service/NotificationsEndpoint.js';
|
|
18
|
+
import { CodeDeployEndpoint } from './Service/CodeDeployEndpoint.js';
|
|
19
|
+
import { SourcesAccountEndpoint } from './Service/SourcesAccountEndpoint.js';
|
|
20
|
+
import { PlatformLanguageEndpoint } from './Service/PlatformLanguageEndpoint.js';
|
|
21
|
+
import { ChannelEndpoint } from './Service/ChannelEndpoint.js';
|
|
22
|
+
import { HealthAlertEndpoint } from './Service/HealthAlertEndpoint.js';
|
|
23
|
+
import { FlowRunEndpoint } from './Service/FlowRunEndpoint.js';
|
|
24
|
+
import { LogEndpoint } from './Service/LogEndpoint.js';
|
|
25
|
+
import { TriggerEndpoint } from './Service/TriggerEndpoint.js';
|
|
26
|
+
import { PlatformEndpoint } from './Service/PlatformEndpoint.js';
|
|
27
|
+
import { FlowRunStatsEndpoint } from './Service/FlowRunStatsEndpoint.js';
|
|
28
|
+
import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
|
|
29
|
+
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
30
|
+
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
31
31
|
export declare class Client {
|
|
32
32
|
private readonly apiEndpoint;
|
|
33
33
|
private readonly clientId;
|
|
@@ -72,7 +72,7 @@ export declare class Client {
|
|
|
72
72
|
getWorkerConfigEndpoint(): WorkerConfigEndpoint;
|
|
73
73
|
getQueueEndpoint(): QueueEndpoint;
|
|
74
74
|
getHealthAlertEndpoint(): HealthAlertEndpoint;
|
|
75
|
-
|
|
75
|
+
getCodeSourceStrategiesEndpoint(): CodeSourceStrategiesEndpoint;
|
|
76
76
|
getSearchEndpoint(): SearchEndpoint;
|
|
77
77
|
getFirewallEndpoint(): FirewallEndpoint;
|
|
78
78
|
private getEndpoint;
|
package/dist/Client.js
CHANGED
|
@@ -1,74 +1,76 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
1
|
+
import { WorkerEndpoint } from './Service/WorkerEndpoint.js';
|
|
2
|
+
import { AdapterEndpoint } from './Service/AdapterEndpoint.js';
|
|
3
|
+
import { ProjectEnvironmentEndpoint } from './Service/ProjectEnvironmentEndpoint.js';
|
|
4
|
+
import { ProjectEndpoint } from './Service/ProjectEndpoint.js';
|
|
5
|
+
import { FlowRunRequestEndpoint } from './Service/FlowRunRequestEndpoint.js';
|
|
6
|
+
import { OAuthClient } from './Http/OAuthClient.js';
|
|
7
|
+
import { WorkerConfigEndpoint } from './Service/WorkerConfigEndpoint.js';
|
|
8
|
+
import { WorkspaceEndpoint } from './Service/WorkspaceEndpoint.js';
|
|
9
|
+
import { UserEndpoint } from './Service/UserEndpoint.js';
|
|
10
|
+
import { ConfigEndpoint } from './Service/ConfigEndpoint.js';
|
|
11
|
+
import { SubscriberEndpoint } from './Service/SubscriberEndpoint.js';
|
|
12
|
+
import { FlowEndpoint } from './Service/FlowEndpoint.js';
|
|
13
|
+
import { WorkspaceMemberEndpoint } from './Service/WorkspaceMemberEndpoint.js';
|
|
14
|
+
import { StorageEndpoint } from './Service/StorageEndpoint.js';
|
|
15
|
+
import { QueueEndpoint } from './Service/QueueEndpoint.js';
|
|
16
|
+
import { NotificationsEndpoint } from './Service/NotificationsEndpoint.js';
|
|
17
|
+
import { CodeDeployEndpoint } from './Service/CodeDeployEndpoint.js';
|
|
18
|
+
import { SourcesAccountEndpoint } from './Service/SourcesAccountEndpoint.js';
|
|
19
|
+
import { OAuthClientOptions } from './Http/OAuthClientOptions.js';
|
|
20
|
+
import { PlatformLanguageEndpoint } from './Service/PlatformLanguageEndpoint.js';
|
|
21
|
+
import { ChannelEndpoint } from './Service/ChannelEndpoint.js';
|
|
22
|
+
import { HealthAlertEndpoint } from './Service/HealthAlertEndpoint.js';
|
|
23
|
+
import { FlowRunEndpoint } from './Service/FlowRunEndpoint.js';
|
|
24
|
+
import { LogEndpoint } from './Service/LogEndpoint.js';
|
|
25
|
+
import { TriggerEndpoint } from './Service/TriggerEndpoint.js';
|
|
26
|
+
import { PlatformEndpoint } from './Service/PlatformEndpoint.js';
|
|
27
|
+
import { FlowRunStatsEndpoint } from './Service/FlowRunStatsEndpoint.js';
|
|
28
|
+
import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
|
|
29
|
+
import { VERSION } from './version.js';
|
|
30
|
+
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
31
|
+
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
32
|
+
export class Client {
|
|
33
|
+
apiEndpoint;
|
|
34
|
+
clientId;
|
|
35
|
+
clientSecret;
|
|
36
|
+
endpoints;
|
|
37
|
+
httpClient;
|
|
38
|
+
Store = {
|
|
39
|
+
WorkerEndpoint,
|
|
40
|
+
AdapterEndpoint,
|
|
41
|
+
ProjectEndpoint,
|
|
42
|
+
ProjectEnvironmentEndpoint,
|
|
43
|
+
CodeDeployEndpoint,
|
|
44
|
+
QueueEndpoint,
|
|
45
|
+
ChannelEndpoint,
|
|
46
|
+
ConfigEndpoint,
|
|
47
|
+
NotificationsEndpoint,
|
|
48
|
+
SubscriberEndpoint,
|
|
49
|
+
LogEndpoint,
|
|
50
|
+
FlowEndpoint,
|
|
51
|
+
FlowRunEndpoint,
|
|
52
|
+
FlowRunRequestEndpoint,
|
|
53
|
+
WorkspaceEndpoint,
|
|
54
|
+
TriggerEndpoint,
|
|
55
|
+
UserEndpoint,
|
|
56
|
+
WorkspaceMemberEndpoint,
|
|
57
|
+
SourcesAccountEndpoint,
|
|
58
|
+
PlatformLanguageEndpoint,
|
|
59
|
+
StorageEndpoint,
|
|
60
|
+
WorkerConfigEndpoint,
|
|
61
|
+
HealthAlertEndpoint,
|
|
62
|
+
PlatformEndpoint,
|
|
63
|
+
FlowRunStatsEndpoint,
|
|
64
|
+
CodeSourceStrategiesEndpoint,
|
|
65
|
+
FirewallEndpoint,
|
|
66
|
+
SearchEndpoint
|
|
67
|
+
};
|
|
36
68
|
constructor(apiEndpoint, clientId, clientSecret) {
|
|
37
69
|
this.apiEndpoint = apiEndpoint;
|
|
38
70
|
this.clientId = clientId;
|
|
39
71
|
this.clientSecret = clientSecret;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
AdapterEndpoint: AdapterEndpoint_1.AdapterEndpoint,
|
|
43
|
-
ProjectEndpoint: ProjectEndpoint_1.ProjectEndpoint,
|
|
44
|
-
ProjectEnvironmentEndpoint: ProjectEnvironmentEndpoint_1.ProjectEnvironmentEndpoint,
|
|
45
|
-
CodeDeployEndpoint: CodeDeployEndpoint_1.CodeDeployEndpoint,
|
|
46
|
-
QueueEndpoint: QueueEndpoint_1.QueueEndpoint,
|
|
47
|
-
ChannelEndpoint: ChannelEndpoint_1.ChannelEndpoint,
|
|
48
|
-
ConfigEndpoint: ConfigEndpoint_1.ConfigEndpoint,
|
|
49
|
-
NotificationsEndpoint: NotificationsEndpoint_1.NotificationsEndpoint,
|
|
50
|
-
SubscriberEndpoint: SubscriberEndpoint_1.SubscriberEndpoint,
|
|
51
|
-
LogEndpoint: LogEndpoint_1.LogEndpoint,
|
|
52
|
-
FlowEndpoint: FlowEndpoint_1.FlowEndpoint,
|
|
53
|
-
FlowRunEndpoint: FlowRunEndpoint_1.FlowRunEndpoint,
|
|
54
|
-
FlowRunRequestEndpoint: FlowRunRequestEndpoint_1.FlowRunRequestEndpoint,
|
|
55
|
-
WorkspaceEndpoint: WorkspaceEndpoint_1.WorkspaceEndpoint,
|
|
56
|
-
TriggerEndpoint: TriggerEndpoint_1.TriggerEndpoint,
|
|
57
|
-
UserEndpoint: UserEndpoint_1.UserEndpoint,
|
|
58
|
-
WorkspaceMemberEndpoint: WorkspaceMemberEndpoint_1.WorkspaceMemberEndpoint,
|
|
59
|
-
SourcesAccountEndpoint: SourcesAccountEndpoint_1.SourcesAccountEndpoint,
|
|
60
|
-
PlatformLanguageEndpoint: PlatformLanguageEndpoint_1.PlatformLanguageEndpoint,
|
|
61
|
-
StorageEndpoint: StorageEndpoint_1.StorageEndpoint,
|
|
62
|
-
WorkerConfigEndpoint: WorkerConfigEndpoint_1.WorkerConfigEndpoint,
|
|
63
|
-
HealthAlertEndpoint: HealthAlertEndpoint_1.HealthAlertEndpoint,
|
|
64
|
-
PlatformEndpoint: PlatformEndpoint_1.PlatformEndpoint,
|
|
65
|
-
FlowRunStatsEndpoint: FlowRunStatsEndpoint_1.FlowRunStatsEndpoint,
|
|
66
|
-
CodeSourceBuildStrategyEndpoint: CodeSourceBuildStrategyEndpoint_1.CodeSourceBuildStrategyEndpoint,
|
|
67
|
-
FirewallEndpoint: FirewallEndpoint_1.FirewallEndpoint,
|
|
68
|
-
SearchEndpoint: SearchEndpoint_1.SearchEndpoint
|
|
69
|
-
};
|
|
70
|
-
const options = new OAuthClientOptions_1.OAuthClientOptions(apiEndpoint, clientId, clientSecret, this.getHeaders());
|
|
71
|
-
this.httpClient = new OAuthClient_1.OAuthClient(options);
|
|
72
|
+
const options = new OAuthClientOptions(apiEndpoint, clientId, clientSecret, this.getHeaders());
|
|
73
|
+
this.httpClient = new OAuthClient(options);
|
|
72
74
|
this.endpoints = new Map();
|
|
73
75
|
// this.test = new Map<string, any>();
|
|
74
76
|
//
|
|
@@ -81,13 +83,13 @@ class Client {
|
|
|
81
83
|
}
|
|
82
84
|
getHeaders() {
|
|
83
85
|
const userAgentInfo = {
|
|
84
|
-
version:
|
|
86
|
+
version: VERSION,
|
|
85
87
|
language: 'Javascript',
|
|
86
88
|
language_version: '',
|
|
87
89
|
publisher: 'Attlaz'
|
|
88
90
|
};
|
|
89
91
|
return {
|
|
90
|
-
'User-Agent': 'Attlaz Javascript Client/' +
|
|
92
|
+
'User-Agent': 'Attlaz Javascript Client/' + VERSION,
|
|
91
93
|
'X-Attlaz-Client-User-Agent': JSON.stringify(userAgentInfo)
|
|
92
94
|
};
|
|
93
95
|
}
|
|
@@ -200,8 +202,8 @@ class Client {
|
|
|
200
202
|
getHealthAlertEndpoint() {
|
|
201
203
|
return this.getEndpoint('healt-alert', this.Store.HealthAlertEndpoint);
|
|
202
204
|
}
|
|
203
|
-
|
|
204
|
-
return this.getEndpoint('code-source-
|
|
205
|
+
getCodeSourceStrategiesEndpoint() {
|
|
206
|
+
return this.getEndpoint('code-source-strategies', this.Store.CodeSourceStrategiesEndpoint);
|
|
205
207
|
}
|
|
206
208
|
getSearchEndpoint() {
|
|
207
209
|
return this.getEndpoint('search', this.Store.SearchEndpoint);
|
|
@@ -227,4 +229,3 @@ class Client {
|
|
|
227
229
|
return this.endpoints.get(key);
|
|
228
230
|
}
|
|
229
231
|
}
|
|
230
|
-
exports.Client = Client;
|
package/dist/Http/Data/Header.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|
|
@@ -1,10 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.QueryString = void 0;
|
|
4
|
-
class QueryString {
|
|
5
|
-
constructor() {
|
|
6
|
-
this.parameters = [];
|
|
7
|
-
}
|
|
1
|
+
export class QueryString {
|
|
2
|
+
parameters = [];
|
|
8
3
|
set(parameter, value) {
|
|
9
4
|
this.parameters.push({ parameter, value });
|
|
10
5
|
}
|
|
@@ -26,4 +21,3 @@ class QueryString {
|
|
|
26
21
|
return '?' + output.join('&');
|
|
27
22
|
}
|
|
28
23
|
}
|
|
29
|
-
exports.QueryString = QueryString;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { HttpClientRequest } from './HttpClientRequest';
|
|
2
|
-
import { HttpClientResponse } from './HttpClientResponse';
|
|
1
|
+
import { HttpClientRequest } from './HttpClientRequest.js';
|
|
2
|
+
import { HttpClientResponse } from './HttpClientResponse.js';
|
|
3
3
|
export declare class HttpClient {
|
|
4
4
|
static HTTP_BAD_REQUEST: number;
|
|
5
5
|
static HTTP_UNAUTHORIZED: number;
|
package/dist/Http/HttpClient.js
CHANGED
|
@@ -1,11 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
import { fetch } from 'popsicle';
|
|
2
|
+
import { HttpClientResponse } from './HttpClientResponse.js';
|
|
3
|
+
import { ClientError } from '../Model/Error/ClientError.js';
|
|
4
|
+
import { VERSION } from '../version.js';
|
|
5
|
+
export class HttpClient {
|
|
6
|
+
static HTTP_BAD_REQUEST = 400;
|
|
7
|
+
static HTTP_UNAUTHORIZED = 401;
|
|
8
|
+
static HTTP_FORBIDDEN = 403;
|
|
9
|
+
static HTTP_NOTFOUND = 404;
|
|
10
|
+
static HTTP_NOT_ALLOWED = 405;
|
|
11
|
+
static HTTP_UNPROCESSABLE_ENTITY = 422;
|
|
12
|
+
static HTTP_INTERNAL_SERVER_ERROR = 500;
|
|
13
|
+
static HTTP_BAD_GATEWAY = 502;
|
|
14
|
+
static HTTP_UNAVAILABLE = 503;
|
|
15
|
+
static HTTP_TIMEOUT = 504;
|
|
9
16
|
// public static async get(url: string, requestData: any = {}): Promise<any> {
|
|
10
17
|
// if (Utils.isNullOrUndefined(requestData)) {
|
|
11
18
|
// requestData = {};
|
|
@@ -24,7 +31,7 @@ class HttpClient {
|
|
|
24
31
|
static async request2(request) {
|
|
25
32
|
if (typeof window === 'undefined') {
|
|
26
33
|
// Add user agent when running in Node
|
|
27
|
-
request.headers['User-Agent'] = 'Attlaz Http/' +
|
|
34
|
+
request.headers['User-Agent'] = 'Attlaz Http/' + VERSION;
|
|
28
35
|
}
|
|
29
36
|
const rawRequest = {
|
|
30
37
|
url: request.getFullUrl(),
|
|
@@ -33,8 +40,8 @@ class HttpClient {
|
|
|
33
40
|
omitDefaultHeaders: true,
|
|
34
41
|
body: request.body
|
|
35
42
|
};
|
|
36
|
-
const response = await
|
|
37
|
-
const httpResponse = new
|
|
43
|
+
const response = await fetch(request.getFullUrl(), rawRequest);
|
|
44
|
+
const httpResponse = new HttpClientResponse(response.status, response.statusText);
|
|
38
45
|
let contentType = this.getContentType(response);
|
|
39
46
|
const rawData = await response.text();
|
|
40
47
|
if (contentType.type === 'application/json') {
|
|
@@ -44,7 +51,9 @@ class HttpClient {
|
|
|
44
51
|
jsonData = JSON.parse(rawData);
|
|
45
52
|
}
|
|
46
53
|
catch (e) {
|
|
47
|
-
console.error('Unable to parse response data to JSON', {
|
|
54
|
+
console.error('Unable to parse response data to JSON', {
|
|
55
|
+
statusText: httpResponse.statusText, error: e
|
|
56
|
+
});
|
|
48
57
|
}
|
|
49
58
|
}
|
|
50
59
|
httpResponse.body = jsonData;
|
|
@@ -52,7 +61,7 @@ class HttpClient {
|
|
|
52
61
|
else {
|
|
53
62
|
httpResponse.body = rawData;
|
|
54
63
|
}
|
|
55
|
-
const error =
|
|
64
|
+
const error = ClientError.byStatus(response.status, response.statusText);
|
|
56
65
|
if (error !== null && error !== undefined) {
|
|
57
66
|
error.body = httpResponse.body;
|
|
58
67
|
throw error;
|
|
@@ -80,14 +89,3 @@ class HttpClient {
|
|
|
80
89
|
return { type: input, options: null };
|
|
81
90
|
}
|
|
82
91
|
}
|
|
83
|
-
exports.HttpClient = HttpClient;
|
|
84
|
-
HttpClient.HTTP_BAD_REQUEST = 400;
|
|
85
|
-
HttpClient.HTTP_UNAUTHORIZED = 401;
|
|
86
|
-
HttpClient.HTTP_FORBIDDEN = 403;
|
|
87
|
-
HttpClient.HTTP_NOTFOUND = 404;
|
|
88
|
-
HttpClient.HTTP_NOT_ALLOWED = 405;
|
|
89
|
-
HttpClient.HTTP_UNPROCESSABLE_ENTITY = 422;
|
|
90
|
-
HttpClient.HTTP_INTERNAL_SERVER_ERROR = 500;
|
|
91
|
-
HttpClient.HTTP_BAD_GATEWAY = 502;
|
|
92
|
-
HttpClient.HTTP_UNAVAILABLE = 503;
|
|
93
|
-
HttpClient.HTTP_TIMEOUT = 504;
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
1
|
+
import { Utils } from '../Utils.js';
|
|
2
|
+
import { JsonSerializable } from '../Model/JsonSerializable.js';
|
|
3
|
+
export class HttpClientRequest {
|
|
4
|
+
static GET = 'GET';
|
|
5
|
+
static POST = 'POST';
|
|
6
|
+
static PUT = 'PUT';
|
|
7
|
+
method;
|
|
8
|
+
headers = {};
|
|
9
|
+
body = null;
|
|
10
|
+
urlObj;
|
|
7
11
|
constructor(url, method = HttpClientRequest.GET) {
|
|
8
|
-
this.headers = {};
|
|
9
|
-
this.body = null;
|
|
10
12
|
this.urlObj = new URL(url);
|
|
11
13
|
this.method = method;
|
|
12
14
|
}
|
|
@@ -14,7 +16,7 @@ class HttpClientRequest {
|
|
|
14
16
|
this.setHeader('Content-Type', 'application/json');
|
|
15
17
|
}
|
|
16
18
|
setBasicAuth(user, password) {
|
|
17
|
-
this.setHeader('Authorization', 'Basic ' +
|
|
19
|
+
this.setHeader('Authorization', 'Basic ' + Utils.base64encode(user + ':' + password));
|
|
18
20
|
}
|
|
19
21
|
setHeader(key, value) {
|
|
20
22
|
this.headers[key] = value;
|
|
@@ -24,7 +26,7 @@ class HttpClientRequest {
|
|
|
24
26
|
}
|
|
25
27
|
setJsonBody(data) {
|
|
26
28
|
this.setJsonHeader();
|
|
27
|
-
this.body =
|
|
29
|
+
this.body = JsonSerializable.stringify(data);
|
|
28
30
|
}
|
|
29
31
|
getFullUrl() {
|
|
30
32
|
let result = this.urlObj.href;
|
|
@@ -35,7 +37,3 @@ class HttpClientRequest {
|
|
|
35
37
|
return result;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
exports.HttpClientRequest = HttpClientRequest;
|
|
39
|
-
HttpClientRequest.GET = 'GET';
|
|
40
|
-
HttpClientRequest.POST = 'POST';
|
|
41
|
-
HttpClientRequest.PUT = 'PUT';
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export class HttpClientResponse {
|
|
2
|
+
status;
|
|
3
|
+
statusText;
|
|
4
|
+
body = null;
|
|
5
5
|
constructor(status, statusText) {
|
|
6
|
-
this.body = null;
|
|
7
6
|
this.status = status;
|
|
8
7
|
this.statusText = statusText;
|
|
9
8
|
}
|
|
10
9
|
}
|
|
11
|
-
exports.HttpClientResponse = HttpClientResponse;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { OAuthClientOptions } from './OAuthClientOptions';
|
|
2
|
-
import { OAuthClientToken } from './OAuthClientToken';
|
|
3
|
-
import { Parameters } from './Data/Parameters';
|
|
1
|
+
import { OAuthClientOptions } from './OAuthClientOptions.js';
|
|
2
|
+
import { OAuthClientToken } from './OAuthClientToken.js';
|
|
3
|
+
import { Parameters } from './Data/Parameters.js';
|
|
4
4
|
export declare class OAuthClient {
|
|
5
5
|
private readonly options;
|
|
6
6
|
private debug;
|
package/dist/Http/OAuthClient.js
CHANGED
|
@@ -1,23 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
class OAuthClient {
|
|
1
|
+
import { ClientError } from '../Model/Error/ClientError.js';
|
|
2
|
+
import { HttpClient } from './HttpClient.js';
|
|
3
|
+
import { HttpClientRequest } from './HttpClientRequest.js';
|
|
4
|
+
import { OAuthClientToken } from './OAuthClientToken.js';
|
|
5
|
+
import ClientOAuth2 from 'client-oauth2';
|
|
6
|
+
import { JsonSerializable } from '../Model/JsonSerializable.js';
|
|
7
|
+
export class OAuthClient {
|
|
8
|
+
options;
|
|
9
|
+
debug = false;
|
|
10
|
+
oauthClient;
|
|
11
|
+
oauthToken = null;
|
|
12
|
+
oathClientToken = null;
|
|
14
13
|
constructor(options) {
|
|
15
14
|
this.options = options;
|
|
16
|
-
this.
|
|
17
|
-
this.oauthToken = null;
|
|
18
|
-
this.oathClientToken = null;
|
|
19
|
-
this.refreshTokenPromise = null;
|
|
20
|
-
this.oauthClient = new client_oauth2_1.default({
|
|
15
|
+
this.oauthClient = new ClientOAuth2({
|
|
21
16
|
clientId: options.clientId,
|
|
22
17
|
clientSecret: options.clientSecret,
|
|
23
18
|
accessTokenUri: this.getUri(options.accessTokenUri),
|
|
@@ -48,9 +43,10 @@ class OAuthClient {
|
|
|
48
43
|
if (this.debug) {
|
|
49
44
|
console.debug('[Client] Error during authentication', e);
|
|
50
45
|
}
|
|
51
|
-
throw
|
|
46
|
+
throw ClientError.fromError(e);
|
|
52
47
|
}
|
|
53
48
|
}
|
|
49
|
+
refreshTokenPromise = null;
|
|
54
50
|
async refreshToken() {
|
|
55
51
|
if (this.debug) {
|
|
56
52
|
console.debug('[OAuthClient] refresh token');
|
|
@@ -64,7 +60,7 @@ class OAuthClient {
|
|
|
64
60
|
this.oathClientToken = this.tokenToOauthClientToken(this.oauthToken);
|
|
65
61
|
}
|
|
66
62
|
catch (e) {
|
|
67
|
-
throw
|
|
63
|
+
throw ClientError.fromError(e);
|
|
68
64
|
}
|
|
69
65
|
}
|
|
70
66
|
else {
|
|
@@ -79,12 +75,12 @@ class OAuthClient {
|
|
|
79
75
|
}
|
|
80
76
|
async request(action, parameters = null, method = 'GET', signWithOauthToken = true) {
|
|
81
77
|
if (signWithOauthToken && !this.isAuthenticated()) {
|
|
82
|
-
throw new
|
|
78
|
+
throw new ClientError('Unable to perform request, access token not provided');
|
|
83
79
|
}
|
|
84
80
|
else {
|
|
85
81
|
if (signWithOauthToken) {
|
|
86
82
|
if (this.oauthToken === null) {
|
|
87
|
-
throw new
|
|
83
|
+
throw new ClientError('Unable to perform request, access token not provided');
|
|
88
84
|
}
|
|
89
85
|
if (signWithOauthToken && this.oauthToken.expired()) {
|
|
90
86
|
if (this.refreshTokenPromise === null) {
|
|
@@ -102,14 +98,14 @@ class OAuthClient {
|
|
|
102
98
|
console.debug('[OAuthClient] Request: ' + requestData.method.toUpperCase() + ' ' + requestData.getFullUrl());
|
|
103
99
|
}
|
|
104
100
|
try {
|
|
105
|
-
const response = await
|
|
101
|
+
const response = await HttpClient.request2(requestData);
|
|
106
102
|
// if (this.debug) {
|
|
107
103
|
// console.info('[Client response] ', {body: response.body});
|
|
108
104
|
// }
|
|
109
105
|
return response.body;
|
|
110
106
|
}
|
|
111
107
|
catch (error) {
|
|
112
|
-
const clientError =
|
|
108
|
+
const clientError = ClientError.fromError(error);
|
|
113
109
|
if (this.debug) {
|
|
114
110
|
console.error('[Client] Error:', { error, clientError });
|
|
115
111
|
}
|
|
@@ -161,7 +157,7 @@ class OAuthClient {
|
|
|
161
157
|
return this.oauthClient.token.getUri(options === null ? undefined : options);
|
|
162
158
|
}
|
|
163
159
|
tokenToOauthClientToken(oauthToken) {
|
|
164
|
-
const token = new
|
|
160
|
+
const token = new OAuthClientToken(oauthToken.accessToken, oauthToken.tokenType, oauthToken.refreshToken, oauthToken.data.scopes);
|
|
165
161
|
const rawTokenExpires = oauthToken.expires;
|
|
166
162
|
if (rawTokenExpires !== null && rawTokenExpires !== undefined) {
|
|
167
163
|
token.expires = rawTokenExpires;
|
|
@@ -176,10 +172,10 @@ class OAuthClient {
|
|
|
176
172
|
}
|
|
177
173
|
createRequestData(action, parameters = null, method = 'GET', signWithOauthToken = true) {
|
|
178
174
|
const url = this.getUri(action);
|
|
179
|
-
let requestData = new
|
|
175
|
+
let requestData = new HttpClientRequest(url, method);
|
|
180
176
|
if ((method === 'POST' || method === 'DELETE' || method === 'PUT') && parameters !== null && parameters !== undefined) {
|
|
181
177
|
if (typeof parameters === 'object') {
|
|
182
|
-
requestData.body =
|
|
178
|
+
requestData.body = JsonSerializable.stringify(parameters);
|
|
183
179
|
}
|
|
184
180
|
else if (typeof parameters === 'string') {
|
|
185
181
|
requestData.body = parameters;
|
|
@@ -198,7 +194,7 @@ class OAuthClient {
|
|
|
198
194
|
}
|
|
199
195
|
if (signWithOauthToken) {
|
|
200
196
|
if (this.oauthToken === null) {
|
|
201
|
-
throw new
|
|
197
|
+
throw new ClientError('Unable to perform request, access token not provided');
|
|
202
198
|
}
|
|
203
199
|
if (this.oauthToken.expired()) {
|
|
204
200
|
throw new Error('Unable to sign request, token is expired');
|
|
@@ -211,7 +207,7 @@ class OAuthClient {
|
|
|
211
207
|
}
|
|
212
208
|
signRequest(requestObject) {
|
|
213
209
|
if (this.oathClientToken === null) {
|
|
214
|
-
throw new
|
|
210
|
+
throw new ClientError('Unable to sign request, access token not provided');
|
|
215
211
|
}
|
|
216
212
|
const tokenType = this.oathClientToken.token_type;
|
|
217
213
|
const accessToken = this.oathClientToken.access_token;
|
|
@@ -228,4 +224,3 @@ class OAuthClient {
|
|
|
228
224
|
return requestObject;
|
|
229
225
|
}
|
|
230
226
|
}
|
|
231
|
-
exports.OAuthClient = OAuthClient;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
export class OAuthClientOptions {
|
|
2
|
+
apiEndpoint;
|
|
3
|
+
clientId;
|
|
4
|
+
clientSecret;
|
|
5
|
+
accessTokenUri = 'oauth/token';
|
|
6
|
+
authorizationUri = 'oauth/authorize';
|
|
7
|
+
redirectUri = 'https://example.com/auth/github/callback';
|
|
8
|
+
scopes = ['all'];
|
|
9
|
+
state = 'xyz';
|
|
10
|
+
headers;
|
|
5
11
|
constructor(apiEndpoint, clientId, clientSecret, headers) {
|
|
6
|
-
this.accessTokenUri = 'oauth/token';
|
|
7
|
-
this.authorizationUri = 'oauth/authorize';
|
|
8
|
-
this.redirectUri = 'https://example.com/auth/github/callback';
|
|
9
|
-
this.scopes = ['all'];
|
|
10
|
-
this.state = 'xyz';
|
|
11
12
|
this.apiEndpoint = apiEndpoint;
|
|
12
13
|
this.clientId = clientId;
|
|
13
14
|
this.clientSecret = clientSecret;
|
|
14
15
|
this.headers = headers;
|
|
15
16
|
}
|
|
16
17
|
}
|
|
17
|
-
exports.OAuthClientOptions = OAuthClientOptions;
|