@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.
Files changed (98) hide show
  1. package/cjs/gen/graphqlTypes.js +557 -1
  2. package/cjs/private/data/action/actionSubscriptionManager.js +25 -0
  3. package/cjs/private/data/action/defaultActionService.js +80 -0
  4. package/cjs/private/data/action/transformer/actionFulfilmentMethodTransformer.js +47 -0
  5. package/cjs/private/data/action/transformer/actionIntentTransformer.js +69 -0
  6. package/cjs/private/data/action/transformer/actionOriginTransformer.js +37 -0
  7. package/cjs/private/data/action/transformer/actionStatusTransformer.js +53 -0
  8. package/cjs/private/data/action/transformer/actionTransformer.js +85 -0
  9. package/cjs/private/data/action/transformer/availableActionTransformer.js +37 -0
  10. package/cjs/private/data/common/apiClient.js +35 -0
  11. package/cjs/private/domain/entities/action/actionEntity.js +86 -0
  12. package/cjs/private/domain/entities/action/actionService.js +7 -0
  13. package/cjs/private/domain/use-cases/action/confirmActionOutcomeUseCase.js +25 -0
  14. package/cjs/private/domain/use-cases/action/initiateActionUseCase.js +26 -0
  15. package/cjs/private/domain/use-cases/action/listAvailableActionsUseCase.js +26 -0
  16. package/cjs/private/domain/use-cases/action/subscribeToActionUseCase.js +37 -0
  17. package/cjs/private/domain/use-cases/action/unsubscribeFromActionUseCase.js +27 -0
  18. package/cjs/public/defaultSudoPrivacyInteractionClient.js +58 -0
  19. package/cjs/public/inputs/action.js +7 -0
  20. package/cjs/public/inputs/index.js +1 -0
  21. package/cjs/public/typings/action.js +85 -0
  22. package/cjs/public/typings/index.js +1 -0
  23. package/docs/assets/hierarchy.js +1 -1
  24. package/docs/assets/navigation.js +1 -1
  25. package/docs/assets/search.js +1 -1
  26. package/docs/classes/DefaultSudoPrivacyInteractionClient.html +128 -22
  27. package/docs/enums/ActionFulfilmentMethod.html +63 -0
  28. package/docs/enums/ActionIntent.html +84 -0
  29. package/docs/enums/ActionOrigin.html +75 -0
  30. package/docs/enums/ActionStatus.html +99 -0
  31. package/docs/enums/ConnectionState.html +3 -3
  32. package/docs/hierarchy.html +6 -6
  33. package/docs/interfaces/Action.html +167 -0
  34. package/docs/interfaces/ActionContact.html +77 -0
  35. package/docs/interfaces/ActionSubscriber.html +92 -0
  36. package/docs/interfaces/AnalysisResultSubscriber.html +3 -3
  37. package/docs/interfaces/AssistedEmailTemplate.html +70 -0
  38. package/docs/interfaces/AssistedPayload.html +113 -0
  39. package/docs/interfaces/AvailableAction.html +102 -0
  40. package/docs/interfaces/DataHolderSubscriber.html +3 -3
  41. package/docs/interfaces/InitiateActionInput.html +79 -0
  42. package/docs/interfaces/ListAnalysisResultsInput.html +1 -1
  43. package/docs/interfaces/ListAvailableActionsInput.html +61 -0
  44. package/docs/interfaces/ListDataHolderScanSummariesInput.html +1 -1
  45. package/docs/interfaces/ListDataHoldersInput.html +1 -1
  46. package/docs/interfaces/ListVirtualPresencesInput.html +1 -1
  47. package/docs/interfaces/Pagination.html +1 -1
  48. package/docs/interfaces/SudoPrivacyInteractionClient.html +123 -22
  49. package/docs/interfaces/VirtualPresenceSubscriber.html +3 -3
  50. package/docs/modules.html +4 -4
  51. package/docs/types/SudoPrivacyInteractionClientOptions.html +2 -2
  52. package/lib/gen/graphqlTypes.js +556 -0
  53. package/lib/private/data/action/actionSubscriptionManager.js +21 -0
  54. package/lib/private/data/action/defaultActionService.js +76 -0
  55. package/lib/private/data/action/transformer/actionFulfilmentMethodTransformer.js +43 -0
  56. package/lib/private/data/action/transformer/actionIntentTransformer.js +65 -0
  57. package/lib/private/data/action/transformer/actionOriginTransformer.js +33 -0
  58. package/lib/private/data/action/transformer/actionStatusTransformer.js +49 -0
  59. package/lib/private/data/action/transformer/actionTransformer.js +81 -0
  60. package/lib/private/data/action/transformer/availableActionTransformer.js +33 -0
  61. package/lib/private/data/common/apiClient.js +36 -1
  62. package/lib/private/domain/entities/action/actionEntity.js +83 -0
  63. package/lib/private/domain/entities/action/actionService.js +6 -0
  64. package/lib/private/domain/use-cases/action/confirmActionOutcomeUseCase.js +21 -0
  65. package/lib/private/domain/use-cases/action/initiateActionUseCase.js +22 -0
  66. package/lib/private/domain/use-cases/action/listAvailableActionsUseCase.js +22 -0
  67. package/lib/private/domain/use-cases/action/subscribeToActionUseCase.js +33 -0
  68. package/lib/private/domain/use-cases/action/unsubscribeFromActionUseCase.js +23 -0
  69. package/lib/public/defaultSudoPrivacyInteractionClient.js +58 -0
  70. package/lib/public/inputs/action.js +6 -0
  71. package/lib/public/inputs/index.js +1 -0
  72. package/lib/public/typings/action.js +82 -0
  73. package/lib/public/typings/index.js +1 -0
  74. package/package.json +2 -2
  75. package/types/gen/graphqlTypes.d.ts +245 -1
  76. package/types/private/data/action/actionSubscriptionManager.d.ts +19 -0
  77. package/types/private/data/action/defaultActionService.d.ts +23 -0
  78. package/types/private/data/action/transformer/actionFulfilmentMethodTransformer.d.ts +14 -0
  79. package/types/private/data/action/transformer/actionIntentTransformer.d.ts +14 -0
  80. package/types/private/data/action/transformer/actionOriginTransformer.d.ts +12 -0
  81. package/types/private/data/action/transformer/actionStatusTransformer.d.ts +12 -0
  82. package/types/private/data/action/transformer/actionTransformer.d.ts +39 -0
  83. package/types/private/data/action/transformer/availableActionTransformer.d.ts +15 -0
  84. package/types/private/data/common/apiClient.d.ts +7 -1
  85. package/types/private/domain/entities/action/actionEntity.d.ts +187 -0
  86. package/types/private/domain/entities/action/actionService.d.ts +99 -0
  87. package/types/private/domain/use-cases/action/confirmActionOutcomeUseCase.d.ts +16 -0
  88. package/types/private/domain/use-cases/action/initiateActionUseCase.d.ts +17 -0
  89. package/types/private/domain/use-cases/action/listAvailableActionsUseCase.d.ts +16 -0
  90. package/types/private/domain/use-cases/action/subscribeToActionUseCase.d.ts +27 -0
  91. package/types/private/domain/use-cases/action/unsubscribeFromActionUseCase.d.ts +15 -0
  92. package/types/public/defaultSudoPrivacyInteractionClient.d.ts +12 -2
  93. package/types/public/inputs/action.d.ts +30 -0
  94. package/types/public/inputs/index.d.ts +1 -0
  95. package/types/public/sudoPrivacyInteractionClient.d.ts +41 -2
  96. package/types/public/typings/action.d.ts +185 -0
  97. package/types/public/typings/index.d.ts +1 -0
  98. package/types/public/typings/subscription.d.ts +23 -0
