Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
@supabase/postgrest-js
Advanced tools
@supabase/postgrest-js is a JavaScript client library for interacting with PostgREST APIs. It allows you to perform CRUD operations, filter data, and manage real-time subscriptions with ease. This package is particularly useful for developers working with Supabase, a backend-as-a-service platform that provides a PostgREST API for interacting with PostgreSQL databases.
CRUD Operations
This feature allows you to perform basic CRUD (Create, Read, Update, Delete) operations on your database tables. The code sample demonstrates how to insert a new record, read records, update a record, and delete a record from a 'users' table.
const { createClient } = require('@supabase/postgrest-js');
const client = createClient('https://your-project.supabase.co', 'public-anon-key');
// Create a new record
client.from('users').insert({ username: 'johndoe', age: 30 }).then(response => console.log(response));
// Read records
client.from('users').select('*').then(response => console.log(response));
// Update a record
client.from('users').update({ age: 31 }).eq('username', 'johndoe').then(response => console.log(response));
// Delete a record
client.from('users').delete().eq('username', 'johndoe').then(response => console.log(response));
Filtering Data
This feature allows you to filter data based on specific conditions. The code sample demonstrates how to filter records where the age is 30 and how to use advanced filtering with multiple conditions.
const { createClient } = require('@supabase/postgrest-js');
const client = createClient('https://your-project.supabase.co', 'public-anon-key');
// Filter records
client.from('users').select('*').eq('age', 30).then(response => console.log(response));
// Advanced filtering
client.from('users').select('*').or('age.eq.30,username.eq.johndoe').then(response => console.log(response));
Real-time Subscriptions
This feature allows you to subscribe to real-time changes in your database tables. The code sample demonstrates how to set up a subscription to listen for any changes in the 'users' table and log the changes to the console.
const { createClient } = require('@supabase/postgrest-js');
const client = createClient('https://your-project.supabase.co', 'public-anon-key');
// Subscribe to changes in the 'users' table
const subscription = client.from('users').on('*', payload => {
console.log('Change received!', payload);
}).subscribe();
The 'pg' package is a PostgreSQL client for Node.js. It allows you to interact with PostgreSQL databases using SQL queries. Unlike @supabase/postgrest-js, which provides a higher-level abstraction for CRUD operations and real-time subscriptions, 'pg' requires you to write raw SQL queries and manage connections manually.
Knex.js is a SQL query builder for Node.js, supporting multiple database types including PostgreSQL. It provides a more flexible and powerful way to build SQL queries compared to @supabase/postgrest-js. However, it does not offer built-in real-time subscriptions and requires more setup for basic CRUD operations.
Sequelize is a promise-based Node.js ORM for various SQL databases, including PostgreSQL. It provides a higher-level abstraction for database operations, similar to @supabase/postgrest-js, but with more features like model definitions, associations, and migrations. However, it does not natively support real-time subscriptions.
Isomorphic JavaScript client for PostgREST. The goal of this library is to make an "ORM-like" restful interface.
Ready for production! Watch and star this repo to keep updated on releases.
Visit our wiki to get started!
This repo is liscenced under MIT.
We are building the features of Firebase using enterprise-grade, open source products. We support existing communities wherever possible, and if the products don’t exist we build them and open source them ourselves. Thanks to these sponsors who are making the OSS ecosystem better for everyone.
FAQs
Isomorphic PostgREST client
The npm package @supabase/postgrest-js receives a total of 366,560 weekly downloads. As such, @supabase/postgrest-js popularity was classified as popular.
We found that @supabase/postgrest-js 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.