Commit ec61f9f
feat(sdk): add bulk processing support for email sending (#235)
* chore(deps): add bulk processing support dependencies
- Move @iexec/dataprotector to dependencies
- Update @iexec/dataprotector to beta version with bulk processing support
- Update iexec SDK to version with bulk processing support
* feat(types): add bulk processing types and GrantedAccess
- Add GrantedAccess type for detailed dataset order information
- Update Contact type to include grantedAccess field
- Update SendEmailParams to support grantedAccess array
- Add ProcessBulkRequestResponse and SendEmailBulkResponse types
- Add bulkOnly parameter to contact fetching params
* feat(core): integrate IExecDataProtectorCore for bulk processing
- Add dataProtector instance to IExecWeb3mail class
- Update sendEmail return type to ProcessBulkRequestResponse | SendEmailSingleResponse
- Initialize dataProtector with proper configuration matching web3telegram pattern
- Update resolveConfig to create dataProtector instance with subgraphUrl, ipfsGateway, and ipfsNode
* feat(sendEmail): add bulk processing support with grantedAccess
- Refactor sendEmail to support both single and bulk processing modes
- Add bulk processing logic using dataProtector.prepareBulkRequest and processBulkRequest
- Update single processing to use dataProtector.processProtectedData
- Add validation for grantedAccess parameter
- Support grantedAccess array for bulk email sending
* feat(contacts): add bulkOnly parameter and grantedAccess support
- Add bulkOnly parameter to fetchMyContacts and fetchUserContacts
- Update fetchUserContacts to populate grantedAccess field with full dataset order details
- Pass bulkOnly as allowBulk to fetchDatasetOrderbook
- Update subgraphQuery.getValidContact to include grantedAccess in returned contacts
- Filter null/undefined contacts matching web3telegram pattern
* test(unit): add bulk processing unit tests
- Add unit tests for grantedAccess parameter in sendEmail
- Add unit tests for bulkOnly parameter in fetchMyContacts
- Add test for grantedAccess property in returned contacts
- Update sendEmail unit tests to match web3telegram pattern
- Add comprehensive bulk processing test coverage
* test(e2e): add bulkOnly parameter e2e tests
- Add bulkOnly parameter tests to fetchMyContacts e2e suite
- Add bulkOnly parameter tests to fetchUserContacts e2e suite
- Test bulk access filtering and default behavior
- Match web3telegram e2e test patterns
* test(e2e): add bulk email sending e2e tests
- Fix sendEmail e2e test type guards for ProcessBulkRequestResponse | SendEmailSingleResponse
- Add sendEmailBulk e2e test file for bulk processing
- Update error message expectations for processProtectedData errors
- Test bulk email sending with grantedAccess array
* test: fix constructor test and update test utilities
- Fix constructor test error message expectation (remove dappAddress from missing config)
- Update test utilities for bulk processing support
* test(e2e): fix sendEmail e2e test error handling
- Fix voucher error test to check error message in cause chain
- Update error message expectations to handle wrapped errors from processProtectedData
- Fix timeout issue in beforeEach hook for workerpool order test
* feat(sendEmail): add missing parameters to processProtectedData
- Add defaultWorkerpool parameter
- Add workerpoolMaxPrice, dataMaxPrice, appMaxPrice parameters
- Add useVoucher parameter
- Add dataMaxPrice validation
* style: format code with prettier
- Format fetchMyContacts validation to single line
- Format beforeAll hook in fetchUserContacts test
* fix(types): add grantedAccess property to test contact objects
- Add grantedAccess mock data to all test contact objects
- Update test expectations to include grantedAccess property
- Fix TypeScript errors in subgraphQuery.test.ts
* feat: add prepareEmailCampaign and sendEmailCampaign methods for bulk processing
- Add prepareEmailCampaign to prepare bulk email campaigns with encryption and IPFS upload
- Add sendEmailCampaign to process prepared bulk campaigns
- Support for bulk email processing using @iexec/dataprotector SDK
* feat: add types for bulk email campaign processing
- Add PrepareEmailCampaignParams and PrepareEmailCampaignResponse types
- Add SendEmailCampaignParams and ProcessBulkRequestResponse types
- Add GrantedAccess type for detailed access grant information
- Update Contact type to include grantedAccess field
* feat: integrate bulk email campaign methods into IExecWeb3mail
- Add prepareEmailCampaign method to IExecWeb3mail class
- Add sendEmailCampaign method to IExecWeb3mail class
- Initialize IExecDataProtectorCore instance for bulk processing support
* test: add e2e tests for bulk email campaign methods
- Add prepareEmailCampaign e2e tests
- Add sendEmailCampaign e2e tests with comprehensive coverage
- Test error handling, validation, and integration scenarios
* test: add prepare-iexec script to disable checkImplementedOnChain
- Add script to disable checkImplementedOnChain in iexec config module
- Required for testing on experimental networks
* fix(test): update constructor test to use isUserStrict for accurate contact filtering
- Set isUserStrict: true in fetchUserContacts test to only get user-specific orders
- Fix test expecting empty array for random wallet with no grants
* chore: update dataprotector and iexec deps to latest stable version
* chore: remove obsolete sendEmailBulk test file
- Remove sendEmailBulk.test.ts as bulk processing is now handled by prepareEmailCampaign and sendEmailCampaign
* refactor: restore sendEmail to original single email sending implementation
- Remove bulk processing logic from sendEmail
- Restore orderbook-based single email sending
- Bulk processing now handled by prepareEmailCampaign and sendEmailCampaign methods
* fix(test): handle transaction already imported error in ensureSufficientStake
- Add error handling for parallel test execution in CI
- Handle 'transaction already imported' error (-32003) gracefully
- Wait and re-check balance after transaction submission
- Make deposit operation idempotent for parallel test execution
- Prevents nonce conflicts when multiple tests run simultaneously
* fix: update types
* fix: update types
* chore: stop using deprecated function
* chore: update unit tests
* fix: update subgraphQuery
Co-authored-by: pjt <[email protected]>
* fix: remove as any IExecWeb3mail
Co-authored-by: pjt <[email protected]>
* fix: remove as any IExecWeb3mail
Co-authored-by: pjt <[email protected]>
* fix: avoid wrapping ValidationError into WorkflowError
Co-authored-by: pjt <[email protected]>
* fix: add missing imports
* chore: remove deprecate function call
* fix: e2e tests
* fix(test): update e2e tests to match SDK implementation and fix timeouts
- Update sendEmailCampaign tests to accept ValidationError and TypeError where appropriate
- Fix workerpool matching in tests by passing correct workerpoolAddressOrEns
- Increase prepareEmailCampaign beforeEach timeout
* fix: no waiting for response in a campaign sending
* docs: improve documentation in types
* chore: clean package.json
* fix: use grantedAccess plural form for GrantedAccess list
* chore: remove useless params from sendEmailCampaign
* feat: add campaignRequest validation
* fix: add dealId in sendEmail response
* fix(validators): improve campaignRequest schema validation error message
- Add strict mode to prevent undefined coercion to empty object
- Add custom test to check for undefined/null/empty object before field validation
- Fix error message to show 'campaignRequest is required' instead of 'sign is a required field' when campaignRequest is undefined
---------
Co-authored-by: Pierre Jeanjacquot <[email protected]>1 parent 0fd827f commit ec61f9f
File tree
23 files changed
+2147
-169
lines changed- src
- utils
- web3mail
- tests
- e2e
- scripts
- unit
- utils
23 files changed
+2147
-169
lines changedSome generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
24 | | - | |
| 23 | + | |
25 | 24 | | |
26 | 25 | | |
27 | 26 | | |
| |||
31 | 30 | | |
32 | 31 | | |
33 | 32 | | |
34 | | - | |
| 33 | + | |
35 | 34 | | |
36 | 35 | | |
37 | 36 | | |
| |||
49 | 48 | | |
50 | 49 | | |
51 | 50 | | |
| 51 | + | |
52 | 52 | | |
53 | 53 | | |
54 | 54 | | |
55 | | - | |
| 55 | + | |
56 | 56 | | |
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
60 | | - | |
61 | 60 | | |
62 | 61 | | |
63 | 62 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
88 | 91 | | |
89 | 92 | | |
90 | 93 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
61 | 62 | | |
62 | 63 | | |
63 | 64 | | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| 8 | + | |
| 9 | + | |
7 | 10 | | |
8 | 11 | | |
9 | 12 | | |
| |||
13 | 16 | | |
14 | 17 | | |
15 | 18 | | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
16 | 23 | | |
17 | 24 | | |
18 | 25 | | |
| |||
34 | 41 | | |
35 | 42 | | |
36 | 43 | | |
| 44 | + | |
37 | 45 | | |
38 | 46 | | |
39 | 47 | | |
| |||
51 | 59 | | |
52 | 60 | | |
53 | 61 | | |
| 62 | + | |
| 63 | + | |
54 | 64 | | |
55 | 65 | | |
56 | 66 | | |
| |||
75 | 85 | | |
76 | 86 | | |
77 | 87 | | |
| 88 | + | |
78 | 89 | | |
79 | 90 | | |
80 | 91 | | |
| |||
121 | 132 | | |
122 | 133 | | |
123 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
124 | 165 | | |
125 | 166 | | |
126 | 167 | | |
| |||
184 | 225 | | |
185 | 226 | | |
186 | 227 | | |
| 228 | + | |
| 229 | + | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
| 233 | + | |
| 234 | + | |
| 235 | + | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
187 | 239 | | |
188 | 240 | | |
189 | 241 | | |
| |||
192 | 244 | | |
193 | 245 | | |
194 | 246 | | |
| 247 | + | |
195 | 248 | | |
196 | 249 | | |
197 | 250 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| 19 | + | |
19 | 20 | | |
20 | 21 | | |
21 | 22 | | |
| |||
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| 28 | + | |
27 | 29 | | |
28 | 30 | | |
29 | 31 | | |
| |||
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| 38 | + | |
36 | 39 | | |
37 | 40 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| |||
47 | 48 | | |
48 | 49 | | |
49 | 50 | | |
| 51 | + | |
50 | 52 | | |
51 | 53 | | |
52 | 54 | | |
| |||
55 | 57 | | |
56 | 58 | | |
57 | 59 | | |
| 60 | + | |
58 | 61 | | |
59 | 62 | | |
60 | 63 | | |
61 | 64 | | |
62 | 65 | | |
63 | 66 | | |
| 67 | + | |
64 | 68 | | |
65 | 69 | | |
66 | 70 | | |
| |||
84 | 88 | | |
85 | 89 | | |
86 | 90 | | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
| 95 | + | |
| 96 | + | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
87 | 103 | | |
88 | 104 | | |
89 | 105 | | |
| |||
107 | 123 | | |
108 | 124 | | |
109 | 125 | | |
| 126 | + | |
110 | 127 | | |
111 | 128 | | |
112 | 129 | | |
113 | 130 | | |
114 | 131 | | |
| 132 | + | |
115 | 133 | | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
126 | | - | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
127 | 144 | | |
128 | 145 | | |
129 | 146 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
4 | 5 | | |
| |||
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
0 commit comments