Skip to content

Commit a7aed20

Browse files
Feat/move get result from completed task to dp core (#396)
2 parents 63da37f + 60ae48b commit a7aed20

File tree

9 files changed

+39
-31
lines changed

9 files changed

+39
-31
lines changed

packages/sdk/CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,12 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## Next
6+
7+
### Changed
8+
9+
- Moved `getResultFromCompletedTask` method from DataProtectorSharing module (DPS) to DataProtectorCore module (DPC).
10+
511
## [2.0.0-beta.11] (2025-01-29)
612

713
### Added

packages/sdk/src/lib/dataProtectorCore/IExecDataProtectorCore.ts

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ import {
1010
ProcessProtectedDataResponse,
1111
ProtectDataParams,
1212
ProtectedData,
13+
GetResultFromCompletedTaskParams,
14+
GetResultFromCompletedTaskResponse,
1315
ProtectedDataWithSecretProps,
1416
RevokeAllAccessParams,
1517
RevokedAccess,
@@ -18,6 +20,7 @@ import {
1820
} from '../types/index.js';
1921
import { getGrantedAccess } from './getGrantedAccess.js';
2022
import { getProtectedData } from './getProtectedData.js';
23+
import { getResultFromCompletedTask } from './getResultFromCompletedTask.js';
2124
import { grantAccess } from './grantAccess.js';
2225
import { processProtectedData } from './processProtectedData.js';
2326
import { protectData } from './protectData.js';
@@ -84,6 +87,16 @@ class IExecDataProtectorCore extends IExecDataProtectorModule {
8487
): Promise<GrantedAccessResponse> {
8588
return getGrantedAccess({ ...args, iexec: this.iexec });
8689
}
90+
91+
async getResultFromCompletedTask(
92+
args: GetResultFromCompletedTaskParams
93+
): Promise<GetResultFromCompletedTaskResponse> {
94+
await isValidProvider(this.iexec);
95+
return getResultFromCompletedTask({
96+
...args,
97+
iexec: this.iexec,
98+
});
99+
}
87100
}
88101

89102
export { IExecDataProtectorCore };

packages/sdk/src/lib/dataProtectorSharing/getResultFromCompletedTask.ts renamed to packages/sdk/src/lib/dataProtectorCore/getResultFromCompletedTask.ts

File renamed without changes.

packages/sdk/src/lib/dataProtectorCore/processProtectedData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {
2222
validateOnStatusUpdateCallback,
2323
} from '../../utils/validators.js';
2424
import { isERC734 } from '../../utils/whitelist.js';
25-
import { getResultFromCompletedTask } from '../dataProtectorSharing/getResultFromCompletedTask.js';
25+
import { getResultFromCompletedTask } from './getResultFromCompletedTask.js';
2626
import {
2727
OnStatusUpdateFn,
2828
ProcessProtectedDataParams,

packages/sdk/src/lib/dataProtectorSharing/IExecDataProtectorSharing.ts

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,6 @@ import {
2020
GetProtectedDataPricingParamsResponse,
2121
GetRentalsParams,
2222
GetRentalsResponse,
23-
GetResultFromCompletedTaskParams,
24-
GetResultFromCompletedTaskResponse,
2523
GetUserAppWhitelistParams,
2624
GetUserAppWhitelistResponse,
2725
RemoveCollectionParams,
@@ -50,7 +48,6 @@ import { getCollectionSubscriptions } from './getCollectionSubscriptions.js';
5048
import { getProtectedDataInCollections } from './getProtectedDataInCollections.js';
5149
import { getProtectedDataPricingParams } from './getProtectedDataPricingParams.js';
5250
import { getRentals } from './getRentals.js';
53-
import { getResultFromCompletedTask } from './getResultFromCompletedTask.js';
5451
import { getUserAddOnlyAppWhitelist } from './getUserAddOnlyAppWhitelist.js';
5552
import { removeCollection } from './removeCollection.js';
5653
import { removeProtectedDataForSale } from './removeProtectedDataForSale.js';
@@ -254,16 +251,6 @@ class IExecDataProtectorSharing extends IExecDataProtectorModule {
254251
});
255252
}
256253

257-
async getResultFromCompletedTask(
258-
args: GetResultFromCompletedTaskParams
259-
): Promise<GetResultFromCompletedTaskResponse> {
260-
await isValidProvider(this.iexec);
261-
return getResultFromCompletedTask({
262-
...args,
263-
iexec: this.iexec,
264-
});
265-
}
266-
267254
// -------------------- Apps whitelist --------------------
268255

269256
async createAddOnlyAppWhitelist(): Promise<CreateAppWhitelistResponse> {

packages/sdk/src/lib/dataProtectorSharing/consumeProtectedData.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import {
2626
SharingContractConsumer,
2727
} from '../types/index.js';
2828
import { IExecConsumer } from '../types/internalTypes.js';
29-
import { getResultFromCompletedTask } from './getResultFromCompletedTask.js';
29+
import { getResultFromCompletedTask } from '../dataProtectorCore/getResultFromCompletedTask.js';
3030
import { getAppWhitelistContract } from './smartContract/getAddOnlyAppWhitelistContract.js';
3131
import { getSharingContract } from './smartContract/getSharingContract.js';
3232
import {

packages/sdk/src/lib/types/coreTypes.ts

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,23 @@ export type GrantedAccessResponse = {
209209
grantedAccess: GrantedAccess[];
210210
};
211211

212+
// ---------------------GetResultFromCompletedTask Types------------------------------------
213+
214+
export type GetResultFromCompletedTaskStatuses =
215+
| 'CONSUME_RESULT_DOWNLOAD'
216+
| 'CONSUME_RESULT_DECRYPT';
217+
218+
export type GetResultFromCompletedTaskParams = {
219+
taskId: string;
220+
path?: string;
221+
pemPrivateKey?: string;
222+
onStatusUpdate?: OnStatusUpdateFn<GetResultFromCompletedTaskStatuses>;
223+
};
224+
225+
export type GetResultFromCompletedTaskResponse = {
226+
result: ArrayBuffer;
227+
};
228+
212229
// ---------------------RevokeAccess Types------------------------------------
213230
export type RevokeAllAccessStatuses =
214231
| 'RETRIEVE_ALL_GRANTED_ACCESS'

packages/sdk/src/lib/types/sharingTypes.ts

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,6 @@ export type ConsumeProtectedDataResponse = {
120120
pemPrivateKey: string;
121121
};
122122

123-
export type GetResultFromCompletedTaskStatuses =
124-
| 'CONSUME_RESULT_DOWNLOAD'
125-
| 'CONSUME_RESULT_DECRYPT';
126-
127-
export type GetResultFromCompletedTaskParams = {
128-
taskId: string;
129-
path?: string;
130-
pemPrivateKey?: string;
131-
onStatusUpdate?: OnStatusUpdateFn<GetResultFromCompletedTaskStatuses>;
132-
};
133-
134-
export type GetResultFromCompletedTaskResponse = {
135-
result: ArrayBuffer;
136-
};
137-
138123
// ---------------------Collection Types------------------------------------
139124

140125
export type Collection = {

packages/sdk/tests/e2e/dataProtectorCore/processProtectedData.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ describe.skip('dataProtectorCore.processProtectedData()', () => {
8282

8383
const mockArrayBuffer = new ArrayBuffer(8);
8484
jest.unstable_mockModule(
85-
'../../../src/lib/dataProtectorSharing/getResultFromCompletedTask.js',
85+
'../../../src/lib/dataProtectorCore/getResultFromCompletedTask.js',
8686
() => {
8787
return {
8888
getResultFromCompletedTask: jest

0 commit comments

Comments
 (0)