Skip to content

Commit f4468fa

Browse files
SeddikBellaminePierreJeanjacquot
authored andcommitted
feat: add ProcessBulkRequest types and update GrantAccess types
- Add ProcessBulkRequestStatuses, ProcessBulkRequestParams, ProcessBulkRequestResponse types - Add allowBulk parameter to GrantAccessParams - Add bulkOnly filter to GetGrantedAccessParams - Update GrantAccessStatuses with bulk order statuses
1 parent 13e1332 commit f4468fa

File tree

1 file changed

+121
-1
lines changed

1 file changed

+121
-1
lines changed

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

Lines changed: 121 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ export type GetGrantedAccessParams = {
141141
* Size of the page to fetch
142142
*/
143143
pageSize?: number;
144+
145+
/**
146+
* Filter for bulk orders only
147+
*/
148+
bulkOnly?: boolean;
144149
};
145150

146151
export type GetProtectedDataParams = {
@@ -154,7 +159,9 @@ export type GetProtectedDataParams = {
154159

155160
export type GrantAccessStatuses =
156161
| 'CREATE_DATASET_ORDER'
157-
| 'PUBLISH_DATASET_ORDER';
162+
| 'PUBLISH_DATASET_ORDER'
163+
| 'CREATE_BULK_ORDER'
164+
| 'PUBLISH_BULK_ORDER';
158165

159166
export type GrantAccessParams = {
160167
/**
@@ -184,6 +191,11 @@ export type GrantAccessParams = {
184191
*/
185192
numberOfAccess?: number;
186193

194+
/**
195+
* Enable bulk processing for the granted access
196+
*/
197+
allowBulk?: boolean;
198+
187199
/**
188200
* Callback function that will get called at each step of the process
189201
*/
@@ -382,3 +394,111 @@ export type ProcessProtectedDataResponse = {
382394
result: ArrayBuffer;
383395
pemPrivateKey?: string;
384396
};
397+
398+
// ---------------------ProcessBulkRequest Types------------------------------------
399+
400+
export type ProcessBulkRequestStatuses =
401+
| 'FETCH_ORDERS'
402+
| 'PUSH_REQUESTER_SECRET'
403+
| 'GENERATE_ENCRYPTION_KEY'
404+
| 'PUSH_ENCRYPTION_KEY'
405+
| 'PREPARE_PROTECTED_DATA_BULK'
406+
| 'CREATE_REQUEST_ORDER'
407+
| 'MATCH_ORDERS_LOOP'
408+
| 'WAITING_FOR_WORKERPOOL_ORDERS'
409+
| 'REQUEST_TO_PROCESS_BULK_DATA'
410+
| 'CONSUME_TASK'
411+
| 'CONSUME_RESULT_DOWNLOAD'
412+
| 'CONSUME_RESULT_DECRYPT';
413+
414+
export type ProcessBulkRequestParams = {
415+
/**
416+
* Array of bulk dataset orders to process
417+
*/
418+
bulkOrders: GrantedAccess[];
419+
420+
/**
421+
* Address or ENS of the app to use for processing the protected data
422+
*/
423+
app: AddressOrENS;
424+
425+
/**
426+
* Maximum number of datasets per task
427+
*/
428+
maxProtectedDataPerTask: number;
429+
430+
/**
431+
* Maximum price willing to pay for the data order (in nRLC)
432+
*/
433+
dataMaxPrice?: number;
434+
435+
/**
436+
* Maximum price willing to pay for the app order (in nRLC)
437+
*/
438+
appMaxPrice?: number;
439+
440+
/**
441+
* Maximum price willing to pay for the workerpool order (in nRLC)
442+
*/
443+
workerpoolMaxPrice?: number;
444+
445+
/**
446+
* Path to the result file in the app's output
447+
*/
448+
path?: string;
449+
450+
/**
451+
* Arguments to pass to the application
452+
*/
453+
args?: string;
454+
455+
/**
456+
* URLs of input files to be used by the application
457+
*/
458+
inputFiles?: string[];
459+
460+
/**
461+
* Requester secrets necessary for the application's execution.
462+
* It is represented as a mapping of numerical identifiers to corresponding secrets.
463+
*/
464+
secrets?: Record<number, string>;
465+
466+
/**
467+
* The workerpool to use for the application's execution. (default iExec production workerpool)
468+
*/
469+
workerpool?: AddressOrENS;
470+
471+
/**
472+
* A boolean that indicates whether to use a voucher or no.
473+
*/
474+
useVoucher?: boolean;
475+
476+
/**
477+
* Override the voucher contract to use, must be combined with useVoucher: true the user must be authorized by the voucher's owner to use it.
478+
*/
479+
voucherOwner?: AddressOrENS;
480+
481+
/**
482+
* Enable result encryption for the processed data.
483+
* @default = false
484+
*/
485+
encryptResult?: boolean;
486+
487+
/**
488+
* Private key in PEM format for result encryption/decryption.
489+
* If not provided and encryptResult is true, a new key pair will be generated.
490+
*/
491+
pemPrivateKey?: string;
492+
493+
/**
494+
* Callback function that will get called at each step of the process
495+
*/
496+
onStatusUpdate?: OnStatusUpdateFn<ProcessBulkRequestStatuses>;
497+
};
498+
499+
export type ProcessBulkRequestResponse = {
500+
dealsIds: string[];
501+
txHashes: string[];
502+
requestOrder: any;
503+
pemPrivateKey?: string;
504+
};

0 commit comments

Comments
 (0)