Commit e26e496
feat: Actor.charge() (#346)
* Add signatures of new methods * Add ACTOR_MAX_TOTAL_CHARGE_USD configuration option * Fix type error * Update method signatures to be more in line with Actor whitepaper * Update apify-client * Partially implement ChargingManager * Use ChargingManager in Actor * Read pricing info and use it * Dataset set up * Load more charging information on platform * Make sure that we stay within the budget when charging * Reorder stuff * Fill in docblocks * Reorder operations to prevent race conditions * Update apify-client * Update e2e test directory structure * WIP: Add e2e sdk test setup * Finalize sdk e2e testing environment * Initial e2e test of Actor.charge * Improve test runner * Make Actor.charge test fail * More tests * Simplify control flow * Ensure Actor init in PPE methods * Improve logging * Add remaining charges to ChargeResult * Do not charge for items not yet added to the dataset * Add getPricingInfo method * Allow switching actor into PPE mode locally for testing * Bug * Apply suggestions from code review Co-authored-by: Martin Adámek <banan23@gmail.com> * Extend helloWorld test * Update packages/apify/src/internals/charging.ts Co-authored-by: Martin Adámek <banan23@gmail.com> * Use an existing type for pricingModel * Make charging log dataset opt-in * Address code review comments * Address more review comments * Hide global Actor methods other than charge and add getChargingManager instead * Repeat ourselves to please our documentation tool * Remove unused import * Update e2e tests * Fix local charging * Lint * Do not allow using the charging log dataset on platform * Ignore a docblock * Log a single line for each Actor.charge * Make consts private --------- Co-authored-by: Martin Adámek <banan23@gmail.com>1 parent 4f6a291 commit e26e496
File tree
46 files changed
+900
-13
lines changed- packages/apify
- src
- internals
- test/e2e
- scrapers
- cheerio-default
- cheerio-ignoreSslErrors-disabled
- cheerio-ignoreSslErrors-enabled
- cheerio-initial-cookies
- cheerio-max-requests
- cheerio-page-info
- jsdom-default
- jsdom-initial-cookies
- jsdom-max-requests
- jsdom-page-info
- playwright-default
- playwright-initial-cookies
- puppeteer-default
- puppeteer-ignoreSslErrors-disabled
- puppeteer-ignoreSslErrors-enabled
- puppeteer-initial-cookies
- puppeteer-page-info
- puppeteer-store-pagination-jquery
- puppeteer-store-pagination
- web-default
- web-dev-mode
- web-ignoreSslErrors-disabled
- web-ignoreSslErrors-enabled
- web-initial-cookies
- web-page-info
- web-proxy-rotation-works
- web-store-pagination
- sdk
- actorBase
- .actor
- src
- actorChargeLocal
- src
- actorCharge
- src
- helloWorld
- src
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
46 files changed
+900
-13
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
Some 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 | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
43 | | - | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
44 | 47 | | |
45 | 48 | | |
46 | 49 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
65 | | - | |
| 65 | + | |
66 | 66 | | |
67 | 67 | | |
68 | 68 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
37 | 37 | | |
38 | 38 | | |
39 | 39 | | |
| 40 | + | |
| 41 | + | |
40 | 42 | | |
41 | 43 | | |
42 | 44 | | |
| |||
86 | 88 | | |
87 | 89 | | |
88 | 90 | | |
| 91 | + | |
| 92 | + | |
89 | 93 | | |
90 | 94 | | |
91 | 95 | | |
92 | 96 | | |
93 | 97 | | |
| 98 | + | |
94 | 99 | | |
95 | 100 | | |
96 | 101 | | |
| |||
222 | 227 | | |
223 | 228 | | |
224 | 229 | | |
| 230 | + | |
| 231 | + | |
| 232 | + | |
225 | 233 | | |
226 | 234 | | |
227 | 235 | | |
| |||
611 | 619 | | |
612 | 620 | | |
613 | 621 | | |
614 | | - | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
615 | 675 | | |
616 | 676 | | |
617 | 677 | | |
618 | | - | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
619 | 693 | | |
620 | 694 | | |
621 | 695 | | |
| |||
896 | 970 | | |
897 | 971 | | |
898 | 972 | | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
899 | 993 | | |
900 | 994 | | |
901 | 995 | | |
| |||
1305 | 1399 | | |
1306 | 1400 | | |
1307 | 1401 | | |
1308 | | - | |
1309 | | - | |
| 1402 | + | |
| 1403 | + | |
| 1404 | + | |
| 1405 | + | |
| 1406 | + | |
| 1407 | + | |
| 1408 | + | |
| 1409 | + | |
| 1410 | + | |
| 1411 | + | |
| 1412 | + | |
| 1413 | + | |
| 1414 | + | |
| 1415 | + | |
| 1416 | + | |
| 1417 | + | |
| 1418 | + | |
| 1419 | + | |
| 1420 | + | |
| 1421 | + | |
| 1422 | + | |
| 1423 | + | |
| 1424 | + | |
| 1425 | + | |
| 1426 | + | |
| 1427 | + | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| 1446 | + | |
| 1447 | + | |
| 1448 | + | |
| 1449 | + | |
| 1450 | + | |
| 1451 | + | |
| 1452 | + | |
| 1453 | + | |
| 1454 | + | |
| 1455 | + | |
| 1456 | + | |
1310 | 1457 | | |
1311 | 1458 | | |
1312 | 1459 | | |
| |||
1512 | 1659 | | |
1513 | 1660 | | |
1514 | 1661 | | |
| 1662 | + | |
| 1663 | + | |
| 1664 | + | |
| 1665 | + | |
| 1666 | + | |
| 1667 | + | |
| 1668 | + | |
| 1669 | + | |
| 1670 | + | |
| 1671 | + | |
| 1672 | + | |
| 1673 | + | |
| 1674 | + | |
| 1675 | + | |
| 1676 | + | |
| 1677 | + | |
1515 | 1678 | | |
1516 | 1679 | | |
1517 | 1680 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
34 | 35 | | |
| 36 | + | |
| 37 | + | |
35 | 38 | | |
36 | 39 | | |
37 | 40 | | |
| |||
164 | 167 | | |
165 | 168 | | |
166 | 169 | | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
167 | 173 | | |
168 | 174 | | |
169 | 175 | | |
170 | 176 | | |
171 | | - | |
| 177 | + | |
172 | 178 | | |
173 | 179 | | |
174 | 180 | | |
| |||
185 | 191 | | |
186 | 192 | | |
187 | 193 | | |
| 194 | + | |
| 195 | + | |
188 | 196 | | |
189 | 197 | | |
190 | 198 | | |
| |||
0 commit comments