@sudoplatform/sudo-privacy-interaction 2.1.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 +557 -1
- 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/common/apiClient.js +35 -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/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/public/defaultSudoPrivacyInteractionClient.js +58 -0
- package/cjs/public/inputs/action.js +7 -0
- package/cjs/public/inputs/index.js +1 -0
- package/cjs/public/typings/action.js +85 -0
- package/cjs/public/typings/index.js +1 -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 +128 -22
- 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/hierarchy.html +6 -6
- 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/DataHolderSubscriber.html +3 -3
- 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 +1 -1
- package/docs/interfaces/ListDataHoldersInput.html +1 -1
- package/docs/interfaces/ListVirtualPresencesInput.html +1 -1
- package/docs/interfaces/Pagination.html +1 -1
- package/docs/interfaces/SudoPrivacyInteractionClient.html +123 -22
- 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 +556 -0
- 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/common/apiClient.js +36 -1
- package/lib/private/domain/entities/action/actionEntity.js +83 -0
- package/lib/private/domain/entities/action/actionService.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/public/defaultSudoPrivacyInteractionClient.js +58 -0
- package/lib/public/inputs/action.js +6 -0
- package/lib/public/inputs/index.js +1 -0
- package/lib/public/typings/action.js +82 -0
- package/lib/public/typings/index.js +1 -0
- package/package.json +2 -2
- package/types/gen/graphqlTypes.d.ts +245 -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 +7 -1
- 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/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/public/defaultSudoPrivacyInteractionClient.d.ts +12 -2
- package/types/public/inputs/action.d.ts +30 -0
- package/types/public/inputs/index.d.ts +1 -0
- package/types/public/sudoPrivacyInteractionClient.d.ts +41 -2
- package/types/public/typings/action.d.ts +185 -0
- package/types/public/typings/index.d.ts +1 -0
- package/types/public/typings/subscription.d.ts +23 -0
|
@@ -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
|
+
}
|
|
@@ -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, GetOrganizationAnalysisDocument, ListAnalysisResultsDocument, ListDataHolderScanSummariesDocument, 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;
|
|
@@ -122,6 +122,32 @@ export class ApiClient {
|
|
|
122
122
|
});
|
|
123
123
|
return data.listAnalysisResults;
|
|
124
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
|
+
}
|
|
125
151
|
onVirtualPresenceUpdated(owner) {
|
|
126
152
|
return this.performSubscription({
|
|
127
153
|
subscription: OnVirtualPresenceUpdateDocument,
|
|
@@ -149,6 +175,15 @@ export class ApiClient {
|
|
|
149
175
|
calleeName: this.onAnalysisResultUpdated.name,
|
|
150
176
|
});
|
|
151
177
|
}
|
|
178
|
+
onActionStatusUpdated(owner) {
|
|
179
|
+
return this.performSubscription({
|
|
180
|
+
subscription: OnActionStatusUpdateDocument,
|
|
181
|
+
variables: {
|
|
182
|
+
owner,
|
|
183
|
+
},
|
|
184
|
+
calleeName: this.onActionStatusUpdated.name,
|
|
185
|
+
});
|
|
186
|
+
}
|
|
152
187
|
async performQuery({ variables, query, calleeName, }) {
|
|
153
188
|
let result;
|
|
154
189
|
try {
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* The user-facing intent of an action. This is a service-owned taxonomy,
|
|
8
|
+
* decoupled from any upstream provider's action vocabulary.
|
|
9
|
+
*
|
|
10
|
+
* Clients must tolerate unknown values: an unrecognised intent is represented
|
|
11
|
+
* as `Other` rather than failing, so newly added intents do not break existing
|
|
12
|
+
* clients.
|
|
13
|
+
*
|
|
14
|
+
* @property StopContact Unsubscribe / opt out of marketing communications.
|
|
15
|
+
* @property AccessMyData Data subject access / portability request.
|
|
16
|
+
* @property DeleteMyData Account deletion / data erasure.
|
|
17
|
+
* @property LimitDataUse Opt out of sale / tracking, manage consent.
|
|
18
|
+
* @property Other Anything unmapped; carries additionalInfo.
|
|
19
|
+
*
|
|
20
|
+
* @enum
|
|
21
|
+
*/
|
|
22
|
+
export var ActionIntentEntity;
|
|
23
|
+
(function (ActionIntentEntity) {
|
|
24
|
+
ActionIntentEntity["StopContact"] = "STOP_CONTACT";
|
|
25
|
+
ActionIntentEntity["AccessMyData"] = "ACCESS_MY_DATA";
|
|
26
|
+
ActionIntentEntity["DeleteMyData"] = "DELETE_MY_DATA";
|
|
27
|
+
ActionIntentEntity["LimitDataUse"] = "LIMIT_DATA_USE";
|
|
28
|
+
ActionIntentEntity["Other"] = "OTHER";
|
|
29
|
+
})(ActionIntentEntity || (ActionIntentEntity = {}));
|
|
30
|
+
/**
|
|
31
|
+
* How an action is fulfilled from the user's perspective.
|
|
32
|
+
*
|
|
33
|
+
* @property Assisted The service returns structured materials for the client to
|
|
34
|
+
* complete the action.
|
|
35
|
+
* @property Delegated The service performs the action on the user's behalf.
|
|
36
|
+
*
|
|
37
|
+
* @enum
|
|
38
|
+
*/
|
|
39
|
+
export var ActionFulfilmentMethodEntity;
|
|
40
|
+
(function (ActionFulfilmentMethodEntity) {
|
|
41
|
+
ActionFulfilmentMethodEntity["Assisted"] = "ASSISTED";
|
|
42
|
+
ActionFulfilmentMethodEntity["Delegated"] = "DELEGATED";
|
|
43
|
+
})(ActionFulfilmentMethodEntity || (ActionFulfilmentMethodEntity = {}));
|
|
44
|
+
/**
|
|
45
|
+
* Which source contributed an available action.
|
|
46
|
+
*
|
|
47
|
+
* @property Static Always-possible action for the virtual presence type.
|
|
48
|
+
* @property Analysis Derived from an analysis source's reported actions.
|
|
49
|
+
* @property Discovery Derived from a discovery scan (e.g. List-Unsubscribe).
|
|
50
|
+
*
|
|
51
|
+
* @enum
|
|
52
|
+
*/
|
|
53
|
+
export var ActionOriginEntity;
|
|
54
|
+
(function (ActionOriginEntity) {
|
|
55
|
+
ActionOriginEntity["Static"] = "STATIC";
|
|
56
|
+
ActionOriginEntity["Analysis"] = "ANALYSIS";
|
|
57
|
+
ActionOriginEntity["Discovery"] = "DISCOVERY";
|
|
58
|
+
ActionOriginEntity["Unknown"] = "UNKNOWN";
|
|
59
|
+
})(ActionOriginEntity || (ActionOriginEntity = {}));
|
|
60
|
+
/**
|
|
61
|
+
* Lifecycle status of a persisted action instance.
|
|
62
|
+
*
|
|
63
|
+
* @property Pending The action has been created but not yet started.
|
|
64
|
+
* @property InProgress The action is being performed.
|
|
65
|
+
* @property CompletedUnverified The action completed but has not been verified.
|
|
66
|
+
* @property CompletedVerified The action completed and has been verified.
|
|
67
|
+
* @property Failed The action failed to complete.
|
|
68
|
+
* @property RequiresUserInput The action requires further input from the user.
|
|
69
|
+
* @property Contradicted Subsequent evidence contradicts the action's completion.
|
|
70
|
+
*
|
|
71
|
+
* @enum
|
|
72
|
+
*/
|
|
73
|
+
export var ActionStatusEntity;
|
|
74
|
+
(function (ActionStatusEntity) {
|
|
75
|
+
ActionStatusEntity["Pending"] = "PENDING";
|
|
76
|
+
ActionStatusEntity["InProgress"] = "IN_PROGRESS";
|
|
77
|
+
ActionStatusEntity["CompletedUnverified"] = "COMPLETED_UNVERIFIED";
|
|
78
|
+
ActionStatusEntity["CompletedVerified"] = "COMPLETED_VERIFIED";
|
|
79
|
+
ActionStatusEntity["Failed"] = "FAILED";
|
|
80
|
+
ActionStatusEntity["RequiresUserInput"] = "REQUIRES_USER_INPUT";
|
|
81
|
+
ActionStatusEntity["Contradicted"] = "CONTRADICTED";
|
|
82
|
+
ActionStatusEntity["Unknown"] = "UNKNOWN";
|
|
83
|
+
})(ActionStatusEntity || (ActionStatusEntity = {}));
|
|
@@ -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 { DefaultLogger } from '@sudoplatform/sudo-common';
|
|
7
|
+
/**
|
|
8
|
+
* Application business logic for confirming that an action was completed.
|
|
9
|
+
*/
|
|
10
|
+
export class ConfirmActionOutcomeUseCase {
|
|
11
|
+
actionService;
|
|
12
|
+
log;
|
|
13
|
+
constructor(actionService) {
|
|
14
|
+
this.actionService = actionService;
|
|
15
|
+
this.log = new DefaultLogger(this.constructor.name);
|
|
16
|
+
}
|
|
17
|
+
async execute(id) {
|
|
18
|
+
this.log.debug(this.constructor.name, { id });
|
|
19
|
+
return await this.actionService.confirmOutcome(id);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { DefaultLogger } from '@sudoplatform/sudo-common';
|
|
7
|
+
/**
|
|
8
|
+
* Application business logic for initiating an action against a data holder
|
|
9
|
+
* relationship.
|
|
10
|
+
*/
|
|
11
|
+
export class InitiateActionUseCase {
|
|
12
|
+
actionService;
|
|
13
|
+
log;
|
|
14
|
+
constructor(actionService) {
|
|
15
|
+
this.actionService = actionService;
|
|
16
|
+
this.log = new DefaultLogger(this.constructor.name);
|
|
17
|
+
}
|
|
18
|
+
async execute(input) {
|
|
19
|
+
this.log.debug(this.constructor.name, { input });
|
|
20
|
+
return await this.actionService.initiate(input);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { DefaultLogger } from '@sudoplatform/sudo-common';
|
|
7
|
+
/**
|
|
8
|
+
* Application business logic for listing the actions available for a data holder
|
|
9
|
+
* relationship.
|
|
10
|
+
*/
|
|
11
|
+
export class ListAvailableActionsUseCase {
|
|
12
|
+
actionService;
|
|
13
|
+
log;
|
|
14
|
+
constructor(actionService) {
|
|
15
|
+
this.actionService = actionService;
|
|
16
|
+
this.log = new DefaultLogger(this.constructor.name);
|
|
17
|
+
}
|
|
18
|
+
async execute(input) {
|
|
19
|
+
this.log.debug(this.constructor.name, { input });
|
|
20
|
+
return await this.actionService.listAvailable(input);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -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 { DefaultLogger, NotSignedInError, } from '@sudoplatform/sudo-common';
|
|
7
|
+
/**
|
|
8
|
+
* Application business logic for subscribing to action status events.
|
|
9
|
+
*/
|
|
10
|
+
export class SubscribeToActionUseCase {
|
|
11
|
+
actionService;
|
|
12
|
+
sudoUserClient;
|
|
13
|
+
log;
|
|
14
|
+
constructor(actionService, sudoUserClient) {
|
|
15
|
+
this.actionService = actionService;
|
|
16
|
+
this.sudoUserClient = sudoUserClient;
|
|
17
|
+
this.log = new DefaultLogger(this.constructor.name);
|
|
18
|
+
}
|
|
19
|
+
async execute(input) {
|
|
20
|
+
this.log.debug(this.constructor.name, {
|
|
21
|
+
subscriptionId: input.subscriptionId,
|
|
22
|
+
});
|
|
23
|
+
const owner = await this.sudoUserClient.getSubject();
|
|
24
|
+
if (!owner) {
|
|
25
|
+
throw new NotSignedInError();
|
|
26
|
+
}
|
|
27
|
+
await this.actionService.subscribe({
|
|
28
|
+
subscriptionId: input.subscriptionId,
|
|
29
|
+
owner,
|
|
30
|
+
subscriber: input.subscriber,
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright © 2026 Anonyome Labs, Inc. All rights reserved.
|
|
3
|
+
*
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0
|
|
5
|
+
*/
|
|
6
|
+
import { DefaultLogger } from '@sudoplatform/sudo-common';
|
|
7
|
+
/**
|
|
8
|
+
* Application business logic for unsubscribing from action status events.
|
|
9
|
+
*/
|
|
10
|
+
export class UnsubscribeFromActionUseCase {
|
|
11
|
+
actionService;
|
|
12
|
+
log;
|
|
13
|
+
constructor(actionService) {
|
|
14
|
+
this.actionService = actionService;
|
|
15
|
+
this.log = new DefaultLogger(this.constructor.name);
|
|
16
|
+
}
|
|
17
|
+
execute(subscriptionId) {
|
|
18
|
+
this.log.debug(this.constructor.name, {
|
|
19
|
+
subscriptionId,
|
|
20
|
+
});
|
|
21
|
+
this.actionService.unsubscribe(subscriptionId);
|
|
22
|
+
}
|
|
23
|
+
}
|