@sudoplatform/sudo-privacy-interaction 2.0.0 → 2.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/cjs/gen/graphqlTypes.js +2291 -780
- package/cjs/private/data/action/actionSubscriptionManager.js +25 -0
- package/cjs/private/data/action/defaultActionService.js +80 -0
- package/cjs/private/data/action/transformer/actionFulfilmentMethodTransformer.js +47 -0
- package/cjs/private/data/action/transformer/actionIntentTransformer.js +69 -0
- package/cjs/private/data/action/transformer/actionOriginTransformer.js +37 -0
- package/cjs/private/data/action/transformer/actionStatusTransformer.js +53 -0
- package/cjs/private/data/action/transformer/actionTransformer.js +85 -0
- package/cjs/private/data/action/transformer/availableActionTransformer.js +37 -0
- package/cjs/private/data/analysis-result/transformer/privacyScoreTransformer.js +8 -0
- package/cjs/private/data/common/apiClient.js +58 -0
- package/cjs/private/data/data-holder/defaultDataHolderService.js +12 -0
- package/cjs/private/data/data-holder/transformer/dataHolderScanSummaryTransformer.js +56 -0
- package/cjs/private/data/organization-analysis/defaultOrganizationAnalysisService.js +31 -0
- package/cjs/private/data/organization-analysis/transformer/organizationAnalysisModeTransformer.js +29 -0
- package/cjs/private/data/organization-analysis/transformer/organizationAnalysisTransformer.js +45 -0
- package/cjs/private/data/virtual-presence/transformer/virtualPresenceTransformer.js +2 -0
- package/cjs/private/domain/entities/action/actionEntity.js +86 -0
- package/cjs/private/domain/entities/action/actionService.js +7 -0
- package/cjs/private/domain/entities/organization-analysis/organizationAnalysisEntity.js +24 -0
- package/cjs/private/domain/entities/organization-analysis/organizationAnalysisService.js +7 -0
- package/cjs/private/domain/use-cases/action/confirmActionOutcomeUseCase.js +25 -0
- package/cjs/private/domain/use-cases/action/initiateActionUseCase.js +26 -0
- package/cjs/private/domain/use-cases/action/listAvailableActionsUseCase.js +26 -0
- package/cjs/private/domain/use-cases/action/subscribeToActionUseCase.js +37 -0
- package/cjs/private/domain/use-cases/action/unsubscribeFromActionUseCase.js +27 -0
- package/cjs/private/domain/use-cases/data-holder/listDataHolderScanSummariesUseCase.js +29 -0
- package/cjs/private/domain/use-cases/organization-analysis/getOrganizationAnalysisUseCase.js +25 -0
- package/cjs/public/defaultSudoPrivacyInteractionClient.js +133 -6
- package/cjs/public/inputs/action.js +7 -0
- package/cjs/public/inputs/index.js +2 -0
- package/cjs/public/inputs/organizationAnalysis.js +7 -0
- package/cjs/public/typings/action.js +85 -0
- package/cjs/public/typings/index.js +2 -0
- package/cjs/public/typings/organizationAnalysis.js +24 -0
- package/docs/assets/hierarchy.js +1 -1
- package/docs/assets/navigation.js +1 -1
- package/docs/assets/search.js +1 -1
- package/docs/classes/DefaultSudoPrivacyInteractionClient.html +176 -21
- package/docs/enums/ActionFulfilmentMethod.html +63 -0
- package/docs/enums/ActionIntent.html +84 -0
- package/docs/enums/ActionOrigin.html +75 -0
- package/docs/enums/ActionStatus.html +99 -0
- package/docs/enums/ConnectionState.html +3 -3
- package/docs/enums/DataCategory.html +18 -18
- package/docs/enums/DataHolderProtectionState.html +5 -5
- package/docs/enums/OrganizationAnalysisMode.html +70 -0
- package/docs/enums/OrganizationCategory.html +30 -30
- package/docs/enums/ProviderType.html +3 -3
- package/docs/enums/RetentionStyle.html +5 -5
- package/docs/enums/ShareStyle.html +6 -6
- package/docs/enums/SignalValue.html +4 -4
- package/docs/enums/VirtualPresenceState.html +7 -7
- package/docs/hierarchy.html +6 -5
- package/docs/interfaces/Action.html +167 -0
- package/docs/interfaces/ActionContact.html +77 -0
- package/docs/interfaces/ActionSubscriber.html +92 -0
- package/docs/interfaces/AnalysisResultSubscriber.html +3 -3
- package/docs/interfaces/AssistedEmailTemplate.html +70 -0
- package/docs/interfaces/AssistedPayload.html +113 -0
- package/docs/interfaces/AvailableAction.html +102 -0
- package/docs/interfaces/CapabilitySignals.html +9 -9
- package/docs/interfaces/CategorySignals.html +11 -11
- package/docs/interfaces/DataHolder.html +24 -14
- package/docs/interfaces/DataHolderScanSummary.html +158 -0
- package/docs/interfaces/DataHolderSubscriber.html +3 -3
- package/docs/interfaces/GetDataHolderOptions.html +63 -0
- package/docs/interfaces/GetOrganizationAnalysisInput.html +70 -0
- package/docs/interfaces/InitiateActionInput.html +79 -0
- package/docs/interfaces/ListAnalysisResultsInput.html +1 -1
- package/docs/interfaces/ListAvailableActionsInput.html +61 -0
- package/docs/interfaces/ListDataHolderScanSummariesInput.html +85 -0
- package/docs/interfaces/ListDataHoldersInput.html +1 -1
- package/docs/interfaces/ListVirtualPresencesInput.html +1 -1
- package/docs/interfaces/OrganizationAnalysis.html +131 -0
- package/docs/interfaces/OrganizationIdentity.html +5 -5
- package/docs/interfaces/Pagination.html +2 -1
- package/docs/interfaces/PrivacyScore.html +13 -5
- package/docs/interfaces/PrivacySummary.html +4 -4
- package/docs/interfaces/RetentionInfo.html +4 -4
- package/docs/interfaces/RiskIndicators.html +8 -8
- package/docs/interfaces/ScoreContribution.html +3 -3
- package/docs/interfaces/ScoreCoverage.html +70 -0
- package/docs/interfaces/SudoPrivacyInteractionClient.html +169 -21
- package/docs/interfaces/VirtualPresence.html +21 -12
- package/docs/interfaces/VirtualPresenceSubscriber.html +3 -3
- package/docs/modules.html +4 -4
- package/docs/types/SudoPrivacyInteractionClientOptions.html +2 -2
- package/lib/gen/graphqlTypes.js +2290 -779
- package/lib/private/data/action/actionSubscriptionManager.js +21 -0
- package/lib/private/data/action/defaultActionService.js +76 -0
- package/lib/private/data/action/transformer/actionFulfilmentMethodTransformer.js +43 -0
- package/lib/private/data/action/transformer/actionIntentTransformer.js +65 -0
- package/lib/private/data/action/transformer/actionOriginTransformer.js +33 -0
- package/lib/private/data/action/transformer/actionStatusTransformer.js +49 -0
- package/lib/private/data/action/transformer/actionTransformer.js +81 -0
- package/lib/private/data/action/transformer/availableActionTransformer.js +33 -0
- package/lib/private/data/analysis-result/transformer/privacyScoreTransformer.js +8 -0
- package/lib/private/data/common/apiClient.js +59 -1
- package/lib/private/data/data-holder/defaultDataHolderService.js +12 -0
- package/lib/private/data/data-holder/transformer/dataHolderScanSummaryTransformer.js +52 -0
- package/lib/private/data/organization-analysis/defaultOrganizationAnalysisService.js +27 -0
- package/lib/private/data/organization-analysis/transformer/organizationAnalysisModeTransformer.js +25 -0
- package/lib/private/data/organization-analysis/transformer/organizationAnalysisTransformer.js +41 -0
- package/lib/private/data/virtual-presence/transformer/virtualPresenceTransformer.js +2 -0
- package/lib/private/domain/entities/action/actionEntity.js +83 -0
- package/lib/private/domain/entities/action/actionService.js +6 -0
- package/lib/private/domain/entities/organization-analysis/organizationAnalysisEntity.js +21 -0
- package/lib/private/domain/entities/organization-analysis/organizationAnalysisService.js +6 -0
- package/lib/private/domain/use-cases/action/confirmActionOutcomeUseCase.js +21 -0
- package/lib/private/domain/use-cases/action/initiateActionUseCase.js +22 -0
- package/lib/private/domain/use-cases/action/listAvailableActionsUseCase.js +22 -0
- package/lib/private/domain/use-cases/action/subscribeToActionUseCase.js +33 -0
- package/lib/private/domain/use-cases/action/unsubscribeFromActionUseCase.js +23 -0
- package/lib/private/domain/use-cases/data-holder/listDataHolderScanSummariesUseCase.js +25 -0
- package/lib/private/domain/use-cases/organization-analysis/getOrganizationAnalysisUseCase.js +21 -0
- package/lib/public/defaultSudoPrivacyInteractionClient.js +133 -6
- package/lib/public/inputs/action.js +6 -0
- package/lib/public/inputs/index.js +2 -0
- package/lib/public/inputs/organizationAnalysis.js +6 -0
- package/lib/public/typings/action.js +82 -0
- package/lib/public/typings/index.js +2 -0
- package/lib/public/typings/organizationAnalysis.js +21 -0
- package/package.json +5 -3
- package/types/gen/graphqlTypes.d.ts +569 -1
- package/types/private/data/action/actionSubscriptionManager.d.ts +19 -0
- package/types/private/data/action/defaultActionService.d.ts +23 -0
- package/types/private/data/action/transformer/actionFulfilmentMethodTransformer.d.ts +14 -0
- package/types/private/data/action/transformer/actionIntentTransformer.d.ts +14 -0
- package/types/private/data/action/transformer/actionOriginTransformer.d.ts +12 -0
- package/types/private/data/action/transformer/actionStatusTransformer.d.ts +12 -0
- package/types/private/data/action/transformer/actionTransformer.d.ts +39 -0
- package/types/private/data/action/transformer/availableActionTransformer.d.ts +15 -0
- package/types/private/data/common/apiClient.d.ts +16 -1
- package/types/private/data/common/baseSubscriptionManager.d.ts +5 -0
- package/types/private/data/data-holder/defaultDataHolderService.d.ts +3 -1
- package/types/private/data/data-holder/transformer/dataHolderScanSummaryTransformer.d.ts +18 -0
- package/types/private/data/organization-analysis/defaultOrganizationAnalysisService.d.ts +15 -0
- package/types/private/data/organization-analysis/transformer/organizationAnalysisModeTransformer.d.ts +12 -0
- package/types/private/data/organization-analysis/transformer/organizationAnalysisTransformer.d.ts +14 -0
- package/types/private/domain/entities/action/actionEntity.d.ts +187 -0
- package/types/private/domain/entities/action/actionService.d.ts +99 -0
- package/types/private/domain/entities/analysis-result/analysisResultEntity.d.ts +14 -0
- package/types/private/domain/entities/data-holder/dataHolderEntity.d.ts +34 -0
- package/types/private/domain/entities/data-holder/dataHolderService.d.ts +35 -1
- package/types/private/domain/entities/organization-analysis/organizationAnalysisEntity.d.ts +53 -0
- package/types/private/domain/entities/organization-analysis/organizationAnalysisService.d.ts +35 -0
- package/types/private/domain/entities/virtual-presence/virtualPresenceEntity.d.ts +3 -0
- package/types/private/domain/use-cases/action/confirmActionOutcomeUseCase.d.ts +16 -0
- package/types/private/domain/use-cases/action/initiateActionUseCase.d.ts +17 -0
- package/types/private/domain/use-cases/action/listAvailableActionsUseCase.d.ts +16 -0
- package/types/private/domain/use-cases/action/subscribeToActionUseCase.d.ts +27 -0
- package/types/private/domain/use-cases/action/unsubscribeFromActionUseCase.d.ts +15 -0
- package/types/private/domain/use-cases/data-holder/listDataHolderScanSummariesUseCase.d.ts +36 -0
- package/types/private/domain/use-cases/organization-analysis/getOrganizationAnalysisUseCase.d.ts +16 -0
- package/types/public/defaultSudoPrivacyInteractionClient.d.ts +19 -3
- package/types/public/inputs/action.d.ts +30 -0
- package/types/public/inputs/dataHolder.d.ts +22 -0
- package/types/public/inputs/index.d.ts +2 -0
- package/types/public/inputs/organizationAnalysis.d.ts +18 -0
- package/types/public/sudoPrivacyInteractionClient.d.ts +64 -3
- package/types/public/typings/action.d.ts +185 -0
- package/types/public/typings/analysisResult.d.ts +14 -0
- package/types/public/typings/dataHolder.d.ts +38 -0
- package/types/public/typings/index.d.ts +2 -0
- package/types/public/typings/organizationAnalysis.d.ts +53 -0
- package/types/public/typings/subscription.d.ts +23 -0
- package/types/public/typings/virtualPresence.d.ts +3 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { BaseSubscriptionManager } from '../common/baseSubscriptionManager';
|
|
7
|
+
export class ActionSubscriptionManager extends BaseSubscriptionManager {
|
|
8
|
+
/**
|
|
9
|
+
* Notifies subscribers of an action status update.
|
|
10
|
+
*
|
|
11
|
+
* @param action The updated action.
|
|
12
|
+
*/
|
|
13
|
+
actionUpdated(action) {
|
|
14
|
+
for (const subscriber of this.getSubscribers()) {
|
|
15
|
+
subscriber.actionUpdated(action);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
connectionStatusChanged(state) {
|
|
19
|
+
super.connectionStatusChanged(state);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ConnectionState, } from '../../../public/typings/subscription';
|
|
7
|
+
import { ActionSubscriptionManager } from './actionSubscriptionManager';
|
|
8
|
+
import { ActionFulfilmentMethodTransformer } from './transformer/actionFulfilmentMethodTransformer';
|
|
9
|
+
import { ActionIntentTransformer } from './transformer/actionIntentTransformer';
|
|
10
|
+
import { ActionTransformer } from './transformer/actionTransformer';
|
|
11
|
+
import { AvailableActionTransformer } from './transformer/availableActionTransformer';
|
|
12
|
+
export class DefaultActionService {
|
|
13
|
+
appSync;
|
|
14
|
+
actionTransformer;
|
|
15
|
+
availableActionTransformer;
|
|
16
|
+
intentTransformer;
|
|
17
|
+
fulfilmentMethodTransformer;
|
|
18
|
+
subscriptionManager;
|
|
19
|
+
constructor(appSync) {
|
|
20
|
+
this.appSync = appSync;
|
|
21
|
+
this.actionTransformer = new ActionTransformer();
|
|
22
|
+
this.availableActionTransformer = new AvailableActionTransformer();
|
|
23
|
+
this.intentTransformer = new ActionIntentTransformer();
|
|
24
|
+
this.fulfilmentMethodTransformer = new ActionFulfilmentMethodTransformer();
|
|
25
|
+
this.subscriptionManager = new ActionSubscriptionManager();
|
|
26
|
+
}
|
|
27
|
+
async initiate(input) {
|
|
28
|
+
const result = await this.appSync.initiateAction({
|
|
29
|
+
dataHolderId: input.dataHolderId,
|
|
30
|
+
intent: this.intentTransformer.fromEntityToGraphQL(input.intent),
|
|
31
|
+
fulfilmentMethod: this.fulfilmentMethodTransformer.fromEntityToGraphQL(input.fulfilmentMethod),
|
|
32
|
+
});
|
|
33
|
+
return this.actionTransformer.fromGraphQLToEntity(result);
|
|
34
|
+
}
|
|
35
|
+
async confirmOutcome(id) {
|
|
36
|
+
const result = await this.appSync.confirmActionOutcome(id);
|
|
37
|
+
return this.actionTransformer.fromGraphQLToEntity(result);
|
|
38
|
+
}
|
|
39
|
+
async listAvailable(input) {
|
|
40
|
+
const result = await this.appSync.listAvailableActions(input);
|
|
41
|
+
const availableActions = (result.items ?? []).map((item) => this.availableActionTransformer.fromGraphQLToEntity(item));
|
|
42
|
+
return {
|
|
43
|
+
availableActions,
|
|
44
|
+
nextToken: result.nextToken ?? undefined,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
async subscribe(input) {
|
|
48
|
+
this.subscriptionManager.subscribe(input.subscriptionId, input.subscriber);
|
|
49
|
+
if (!this.subscriptionManager.getWatcher()) {
|
|
50
|
+
this.subscriptionManager.setWatcher(await this.appSync.onActionStatusUpdated(input.owner));
|
|
51
|
+
this.subscriptionManager.setSubscription(this.setupUpdateSubscription());
|
|
52
|
+
this.subscriptionManager.connectionStatusChanged(ConnectionState.Connected);
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
unsubscribe(subscriptionId) {
|
|
56
|
+
this.subscriptionManager.unsubscribe(subscriptionId);
|
|
57
|
+
}
|
|
58
|
+
setupUpdateSubscription() {
|
|
59
|
+
const subscription = this.subscriptionManager.getWatcher()?.subscribe({
|
|
60
|
+
complete: () => {
|
|
61
|
+
this.subscriptionManager.connectionStatusChanged(ConnectionState.Disconnected);
|
|
62
|
+
},
|
|
63
|
+
error: () => {
|
|
64
|
+
this.subscriptionManager.connectionStatusChanged(ConnectionState.Disconnected);
|
|
65
|
+
},
|
|
66
|
+
next: (result) => {
|
|
67
|
+
const action = result.data?.onActionStatusUpdate;
|
|
68
|
+
if (action) {
|
|
69
|
+
const entity = this.actionTransformer.fromGraphQLToEntity(action);
|
|
70
|
+
this.subscriptionManager.actionUpdated(this.actionTransformer.fromEntityToAPI(entity));
|
|
71
|
+
}
|
|
72
|
+
},
|
|
73
|
+
});
|
|
74
|
+
return subscription;
|
|
75
|
+
}
|
|
76
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ActionFulfilmentMethod } from '../../../../public';
|
|
7
|
+
import { ActionFulfilmentMethodEntity } from '../../../domain/entities/action/actionEntity';
|
|
8
|
+
export class ActionFulfilmentMethodTransformer {
|
|
9
|
+
fromEntityToAPI(entity) {
|
|
10
|
+
switch (entity) {
|
|
11
|
+
case ActionFulfilmentMethodEntity.Assisted:
|
|
12
|
+
return ActionFulfilmentMethod.Assisted;
|
|
13
|
+
case ActionFulfilmentMethodEntity.Delegated:
|
|
14
|
+
return ActionFulfilmentMethod.Delegated;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
fromAPIToEntity(data) {
|
|
18
|
+
switch (data) {
|
|
19
|
+
case ActionFulfilmentMethod.Assisted:
|
|
20
|
+
return ActionFulfilmentMethodEntity.Assisted;
|
|
21
|
+
case ActionFulfilmentMethod.Delegated:
|
|
22
|
+
return ActionFulfilmentMethodEntity.Delegated;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
fromGraphQLToEntity(data) {
|
|
26
|
+
switch (data) {
|
|
27
|
+
case 'ASSISTED':
|
|
28
|
+
return ActionFulfilmentMethodEntity.Assisted;
|
|
29
|
+
case 'DELEGATED':
|
|
30
|
+
return ActionFulfilmentMethodEntity.Delegated;
|
|
31
|
+
default:
|
|
32
|
+
return ActionFulfilmentMethodEntity.Assisted;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
fromEntityToGraphQL(entity) {
|
|
36
|
+
switch (entity) {
|
|
37
|
+
case ActionFulfilmentMethodEntity.Assisted:
|
|
38
|
+
return 'ASSISTED';
|
|
39
|
+
case ActionFulfilmentMethodEntity.Delegated:
|
|
40
|
+
return 'DELEGATED';
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ActionIntent } from '../../../../public';
|
|
7
|
+
import { ActionIntentEntity } from '../../../domain/entities/action/actionEntity';
|
|
8
|
+
export class ActionIntentTransformer {
|
|
9
|
+
fromEntityToAPI(entity) {
|
|
10
|
+
switch (entity) {
|
|
11
|
+
case ActionIntentEntity.StopContact:
|
|
12
|
+
return ActionIntent.StopContact;
|
|
13
|
+
case ActionIntentEntity.AccessMyData:
|
|
14
|
+
return ActionIntent.AccessMyData;
|
|
15
|
+
case ActionIntentEntity.DeleteMyData:
|
|
16
|
+
return ActionIntent.DeleteMyData;
|
|
17
|
+
case ActionIntentEntity.LimitDataUse:
|
|
18
|
+
return ActionIntent.LimitDataUse;
|
|
19
|
+
case ActionIntentEntity.Other:
|
|
20
|
+
return ActionIntent.Other;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
fromAPIToEntity(data) {
|
|
24
|
+
switch (data) {
|
|
25
|
+
case ActionIntent.StopContact:
|
|
26
|
+
return ActionIntentEntity.StopContact;
|
|
27
|
+
case ActionIntent.AccessMyData:
|
|
28
|
+
return ActionIntentEntity.AccessMyData;
|
|
29
|
+
case ActionIntent.DeleteMyData:
|
|
30
|
+
return ActionIntentEntity.DeleteMyData;
|
|
31
|
+
case ActionIntent.LimitDataUse:
|
|
32
|
+
return ActionIntentEntity.LimitDataUse;
|
|
33
|
+
case ActionIntent.Other:
|
|
34
|
+
return ActionIntentEntity.Other;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
fromGraphQLToEntity(data) {
|
|
38
|
+
switch (data) {
|
|
39
|
+
case 'STOP_CONTACT':
|
|
40
|
+
return ActionIntentEntity.StopContact;
|
|
41
|
+
case 'ACCESS_MY_DATA':
|
|
42
|
+
return ActionIntentEntity.AccessMyData;
|
|
43
|
+
case 'DELETE_MY_DATA':
|
|
44
|
+
return ActionIntentEntity.DeleteMyData;
|
|
45
|
+
case 'LIMIT_DATA_USE':
|
|
46
|
+
return ActionIntentEntity.LimitDataUse;
|
|
47
|
+
default:
|
|
48
|
+
return ActionIntentEntity.Other;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
fromEntityToGraphQL(entity) {
|
|
52
|
+
switch (entity) {
|
|
53
|
+
case ActionIntentEntity.StopContact:
|
|
54
|
+
return 'STOP_CONTACT';
|
|
55
|
+
case ActionIntentEntity.AccessMyData:
|
|
56
|
+
return 'ACCESS_MY_DATA';
|
|
57
|
+
case ActionIntentEntity.DeleteMyData:
|
|
58
|
+
return 'DELETE_MY_DATA';
|
|
59
|
+
case ActionIntentEntity.LimitDataUse:
|
|
60
|
+
return 'LIMIT_DATA_USE';
|
|
61
|
+
case ActionIntentEntity.Other:
|
|
62
|
+
return 'OTHER';
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ActionOrigin } from '../../../../public';
|
|
7
|
+
import { ActionOriginEntity } from '../../../domain/entities/action/actionEntity';
|
|
8
|
+
export class ActionOriginTransformer {
|
|
9
|
+
fromEntityToAPI(entity) {
|
|
10
|
+
switch (entity) {
|
|
11
|
+
case ActionOriginEntity.Static:
|
|
12
|
+
return ActionOrigin.Static;
|
|
13
|
+
case ActionOriginEntity.Analysis:
|
|
14
|
+
return ActionOrigin.Analysis;
|
|
15
|
+
case ActionOriginEntity.Discovery:
|
|
16
|
+
return ActionOrigin.Discovery;
|
|
17
|
+
case ActionOriginEntity.Unknown:
|
|
18
|
+
return ActionOrigin.Unknown;
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
fromGraphQLToEntity(data) {
|
|
22
|
+
switch (data) {
|
|
23
|
+
case 'STATIC':
|
|
24
|
+
return ActionOriginEntity.Static;
|
|
25
|
+
case 'ANALYSIS':
|
|
26
|
+
return ActionOriginEntity.Analysis;
|
|
27
|
+
case 'DISCOVERY':
|
|
28
|
+
return ActionOriginEntity.Discovery;
|
|
29
|
+
default:
|
|
30
|
+
return ActionOriginEntity.Unknown;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ActionStatus } from '../../../../public';
|
|
7
|
+
import { ActionStatusEntity } from '../../../domain/entities/action/actionEntity';
|
|
8
|
+
export class ActionStatusTransformer {
|
|
9
|
+
fromEntityToAPI(entity) {
|
|
10
|
+
switch (entity) {
|
|
11
|
+
case ActionStatusEntity.Pending:
|
|
12
|
+
return ActionStatus.Pending;
|
|
13
|
+
case ActionStatusEntity.InProgress:
|
|
14
|
+
return ActionStatus.InProgress;
|
|
15
|
+
case ActionStatusEntity.CompletedUnverified:
|
|
16
|
+
return ActionStatus.CompletedUnverified;
|
|
17
|
+
case ActionStatusEntity.CompletedVerified:
|
|
18
|
+
return ActionStatus.CompletedVerified;
|
|
19
|
+
case ActionStatusEntity.Failed:
|
|
20
|
+
return ActionStatus.Failed;
|
|
21
|
+
case ActionStatusEntity.RequiresUserInput:
|
|
22
|
+
return ActionStatus.RequiresUserInput;
|
|
23
|
+
case ActionStatusEntity.Contradicted:
|
|
24
|
+
return ActionStatus.Contradicted;
|
|
25
|
+
case ActionStatusEntity.Unknown:
|
|
26
|
+
return ActionStatus.Unknown;
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
fromGraphQLToEntity(data) {
|
|
30
|
+
switch (data) {
|
|
31
|
+
case 'PENDING':
|
|
32
|
+
return ActionStatusEntity.Pending;
|
|
33
|
+
case 'IN_PROGRESS':
|
|
34
|
+
return ActionStatusEntity.InProgress;
|
|
35
|
+
case 'COMPLETED_UNVERIFIED':
|
|
36
|
+
return ActionStatusEntity.CompletedUnverified;
|
|
37
|
+
case 'COMPLETED_VERIFIED':
|
|
38
|
+
return ActionStatusEntity.CompletedVerified;
|
|
39
|
+
case 'FAILED':
|
|
40
|
+
return ActionStatusEntity.Failed;
|
|
41
|
+
case 'REQUIRES_USER_INPUT':
|
|
42
|
+
return ActionStatusEntity.RequiresUserInput;
|
|
43
|
+
case 'CONTRADICTED':
|
|
44
|
+
return ActionStatusEntity.Contradicted;
|
|
45
|
+
default:
|
|
46
|
+
return ActionStatusEntity.Unknown;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ActionFulfilmentMethodTransformer } from './actionFulfilmentMethodTransformer';
|
|
7
|
+
import { ActionIntentTransformer } from './actionIntentTransformer';
|
|
8
|
+
import { ActionStatusTransformer } from './actionStatusTransformer';
|
|
9
|
+
export class ActionTransformer {
|
|
10
|
+
intentTransformer = new ActionIntentTransformer();
|
|
11
|
+
fulfilmentMethodTransformer = new ActionFulfilmentMethodTransformer();
|
|
12
|
+
statusTransformer = new ActionStatusTransformer();
|
|
13
|
+
fromGraphQLToEntity(data) {
|
|
14
|
+
return {
|
|
15
|
+
id: data.id,
|
|
16
|
+
virtualPresenceId: data.virtualPresenceId,
|
|
17
|
+
dataHolderId: data.dataHolderId ?? undefined,
|
|
18
|
+
intent: this.intentTransformer.fromGraphQLToEntity(data.intent),
|
|
19
|
+
additionalInfo: data.additionalInfo ?? undefined,
|
|
20
|
+
fulfilmentMethod: this.fulfilmentMethodTransformer.fromGraphQLToEntity(data.fulfilmentMethod),
|
|
21
|
+
status: this.statusTransformer.fromGraphQLToEntity(data.status),
|
|
22
|
+
assistedPayload: data.assistedPayload
|
|
23
|
+
? this.assistedPayloadFromGraphQL(data.assistedPayload)
|
|
24
|
+
: undefined,
|
|
25
|
+
initiatedAt: data.initiatedAtEpochMs != null
|
|
26
|
+
? new Date(data.initiatedAtEpochMs)
|
|
27
|
+
: undefined,
|
|
28
|
+
completedAt: data.completedAtEpochMs != null
|
|
29
|
+
? new Date(data.completedAtEpochMs)
|
|
30
|
+
: undefined,
|
|
31
|
+
owner: data.owner,
|
|
32
|
+
version: data.version,
|
|
33
|
+
createdAt: new Date(data.createdAtEpochMs),
|
|
34
|
+
updatedAt: new Date(data.updatedAtEpochMs),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
fromEntityToAPI(entity) {
|
|
38
|
+
return {
|
|
39
|
+
id: entity.id,
|
|
40
|
+
virtualPresenceId: entity.virtualPresenceId,
|
|
41
|
+
dataHolderId: entity.dataHolderId,
|
|
42
|
+
intent: this.intentTransformer.fromEntityToAPI(entity.intent),
|
|
43
|
+
additionalInfo: entity.additionalInfo,
|
|
44
|
+
fulfilmentMethod: this.fulfilmentMethodTransformer.fromEntityToAPI(entity.fulfilmentMethod),
|
|
45
|
+
status: this.statusTransformer.fromEntityToAPI(entity.status),
|
|
46
|
+
assistedPayload: entity.assistedPayload,
|
|
47
|
+
initiatedAt: entity.initiatedAt,
|
|
48
|
+
completedAt: entity.completedAt,
|
|
49
|
+
owner: entity.owner,
|
|
50
|
+
version: entity.version,
|
|
51
|
+
createdAt: entity.createdAt,
|
|
52
|
+
updatedAt: entity.updatedAt,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
assistedPayloadFromGraphQL(data) {
|
|
56
|
+
return {
|
|
57
|
+
toAddress: data.toAddress ?? undefined,
|
|
58
|
+
unsubscribeUrl: data.unsubscribeUrl ?? undefined,
|
|
59
|
+
unsubscribeMailto: data.unsubscribeMailto ?? undefined,
|
|
60
|
+
contact: data.contact ? this.contactFromGraphQL(data.contact) : undefined,
|
|
61
|
+
jurisdiction: data.jurisdiction ?? undefined,
|
|
62
|
+
instructions: data.instructions ?? undefined,
|
|
63
|
+
emailTemplate: data.emailTemplate
|
|
64
|
+
? this.emailTemplateFromGraphQL(data.emailTemplate)
|
|
65
|
+
: undefined,
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
contactFromGraphQL(data) {
|
|
69
|
+
return {
|
|
70
|
+
email: data.email ?? undefined,
|
|
71
|
+
phone: data.phone ?? undefined,
|
|
72
|
+
address: data.address ?? undefined,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
emailTemplateFromGraphQL(data) {
|
|
76
|
+
return {
|
|
77
|
+
subject: data.subject ?? undefined,
|
|
78
|
+
body: data.body,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { ActionFulfilmentMethodTransformer } from './actionFulfilmentMethodTransformer';
|
|
7
|
+
import { ActionIntentTransformer } from './actionIntentTransformer';
|
|
8
|
+
import { ActionOriginTransformer } from './actionOriginTransformer';
|
|
9
|
+
export class AvailableActionTransformer {
|
|
10
|
+
intentTransformer = new ActionIntentTransformer();
|
|
11
|
+
fulfilmentMethodTransformer = new ActionFulfilmentMethodTransformer();
|
|
12
|
+
originTransformer = new ActionOriginTransformer();
|
|
13
|
+
fromGraphQLToEntity(data) {
|
|
14
|
+
return {
|
|
15
|
+
intent: this.intentTransformer.fromGraphQLToEntity(data.intent),
|
|
16
|
+
additionalInfo: data.additionalInfo ?? undefined,
|
|
17
|
+
fulfilmentMethod: this.fulfilmentMethodTransformer.fromGraphQLToEntity(data.fulfilmentMethod),
|
|
18
|
+
origin: this.originTransformer.fromGraphQLToEntity(data.origin),
|
|
19
|
+
title: data.title ?? undefined,
|
|
20
|
+
description: data.description ?? undefined,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
fromEntityToAPI(entity) {
|
|
24
|
+
return {
|
|
25
|
+
intent: this.intentTransformer.fromEntityToAPI(entity.intent),
|
|
26
|
+
additionalInfo: entity.additionalInfo,
|
|
27
|
+
fulfilmentMethod: this.fulfilmentMethodTransformer.fromEntityToAPI(entity.fulfilmentMethod),
|
|
28
|
+
origin: this.originTransformer.fromEntityToAPI(entity.origin),
|
|
29
|
+
title: entity.title,
|
|
30
|
+
description: entity.description,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -11,6 +11,10 @@ export class PrivacyScoreTransformer {
|
|
|
11
11
|
aspect: b.aspect,
|
|
12
12
|
contribution: b.contribution,
|
|
13
13
|
})),
|
|
14
|
+
coverage: {
|
|
15
|
+
evaluated: data.coverage.evaluated,
|
|
16
|
+
total: data.coverage.total,
|
|
17
|
+
},
|
|
14
18
|
};
|
|
15
19
|
}
|
|
16
20
|
fromEntityToAPI(entity) {
|
|
@@ -20,6 +24,10 @@ export class PrivacyScoreTransformer {
|
|
|
20
24
|
aspect: b.aspect,
|
|
21
25
|
contribution: b.contribution,
|
|
22
26
|
})),
|
|
27
|
+
coverage: {
|
|
28
|
+
evaluated: entity.coverage.evaluated,
|
|
29
|
+
total: entity.coverage.total,
|
|
30
|
+
},
|
|
23
31
|
};
|
|
24
32
|
}
|
|
25
33
|
}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { DefaultApiClientManager, } from '@sudoplatform/sudo-api-client';
|
|
7
7
|
import { DefaultLogger, FatalError, UnknownGraphQLError, isGraphQLNetworkError, mapNetworkErrorToClientError, } from '@sudoplatform/sudo-common';
|
|
8
|
-
import { ConnectVirtualPresenceDocument, DisconnectVirtualPresenceDocument, GetAnalysisResultDocument, GetDataHolderDocument, GetProviderConfigurationDocument, ListAnalysisResultsDocument, ListDataHoldersDocument, ListVirtualPresencesDocument, OnAnalysisResultUpdateDocument, OnDataHoldersUpdateDocument, OnVirtualPresenceUpdateDocument, RescanVirtualPresenceDocument, } from '../../../gen/graphqlTypes';
|
|
8
|
+
import { ConfirmActionOutcomeDocument, ConnectVirtualPresenceDocument, DisconnectVirtualPresenceDocument, GetAnalysisResultDocument, GetDataHolderDocument, GetProviderConfigurationDocument, GetOrganizationAnalysisDocument, InitiateActionDocument, ListAnalysisResultsDocument, ListAvailableActionsDocument, ListDataHolderScanSummariesDocument, ListDataHoldersDocument, ListVirtualPresencesDocument, OnActionStatusUpdateDocument, OnAnalysisResultUpdateDocument, OnDataHoldersUpdateDocument, OnVirtualPresenceUpdateDocument, RescanVirtualPresenceDocument, } from '../../../gen/graphqlTypes';
|
|
9
9
|
import { ErrorTransformer } from './transformer/errorTransformer';
|
|
10
10
|
export class ApiClient {
|
|
11
11
|
log;
|
|
@@ -79,6 +79,18 @@ export class ApiClient {
|
|
|
79
79
|
});
|
|
80
80
|
return data.listDataHolders;
|
|
81
81
|
}
|
|
82
|
+
async listDataHolderScanSummaries(input) {
|
|
83
|
+
const data = await this.performQuery({
|
|
84
|
+
query: ListDataHolderScanSummariesDocument,
|
|
85
|
+
variables: {
|
|
86
|
+
dataHolderId: input.dataHolderId,
|
|
87
|
+
limit: input.limit,
|
|
88
|
+
nextToken: input.nextToken,
|
|
89
|
+
},
|
|
90
|
+
calleeName: this.listDataHolderScanSummaries.name,
|
|
91
|
+
});
|
|
92
|
+
return data.listDataHolderScanSummaries;
|
|
93
|
+
}
|
|
82
94
|
async getAnalysisResult(id) {
|
|
83
95
|
const data = await this.performQuery({
|
|
84
96
|
query: GetAnalysisResultDocument,
|
|
@@ -87,6 +99,17 @@ export class ApiClient {
|
|
|
87
99
|
});
|
|
88
100
|
return data.getAnalysisResult ?? undefined;
|
|
89
101
|
}
|
|
102
|
+
async getOrganizationAnalysis(input) {
|
|
103
|
+
const data = await this.performQuery({
|
|
104
|
+
query: GetOrganizationAnalysisDocument,
|
|
105
|
+
variables: {
|
|
106
|
+
domain: input.domain,
|
|
107
|
+
mode: input.mode,
|
|
108
|
+
},
|
|
109
|
+
calleeName: this.getOrganizationAnalysis.name,
|
|
110
|
+
});
|
|
111
|
+
return data.getOrganizationAnalysis ?? undefined;
|
|
112
|
+
}
|
|
90
113
|
async listAnalysisResults(input) {
|
|
91
114
|
const data = await this.performQuery({
|
|
92
115
|
query: ListAnalysisResultsDocument,
|
|
@@ -99,6 +122,32 @@ export class ApiClient {
|
|
|
99
122
|
});
|
|
100
123
|
return data.listAnalysisResults;
|
|
101
124
|
}
|
|
125
|
+
async initiateAction(input) {
|
|
126
|
+
const data = await this.performMutation({
|
|
127
|
+
mutation: InitiateActionDocument,
|
|
128
|
+
variables: { input },
|
|
129
|
+
calleeName: this.initiateAction.name,
|
|
130
|
+
});
|
|
131
|
+
return data.initiateAction;
|
|
132
|
+
}
|
|
133
|
+
async confirmActionOutcome(id) {
|
|
134
|
+
const data = await this.performMutation({
|
|
135
|
+
mutation: ConfirmActionOutcomeDocument,
|
|
136
|
+
variables: { id },
|
|
137
|
+
calleeName: this.confirmActionOutcome.name,
|
|
138
|
+
});
|
|
139
|
+
return data.confirmActionOutcome;
|
|
140
|
+
}
|
|
141
|
+
async listAvailableActions(input) {
|
|
142
|
+
const data = await this.performQuery({
|
|
143
|
+
query: ListAvailableActionsDocument,
|
|
144
|
+
variables: {
|
|
145
|
+
dataHolderId: input.dataHolderId,
|
|
146
|
+
},
|
|
147
|
+
calleeName: this.listAvailableActions.name,
|
|
148
|
+
});
|
|
149
|
+
return data.listAvailableActions;
|
|
150
|
+
}
|
|
102
151
|
onVirtualPresenceUpdated(owner) {
|
|
103
152
|
return this.performSubscription({
|
|
104
153
|
subscription: OnVirtualPresenceUpdateDocument,
|
|
@@ -126,6 +175,15 @@ export class ApiClient {
|
|
|
126
175
|
calleeName: this.onAnalysisResultUpdated.name,
|
|
127
176
|
});
|
|
128
177
|
}
|
|
178
|
+
onActionStatusUpdated(owner) {
|
|
179
|
+
return this.performSubscription({
|
|
180
|
+
subscription: OnActionStatusUpdateDocument,
|
|
181
|
+
variables: {
|
|
182
|
+
owner,
|
|
183
|
+
},
|
|
184
|
+
calleeName: this.onActionStatusUpdated.name,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
129
187
|
async performQuery({ variables, query, calleeName, }) {
|
|
130
188
|
let result;
|
|
131
189
|
try {
|
|
@@ -5,14 +5,18 @@
|
|
|
5
5
|
*/
|
|
6
6
|
import { ConnectionState, } from '../../../public/typings/subscription';
|
|
7
7
|
import { DataHolderSubscriptionManager } from './dataHolderSubscriptionManager';
|
|
8
|
+
import { DataHolderScanSummaryTransformer } from './transformer/dataHolderScanSummaryTransformer';
|
|
8
9
|
import { DataHolderTransformer } from './transformer/dataHolderTransformer';
|
|
9
10
|
export class DefaultDataHolderService {
|
|
10
11
|
appSync;
|
|
11
12
|
dataHolderTransformer;
|
|
13
|
+
dataHolderScanSummaryTransformer;
|
|
12
14
|
subscriptionManager;
|
|
13
15
|
constructor(appSync) {
|
|
14
16
|
this.appSync = appSync;
|
|
15
17
|
this.dataHolderTransformer = new DataHolderTransformer();
|
|
18
|
+
this.dataHolderScanSummaryTransformer =
|
|
19
|
+
new DataHolderScanSummaryTransformer();
|
|
16
20
|
this.subscriptionManager = new DataHolderSubscriptionManager();
|
|
17
21
|
}
|
|
18
22
|
async get(id) {
|
|
@@ -33,6 +37,14 @@ export class DefaultDataHolderService {
|
|
|
33
37
|
nextToken: result.nextToken ?? undefined,
|
|
34
38
|
};
|
|
35
39
|
}
|
|
40
|
+
async listScanSummaries(input) {
|
|
41
|
+
const result = await this.appSync.listDataHolderScanSummaries(input);
|
|
42
|
+
const scanSummaries = (result.items ?? []).map((item) => this.dataHolderScanSummaryTransformer.fromGraphQLToEntity(item));
|
|
43
|
+
return {
|
|
44
|
+
scanSummaries,
|
|
45
|
+
nextToken: result.nextToken ?? undefined,
|
|
46
|
+
};
|
|
47
|
+
}
|
|
36
48
|
async subscribe(input) {
|
|
37
49
|
this.subscriptionManager.subscribe(input.subscriptionId, input.subscriber);
|
|
38
50
|
if (!this.subscriptionManager.getWatcher()) {
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
export class DataHolderScanSummaryTransformer {
|
|
7
|
+
fromGraphQLToEntity(data) {
|
|
8
|
+
return {
|
|
9
|
+
dataHolderId: data.dataHolderId,
|
|
10
|
+
owner: data.owner,
|
|
11
|
+
scannedAt: new Date(data.scannedAtEpochMs),
|
|
12
|
+
scanRangeFrom: new Date(data.scanRangeFromEpochMs),
|
|
13
|
+
scanRangeTo: new Date(data.scanRangeToEpochMs),
|
|
14
|
+
emailCount: data.emailCount,
|
|
15
|
+
readCount: data.readCount,
|
|
16
|
+
readRate: data.readRate,
|
|
17
|
+
marketingEmailCount: data.marketingEmailCount,
|
|
18
|
+
marketingEmailOpened: data.marketingEmailOpened,
|
|
19
|
+
marketingOpenRate: data.marketingOpenRate,
|
|
20
|
+
categoryBreakdown: this.parseCategoryBreakdown(data.categoryBreakdown),
|
|
21
|
+
uncategorizedCount: data.uncategorizedCount,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
fromEntityToAPI(entity) {
|
|
25
|
+
return {
|
|
26
|
+
dataHolderId: entity.dataHolderId,
|
|
27
|
+
owner: entity.owner,
|
|
28
|
+
scannedAt: entity.scannedAt,
|
|
29
|
+
scanRangeFrom: entity.scanRangeFrom,
|
|
30
|
+
scanRangeTo: entity.scanRangeTo,
|
|
31
|
+
emailCount: entity.emailCount,
|
|
32
|
+
readCount: entity.readCount,
|
|
33
|
+
readRate: entity.readRate,
|
|
34
|
+
marketingEmailCount: entity.marketingEmailCount,
|
|
35
|
+
marketingEmailOpened: entity.marketingEmailOpened,
|
|
36
|
+
marketingOpenRate: entity.marketingOpenRate,
|
|
37
|
+
categoryBreakdown: { ...entity.categoryBreakdown },
|
|
38
|
+
uncategorizedCount: entity.uncategorizedCount,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* The `categoryBreakdown` field is an AWSJSON scalar, which is delivered as a
|
|
43
|
+
* JSON-encoded string. Parse it into a category-to-count map. Accepts an
|
|
44
|
+
* already-parsed object for resilience.
|
|
45
|
+
*/
|
|
46
|
+
parseCategoryBreakdown(value) {
|
|
47
|
+
if (typeof value === 'string') {
|
|
48
|
+
return JSON.parse(value);
|
|
49
|
+
}
|
|
50
|
+
return value ?? {};
|
|
51
|
+
}
|
|
52
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { OrganizationAnalysisModeTransformer } from './transformer/organizationAnalysisModeTransformer';
|
|
7
|
+
import { OrganizationAnalysisTransformer } from './transformer/organizationAnalysisTransformer';
|
|
8
|
+
export class DefaultOrganizationAnalysisService {
|
|
9
|
+
appSync;
|
|
10
|
+
organizationAnalysisTransformer = new OrganizationAnalysisTransformer();
|
|
11
|
+
modeTransformer = new OrganizationAnalysisModeTransformer();
|
|
12
|
+
constructor(appSync) {
|
|
13
|
+
this.appSync = appSync;
|
|
14
|
+
}
|
|
15
|
+
async getOrganizationAnalysis(input) {
|
|
16
|
+
const result = await this.appSync.getOrganizationAnalysis({
|
|
17
|
+
domain: input.domain,
|
|
18
|
+
mode: input.mode
|
|
19
|
+
? this.modeTransformer.fromEntityToGraphQL(input.mode)
|
|
20
|
+
: undefined,
|
|
21
|
+
});
|
|
22
|
+
if (!result) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
return this.organizationAnalysisTransformer.fromGraphQLToEntity(result);
|
|
26
|
+
}
|
|
27
|
+
}
|
package/lib/private/data/organization-analysis/transformer/organizationAnalysisModeTransformer.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { OrganizationAnalysisMode } from '../../../../public/typings/organizationAnalysis';
|
|
7
|
+
import { OrganizationAnalysisModeEntity } from '../../../domain/entities/organization-analysis/organizationAnalysisEntity';
|
|
8
|
+
export class OrganizationAnalysisModeTransformer {
|
|
9
|
+
fromAPIToEntity(mode) {
|
|
10
|
+
switch (mode) {
|
|
11
|
+
case OrganizationAnalysisMode.Analyze:
|
|
12
|
+
return OrganizationAnalysisModeEntity.Analyze;
|
|
13
|
+
case OrganizationAnalysisMode.Fetch:
|
|
14
|
+
return OrganizationAnalysisModeEntity.Fetch;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
fromEntityToGraphQL(mode) {
|
|
18
|
+
switch (mode) {
|
|
19
|
+
case OrganizationAnalysisModeEntity.Analyze:
|
|
20
|
+
return 'ANALYZE';
|
|
21
|
+
case OrganizationAnalysisModeEntity.Fetch:
|
|
22
|
+
return 'FETCH';
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|