@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
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { StorageInformation } from '../Model/Storage/StorageInformation.js';
|
|
2
|
+
import { StorageItem } from '../Model/Storage/StorageItem.js';
|
|
3
|
+
import { StorageItemInformation } from '../Model/Storage/StorageItemInformation.js';
|
|
4
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
5
|
+
import { Endpoint } from './Endpoint.js';
|
|
6
|
+
export class StorageEndpoint extends Endpoint {
|
|
7
|
+
async getInformation(projectEnvironmentId, storageType) {
|
|
8
|
+
const cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType;
|
|
9
|
+
try {
|
|
10
|
+
const parser = (raw) => {
|
|
11
|
+
const storageInformation = new StorageInformation();
|
|
12
|
+
storageInformation.bytes = raw.bytes;
|
|
13
|
+
storageInformation.bytes_limit = raw.bytes_limit;
|
|
14
|
+
storageInformation.items = raw.items;
|
|
15
|
+
// Prefer the new `buckets` field; fall back to the legacy `pools` for older API responses.
|
|
16
|
+
storageInformation.buckets = (raw.buckets ?? raw.pools);
|
|
17
|
+
return storageInformation;
|
|
18
|
+
};
|
|
19
|
+
const result = await this.requestObject(cmd, null, parser, 'GET');
|
|
20
|
+
return result.getData();
|
|
21
|
+
}
|
|
22
|
+
catch (ex) {
|
|
23
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
24
|
+
console.error('Failed to get storage information', ex);
|
|
25
|
+
}
|
|
26
|
+
throw ex;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
async clearBucket(projectEnvironmentId, storageType, bucketKey) {
|
|
30
|
+
const cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + bucketKey;
|
|
31
|
+
try {
|
|
32
|
+
const parser = (raw) => raw.deleted;
|
|
33
|
+
const result = await this.requestObject(cmd, null, parser, 'DELETE');
|
|
34
|
+
const re = result.getData();
|
|
35
|
+
if (re === null) {
|
|
36
|
+
throw new Error('Unable to clear storage pool: wrong response from API');
|
|
37
|
+
}
|
|
38
|
+
return re.deleted;
|
|
39
|
+
}
|
|
40
|
+
catch (ex) {
|
|
41
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
42
|
+
console.error('Failed to get storage information', ex);
|
|
43
|
+
}
|
|
44
|
+
throw ex;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
async getBucketItemsInformation(projectEnvironmentId, storageType, bucketKey, pagination = null) {
|
|
48
|
+
const qs = new QueryString('/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + bucketKey + '/items');
|
|
49
|
+
qs.addPagination(pagination);
|
|
50
|
+
try {
|
|
51
|
+
const result = await this.requestCollection(qs, StorageItemInformation.parse, null, 'GET');
|
|
52
|
+
return result;
|
|
53
|
+
}
|
|
54
|
+
catch (ex) {
|
|
55
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
56
|
+
console.error('Failed to get storage information', ex);
|
|
57
|
+
}
|
|
58
|
+
throw ex;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
/** @deprecated Renamed to getBucketItemsInformation. Kept for backwards compatibility. */
|
|
62
|
+
async getPoolItemsInformation(projectEnvironmentId, storageType, bucketKey, pagination = null) {
|
|
63
|
+
return this.getBucketItemsInformation(projectEnvironmentId, storageType, bucketKey, pagination);
|
|
64
|
+
}
|
|
65
|
+
/** @deprecated Renamed to clearBucket. Kept for backwards compatibility. */
|
|
66
|
+
async clearPool(projectEnvironmentId, storageType, bucketKey) {
|
|
67
|
+
return this.clearBucket(projectEnvironmentId, storageType, bucketKey);
|
|
68
|
+
}
|
|
69
|
+
async getItem(projectEnvironmentId, storageType, bucketKey, storageItemKey) {
|
|
70
|
+
const cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + bucketKey + '/items/' + storageItemKey;
|
|
71
|
+
try {
|
|
72
|
+
const result = await this.requestObject(cmd, null, StorageItem.parse, 'GET');
|
|
73
|
+
return result.getData();
|
|
74
|
+
}
|
|
75
|
+
catch (ex) {
|
|
76
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
77
|
+
console.error('Failed to get storage item', ex);
|
|
78
|
+
}
|
|
79
|
+
throw ex;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
async getBucketItem(storageBucketId, storageItemKey) {
|
|
83
|
+
const cmd = '/storage-buckets/' + storageBucketId + '/items/' + storageItemKey;
|
|
84
|
+
try {
|
|
85
|
+
const result = await this.requestObject(cmd, null, StorageItem.parse, 'GET');
|
|
86
|
+
return result.getData();
|
|
87
|
+
}
|
|
88
|
+
catch (ex) {
|
|
89
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
90
|
+
console.error('Failed to get storage item', ex);
|
|
91
|
+
}
|
|
92
|
+
throw ex;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
async setItem(projectEnvironmentId, storageType, bucketKey, storageItem) {
|
|
96
|
+
const cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + bucketKey + '/items/' + storageItem.key;
|
|
97
|
+
try {
|
|
98
|
+
const result = await this.requestObject(cmd, storageItem, StorageItem.parse, 'POST');
|
|
99
|
+
const savedItem = result.getData();
|
|
100
|
+
if (savedItem === null) {
|
|
101
|
+
throw new Error('Unable to save storage item: wrong response from API');
|
|
102
|
+
}
|
|
103
|
+
return savedItem;
|
|
104
|
+
}
|
|
105
|
+
catch (ex) {
|
|
106
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
107
|
+
console.error('Failed to get storage information', ex);
|
|
108
|
+
}
|
|
109
|
+
throw ex;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
async deleteItem(projectEnvironmentId, storageType, bucketKey, storageItemKey) {
|
|
113
|
+
const cmd = '/projectenvironments/' + projectEnvironmentId + '/storage/' + storageType + '/' + bucketKey + '/items/' + storageItemKey;
|
|
114
|
+
try {
|
|
115
|
+
const parser = (raw) => ({ deleted: raw.deleted });
|
|
116
|
+
const result = await this.requestObject(cmd, null, parser, 'DELETE');
|
|
117
|
+
const x = result.getData();
|
|
118
|
+
if (x === null) {
|
|
119
|
+
throw new Error('Unable to delete storage item: wrong response from API');
|
|
120
|
+
}
|
|
121
|
+
return x.deleted;
|
|
122
|
+
}
|
|
123
|
+
catch (ex) {
|
|
124
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
125
|
+
console.error('Failed to get storage information', ex);
|
|
126
|
+
}
|
|
127
|
+
throw ex;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Subscriber } from '../Model/Messaging/Subscriber.js';
|
|
2
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
4
|
+
import { Endpoint } from './Endpoint.js';
|
|
5
|
+
export declare class SubscriberEndpoint extends Endpoint {
|
|
6
|
+
getSubscribersByFlow(flowId: string, projectEnvironmentId?: string | null, pagination?: CursorPagination | null): Promise<CollectionResult<Subscriber>>;
|
|
7
|
+
getSubscribersByChannel(channelId: string, pagination?: CursorPagination | null): Promise<CollectionResult<Subscriber>>;
|
|
8
|
+
save(subscriber: Subscriber): Promise<Subscriber>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { Subscriber } from '../Model/Messaging/Subscriber.js';
|
|
2
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
3
|
+
import { Endpoint } from './Endpoint.js';
|
|
4
|
+
export class SubscriberEndpoint extends Endpoint {
|
|
5
|
+
async getSubscribersByFlow(flowId, projectEnvironmentId = null, pagination = null) {
|
|
6
|
+
const qu = new QueryString('/flows/' + flowId + '/subscribers');
|
|
7
|
+
if (projectEnvironmentId !== null && projectEnvironmentId !== undefined) {
|
|
8
|
+
qu.set('environment', projectEnvironmentId);
|
|
9
|
+
}
|
|
10
|
+
qu.addPagination(pagination);
|
|
11
|
+
const result = await this.requestCollection(qu, Subscriber.parseRaw);
|
|
12
|
+
return result;
|
|
13
|
+
}
|
|
14
|
+
async getSubscribersByChannel(channelId, pagination = null) {
|
|
15
|
+
const qu = new QueryString('/channels/' + channelId + '/subscribers');
|
|
16
|
+
qu.addPagination(pagination);
|
|
17
|
+
const result = await this.requestCollection(qu, Subscriber.parseRaw);
|
|
18
|
+
return result;
|
|
19
|
+
}
|
|
20
|
+
async save(subscriber) {
|
|
21
|
+
const url = '/flows/' + subscriber.flowId + '/subscribers';
|
|
22
|
+
const result = await this.requestObject(url, subscriber, Subscriber.parseRaw, 'POST');
|
|
23
|
+
const createdSubscriber = result.getData();
|
|
24
|
+
if (createdSubscriber === null) {
|
|
25
|
+
throw new Error('Subscriber not created');
|
|
26
|
+
}
|
|
27
|
+
return createdSubscriber;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Trigger } from '../Model/Trigger/Trigger.js';
|
|
2
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
4
|
+
import { Endpoint } from './Endpoint.js';
|
|
5
|
+
export declare class TriggerEndpoint extends Endpoint {
|
|
6
|
+
getByFlow(flowId: string, projectEnvironmentId?: string | null, pagination?: CursorPagination | null): Promise<CollectionResult<Trigger>>;
|
|
7
|
+
getByCodeSource(codeSourceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<Trigger>>;
|
|
8
|
+
getById(id: string): Promise<Trigger | null>;
|
|
9
|
+
save(trigger: Trigger): Promise<Trigger>;
|
|
10
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Trigger } from '../Model/Trigger/Trigger.js';
|
|
2
|
+
import { Utils } from '../Utils.js';
|
|
3
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
4
|
+
import { Endpoint } from './Endpoint.js';
|
|
5
|
+
export class TriggerEndpoint extends Endpoint {
|
|
6
|
+
async getByFlow(flowId, projectEnvironmentId = null, pagination = null) {
|
|
7
|
+
try {
|
|
8
|
+
const queryString = new QueryString('/triggers/rfr/' + flowId + '');
|
|
9
|
+
queryString.addPagination(pagination);
|
|
10
|
+
let parameters = null;
|
|
11
|
+
if (!Utils.isNullOrUndefined(projectEnvironmentId)) {
|
|
12
|
+
parameters = { environment: projectEnvironmentId };
|
|
13
|
+
}
|
|
14
|
+
const rawTriggers = await this.requestCollection(queryString, Trigger.parse, parameters);
|
|
15
|
+
return rawTriggers;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
19
|
+
console.error('Failed to load triggers: ', error);
|
|
20
|
+
}
|
|
21
|
+
throw error;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
async getByCodeSource(codeSourceId, pagination = null) {
|
|
25
|
+
try {
|
|
26
|
+
const queryString = new QueryString('/triggers/csd/' + codeSourceId + '');
|
|
27
|
+
queryString.addPagination(pagination);
|
|
28
|
+
const rawTriggers = await this.requestCollection(queryString, Trigger.parse, null);
|
|
29
|
+
return rawTriggers;
|
|
30
|
+
}
|
|
31
|
+
catch (error) {
|
|
32
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
33
|
+
console.error('Failed to load triggers: ', error);
|
|
34
|
+
}
|
|
35
|
+
throw error;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
async getById(id) {
|
|
39
|
+
try {
|
|
40
|
+
const result = await this.requestObject('/triggers/' + id, null, Trigger.parse);
|
|
41
|
+
return result.getData();
|
|
42
|
+
}
|
|
43
|
+
catch (error) {
|
|
44
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
45
|
+
console.error('Failed to load trigger by id: ', error);
|
|
46
|
+
}
|
|
47
|
+
throw error;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
async save(trigger) {
|
|
51
|
+
try {
|
|
52
|
+
const url = '/flows/' + trigger.flowId + '/triggers';
|
|
53
|
+
const result = await this.requestObject(url, trigger, Trigger.parse, 'POST');
|
|
54
|
+
const createdTrigger = result.getData();
|
|
55
|
+
if (createdTrigger === null) {
|
|
56
|
+
throw new Error('Unable save trigger: wrong response from API');
|
|
57
|
+
}
|
|
58
|
+
return createdTrigger;
|
|
59
|
+
}
|
|
60
|
+
catch (error) {
|
|
61
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
62
|
+
console.error('Failed to save trigger: ', error);
|
|
63
|
+
}
|
|
64
|
+
throw error;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { UserAction } from '../Model/User/UserAction.js';
|
|
2
|
+
import { UserActionFilter } from '../Model/User/UserActionFilter.js';
|
|
3
|
+
import { UserSummary } from '../Model/User/UserSummary.js';
|
|
4
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
5
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
6
|
+
import { Endpoint } from './Endpoint.js';
|
|
7
|
+
export declare class UserActionEndpoint extends Endpoint {
|
|
8
|
+
getWorkspaceMemberActions(workspaceId: string, memberId: string, pagination?: CursorPagination | null): Promise<CollectionResult<UserAction>>;
|
|
9
|
+
getUserActions(userId: string, pagination?: CursorPagination | null): Promise<CollectionResult<UserAction>>;
|
|
10
|
+
getByResource(resourceId: string, resourceType: string, pagination?: CursorPagination | null): Promise<CollectionResult<UserAction>>;
|
|
11
|
+
getAll(pagination?: CursorPagination | null, filter?: UserActionFilter | null): Promise<CollectionResult<UserAction>>;
|
|
12
|
+
/** Distinct users that appear in the audit log, resolved to display-safe summaries (for the user filter). */
|
|
13
|
+
getDistinctUsers(): Promise<UserSummary[]>;
|
|
14
|
+
private static parseSummary;
|
|
15
|
+
private static parse;
|
|
16
|
+
}
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Utils } from '../Utils.js';
|
|
2
|
+
import { UserAction } from '../Model/User/UserAction.js';
|
|
3
|
+
import { UserSummary } from '../Model/User/UserSummary.js';
|
|
4
|
+
import { State } from '../Model/State.js';
|
|
5
|
+
import { DataValueCollection } from '../Model/DataValueCollection.js';
|
|
6
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
7
|
+
import { Endpoint } from './Endpoint.js';
|
|
8
|
+
export class UserActionEndpoint extends Endpoint {
|
|
9
|
+
async getWorkspaceMemberActions(workspaceId, memberId, pagination = null) {
|
|
10
|
+
try {
|
|
11
|
+
const queryString = new QueryString('/workspaces/' + workspaceId + '/members/' + memberId + '/actions');
|
|
12
|
+
queryString.addPagination(pagination);
|
|
13
|
+
return await this.requestCollection(queryString, UserActionEndpoint.parse, null, 'GET');
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
17
|
+
console.error('Failed to load adapter configuration: ', error);
|
|
18
|
+
}
|
|
19
|
+
throw error;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
async getUserActions(userId, pagination = null) {
|
|
23
|
+
try {
|
|
24
|
+
const queryString = new QueryString('/users/' + userId + '/actions');
|
|
25
|
+
queryString.addPagination(pagination);
|
|
26
|
+
return await this.requestCollection(queryString, UserActionEndpoint.parse, null, 'GET');
|
|
27
|
+
}
|
|
28
|
+
catch (error) {
|
|
29
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
30
|
+
console.error('Failed to load adapter configuration: ', error);
|
|
31
|
+
}
|
|
32
|
+
throw error;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
async getByResource(resourceId, resourceType, pagination = null) {
|
|
36
|
+
try {
|
|
37
|
+
const queryString = new QueryString('/resources/' + resourceType + '/' + resourceId + '/actions');
|
|
38
|
+
queryString.addPagination(pagination);
|
|
39
|
+
return await this.requestCollection(queryString, UserActionEndpoint.parse, null, 'GET');
|
|
40
|
+
}
|
|
41
|
+
catch (error) {
|
|
42
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
43
|
+
console.error('Failed to load adapter configuration: ', error);
|
|
44
|
+
}
|
|
45
|
+
throw error;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
async getAll(pagination = null, filter = null) {
|
|
49
|
+
const queryString = new QueryString('/audit-logs');
|
|
50
|
+
queryString.addPagination(pagination);
|
|
51
|
+
if (filter !== null) {
|
|
52
|
+
if (filter.userIds !== undefined && filter.userIds.length > 0) {
|
|
53
|
+
queryString.set('user', filter.userIds);
|
|
54
|
+
}
|
|
55
|
+
if (filter.entityId !== undefined) {
|
|
56
|
+
queryString.set('entity', filter.entityId);
|
|
57
|
+
}
|
|
58
|
+
if (filter.timeFrom !== undefined) {
|
|
59
|
+
queryString.set('time_from', filter.timeFrom.toISOString());
|
|
60
|
+
}
|
|
61
|
+
if (filter.timeTo !== undefined) {
|
|
62
|
+
queryString.set('time_to', filter.timeTo.toISOString());
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
return await this.requestCollection(queryString, UserActionEndpoint.parse, null, 'GET');
|
|
66
|
+
}
|
|
67
|
+
/** Distinct users that appear in the audit log, resolved to display-safe summaries (for the user filter). */
|
|
68
|
+
async getDistinctUsers() {
|
|
69
|
+
const queryString = new QueryString('/audit-logs/users');
|
|
70
|
+
const result = await this.requestCollection(queryString, UserActionEndpoint.parseSummary, null, 'GET');
|
|
71
|
+
return result.getData();
|
|
72
|
+
}
|
|
73
|
+
static parseSummary(raw) {
|
|
74
|
+
const summary = new UserSummary();
|
|
75
|
+
summary.id = raw.id;
|
|
76
|
+
summary.type = raw.type;
|
|
77
|
+
summary.state = (raw.state === null || raw.state === undefined) ? null : State.fromString(raw.state);
|
|
78
|
+
summary.displayName = raw.display_name;
|
|
79
|
+
return summary;
|
|
80
|
+
}
|
|
81
|
+
static parse(rawUserEvent) {
|
|
82
|
+
const userAction = new UserAction();
|
|
83
|
+
userAction.id = rawUserEvent.id;
|
|
84
|
+
userAction.userId = rawUserEvent.user;
|
|
85
|
+
userAction.workspaceId = rawUserEvent.workspace;
|
|
86
|
+
userAction.action = rawUserEvent.action;
|
|
87
|
+
userAction.entityId = rawUserEvent.entity;
|
|
88
|
+
userAction.entityType = rawUserEvent.entity_type;
|
|
89
|
+
userAction.description = rawUserEvent.description;
|
|
90
|
+
userAction.ip = rawUserEvent.ip;
|
|
91
|
+
userAction.time = Utils.parseRawDate(rawUserEvent.time);
|
|
92
|
+
userAction.result = rawUserEvent.result;
|
|
93
|
+
userAction.data = DataValueCollection.fromObject(rawUserEvent.data);
|
|
94
|
+
return userAction;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
|
|
2
|
+
import { User } from '../Model/User/User.js';
|
|
3
|
+
import { UserSummary } from '../Model/User/UserSummary.js';
|
|
4
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
5
|
+
import { Endpoint } from './Endpoint.js';
|
|
6
|
+
import { UserNotificationSession } from '../Model/User/UserNotificationSession.js';
|
|
7
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
8
|
+
export declare class UserEndpoint extends Endpoint {
|
|
9
|
+
getUser(): Promise<User | null>;
|
|
10
|
+
removeAuthProvider(providerId: string): Promise<boolean>;
|
|
11
|
+
/**
|
|
12
|
+
* Resolve display-safe summaries for a set of user ids (e.g. to show "Requested by" names in a
|
|
13
|
+
* list). The server applies visibility rules and returns tombstones ("Unknown user" / "Removed
|
|
14
|
+
* user") rather than leaking anything the caller isn't allowed to see.
|
|
15
|
+
*/
|
|
16
|
+
getSummaries(userIds: string[]): Promise<UserSummary[]>;
|
|
17
|
+
private static parseSummary;
|
|
18
|
+
getAuthProviders(): Promise<CollectionResult<UserAuthProvider>>;
|
|
19
|
+
getPermissions(): Promise<CollectionResult<{
|
|
20
|
+
key: string;
|
|
21
|
+
allowed: boolean;
|
|
22
|
+
}>>;
|
|
23
|
+
update(user: User): Promise<User>;
|
|
24
|
+
create(user: User, password: string, invitationCode?: string | null): Promise<User>;
|
|
25
|
+
requestResetPassword(email: string): Promise<boolean>;
|
|
26
|
+
resetPassword(code: string, password: string): Promise<boolean>;
|
|
27
|
+
createWebPush(session: UserNotificationSession): Promise<boolean>;
|
|
28
|
+
getSessions(pagination: CursorPagination): Promise<CollectionResult<UserNotificationSession>>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
import { UserAuthProvider } from '../Model/User/UserAuthProvider.js';
|
|
2
|
+
import { User } from '../Model/User/User.js';
|
|
3
|
+
import { UserSummary } from '../Model/User/UserSummary.js';
|
|
4
|
+
import { Endpoint } from './Endpoint.js';
|
|
5
|
+
import { UserNotificationSession } from '../Model/User/UserNotificationSession.js';
|
|
6
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
7
|
+
import { State } from '../Model/State.js';
|
|
8
|
+
export class UserEndpoint extends Endpoint {
|
|
9
|
+
async getUser() {
|
|
10
|
+
const cmd = '/users';
|
|
11
|
+
const rawUser = await this.requestObject(cmd, null, User.parse);
|
|
12
|
+
return rawUser.getData();
|
|
13
|
+
}
|
|
14
|
+
async removeAuthProvider(providerId) {
|
|
15
|
+
try {
|
|
16
|
+
const parser = (raw) => ({ deleted: raw.deleted });
|
|
17
|
+
const result = await this.requestObject('/users/auth/providers', { provider: providerId }, parser, 'DELETE');
|
|
18
|
+
const re = result.getData();
|
|
19
|
+
if (re === null) {
|
|
20
|
+
throw new Error('Unable to remove auth provider: wrong response from API');
|
|
21
|
+
}
|
|
22
|
+
return re.deleted;
|
|
23
|
+
}
|
|
24
|
+
catch (e) {
|
|
25
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
26
|
+
console.error('Failed to assign auth provider: ', e);
|
|
27
|
+
}
|
|
28
|
+
throw e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Resolve display-safe summaries for a set of user ids (e.g. to show "Requested by" names in a
|
|
33
|
+
* list). The server applies visibility rules and returns tombstones ("Unknown user" / "Removed
|
|
34
|
+
* user") rather than leaking anything the caller isn't allowed to see.
|
|
35
|
+
*/
|
|
36
|
+
async getSummaries(userIds) {
|
|
37
|
+
if (userIds.length === 0) {
|
|
38
|
+
return [];
|
|
39
|
+
}
|
|
40
|
+
const queryString = new QueryString('/users/summaries');
|
|
41
|
+
queryString.set('id', userIds);
|
|
42
|
+
const result = await this.requestCollection(queryString, UserEndpoint.parseSummary, null, 'GET');
|
|
43
|
+
return result.getData();
|
|
44
|
+
}
|
|
45
|
+
static parseSummary(raw) {
|
|
46
|
+
const summary = new UserSummary();
|
|
47
|
+
summary.id = raw.id;
|
|
48
|
+
summary.type = raw.type;
|
|
49
|
+
summary.state = (raw.state === null || raw.state === undefined) ? null : State.fromString(raw.state);
|
|
50
|
+
summary.displayName = raw.display_name;
|
|
51
|
+
return summary;
|
|
52
|
+
}
|
|
53
|
+
async getAuthProviders() {
|
|
54
|
+
const cmd = '/users/auth/providers';
|
|
55
|
+
const rawAuthProviders = await this.requestCollection(cmd, UserAuthProvider.parse);
|
|
56
|
+
return rawAuthProviders;
|
|
57
|
+
}
|
|
58
|
+
async getPermissions() {
|
|
59
|
+
const cmd = '/permissions';
|
|
60
|
+
const parser = (raw) => ({ key: raw.key, allowed: raw.allowed });
|
|
61
|
+
const data = await this.requestCollection(cmd, parser);
|
|
62
|
+
return data;
|
|
63
|
+
}
|
|
64
|
+
async update(user) {
|
|
65
|
+
try {
|
|
66
|
+
const url = '/users/' + user.id;
|
|
67
|
+
const result = await this.requestObject(url, user, User.parse, 'POST');
|
|
68
|
+
const updatedUser = result.getData();
|
|
69
|
+
if (updatedUser === null) {
|
|
70
|
+
throw new Error('User not updated');
|
|
71
|
+
}
|
|
72
|
+
return updatedUser;
|
|
73
|
+
}
|
|
74
|
+
catch (e) {
|
|
75
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
76
|
+
console.error('Failed to save user: ', e);
|
|
77
|
+
}
|
|
78
|
+
throw e;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
async create(user, password, invitationCode = null) {
|
|
82
|
+
try {
|
|
83
|
+
const url = '/users/';
|
|
84
|
+
const data = { ...user, password, invitation_code: invitationCode };
|
|
85
|
+
const result = await this.requestObject(url, data, User.parse, 'PUT', false);
|
|
86
|
+
const createdUser = result.getData();
|
|
87
|
+
if (createdUser === null) {
|
|
88
|
+
throw new Error('User not created');
|
|
89
|
+
}
|
|
90
|
+
return createdUser;
|
|
91
|
+
}
|
|
92
|
+
catch (e) {
|
|
93
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
94
|
+
console.error('Failed to create user: ', e);
|
|
95
|
+
}
|
|
96
|
+
throw e;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async requestResetPassword(email) {
|
|
100
|
+
try {
|
|
101
|
+
const url = '/users/resetpassword';
|
|
102
|
+
const parser = (raw) => ({ requested: raw.requested });
|
|
103
|
+
const result = await this.requestObject(url, { email }, parser, 'POST', false);
|
|
104
|
+
const re = result.getData();
|
|
105
|
+
if (re === null) {
|
|
106
|
+
throw new Error('Unable to request password reset: wrong response from API');
|
|
107
|
+
}
|
|
108
|
+
return re.requested;
|
|
109
|
+
}
|
|
110
|
+
catch (e) {
|
|
111
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
112
|
+
console.error('Failed to save user: ', e);
|
|
113
|
+
}
|
|
114
|
+
throw e;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
async resetPassword(code, password) {
|
|
118
|
+
try {
|
|
119
|
+
const url = '/users/resetpassword/' + code;
|
|
120
|
+
const parser = (raw) => ({ updated: raw.updated });
|
|
121
|
+
const result = await this.requestObject(url, { password }, parser, 'POST', false);
|
|
122
|
+
const re = result.getData();
|
|
123
|
+
if (re === null) {
|
|
124
|
+
throw new Error('Unable to reset password: wrong response from API');
|
|
125
|
+
}
|
|
126
|
+
return re.updated;
|
|
127
|
+
}
|
|
128
|
+
catch (e) {
|
|
129
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
130
|
+
console.error('Failed to save user: ', e);
|
|
131
|
+
}
|
|
132
|
+
throw e;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
async createWebPush(session) {
|
|
136
|
+
try {
|
|
137
|
+
const url = '/webpush';
|
|
138
|
+
const data = {
|
|
139
|
+
session: session.session,
|
|
140
|
+
subscription: session.subscription,
|
|
141
|
+
expires_at: session.expiresAt,
|
|
142
|
+
os: session.os,
|
|
143
|
+
browser: session.browser,
|
|
144
|
+
};
|
|
145
|
+
const parser = (raw) => ({ created: raw.created });
|
|
146
|
+
const result = await this.requestObject(url, data, parser, 'POST', true);
|
|
147
|
+
const re = result.getData();
|
|
148
|
+
if (re === null) {
|
|
149
|
+
throw new Error('Unable to request web push: wrong response from API');
|
|
150
|
+
}
|
|
151
|
+
return re.created;
|
|
152
|
+
}
|
|
153
|
+
catch (e) {
|
|
154
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
155
|
+
console.error('Failed to create web push: ', e);
|
|
156
|
+
}
|
|
157
|
+
throw e;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
async getSessions(pagination) {
|
|
161
|
+
const queryString = new QueryString('/webpush');
|
|
162
|
+
queryString.addPagination(pagination);
|
|
163
|
+
const parser = (raw) => {
|
|
164
|
+
const session = new UserNotificationSession();
|
|
165
|
+
session.id = raw.id;
|
|
166
|
+
session.session = raw.session;
|
|
167
|
+
session.state = State.fromString(raw.state);
|
|
168
|
+
session.createdAt = raw.created_at;
|
|
169
|
+
session.updatedAt = raw.updated_at;
|
|
170
|
+
session.expiresAt = raw.expires_at;
|
|
171
|
+
session.os = raw.os;
|
|
172
|
+
session.browser = raw.browser;
|
|
173
|
+
return session;
|
|
174
|
+
};
|
|
175
|
+
const rawTriggers = await this.requestCollection(queryString, parser);
|
|
176
|
+
return rawTriggers;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Endpoint } from './Endpoint.js';
|
|
2
|
+
import { Workspace } from '../Model/Workspace/Workspace.js';
|
|
3
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
4
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
5
|
+
export declare class WorkspaceEndpoint extends Endpoint {
|
|
6
|
+
getAll(pagination?: CursorPagination | null): Promise<CollectionResult<Workspace>>;
|
|
7
|
+
getById(workspaceId: string): Promise<Workspace | null>;
|
|
8
|
+
save(workspace: Workspace): Promise<Workspace>;
|
|
9
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Endpoint } from './Endpoint.js';
|
|
2
|
+
import { Workspace } from '../Model/Workspace/Workspace.js';
|
|
3
|
+
import { QueryString } from '../Http/Data/QueryString.js';
|
|
4
|
+
export class WorkspaceEndpoint extends Endpoint {
|
|
5
|
+
async getAll(pagination = null) {
|
|
6
|
+
try {
|
|
7
|
+
const queryString = new QueryString('/workspaces');
|
|
8
|
+
queryString.addPagination(pagination);
|
|
9
|
+
const result = await this.requestCollection(queryString, Workspace.parse);
|
|
10
|
+
return result;
|
|
11
|
+
}
|
|
12
|
+
catch (e) {
|
|
13
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
14
|
+
console.error('Failed to load workspaces: ' + e);
|
|
15
|
+
}
|
|
16
|
+
throw e;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
async getById(workspaceId) {
|
|
20
|
+
try {
|
|
21
|
+
const url = '/workspaces/' + workspaceId + '';
|
|
22
|
+
const result = await this.requestObject(url, null, Workspace.parse);
|
|
23
|
+
return result.getData();
|
|
24
|
+
}
|
|
25
|
+
catch (error) {
|
|
26
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
27
|
+
console.error('Failed to load workspace by id: ', error);
|
|
28
|
+
}
|
|
29
|
+
throw error;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
async save(workspace) {
|
|
33
|
+
try {
|
|
34
|
+
const url = '/workspaces';
|
|
35
|
+
const result = await this.requestObject(url, workspace, Workspace.parse, 'POST');
|
|
36
|
+
const updatedWorkspace = result.getData();
|
|
37
|
+
if (updatedWorkspace === null) {
|
|
38
|
+
throw new Error('Workspace not updated');
|
|
39
|
+
}
|
|
40
|
+
return updatedWorkspace;
|
|
41
|
+
}
|
|
42
|
+
catch (error) {
|
|
43
|
+
if (this.httpClient.isDebugEnabled()) {
|
|
44
|
+
console.error('Failed to save workspace: ', error);
|
|
45
|
+
}
|
|
46
|
+
throw error;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { CursorPagination } from '../Model/Pagination/CursorPagination.js';
|
|
2
|
+
import { CollectionResult } from '../Model/Result/CollectionResult.js';
|
|
3
|
+
import { WorkspaceMember } from '../Model/Workspace/WorkspaceMember.js';
|
|
4
|
+
import { WorkspaceMemberInvite } from '../Model/Workspace/WorkspaceMemberInvite.js';
|
|
5
|
+
import { WorkspaceMemberInvite2 } from '../Model/Workspace/WorkspaceMemberInvite2.js';
|
|
6
|
+
import { WorkspaceMemberRole } from '../Model/Workspace/WorkspaceMemberRole.js';
|
|
7
|
+
import { Endpoint } from './Endpoint.js';
|
|
8
|
+
export declare class WorkspaceMemberEndpoint extends Endpoint {
|
|
9
|
+
getByWorkspace(workspaceId: string, pagination?: CursorPagination | null): Promise<CollectionResult<WorkspaceMember>>;
|
|
10
|
+
invite(workspaceId: string, invites: WorkspaceMemberInvite[]): Promise<boolean>;
|
|
11
|
+
getWorkspaceInviteByCode(inviteCode: string): Promise<WorkspaceMemberInvite2 | null>;
|
|
12
|
+
getRoles(workspaceId: string): Promise<CollectionResult<WorkspaceMemberRole>>;
|
|
13
|
+
saveMember(member: WorkspaceMember): Promise<WorkspaceMember>;
|
|
14
|
+
}
|