@@ -0,0 +1,185 @@
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.
8
+ *
9
+ * Clients must tolerate unknown values: an unrecognised intent is represented
10
+ * as `Other` rather than failing, so newly added intents do not break existing
11
+ * clients.
12
+ *
13
+ * @property STOP_CONTACT Unsubscribe / opt out of marketing communications.
14
+ * @property ACCESS_MY_DATA Data subject access / portability request.
15
+ * @property DELETE_MY_DATA Account deletion / data erasure.
16
+ * @property LIMIT_DATA_USE Opt out of sale / tracking, manage consent.
17
+ * @property OTHER Anything unmapped; carries additionalInfo.
18
+ *
19
+ * @enum
20
+ */
21
+ export declare enum ActionIntent {
22
+ StopContact = "STOP_CONTACT",
23
+ AccessMyData = "ACCESS_MY_DATA",
24
+ DeleteMyData = "DELETE_MY_DATA",
25
+ LimitDataUse = "LIMIT_DATA_USE",
26
+ Other = "OTHER"
27
+ }
28
+ /**
29
+ * How an action is fulfilled from the user's perspective.
30
+ *
31
+ * @property ASSISTED The service returns structured materials for the client to
32
+ * complete the action.
33
+ * @property DELEGATED The service performs the action on the user's behalf.
34
+ *
35
+ * @enum
36
+ */
37
+ export declare enum ActionFulfilmentMethod {
38
+ Assisted = "ASSISTED",
39
+ Delegated = "DELEGATED"
40
+ }
41
+ /**
42
+ * Which source contributed an available action.
43
+ *
44
+ * @property STATIC Always-possible action for the virtual presence type.
45
+ * @property ANALYSIS Derived from an analysis source's reported actions.
46
+ * @property DISCOVERY Derived from a discovery scan (e.g. List-Unsubscribe).
47
+ *
48
+ * @enum
49
+ */
50
+ export declare enum ActionOrigin {
51
+ Static = "STATIC",
52
+ Analysis = "ANALYSIS",
53
+ Discovery = "DISCOVERY",
54
+ Unknown = "UNKNOWN"
55
+ }
56
+ /**
57
+ * Lifecycle status of a persisted action instance.
58
+ *
59
+ * @property PENDING The action has been created but not yet started.
60
+ * @property IN_PROGRESS The action is being performed.
61
+ * @property COMPLETED_UNVERIFIED The action completed but has not been verified.
62
+ * @property COMPLETED_VERIFIED The action completed and has been verified.
63
+ * @property FAILED The action failed to complete.
64
+ * @property REQUIRES_USER_INPUT The action requires further input from the user.
65
+ * @property CONTRADICTED Subsequent evidence contradicts the action's completion.
66
+ *
67
+ * @enum
68
+ */
69
+ export declare enum ActionStatus {
70
+ Pending = "PENDING",
71
+ InProgress = "IN_PROGRESS",
72
+ CompletedUnverified = "COMPLETED_UNVERIFIED",
73
+ CompletedVerified = "COMPLETED_VERIFIED",
74
+ Failed = "FAILED",
75
+ RequiresUserInput = "REQUIRES_USER_INPUT",
76
+ Contradicted = "CONTRADICTED",
77
+ Unknown = "UNKNOWN"
78
+ }
79
+ /**
80
+ * Contact materials for an assisted action.
81
+ *
82
+ * @interface ActionContact
83
+ * @property {string} email Contact email address, when available.
84
+ * @property {string} phone Contact phone number, when available.
85
+ * @property {string} address Contact postal address, when available.
86
+ */
87
+ export interface ActionContact {
88
+ email?: string;
89
+ phone?: string;
90
+ address?: string;
91
+ }
92
+ /**
93
+ * An email template returned for an assisted action. The body may contain
94
+ * placeholders (e.g. "{{fullName}}") for fields the user supplies client-side.
95
+ *
96
+ * @interface AssistedEmailTemplate
97
+ * @property {string} subject Subject line for the email, when available.
98
+ * @property {string} body Body of the email; may contain placeholders.
99
+ */
100
+ export interface AssistedEmailTemplate {
101
+ subject?: string;
102
+ body: string;
103
+ }
104
+ /**
105
+ * Materials for an assisted action. The service supplies the organisation
106
+ * contact points and any source-provided instructions, but never the user's own
107
+ * data.
108
+ *
109
+ * @interface AssistedPayload
110
+ * @property {string} toAddress Recipient address for an assisted email action.
111
+ * @property {string} unsubscribeUrl Unsubscribe URL, when available.
112
+ * @property {string} unsubscribeMailto Unsubscribe mailto link, when available.
113
+ * @property {ActionContact} contact Organisation contact points, when available.
114
+ * @property {string} jurisdiction Jurisdiction relevant to the action, when available.
115
+ * @property {string} instructions Free-text instructions, potentially provided
116
+ * verbatim by an analysis source.
117
+ * @property {AssistedEmailTemplate} emailTemplate An email template for the action,
118
+ * resolved from a deployment-time template store.
119
+ */
120
+ export interface AssistedPayload {
121
+ toAddress?: string;
122
+ unsubscribeUrl?: string;
123
+ unsubscribeMailto?: string;
124
+ contact?: ActionContact;
125
+ jurisdiction?: string;
126
+ instructions?: string;
127
+ emailTemplate?: AssistedEmailTemplate;
128
+ }
129
+ /**
130
+ * The Sudo Platform SDK representation of a persisted, initiated action instance
131
+ * scoped to a data holder relationship.
132
+ *
133
+ * @interface Action
134
+ * @property {string} id Unique identifier associated with the action.
135
+ * @property {string} virtualPresenceId The virtual presence this action belongs to.
136
+ * @property {string} dataHolderId The data holder relationship this action is scoped to.
137
+ * @property {ActionIntent} intent The user-facing intent of the action.
138
+ * @property {string} additionalInfo Additional info, populated when intent is `Other`.
139
+ * @property {ActionFulfilmentMethod} fulfilmentMethod How the action is fulfilled.
140
+ * @property {ActionStatus} status Current lifecycle status of the action.
141
+ * @property {AssistedPayload} assistedPayload Materials for an assisted action.
142
+ * Undefined for a delegated action.
143
+ * @property {Date} initiatedAt Date for when the action was initiated.
144
+ * @property {Date} completedAt Date for when the action completed.
145
+ * @property {string} owner Unique identifier of the user.
146
+ * @property {number} version Version of this entity. Increments on update.
147
+ * @property {Date} createdAt Date for when the action was created.
148
+ * @property {Date} updatedAt Date for when the action was last updated.
149
+ */
150
+ export interface Action {
151
+ id: string;
152
+ virtualPresenceId: string;
153
+ dataHolderId?: string;
154
+ intent: ActionIntent;
155
+ additionalInfo?: string;
156
+ fulfilmentMethod: ActionFulfilmentMethod;
157
+ status: ActionStatus;
158
+ assistedPayload?: AssistedPayload;
159
+ initiatedAt?: Date;
160
+ completedAt?: Date;
161
+ owner: string;
162
+ version: number;
163
+ createdAt: Date;
164
+ updatedAt: Date;
165
+ }
166
+ /**
167
+ * The Sudo Platform SDK representation of a derived, non-persisted action the
168
+ * user could take against a data holder.
169
+ *
170
+ * @interface AvailableAction
171
+ * @property {ActionIntent} intent The user-facing intent of the action.
172
+ * @property {string} additionalInfo Additional info, populated when intent is `Other`.
173
+ * @property {ActionFulfilmentMethod} fulfilmentMethod How the action is fulfilled.
174
+ * @property {ActionOrigin} origin Which source contributed this action.
175
+ * @property {string} title Short presentation hint for the action's title.
176
+ * @property {string} description Short presentation hint describing the action.
177
+ */
178
+ export interface AvailableAction {
179
+ intent: ActionIntent;
180
+ additionalInfo?: string;
181
+ fulfilmentMethod: ActionFulfilmentMethod;
182
+ origin: ActionOrigin;
183
+ title?: string;
184
+ description?: string;
185
+ }
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ export * from './action';
6
7
  export * from './analysisResult';
