
Research
PyPI Package Disguised as Instagram Growth Tool Harvests User Credentials
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
react-native-realm-wrapper
Advanced tools
With this wrapper, you can write less code when using Realm.
With this wrapper, you can write less code when using Realm.
First, install Realm:
npm install realm
Then:
npm install react-native-realm-wrapper
Import it:
import { rnrw } from 'react-native-realm-wrapper';
You don't need to worry about opening and closing realms because everything is done automatically. All operations can be performed without calling any additional function.
This wrapper supports only the functions listed here. If you need anything else, you can always use Realm directly.
All functions return a promise with a success or error message or the query results.
Here, schemas are arrays, not objects, and they have the following elements: schema name, properties, and encryption key (optional). The id property is always required, and it must be an integer representing the primary key.
const schema = ["Cars", {id: "int", model: "string", color: "string", year: "int"}];
The id will automatically be used as the primary key.
With the same function, you can create new objects or edit existing ones. If you pass a new id, it'll be a new object, and if you pass an existing id, the object properties will be updated with the new values provided.
The id property must be unique per object. Objects from different schemas can have the same id.
rnrw.write(schema, properties);
Example:
const schema = ["Cars", {id: "int", model: "string", color: "string", year: "int"}];
rnrw.write(schema, {id: 1, model: "Honda Pilot", color: "Blue Pearl", year: 2022});
To delete an object, you must pass its id.
rnrw.del(schema, id);
Example:
const schema = ["Cars", {id: "int", model: "string", color: "string", year: "int"}];
rnrw.del(schema, 1);
It deletes all objects in a schema.
rnrw.delT(schema);
Example:
const schema = ["Cars", {id: "int", model: "string", color: "string", year: "int"}];
rnrw.delT(schema);
It deletes all objects from all schemas.
rnrw.delAll();
If you're using an encryption key, it must be passed as an argument.
rnrw.delAll(key);
rnrw.pk(schema, id);
Example:
const schema = ["Cars", {id: "int", model: "string", color: "string", year: "int"}];
rnrw.pk(schema, 1).then(obj => {});
It returns all objects in a schema.
rnrw.ot(schema).then(obj => {});
You can sort the objects by any property. In the example below, we're sorting them by model in ascending order:
rnrw.ot(schema, "model").then(obj => {});
To sort in descending order, pass true as the third argument.
Since every object in a schema must have a unique id, you can use the following function to find the next available one:
rnrw.nextID(schema).then(id => {});
To add or remove properties, use the following function passing the modified schema and the new schema version as arguments. The standard version is zero, so if you're making changes for the first time, you can set it to 1.
rnrw.schema(schema, newVersion);
Example:
// Original schema: ["Cars", {id: "int", model: "string", color: "string", year: "int"}];
// Modified schema:
const schema = ["Cars", {id: "int", brand: "string", model: "string", color: "string", year: "int"}];
rnrw.schema(schema, 1);
As you can see, when you add or remove properties, you need to set a new schema version greater than the previous one, and it comes with some changes too. Let's see what happens when the schema version changes:
The schema array will require two additional elements
The fourth element must always be the new schema version, and the third one will depend on whether you're using an encryption key. If you're using it, pass the key, and if not, pass null.
With encryption key:
const schema = [name, properties, key, schemaVersion];
Without encryption key:
const schema = [name, properties, null, schemaVersion];
All schemas in Realm use the same schema version. Even if you're changing the properties of only one schema, the other ones will follow the same rule.
The delAll() function will require two arguments
The second argument must always be the new schema version, and the first one will depend on whether you're using an encryption key. If you're using it, pass the key, and if not, pass null.
With encryption key:
rnrw.delAll(key, schemaVersion);
Without encryption key:
rnrw.delAll(null, schemaVersion);
If you're starting a new project, you can opt for encryption. Unfortunately, there's no easy way of encrypting an existing Realm database. Bear in mind that, although you first pass the key in only one schema array, all future schemas will be encrypted too, and you must use the key with all of them.
To learn more about how encryption works with Realm, read their page https://docs.mongodb.com/realm/sdk/react-native/advanced/encrypt/.
FAQs
With this wrapper, you can write less code when using Realm.
The npm package react-native-realm-wrapper receives a total of 0 weekly downloads. As such, react-native-realm-wrapper popularity was classified as not popular.
We found that react-native-realm-wrapper 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.
Research
A deceptive PyPI package posing as an Instagram growth tool collects user credentials and sends them to third-party bot services.
Product
Socket now supports pylock.toml, enabling secure, reproducible Python builds with advanced scanning and full alignment with PEP 751's new standard.
Security News
Research
Socket uncovered two npm packages that register hidden HTTP endpoints to delete all files on command.