Skip to content

Commit aae6aec

Browse files
Release/sdk v2.0.0 beta.12 (#398)
2 parents 63da37f + a59660b commit aae6aec

File tree

14 files changed

+222
-57
lines changed

14 files changed

+222
-57
lines changed

.drone.yml

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -668,43 +668,49 @@ trigger:
668668
event:
669669
- promote
670670
target:
671-
# deploy the dataprotector subgraph
672-
- subgraph-deploy-dev
673671
# deploy the dataprotector subgraph for the staging environment
674672
- subgraph-deploy-staging
673+
# deploy the dataprotector subgraph
674+
- subgraph-deploy-tmp
675675
# deploy the dataprotector subgraph for the prod environment
676676
- subgraph-deploy-prod
677677
branch:
678678
- develop
679679
- main
680680

681681
steps:
682-
- name: deploy-v2-dev
682+
- name: install deps
683+
image: node:18.19
684+
pull: always
685+
commands:
686+
- cd packages/subgraph
687+
- npm ci
688+
689+
- name: deploy-v2-staging
683690
image: node:18.19
684691
params:
685692
- START_BLOCK
686693
environment:
687694
GRAPHNODE_URL:
688-
from_secret: graphnode-url
695+
from_secret: graphnode-url-staging
689696
IPFS_URL:
690-
from_secret: ipfs-url
691-
ENV: prod
697+
from_secret: ipfs-url-staging
698+
ENV: staging
692699
commands:
693700
- cd packages/subgraph
694-
- export SUBGRAPH_NAME=bellecour/dev-dataprotector-v2
701+
- export SUBGRAPH_NAME=bellecour/staging-dataprotector-v2
695702
- echo "deploying commit $DRONE_COMMIT on subgraph $SUBGRAPH_NAME"
696-
- npm ci
697703
- npm run codegen
698704
- npm run build
699705
- npx graph create --node $GRAPHNODE_URL $SUBGRAPH_NAME
700-
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $DRONE_COMMIT
706+
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $(npm pkg get version)
701707
when:
702708
target:
703-
- subgraph-deploy-dev
709+
- subgraph-deploy-staging
704710
branch:
705711
- develop
706712

707-
- name: deploy-v2-prod
713+
- name: deploy-v2-tmp
708714
image: node:18.19
709715
params:
710716
- START_BLOCK
@@ -716,20 +722,19 @@ steps:
716722
ENV: prod
717723
commands:
718724
- cd packages/subgraph
719-
- export SUBGRAPH_NAME=bellecour/dataprotector-v2
725+
- export SUBGRAPH_NAME=bellecour/tmp-dataprotector-v2
720726
- echo "deploying commit $DRONE_COMMIT on subgraph $SUBGRAPH_NAME"
721-
- npm ci
722727
- npm run codegen
723728
- npm run build
724729
- npx graph create --node $GRAPHNODE_URL $SUBGRAPH_NAME
725-
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $(npm pkg get version)
730+
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $DRONE_COMMIT
726731
when:
727732
target:
728-
- subgraph-deploy-prod
733+
- subgraph-deploy-tmp
729734
branch:
730735
- main
731736

732-
- name: deploy-v2-staging
737+
- name: deploy-v2-prod
733738
image: node:18.19
734739
params:
735740
- START_BLOCK
@@ -738,21 +743,20 @@ steps:
738743
from_secret: graphnode-url
739744
IPFS_URL:
740745
from_secret: ipfs-url
741-
ENV: staging
746+
ENV: prod
742747
commands:
743748
- cd packages/subgraph
744-
- export SUBGRAPH_NAME=bellecour/staging-dataprotector-v2
749+
- export SUBGRAPH_NAME=bellecour/dataprotector-v2
745750
- echo "deploying commit $DRONE_COMMIT on subgraph $SUBGRAPH_NAME"
746-
- npm ci
747751
- npm run codegen
748752
- npm run build
749753
- npx graph create --node $GRAPHNODE_URL $SUBGRAPH_NAME
750754
- npx graph deploy --node $GRAPHNODE_URL $SUBGRAPH_NAME --ipfs $IPFS_URL --version-label $(npm pkg get version)
751755
when:
752756
target:
753-
- subgraph-deploy-staging
757+
- subgraph-deploy-prod
754758
branch:
755-
- develop
759+
- main
756760

757761
---
758762
#pipeline to deploy app whitelist on iexec
@@ -937,7 +941,7 @@ steps:
937941
from_secret: nexus-password
938942
tags:
939943
- dev
940-
- 'dev-${DRONE_COMMIT}'
944+
- "dev-${DRONE_COMMIT}"
941945
when:
942946
branch:
943947
- develop

packages/sdk/CHANGELOG.md

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

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

5+
## [2.0.0-beta.12] (2025-02-04)
6+
7+
### Added
8+
9+
- Added optional `path` parameter to `processProtectedData` method
10+
11+
### Changed
12+
13+
- Moved `getResultFromCompletedTask` method from DataProtectorSharing module (DPS) to DataProtectorCore module (DPC).
14+
515
## [2.0.0-beta.11] (2025-01-29)
616

717
### Added

packages/sdk/package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/sdk/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@iexec/dataprotector",
3-
"version": "2.0.0-beta.11",
3+
"version": "2.0.0-beta.12",
44
"description": "This product enables users to confidentially store data–such as mail address, documents, personal information ...",
55
"type": "module",
66
"types": "dist/src/index.d.ts",

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: 4 additions & 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,
@@ -41,6 +41,7 @@ export const processProtectedData = async ({
4141
app,
4242
userWhitelist,
4343
maxPrice = DEFAULT_MAX_PRICE,
44+
path,
4445
args,
4546
inputFiles,
4647
secrets,
@@ -62,6 +63,7 @@ export const processProtectedData = async ({
6263
const vMaxPrice = positiveNumberSchema()
6364
.label('maxPrice')
6465
.validateSync(maxPrice);
66+
const vPath = stringSchema().label('path').validateSync(path);
6567
const vInputFiles = urlArraySchema()
6668
.label('inputFiles')
6769
.validateSync(inputFiles);
@@ -236,6 +238,7 @@ export const processProtectedData = async ({
236238
const { result } = await getResultFromCompletedTask({
237239
iexec,
238240
taskId,
241+
path: vPath,
239242
onStatusUpdate: vOnStatusUpdate,
240243
});
241244

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: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ import {
1717
throwIfMissing,
1818
validateOnStatusUpdateCallback,
1919
positiveNumberSchema,
20+
stringSchema,
2021
} from '../../utils/validators.js';
2122
import {
2223
ConsumeProtectedDataParams,
@@ -26,7 +27,7 @@ import {
2627
SharingContractConsumer,
2728
} from '../types/index.js';
2829
import { IExecConsumer } from '../types/internalTypes.js';
29-
import { getResultFromCompletedTask } from './getResultFromCompletedTask.js';
30+
import { getResultFromCompletedTask } from '../dataProtectorCore/getResultFromCompletedTask.js';
3031
import { getAppWhitelistContract } from './smartContract/getAddOnlyAppWhitelistContract.js';
3132
import { getSharingContract } from './smartContract/getSharingContract.js';
3233
import {
@@ -56,6 +57,7 @@ export const consumeProtectedData = async ({
5657
const vMaxPrice = positiveNumberSchema()
5758
.label('maxPrice')
5859
.validateSync(maxPrice);
60+
const vPath = stringSchema().label('path').validateSync(path);
5961
let vApp = addressOrEnsSchema().required().label('app').validateSync(app);
6062
let vWorkerpool = addressOrEnsSchema()
6163
.label('workerpool')
@@ -215,7 +217,7 @@ export const consumeProtectedData = async ({
215217
const { result } = await getResultFromCompletedTask({
216218
iexec,
217219
taskId,
218-
path,
220+
path: vPath,
219221
pemPrivateKey: privateKey,
220222
onStatusUpdate: vOnStatusUpdate,
221223
});

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

Lines changed: 22 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'
@@ -291,6 +308,11 @@ export type ProcessProtectedDataParams = {
291308
*/
292309
maxPrice?: number;
293310

311+
/**
312+
* The file name of the desired file in the returned ZIP file.
313+
*/
314+
path?: string;
315+
294316
/**
295317
* Arguments to pass to the application during execution.
296318
*/

0 commit comments

Comments
 (0)