Skip to content

Commit 9db13f8

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 d056da5 commit 9db13f8

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
*/
@@ -412,3 +424,111 @@ export type ProcessProtectedDataResponseWithResult =
412424
export type ProcessProtectedDataResponse<T> = T extends { waitForResult: false }
413425
? ProcessProtectedDataResponseBase
414426
: ProcessProtectedDataResponseWithResult;
427+
428+
// ---------------------ProcessBulkRequest Types------------------------------------
429+
430+
export type ProcessBulkRequestStatuses =
431+
| 'FETCH_ORDERS'
432+
| 'PUSH_REQUESTER_SECRET'
433+
| 'GENERATE_ENCRYPTION_KEY'
434+
| 'PUSH_ENCRYPTION_KEY'
435+
| 'PREPARE_PROTECTED_DATA_BULK'
436+
| 'CREATE_REQUEST_ORDER'
437+
| 'MATCH_ORDERS_LOOP'
438+
| 'WAITING_FOR_WORKERPOOL_ORDERS'
439+
| 'REQUEST_TO_PROCESS_BULK_DATA'
440+
| 'CONSUME_TASK'
441+
| 'CONSUME_RESULT_DOWNLOAD'
442+
| 'CONSUME_RESULT_DECRYPT';
443+
444+
export type ProcessBulkRequestParams = {
445+
/**
446+
* Array of bulk dataset orders to process
447+
*/
448+
bulkOrders: GrantedAccess[];
449+
450+
/**
451+
* Address or ENS of the app to use for processing the protected data
452+
*/
453+
app: AddressOrENS;
454+
455+
/**
456+
* Maximum number of datasets per task
457+
*/
458+
maxProtectedDataPerTask: number;
459+
460+
/**
461+
* Maximum price willing to pay for the data order (in nRLC)
462+
*/
463+
dataMaxPrice?: number;
464+
465+
/**
466+
* Maximum price willing to pay for the app order (in nRLC)
467+
*/
468+
appMaxPrice?: number;
469+
470+
/**
471+
* Maximum price willing to pay for the workerpool order (in nRLC)
472+
*/
473+
workerpoolMaxPrice?: number;
474+
475+
/**
476+
* Path to the result file in the app's output
477+
*/
478+
path?: string;
479+
480+
/**
481+
* Arguments to pass to the application
482+
*/
483+
args?: string;
484+
485+
/**
486+
* URLs of input files to be used by the application
487+
*/
488+
inputFiles?: string[];
489+
490+
/**
491+
* Requester secrets necessary for the application's execution.
492+
* It is represented as a mapping of numerical identifiers to corresponding secrets.
493+
*/
494+
secrets?: Record<number, string>;
495+
496+
/**
497+
* The workerpool to use for the application's execution. (default iExec production workerpool)
498+
*/
499+
workerpool?: AddressOrENS;
500+
501+
/**
502+
* A boolean that indicates whether to use a voucher or no.
503+
*/
504+
useVoucher?: boolean;
505+
506+
/**
507+
* 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.
508+
*/
509+
voucherOwner?: AddressOrENS;
510+
511+
/**
512+
* Enable result encryption for the processed data.
513+
* @default = false
514+
*/
515+
encryptResult?: boolean;
516+
517+
/**
518+
* Private key in PEM format for result encryption/decryption.
519+
* If not provided and encryptResult is true, a new key pair will be generated.
520+
*/
521+
pemPrivateKey?: string;
522+
523+
/**
524+
* Callback function that will get called at each step of the process
525+
*/
526+
onStatusUpdate?: OnStatusUpdateFn<ProcessBulkRequestStatuses>;
527+
};
528+
529+
export type ProcessBulkRequestResponse = {
530+
dealsIds: string[];
531+
txHashes: string[];
532+
requestOrder: any;
533+
pemPrivateKey?: string;
534+
};

0 commit comments

Comments
 (0)