![Create React App Officially Deprecated Amid React 19 Compatibility Issues](https://cdn.sanity.io/images/cgdhsj6q/production/04fa08cf844d798abc0e1a6391c129363cc7e2ab-1024x1024.webp?w=400&fit=max&auto=format)
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.
@ovotech/potygen-pg-stream
Advanced tools
Perform streaming query with @ovotech/potygen.
Supports:
Allows you to use Cursor to split up a big query response and retrieve only a subsection of it at a time, efficiently iterating through it. And helps integrating with other tools that use generators / node-streams.
The simplest of the helpers just calls a callback for each "batch" of items until all the results have been exhaousted.
const productsQuery = toEachBatch(sql`SELECT product FROM orders WHERE region = $region`, { batchSize: 2 });
await productsQuery(db, { region: 'Sofia' }, async (batch) => {
console.log(batch);
});
Utilizing javascript's async iterators you can iterate through the results by keeping only a single batch in memory, using the humble for of loop.
const productsQuery = toAsyncIterator(sql`SELECT product FROM orders WHERE region = $region`, { batchSize: 2 });
for await (const item of productsQuery(db, { region: 'Sofia' })) {
console.log(item);
}
The same as the toAsyncIterator
, but keeps the batches intact and retrieves them whole.
const productsQuery = toAsyncBatchIterator(sql`SELECT product FROM orders WHERE region = $region`, { batchSize: 2 });
for await (const batch of productsQuery(db, { region: 'Sofia' })) {
console.log(batch);
}
You can also utilize node streams to process the data either in batches or one by one
const productsQuery = toReadable(sql`SELECT product FROM orders WHERE region = $region`, { batchSize: 2 });
const sink = new Writable({
objectMode: true,
write: (chunk, encoding, callback) => {
console.log(chunk);
callback();
},
});
const source = productsQuery(db, { region: 'Sofia' });
await asyncPipeline(source, sink);
console.log('Done');
All of the streaming helpers support mapped queries, and the map will be executed on each batch after its retrieval.
const productsQuery = sql<MyQuery>`SELECT product FROM orders WHERE region = $region`;
const mappedProductsQuery = mapResult(
(rows) => rows.map((row) => ({ ...row, productLength: row.product.length })),
productsQuery,
);
const secondMappedProductsQuery = mapResult(
(rows) => rows.map((row) => ({ ...row, productLengthSquare: Math.pow(row.productLength, 2) })),
mappedProductsQuery,
);
const productsIterator = toAsyncIterator(secondMappedProductsQuery, { batchSize: 2 });
for await (const item of productsIterator(db, { region: 'Sofia' })) {
console.log(item);
}
FAQs
Streaming queries for potygen
The npm package @ovotech/potygen-pg-stream receives a total of 3,039 weekly downloads. As such, @ovotech/potygen-pg-stream popularity was classified as popular.
We found that @ovotech/potygen-pg-stream demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers 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.