Security News
Create React App Officially Deprecated Amid React 19 Compatibility Issues
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
``` _ _ _ | |__ ___ ___ | | _____| |_ ___ _ __ ___ | '_ \ / _ \ / _ \| |/ / __| __/ _ \| '__/ _ \ | |_) | (_) | (_) | <\__ \ || (_) | | | __/ |_.__/ \___/ \___/|_|\_\___/\__\___/|_| \___|
_ _ _
| |__ ___ ___ | | _____| |_ ___ _ __ ___
| '_ \ / _ \ / _ \| |/ / __| __/ _ \| '__/ _ \
| |_) | (_) | (_) | <\__ \ || (_) | | | __/
|_.__/ \___/ \___/|_|\_\___/\__\___/|_| \___|
A small data framework for collaborative list editing using Azure Blob Storage and Redis.
O(1)
bookstore
is designed to be exposed over Web Socket and Server-Sent Events.
For production build, npm install bookstore
. For development build, npm install bookstore@master
.
For peer dependencies, you will also need npm install azure-storage@2 redis
.
const { createBlobService } = require('azure-storage');
const { createClient } = require('redis');
const updateIn = require('simple-update-in');
const createBook, { createPubSubUsingRedis, createStorageUsingAzureStorage } = require('bookstore');
const blobService = createBlobService(
process.env.AZURE_STORAGE_ACCOUNT,
process.env.AZURE_STORAGE_ACCESS_KEY
);
const publishRedis = createClient();
const subscribeRedis = publishRedis.duplicate();
const book = createBook(
({ x, y }) => ({ sum: x + y }),
{
...createPubSubUsingRedis(publishRedis, subscribeRedis, 'blob-container-name'),
...createStorageUsingAzureStorage(blobService, 'blob-container-name')
}
);
await book.create('page-0', { x: 1, y: 2 });
// Listing summary of all pages
// { 'page-0': {
// summary: { sum: 3 }
// } }
await book.list();
// Getting the content of the page
// { x: 1, y: 2 }
await book.get('page-0');
// Update a page
// We use `simple-update-in` and updater function for handling concurrency
await book.update('page-0', content => updateIn(content, ['x'], () => 3));
// "change" event emitted when update broadcast on Redis
// Only summaries are sent over Redis
book.subscribe(({ id, summary }) => {
console.log(id); // 'page-0'
console.log(summary); // { sum: 5 }
});
// Listing summary of all pages again, with new changes
// { 'page-0': {
// summary: { sum: 5 }
// } }
await book.list();
// Delete a page
await book.del('page-0');
Instead of using Blob via Azure Storage and Pub-sub via Redis, you can also use other services as long as they met the requirements:
create(id, content, summary)
: Create a new blob with content and summarydel(id)
: Delete a blobget(id)
: Read a blob contentlist()
: List all blob summaries, without reading the actual contentupdate(id, updater)
: Update an existing blob via an updater function, using lock to prevent dirty read
updater: ({ content, summary }) => ({ content, summary })
publish(content)
: Publish to a predefined topicsubscribe(callback: content => void): () => void
: Subscribe to a predefined topic via callback, will return a function for unsubscribe
callback
will be called if content is updated (via Object.is
) and summary has kept the sameLike us? Star us.
Want to make it better? File us an issue.
Don't like something you see? Submit a pull request.
FAQs
``` _ _ _ | |__ ___ ___ | | _____| |_ ___ _ __ ___ | '_ \ / _ \ / _ \| |/ / __| __/ _ \| '__/ _ \ | |_) | (_) | (_) | <\__ \ || (_) | | | __/ |_.__/ \___/ \___/|_|\_\___/\__\___/|_| \___|
The npm package bookstore receives a total of 2 weekly downloads. As such, bookstore popularity was classified as not popular.
We found that bookstore 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
Create React App is officially deprecated due to React 19 issues and lack of maintenance—developers should switch to Vite or other modern alternatives.
Security News
Oracle seeks to dismiss fraud claims in the JavaScript trademark dispute, delaying the case and avoiding questions about its right to the name.
Security News
The Linux Foundation is warning open source developers that compliance with global sanctions is mandatory, highlighting legal risks and restrictions on contributions.