@attlaz/client 1.77.1
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 +30 -0
- package/dist/AttlazResource.d.ts +3 -0
- package/dist/AttlazResource.js +4 -0
- package/dist/Client.d.ts +114 -0
- package/dist/Client.js +278 -0
- package/dist/Core/MetaDataAware.d.ts +11 -0
- package/dist/Core/MetaDataAware.js +27 -0
- package/dist/Core/MetaDataWithIconAware.d.ts +13 -0
- package/dist/Core/MetaDataWithIconAware.js +26 -0
- package/dist/Helper/LoadAllHelper.d.ts +8 -0
- package/dist/Helper/LoadAllHelper.js +25 -0
- package/dist/Helper/ResponseParser.d.ts +2 -0
- package/dist/Helper/ResponseParser.js +2 -0
- package/dist/Http/ClientError.d.ts +22 -0
- package/dist/Http/ClientError.js +79 -0
- package/dist/Http/ContentTypeHelper.d.ts +6 -0
- package/dist/Http/ContentTypeHelper.js +13 -0
- package/dist/Http/Data/Headers.d.ts +3 -0
- package/dist/Http/Data/Headers.js +1 -0
- package/dist/Http/Data/Parameters.d.ts +3 -0
- package/dist/Http/Data/Parameters.js +1 -0
- package/dist/Http/Data/QueryString.d.ts +18 -0
- package/dist/Http/Data/QueryString.js +67 -0
- package/dist/Http/HttpClient.d.ts +5 -0
- package/dist/Http/HttpClient.js +54 -0
- package/dist/Http/HttpClientRequest.d.ts +17 -0
- package/dist/Http/HttpClientRequest.js +39 -0
- package/dist/Http/HttpClientResponse.d.ts +8 -0
- package/dist/Http/HttpClientResponse.js +10 -0
- package/dist/Http/HttpStatus.d.ts +13 -0
- package/dist/Http/HttpStatus.js +13 -0
- package/dist/Http/OAuthClientOptions.d.ts +11 -0
- package/dist/Http/OAuthClientOptions.js +15 -0
- package/dist/Http/OAuthClientToken.d.ts +11 -0
- package/dist/Http/OAuthClientToken.js +32 -0
- package/dist/Http/Transport/DirectTransport.d.ts +41 -0
- package/dist/Http/Transport/DirectTransport.js +83 -0
- package/dist/Http/Transport/ITransport.d.ts +13 -0
- package/dist/Http/Transport/ITransport.js +1 -0
- package/dist/Http/Transport/OAuthClient.d.ts +45 -0
- package/dist/Http/Transport/OAuthClient.js +315 -0
- package/dist/Model/AccessToken/UserAccessToken.d.ts +15 -0
- package/dist/Model/AccessToken/UserAccessToken.js +28 -0
- package/dist/Model/AccessToken/UserAccessTokenStatus.d.ts +11 -0
- package/dist/Model/AccessToken/UserAccessTokenStatus.js +12 -0
- package/dist/Model/Adapter/Adapter.d.ts +14 -0
- package/dist/Model/Adapter/Adapter.js +28 -0
- package/dist/Model/Adapter/AdapterCategory.d.ts +6 -0
- package/dist/Model/Adapter/AdapterCategory.js +12 -0
- package/dist/Model/Adapter/AdapterConfiguration.d.ts +12 -0
- package/dist/Model/Adapter/AdapterConfiguration.js +22 -0
- package/dist/Model/Adapter/AdapterConnection.d.ts +15 -0
- package/dist/Model/Adapter/AdapterConnection.js +24 -0
- package/dist/Model/Adapter/AdapterConnectionConfigurationValue.d.ts +7 -0
- package/dist/Model/Adapter/AdapterConnectionConfigurationValue.js +6 -0
- package/dist/Model/Adapter/AdapterConnectionEvent.d.ts +9 -0
- package/dist/Model/Adapter/AdapterConnectionEvent.js +18 -0
- package/dist/Model/Adapter/AdapterConnectionStatus.d.ts +9 -0
- package/dist/Model/Adapter/AdapterConnectionStatus.js +20 -0
- package/dist/Model/Adapter/TestConnectionResult.d.ts +33 -0
- package/dist/Model/Adapter/TestConnectionResult.js +19 -0
- package/dist/Model/ApiRecord.d.ts +1 -0
- package/dist/Model/ApiRecord.js +1 -0
- package/dist/Model/Collections/Collection.d.ts +13 -0
- package/dist/Model/Collections/Collection.js +15 -0
- package/dist/Model/Collections/CollectionRecord.d.ts +6 -0
- package/dist/Model/Collections/CollectionRecord.js +12 -0
- package/dist/Model/Command/CommandExecutionFilter.d.ts +6 -0
- package/dist/Model/Command/CommandExecutionFilter.js +1 -0
- package/dist/Model/Command/CommandExecutionHistory.d.ts +15 -0
- package/dist/Model/Command/CommandExecutionHistory.js +15 -0
- package/dist/Model/Command/CommandExecutionStatus.d.ts +9 -0
- package/dist/Model/Command/CommandExecutionStatus.js +20 -0
- package/dist/Model/Config.d.ts +17 -0
- package/dist/Model/Config.js +31 -0
- package/dist/Model/Configuration/Configuration.d.ts +10 -0
- package/dist/Model/Configuration/Configuration.js +17 -0
- package/dist/Model/DataValue.d.ts +6 -0
- package/dist/Model/DataValue.js +8 -0
- package/dist/Model/DataValueCollection.d.ts +17 -0
- package/dist/Model/DataValueCollection.js +61 -0
- package/dist/Model/Deployment/CodeSource.d.ts +24 -0
- package/dist/Model/Deployment/CodeSource.js +32 -0
- package/dist/Model/Deployment/CodeSourceAccount.d.ts +13 -0
- package/dist/Model/Deployment/CodeSourceAccount.js +25 -0
- package/dist/Model/Deployment/CodeSourceBuildStrategy.d.ts +10 -0
- package/dist/Model/Deployment/CodeSourceBuildStrategy.js +17 -0
- package/dist/Model/Deployment/CodeSourceRunStrategy.d.ts +10 -0
- package/dist/Model/Deployment/CodeSourceRunStrategy.js +17 -0
- package/dist/Model/Deployment/SourcesAccountRepository.d.ts +7 -0
- package/dist/Model/Deployment/SourcesAccountRepository.js +14 -0
- package/dist/Model/Deployment/SourcesAccountRepositoryBranch.d.ts +4 -0
- package/dist/Model/Deployment/SourcesAccountRepositoryBranch.js +8 -0
- package/dist/Model/EntityId.d.ts +9 -0
- package/dist/Model/EntityId.js +27 -0
- package/dist/Model/EntityType.d.ts +25 -0
- package/dist/Model/EntityType.js +33 -0
- package/dist/Model/Error/ApiError.d.ts +14 -0
- package/dist/Model/Error/ApiError.js +16 -0
- package/dist/Model/Event/EventType.d.ts +17 -0
- package/dist/Model/Event/EventType.js +18 -0
- package/dist/Model/Filter/FilterNode.d.ts +18 -0
- package/dist/Model/Filter/FilterNode.js +1 -0
- package/dist/Model/Filter/FilterOperator.d.ts +1 -0
- package/dist/Model/Filter/FilterOperator.js +1 -0
- package/dist/Model/Flow/Flow.d.ts +17 -0
- package/dist/Model/Flow/Flow.js +27 -0
- package/dist/Model/Flow/FlowRun.d.ts +18 -0
- package/dist/Model/Flow/FlowRun.js +32 -0
- package/dist/Model/Flow/FlowRunHistory.d.ts +8 -0
- package/dist/Model/Flow/FlowRunHistory.js +14 -0
- package/dist/Model/Flow/FlowRunHistoryStatus.d.ts +16 -0
- package/dist/Model/Flow/FlowRunHistoryStatus.js +24 -0
- package/dist/Model/Flow/FlowRunLifecycle.d.ts +16 -0
- package/dist/Model/Flow/FlowRunLifecycle.js +24 -0
- package/dist/Model/Flow/FlowRunPriority.d.ts +9 -0
- package/dist/Model/Flow/FlowRunPriority.js +17 -0
- package/dist/Model/Flow/FlowRunResponse.d.ts +5 -0
- package/dist/Model/Flow/FlowRunResponse.js +6 -0
- package/dist/Model/Flow/FlowRunStats.d.ts +13 -0
- package/dist/Model/Flow/FlowRunStats.js +27 -0
- package/dist/Model/Flow/FlowRunStatus.d.ts +12 -0
- package/dist/Model/Flow/FlowRunStatus.js +20 -0
- package/dist/Model/Flow/FlowRunSummary.d.ts +17 -0
- package/dist/Model/Flow/FlowRunSummary.js +33 -0
- package/dist/Model/Flow/FlowSummary.d.ts +11 -0
- package/dist/Model/Flow/FlowSummary.js +21 -0
- package/dist/Model/Flow/FlowTemplate.d.ts +10 -0
- package/dist/Model/Flow/FlowTemplate.js +10 -0
- package/dist/Model/HealthAlert/HealthAlert.d.ts +17 -0
- package/dist/Model/HealthAlert/HealthAlert.js +34 -0
- package/dist/Model/HealthAlert/HealthAlertSeverity.d.ts +8 -0
- package/dist/Model/HealthAlert/HealthAlertSeverity.js +16 -0
- package/dist/Model/HealthAlert/HealthAlertStatus.d.ts +8 -0
- package/dist/Model/HealthAlert/HealthAlertStatus.js +16 -0
- package/dist/Model/HealthAlert/HealthTestType.d.ts +14 -0
- package/dist/Model/HealthAlert/HealthTestType.js +22 -0
- package/dist/Model/Inbox/InboxMessage.d.ts +10 -0
- package/dist/Model/Inbox/InboxMessage.js +21 -0
- package/dist/Model/Infrastructure/RunnerPool.d.ts +39 -0
- package/dist/Model/Infrastructure/RunnerPool.js +77 -0
- package/dist/Model/InfrastructureStatus/QueueStatus.d.ts +11 -0
- package/dist/Model/InfrastructureStatus/QueueStatus.js +11 -0
- package/dist/Model/InfrastructureStatus/RunnersStatus.d.ts +9 -0
- package/dist/Model/InfrastructureStatus/RunnersStatus.js +9 -0
- package/dist/Model/InfrastructureStatus/StorageStatus.d.ts +13 -0
- package/dist/Model/InfrastructureStatus/StorageStatus.js +7 -0
- package/dist/Model/JsonSerializable.d.ts +6 -0
- package/dist/Model/JsonSerializable.js +12 -0
- package/dist/Model/Log/Log.d.ts +17 -0
- package/dist/Model/Log/Log.js +37 -0
- package/dist/Model/Log/LogLevel.d.ts +15 -0
- package/dist/Model/Log/LogLevel.js +54 -0
- package/dist/Model/Log/LogQuery.d.ts +26 -0
- package/dist/Model/Log/LogQuery.js +15 -0
- package/dist/Model/Log/LogStatus.d.ts +8 -0
- package/dist/Model/Log/LogStatus.js +16 -0
- package/dist/Model/Log/LogStream.d.ts +6 -0
- package/dist/Model/Log/LogStream.js +8 -0
- package/dist/Model/Log/LogStreamId.d.ts +5 -0
- package/dist/Model/Log/LogStreamId.js +7 -0
- package/dist/Model/Log/LogStreamInformation.d.ts +18 -0
- package/dist/Model/Log/LogStreamInformation.js +58 -0
- package/dist/Model/Messaging/Channel/Channel.d.ts +16 -0
- package/dist/Model/Messaging/Channel/Channel.js +31 -0
- package/dist/Model/Messaging/Channel/ChannelData.d.ts +6 -0
- package/dist/Model/Messaging/Channel/ChannelData.js +9 -0
- package/dist/Model/Messaging/Channel/ChannelType.d.ts +10 -0
- package/dist/Model/Messaging/Channel/ChannelType.js +18 -0
- package/dist/Model/Messaging/Channel/EmailChannelData.d.ts +5 -0
- package/dist/Model/Messaging/Channel/EmailChannelData.js +9 -0
- package/dist/Model/Messaging/Channel/PushChannelData.d.ts +5 -0
- package/dist/Model/Messaging/Channel/PushChannelData.js +9 -0
- package/dist/Model/Messaging/Channel/SlackChannelData.d.ts +10 -0
- package/dist/Model/Messaging/Channel/SlackChannelData.js +19 -0
- package/dist/Model/Messaging/Channel/SmsChannelData.d.ts +5 -0
- package/dist/Model/Messaging/Channel/SmsChannelData.js +9 -0
- package/dist/Model/Messaging/Channel/WebhookChannelData.d.ts +6 -0
- package/dist/Model/Messaging/Channel/WebhookChannelData.js +11 -0
- package/dist/Model/Messaging/ChannelHistory.d.ts +10 -0
- package/dist/Model/Messaging/ChannelHistory.js +31 -0
- package/dist/Model/Messaging/Subscriber.d.ts +19 -0
- package/dist/Model/Messaging/Subscriber.js +35 -0
- package/dist/Model/Pagination/CursorPagination.d.ts +5 -0
- package/dist/Model/Pagination/CursorPagination.js +5 -0
- package/dist/Model/Pagination/Filters.d.ts +20 -0
- package/dist/Model/Pagination/Filters.js +33 -0
- package/dist/Model/Project/CodeDeploy.d.ts +28 -0
- package/dist/Model/Project/CodeDeploy.js +57 -0
- package/dist/Model/Project/CodeDeployStatus.d.ts +12 -0
- package/dist/Model/Project/CodeDeployStatus.js +20 -0
- package/dist/Model/Project/PlatformLanguage.d.ts +11 -0
- package/dist/Model/Project/PlatformLanguage.js +19 -0
- package/dist/Model/Project/Project.d.ts +13 -0
- package/dist/Model/Project/Project.js +26 -0
- package/dist/Model/Project/ProjectDeployCommit.d.ts +7 -0
- package/dist/Model/Project/ProjectDeployCommit.js +7 -0
- package/dist/Model/Project/ProjectEnvironment.d.ts +16 -0
- package/dist/Model/Project/ProjectEnvironment.js +25 -0
- package/dist/Model/Project/ProjectEnvironmentType.d.ts +8 -0
- package/dist/Model/Project/ProjectEnvironmentType.js +16 -0
- package/dist/Model/ProviderToken/ProviderToken.d.ts +11 -0
- package/dist/Model/ProviderToken/ProviderToken.js +12 -0
- package/dist/Model/ProviderToken/ProviderTokenAccessToken.d.ts +6 -0
- package/dist/Model/ProviderToken/ProviderTokenAccessToken.js +11 -0
- package/dist/Model/Result/CollectionResult.d.ts +7 -0
- package/dist/Model/Result/CollectionResult.js +27 -0
- package/dist/Model/Result/ObjectResult.d.ts +5 -0
- package/dist/Model/Result/ObjectResult.js +21 -0
- package/dist/Model/Result/ObjectWrapper.d.ts +3 -0
- package/dist/Model/Result/ObjectWrapper.js +20 -0
- package/dist/Model/Result/ResultError.d.ts +4 -0
- package/dist/Model/Result/ResultError.js +6 -0
- package/dist/Model/Runner/RunnerImage.d.ts +13 -0
- package/dist/Model/Runner/RunnerImage.js +12 -0
- package/dist/Model/Search/SearchResult.d.ts +23 -0
- package/dist/Model/Search/SearchResult.js +94 -0
- package/dist/Model/State.d.ts +8 -0
- package/dist/Model/State.js +16 -0
- package/dist/Model/StateAware.d.ts +4 -0
- package/dist/Model/StateAware.js +1 -0
- package/dist/Model/Storage/StorageInformation.d.ts +10 -0
- package/dist/Model/Storage/StorageInformation.js +7 -0
- package/dist/Model/Storage/StorageItem.d.ts +9 -0
- package/dist/Model/Storage/StorageItem.js +21 -0
- package/dist/Model/Storage/StorageItemInformation.d.ts +8 -0
- package/dist/Model/Storage/StorageItemInformation.js +19 -0
- package/dist/Model/Storage/StorageType.d.ts +9 -0
- package/dist/Model/Storage/StorageType.js +17 -0
- package/dist/Model/Trigger/Trigger.d.ts +18 -0
- package/dist/Model/Trigger/Trigger.js +34 -0
- package/dist/Model/User/User.d.ts +18 -0
- package/dist/Model/User/User.js +33 -0
- package/dist/Model/User/UserAction.d.ts +14 -0
- package/dist/Model/User/UserAction.js +13 -0
- package/dist/Model/User/UserActionFilter.d.ts +10 -0
- package/dist/Model/User/UserActionFilter.js +1 -0
- package/dist/Model/User/UserAuthProvider.d.ts +12 -0
- package/dist/Model/User/UserAuthProvider.js +22 -0
- package/dist/Model/User/UserNotificationSession.d.ts +13 -0
- package/dist/Model/User/UserNotificationSession.js +11 -0
- package/dist/Model/User/UserSummary.d.ts +13 -0
- package/dist/Model/User/UserSummary.js +11 -0
- package/dist/Model/Worker/InfrastructureConfiguration.d.ts +16 -0
- package/dist/Model/Worker/InfrastructureConfiguration.js +20 -0
- package/dist/Model/Worker/Platform.d.ts +13 -0
- package/dist/Model/Worker/Platform.js +24 -0
- package/dist/Model/Worker/PlatformImage.d.ts +13 -0
- package/dist/Model/Worker/PlatformImage.js +24 -0
- package/dist/Model/Workspace/Workspace.d.ts +10 -0
- package/dist/Model/Workspace/Workspace.js +14 -0
- package/dist/Model/Workspace/WorkspaceMember.d.ts +14 -0
- package/dist/Model/Workspace/WorkspaceMember.js +32 -0
- package/dist/Model/Workspace/WorkspaceMemberInvite.d.ts +13 -0
- package/dist/Model/Workspace/WorkspaceMemberInvite.js +13 -0
- package/dist/Model/Workspace/WorkspaceMemberInvite2.d.ts +10 -0
- package/dist/Model/Workspace/WorkspaceMemberInvite2.js +19 -0
- package/dist/Model/Workspace/WorkspaceMemberInviteState.d.ts +11 -0
- package/dist/Model/Workspace/WorkspaceMemberInviteState.js +19 -0
- package/dist/Model/Workspace/WorkspaceMemberRole.d.ts +4 -0
- package/dist/Model/Workspace/WorkspaceMemberRole.js +4 -0
- package/dist/ResourceNamespace.d.ts +2 -0
- package/dist/ResourceNamespace.js +2 -0
- package/dist/Service/AccessTokenEndpoint.d.ts +11 -0
- package/dist/Service/AccessTokenEndpoint.js +82 -0
- package/dist/Service/AdapterConnectionEndpoint.d.ts +28 -0
- package/dist/Service/AdapterConnectionEndpoint.js +124 -0
- package/dist/Service/AdapterEndpoint.d.ts +12 -0
- package/dist/Service/AdapterEndpoint.js +64 -0
- package/dist/Service/ChannelEndpoint.d.ts +13 -0
- package/dist/Service/ChannelEndpoint.js +96 -0
- package/dist/Service/CodeDeployEndpoint.d.ts +9 -0
- package/dist/Service/CodeDeployEndpoint.js +56 -0
- package/dist/Service/CodeSourceStrategiesEndpoint.d.ts +8 -0
- package/dist/Service/CodeSourceStrategiesEndpoint.js +13 -0
- package/dist/Service/CollectionsEndpoint.d.ts +11 -0
- package/dist/Service/CollectionsEndpoint.js +54 -0
- package/dist/Service/CommandExecutionEndpoint.d.ts +14 -0
- package/dist/Service/CommandExecutionEndpoint.js +60 -0
- package/dist/Service/ConfigEndpoint.d.ts +8 -0
- package/dist/Service/ConfigEndpoint.js +46 -0
- package/dist/Service/ConfigurationEndpoint.d.ts +20 -0
- package/dist/Service/ConfigurationEndpoint.js +53 -0
- package/dist/Service/Endpoint.d.ts +16 -0
- package/dist/Service/Endpoint.js +185 -0
- package/dist/Service/FirewallEndpoint.d.ts +29 -0
- package/dist/Service/FirewallEndpoint.js +88 -0
- package/dist/Service/FlowEndpoint.d.ts +12 -0
- package/dist/Service/FlowEndpoint.js +84 -0
- package/dist/Service/FlowRunEndpoint.d.ts +21 -0
- package/dist/Service/FlowRunEndpoint.js +93 -0
- package/dist/Service/FlowRunRequestEndpoint.d.ts +6 -0
- package/dist/Service/FlowRunRequestEndpoint.js +32 -0
- package/dist/Service/FlowRunStatsEndpoint.d.ts +5 -0
- package/dist/Service/FlowRunStatsEndpoint.js +21 -0
- package/dist/Service/HealthAlertEndpoint.d.ts +13 -0
- package/dist/Service/HealthAlertEndpoint.js +36 -0
- package/dist/Service/InboxEndpoint.d.ts +8 -0
- package/dist/Service/InboxEndpoint.js +20 -0
- package/dist/Service/LogEndpoint.d.ts +18 -0
- package/dist/Service/LogEndpoint.js +127 -0
- package/dist/Service/PlatformEndpoint.d.ts +9 -0
- package/dist/Service/PlatformEndpoint.js +18 -0
- package/dist/Service/PlatformLanguageEndpoint.d.ts +6 -0
- package/dist/Service/PlatformLanguageEndpoint.js +7 -0
- package/dist/Service/ProjectEndpoint.d.ts +11 -0
- package/dist/Service/ProjectEndpoint.js +63 -0
- package/dist/Service/ProjectEnvironmentEndpoint.d.ts +8 -0
- package/dist/Service/ProjectEnvironmentEndpoint.js +48 -0
- package/dist/Service/ProviderTokenEndpoint.d.ts +16 -0
- package/dist/Service/ProviderTokenEndpoint.js +43 -0
- package/dist/Service/RunnerEndpoint.d.ts +6 -0
- package/dist/Service/RunnerEndpoint.js +28 -0
- package/dist/Service/RunnerPoolEndpoint.d.ts +9 -0
- package/dist/Service/RunnerPoolEndpoint.js +20 -0
- package/dist/Service/SearchEndpoint.d.ts +6 -0
- package/dist/Service/SearchEndpoint.js +14 -0
- package/dist/Service/SourcesAccountEndpoint.d.ts +16 -0
- package/dist/Service/SourcesAccountEndpoint.js +85 -0
- package/dist/Service/StorageEndpoint.d.ts +20 -0
- package/dist/Service/StorageEndpoint.js +130 -0
- package/dist/Service/SubscriberEndpoint.d.ts +9 -0
- package/dist/Service/SubscriberEndpoint.js +29 -0
- package/dist/Service/TriggerEndpoint.d.ts +10 -0
- package/dist/Service/TriggerEndpoint.js +67 -0
- package/dist/Service/UserActionEndpoint.d.ts +16 -0
- package/dist/Service/UserActionEndpoint.js +96 -0
- package/dist/Service/UserEndpoint.d.ts +29 -0
- package/dist/Service/UserEndpoint.js +178 -0
- package/dist/Service/WorkspaceEndpoint.d.ts +9 -0
- package/dist/Service/WorkspaceEndpoint.js +49 -0
- package/dist/Service/WorkspaceMemberEndpoint.d.ts +14 -0
- package/dist/Service/WorkspaceMemberEndpoint.js +77 -0
- package/dist/Utils.d.ts +11 -0
- package/dist/Utils.js +68 -0
- package/dist/index.d.ts +169 -0
- package/dist/index.js +154 -0
- package/dist/main.d.ts +1 -0
- package/dist/main.js +1 -0
- package/dist/version.d.ts +1 -0
- package/dist/version.js +1 -0
- package/package.json +72 -0
package/README.md
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
Attlaz Javascript/Node client
|
|
2
|
+
==========
|
|
3
|
+
|
|
4
|
+
[Attlaz](https://attlaz.com) is a cloud-based iPaas (Integration Platform as a Service), automation and data management
|
|
5
|
+
platform.
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@attlaz/client)
|
|
8
|
+
|
|
9
|
+
Getting Started
|
|
10
|
+
---------------
|
|
11
|
+
|
|
12
|
+
Install Attlaz using `yarn`:
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
yarn add attlaz-client
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
Or npm, if you wish:
|
|
19
|
+
|
|
20
|
+
```bash
|
|
21
|
+
npm install attlaz-client
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Getting Help
|
|
25
|
+
------------
|
|
26
|
+
|
|
27
|
+
* [Issue Tracker](https://github.com/Attlaz-Platform) for questions, feature requests, bug reports and
|
|
28
|
+
general discussion related to these packages. Try searching before you create a new issue.
|
|
29
|
+
* Check the [Attlaz Documentation](https://docs.attlaz.com).
|
|
30
|
+
* [Email us](developers@attlaz.com) in Attlaz developer support: `developers@attlaz.com`
|
package/dist/Client.d.ts
ADDED
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import { OAuthClientToken } from './Http/OAuthClientToken.js';
|
|
2
|
+
import { ITransport, ParseErrorHandler } from './Http/Transport/ITransport.js';
|
|
3
|
+
import { OAuthClient } from './Http/Transport/OAuthClient.js';
|
|
4
|
+
import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
|
|
5
|
+
import { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
|
|
6
|
+
import { AdapterEndpoint } from './Service/AdapterEndpoint.js';
|
|
7
|
+
import { ChannelEndpoint } from './Service/ChannelEndpoint.js';
|
|
8
|
+
import { CodeDeployEndpoint } from './Service/CodeDeployEndpoint.js';
|
|
9
|
+
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
10
|
+
import { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
|
|
11
|
+
import { CommandExecutionEndpoint } from './Service/CommandExecutionEndpoint.js';
|
|
12
|
+
import { ConfigEndpoint } from './Service/ConfigEndpoint.js';
|
|
13
|
+
import { ConfigurationEndpoint } from './Service/ConfigurationEndpoint.js';
|
|
14
|
+
import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
|
|
15
|
+
import { FlowEndpoint } from './Service/FlowEndpoint.js';
|
|
16
|
+
import { FlowRunEndpoint } from './Service/FlowRunEndpoint.js';
|
|
17
|
+
import { FlowRunRequestEndpoint } from './Service/FlowRunRequestEndpoint.js';
|
|
18
|
+
import { FlowRunStatsEndpoint } from './Service/FlowRunStatsEndpoint.js';
|
|
19
|
+
import { HealthAlertEndpoint } from './Service/HealthAlertEndpoint.js';
|
|
20
|
+
import { InboxEndpoint } from './Service/InboxEndpoint.js';
|
|
21
|
+
import { LogEndpoint } from './Service/LogEndpoint.js';
|
|
22
|
+
import { PlatformEndpoint } from './Service/PlatformEndpoint.js';
|
|
23
|
+
import { PlatformLanguageEndpoint } from './Service/PlatformLanguageEndpoint.js';
|
|
24
|
+
import { ProjectEndpoint } from './Service/ProjectEndpoint.js';
|
|
25
|
+
import { ProjectEnvironmentEndpoint } from './Service/ProjectEnvironmentEndpoint.js';
|
|
26
|
+
import { ProviderTokenEndpoint } from './Service/ProviderTokenEndpoint.js';
|
|
27
|
+
import { RunnerEndpoint } from './Service/RunnerEndpoint.js';
|
|
28
|
+
import { RunnerPoolEndpoint } from './Service/RunnerPoolEndpoint.js';
|
|
29
|
+
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
30
|
+
import { SourcesAccountEndpoint } from './Service/SourcesAccountEndpoint.js';
|
|
31
|
+
import { StorageEndpoint } from './Service/StorageEndpoint.js';
|
|
32
|
+
import { SubscriberEndpoint } from './Service/SubscriberEndpoint.js';
|
|
33
|
+
import { TriggerEndpoint } from './Service/TriggerEndpoint.js';
|
|
34
|
+
import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
|
|
35
|
+
import { UserEndpoint } from './Service/UserEndpoint.js';
|
|
36
|
+
import { WorkspaceEndpoint } from './Service/WorkspaceEndpoint.js';
|
|
37
|
+
import { WorkspaceMemberEndpoint } from './Service/WorkspaceMemberEndpoint.js';
|
|
38
|
+
export declare class Client {
|
|
39
|
+
private readonly endpoints;
|
|
40
|
+
private httpClient;
|
|
41
|
+
private transport;
|
|
42
|
+
private readonly Store;
|
|
43
|
+
private readonly apiEndpoint;
|
|
44
|
+
constructor(token?: string | null, config?: {
|
|
45
|
+
apiEndpoint?: string;
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* Create a Client that uses a custom transport instead of OAuth.
|
|
49
|
+
* Intended for internal service-to-service calls (e.g. using DirectTransport).
|
|
50
|
+
*/
|
|
51
|
+
static withTransport(transport: ITransport, config?: {
|
|
52
|
+
apiEndpoint: string | undefined;
|
|
53
|
+
}): Client;
|
|
54
|
+
setClientCredentials(clientId: string, clientSecret?: string): void;
|
|
55
|
+
/**
|
|
56
|
+
* Configure this client as a public OAuth client (no client_secret).
|
|
57
|
+
* Used for SPAs and other public clients that cannot keep a secret.
|
|
58
|
+
*/
|
|
59
|
+
setPublicClient(clientId: string): void;
|
|
60
|
+
setVersion(version: string | null): void;
|
|
61
|
+
getHttpClient(): OAuthClient;
|
|
62
|
+
/**
|
|
63
|
+
* Set a handler for non-fatal response parse failures (schema drift). Defaults to
|
|
64
|
+
* console.error; wire this to your logger / error tracker to observe drift in production
|
|
65
|
+
* without breaking views. Pass null to restore the default. Set on the active transport,
|
|
66
|
+
* so it applies whether the client uses OAuth or a custom transport.
|
|
67
|
+
*/
|
|
68
|
+
setParseErrorHandler(handler: ParseErrorHandler | null): void;
|
|
69
|
+
authenticate(): Promise<boolean>;
|
|
70
|
+
authenticate(username: string, password: string): Promise<boolean>;
|
|
71
|
+
isAuthenticated(): boolean;
|
|
72
|
+
getToken(): OAuthClientToken | null;
|
|
73
|
+
setToken(token: OAuthClientToken): void;
|
|
74
|
+
unsetAccessToken(): void;
|
|
75
|
+
getApiInformation(): Promise<{
|
|
76
|
+
version: string;
|
|
77
|
+
}>;
|
|
78
|
+
getAdapterEndpoint(): AdapterEndpoint;
|
|
79
|
+
getAdapterConnectionEndpoint(): AdapterConnectionEndpoint;
|
|
80
|
+
getProjectEndpoint(): ProjectEndpoint;
|
|
81
|
+
getProjectEnvironmentEndpoint(): ProjectEnvironmentEndpoint;
|
|
82
|
+
getCodeDeployEndpoint(): CodeDeployEndpoint;
|
|
83
|
+
getChannelEndpoint(): ChannelEndpoint;
|
|
84
|
+
getConfigEndpoint(): ConfigEndpoint;
|
|
85
|
+
getInboxEndpoint(): InboxEndpoint;
|
|
86
|
+
getPlatformEndpoint(): PlatformEndpoint;
|
|
87
|
+
getSubscriberEndpoint(): SubscriberEndpoint;
|
|
88
|
+
getLogEndPoint(): LogEndpoint;
|
|
89
|
+
getFlowEndpoint(): FlowEndpoint;
|
|
90
|
+
getFlowRunEndpoint(): FlowRunEndpoint;
|
|
91
|
+
getFlowRunRequestEndpoint(): FlowRunRequestEndpoint;
|
|
92
|
+
getFlowRunStatsEndpoint(): FlowRunStatsEndpoint;
|
|
93
|
+
getWorkspaceEndpoint(): WorkspaceEndpoint;
|
|
94
|
+
getTriggerEndpoint(): TriggerEndpoint;
|
|
95
|
+
getUserEndpoint(): UserEndpoint;
|
|
96
|
+
getWorkspaceMemberEndpoint(): WorkspaceMemberEndpoint;
|
|
97
|
+
getRunnerEndpoint(): RunnerEndpoint;
|
|
98
|
+
getSourcesAccountEndpoint(): SourcesAccountEndpoint;
|
|
99
|
+
getLanguageEndpoint(): PlatformLanguageEndpoint;
|
|
100
|
+
getStorageEndpoint(): StorageEndpoint;
|
|
101
|
+
getConfigurationEndpoint(): ConfigurationEndpoint;
|
|
102
|
+
getHealthAlertEndpoint(): HealthAlertEndpoint;
|
|
103
|
+
getCodeSourceStrategiesEndpoint(): CodeSourceStrategiesEndpoint;
|
|
104
|
+
getSearchEndpoint(): SearchEndpoint;
|
|
105
|
+
getUserActionEndpoint(): UserActionEndpoint;
|
|
106
|
+
getCommandExecutionEndpoint(): CommandExecutionEndpoint;
|
|
107
|
+
getAccessTokenEndpoint(): AccessTokenEndpoint;
|
|
108
|
+
getCollectionsEndpoint(): CollectionsEndpoint;
|
|
109
|
+
getRunnerPoolEndpoint(): RunnerPoolEndpoint;
|
|
110
|
+
getProviderTokenEndpoint(): ProviderTokenEndpoint;
|
|
111
|
+
getFirewallEndpoint(): FirewallEndpoint;
|
|
112
|
+
private getEndpoint;
|
|
113
|
+
getVersion(): string;
|
|
114
|
+
}
|
package/dist/Client.js
ADDED
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { OAuthClientOptions } from './Http/OAuthClientOptions.js';
|
|
2
|
+
import { OAuthClientToken } from './Http/OAuthClientToken.js';
|
|
3
|
+
import { OAuthClient } from './Http/Transport/OAuthClient.js';
|
|
4
|
+
import { AccessTokenEndpoint } from './Service/AccessTokenEndpoint.js';
|
|
5
|
+
import { AdapterConnectionEndpoint } from './Service/AdapterConnectionEndpoint.js';
|
|
6
|
+
import { AdapterEndpoint } from './Service/AdapterEndpoint.js';
|
|
7
|
+
import { ChannelEndpoint } from './Service/ChannelEndpoint.js';
|
|
8
|
+
import { CodeDeployEndpoint } from './Service/CodeDeployEndpoint.js';
|
|
9
|
+
import { CodeSourceStrategiesEndpoint } from './Service/CodeSourceStrategiesEndpoint.js';
|
|
10
|
+
import { CollectionsEndpoint } from './Service/CollectionsEndpoint.js';
|
|
11
|
+
import { CommandExecutionEndpoint } from './Service/CommandExecutionEndpoint.js';
|
|
12
|
+
import { ConfigEndpoint } from './Service/ConfigEndpoint.js';
|
|
13
|
+
import { ConfigurationEndpoint } from './Service/ConfigurationEndpoint.js';
|
|
14
|
+
import { FirewallEndpoint } from './Service/FirewallEndpoint.js';
|
|
15
|
+
import { FlowEndpoint } from './Service/FlowEndpoint.js';
|
|
16
|
+
import { FlowRunEndpoint } from './Service/FlowRunEndpoint.js';
|
|
17
|
+
import { FlowRunRequestEndpoint } from './Service/FlowRunRequestEndpoint.js';
|
|
18
|
+
import { FlowRunStatsEndpoint } from './Service/FlowRunStatsEndpoint.js';
|
|
19
|
+
import { HealthAlertEndpoint } from './Service/HealthAlertEndpoint.js';
|
|
20
|
+
import { InboxEndpoint } from './Service/InboxEndpoint.js';
|
|
21
|
+
import { LogEndpoint } from './Service/LogEndpoint.js';
|
|
22
|
+
import { PlatformEndpoint } from './Service/PlatformEndpoint.js';
|
|
23
|
+
import { PlatformLanguageEndpoint } from './Service/PlatformLanguageEndpoint.js';
|
|
24
|
+
import { ProjectEndpoint } from './Service/ProjectEndpoint.js';
|
|
25
|
+
import { ProjectEnvironmentEndpoint } from './Service/ProjectEnvironmentEndpoint.js';
|
|
26
|
+
import { ProviderTokenEndpoint } from './Service/ProviderTokenEndpoint.js';
|
|
27
|
+
import { RunnerEndpoint } from './Service/RunnerEndpoint.js';
|
|
28
|
+
import { RunnerPoolEndpoint } from './Service/RunnerPoolEndpoint.js';
|
|
29
|
+
import { SearchEndpoint } from './Service/SearchEndpoint.js';
|
|
30
|
+
import { SourcesAccountEndpoint } from './Service/SourcesAccountEndpoint.js';
|
|
31
|
+
import { StorageEndpoint } from './Service/StorageEndpoint.js';
|
|
32
|
+
import { SubscriberEndpoint } from './Service/SubscriberEndpoint.js';
|
|
33
|
+
import { TriggerEndpoint } from './Service/TriggerEndpoint.js';
|
|
34
|
+
import { UserActionEndpoint } from './Service/UserActionEndpoint.js';
|
|
35
|
+
import { UserEndpoint } from './Service/UserEndpoint.js';
|
|
36
|
+
import { WorkspaceEndpoint } from './Service/WorkspaceEndpoint.js';
|
|
37
|
+
import { WorkspaceMemberEndpoint } from './Service/WorkspaceMemberEndpoint.js';
|
|
38
|
+
import { VERSION } from './version.js';
|
|
39
|
+
export class Client {
|
|
40
|
+
endpoints = new Map();
|
|
41
|
+
httpClient;
|
|
42
|
+
transport;
|
|
43
|
+
Store = {
|
|
44
|
+
AccessTokenEndpoint,
|
|
45
|
+
AdapterConnectionEndpoint,
|
|
46
|
+
AdapterEndpoint,
|
|
47
|
+
ChannelEndpoint,
|
|
48
|
+
CodeDeployEndpoint,
|
|
49
|
+
CodeSourceStrategiesEndpoint,
|
|
50
|
+
CommandExecutionEndpoint,
|
|
51
|
+
ConfigEndpoint,
|
|
52
|
+
FirewallEndpoint,
|
|
53
|
+
FlowEndpoint,
|
|
54
|
+
FlowRunEndpoint,
|
|
55
|
+
FlowRunRequestEndpoint,
|
|
56
|
+
FlowRunStatsEndpoint,
|
|
57
|
+
HealthAlertEndpoint,
|
|
58
|
+
InboxEndpoint,
|
|
59
|
+
LogEndpoint,
|
|
60
|
+
PlatformEndpoint,
|
|
61
|
+
PlatformLanguageEndpoint,
|
|
62
|
+
ProjectEndpoint,
|
|
63
|
+
ProjectEnvironmentEndpoint,
|
|
64
|
+
SearchEndpoint,
|
|
65
|
+
SourcesAccountEndpoint,
|
|
66
|
+
StorageEndpoint,
|
|
67
|
+
SubscriberEndpoint,
|
|
68
|
+
TriggerEndpoint,
|
|
69
|
+
UserActionEndpoint,
|
|
70
|
+
UserEndpoint,
|
|
71
|
+
ConfigurationEndpoint,
|
|
72
|
+
RunnerEndpoint,
|
|
73
|
+
WorkspaceEndpoint,
|
|
74
|
+
WorkspaceMemberEndpoint,
|
|
75
|
+
CollectionsEndpoint,
|
|
76
|
+
RunnerPoolEndpoint,
|
|
77
|
+
ProviderTokenEndpoint,
|
|
78
|
+
};
|
|
79
|
+
apiEndpoint = 'https://api.attlaz.com';
|
|
80
|
+
constructor(token = null, config = {}) {
|
|
81
|
+
if (config.apiEndpoint !== undefined) {
|
|
82
|
+
this.apiEndpoint = config.apiEndpoint;
|
|
83
|
+
}
|
|
84
|
+
const options = new OAuthClientOptions(this.apiEndpoint);
|
|
85
|
+
this.httpClient = new OAuthClient(options);
|
|
86
|
+
if (token !== null) {
|
|
87
|
+
const clientToken = new OAuthClientToken(token, 'Bearer', '', '');
|
|
88
|
+
this.httpClient.setToken(clientToken);
|
|
89
|
+
}
|
|
90
|
+
this.transport = this.httpClient;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Create a Client that uses a custom transport instead of OAuth.
|
|
94
|
+
* Intended for internal service-to-service calls (e.g. using DirectTransport).
|
|
95
|
+
*/
|
|
96
|
+
static withTransport(transport, config = { apiEndpoint: undefined }) {
|
|
97
|
+
const client = new Client(null, config);
|
|
98
|
+
client.transport = transport;
|
|
99
|
+
return client;
|
|
100
|
+
}
|
|
101
|
+
setClientCredentials(clientId, clientSecret = '') {
|
|
102
|
+
const options = new OAuthClientOptions(this.apiEndpoint, clientId, clientSecret);
|
|
103
|
+
// TODO: how to know these scopes?
|
|
104
|
+
options.scopes = ['all'];
|
|
105
|
+
// TODO: do we need to create a new oauth client, or can we update with these credentials?
|
|
106
|
+
this.httpClient = new OAuthClient(options);
|
|
107
|
+
this.transport = this.httpClient;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Configure this client as a public OAuth client (no client_secret).
|
|
111
|
+
* Used for SPAs and other public clients that cannot keep a secret.
|
|
112
|
+
*/
|
|
113
|
+
setPublicClient(clientId) {
|
|
114
|
+
const options = new OAuthClientOptions(this.apiEndpoint, clientId, null);
|
|
115
|
+
options.scopes = ['all'];
|
|
116
|
+
this.httpClient = new OAuthClient(options);
|
|
117
|
+
this.transport = this.httpClient;
|
|
118
|
+
}
|
|
119
|
+
setVersion(version) {
|
|
120
|
+
this.httpClient.setVersion(version);
|
|
121
|
+
}
|
|
122
|
+
getHttpClient() {
|
|
123
|
+
return this.httpClient;
|
|
124
|
+
}
|
|
125
|
+
/**
|
|
126
|
+
* Set a handler for non-fatal response parse failures (schema drift). Defaults to
|
|
127
|
+
* console.error; wire this to your logger / error tracker to observe drift in production
|
|
128
|
+
* without breaking views. Pass null to restore the default. Set on the active transport,
|
|
129
|
+
* so it applies whether the client uses OAuth or a custom transport.
|
|
130
|
+
*/
|
|
131
|
+
setParseErrorHandler(handler) {
|
|
132
|
+
this.transport.setParseErrorHandler(handler);
|
|
133
|
+
}
|
|
134
|
+
async authenticate(username = null, password = null) {
|
|
135
|
+
if (username === null || password === null) {
|
|
136
|
+
return await this.httpClient.authenticate();
|
|
137
|
+
}
|
|
138
|
+
// TODO: this is only possible when clientId and clientSecret are defined
|
|
139
|
+
return await this.httpClient.authenticate(username, password);
|
|
140
|
+
}
|
|
141
|
+
isAuthenticated() {
|
|
142
|
+
return this.httpClient.isAuthenticated();
|
|
143
|
+
}
|
|
144
|
+
getToken() {
|
|
145
|
+
return this.httpClient.getToken();
|
|
146
|
+
}
|
|
147
|
+
setToken(token) {
|
|
148
|
+
this.httpClient.setToken(token);
|
|
149
|
+
}
|
|
150
|
+
unsetAccessToken() {
|
|
151
|
+
this.httpClient.unsetToken();
|
|
152
|
+
}
|
|
153
|
+
async getApiInformation() {
|
|
154
|
+
const result = await this.httpClient.request('/system/health', null, 'GET', false);
|
|
155
|
+
if (result.version === undefined) {
|
|
156
|
+
throw new Error('Unable to get API information: invalid response');
|
|
157
|
+
}
|
|
158
|
+
return { version: result.version };
|
|
159
|
+
}
|
|
160
|
+
/* Endpoints */
|
|
161
|
+
getAdapterEndpoint() {
|
|
162
|
+
return this.getEndpoint('adapter', this.Store.AdapterEndpoint);
|
|
163
|
+
}
|
|
164
|
+
getAdapterConnectionEndpoint() {
|
|
165
|
+
return this.getEndpoint('adapter-connection', this.Store.AdapterConnectionEndpoint);
|
|
166
|
+
}
|
|
167
|
+
getProjectEndpoint() {
|
|
168
|
+
return this.getEndpoint('project', this.Store.ProjectEndpoint);
|
|
169
|
+
}
|
|
170
|
+
getProjectEnvironmentEndpoint() {
|
|
171
|
+
return this.getEndpoint('project-environment', this.Store.ProjectEnvironmentEndpoint);
|
|
172
|
+
}
|
|
173
|
+
getCodeDeployEndpoint() {
|
|
174
|
+
return this.getEndpoint('code-deploy', this.Store.CodeDeployEndpoint);
|
|
175
|
+
}
|
|
176
|
+
getChannelEndpoint() {
|
|
177
|
+
return this.getEndpoint('channel', this.Store.ChannelEndpoint);
|
|
178
|
+
}
|
|
179
|
+
getConfigEndpoint() {
|
|
180
|
+
return this.getEndpoint('config', this.Store.ConfigEndpoint);
|
|
181
|
+
}
|
|
182
|
+
getInboxEndpoint() {
|
|
183
|
+
return this.getEndpoint('inbox', this.Store.InboxEndpoint);
|
|
184
|
+
}
|
|
185
|
+
getPlatformEndpoint() {
|
|
186
|
+
return this.getEndpoint('platform', this.Store.PlatformEndpoint);
|
|
187
|
+
}
|
|
188
|
+
getSubscriberEndpoint() {
|
|
189
|
+
return this.getEndpoint('subscriber', this.Store.SubscriberEndpoint);
|
|
190
|
+
}
|
|
191
|
+
getLogEndPoint() {
|
|
192
|
+
return this.getEndpoint('log', this.Store.LogEndpoint);
|
|
193
|
+
}
|
|
194
|
+
getFlowEndpoint() {
|
|
195
|
+
return this.getEndpoint('flow', this.Store.FlowEndpoint);
|
|
196
|
+
}
|
|
197
|
+
getFlowRunEndpoint() {
|
|
198
|
+
return this.getEndpoint('flow-run', this.Store.FlowRunEndpoint);
|
|
199
|
+
}
|
|
200
|
+
getFlowRunRequestEndpoint() {
|
|
201
|
+
return this.getEndpoint('flow-run-request', this.Store.FlowRunRequestEndpoint);
|
|
202
|
+
}
|
|
203
|
+
getFlowRunStatsEndpoint() {
|
|
204
|
+
return this.getEndpoint('flow-run-stats', this.Store.FlowRunStatsEndpoint);
|
|
205
|
+
}
|
|
206
|
+
getWorkspaceEndpoint() {
|
|
207
|
+
return this.getEndpoint('workspaces', this.Store.WorkspaceEndpoint);
|
|
208
|
+
}
|
|
209
|
+
getTriggerEndpoint() {
|
|
210
|
+
return this.getEndpoint('trigger', this.Store.TriggerEndpoint);
|
|
211
|
+
}
|
|
212
|
+
getUserEndpoint() {
|
|
213
|
+
return this.getEndpoint('user', this.Store.UserEndpoint);
|
|
214
|
+
}
|
|
215
|
+
getWorkspaceMemberEndpoint() {
|
|
216
|
+
return this.getEndpoint('member', this.Store.WorkspaceMemberEndpoint);
|
|
217
|
+
}
|
|
218
|
+
getRunnerEndpoint() {
|
|
219
|
+
return this.getEndpoint('worker', this.Store.RunnerEndpoint);
|
|
220
|
+
}
|
|
221
|
+
getSourcesAccountEndpoint() {
|
|
222
|
+
return this.getEndpoint('sources-account', this.Store.SourcesAccountEndpoint);
|
|
223
|
+
}
|
|
224
|
+
getLanguageEndpoint() {
|
|
225
|
+
return this.getEndpoint('language', this.Store.PlatformLanguageEndpoint);
|
|
226
|
+
}
|
|
227
|
+
getStorageEndpoint() {
|
|
228
|
+
return this.getEndpoint('storage', this.Store.StorageEndpoint);
|
|
229
|
+
}
|
|
230
|
+
getConfigurationEndpoint() {
|
|
231
|
+
return this.getEndpoint('configuration', this.Store.ConfigurationEndpoint);
|
|
232
|
+
}
|
|
233
|
+
getHealthAlertEndpoint() {
|
|
234
|
+
return this.getEndpoint('health-alert', this.Store.HealthAlertEndpoint);
|
|
235
|
+
}
|
|
236
|
+
getCodeSourceStrategiesEndpoint() {
|
|
237
|
+
return this.getEndpoint('code-source-strategies', this.Store.CodeSourceStrategiesEndpoint);
|
|
238
|
+
}
|
|
239
|
+
getSearchEndpoint() {
|
|
240
|
+
return this.getEndpoint('search', this.Store.SearchEndpoint);
|
|
241
|
+
}
|
|
242
|
+
getUserActionEndpoint() {
|
|
243
|
+
return this.getEndpoint('useraction', this.Store.UserActionEndpoint);
|
|
244
|
+
}
|
|
245
|
+
getCommandExecutionEndpoint() {
|
|
246
|
+
return this.getEndpoint('commandexecution', this.Store.CommandExecutionEndpoint);
|
|
247
|
+
}
|
|
248
|
+
getAccessTokenEndpoint() {
|
|
249
|
+
return this.getEndpoint('accesstoken', this.Store.AccessTokenEndpoint);
|
|
250
|
+
}
|
|
251
|
+
getCollectionsEndpoint() {
|
|
252
|
+
return this.getEndpoint('collections', this.Store.CollectionsEndpoint);
|
|
253
|
+
}
|
|
254
|
+
getRunnerPoolEndpoint() {
|
|
255
|
+
return this.getEndpoint('runner_pool', this.Store.RunnerPoolEndpoint);
|
|
256
|
+
}
|
|
257
|
+
getProviderTokenEndpoint() {
|
|
258
|
+
return this.getEndpoint('provider_token', this.Store.ProviderTokenEndpoint);
|
|
259
|
+
}
|
|
260
|
+
getFirewallEndpoint() {
|
|
261
|
+
return this.getEndpoint('firewall', this.Store.FirewallEndpoint);
|
|
262
|
+
}
|
|
263
|
+
getEndpoint(key, ClassName) {
|
|
264
|
+
if (!this.endpoints.has(key)) {
|
|
265
|
+
try {
|
|
266
|
+
this.endpoints.set(key, new ClassName(this.transport));
|
|
267
|
+
}
|
|
268
|
+
catch (error) {
|
|
269
|
+
const errorMsg = (error !== null && typeof error === 'object' && 'message' in error && typeof error.message === 'string') ? error.message : 'Unknown';
|
|
270
|
+
throw new Error('Unable to initialize ' + key + ' endpoint (' + errorMsg + ')');
|
|
271
|
+
}
|
|
272
|
+
}
|
|
273
|
+
return this.endpoints.get(key);
|
|
274
|
+
}
|
|
275
|
+
getVersion() {
|
|
276
|
+
return VERSION;
|
|
277
|
+
}
|
|
278
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { DataValueCollection } from '../Model/DataValueCollection.js';
|
|
2
|
+
import { ApiRecord } from '../Model/ApiRecord.js';
|
|
3
|
+
export declare abstract class MetaDataAware {
|
|
4
|
+
abstract id: string;
|
|
5
|
+
name: string;
|
|
6
|
+
description: string | null;
|
|
7
|
+
metadata: DataValueCollection;
|
|
8
|
+
updatedAt: Date | null;
|
|
9
|
+
createdAt: Date | null;
|
|
10
|
+
static parseMetaData<T extends MetaDataAware>(input: T, raw: ApiRecord): T;
|
|
11
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { DataValueCollection } from '../Model/DataValueCollection.js';
|
|
2
|
+
import { Utils } from '../Utils.js';
|
|
3
|
+
export class MetaDataAware {
|
|
4
|
+
name;
|
|
5
|
+
description = null;
|
|
6
|
+
// public icon: string | null = null;
|
|
7
|
+
metadata;
|
|
8
|
+
updatedAt = null;
|
|
9
|
+
createdAt = null;
|
|
10
|
+
static parseMetaData(input, raw) {
|
|
11
|
+
input.id = raw.id;
|
|
12
|
+
input.name = raw.name;
|
|
13
|
+
input.description = raw.description;
|
|
14
|
+
// input.icon = raw.icon as string | null;
|
|
15
|
+
// TODO: parse meta data
|
|
16
|
+
if (Object.prototype.hasOwnProperty.call(raw, 'metadata')) {
|
|
17
|
+
// input.metadata = DataValueCollection.fromObject(raw.metadata as any);
|
|
18
|
+
input.metadata = DataValueCollection.fromObject(raw.metadata);
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
input.metadata = new DataValueCollection();
|
|
22
|
+
}
|
|
23
|
+
input.updatedAt = (raw.updated === null || raw.updated === undefined) ? null : Utils.parseRawDate(raw.updated);
|
|
24
|
+
input.createdAt = (raw.created === null || raw.created === undefined) ? null : Utils.parseRawDate(raw.created);
|
|
25
|
+
return input;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApiRecord } from '../Model/ApiRecord.js';
|
|
2
|
+
import { DataValueCollection } from '../Model/DataValueCollection.js';
|
|
3
|
+
export declare abstract class MetaDataWithIconAware {
|
|
4
|
+
abstract id: string;
|
|
5
|
+
icon: string | null;
|
|
6
|
+
name: string;
|
|
7
|
+
description: string | null;
|
|
8
|
+
metadata: DataValueCollection;
|
|
9
|
+
updatedAt: Date | null;
|
|
10
|
+
createdAt: Date | null;
|
|
11
|
+
static parseMetaData<T extends MetaDataWithIconAware>(input: T, raw: ApiRecord): T;
|
|
12
|
+
static parseIcon(icon: unknown): string | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MetaDataAware } from './MetaDataAware.js';
|
|
2
|
+
export class MetaDataWithIconAware {
|
|
3
|
+
icon;
|
|
4
|
+
name;
|
|
5
|
+
description = null;
|
|
6
|
+
metadata;
|
|
7
|
+
updatedAt = null;
|
|
8
|
+
createdAt = null;
|
|
9
|
+
static parseMetaData(input, raw) {
|
|
10
|
+
input = MetaDataAware.parseMetaData(input, raw);
|
|
11
|
+
input.icon = MetaDataWithIconAware.parseIcon(raw.icon);
|
|
12
|
+
return input;
|
|
13
|
+
}
|
|
14
|
+
static parseIcon(icon) {
|
|
15
|
+
if (icon === null) {
|
|
16
|
+
return null;
|
|
17
|
+
}
|
|
18
|
+
if (typeof icon === 'object') {
|
|
19
|
+
if ('type' in icon && 'data' in icon) {
|
|
20
|
+
return icon.data;
|
|
21
|
+
}
|
|
22
|
+
console.log('Icon', { icon });
|
|
23
|
+
}
|
|
24
|
+
return icon;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
2
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
|
+
import { EntityId } from '../Model/EntityId.js';
|
|
4
|
+
export declare class LoadAllHelper {
|
|
5
|
+
static loadAll<T extends {
|
|
6
|
+
id: string | EntityId;
|
|
7
|
+
}>(call: (pagination: CursorPagination) => Promise<CollectionResult<T>>, limit?: number): Promise<T[]>;
|
|
8
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
2
|
+
export class LoadAllHelper {
|
|
3
|
+
static async loadAll(call, limit = 100) {
|
|
4
|
+
const totalResult = [];
|
|
5
|
+
let hasMore = true;
|
|
6
|
+
let lastRef = null;
|
|
7
|
+
while (hasMore) {
|
|
8
|
+
const firstPagination = new CursorPagination();
|
|
9
|
+
firstPagination.limit = limit;
|
|
10
|
+
firstPagination.startingAfter = lastRef;
|
|
11
|
+
const data = await call(firstPagination);
|
|
12
|
+
const records = data.getData();
|
|
13
|
+
// Spread is faster than a per-element loop but can exceed the call stack for very large collections (50k+)
|
|
14
|
+
if (totalResult.length + records.length > 50_000) {
|
|
15
|
+
throw new Error('loadAll exceeded 50,000 records (' + (totalResult.length + records.length) + '). This method is not intended for large datasets.');
|
|
16
|
+
}
|
|
17
|
+
totalResult.push(...records);
|
|
18
|
+
if (records.length > 0) {
|
|
19
|
+
lastRef = records[records.length - 1].id.toString();
|
|
20
|
+
}
|
|
21
|
+
hasMore = data.hasMore;
|
|
22
|
+
}
|
|
23
|
+
return totalResult;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
export declare class ClientError extends Error {
|
|
2
|
+
httpStatus: number | null;
|
|
3
|
+
message: string;
|
|
4
|
+
response: unknown;
|
|
5
|
+
constructor(message: string, httpErrorCode?: number | null);
|
|
6
|
+
/**
|
|
7
|
+
* Type guard: true when `error` is a ClientError (or a subclass such as ApiError). Use it to
|
|
8
|
+
* narrow before reading typed fields (`httpStatus`, `message`, …). Relies on instanceof, which
|
|
9
|
+
* is reliable when there's a single copy of this package (e.g. a bundled web app). For a status
|
|
10
|
+
* check that must survive multiple package copies / realm boundaries, prefer statusOf().
|
|
11
|
+
*/
|
|
12
|
+
static is(error: unknown): error is ClientError;
|
|
13
|
+
/**
|
|
14
|
+
* The HTTP status carried by a ClientError/ApiError, or null for anything else (e.g. a plain
|
|
15
|
+
* Error or a non-error value). Robust across module/realm boundaries: when instanceof fails
|
|
16
|
+
* (two copies of this package in one process) it falls back to reading a numeric httpStatus
|
|
17
|
+
* field. This is the safe way to ask "what status did this error carry?".
|
|
18
|
+
*/
|
|
19
|
+
static statusOf(error: unknown): number | null;
|
|
20
|
+
static fromError(error: Error): ClientError;
|
|
21
|
+
static byStatus(statusCode: number, statusText: string): ClientError | null;
|
|
22
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { HttpStatus } from './HttpStatus.js';
|
|
2
|
+
export class ClientError extends Error {
|
|
3
|
+
httpStatus = null;
|
|
4
|
+
message;
|
|
5
|
+
response;
|
|
6
|
+
constructor(message, httpErrorCode = null) {
|
|
7
|
+
super(message);
|
|
8
|
+
this.message = message;
|
|
9
|
+
this.httpStatus = httpErrorCode;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Type guard: true when `error` is a ClientError (or a subclass such as ApiError). Use it to
|
|
13
|
+
* narrow before reading typed fields (`httpStatus`, `message`, …). Relies on instanceof, which
|
|
14
|
+
* is reliable when there's a single copy of this package (e.g. a bundled web app). For a status
|
|
15
|
+
* check that must survive multiple package copies / realm boundaries, prefer statusOf().
|
|
16
|
+
*/
|
|
17
|
+
static is(error) {
|
|
18
|
+
return error instanceof ClientError;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* The HTTP status carried by a ClientError/ApiError, or null for anything else (e.g. a plain
|
|
22
|
+
* Error or a non-error value). Robust across module/realm boundaries: when instanceof fails
|
|
23
|
+
* (two copies of this package in one process) it falls back to reading a numeric httpStatus
|
|
24
|
+
* field. This is the safe way to ask "what status did this error carry?".
|
|
25
|
+
*/
|
|
26
|
+
static statusOf(error) {
|
|
27
|
+
if (error instanceof ClientError) {
|
|
28
|
+
return error.httpStatus;
|
|
29
|
+
}
|
|
30
|
+
const status = error?.httpStatus;
|
|
31
|
+
return typeof status === 'number' ? status : null;
|
|
32
|
+
}
|
|
33
|
+
static fromError(error) {
|
|
34
|
+
// Already a ClientError (or a subclass such as ApiError) — preserve it as-is.
|
|
35
|
+
if (error instanceof ClientError) {
|
|
36
|
+
return error;
|
|
37
|
+
}
|
|
38
|
+
// The transport uses fetch, which throws TypeError on network failures (DNS, refused
|
|
39
|
+
// connection, TLS, etc.). Anything else reaching here is unexpected — surface it as a
|
|
40
|
+
// generic 500 while keeping the original name/stack for debugging.
|
|
41
|
+
const clientError = error instanceof TypeError
|
|
42
|
+
? new ClientError('Service not available', HttpStatus.HTTP_UNAVAILABLE)
|
|
43
|
+
: new ClientError('Unknown error', HttpStatus.HTTP_INTERNAL_SERVER_ERROR);
|
|
44
|
+
clientError.name = error.name;
|
|
45
|
+
clientError.stack = error.stack;
|
|
46
|
+
return clientError;
|
|
47
|
+
}
|
|
48
|
+
static byStatus(statusCode, statusText) {
|
|
49
|
+
switch (statusCode) {
|
|
50
|
+
case 200:
|
|
51
|
+
case 201:
|
|
52
|
+
case 202:
|
|
53
|
+
return null;
|
|
54
|
+
case 400:
|
|
55
|
+
return new ClientError('Bad Request', HttpStatus.HTTP_BAD_REQUEST);
|
|
56
|
+
case 401:
|
|
57
|
+
return new ClientError('Unauthorized', HttpStatus.HTTP_UNAUTHORIZED);
|
|
58
|
+
case 403:
|
|
59
|
+
return new ClientError('Forbidden', HttpStatus.HTTP_FORBIDDEN);
|
|
60
|
+
case 404:
|
|
61
|
+
return new ClientError('Not Found', HttpStatus.HTTP_NOTFOUND);
|
|
62
|
+
case 405:
|
|
63
|
+
return new ClientError('Not allowed', HttpStatus.HTTP_NOT_ALLOWED);
|
|
64
|
+
case 422:
|
|
65
|
+
return new ClientError('Unprocessable Entity', HttpStatus.HTTP_UNPROCESSABLE_ENTITY);
|
|
66
|
+
case 500:
|
|
67
|
+
return new ClientError('Internal Server Error', HttpStatus.HTTP_INTERNAL_SERVER_ERROR);
|
|
68
|
+
case 502:
|
|
69
|
+
return new ClientError('Bad gateway', HttpStatus.HTTP_BAD_GATEWAY);
|
|
70
|
+
case 503:
|
|
71
|
+
return new ClientError('Service not available', HttpStatus.HTTP_UNAVAILABLE);
|
|
72
|
+
case 504:
|
|
73
|
+
return new ClientError('Gateway Time-out', HttpStatus.HTTP_TIMEOUT);
|
|
74
|
+
default:
|
|
75
|
+
console.error('Unknown status code "' + statusCode + '"', { code: statusCode, text: statusText });
|
|
76
|
+
return new ClientError('Status code ' + statusCode + ': ' + statusText, statusCode);
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|