![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.
@infinitaslearning/systemic-mssql
Advanced tools
Systemic mssql is a systemic component for the MS SQL. Its goal is to help you connect to a MS SQL database.
This library:
We've created this library as an alternative to the existing systemic-mssql library, which is very opiniated, and doesn't meet our needs.
import System from 'systemic'
import initDb from '@infinitaslearning/systemic-mssql'
new System()
.configure({
mssql: {
connection: 'my-connection-string',
},
})
.add('mssql', initDb())
.dependsOn('config')
.start((err, components) => {
// Do stuff with components.mssql
})
Connection in the configuration can either be a mssql connection string or a full mssql ConnectionPool config.
import { Database } from '@infinitaslearning/systemic-mssql'
interface Book {
id: string
title: string
}
const initBookStore = (database: Database) => ({
getBook: (id: string) => database.query<Book>`
SELECT *
FROM Books
WHERE id = ${id}`,
})
or
import { Database } from '@infinitaslearning/systemic-mssql'
import { bookQuery } from './queries'
const initBookStore = (database: Database) => ({
getBook: (id: string) => database.query(bookQuery(id)),
})
All query functions use mssql tagged template literals to prevent sql injection
import { sql } from '@infinitaslearning/systemic-mssql'
interface Book {
id: string
title: string
}
export bookQuery = (id: string) => sql`
SELECT *
FROM Books
WHERE id = ${id}`
If you plan to work with large amount of rows, you should always use streaming to prevent memory exhaustion issues. The streamingQuery function wraps the mssql streaming capability and exposes it as an easy to use async iterable.
import { Database, sql } from '@infinitaslearning/systemic-mssql'
const initBookStore = (database: Database) => ({
getBooks: () => database.streamingQuery(sql`SELECT * FROM Books`, { size: 500 }),
})
The second argument to the streamingQuery function is optional can be used to set the maximum size of the buffer (in number of records). When the buffer is full the request is automatically paused until all retreived records have been read.
Here's an example of using the result of a streamingQuery:
import { BookStore } from './stores'
const initBooksDomain = (store: BookStore) => ({
doSomething: async () => {
for await (const book of store.getBooks()) {
// do something with the book
}
},
})
The withTransaction function allows you to write clean code that's bundled in a single transaction that's automatically commited on success. By default the entire transaction is rolled back on error, but that behaviour can be overriden by providing and onTransactionError callback.
import { Database } from '@infinitaslearning/systemic-mssql'
const initStore = (database: Database) => ({
doSomething: () => {
database.withTransaction((transaction) => {
const request = transaction.request()
// ... execute mulitple request within same transaction and/or include other related logic
})
},
})
WithTransaction throws if an error occures while connecting to the database or starting the transaction, therefore in the error callback it's safe to assume that there's an active database connection.
import { Database } from '@infinitaslearning/systemic-mssql'
import { ISOLATION_LEVEL } from 'mssql'
const initStore = (database: Database) => ({
doSomething: () => {
database.withTransaction(
(transaction) => {
// normal transaction flow
},
{
isolationLevel: ISOLATION_LEVEL.READ_UNCOMMITTED,
onTransactionError: (error, transaction) => {
// mitigating actions
},
},
)
},
})
The onError function can be used to attach an error callback to the connection pool.
import { system } from './system'
system.start((err, components) => {
const { mssql } = components
mssql.onError((error) => {
// ... error handler
})
})
For advanced scenarios that are not supported by any of the functions, the raw mssql Request is also available from this component:
import { Database } from '@infinitaslearning/systemic-mssql'
const initBookStore = (database: Database) => ({
doAdvancedStuff: () => {
const request = database.request()
// do whatever you want with this request
},
})
FAQs
Systemic component to connect to Mssql
The npm package @infinitaslearning/systemic-mssql receives a total of 0 weekly downloads. As such, @infinitaslearning/systemic-mssql popularity was classified as not popular.
We found that @infinitaslearning/systemic-mssql demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 4 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.