Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Bump Version to Beta 7 * Refactor Captcha Token Management (#382) * Reset Captcha Token After Use This commit updates the checkout processes to reset the stored captcha token after it has been used. This prevents a token from being used twice. * Enable Harvesting Suspension This commit adds a new suspend method for harvesting captchas that allows a runner to temporarily stop harvesting tokens without fully destroying the token queue. This allows the frontend to better detect when a token is needed. * Add HarvestStates Enum This commit adds an enumeration for harvest states to better handle harvest state transitions. * Fix Invalid Form Bug This commit fixes a bug caused by an invalid form structure when patching the checkout. An empty string passed into the captcha token caused the form structure to be invalid. The change allows an empty string to be passed in without causing an invalid form structure. * Add better handling for captcha requesters This commit refactors the handler for captcha requests now that harvest suspension is a thing. This will prevent multiple start/stops from a single runner interfering with the total semaphore count. * Enable Auto Stop for harvesting tokens This commit updates the captcha window manager to automatically stop after a certain number of tokens have been harvested. This prevents overharvesting of tokens. * Fix Captcha Reset Bug This commit fixes a bug that prevented the captcha from being reset properly. If the captcha window submitted a token and was stopped immediately, the reset logic would call the recaptcha api reset function _while_ the api was in the middle of calling the submit callback. This would cause a bug when resetting and prevent the reset from occurring. To fix this a new _submitting flag is added to track when the captcha window is in the process of submitting a token. If the stop handler is called when submitting, the stop handler skips resetting the challenge. The submit handler now calls the reset method regardless of the start status. Further. the reset function has been adjusted to remove the shouldAutoClick parameter. An analysis of the calls to this function show that we only autoclick if the _started flag is true. Thus the parameter was removed and the _started flag is used alone to determine whether autoclick should be run. Additionally, the logic to hide the captcha form is moved to the reset method since we only hide the form when _started is false. * Add Async Queue to Frontend This commit adds the async queue to the frontend so the captcha window manager can manage a queue and return tokens using promises. The async queue has been updated to include expiration functionality. The expiration functionality takes several parameters: - A filter function to determine whether a datum has "expired" - A interval time (default 1000ms) - Update callback to add logic _after_ the filter has occurred - thisArg optional this reference to use with _both_ the filter and update calls * Use AsyncQueue to manage tokens This commit refactors the captcha window manager to use an async queue for tokens. When a maximum number of tokens has been added to the backlog, the token harvesting is suspended. Once all tokens have been used (or expired) the harvesting resumes. * Source Captcha Tokens CWM This commit completes the transition to have the launcher source tokens from the CWM rather than directly from a harvest event. This allows us to take full advantage of the captcha backlog and handle expired tokens automatically. * Remove unnecessary function This commit removes a function that is no longer used. * Add Better Guard against Canceling Queue Request This commit updates the AsyncQueue to add better guarding against calling the `cancel` function for the returned request. Instead of a null reference, an empty function is used by default. Further, when the request resolves, the cancel function is replaced with an empty function to prevent a rejection from being called after the promise has already finished. * Add New Debug Commands This commit updates the frontend to add new debug commands surrounding captcha management: - viewRunnerRequests - view how many requests each unique runner has pending - viewCwmQueueStats - view the queue and backlog lengths for the captcha queue - viewCwmHarvestState - view the current harvest state of the CWM Additionally, a bug was fixed with the start and stop harvest debug commands to forward parameters in the correct order. Lastly some console logs were added for debugging. * Minor Refactors to Request Cancelling This commit updates the launcher to only cancel unfulfilled requests. Further, some minor refactoring is done sending the token to the launcher. This removes a redundant helper function in place of a one-line insert. * Fix AsyncQueue Bug This commit fixes a bug caused by the async queue treating the wait queue as a stack (using push/pop instead of unshift/pop). This caused incoming tokens to be sent to the wrong runner and have two requests cancelled instead of only one per token. fixes #362 * Loosen Ban Criteria for Proxies (#386) * Adjust shouldBan flag to only ban on 403 errors This commit loosens the should ban status to only being on 403 errors. This should prevent a chain of proxy bans from too many requests on the same site. * Adjust Log Message This commit updates the log message to add the number of proxies available for searching. This should help diagnose errors where the proxy list is getting out of sync. * Fix typo the `size` is a property of a `Map` not a function, so anytime we run this code, an error is thrown. Change this to a property call fixes the issue. Co-Authored-By: pr1sm <dhanwada.dev@gmail.com> * Add Redux State Migration (#389) * Add Migrator Logic This commit adds the main logic behind migrating a state from a given version to the latest. This requires the addition of the semver package to sort tracked versions sequentially. This logic will not have to change, but new migrators will have to be imported as we make new changes to the state. * Add 0.0.0 Migrator This commit adds the initial migrator that represents the current state tree. A copy of the initial state tree is added so the original source can be updated as changes are made. References to the original source files are added in comments. This base state will be used as an initial starting point for new migrations. * Add 0.1.0 Migrator This commit adds a 0.1.0 migrator to handle adding the first "versioned" state tree. This migrator simply attaches the version to the previous 0.0.0 state. * Refactor Top Level Migrator This commit refactors the top level migrator to allow a full migrator map to be injected instead of just the versions. This prevents a bug where a version is found (from injected versions), but doesn't exist in the migrator map, causing an error. * Add Migration Shortcut on Initial State This commit adds a shortcut to the migration logic when the given state is null. In this case, we simply want to return the latest migrations initial state, so we don't need to go through the logic of creating a full length chain and going through meaningless migrations, ending up with the latest initial state. * Add Migrate State Action This commit adds a global action to migrate the state tree and adds the call to the migrator in the top level reducer. Further. the initial state tree is updated to the latest tracked version (0.1.0). * Call Migrate State This commit updates the entry point of the frontend react to call migrate state. * Fix typo Co-Authored-By: pr1sm <dhanwada.dev@gmail.com> * Fix Windows Jest Caching Errors [temporary] This commit temporarily fixes a bug with jest due to bad atomic file writing on Windows. This fix is a temporary on using the resolutions to force a lower version of the offending package. A fix is available for this package (2.4.2) and is consumed in a newer version of jest (24.x), but both packages are depended on transiently through react-scripts, which has yet to consume the fixed version of jest. Until that fix makes its way to react-scripts, we can use this to pin the working version. * Adjust Directory Structure This commit adjusts the directory structure to match the style of importing we have for actions and reducers. No functionality changes, just the file names, locations, and import paths. * Add Migrator Logic Unit Tests This commit adds a new suite of unit tests to focus on the testing the logic for the top level migrator. Test suite over specific migrators will follow. * Add Unit Test Suites for Specific Migrators This commit adds separate test suites for each migrator added. * Finish adding Unit Tests This commit updates the frontend to increase the coverage of changed/added code. [Bonus]: Tests for the set theme action were also added. * Source Initial State from latest migration version This commit updates the frontend to source the initial state from the latest migration version. Instead of having the initial state parts defined in the definition files, the parts are exported similarly from several new files that pull the initial state from the migrator file. The migrator file in turn has a function that looks for the latest migrator and gets the initial state. All import references were updated to reflect the change. * Add Better Log Cleanup (#390) * Add Daily File Rotate Transport This commit adds the daily file rotate transport to handle rotating files on a schedule. This will be used instead of the regular file transport. * Use daily rotate file transport This commit updates the logger implementation to use the new transport instead of the old file transport. * Prevent Unnecessary Logs This commit prevents unnecessary log messages from being printed. The content is unnecessary and drastically increases the size of the log file for little to no benefit. * Remove All Previous Logs To initially cleanup logs, we need to delete the log directory contents the _first_ time we run this changed version. The presence of the `audit.json` file is what we use to determine this. If the log directory previously existed, without the audit file, we know we were using an old version, so we recursively delete the directory contents. We can then proceed with all future files following the DRF cleanup model. fixes #118 * Add Restock Monitor (#392) * switch endpoints to .js * Split GenerateVariants to a Utility File This commit splits a part of the monitor class out to a utility function. This will allow it to be used other classes as well without needing to extend Monitor. * Add Initial Filter for Availability This commit updates the generateVariants utility function to check for available variants before doing anything else. This allows any generated variants to be known as available, while also allowing us to return early if no variants are available. * Add Variant Related Error Codes This commit adds variant specific error codes and updates the generateVariants function throw errors with the relevant codes. A new private function is added to the monitor to call the generateVariants function and handle the error returned (if it exists). * Ensure all parsers include product url This commit updates the parser run methods to ensure the parser includes the product url. This ensures that restocking can happen without the need to search for the product again. That product url is then stored as the restockUrl for the task's product -- this will allow restocking to have an easy reference to the endpoint it needs to poll for more information. * Consolidate Error Codes Map This commit consolidates the error codes maps into one. Separate error maps added an unnecessary extra level. Imports and usages have been updated to reflect this change. * Implement Restock Monitor This commit implements a sub class of the monitor that performs restock monitoring. If restocking is supported, the restock monitor will look for matched, available variants. If no variants are available, further restock monitoring will take place. If variants are available, they will be added to the cart. * Consolidate Parser Error Handling This commit refactors the monitor to add a new method for handling parser errors. This allows the method to be applied more universally to the monitor as well as the restock monitor without code duplication. * Update status messages to match This commit updates the status messages for restocks so they match the ones emitted from the checkout class. * Add Restocking Handler to Task Runner This commit adds the restock monitor and restocking handler to the TaskRunner. All nextStates that deal with restocking have been updated to use the restocking monitor. * Fix Imports Fix imports to be direct instead of inside an export object. Co-Authored-By: pr1sm <dhanwada.dev@gmail.com> * Fix Typo and Reword Status Message This commit updates a typo that caused a crash when monitoring with keywords. This commit also updates the message that gets emitted when a product has been restocked. * Bug Fixes This commit updates several files with the following fixes: - Fixed typos where the wrong variable was referenced - Returned the right value - Fixed Typos in status messages and log messages - Ensure product url is always the correct format * Wait for Monitor Delay when Restocking Co-Authored-By: pr1sm <dhanwada.dev@gmail.com> Fixes #380 * Add Small Frontend Improvements (#395) * Update yarn lock * Remove UK Mens Size Group This commit removes the UK mens size group until multi region size support is implement. The US sizing is renamed to just "Men's" instead of "US Men's" * Change default country to US This commit adds a new migrator to adjust the default state of all locations to the US. If a country was already entered, it is not changed. * remove isMulti from sizes * Add Better Handling for Garment Size Matching This commit updates the variant matching algorithm to improve matching when garment sizes are the input. When a garment size is determined (no numbers in the input size), All mapped sizes must be non-numeric and start with the input size. * Increase Test Coverage This commit updates tests related to changed code to increase coverage. * Fix Size Change Handlers This commit updates the size change handlers for both the createTask and taskRow components to allow for single select components. A temporary hot fix to mock two multi-select changes is used to prevent a total rewrite of reducer logic. * Update packages/frontend/src/__tests__/constants/getAllSizes.test.js * Fix Typo * version 6.4
- Loading branch information