7
8
  export * from './dataHolder';
8
9
  export * from './organizationAnalysis';
@@ -3,6 +3,7 @@
3
3
  *
4
4
  * SPDX-License-Identifier: Apache-2.0
5
5
  */
6
+ import { Action } from './action';
6
7
  import { AnalysisResultUpdate } from './analysisResult';
7
8
  import { DataHolder } from './dataHolder';
8
9
  import { VirtualPresence } from './virtualPresence';
@@ -84,3 +85,25 @@ export interface AnalysisResultSubscriber {
84
85
  */
85
86
  connectionStatusChanged(state: ConnectionState): void;
86
87
  }
88
+ /**
89
+ * Subscriber interface for receiving action status update events.
90
+ *
91
+ * @interface ActionSubscriber
92
+ */
93
+ export interface ActionSubscriber {
94
+ /**
95
+ * Notifies the subscriber of an action status update.
96
+ *
97
+ * @param {Action} action The updated action.
98
+ */
99
+ actionUpdated(action: Action): void;
100
+ /**
101
+ * Notifies the subscriber that the subscription connection state has changed.
102
+ * The subscriber won't be notified of action changes until the connection
103
+ * status changes to `ConnectionState.CONNECTED`. The subscriber will stop receiving
104
+ * action change notifications when the connection state changes to `ConnectionState.DISCONNECTED`.
105
+ *
106
+ * @param state The connection state.
107
+ */
108
+ connectionStatusChanged(state: ConnectionState): void;
109
+ }