Security News
pnpm 10.0.0 Blocks Lifecycle Scripts by Default
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Hacking around with watirose
npm install mywaitrose
Typical use case would be to login:
await waitroseAPI.login(<USERNAME>, <PASSWORD>);
Then set the delivery postcode (this is required before you try and add anything to your basket)
await waitroseAPI.setPostcode(postcode);
You can now search for products:
const products = waitroseAPI.searchForProduct('Bananas');
Add products to your basket:
const newBasket = await waitroseAPI.addToBasket(products[0].id);
console.log(`You now have ${newBasket.numberOfItems} items in your basket`);
newBasket.products.forEach(product => console.log(product.id, product.name, product.quantity));
Get the estimated cost of your basket
const newTolleySummary = await waitroseAPI.getTrolleySummary();
console.log(`Estimated cost of trolley ${newTolleySummary.estimatedCost}`);
List the contents of your basket
const itemsInBasket = await waitroseAPI.getItemsInBasket();
console.log(`You have ${itemsInBasket.numberOfItems} items in your basket`);
itemsInBasket.products.forEach(product => console.log(product.name));
Get your favourite products
const favourites = await waitroseAPI.getFavourites();
console.log(`You have ${favourites.length} favourite products`);
favourites.forEach(favourite => console.log(favourite.details.name));
import WaitroseAPI from 'mywaitrose';
async function addToBasket(username, password, postcode, searchTerm) {
const waitroseAPI = new WaitroseAPI();
await waitroseAPI.login(username, password);
console.log('Logged in');
// need to set the postcode before we can add stuff to the basket ?
await waitroseAPI.setPostcode(postcode);
console.log('Set Password');
// see what's in our basket
const itemsInBasket = await waitroseAPI.getItemsInBasket();
console.log(`You have ${itemsInBasket.numberOfItems} items in your basket`);
itemsInBasket.products.forEach(product => console.log(product.id, product.name));
// get the trolley cost
const trolleySummary = await waitroseAPI.getTrolleySummary();
console.log(`Estimated cost of trolley ${trolleySummary.estimatedCost}`);
// seach for a product
const products = await waitroseAPI.searchForProduct(searchTerm);
console.log(`Found ${products.length} matches for "${searchTerm}"`);
products.forEach(product => console.log(product.id, product.name));
// add the first product we found
const newBasket = await waitroseAPI.addToBasket(products[0].id);
console.log(`You now have ${newBasket.numberOfItems} items in your basket`);
newBasket.products.forEach(product => console.log(product.id, product.name, product.quantity));
const newTolleySummary = await waitroseAPI.getTrolleySummary();
console.log(`Estimated cost of trolley ${newTolleySummary.estimatedCost}`);
}
main(<YOUR USERNAME>, <YOUR PASSWORD>, <YOUR POSTCODE> <SEARCH TERM FOR PRODUCT TO ADD TO BASKET>);
Clone the repo and run:
npm install
npm run dev USERNAME PASSWORD "POSTCODE" "PRODUCT SEARCH TERM"
This will run the code in a loop waiting for changes to the code. Pass your waitrose username, password, delivery postcode and the product you want to search for.
npm start USERNAME PASSWORD "POSTCODE" "PRODUCT SEARCH TERM"
This will run the code once - pass the same arguments as above.
Build the javascript with:
npm run lint
npm test
npm run compile
FAQs
Waitrose API
We found that mywaitrose demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.
Product
Socket now supports uv.lock files to ensure consistent, secure dependency resolution for Python projects and enhance supply chain security.
Research
Security News
Socket researchers have discovered multiple malicious npm packages targeting Solana private keys, abusing Gmail to exfiltrate the data and drain Solana wallets.